Blender V5.3
physics_fluid.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10#include <cstring>
11#include <sys/stat.h>
12
13#include "MEM_guardedalloc.h"
14
15/* types */
16#include "DNA_object_types.h"
17
18#include "BLI_fileops.hh"
19#include "BLI_path_utils.hh"
20#include "BLI_string.hh"
21#include "BLI_string_utf8.hh"
22#include "BLI_time.hh"
23#include "BLI_utildefines.hh"
24
25#include "BLT_translation.hh"
26
27#include "BKE_context.hh"
28#include "BKE_fluid.h"
29#include "BKE_global.hh"
30#include "BKE_main.hh"
31#include "BKE_modifier.hh"
32#include "BKE_report.hh"
33#include "BKE_screen.hh"
34
35#include "DEG_depsgraph.hh"
36
37#include "ED_object.hh"
38#include "ED_screen.hh"
39
40#include "WM_api.hh"
41#include "WM_types.hh"
42
43#include "physics_intern.hh" /* own include */
44
45#include "DNA_fluid_types.h"
46#include "DNA_scene_types.h"
47
48namespace blender {
49
50#define FLUID_JOB_BAKE_ALL "FLUID_OT_bake_all"
51#define FLUID_JOB_BAKE_DATA "FLUID_OT_bake_data"
52#define FLUID_JOB_BAKE_NOISE "FLUID_OT_bake_noise"
53#define FLUID_JOB_BAKE_MESH "FLUID_OT_bake_mesh"
54#define FLUID_JOB_BAKE_PARTICLES "FLUID_OT_bake_particles"
55#define FLUID_JOB_BAKE_GUIDES "FLUID_OT_bake_guides"
56#define FLUID_JOB_FREE_ALL "FLUID_OT_free_all"
57#define FLUID_JOB_FREE_DATA "FLUID_OT_free_data"
58#define FLUID_JOB_FREE_NOISE "FLUID_OT_free_noise"
59#define FLUID_JOB_FREE_MESH "FLUID_OT_free_mesh"
60#define FLUID_JOB_FREE_PARTICLES "FLUID_OT_free_particles"
61#define FLUID_JOB_FREE_GUIDES "FLUID_OT_free_guides"
62#define FLUID_JOB_BAKE_PAUSE "FLUID_OT_pause_bake"
63
64struct FluidJob {
65 /* from wmJob */
66 void *owner;
67 bool *stop, *do_update;
68 float *progress;
69 const char *type;
70 const char *name;
71
74 Depsgraph *depsgraph;
76
78
80 double start;
81
83};
84
85static inline bool fluid_is_bake_all(FluidJob *job)
86{
87 return STREQ(job->type, FLUID_JOB_BAKE_ALL);
88}
89static inline bool fluid_is_bake_data(FluidJob *job)
90{
91 return STREQ(job->type, FLUID_JOB_BAKE_DATA);
92}
93static inline bool fluid_is_bake_noise(FluidJob *job)
94{
95 return STREQ(job->type, FLUID_JOB_BAKE_NOISE);
96}
97static inline bool fluid_is_bake_mesh(FluidJob *job)
98{
99 return STREQ(job->type, FLUID_JOB_BAKE_MESH);
100}
101static inline bool fluid_is_bake_particle(FluidJob *job)
102{
103 return STREQ(job->type, FLUID_JOB_BAKE_PARTICLES);
104}
105static inline bool fluid_is_bake_guiding(FluidJob *job)
106{
107 return STREQ(job->type, FLUID_JOB_BAKE_GUIDES);
108}
109static inline bool fluid_is_free_all(FluidJob *job)
110{
111 return STREQ(job->type, FLUID_JOB_FREE_ALL);
112}
113static inline bool fluid_is_free_data(FluidJob *job)
114{
115 return STREQ(job->type, FLUID_JOB_FREE_DATA);
116}
117static inline bool fluid_is_free_noise(FluidJob *job)
118{
119 return STREQ(job->type, FLUID_JOB_FREE_NOISE);
120}
121static inline bool fluid_is_free_mesh(FluidJob *job)
122{
123 return STREQ(job->type, FLUID_JOB_FREE_MESH);
124}
125static inline bool fluid_is_free_particles(FluidJob *job)
126{
127 return STREQ(job->type, FLUID_JOB_FREE_PARTICLES);
128}
129static inline bool fluid_is_free_guiding(FluidJob *job)
130{
131 return STREQ(job->type, FLUID_JOB_FREE_GUIDES);
132}
133
134static bool fluid_job_init(
135 bContext *C, FluidJob *job, wmOperator *op, char *error_msg, int error_msg_maxncpy)
136{
137 FluidModifierData *fmd = nullptr;
140
142 if (!fmd) {
143 BLI_strncpy_utf8(error_msg, N_("No Fluid modifier found"), error_msg_maxncpy);
144 return false;
145 }
146 fds = fmd->domain;
147 if (!fds) {
148 BLI_strncpy_utf8(error_msg, N_("Invalid domain"), error_msg_maxncpy);
149 return false;
150 }
153 {
154 BKE_report(op->reports, RPT_ERROR, "Pending bake jobs found");
155 return false;
156 }
157
158 job->bmain = CTX_data_main(C);
159 job->scene = CTX_data_scene(C);
161 job->ob = ob;
162 job->fmd = fmd;
163 job->type = op->type->idname;
164 job->name = op->type->name;
165
166 return true;
167}
168
169static bool fluid_validate_paths(FluidJob *job, ReportList *reports)
170{
171 FluidDomainSettings *fds = job->fmd->domain;
172 char temp_dir[FILE_MAX];
173 temp_dir[0] = '\0';
174 bool is_relative = false;
175
176 const char *relbase = BKE_modifier_path_relbase(job->bmain, job->ob);
177
178 /* We do not accept empty paths, they can end in random places silently, see #51176. */
179 if (fds->cache_directory[0] == '\0') {
180 char cache_name[64];
181 BKE_fluid_cache_new_name_for_current_session(sizeof(cache_name), cache_name);
182 BKE_modifier_path_init(fds->cache_directory, sizeof(fds->cache_directory), cache_name);
183 BKE_reportf(reports,
185 "Fluid: Empty cache path, reset to default '%s'",
186 fds->cache_directory);
187 }
188
189 BLI_strncpy(temp_dir, fds->cache_directory, FILE_MAXDIR);
190 is_relative = BLI_path_abs(temp_dir, relbase);
191
192 /* Ensure whole path exists */
193 const bool dir_exists = BLI_dir_create_recursive(temp_dir);
194
195 /* We change path to some presumably valid default value, but do not allow bake process to
196 * continue, this gives user chance to set manually another path. */
197 if (!dir_exists) {
198 char cache_name[64];
199 BKE_fluid_cache_new_name_for_current_session(sizeof(cache_name), cache_name);
200 BKE_modifier_path_init(fds->cache_directory, sizeof(fds->cache_directory), cache_name);
201
202 BKE_reportf(reports,
203 RPT_ERROR,
204 "Fluid: Could not create cache directory '%s', reset to default '%s'",
205 temp_dir,
206 fds->cache_directory);
207
208 /* Ensure whole path exists and is writable. */
209 if (!BLI_dir_create_recursive(temp_dir)) {
210 BKE_reportf(reports,
211 RPT_ERROR,
212 "Fluid: Could not use default cache directory '%s', "
213 "please define a valid cache path manually",
214 temp_dir);
215 return false;
216 }
217 /* Copy final dir back into domain settings */
218 BLI_strncpy(fds->cache_directory, temp_dir, FILE_MAXDIR);
219
220 return false;
221 }
222
223 /* Change path back to is original state (ie relative or absolute). */
224 if (is_relative) {
225 BLI_path_rel(temp_dir, relbase);
226 }
227
228 /* Copy final dir back into domain settings */
229 BLI_strncpy(fds->cache_directory, temp_dir, FILE_MAXDIR);
230 return true;
231}
232
233static void fluid_job_free(void *customdata)
234{
235 FluidJob *job = static_cast<FluidJob *>(customdata);
236 MEM_delete(job);
237}
238
240{
241 FluidJob *job = MEM_new_uninitialized<FluidJob>("FluidJob");
242 char error_msg[256] = "\0";
243
244 if (!fluid_job_init(C, job, op, error_msg, sizeof(error_msg))) {
245 if (error_msg[0]) {
246 BKE_report(op->reports, RPT_ERROR, error_msg);
247 }
248 fluid_job_free(job);
249 return nullptr;
250 }
251 if (!fluid_validate_paths(job, op->reports)) {
252 fluid_job_free(job);
253 return nullptr;
254 }
256 return job;
257}
258
260{
261 FluidDomainSettings *fds = job->fmd->domain;
262 Scene *scene = job->scene;
263 int frame = 1, orig_frame;
264 int frames;
265 int *pause_frame = nullptr;
266 bool is_first_frame;
267
268 frames = fds->cache_frame_end - fds->cache_frame_start + 1;
269
270 if (frames <= 0) {
271 STRNCPY_UTF8(fds->error, N_("No frames to bake"));
272 return;
273 }
274
275 /* Show progress bar. */
276 if (job->do_update) {
277 *(job->do_update) = true;
278 }
279
280 /* Get current pause frame (pointer) - depending on bake type. */
281 pause_frame = job->pause_frame;
282
283 /* Set frame to start point (depending on current pause frame value). */
284 is_first_frame = ((*pause_frame) == 0);
285 frame = is_first_frame ? fds->cache_frame_start : (*pause_frame);
286
287 /* Save orig frame and update scene frame. */
288 orig_frame = scene->r.cfra;
289 scene->r.cfra = frame;
290
291 /* Loop through selected frames. */
292 for (; frame <= fds->cache_frame_end; frame++) {
293 const float progress = (frame - fds->cache_frame_start) / float(frames);
294
295 /* Keep track of pause frame - needed to init future loop. */
296 (*pause_frame) = frame;
297
298 /* If user requested stop, quit baking. */
299 if (G.is_break) {
300 job->success = 0;
301 return;
302 }
303
304 /* Update progress bar. */
305 if (job->do_update) {
306 *(job->do_update) = true;
307 }
308 if (job->progress) {
309 *(job->progress) = progress;
310 }
311
312 scene->r.cfra = frame;
313
314 /* Update animation system. */
316
317 /* If user requested stop, quit baking. */
318 if (G.is_break) {
319 job->success = 0;
320 return;
321 }
322 }
323
324 /* Restore frame position that we were on before bake. */
325 scene->r.cfra = orig_frame;
326}
327
328static void fluid_bake_endjob(void *customdata)
329{
330 FluidJob *job = static_cast<FluidJob *>(customdata);
331 FluidDomainSettings *fds = job->fmd->domain;
332
333 if (fluid_is_bake_noise(job) || fluid_is_bake_all(job)) {
337 }
338 if (fluid_is_bake_mesh(job) || fluid_is_bake_all(job)) {
342 }
343 if (fluid_is_bake_particle(job) || fluid_is_bake_all(job)) {
347 }
348 if (fluid_is_bake_guiding(job) || fluid_is_bake_all(job)) {
352 }
353 if (fluid_is_bake_data(job) || fluid_is_bake_all(job)) {
357 }
359
360 G.is_rendering = false;
361 WM_locked_interface_set(G_MAIN->wm.first(), false);
362
363 /* Bake was successful:
364 * Report for ended bake and how long it took. */
365 if (job->success) {
366 /* Show bake info. */
368 "Fluid: %s complete (%.2fs)",
370 BLI_time_now_seconds() - job->start);
371 }
372 else {
373 if (fds->error[0] != '\0') {
375 "Fluid: %s failed at frame %d: %s",
377 *job->pause_frame,
378 fds->error);
379 }
380 else { /* User canceled the bake. */
382 "Fluid: %s canceled at frame %d!",
384 *job->pause_frame);
385 }
386 }
387}
388
389static void fluid_bake_startjob(void *customdata, wmJobWorkerStatus *worker_status)
390{
391 FluidJob *job = static_cast<FluidJob *>(customdata);
392 FluidDomainSettings *fds = job->fmd->domain;
393
394 char temp_dir[FILE_MAX];
395 const char *relbase = BKE_modifier_path_relbase_from_global(job->ob);
396
397 job->stop = &worker_status->stop;
398 job->do_update = &worker_status->do_update;
399 job->progress = &worker_status->progress;
401 job->success = 1;
402
403 G.is_break = false;
404 G.is_rendering = true;
406
407 if (fluid_is_bake_noise(job) || fluid_is_bake_all(job)) {
408 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_NOISE);
409 BLI_path_abs(temp_dir, relbase);
410 BLI_dir_create_recursive(temp_dir); /* Create 'noise' subdir if it does not exist already */
414 }
415 if (fluid_is_bake_mesh(job) || fluid_is_bake_all(job)) {
416 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_MESH);
417 BLI_path_abs(temp_dir, relbase);
418 BLI_dir_create_recursive(temp_dir); /* Create 'mesh' subdir if it does not exist already */
422 }
423 if (fluid_is_bake_particle(job) || fluid_is_bake_all(job)) {
424 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_PARTICLES);
425 BLI_path_abs(temp_dir, relbase);
426
427 /* Create 'particles' subdir if it does not exist already */
428 BLI_dir_create_recursive(temp_dir);
429
433 }
434 if (fluid_is_bake_guiding(job) || fluid_is_bake_all(job)) {
435 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_GUIDE);
436 BLI_path_abs(temp_dir, relbase);
437 BLI_dir_create_recursive(temp_dir); /* Create 'guiding' subdir if it does not exist already */
441 }
442 if (fluid_is_bake_data(job) || fluid_is_bake_all(job)) {
443 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_CONFIG);
444 BLI_path_abs(temp_dir, relbase);
445 BLI_dir_create_recursive(temp_dir); /* Create 'config' subdir if it does not exist already */
446
447 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_DATA);
448 BLI_path_abs(temp_dir, relbase);
449 BLI_dir_create_recursive(temp_dir); /* Create 'data' subdir if it does not exist already */
453
455 BLI_path_join(temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_SCRIPT);
456 BLI_path_abs(temp_dir, relbase);
457 BLI_dir_create_recursive(temp_dir); /* Create 'script' subdir if it does not exist already */
458 }
459 }
461
463
464 worker_status->do_update = true;
465 worker_status->stop = false;
466}
467
468static void fluid_free_endjob(void *customdata)
469{
470 FluidJob *job = static_cast<FluidJob *>(customdata);
471 FluidDomainSettings *fds = job->fmd->domain;
472
473 G.is_rendering = false;
474 WM_locked_interface_set(G_MAIN->wm.first(), false);
475
476 /* Reflect the now empty cache in the viewport too. */
478
479 /* Free was successful:
480 * Report for ended free job and how long it took */
481 if (job->success) {
482 /* Show free job info */
484 "Fluid: %s complete (%.2fs)",
486 BLI_time_now_seconds() - job->start);
487 }
488 else {
489 if (fds->error[0] != '\0') {
491 "Fluid: %s failed at frame %d: %s",
493 *job->pause_frame,
494 fds->error);
495 }
496 else { /* User canceled the free job */
498 "Fluid: %s canceled at frame %d!",
500 *job->pause_frame);
501 }
502 }
503}
504
505static void fluid_free_startjob(void *customdata, wmJobWorkerStatus *worker_status)
506{
507 FluidJob *job = static_cast<FluidJob *>(customdata);
508 FluidDomainSettings *fds = job->fmd->domain;
509
510 job->stop = &worker_status->stop;
511 job->do_update = &worker_status->do_update;
512 job->progress = &worker_status->progress;
514 job->success = 1;
515
516 G.is_break = false;
517 G.is_rendering = true;
519
520 int cache_map = 0;
521
522 if (fluid_is_free_data(job) || fluid_is_free_all(job)) {
525 }
526 if (fluid_is_free_noise(job) || fluid_is_free_all(job)) {
527 cache_map |= FLUID_DOMAIN_OUTDATED_NOISE;
528 }
529 if (fluid_is_free_mesh(job) || fluid_is_free_all(job)) {
530 cache_map |= FLUID_DOMAIN_OUTDATED_MESH;
531 }
534 }
535 if (fluid_is_free_guiding(job) || fluid_is_free_all(job)) {
539 }
540#ifdef WITH_FLUID
541 BKE_fluid_cache_free(fds, job->ob, cache_map);
542#else
543 UNUSED_VARS(fds);
544 UNUSED_VARS(cache_map);
545#endif
546
547 worker_status->do_update = true;
548 worker_status->stop = false;
549
550 /* Update scene so that viewport shows freed up scene */
552}
553
554/***************************** Operators ******************************/
555
557{
558 FluidJob *job = fluid_job_create(C, op);
559 if (job == nullptr) {
560 return OPERATOR_CANCELLED;
561 }
562
563 wmJobWorkerStatus worker_status = {};
564 fluid_bake_startjob(job, &worker_status);
566 fluid_job_free(job);
567
568 return OPERATOR_FINISHED;
569}
570
572{
573 FluidJob *job = fluid_job_create(C, op);
574 if (job == nullptr) {
575 return OPERATOR_CANCELLED;
576 }
577
581 "Baking fluid...",
584
587 WM_jobs_callbacks(wm_job, fluid_bake_startjob, nullptr, nullptr, fluid_bake_endjob);
588
590
593
595}
596
598{
599 /* No running blender, remove handler and pass through. */
602 }
603
604 switch (event->type) {
605 case EVT_ESCKEY:
607 default: {
608 break;
609 }
610 }
612}
613
615{
616 FluidJob *job = fluid_job_create(C, op);
617 if (job == nullptr) {
618 return OPERATOR_CANCELLED;
619 }
620
621 wmJobWorkerStatus worker_status = {};
622 fluid_free_startjob(job, &worker_status);
624 fluid_job_free(job);
625
626 return OPERATOR_FINISHED;
627}
628
630{
631 FluidJob *job = fluid_job_create(C, op);
632 if (job == nullptr) {
633 return OPERATOR_CANCELLED;
634 }
635
639 "Freeing fluid...",
642
645 WM_jobs_callbacks(wm_job, fluid_free_startjob, nullptr, nullptr, fluid_free_endjob);
646
648
651
653}
654
656{
657 /* No running blender, remove handler and pass through. */
660 }
661
662 switch (event->type) {
663 case EVT_ESCKEY:
665 default: {
666 break;
667 }
668 }
670}
671
673{
674 FluidModifierData *fmd = nullptr;
677
678 /*
679 * Get modifier data
680 */
682 if (!fmd) {
683 BKE_report(op->reports, RPT_ERROR, "Bake free failed: no Fluid modifier found");
684 return OPERATOR_CANCELLED;
685 }
686 fds = fmd->domain;
687 if (!fds) {
688 BKE_report(op->reports, RPT_ERROR, "Bake free failed: invalid domain");
689 return OPERATOR_CANCELLED;
690 }
691
692 G.is_break = true;
693
694 return OPERATOR_FINISHED;
695}
696
698{
699 /* identifiers */
700 ot->name = "Bake All";
701 ot->description = "Bake Entire Fluid Simulation";
703
704 /* API callbacks. */
705 ot->exec = fluid_bake_exec;
709}
710
712{
713 /* identifiers */
714 ot->name = "Free All";
715 ot->description = "Free Entire Fluid Simulation";
717
718 /* API callbacks. */
719 ot->exec = fluid_free_exec;
723}
724
726{
727 /* identifiers */
728 ot->name = "Bake Data";
729 ot->description = "Bake Fluid Data";
731
732 /* API callbacks. */
733 ot->exec = fluid_bake_exec;
737}
738
740{
741 /* identifiers */
742 ot->name = "Free Data";
743 ot->description = "Free Fluid Data";
745
746 /* API callbacks. */
747 ot->exec = fluid_free_exec;
749}
750
752{
753 /* identifiers */
754 ot->name = "Bake Noise";
755 ot->description = "Bake Fluid Noise";
757
758 /* API callbacks. */
759 ot->exec = fluid_bake_exec;
763}
764
766{
767 /* identifiers */
768 ot->name = "Free Noise";
769 ot->description = "Free Fluid Noise";
771
772 /* API callbacks. */
773 ot->exec = fluid_free_exec;
775}
776
778{
779 /* identifiers */
780 ot->name = "Bake Mesh";
781 ot->description = "Bake Fluid Mesh";
783
784 /* API callbacks. */
785 ot->exec = fluid_bake_exec;
789}
790
792{
793 /* identifiers */
794 ot->name = "Free Mesh";
795 ot->description = "Free Fluid Mesh";
797
798 /* API callbacks. */
799 ot->exec = fluid_free_exec;
801}
802
804{
805 /* identifiers */
806 ot->name = "Bake Particles";
807 ot->description = "Bake Fluid Particles";
809
810 /* API callbacks. */
811 ot->exec = fluid_bake_exec;
815}
816
818{
819 /* identifiers */
820 ot->name = "Free Particles";
821 ot->description = "Free Fluid Particles";
823
824 /* API callbacks. */
825 ot->exec = fluid_free_exec;
827}
828
830{
831 /* identifiers */
832 ot->name = "Bake Guides";
833 ot->description = "Bake Fluid Guiding";
835
836 /* API callbacks. */
837 ot->exec = fluid_bake_exec;
841}
842
844{
845 /* identifiers */
846 ot->name = "Free Guides";
847 ot->description = "Free Fluid Guiding";
849
850 /* API callbacks. */
851 ot->exec = fluid_free_exec;
853}
854
856{
857 /* identifiers */
858 ot->name = "Pause Bake";
859 ot->description = "Pause Bake";
861
862 /* API callbacks. */
865}
866
867} // namespace blender
#define G_MAIN
File and directory operations.
#define FILE_MAX
#define BLI_path_join(...)
#define FILE_MAXDIR
#define STRNCPY_UTF8(dst, src)
Platform independent time functions.
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
#define CTX_RPT_(context, msgid)
#define FLUID_DOMAIN_DIR_DATA
#define FLUID_DOMAIN_DIR_PARTICLES
#define FLUID_DOMAIN_DIR_MESH
#define FLUID_DOMAIN_DIR_GUIDE
#define FLUID_DOMAIN_DIR_SCRIPT
#define FLUID_DOMAIN_DIR_CONFIG
#define FLUID_DOMAIN_DIR_NOISE
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ND_MODIFIER
Definition WM_types.hh:503
#define NC_OBJECT
Definition WM_types.hh:392
#define UNUSED_VARS(...)
#define STREQ(a, b)
Object * context_active_object(const bContext *C)
BMesh Iterators.
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void BKE_fluid_cache_new_name_for_current_session(int maxlen, char *r_name)
Definition fluid.cc:5073
static bool fluid_is_bake_guiding(FluidJob *job)
void FLUID_OT_bake_all(wmOperatorType *ot)
void WM_global_reportf(eReportType type, const char *format,...)
static void fluid_bake_startjob(void *customdata, wmJobWorkerStatus *worker_status)
static wmOperatorStatus fluid_free_exec(bContext *C, wmOperator *op)
static bool fluid_is_bake_mesh(FluidJob *job)
@ RPT_WARNING
Definition BKE_report.hh:40
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition wm_jobs.cc:407
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
static void fluid_free_endjob(void *customdata)
@ REGION_DRAW_LOCK_BAKING
static bool fluid_job_init(bContext *C, FluidJob *job, wmOperator *op, char *error_msg, int error_msg_maxncpy)
static void fluid_bake_sequence(FluidJob *job)
void BKE_spacedata_draw_locks(ARegionDrawLockFlags lock_flags)
Definition screen.cc:558
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
bool BLI_dir_create_recursive(const char *dirname) ATTR_NONNULL()
Definition fileops_c.cc:416
void FLUID_OT_free_noise(wmOperatorType *ot)
@ WM_JOB_TYPE_OBJECT_SIM_FLUID
Definition WM_api.hh:2016
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void FLUID_OT_free_guides(wmOperatorType *ot)
wmWindow * CTX_wm_window(const bContext *C)
static wmOperatorStatus fluid_free_invoke(bContext *C, wmOperator *op, const wmEvent *)
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
Definition wm_jobs.cc:377
@ WM_JOB_PROGRESS
Definition WM_api.hh:1997
void WM_report_banners_cancel(Main *bmain)
void FLUID_OT_free_particles(wmOperatorType *ot)
@ FLUID_DOMAIN_EXPORT_MANTA_SCRIPT
static bool fluid_is_free_particles(FluidJob *job)
static void fluid_job_free(void *customdata)
static bool fluid_is_free_noise(FluidJob *job)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition wm_jobs.cc:498
Global G
Definition blender.cc:57
const char * BKE_modifier_path_relbase(Main *bmain, Object *ob)
void WM_locked_interface_set(wmWindowManager *wm, bool lock)
void WM_locked_interface_set_with_flags(wmWindowManager *wm, short lock_flags)
void FLUID_OT_bake_guides(wmOperatorType *ot)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
static void fluid_bake_endjob(void *customdata)
void FLUID_OT_free_data(wmOperatorType *ot)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
static bool fluid_is_bake_noise(FluidJob *job)
bool WM_jobs_has_running(const wmWindowManager *window_manager, const void *owner, const eWM_JobType type, const eWM_JobFlag exclude_flags)
Definition wm_jobs.cc:809
static bool fluid_is_free_guiding(FluidJob *job)
wmWindowManager * CTX_wm_manager(const bContext *C)
static FluidJob * fluid_job_create(bContext *C, wmOperator *op)
void FLUID_OT_bake_noise(wmOperatorType *ot)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
static void fluid_free_startjob(void *customdata, wmJobWorkerStatus *worker_status)
bool ED_operator_object_active_editable(bContext *C)
static bool fluid_is_bake_particle(FluidJob *job)
static bool fluid_validate_paths(FluidJob *job, ReportList *reports)
void FLUID_OT_free_mesh(wmOperatorType *ot)
void BKE_fluid_cache_free(struct FluidDomainSettings *fds, struct Object *ob, int cache_map)
@ FLUID_DOMAIN_BAKED_PARTICLES
@ FLUID_DOMAIN_BAKED_GUIDE
@ FLUID_DOMAIN_BAKED_NOISE
@ FLUID_DOMAIN_OUTDATED_MESH
@ FLUID_DOMAIN_BAKED_DATA
@ FLUID_DOMAIN_OUTDATED_NOISE
@ FLUID_DOMAIN_BAKING_NOISE
@ FLUID_DOMAIN_BAKING_MESH
@ FLUID_DOMAIN_OUTDATED_GUIDE
@ FLUID_DOMAIN_BAKED_MESH
@ FLUID_DOMAIN_OUTDATED_PARTICLES
@ FLUID_DOMAIN_BAKING_PARTICLES
@ FLUID_DOMAIN_BAKING_DATA
@ FLUID_DOMAIN_OUTDATED_DATA
@ FLUID_DOMAIN_BAKING_GUIDE
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void ED_update_for_newframe(Main *bmain, Depsgraph *depsgraph)
static bool fluid_is_free_data(FluidJob *job)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void FLUID_OT_free_all(wmOperatorType *ot)
Main * CTX_data_main(const bContext *C)
static bool fluid_is_free_mesh(FluidJob *job)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
Definition wm_jobs.cc:228
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
void FLUID_OT_bake_mesh(wmOperatorType *ot)
double BLI_time_now_seconds()
Definition time.cc:30
static wmOperatorStatus fluid_free_modal(bContext *C, wmOperator *, const wmEvent *event)
Scene * CTX_data_scene(const bContext *C)
static wmOperatorStatus fluid_bake_exec(bContext *C, wmOperator *op)
void FLUID_OT_bake_data(wmOperatorType *ot)
static bool fluid_is_bake_data(FluidJob *job)
static wmOperatorStatus fluid_bake_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool fluid_is_bake_all(FluidJob *job)
const char * BKE_modifier_path_relbase_from_global(Object *ob)
void BKE_modifier_path_init(char *path, int path_maxncpy, const char *name)
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote, void(*timer_step)(void *))
Definition wm_jobs.cc:393
static wmOperatorStatus fluid_bake_modal(bContext *C, wmOperator *, const wmEvent *event)
void FLUID_OT_bake_particles(wmOperatorType *ot)
static bool fluid_is_free_all(FluidJob *job)
void FLUID_OT_pause_bake(wmOperatorType *ot)
static wmOperatorStatus fluid_pause_exec(bContext *C, wmOperator *op)
#define FLUID_JOB_FREE_DATA
#define FLUID_JOB_BAKE_GUIDES
#define FLUID_JOB_BAKE_ALL
#define FLUID_JOB_FREE_MESH
#define FLUID_JOB_FREE_ALL
#define FLUID_JOB_BAKE_PAUSE
#define FLUID_JOB_BAKE_NOISE
#define FLUID_JOB_FREE_PARTICLES
#define FLUID_JOB_BAKE_PARTICLES
#define FLUID_JOB_FREE_NOISE
#define FLUID_JOB_FREE_GUIDES
#define FLUID_JOB_BAKE_DATA
#define FLUID_JOB_BAKE_MESH
eFluidDomain_CacheFlag cache_flag
const char * name
FluidModifierData * fmd
const char * type
Depsgraph * depsgraph
struct FluidDomainSettings * domain
struct RenderData r
wmEventType type
Definition WM_types.hh:817
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1157
struct ReportList * reports
struct wmOperatorType * type
#define N_(msgid)