Blender V5.0
rna_fluid.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <climits>
10#include <cstdlib>
11
12#include "BLI_path_utils.hh"
13
14#include "RNA_define.hh"
15#include "RNA_enum_types.hh"
16
17#include "rna_internal.hh"
18
19#include "BKE_modifier.hh"
20
21#include "BLT_translation.hh"
22
23#include "DNA_fluid_types.h"
24#include "DNA_scene_types.h"
25
26#include "WM_api.hh"
27#include "WM_types.hh"
28
29#ifdef RNA_RUNTIME
30
31# include <fmt/format.h>
32
33# include "BLI_math_vector.h"
34# include "BLI_string.h"
35# include "BLI_threads.h"
36
37# include "BKE_colorband.hh"
38# include "BKE_context.hh"
39# include "BKE_fluid.h"
40# include "BKE_particle.h"
41
42# include "DEG_depsgraph.hh"
43# include "DEG_depsgraph_build.hh"
44
45# include "manta_fluid_API.h"
46
47static void rna_Fluid_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
48{
50
51 /* Needed for liquid domain objects */
52 Object *ob = (Object *)ptr->owner_id;
54}
55
56static void rna_Fluid_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
57{
58 rna_Fluid_update(bmain, scene, ptr);
60}
61
62static void rna_Fluid_datacache_reset(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
63{
64# ifdef WITH_FLUID
65 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
66 if (settings->fmd && settings->fmd->domain) {
67 Object *ob = (Object *)ptr->owner_id;
70
71 /* In replay mode, always invalidate guiding cache too. */
72 if (settings->cache_type == FLUID_DOMAIN_CACHE_REPLAY) {
73 cache_map |= FLUID_DOMAIN_OUTDATED_GUIDE;
74 }
75 BKE_fluid_cache_free(settings, ob, cache_map);
76 }
77# endif
79}
80static void rna_Fluid_noisecache_reset(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
81{
82# ifdef WITH_FLUID
83 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
84 if (settings->fmd && settings->fmd->domain) {
85 Object *ob = (Object *)ptr->owner_id;
86 int cache_map = FLUID_DOMAIN_OUTDATED_NOISE;
87 BKE_fluid_cache_free(settings, ob, cache_map);
88 }
89# endif
91}
92static void rna_Fluid_meshcache_reset(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
93{
94# ifdef WITH_FLUID
95 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
96 if (settings->fmd && settings->fmd->domain) {
97 Object *ob = (Object *)ptr->owner_id;
98 int cache_map = FLUID_DOMAIN_OUTDATED_MESH;
99 BKE_fluid_cache_free(settings, ob, cache_map);
100 }
101# endif
103}
104static void rna_Fluid_particlescache_reset(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
105{
106# ifdef WITH_FLUID
107 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
108 if (settings->fmd && settings->fmd->domain) {
109 Object *ob = (Object *)ptr->owner_id;
110 int cache_map = FLUID_DOMAIN_OUTDATED_PARTICLES;
111 BKE_fluid_cache_free(settings, ob, cache_map);
112 }
113# endif
115}
116static void rna_Fluid_guidingcache_reset(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
117{
118# ifdef WITH_FLUID
119 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
120 if (settings->fmd && settings->fmd->domain) {
121 Object *ob = (Object *)ptr->owner_id;
125 BKE_fluid_cache_free(settings, ob, cache_map);
126 }
127# endif
129}
130
131static void rna_Fluid_effector_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
132{
133# ifdef WITH_FLUID
135 settings->flags |= FLUID_EFFECTOR_NEEDS_UPDATE;
136# endif
137
138 rna_Fluid_update(bmain, scene, ptr);
139}
140
141static void rna_Fluid_flow_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
142{
143# ifdef WITH_FLUID
144 FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
145 settings->flags |= FLUID_FLOW_NEEDS_UPDATE;
146# endif
147
148 rna_Fluid_update(bmain, scene, ptr);
149}
150
151static void rna_Fluid_domain_data_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
152{
153# ifdef WITH_FLUID
154 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
155 BKE_fluid_modifier_reset(settings->fmd);
156# endif
157
158 rna_Fluid_datacache_reset(bmain, scene, ptr);
159 rna_Fluid_update(bmain, scene, ptr);
160}
161
162static void rna_Fluid_domain_noise_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
163{
164# ifdef WITH_FLUID
165 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
166 BKE_fluid_modifier_reset(settings->fmd);
167# endif
168
169 rna_Fluid_noisecache_reset(bmain, scene, ptr);
170 rna_Fluid_update(bmain, scene, ptr);
171}
172
173static void rna_Fluid_domain_mesh_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
174{
175# ifdef WITH_FLUID
176 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
177 BKE_fluid_modifier_reset(settings->fmd);
178# endif
179
180 rna_Fluid_meshcache_reset(bmain, scene, ptr);
181 rna_Fluid_update(bmain, scene, ptr);
182}
183
184static void rna_Fluid_domain_particles_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
185{
186# ifdef WITH_FLUID
187 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
188 BKE_fluid_modifier_reset(settings->fmd);
189# endif
190
191 rna_Fluid_particlescache_reset(bmain, scene, ptr);
192 rna_Fluid_update(bmain, scene, ptr);
193}
194
195static void rna_Fluid_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
196{
197# ifdef WITH_FLUID
198 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
199 BKE_fluid_modifier_reset(settings->fmd);
200# endif
201
202 rna_Fluid_dependency_update(bmain, scene, ptr);
203}
204
205static void rna_Fluid_parts_create(Main *bmain,
207 const char *pset_name,
208 const char *parts_name,
209 const char *psys_name,
210 int psys_type)
211{
212# ifndef WITH_FLUID
213 UNUSED_VARS(bmain, ptr, pset_name, parts_name, psys_name, psys_type);
214# else
215 Object *ob = (Object *)ptr->owner_id;
216 BKE_fluid_particle_system_create(bmain, ob, pset_name, parts_name, psys_name, psys_type);
217
220# endif
221}
222
223static void rna_Fluid_parts_delete(Main *bmain, PointerRNA *ptr, int ptype)
224{
225# ifndef WITH_FLUID
226 UNUSED_VARS(bmain, ptr, ptype);
227# else
228 Object *ob = (Object *)ptr->owner_id;
230
233# endif
234}
235
236static bool rna_Fluid_parts_exists(PointerRNA *ptr, int ptype)
237{
238 Object *ob = (Object *)ptr->owner_id;
239 ParticleSystem *psys;
240
241 for (psys = static_cast<ParticleSystem *>(ob->particlesystem.first); psys; psys = psys->next) {
242 if (psys->part->type == ptype) {
243 return true;
244 }
245 }
246 return false;
247}
248
249static void rna_Fluid_flip_parts_update(Main *bmain, Scene *scene, PointerRNA *ptr)
250{
251 Object *ob = (Object *)ptr->owner_id;
254 bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_FLIP);
255
256 /* Only create a particle system in liquid domain mode.
257 * Remove any remaining data from a liquid sim when switching to gas. */
258 if (fmd->domain->type != FLUID_DOMAIN_TYPE_LIQUID) {
259 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FLIP);
261 rna_Fluid_domain_data_reset(bmain, scene, ptr);
262 return;
263 }
264
265 if (ob->type == OB_MESH && !exists) {
266 rna_Fluid_parts_create(
267 bmain, ptr, "LiquidParticleSettings", "Liquid", "Liquid Particle System", PART_FLUID_FLIP);
269 }
270 else {
271 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FLIP);
273 }
274 rna_Fluid_update(bmain, scene, ptr);
275}
276
277static void rna_Fluid_spray_parts_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
278{
279 Object *ob = (Object *)ptr->owner_id;
282 bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAY);
283
284 if (ob->type == OB_MESH && !exists) {
285 rna_Fluid_parts_create(
286 bmain, ptr, "SprayParticleSettings", "Spray", "Spray Particle System", PART_FLUID_SPRAY);
288 }
289 else {
290 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAY);
292 }
293}
294
295static void rna_Fluid_bubble_parts_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
296{
297 Object *ob = (Object *)ptr->owner_id;
300 bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_BUBBLE);
301
302 if (ob->type == OB_MESH && !exists) {
303 rna_Fluid_parts_create(bmain,
304 ptr,
305 "BubbleParticleSettings",
306 "Bubbles",
307 "Bubble Particle System",
310 }
311 else {
312 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_BUBBLE);
314 }
315}
316
317static void rna_Fluid_foam_parts_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
318{
319 Object *ob = (Object *)ptr->owner_id;
322 bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_FOAM);
323
324 if (ob->type == OB_MESH && !exists) {
325 rna_Fluid_parts_create(
326 bmain, ptr, "FoamParticleSettings", "Foam", "Foam Particle System", PART_FLUID_FOAM);
328 }
329 else {
330 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAM);
332 }
333}
334
335static void rna_Fluid_tracer_parts_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
336{
337 Object *ob = (Object *)ptr->owner_id;
340 bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_TRACER);
341
342 if (ob->type == OB_MESH && !exists) {
343 rna_Fluid_parts_create(bmain,
344 ptr,
345 "TracerParticleSettings",
346 "Tracers",
347 "Tracer Particle System",
350 }
351 else {
352 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_TRACER);
354 }
355}
356
357static void rna_Fluid_combined_export_update(Main *bmain, Scene *scene, PointerRNA *ptr)
358{
359 Object *ob = (Object *)ptr->owner_id;
362
364 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAM);
365 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYBUBBLE);
366 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAMBUBBLE);
367 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAMBUBBLE);
368
369 bool exists_spray = rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAY);
370 bool exists_foam = rna_Fluid_parts_exists(ptr, PART_FLUID_FOAM);
371 bool exists_bubble = rna_Fluid_parts_exists(ptr, PART_FLUID_BUBBLE);
372
373 /* Re-add each particle type if enabled and no particle system exists for them anymore. */
374 if ((fmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) && !exists_spray) {
375 rna_Fluid_spray_parts_update(bmain, scene, ptr);
376 }
377 if ((fmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) && !exists_foam) {
378 rna_Fluid_foam_parts_update(bmain, scene, ptr);
379 }
380 if ((fmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) && !exists_bubble) {
381 rna_Fluid_bubble_parts_update(bmain, scene, ptr);
382 }
383 }
385 if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAYFOAM)) {
386
387 rna_Fluid_parts_create(bmain,
388 ptr,
389 "SprayFoamParticleSettings",
390 "Spray + Foam",
391 "Spray + Foam Particle System",
393
396
397 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAY);
398 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAM);
399 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYBUBBLE);
400 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAMBUBBLE);
401 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAMBUBBLE);
402
403 /* Re-add spray if enabled and no particle system exists for it anymore. */
404 bool exists_bubble = rna_Fluid_parts_exists(ptr, PART_FLUID_BUBBLE);
405 if ((fmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_BUBBLE) && !exists_bubble) {
406 rna_Fluid_bubble_parts_update(bmain, scene, ptr);
407 }
408 }
409 }
411 if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAYBUBBLE)) {
412
413 rna_Fluid_parts_create(bmain,
414 ptr,
415 "SprayBubbleParticleSettings",
416 "Spray + Bubbles",
417 "Spray + Bubble Particle System",
419
422
423 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAY);
424 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_BUBBLE);
425 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAM);
426 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAMBUBBLE);
427 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAMBUBBLE);
428
429 /* Re-add foam if enabled and no particle system exists for it anymore. */
430 bool exists_foam = rna_Fluid_parts_exists(ptr, PART_FLUID_FOAM);
431 if ((fmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_FOAM) && !exists_foam) {
432 rna_Fluid_foam_parts_update(bmain, scene, ptr);
433 }
434 }
435 }
437 if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_FOAMBUBBLE)) {
438
439 rna_Fluid_parts_create(bmain,
440 ptr,
441 "FoamBubbleParticleSettings",
442 "Foam + Bubble Particles",
443 "Foam + Bubble Particle System",
445
448
449 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAM);
450 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_BUBBLE);
451 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAM);
452 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYBUBBLE);
453 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAMBUBBLE);
454
455 /* Re-add foam if enabled and no particle system exists for it anymore. */
456 bool exists_spray = rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAY);
457 if ((fmd->domain->particle_type & FLUID_DOMAIN_PARTICLE_SPRAY) && !exists_spray) {
458 rna_Fluid_spray_parts_update(bmain, scene, ptr);
459 }
460 }
461 }
462 else if (fmd->domain->sndparticle_combined_export ==
464 {
465 if (ob->type == OB_MESH && !rna_Fluid_parts_exists(ptr, PART_FLUID_SPRAYFOAMBUBBLE)) {
466
467 rna_Fluid_parts_create(bmain,
468 ptr,
469 "SprayFoamBubbleParticleSettings",
470 "Spray + Foam + Bubbles",
471 "Spray + Foam + Bubble Particle System",
473
477
478 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAY);
479 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAM);
480 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_BUBBLE);
481 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYFOAM);
482 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_SPRAYBUBBLE);
483 rna_Fluid_parts_delete(bmain, ptr, PART_FLUID_FOAMBUBBLE);
484 }
485 }
486 else {
487 /* sanity check, should not occur */
488 printf("ERROR: Unexpected combined export setting encountered!");
489 }
490}
491
492static void rna_Fluid_cache_startframe_set(PointerRNA *ptr, int value)
493{
494 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
495 BKE_fluid_cache_startframe_set(settings, value);
496}
497
498static void rna_Fluid_cache_endframe_set(PointerRNA *ptr, int value)
499{
500 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
501 BKE_fluid_cache_endframe_set(settings, value);
502}
503
504static void rna_Fluid_cachetype_mesh_set(PointerRNA *ptr, int value)
505{
506 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
507 BKE_fluid_cachetype_mesh_set(settings, value);
508}
509
510static void rna_Fluid_cachetype_data_set(PointerRNA *ptr, int value)
511{
512 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
513 BKE_fluid_cachetype_data_set(settings, value);
514}
515
516static void rna_Fluid_cachetype_particle_set(PointerRNA *ptr, int value)
517{
518 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
519 BKE_fluid_cachetype_particle_set(settings, value);
520}
521
522static void rna_Fluid_cachetype_noise_set(PointerRNA *ptr, int value)
523{
524 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
525 BKE_fluid_cachetype_noise_set(settings, value);
526}
527
528static void rna_Fluid_cachetype_set(PointerRNA *ptr, int value)
529{
530 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
531
532 if (value != settings->cache_type) {
533 settings->cache_type = value;
534 settings->cache_flag = 0;
535 }
536}
537
538static void rna_Fluid_guide_parent_set(PointerRNA *ptr, PointerRNA value, ReportList * /*reports*/)
539{
541 Object *par = (Object *)value.data;
542
543 FluidModifierData *fmd_par = nullptr;
544
545 if (par != nullptr) {
547 if (fmd_par && fmd_par->domain) {
548 fds->guide_parent = static_cast<Object *>(value.data);
549 copy_v3_v3_int(fds->guide_res, fmd_par->domain->res);
550 }
551 }
552 else {
553 fds->guide_parent = nullptr;
554 }
555}
556
557static const EnumPropertyItem *rna_Fluid_cachetype_mesh_itemf(bContext * /*C*/,
558 PointerRNA * /*ptr*/,
559 PropertyRNA * /*prop*/,
560 bool *r_free)
561{
562 EnumPropertyItem *item = nullptr;
563 EnumPropertyItem tmp = {0, "", 0, "", ""};
564 int totitem = 0;
565
567 tmp.identifier = "BOBJECT";
568 tmp.name = N_("Binary Object");
569 tmp.description = N_("Binary object file format (.bobj.gz)");
570 RNA_enum_item_add(&item, &totitem, &tmp);
571
573 tmp.identifier = "OBJECT";
574 tmp.name = N_("Object");
575 tmp.description = N_("Object file format (.obj)");
576 RNA_enum_item_add(&item, &totitem, &tmp);
577
578 RNA_enum_item_end(&item, &totitem);
579 *r_free = true;
580
581 return item;
582}
583
584static const EnumPropertyItem *rna_Fluid_cachetype_volume_itemf(bContext * /*C*/,
586 PropertyRNA * /*prop*/,
587 bool *r_free)
588{
589 EnumPropertyItem *item = nullptr;
590 EnumPropertyItem tmp = {0, "", 0, "", ""};
591 int totitem = 0;
592
594 tmp.identifier = "UNI";
595 tmp.name = N_("Uni Cache");
596 tmp.description = N_("Uni file format (.uni)");
597 RNA_enum_item_add(&item, &totitem, &tmp);
598
599# ifdef WITH_OPENVDB
601 tmp.identifier = "OPENVDB";
602 tmp.name = N_("OpenVDB");
603 tmp.description = N_("OpenVDB file format (.vdb)");
604 RNA_enum_item_add(&item, &totitem, &tmp);
605# endif
606
607 /* Support for deprecated `.raw` format. */
609 if (fds->cache_data_format == FLUID_DOMAIN_FILE_RAW ||
610 fds->cache_noise_format == FLUID_DOMAIN_FILE_RAW)
611 {
612 tmp.value = FLUID_DOMAIN_FILE_RAW;
613 tmp.identifier = "RAW";
614 tmp.name = N_("Raw Cache");
615 tmp.description = N_("Raw file format (.raw)");
616 RNA_enum_item_add(&item, &totitem, &tmp);
617 }
618
619 RNA_enum_item_end(&item, &totitem);
620 *r_free = true;
621
622 return item;
623}
624
625static const EnumPropertyItem *rna_Fluid_cachetype_particle_itemf(bContext * /*C*/,
626 PointerRNA * /*ptr*/,
627 PropertyRNA * /*prop*/,
628 bool *r_free)
629{
630 EnumPropertyItem *item = nullptr;
631 EnumPropertyItem tmp = {0, "", 0, "", ""};
632 int totitem = 0;
633
635 tmp.identifier = "UNI";
636 tmp.name = N_("Uni Cache");
637 tmp.description = N_("Uni file format");
638 RNA_enum_item_add(&item, &totitem, &tmp);
639
640 RNA_enum_item_end(&item, &totitem);
641 *r_free = true;
642
643 return item;
644}
645
646static void rna_Fluid_cache_directory_set(PointerRNA *ptr, const char *value)
647{
648 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
649
650 if (STREQ(settings->cache_directory, value)) {
651 return;
652 }
653
654 STRNCPY(settings->cache_directory, value);
655
656 /* TODO(sebbas): Read cache state in order to set cache bake flags and cache pause frames
657 * correctly. */
658 // settings->cache_flag = 0;
659}
660
661static const EnumPropertyItem *rna_Fluid_cobafield_itemf(bContext * /*C*/,
663 PropertyRNA * /*prop*/,
664 bool *r_free)
665{
666 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
667
668 EnumPropertyItem *item = nullptr;
669 EnumPropertyItem tmp = {0, "", 0, "", ""};
670 int totitem = 0;
671
673 tmp.identifier = "FLAGS";
674 tmp.icon = 0;
675 tmp.name = N_("Flags");
676 tmp.description = N_("Flag grid of the fluid domain");
677 RNA_enum_item_add(&item, &totitem, &tmp);
678
680 tmp.identifier = "PRESSURE";
681 tmp.icon = 0;
682 tmp.name = N_("Pressure");
683 tmp.description = N_("Pressure field of the fluid domain");
684 RNA_enum_item_add(&item, &totitem, &tmp);
685
687 tmp.identifier = "VELOCITY_X";
688 tmp.icon = 0;
689 tmp.name = N_("X Velocity");
690 tmp.description = N_("X component of the velocity field");
691 RNA_enum_item_add(&item, &totitem, &tmp);
692
694 tmp.identifier = "VELOCITY_Y";
695 tmp.icon = 0;
696 tmp.name = N_("Y Velocity");
697 tmp.description = N_("Y component of the velocity field");
698 RNA_enum_item_add(&item, &totitem, &tmp);
699
701 tmp.identifier = "VELOCITY_Z";
702 tmp.icon = 0;
703 tmp.name = N_("Z Velocity");
704 tmp.description = N_("Z component of the velocity field");
705 RNA_enum_item_add(&item, &totitem, &tmp);
706
708 tmp.identifier = "FORCE_X";
709 tmp.icon = 0;
710 tmp.name = N_("X Force");
711 tmp.description = N_("X component of the force field");
712 RNA_enum_item_add(&item, &totitem, &tmp);
713
715 tmp.identifier = "FORCE_Y";
716 tmp.icon = 0;
717 tmp.name = N_("Y Force");
718 tmp.description = N_("Y component of the force field");
719 RNA_enum_item_add(&item, &totitem, &tmp);
720
722 tmp.identifier = "FORCE_Z";
723 tmp.icon = 0;
724 tmp.name = N_("Z Force");
725 tmp.description = N_("Z component of the force field");
726 RNA_enum_item_add(&item, &totitem, &tmp);
727
728 if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
730 tmp.identifier = "COLOR_R";
731 tmp.icon = 0;
732 tmp.name = N_("Red");
733 tmp.description = N_("Red component of the color field");
734 RNA_enum_item_add(&item, &totitem, &tmp);
735
737 tmp.identifier = "COLOR_G";
738 tmp.icon = 0;
739 tmp.name = N_("Green");
740 tmp.description = N_("Green component of the color field");
741 RNA_enum_item_add(&item, &totitem, &tmp);
742
744 tmp.identifier = "COLOR_B";
745 tmp.icon = 0;
746 tmp.name = N_("Blue");
747 tmp.description = N_("Blue component of the color field");
748 RNA_enum_item_add(&item, &totitem, &tmp);
749
751 tmp.identifier = "DENSITY";
752 tmp.icon = 0;
753 tmp.name = N_("Density");
754 tmp.description = N_("Quantity of soot in the fluid");
755 RNA_enum_item_add(&item, &totitem, &tmp);
756
758 tmp.identifier = "FLAME";
759 tmp.icon = 0;
760 tmp.name = N_("Flame");
761 tmp.description = N_("Flame field");
762 RNA_enum_item_add(&item, &totitem, &tmp);
763
765 tmp.identifier = "FUEL";
766 tmp.icon = 0;
767 tmp.name = N_("Fuel");
768 tmp.description = N_("Fuel field");
769 RNA_enum_item_add(&item, &totitem, &tmp);
770
772 tmp.identifier = "HEAT";
773 tmp.icon = 0;
774 tmp.name = N_("Heat");
775 tmp.description = N_("Temperature of the fluid");
776 RNA_enum_item_add(&item, &totitem, &tmp);
777 }
778 else if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
780 tmp.identifier = "PHI";
781 tmp.icon = 0;
782 tmp.name = N_("Fluid Level Set");
783 tmp.description = N_("Level set representation of the fluid");
784 RNA_enum_item_add(&item, &totitem, &tmp);
785
787 tmp.identifier = "PHI_IN";
788 tmp.icon = 0;
789 tmp.name = N_("Inflow Level Set");
790 tmp.description = N_("Level set representation of the inflow");
791 RNA_enum_item_add(&item, &totitem, &tmp);
792
794 tmp.identifier = "PHI_OUT";
795 tmp.icon = 0;
796 tmp.name = N_("Outflow Level Set");
797 tmp.description = N_("Level set representation of the outflow");
798 RNA_enum_item_add(&item, &totitem, &tmp);
799
801 tmp.identifier = "PHI_OBSTACLE";
802 tmp.icon = 0;
803 tmp.name = N_("Obstacle Level Set");
804 tmp.description = N_("Level set representation of the obstacles");
805 RNA_enum_item_add(&item, &totitem, &tmp);
806 }
807
808 RNA_enum_item_end(&item, &totitem);
809 *r_free = true;
810
811 return item;
812}
813
814static const EnumPropertyItem *rna_Fluid_data_depth_itemf(bContext * /*C*/,
816 PropertyRNA * /*prop*/,
817 bool *r_free)
818{
819 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
820
821 EnumPropertyItem *item = nullptr;
822 EnumPropertyItem tmp = {0, "", 0, "", ""};
823 int totitem = 0;
824
826 tmp.identifier = "32";
827 tmp.icon = 0;
828 tmp.name = N_("Full");
829 tmp.description = N_("Use 32-bit floating-point numbers for all data");
830 RNA_enum_item_add(&item, &totitem, &tmp);
831
833 tmp.identifier = "16";
834 tmp.icon = 0;
835 tmp.name = N_("Half");
836 tmp.description = N_("Use 16-bit floating-point numbers for all data");
837 RNA_enum_item_add(&item, &totitem, &tmp);
838
839 if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
841 tmp.identifier = "8";
842 tmp.icon = 0;
843 tmp.name = N_("Mini");
844 tmp.description = N_("Use 8-bit floating-point numbers where possible, otherwise use 16-bit");
845 RNA_enum_item_add(&item, &totitem, &tmp);
846 }
847
848 RNA_enum_item_end(&item, &totitem);
849 *r_free = true;
850
851 return item;
852}
853
854static void rna_Fluid_domaintype_set(PointerRNA *ptr, int value)
855{
856 FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
857 Object *ob = (Object *)ptr->owner_id;
858 BKE_fluid_domain_type_set(ob, settings, value);
860}
861
862static std::optional<std::string> rna_FluidDomainSettings_path(const PointerRNA *ptr)
863{
864 const FluidDomainSettings *settings = (FluidDomainSettings *)ptr->data;
865 const ModifierData *md = (ModifierData *)settings->fmd;
866 char name_esc[sizeof(md->name) * 2];
867
868 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
869 return fmt::format("modifiers[\"{}\"].domain_settings", name_esc);
870}
871
872static std::optional<std::string> rna_FluidFlowSettings_path(const PointerRNA *ptr)
873{
874 const FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
875 const ModifierData *md = (ModifierData *)settings->fmd;
876 char name_esc[sizeof(md->name) * 2];
877
878 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
879 return fmt::format("modifiers[\"{}\"].flow_settings", name_esc);
880}
881
882static std::optional<std::string> rna_FluidEffectorSettings_path(const PointerRNA *ptr)
883{
884 const FluidEffectorSettings *settings = (FluidEffectorSettings *)ptr->data;
885 const ModifierData *md = (ModifierData *)settings->fmd;
886 char name_esc[sizeof(md->name) * 2];
887
888 BLI_str_escape(name_esc, md->name, sizeof(name_esc));
889 return fmt::format("modifiers[\"{}\"].effector_settings", name_esc);
890}
891
892/* -------------------------------------------------------------------- */
895
896# ifdef WITH_FLUID
897
898static int rna_FluidModifier_grid_get_length(const PointerRNA *ptr,
900{
901 const FluidDomainSettings *fds = (FluidDomainSettings *)ptr->data;
902 float *density = nullptr;
903 int size = 0;
904
905 if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) {
906 /* high resolution smoke */
907 int res[3];
908
909 manta_noise_get_res(fds->fluid, res);
910 size = res[0] * res[1] * res[2];
911
912 density = manta_noise_get_density(fds->fluid);
913 }
914 else if (fds->fluid) {
915 /* regular resolution */
916 size = fds->res[0] * fds->res[1] * fds->res[2];
917 density = manta_smoke_get_density(fds->fluid);
918 }
919
920 length[0] = (density) ? size : 0;
921 return length[0];
922}
923
924static int rna_FluidModifier_color_grid_get_length(const PointerRNA *ptr,
926{
927 rna_FluidModifier_grid_get_length(ptr, length);
928
929 length[0] *= 4;
930 return length[0];
931}
932
933static int rna_FluidModifier_velocity_grid_get_length(const PointerRNA *ptr,
935{
936 const FluidDomainSettings *fds = (FluidDomainSettings *)ptr->data;
937 float *vx = nullptr;
938 float *vy = nullptr;
939 float *vz = nullptr;
940 int size = 0;
941
942 /* Velocity data is always low-resolution. */
943 if (fds->fluid) {
944 size = 3 * fds->res[0] * fds->res[1] * fds->res[2];
945 vx = manta_get_velocity_x(fds->fluid);
946 vy = manta_get_velocity_y(fds->fluid);
947 vz = manta_get_velocity_z(fds->fluid);
948 }
949
950 length[0] = (vx && vy && vz) ? size : 0;
951 return length[0];
952}
953
954static int rna_FluidModifier_heat_grid_get_length(const PointerRNA *ptr,
956{
957 const FluidDomainSettings *fds = (FluidDomainSettings *)ptr->data;
958 float *heat = nullptr;
959 int size = 0;
960
961 /* Heat data is always low-resolution. */
962 if (fds->fluid) {
963 size = fds->res[0] * fds->res[1] * fds->res[2];
964 heat = manta_smoke_get_heat(fds->fluid);
965 }
966
967 length[0] = (heat) ? size : 0;
968 return length[0];
969}
970
971static void rna_FluidModifier_density_grid_get(PointerRNA *ptr, float *values)
972{
975 int size = rna_FluidModifier_grid_get_length(ptr, length);
976 float *density;
977
978 BLI_rw_mutex_lock(static_cast<ThreadRWMutex *>(fds->fluid_mutex), THREAD_LOCK_READ);
979
980 if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) {
981 density = manta_noise_get_density(fds->fluid);
982 }
983 else {
984 density = manta_smoke_get_density(fds->fluid);
985 }
986
987 memcpy(values, density, size * sizeof(float));
988
989 BLI_rw_mutex_unlock(static_cast<ThreadRWMutex *>(fds->fluid_mutex));
990}
991
992static void rna_FluidModifier_velocity_grid_get(PointerRNA *ptr, float *values)
993{
996 int size = rna_FluidModifier_velocity_grid_get_length(ptr, length);
997 float *vx, *vy, *vz;
998 int i;
999
1000 BLI_rw_mutex_lock(static_cast<ThreadRWMutex *>(fds->fluid_mutex), THREAD_LOCK_READ);
1001
1002 vx = manta_get_velocity_x(fds->fluid);
1003 vy = manta_get_velocity_y(fds->fluid);
1004 vz = manta_get_velocity_z(fds->fluid);
1005
1006 for (i = 0; i < size; i += 3) {
1007 *(values++) = *(vx++);
1008 *(values++) = *(vy++);
1009 *(values++) = *(vz++);
1010 }
1011
1012 BLI_rw_mutex_unlock(static_cast<ThreadRWMutex *>(fds->fluid_mutex));
1013}
1014
1015static void rna_FluidModifier_color_grid_get(PointerRNA *ptr, float *values)
1016{
1019 int size = rna_FluidModifier_grid_get_length(ptr, length);
1020
1021 BLI_rw_mutex_lock(static_cast<ThreadRWMutex *>(fds->fluid_mutex), THREAD_LOCK_READ);
1022
1023 if (!fds->fluid) {
1024 memset(values, 0, size * sizeof(float));
1025 }
1026 else {
1027 if (fds->flags & FLUID_DOMAIN_USE_NOISE) {
1028 if (manta_noise_has_colors(fds->fluid)) {
1029 manta_noise_get_rgba(fds->fluid, values, 0);
1030 }
1031 else {
1032 manta_noise_get_rgba_fixed_color(fds->fluid, fds->active_color, values, 0);
1033 }
1034 }
1035 else {
1036 if (manta_smoke_has_colors(fds->fluid)) {
1037 manta_smoke_get_rgba(fds->fluid, values, 0);
1038 }
1039 else {
1040 manta_smoke_get_rgba_fixed_color(fds->fluid, fds->active_color, values, 0);
1041 }
1042 }
1043 }
1044
1045 BLI_rw_mutex_unlock(static_cast<ThreadRWMutex *>(fds->fluid_mutex));
1046}
1047
1048static void rna_FluidModifier_flame_grid_get(PointerRNA *ptr, float *values)
1049{
1052 int size = rna_FluidModifier_grid_get_length(ptr, length);
1053 float *flame;
1054
1055 BLI_rw_mutex_lock(static_cast<ThreadRWMutex *>(fds->fluid_mutex), THREAD_LOCK_READ);
1056
1057 if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) {
1058 flame = manta_noise_get_flame(fds->fluid);
1059 }
1060 else {
1061 flame = manta_smoke_get_flame(fds->fluid);
1062 }
1063
1064 if (flame) {
1065 memcpy(values, flame, size * sizeof(float));
1066 }
1067 else {
1068 memset(values, 0, size * sizeof(float));
1069 }
1070
1071 BLI_rw_mutex_unlock(static_cast<ThreadRWMutex *>(fds->fluid_mutex));
1072}
1073
1074static void rna_FluidModifier_heat_grid_get(PointerRNA *ptr, float *values)
1075{
1078 int size = rna_FluidModifier_heat_grid_get_length(ptr, length);
1079 float *heat;
1080
1081 BLI_rw_mutex_lock(static_cast<ThreadRWMutex *>(fds->fluid_mutex), THREAD_LOCK_READ);
1082
1083 heat = manta_smoke_get_heat(fds->fluid);
1084
1085 if (heat != nullptr) {
1086 /* scale heat values from -2.0-2.0 to -1.0-1.0. */
1087 for (int i = 0; i < size; i++) {
1088 values[i] = heat[i] * 0.5f;
1089 }
1090 }
1091 else {
1092 memset(values, 0, size * sizeof(float));
1093 }
1094
1095 BLI_rw_mutex_unlock(static_cast<ThreadRWMutex *>(fds->fluid_mutex));
1096}
1097
1098static void rna_FluidModifier_temperature_grid_get(PointerRNA *ptr, float *values)
1099{
1102 int size = rna_FluidModifier_grid_get_length(ptr, length);
1103 float *flame;
1104
1105 BLI_rw_mutex_lock(static_cast<ThreadRWMutex *>(fds->fluid_mutex), THREAD_LOCK_READ);
1106
1107 if (fds->flags & FLUID_DOMAIN_USE_NOISE && fds->fluid) {
1108 flame = manta_noise_get_flame(fds->fluid);
1109 }
1110 else {
1111 flame = manta_smoke_get_flame(fds->fluid);
1112 }
1113
1114 if (flame) {
1115 /* Output is such that 0..1 maps to 0..1000K */
1116 float offset = fds->flame_ignition;
1117 float scale = fds->flame_max_temp - fds->flame_ignition;
1118
1119 for (int i = 0; i < size; i++) {
1120 values[i] = (flame[i] > 0.01f) ? offset + flame[i] * scale : 0.0f;
1121 }
1122 }
1123 else {
1124 memset(values, 0, size * sizeof(float));
1125 }
1126
1127 BLI_rw_mutex_unlock(static_cast<ThreadRWMutex *>(fds->fluid_mutex));
1128}
1129# endif /* WITH_FLUID */
1130
1132
1133static void rna_FluidFlow_density_vgroup_get(PointerRNA *ptr, char *value)
1134{
1135 FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
1136 rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density);
1137}
1138
1139static int rna_FluidFlow_density_vgroup_length(PointerRNA *ptr)
1140{
1141 FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
1142 return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density);
1143}
1144
1145static void rna_FluidFlow_density_vgroup_set(PointerRNA *ptr, const char *value)
1146{
1147 FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
1148 rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density);
1149}
1150
1151static void rna_FluidFlow_uvlayer_set(PointerRNA *ptr, const char *value)
1152{
1153 FluidFlowSettings *flow = (FluidFlowSettings *)ptr->data;
1154 rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name));
1155}
1156
1157static void rna_Fluid_use_color_ramp_set(PointerRNA *ptr, bool value)
1158{
1160
1161 fds->use_coba = value;
1162
1163 if (value && fds->coba == nullptr) {
1164 fds->coba = BKE_colorband_add(false);
1165 }
1166}
1167
1168static void rna_Fluid_flowsource_set(PointerRNA *ptr, int value)
1169{
1170 FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
1171
1172 if (value != settings->source) {
1173 settings->source = value;
1174 }
1175}
1176
1177static const EnumPropertyItem *rna_Fluid_flowsource_itemf(bContext * /*C*/,
1178 PointerRNA *ptr,
1179 PropertyRNA * /*prop*/,
1180 bool *r_free)
1181{
1182 FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
1183
1184 EnumPropertyItem *item = nullptr;
1185 EnumPropertyItem tmp = {0, "", 0, "", ""};
1186 int totitem = 0;
1187
1189 tmp.identifier = "MESH";
1190 tmp.icon = ICON_META_CUBE;
1191 tmp.name = N_("Mesh");
1192 tmp.description = N_("Emit fluid from mesh surface or volume");
1193 RNA_enum_item_add(&item, &totitem, &tmp);
1194
1195 if (settings->type != FLUID_FLOW_TYPE_LIQUID) {
1197 tmp.identifier = "PARTICLES";
1198 tmp.icon = ICON_PARTICLES;
1199 tmp.name = N_("Particle System");
1200 tmp.description = N_("Emit smoke from particles");
1201 RNA_enum_item_add(&item, &totitem, &tmp);
1202 }
1203
1204 RNA_enum_item_end(&item, &totitem);
1205 *r_free = true;
1206
1207 return item;
1208}
1209
1210static void rna_Fluid_flowtype_set(PointerRNA *ptr, int value)
1211{
1212 FluidFlowSettings *settings = (FluidFlowSettings *)ptr->data;
1213
1214 if (value != settings->type) {
1215 short prev_value = settings->type;
1216 settings->type = value;
1217
1218 /* Force flow source to mesh for liquids.
1219 * Also use different surface emission. Liquids should by default not emit around surface. */
1220 if (value == FLUID_FLOW_TYPE_LIQUID) {
1221 rna_Fluid_flowsource_set(ptr, FLUID_FLOW_SOURCE_MESH);
1222 settings->surface_distance = 0.0f;
1223 }
1224 /* Use some surface emission when switching to a gas emitter. Gases should by default emit a
1225 * bit around surface. */
1226 if (prev_value == FLUID_FLOW_TYPE_LIQUID) {
1227 settings->surface_distance = 1.0f;
1228 }
1229 }
1230}
1231
1232#else
1233
1235{
1236 StructRNA *srna;
1237 PropertyRNA *prop;
1238
1239 static const EnumPropertyItem domain_types[] = {
1240 {FLUID_DOMAIN_TYPE_GAS, "GAS", 0, "Gas", "Create domain for gases"},
1241 {FLUID_DOMAIN_TYPE_LIQUID, "LIQUID", 0, "Liquid", "Create domain for liquids"},
1242 {0, nullptr, 0, nullptr, nullptr}};
1243
1244 static const EnumPropertyItem prop_compression_items[] = {
1245 {VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression"},
1246# ifdef WITH_OPENVDB_BLOSC
1248 "BLOSC",
1249 0,
1250 "Blosc",
1251 "Multithreaded compression, similar in size and quality as 'Zip'"},
1252# endif
1253 {VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression"},
1254 {0, nullptr, 0, nullptr, nullptr}};
1255
1256 static const EnumPropertyItem smoke_highres_sampling_items[] = {
1257 {SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
1258 {SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
1259 {SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""},
1260 {0, nullptr, 0, nullptr, nullptr},
1261 };
1262
1263 static const EnumPropertyItem cache_types[] = {
1264 {FLUID_DOMAIN_CACHE_REPLAY, "REPLAY", 0, "Replay", "Use the timeline to bake the scene"},
1266 "MODULAR",
1267 0,
1268 "Modular",
1269 "Bake every stage of the simulation separately"},
1270 {FLUID_DOMAIN_CACHE_ALL, "ALL", 0, "All", "Bake all simulation settings at once"},
1271 {0, nullptr, 0, nullptr, nullptr}};
1272
1273 /* OpenVDB data depth - generated dynamically based on domain type. */
1274 static const EnumPropertyItem fluid_data_depth_items[] = {
1275 {0, "NONE", 0, "", ""},
1276 {0, nullptr, 0, nullptr, nullptr},
1277 };
1278
1279 static const EnumPropertyItem fluid_mesh_quality_items[] = {
1281 "IMPROVED",
1282 0,
1283 "Final",
1284 "Use improved particle level set (slower but more precise and with mesh smoothening "
1285 "options)"},
1287 "UNION",
1288 0,
1289 "Preview",
1290 "Use union particle level set (faster but lower quality)"},
1291 {0, nullptr, 0, nullptr, nullptr},
1292 };
1293
1294 static const EnumPropertyItem fluid_guide_source_items[] = {
1296 "DOMAIN",
1297 0,
1298 "Domain",
1299 "Use a fluid domain for guiding (domain needs to be baked already so that velocities can "
1300 "be extracted). Guiding domain can be of any type (i.e. gas or liquid)."},
1302 "EFFECTOR",
1303 0,
1304 "Effector",
1305 "Use guiding (effector) objects to create fluid guiding (guiding objects should be "
1306 "animated and baked once set up completely)"},
1307 {0, nullptr, 0, nullptr, nullptr},
1308 };
1309
1310 /* Cache type - generated dynamically based on domain type. */
1311 static const EnumPropertyItem cache_file_type_items[] = {
1312 {FLUID_DOMAIN_FILE_UNI, "UNI", 0, "Uni Cache", "Uni file format (.uni)"},
1313 {FLUID_DOMAIN_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format (.vdb)"},
1314 {FLUID_DOMAIN_FILE_RAW, "RAW", 0, "Raw Cache", "Raw file format (.raw)"},
1315 {0, nullptr, 0, nullptr, nullptr},
1316 };
1317
1318 static const EnumPropertyItem interp_method_item[] = {
1319 {FLUID_DISPLAY_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
1321 "CUBIC",
1322 0,
1323 "Cubic",
1324 "Smoothed high quality interpolation, but slower"},
1325 {FLUID_DISPLAY_INTERP_CLOSEST, "CLOSEST", 0, "Closest", "No interpolation"},
1326 {0, nullptr, 0, nullptr, nullptr},
1327 };
1328
1329 static const EnumPropertyItem axis_slice_position_items[] = {
1331 "AUTO",
1332 0,
1333 "Auto",
1334 "Adjust slice direction according to the view direction"},
1335 {SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"},
1336 {SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"},
1337 {SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"},
1338 {0, nullptr, 0, nullptr, nullptr},
1339 };
1340
1341 static const EnumPropertyItem vector_draw_items[] = {
1342 {VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"},
1343 {VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"},
1344 {VECTOR_DRAW_MAC, "MAC", 0, "MAC Grid", "Display vector field as MAC grid"},
1345 {0, nullptr, 0, nullptr, nullptr},
1346 };
1347
1348 static const EnumPropertyItem vector_field_items[] = {
1350 "FLUID_VELOCITY",
1351 0,
1352 "Fluid Velocity",
1353 "Velocity field of the fluid domain"},
1355 "GUIDE_VELOCITY",
1356 0,
1357 "Guide Velocity",
1358 "Guide velocity field of the fluid domain"},
1359 {FLUID_DOMAIN_VECTOR_FIELD_FORCE, "FORCE", 0, "Force", "Force field of the fluid domain"},
1360 {0, nullptr, 0, nullptr, nullptr},
1361 };
1362
1363 static const EnumPropertyItem gridlines_color_field_items[] = {
1364 {FLUID_GRIDLINE_COLOR_TYPE_NONE, "NONE", 0, "None", "None"},
1365 {FLUID_GRIDLINE_COLOR_TYPE_FLAGS, "FLAGS", 0, "Flags", "Flag grid of the fluid domain"},
1367 "RANGE",
1368 0,
1369 "Highlight Range",
1370 "Highlight the voxels with values of the color mapped field within the range"},
1371 {0, nullptr, 0, nullptr, nullptr},
1372 };
1373
1374 static const EnumPropertyItem gridlines_cell_filter_items[] = {
1375 {FLUID_CELL_TYPE_NONE, "NONE", 0, "None", "Highlight the cells regardless of their type"},
1376 {FLUID_CELL_TYPE_FLUID, "FLUID", 0, "Fluid", "Highlight only the cells of type Fluid"},
1378 "OBSTACLE",
1379 0,
1380 "Obstacle",
1381 "Highlight only the cells of type Obstacle"},
1382 {FLUID_CELL_TYPE_EMPTY, "EMPTY", 0, "Empty", "Highlight only the cells of type Empty"},
1383 {FLUID_CELL_TYPE_INFLOW, "INFLOW", 0, "Inflow", "Highlight only the cells of type Inflow"},
1385 "OUTFLOW",
1386 0,
1387 "Outflow",
1388 "Highlight only the cells of type Outflow"},
1389 {0, nullptr, 0, nullptr, nullptr},
1390 };
1391
1392 static const EnumPropertyItem sndparticle_boundary_items[] = {
1394 "DELETE",
1395 0,
1396 "Delete",
1397 "Delete secondary particles that are inside obstacles or left the domain"},
1399 "PUSHOUT",
1400 0,
1401 "Push Out",
1402 "Push secondary particles that left the domain back into the domain"},
1403 {0, nullptr, 0, nullptr, nullptr}};
1404
1405 static const EnumPropertyItem sndparticle_combined_export_items[] = {
1407 "OFF",
1408 0,
1409 "Off",
1410 "Create a separate particle system for every secondary particle type"},
1412 "SPRAY_FOAM",
1413 0,
1414 "Spray + Foam",
1415 "Spray and foam particles are saved in the same particle system"},
1417 "SPRAY_BUBBLES",
1418 0,
1419 "Spray + Bubbles",
1420 "Spray and bubble particles are saved in the same particle system"},
1422 "FOAM_BUBBLES",
1423 0,
1424 "Foam + Bubbles",
1425 "Foam and bubbles particles are saved in the same particle system"},
1427 "SPRAY_FOAM_BUBBLES",
1428 0,
1429 "Spray + Foam + Bubbles",
1430 "Create one particle system that contains all three secondary particle types"},
1431 {0, nullptr, 0, nullptr, nullptr}};
1432
1433 static const EnumPropertyItem simulation_methods[] = {
1435 "FLIP",
1436 0,
1437 "FLIP",
1438 "Use FLIP as the simulation method (more splashy behavior)"},
1440 "APIC",
1441 0,
1442 "APIC",
1443 "Use APIC as the simulation method (more energetic and stable behavior)"},
1444 {0, nullptr, 0, nullptr, nullptr},
1445 };
1446
1447 srna = RNA_def_struct(brna, "FluidDomainSettings", nullptr);
1448 RNA_def_struct_ui_text(srna, "Domain Settings", "Fluid domain settings");
1449 RNA_def_struct_sdna(srna, "FluidDomainSettings");
1450 RNA_def_struct_path_func(srna, "rna_FluidDomainSettings_path");
1451
1452 prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
1453 RNA_def_property_struct_type(prop, "EffectorWeights");
1456 RNA_def_property_ui_text(prop, "Effector Weights", "");
1457
1458 /* object collections */
1459
1460 prop = RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
1461 RNA_def_property_pointer_sdna(prop, nullptr, "effector_group");
1462 RNA_def_property_struct_type(prop, "Collection");
1464 RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
1465 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset_dependency");
1466
1467 prop = RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE);
1468 RNA_def_property_pointer_sdna(prop, nullptr, "fluid_group");
1469 RNA_def_property_struct_type(prop, "Collection");
1471 RNA_def_property_ui_text(prop, "Fluid Collection", "Limit fluid objects to this collection");
1472 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset_dependency");
1473
1474 prop = RNA_def_property(srna, "force_collection", PROP_POINTER, PROP_NONE);
1475 RNA_def_property_pointer_sdna(prop, nullptr, "force_group");
1476 RNA_def_property_struct_type(prop, "Collection");
1478 RNA_def_property_ui_text(prop, "Force Collection", "Limit forces to this collection");
1479 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset_dependency");
1480
1481 /* grid access */
1482
1483# ifdef WITH_FLUID
1484 prop = RNA_def_property(srna, "density_grid", PROP_FLOAT, PROP_NONE);
1485 RNA_def_property_array(prop, 32);
1488 RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_grid_get_length");
1489 RNA_def_property_float_funcs(prop, "rna_FluidModifier_density_grid_get", nullptr, nullptr);
1490 RNA_def_property_ui_text(prop, "Density Grid", "Smoke density grid");
1491
1492 prop = RNA_def_property(srna, "velocity_grid", PROP_FLOAT, PROP_NONE);
1493 RNA_def_property_array(prop, 32);
1496 RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_velocity_grid_get_length");
1497 RNA_def_property_float_funcs(prop, "rna_FluidModifier_velocity_grid_get", nullptr, nullptr);
1498 RNA_def_property_ui_text(prop, "Velocity Grid", "Smoke velocity grid");
1499
1500 prop = RNA_def_property(srna, "flame_grid", PROP_FLOAT, PROP_NONE);
1501 RNA_def_property_array(prop, 32);
1504 RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_grid_get_length");
1505 RNA_def_property_float_funcs(prop, "rna_FluidModifier_flame_grid_get", nullptr, nullptr);
1506 RNA_def_property_ui_text(prop, "Flame Grid", "Smoke flame grid");
1507
1508 prop = RNA_def_property(srna, "color_grid", PROP_FLOAT, PROP_NONE);
1509 RNA_def_property_array(prop, 32);
1512 RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_color_grid_get_length");
1513 RNA_def_property_float_funcs(prop, "rna_FluidModifier_color_grid_get", nullptr, nullptr);
1514 RNA_def_property_ui_text(prop, "Color Grid", "Smoke color grid");
1515
1516 prop = RNA_def_property(srna, "heat_grid", PROP_FLOAT, PROP_NONE);
1517 RNA_def_property_array(prop, 32);
1520 RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_heat_grid_get_length");
1521 RNA_def_property_float_funcs(prop, "rna_FluidModifier_heat_grid_get", nullptr, nullptr);
1522 RNA_def_property_ui_text(prop, "Heat Grid", "Smoke heat grid");
1523
1524 prop = RNA_def_property(srna, "temperature_grid", PROP_FLOAT, PROP_NONE);
1525 RNA_def_property_array(prop, 32);
1528 RNA_def_property_dynamic_array_funcs(prop, "rna_FluidModifier_grid_get_length");
1529 RNA_def_property_float_funcs(prop, "rna_FluidModifier_temperature_grid_get", nullptr, nullptr);
1531 prop, "Temperature Grid", "Smoke temperature grid, range 0 to 1 represents 0 to 1000K");
1532# endif /* WITH_FLUID */
1533
1534 /* domain object data */
1535
1536 prop = RNA_def_property(srna,
1537 "start_point",
1538 PROP_FLOAT,
1539 PROP_XYZ); /* can change each frame when using adaptive domain */
1540 RNA_def_property_float_sdna(prop, nullptr, "p0");
1542 RNA_def_property_ui_text(prop, "p0", "Start point");
1543
1544 prop = RNA_def_property(srna,
1545 "cell_size",
1546 PROP_FLOAT,
1547 PROP_XYZ); /* can change each frame when using adaptive domain */
1549 RNA_def_property_ui_text(prop, "cell_size", "Cell Size");
1550
1551 prop = RNA_def_property(srna,
1552 "domain_resolution",
1553 PROP_INT,
1554 PROP_XYZ); /* can change each frame when using adaptive domain */
1555 RNA_def_property_int_sdna(prop, nullptr, "res");
1557 RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution");
1558
1559 /* adaptive domain options */
1560
1561 prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE);
1562 RNA_def_property_int_sdna(prop, nullptr, "adapt_res");
1563 RNA_def_property_range(prop, 0, 512);
1564 RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
1565 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1566
1567 prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
1568 RNA_def_property_int_sdna(prop, nullptr, "adapt_margin");
1569 RNA_def_property_range(prop, 2, 24);
1571 prop, "Margin", "Margin added around fluid to minimize boundary interference");
1572 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1573
1574 prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
1575 RNA_def_property_range(prop, 0.0, 1.0);
1576 RNA_def_property_ui_range(prop, 0.0, 1.0, 0.002, 6);
1578 "Threshold",
1579 "Minimum amount of fluid grid values (smoke density, fuel and heat) a "
1580 "cell can contain, before it is considered empty");
1581 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1582
1583 prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
1586 prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid");
1588 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
1589
1590 /* fluid domain options */
1591
1592 prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE);
1593 RNA_def_property_int_sdna(prop, nullptr, "maxres");
1594 RNA_def_property_range(prop, 6, 10000);
1595 RNA_def_property_ui_range(prop, 24, 10000, 2, -1);
1597 prop,
1598 "Maximum Resolution",
1599 "Resolution used for the fluid domain. Value corresponds to the longest domain side "
1600 "(resolution for other domain sides is calculated automatically).");
1602 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
1603
1604 prop = RNA_def_property(srna, "use_collision_border_front", PROP_BOOLEAN, PROP_NONE);
1605 RNA_def_property_boolean_sdna(prop, nullptr, "border_collisions", FLUID_DOMAIN_BORDER_FRONT);
1606 RNA_def_property_ui_text(prop, "Front", "Enable collisions with front domain border");
1607 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1608
1609 prop = RNA_def_property(srna, "use_collision_border_back", PROP_BOOLEAN, PROP_NONE);
1610 RNA_def_property_boolean_sdna(prop, nullptr, "border_collisions", FLUID_DOMAIN_BORDER_BACK);
1611 RNA_def_property_ui_text(prop, "Back", "Enable collisions with back domain border");
1612 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1613
1614 prop = RNA_def_property(srna, "use_collision_border_right", PROP_BOOLEAN, PROP_NONE);
1615 RNA_def_property_boolean_sdna(prop, nullptr, "border_collisions", FLUID_DOMAIN_BORDER_RIGHT);
1616 RNA_def_property_ui_text(prop, "Right", "Enable collisions with right domain border");
1617 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1618
1619 prop = RNA_def_property(srna, "use_collision_border_left", PROP_BOOLEAN, PROP_NONE);
1620 RNA_def_property_boolean_sdna(prop, nullptr, "border_collisions", FLUID_DOMAIN_BORDER_LEFT);
1621 RNA_def_property_ui_text(prop, "Left", "Enable collisions with left domain border");
1622 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1623
1624 prop = RNA_def_property(srna, "use_collision_border_top", PROP_BOOLEAN, PROP_NONE);
1625 RNA_def_property_boolean_sdna(prop, nullptr, "border_collisions", FLUID_DOMAIN_BORDER_TOP);
1626 RNA_def_property_ui_text(prop, "Top", "Enable collisions with top domain border");
1627 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1628
1629 prop = RNA_def_property(srna, "use_collision_border_bottom", PROP_BOOLEAN, PROP_NONE);
1630 RNA_def_property_boolean_sdna(prop, nullptr, "border_collisions", FLUID_DOMAIN_BORDER_BOTTOM);
1631 RNA_def_property_ui_text(prop, "Bottom", "Enable collisions with bottom domain border");
1632 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1633
1634 prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
1635 RNA_def_property_float_sdna(prop, nullptr, "gravity");
1636 RNA_def_property_array(prop, 3);
1637 RNA_def_property_range(prop, -1000.1, 1000.1);
1638 RNA_def_property_ui_text(prop, "Gravity", "Gravity in X, Y and Z direction");
1639 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1640
1641 prop = RNA_def_property(srna, "domain_type", PROP_ENUM, PROP_NONE);
1642 RNA_def_property_enum_sdna(prop, nullptr, "type");
1643 RNA_def_property_enum_items(prop, domain_types);
1644 RNA_def_property_enum_funcs(prop, nullptr, "rna_Fluid_domaintype_set", nullptr);
1645 RNA_def_property_ui_text(prop, "Domain Type", "Change domain type of the simulation");
1647 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_flip_parts_update");
1648
1649 prop = RNA_def_property(srna, "delete_in_obstacle", PROP_BOOLEAN, PROP_NONE);
1651 RNA_def_property_ui_text(prop, "Clear In Obstacle", "Delete fluid inside obstacles");
1652 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1653
1654 /* smoke domain options */
1655
1656 prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
1657 RNA_def_property_float_sdna(prop, nullptr, "alpha");
1658 RNA_def_property_range(prop, -5.0, 5.0);
1659 RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
1661 prop,
1662 "Buoyancy Density",
1663 "Buoyant force based on smoke density (higher value results in faster rising smoke)");
1664 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1665
1666 prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
1667 RNA_def_property_float_sdna(prop, nullptr, "beta");
1668 RNA_def_property_range(prop, -5.0, 5.0);
1669 RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
1671 prop,
1672 "Buoyancy Heat",
1673 "Buoyant force based on smoke heat (higher value results in faster rising smoke)");
1674 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1675
1676 prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
1677 RNA_def_property_int_sdna(prop, nullptr, "diss_speed");
1678 RNA_def_property_range(prop, 1.0, 10000.0);
1679 RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1);
1681 prop,
1682 "Dissolve Speed",
1683 "Determine how quickly the smoke dissolves (lower value makes smoke disappear faster)");
1684 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1685
1686 prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
1687 RNA_def_property_float_sdna(prop, nullptr, "vorticity");
1688 RNA_def_property_range(prop, 0.0, 4.0);
1689 RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence and rotation in smoke");
1690 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1691
1692 prop = RNA_def_property(srna, "highres_sampling", PROP_ENUM, PROP_NONE);
1693 RNA_def_property_enum_items(prop, smoke_highres_sampling_items);
1694 RNA_def_property_ui_text(prop, "Emitter", "Method for sampling the high resolution flow");
1695 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1696
1697 prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
1699 RNA_def_property_ui_text(prop, "Dissolve Smoke", "Let smoke disappear over time");
1700 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1701
1702 prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
1705 prop,
1706 "Logarithmic Dissolve",
1707 "Dissolve smoke in a logarithmic fashion. Dissolves quickly at first, but lingers longer.");
1708 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1709
1710 /* flame options */
1711
1712 prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE);
1713 RNA_def_property_range(prop, 0.01, 4.0);
1714 RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
1716 prop, "Speed", "Speed of the burning reaction (higher value results in smaller flames)");
1717 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1718
1719 prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
1720 RNA_def_property_range(prop, 0.0, 8.0);
1721 RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
1722 RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
1723 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1724
1725 prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_NONE);
1726 RNA_def_property_range(prop, 0.0, 2.0);
1727 RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
1728 RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
1729 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1730
1731 prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
1732 RNA_def_property_range(prop, 0.5, 5.0);
1733 RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
1735 prop,
1736 "Minimum",
1737 "Minimum temperature of the flames (higher value results in faster rising flames)");
1738 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1739
1740 prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
1741 RNA_def_property_range(prop, 1.0, 10.0);
1742 RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
1744 prop,
1745 "Maximum",
1746 "Maximum temperature of the flames (higher value results in faster rising flames)");
1747 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1748
1749 prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
1750 RNA_def_property_array(prop, 3);
1751 RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
1752 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1753
1754 /* noise options */
1755
1756 prop = RNA_def_property(srna, "noise_strength", PROP_FLOAT, PROP_NONE);
1757 RNA_def_property_float_sdna(prop, nullptr, "noise_strength");
1758 RNA_def_property_range(prop, 0.0, 10.0);
1759 RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
1760 RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
1762 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_noisecache_reset");
1763
1764 prop = RNA_def_property(srna, "noise_pos_scale", PROP_FLOAT, PROP_NONE);
1765 RNA_def_property_float_sdna(prop, nullptr, "noise_pos_scale");
1766 RNA_def_property_range(prop, 0.0001, 10.0);
1768 prop, "Scale", "Scale of noise (higher value results in larger vortices)");
1769 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_noisecache_reset");
1770
1771 prop = RNA_def_property(srna, "noise_time_anim", PROP_FLOAT, PROP_NONE);
1772 RNA_def_property_float_sdna(prop, nullptr, "noise_time_anim");
1773 RNA_def_property_range(prop, 0.0001, 10.0);
1774 RNA_def_property_ui_text(prop, "Time", "Animation time of noise");
1775 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_noisecache_reset");
1776
1777 prop = RNA_def_property(srna, "noise_scale", PROP_INT, PROP_NONE);
1778 RNA_def_property_int_sdna(prop, nullptr, "noise_scale");
1779 RNA_def_property_range(prop, 1, 100);
1780 RNA_def_property_ui_range(prop, 1, 10, 1, -1);
1782 "Noise Scale",
1783 "The noise simulation is scaled up by this factor (compared to the "
1784 "base resolution of the domain)");
1786 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_noise_reset");
1787
1788 prop = RNA_def_property(srna, "use_noise", PROP_BOOLEAN, PROP_NONE);
1790 RNA_def_property_ui_text(prop, "Use Noise", "Enable fluid noise (using amplification)");
1792 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
1793
1794 /* liquid domain options */
1795
1796 prop = RNA_def_property(srna, "simulation_method", PROP_ENUM, PROP_NONE);
1797 RNA_def_property_enum_sdna(prop, nullptr, "simulation_method");
1798 RNA_def_property_enum_items(prop, simulation_methods);
1799 RNA_def_property_ui_text(prop, "Simulation Method", "Change the underlying simulation method");
1801 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
1802
1803 prop = RNA_def_property(srna, "flip_ratio", PROP_FLOAT, PROP_NONE);
1804 RNA_def_property_range(prop, 0.0, 1.0);
1806 prop,
1807 "FLIP Ratio",
1808 "PIC/FLIP Ratio. A value of 1.0 will result in a completely FLIP based simulation. Use a "
1809 "lower value for simulations which should produce smaller splashes.");
1810 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1811
1812 prop = RNA_def_property(srna, "particle_randomness", PROP_FLOAT, PROP_NONE);
1813 RNA_def_property_range(prop, 0.0, 10.0);
1814 RNA_def_property_ui_text(prop, "Randomness", "Randomness factor for particle sampling");
1815 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1816
1817 prop = RNA_def_property(srna, "particle_number", PROP_INT, PROP_NONE);
1818 RNA_def_property_range(prop, 1, 5);
1820 prop, "Number", "Particle number factor (higher value results in more particles)");
1822 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1823
1824 prop = RNA_def_property(srna, "particle_min", PROP_INT, PROP_NONE);
1825 RNA_def_property_int_sdna(prop, nullptr, "particle_minimum");
1826 RNA_def_property_range(prop, 0, 1000);
1828 "Minimum",
1829 "Minimum number of particles per cell (ensures that each cell has at "
1830 "least this amount of particles)");
1831 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1832
1833 prop = RNA_def_property(srna, "particle_max", PROP_INT, PROP_NONE);
1834 RNA_def_property_int_sdna(prop, nullptr, "particle_maximum");
1835 RNA_def_property_range(prop, 0, 1000);
1837 "Maximum",
1838 "Maximum number of particles per cell (ensures that each cell has at "
1839 "most this amount of particles)");
1840 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1841
1842 prop = RNA_def_property(srna, "particle_radius", PROP_FLOAT, PROP_NONE);
1843 RNA_def_property_range(prop, 0.0, 10.0);
1845 "Radius",
1846 "Particle radius factor. Increase this value if the simulation appears "
1847 "to leak volume, decrease it if the simulation seems to gain volume.");
1848 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1849
1850 prop = RNA_def_property(srna, "particle_band_width", PROP_FLOAT, PROP_NONE);
1851 RNA_def_property_range(prop, 0.0, 1000.0);
1853 prop,
1854 "Width",
1855 "Particle (narrow) band width (higher value results in thicker band and more particles)");
1856 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1857
1858 prop = RNA_def_property(srna, "use_flip_particles", PROP_BOOLEAN, PROP_NONE);
1859 RNA_def_property_boolean_sdna(prop, nullptr, "particle_type", FLUID_DOMAIN_PARTICLE_FLIP);
1860 RNA_def_property_ui_text(prop, "FLIP", "Create liquid particle system");
1862 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_flip_parts_update");
1863
1864 prop = RNA_def_property(srna, "use_fractions", PROP_BOOLEAN, PROP_NONE);
1867 prop,
1868 "Fractional Obstacles",
1869 "Fractional obstacles improve and smoothen the fluid-obstacle boundary");
1871 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1872
1873 prop = RNA_def_property(srna, "fractions_threshold", PROP_FLOAT, PROP_NONE);
1874 RNA_def_property_range(prop, 0.001, 1.0);
1875 RNA_def_property_ui_range(prop, 0.01, 1.0, 0.05, -1);
1877 "Obstacle Threshold",
1878 "Determines how much fluid is allowed in an obstacle cell "
1879 "(higher values will tag a boundary cell as an obstacle easier "
1880 "and reduce the boundary smoothening effect)");
1881 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1882
1883 prop = RNA_def_property(srna, "fractions_distance", PROP_FLOAT, PROP_NONE);
1884 RNA_def_property_range(prop, -5.0, 5.0);
1885 RNA_def_property_ui_range(prop, 0.01, 5.0, 0.1, -1);
1887 "Obstacle Distance",
1888 "Determines how far apart fluid and obstacle are (higher values will "
1889 "result in fluid being further away from obstacles, smaller values "
1890 "will let fluid move towards the inside of obstacles)");
1891 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1892
1893 prop = RNA_def_property(srna, "sys_particle_maximum", PROP_INT, PROP_NONE);
1894 RNA_def_property_int_sdna(prop, nullptr, "sys_particle_maximum");
1895 RNA_def_property_range(prop, 0, INT_MAX);
1897 prop,
1898 "System Maximum",
1899 "Maximum number of fluid particles that are allowed in this simulation");
1900 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1901
1902 /* Viscosity options. */
1903
1904 prop = RNA_def_property(srna, "use_viscosity", PROP_BOOLEAN, PROP_NONE);
1907 prop, "Use Viscosity", "Simulate fluids with high viscosity using a special solver");
1908 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1909
1910 prop = RNA_def_property(srna, "viscosity_value", PROP_FLOAT, PROP_NONE);
1911 RNA_def_property_range(prop, 0.0, 10.0);
1912 RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 3);
1914 "Strength",
1915 "Viscosity of liquid (higher values result in more viscous fluids, a "
1916 "value of 0 will still apply some viscosity)");
1918 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1919
1920 /* Diffusion options. */
1921
1922 prop = RNA_def_property(srna, "use_diffusion", PROP_BOOLEAN, PROP_NONE);
1925 prop, "Use Diffusion", "Enable fluid diffusion settings (e.g. viscosity, surface tension)");
1927 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1928
1929 prop = RNA_def_property(srna, "surface_tension", PROP_FLOAT, PROP_NONE);
1930 RNA_def_property_range(prop, 0.0, 100.0);
1932 prop,
1933 "Tension",
1934 "Surface tension of liquid (higher value results in greater hydrophobic behavior)");
1935 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1936
1937 prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
1938 RNA_def_property_float_sdna(prop, nullptr, "viscosity_base");
1939 RNA_def_property_range(prop, 0, 10);
1941 prop,
1942 "Viscosity Base",
1943 "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
1944 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1945
1946 prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
1947 RNA_def_property_int_sdna(prop, nullptr, "viscosity_exponent");
1948 RNA_def_property_range(prop, 0, 10);
1950 prop,
1951 "Viscosity Exponent",
1952 "Negative exponent for the viscosity value (to simplify entering small values "
1953 "e.g. 5*10^-6)");
1954 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
1955
1956 /* Mesh options. */
1957
1958 prop = RNA_def_property(srna, "mesh_concave_upper", PROP_FLOAT, PROP_NONE);
1959 RNA_def_property_range(prop, 0.0, 10.0);
1961 prop,
1962 "Upper Concavity",
1963 "Upper mesh concavity bound (high values tend to smoothen and fill out concave regions)");
1964 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
1965
1966 prop = RNA_def_property(srna, "mesh_concave_lower", PROP_FLOAT, PROP_NONE);
1967 RNA_def_property_range(prop, 0.0, 10.0);
1969 prop,
1970 "Lower Concavity",
1971 "Lower mesh concavity bound (high values tend to smoothen and fill out concave regions)");
1972 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
1973
1974 prop = RNA_def_property(srna, "mesh_smoothen_pos", PROP_INT, PROP_NONE);
1975 RNA_def_property_range(prop, 0, 100);
1976 RNA_def_property_ui_text(prop, "Smoothen Pos", "Positive mesh smoothening");
1977 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
1978
1979 prop = RNA_def_property(srna, "mesh_smoothen_neg", PROP_INT, PROP_NONE);
1980 RNA_def_property_range(prop, 0, 100);
1981 RNA_def_property_ui_text(prop, "Smoothen Neg", "Negative mesh smoothening");
1982 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
1983
1984 prop = RNA_def_property(srna, "mesh_scale", PROP_INT, PROP_NONE);
1985 RNA_def_property_int_sdna(prop, nullptr, "mesh_scale");
1986 RNA_def_property_range(prop, 1, 100);
1987 RNA_def_property_ui_range(prop, 1, 10, 1, -1);
1989 "Mesh scale",
1990 "The mesh simulation is scaled up by this factor (compared to the base "
1991 "resolution of the domain). For best meshing, it is recommended to "
1992 "adjust the mesh particle radius alongside this value.");
1994 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_mesh_reset");
1995
1996 prop = RNA_def_property(srna, "mesh_generator", PROP_ENUM, PROP_NONE);
1997 RNA_def_property_enum_sdna(prop, nullptr, "mesh_generator");
1998 RNA_def_property_enum_items(prop, fluid_mesh_quality_items);
1999 RNA_def_property_ui_text(prop, "Mesh generator", "Which particle level set generator to use");
2000 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update");
2001
2002 prop = RNA_def_property(srna, "use_mesh", PROP_BOOLEAN, PROP_NONE);
2004 RNA_def_property_ui_text(prop, "Use Mesh", "Enable fluid mesh (using amplification)");
2006 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
2007
2008 prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
2011 "Speed Vectors",
2012 "Caches velocities of mesh vertices. These will be used "
2013 "(automatically) when rendering with motion blur enabled.");
2015 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
2016
2017 prop = RNA_def_property(srna, "mesh_particle_radius", PROP_FLOAT, PROP_NONE);
2018 RNA_def_property_range(prop, 0.0, 10.0);
2020 "Radius",
2021 "Particle radius factor (higher value results in larger (meshed) "
2022 "particles). Needs to be adjusted after changing the mesh scale.");
2023 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
2024
2025 /* Secondary particles options. */
2026
2027 prop = RNA_def_property(srna, "sndparticle_potential_min_wavecrest", PROP_FLOAT, PROP_NONE);
2028 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_tau_min_wc");
2029 RNA_def_property_range(prop, 0.0, 1000.0);
2030 RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
2032 "Minimum Wave Crest Potential",
2033 "Lower clamping threshold for marking fluid cells as wave crests "
2034 "(lower value results in more marked cells)");
2035 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2036
2037 prop = RNA_def_property(srna, "sndparticle_potential_max_wavecrest", PROP_FLOAT, PROP_NONE);
2038 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_tau_max_wc");
2039 RNA_def_property_range(prop, 0.0, 1000.0);
2040 RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
2042 "Maximum Wave Crest Potential",
2043 "Upper clamping threshold for marking fluid cells as wave crests "
2044 "(higher value results in less marked cells)");
2045 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2046
2047 prop = RNA_def_property(srna, "sndparticle_potential_min_trappedair", PROP_FLOAT, PROP_NONE);
2048 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_tau_min_ta");
2049 RNA_def_property_range(prop, 0.0, 1000.0);
2050 RNA_def_property_ui_range(prop, 0.0, 10000.0, 100.0, 3);
2052 "Minimum Trapped Air Potential",
2053 "Lower clamping threshold for marking fluid cells where air is trapped "
2054 "(lower value results in more marked cells)");
2055 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2056
2057 prop = RNA_def_property(srna, "sndparticle_potential_max_trappedair", PROP_FLOAT, PROP_NONE);
2058 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_tau_max_ta");
2059 RNA_def_property_range(prop, 0.0, 1000.0);
2060 RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
2062 "Maximum Trapped Air Potential",
2063 "Upper clamping threshold for marking fluid cells where air is trapped "
2064 "(higher value results in less marked cells)");
2065 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2066
2067 prop = RNA_def_property(srna, "sndparticle_potential_min_energy", PROP_FLOAT, PROP_NONE);
2068 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_tau_min_k");
2069 RNA_def_property_range(prop, 0.0, 1000.0);
2070 RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
2072 prop,
2073 "Minimum Kinetic Energy Potential",
2074 "Lower clamping threshold that indicates the fluid speed where cells start to emit "
2075 "particles (lower values result in generally more particles)");
2076 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2077
2078 prop = RNA_def_property(srna, "sndparticle_potential_max_energy", PROP_FLOAT, PROP_NONE);
2079 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_tau_max_k");
2080 RNA_def_property_range(prop, 0.0, 1000.0);
2081 RNA_def_property_ui_range(prop, 0.0, 1000.0, 100.0, 3);
2083 prop,
2084 "Maximum Kinetic Energy Potential",
2085 "Upper clamping threshold that indicates the fluid speed where cells no longer emit more "
2086 "particles (higher value results in generally less particles)");
2087 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2088
2089 prop = RNA_def_property(srna, "sndparticle_sampling_wavecrest", PROP_INT, PROP_NONE);
2090 RNA_def_property_int_sdna(prop, nullptr, "sndparticle_k_wc");
2091 RNA_def_property_range(prop, 0, 10000);
2092 RNA_def_property_ui_range(prop, 0, 10000, 1.0, -1);
2094 "Wave Crest Sampling",
2095 "Maximum number of particles generated per wave crest cell per frame");
2096 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2097
2098 prop = RNA_def_property(srna, "sndparticle_sampling_trappedair", PROP_INT, PROP_NONE);
2099 RNA_def_property_int_sdna(prop, nullptr, "sndparticle_k_ta");
2100 RNA_def_property_range(prop, 0, 10000);
2101 RNA_def_property_ui_range(prop, 0, 10000, 1.0, -1);
2103 "Trapped Air Sampling",
2104 "Maximum number of particles generated per trapped air cell per frame");
2105 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2106
2107 prop = RNA_def_property(srna, "sndparticle_bubble_buoyancy", PROP_FLOAT, PROP_NONE);
2108 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_k_b");
2109 RNA_def_property_range(prop, 0.0, 100.0);
2110 RNA_def_property_ui_range(prop, 0.0, 100.0, 10.0, 2);
2112 "Bubble Buoyancy",
2113 "Amount of buoyancy force that rises bubbles (high value results in "
2114 "bubble movement mainly upwards)");
2115 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2116
2117 prop = RNA_def_property(srna, "sndparticle_bubble_drag", PROP_FLOAT, PROP_NONE);
2118 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_k_d");
2119 RNA_def_property_range(prop, 0.0, 100.0);
2120 RNA_def_property_ui_range(prop, 0.0, 100.0, 10.0, 2);
2122 "Bubble Drag",
2123 "Amount of drag force that moves bubbles along with the fluid (high "
2124 "value results in bubble movement mainly along with the fluid)");
2125 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2126
2127 prop = RNA_def_property(srna, "sndparticle_life_min", PROP_FLOAT, PROP_NONE);
2128 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_l_min");
2129 RNA_def_property_range(prop, 0.0, 10000.0);
2130 RNA_def_property_ui_range(prop, 0.0, 10000.0, 100.0, 1);
2131 RNA_def_property_ui_text(prop, "Minimum Lifetime", "Lowest possible particle lifetime");
2132 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2133
2134 prop = RNA_def_property(srna, "sndparticle_life_max", PROP_FLOAT, PROP_NONE);
2135 RNA_def_property_float_sdna(prop, nullptr, "sndparticle_l_max");
2136 RNA_def_property_range(prop, 0.0, 10000.0);
2137 RNA_def_property_ui_range(prop, 0.0, 10000.0, 100.0, 1);
2138 RNA_def_property_ui_text(prop, "Maximum Lifetime", "Highest possible particle lifetime");
2139 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2140
2141 prop = RNA_def_property(srna, "sndparticle_boundary", PROP_ENUM, PROP_NONE);
2142 RNA_def_property_enum_sdna(prop, nullptr, "sndparticle_boundary");
2143 RNA_def_property_enum_items(prop, sndparticle_boundary_items);
2145 prop, "Particles in Boundary", "How particles that left the domain are treated");
2146 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2147
2148 prop = RNA_def_property(srna, "sndparticle_combined_export", PROP_ENUM, PROP_NONE);
2149 RNA_def_property_enum_sdna(prop, nullptr, "sndparticle_combined_export");
2150 RNA_def_property_enum_items(prop, sndparticle_combined_export_items);
2152 prop,
2153 "Combined Export",
2154 "Determines which particle systems are created from secondary particles");
2155 RNA_def_property_update(prop, 0, "rna_Fluid_combined_export_update");
2156
2157 prop = RNA_def_property(srna, "sndparticle_potential_radius", PROP_INT, PROP_NONE);
2158 RNA_def_property_int_sdna(prop, nullptr, "sndparticle_potential_radius");
2159 RNA_def_property_range(prop, 1, 4);
2160 RNA_def_property_ui_range(prop, 1, 4, 1, -1);
2162 "Potential Radius",
2163 "Radius to compute potential for each cell (higher values are slower "
2164 "but create smoother potential grids)");
2165 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2166
2167 prop = RNA_def_property(srna, "sndparticle_update_radius", PROP_INT, PROP_NONE);
2168 RNA_def_property_int_sdna(prop, nullptr, "sndparticle_update_radius");
2169 RNA_def_property_range(prop, 1, 4);
2170 RNA_def_property_ui_range(prop, 1, 4, 1, -1);
2172 "Update Radius",
2173 "Radius to compute position update for each particle (higher values "
2174 "are slower but particles move less chaotic)");
2175 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2176
2177 prop = RNA_def_property(srna, "particle_scale", PROP_INT, PROP_NONE);
2178 RNA_def_property_int_sdna(prop, nullptr, "particle_scale");
2179 RNA_def_property_range(prop, 1, 100);
2180 RNA_def_property_ui_range(prop, 1, 10, 1, -1);
2182 "Particle scale",
2183 "The particle simulation is scaled up by this factor (compared to the "
2184 "base resolution of the domain)");
2186 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_particles_reset");
2187
2188 prop = RNA_def_property(srna, "use_spray_particles", PROP_BOOLEAN, PROP_NONE);
2189 RNA_def_property_boolean_sdna(prop, nullptr, "particle_type", FLUID_DOMAIN_PARTICLE_SPRAY);
2190 RNA_def_property_ui_text(prop, "Spray", "Create spray particle system");
2192 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_spray_parts_update");
2193
2194 prop = RNA_def_property(srna, "use_bubble_particles", PROP_BOOLEAN, PROP_NONE);
2195 RNA_def_property_boolean_sdna(prop, nullptr, "particle_type", FLUID_DOMAIN_PARTICLE_BUBBLE);
2196 RNA_def_property_ui_text(prop, "Bubble", "Create bubble particle system");
2198 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_bubble_parts_update");
2199
2200 prop = RNA_def_property(srna, "use_foam_particles", PROP_BOOLEAN, PROP_NONE);
2201 RNA_def_property_boolean_sdna(prop, nullptr, "particle_type", FLUID_DOMAIN_PARTICLE_FOAM);
2202 RNA_def_property_ui_text(prop, "Foam", "Create foam particle system");
2204 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_foam_parts_update");
2205
2206 prop = RNA_def_property(srna, "use_tracer_particles", PROP_BOOLEAN, PROP_NONE);
2207 RNA_def_property_boolean_sdna(prop, nullptr, "particle_type", FLUID_DOMAIN_PARTICLE_TRACER);
2208 RNA_def_property_ui_text(prop, "Tracer", "Create tracer particle system");
2210 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_tracer_parts_update");
2211
2212 /* fluid guiding options */
2213
2214 prop = RNA_def_property(srna, "guide_alpha", PROP_FLOAT, PROP_NONE);
2215 RNA_def_property_float_sdna(prop, nullptr, "guide_alpha");
2216 RNA_def_property_range(prop, 1.0, 100.0);
2217 RNA_def_property_ui_text(prop, "Weight", "Guiding weight (higher value results in greater lag)");
2218 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2219
2220 prop = RNA_def_property(srna, "guide_beta", PROP_INT, PROP_NONE);
2221 RNA_def_property_int_sdna(prop, nullptr, "guide_beta");
2222 RNA_def_property_range(prop, 1, 50);
2223 RNA_def_property_ui_text(prop, "Size", "Guiding size (higher value results in larger vortices)");
2224 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2225
2226 prop = RNA_def_property(srna, "guide_vel_factor", PROP_FLOAT, PROP_NONE);
2227 RNA_def_property_float_sdna(prop, nullptr, "guide_vel_factor");
2228 RNA_def_property_range(prop, 0.0, 100.0);
2230 prop,
2231 "Velocity Factor",
2232 "Guiding velocity factor (higher value results in greater guiding velocities)");
2233 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2234
2235 prop = RNA_def_property(srna, "guide_source", PROP_ENUM, PROP_NONE);
2236 RNA_def_property_enum_sdna(prop, nullptr, "guide_source");
2237 RNA_def_property_enum_items(prop, fluid_guide_source_items);
2238 RNA_def_property_ui_text(prop, "Guiding source", "Choose where to get guiding velocities from");
2239 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_update");
2240
2241 prop = RNA_def_property(srna, "guide_parent", PROP_POINTER, PROP_NONE);
2242 RNA_def_property_pointer_sdna(prop, nullptr, "guide_parent");
2243 RNA_def_property_struct_type(prop, "Object");
2244 RNA_def_property_pointer_funcs(prop, nullptr, "rna_Fluid_guide_parent_set", nullptr, nullptr);
2247 "",
2248 "Use velocities from this object for the guiding effect (object needs "
2249 "to have fluid modifier and be of type domain))");
2250 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_guidingcache_reset");
2251
2252 prop = RNA_def_property(srna, "use_guide", PROP_BOOLEAN, PROP_NONE);
2254 RNA_def_property_ui_text(prop, "Use Guiding", "Enable fluid guiding");
2256 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
2257
2258 /* cache options */
2259
2260 prop = RNA_def_property(srna, "cache_frame_start", PROP_INT, PROP_TIME);
2261 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_start");
2263 RNA_def_property_int_funcs(prop, nullptr, "rna_Fluid_cache_startframe_set", nullptr);
2265 prop, "Start", "Frame on which the simulation starts (first frame baked)");
2267
2268 prop = RNA_def_property(srna, "cache_frame_end", PROP_INT, PROP_TIME);
2269 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_end");
2271 RNA_def_property_int_funcs(prop, nullptr, "rna_Fluid_cache_endframe_set", nullptr);
2272 RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops (last frame baked)");
2274
2275 prop = RNA_def_property(srna, "cache_frame_offset", PROP_INT, PROP_TIME);
2276 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_offset");
2279 prop,
2280 "Offset",
2281 "Frame offset that is used when loading the simulation from the cache. It is not considered "
2282 "when baking the simulation, only when loading it.");
2284
2285 prop = RNA_def_property(srna, "cache_frame_pause_data", PROP_INT, PROP_TIME);
2286 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_pause_data");
2287
2288 prop = RNA_def_property(srna, "cache_frame_pause_noise", PROP_INT, PROP_TIME);
2289 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_pause_noise");
2290
2291 prop = RNA_def_property(srna, "cache_frame_pause_mesh", PROP_INT, PROP_TIME);
2292 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_pause_mesh");
2293
2294 prop = RNA_def_property(srna, "cache_frame_pause_particles", PROP_INT, PROP_TIME);
2295 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_pause_particles");
2296
2297 prop = RNA_def_property(srna, "cache_frame_pause_guide", PROP_INT, PROP_TIME);
2298 RNA_def_property_int_sdna(prop, nullptr, "cache_frame_pause_guide");
2299
2300 prop = RNA_def_property(srna, "cache_mesh_format", PROP_ENUM, PROP_NONE);
2301 RNA_def_property_enum_sdna(prop, nullptr, "cache_mesh_format");
2302 RNA_def_property_enum_items(prop, cache_file_type_items);
2304 prop, nullptr, "rna_Fluid_cachetype_mesh_set", "rna_Fluid_cachetype_mesh_itemf");
2306 prop, "File Format", "Select the file format to be used for caching surface data");
2308 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_meshcache_reset");
2309
2310 prop = RNA_def_property(srna, "cache_data_format", PROP_ENUM, PROP_NONE);
2311 RNA_def_property_enum_sdna(prop, nullptr, "cache_data_format");
2312 RNA_def_property_enum_items(prop, cache_file_type_items);
2314 prop, nullptr, "rna_Fluid_cachetype_data_set", "rna_Fluid_cachetype_volume_itemf");
2316 prop, "File Format", "Select the file format to be used for caching volumetric data");
2318 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2319
2320 prop = RNA_def_property(srna, "cache_particle_format", PROP_ENUM, PROP_NONE);
2321 RNA_def_property_enum_sdna(prop, nullptr, "cache_particle_format");
2322 RNA_def_property_enum_items(prop, cache_file_type_items);
2324 prop, nullptr, "rna_Fluid_cachetype_particle_set", "rna_Fluid_cachetype_particle_itemf");
2326 prop, "File Format", "Select the file format to be used for caching particle data");
2328 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_particlescache_reset");
2329
2330 prop = RNA_def_property(srna, "cache_noise_format", PROP_ENUM, PROP_NONE);
2331 RNA_def_property_enum_sdna(prop, nullptr, "cache_noise_format");
2332 RNA_def_property_enum_items(prop, cache_file_type_items);
2334 prop, nullptr, "rna_Fluid_cachetype_noise_set", "rna_Fluid_cachetype_volume_itemf");
2336 prop, "File Format", "Select the file format to be used for caching noise data");
2338 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_noisecache_reset");
2339
2340 prop = RNA_def_property(srna, "cache_type", PROP_ENUM, PROP_NONE);
2341 RNA_def_property_enum_sdna(prop, nullptr, "cache_type");
2342 RNA_def_property_enum_items(prop, cache_types);
2343 RNA_def_property_enum_funcs(prop, nullptr, "rna_Fluid_cachetype_set", nullptr);
2344 RNA_def_property_ui_text(prop, "Type", "Change the cache type of the simulation");
2346 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_domain_data_reset");
2347
2348 prop = RNA_def_property(srna, "cache_resumable", PROP_BOOLEAN, PROP_NONE);
2351 prop,
2352 "Resumable",
2353 "Additional data will be saved so that the bake jobs can be resumed after pausing. Because "
2354 "more data will be written to disk it is recommended to avoid enabling this option when "
2355 "baking at high resolutions.");
2357 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2358
2359 prop = RNA_def_property(srna, "cache_directory", PROP_STRING, PROP_DIRPATH);
2361 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_Fluid_cache_directory_set");
2362 RNA_def_property_string_sdna(prop, nullptr, "cache_directory");
2364 RNA_def_property_ui_text(prop, "Cache directory", "Directory that contains fluid cache files");
2365 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
2366
2367 prop = RNA_def_property(srna, "is_cache_baking_data", PROP_BOOLEAN, PROP_NONE);
2368 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKING_DATA);
2370
2371 prop = RNA_def_property(srna, "has_cache_baked_data", PROP_BOOLEAN, PROP_NONE);
2372 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKED_DATA);
2374
2375 prop = RNA_def_property(srna, "is_cache_baking_noise", PROP_BOOLEAN, PROP_NONE);
2376 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKING_NOISE);
2378
2379 prop = RNA_def_property(srna, "has_cache_baked_noise", PROP_BOOLEAN, PROP_NONE);
2380 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKED_NOISE);
2382
2383 prop = RNA_def_property(srna, "is_cache_baking_mesh", PROP_BOOLEAN, PROP_NONE);
2384 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKING_MESH);
2386
2387 prop = RNA_def_property(srna, "has_cache_baked_mesh", PROP_BOOLEAN, PROP_NONE);
2388 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKED_MESH);
2390
2391 prop = RNA_def_property(srna, "is_cache_baking_particles", PROP_BOOLEAN, PROP_NONE);
2394
2395 prop = RNA_def_property(srna, "has_cache_baked_particles", PROP_BOOLEAN, PROP_NONE);
2396 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKED_PARTICLES);
2398
2399 prop = RNA_def_property(srna, "is_cache_baking_guide", PROP_BOOLEAN, PROP_NONE);
2400 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKING_GUIDE);
2402
2403 prop = RNA_def_property(srna, "has_cache_baked_guide", PROP_BOOLEAN, PROP_NONE);
2404 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKED_GUIDE);
2406
2407 /* Read only checks, avoids individually accessing flags above. */
2408 prop = RNA_def_property(srna, "is_cache_baking_any", PROP_BOOLEAN, PROP_NONE);
2409 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKING_ALL);
2411
2412 prop = RNA_def_property(srna, "has_cache_baked_any", PROP_BOOLEAN, PROP_NONE);
2413 RNA_def_property_boolean_sdna(prop, nullptr, "cache_flag", FLUID_DOMAIN_BAKED_ALL);
2415
2416 prop = RNA_def_property(srna, "export_manta_script", PROP_BOOLEAN, PROP_NONE);
2419 prop,
2420 "Export Mantaflow Script",
2421 "Generate and export Mantaflow script from current domain settings during bake. This is "
2422 "only needed if you plan to analyze the cache (e.g. view grids, velocity vectors, "
2423 "particles) in Mantaflow directly (outside of Blender) after baking the simulation.");
2425 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
2426
2427 prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
2428 RNA_def_property_enum_sdna(prop, nullptr, "openvdb_compression");
2429 RNA_def_property_enum_items(prop, prop_compression_items);
2430 RNA_def_property_ui_text(prop, "Compression", "Compression method to be used");
2431 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
2432
2433 prop = RNA_def_property(srna, "openvdb_data_depth", PROP_ENUM, PROP_NONE);
2434 RNA_def_property_enum_sdna(prop, nullptr, "openvdb_data_depth");
2435 RNA_def_property_enum_items(prop, fluid_data_depth_items);
2436 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Fluid_data_depth_itemf");
2438 prop,
2439 "Data Depth",
2440 "Bit depth for fluid particles and grids (lower bit values reduce file size)");
2441 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
2442
2443 /* time options */
2444
2445 prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
2446 RNA_def_property_float_sdna(prop, nullptr, "time_scale");
2447 RNA_def_property_range(prop, 0.0001, 10.0);
2448 RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
2449 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2450
2451 prop = RNA_def_property(srna, "use_adaptive_timesteps", PROP_BOOLEAN, PROP_NONE);
2454 prop,
2455 "Adaptive Time Steps",
2456 "Automatically decide when to perform multiple simulation steps per frame");
2457 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2458
2459 prop = RNA_def_property(srna, "cfl_condition", PROP_FLOAT, PROP_NONE);
2460 RNA_def_property_float_sdna(prop, nullptr, "cfl_condition");
2461 RNA_def_property_range(prop, 0.0, 10.0);
2463 "CFL",
2464 "Maximal velocity per cell (greater CFL numbers will minimize the "
2465 "number of simulation steps and the computation time.)");
2466 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2467
2468 prop = RNA_def_property(srna, "timesteps_min", PROP_INT, PROP_NONE);
2469 RNA_def_property_int_sdna(prop, nullptr, "timesteps_minimum");
2470 RNA_def_property_range(prop, 1, 100);
2471 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2473 prop, "Minimum", "Minimum number of simulation steps to perform for one frame");
2474 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2475
2476 prop = RNA_def_property(srna, "timesteps_max", PROP_INT, PROP_NONE);
2477 RNA_def_property_int_sdna(prop, nullptr, "timesteps_maximum");
2478 RNA_def_property_range(prop, 1, 100);
2479 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
2481 prop, "Maximum", "Maximum number of simulation steps to perform for one frame");
2482 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset");
2483
2484 /* display settings */
2485
2486 prop = RNA_def_property(srna, "use_slice", PROP_BOOLEAN, PROP_NONE);
2487 RNA_def_property_boolean_sdna(prop, nullptr, "axis_slice_method", AXIS_SLICE_SINGLE);
2488 RNA_def_property_ui_text(prop, "Slice", "Perform a single slice of the domain object");
2489 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2490
2491 prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE);
2492 RNA_def_property_enum_sdna(prop, nullptr, "slice_axis");
2493 RNA_def_property_enum_items(prop, axis_slice_position_items);
2494 RNA_def_property_ui_text(prop, "Axis", "");
2495 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2496
2497 prop = RNA_def_property(srna, "slice_per_voxel", PROP_FLOAT, PROP_NONE);
2498 RNA_def_property_float_sdna(prop, nullptr, "slice_per_voxel");
2499 RNA_def_property_range(prop, 0.0, 100.0);
2500 RNA_def_property_ui_range(prop, 0.0, 5.0, 0.1, 1);
2502 prop, "Slice Per Voxel", "How many slices per voxel should be generated");
2503 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2504
2505 prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR);
2506 RNA_def_property_float_sdna(prop, nullptr, "slice_depth");
2507 RNA_def_property_range(prop, 0.0, 1.0);
2508 RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
2509 RNA_def_property_ui_text(prop, "Position", "Position of the slice");
2510 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2511
2512 prop = RNA_def_property(srna, "display_thickness", PROP_FLOAT, PROP_NONE);
2513 RNA_def_property_float_sdna(prop, nullptr, "display_thickness");
2514 RNA_def_property_range(prop, 0.001, 1000.0);
2515 RNA_def_property_ui_range(prop, 0.1, 100.0, 0.1, 3);
2516 RNA_def_property_ui_text(prop, "Thickness", "Thickness of smoke display in the viewport");
2518
2519 prop = RNA_def_property(srna, "display_interpolation", PROP_ENUM, PROP_NONE);
2520 RNA_def_property_enum_sdna(prop, nullptr, "interp_method");
2521 RNA_def_property_enum_items(prop, interp_method_item);
2523 prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode");
2524 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2525
2526 prop = RNA_def_property(srna, "show_gridlines", PROP_BOOLEAN, PROP_NONE);
2527 RNA_def_property_boolean_sdna(prop, nullptr, "show_gridlines", 0);
2528 RNA_def_property_ui_text(prop, "Gridlines", "Show gridlines");
2529 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2530
2531 prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
2532 RNA_def_property_boolean_sdna(prop, nullptr, "draw_velocity", 0);
2533 RNA_def_property_ui_text(prop, "Vector Display", "Visualize vector fields");
2534 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2535
2536 prop = RNA_def_property(srna, "vector_display_type", PROP_ENUM, PROP_NONE);
2537 RNA_def_property_enum_sdna(prop, nullptr, "vector_draw_type");
2538 RNA_def_property_enum_items(prop, vector_draw_items);
2539 RNA_def_property_ui_text(prop, "Display Type", "");
2540 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2541
2542 prop = RNA_def_property(srna, "vector_field", PROP_ENUM, PROP_NONE);
2543 RNA_def_property_enum_sdna(prop, nullptr, "vector_field");
2544 RNA_def_property_enum_items(prop, vector_field_items);
2545 RNA_def_property_ui_text(prop, "Field", "Vector field to be represented by the display vectors");
2546 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2547
2548 prop = RNA_def_property(srna, "vector_scale_with_magnitude", PROP_BOOLEAN, PROP_NONE);
2549 RNA_def_property_boolean_sdna(prop, nullptr, "vector_scale_with_magnitude", 0);
2550 RNA_def_property_ui_text(prop, "Magnitude", "Scale vectors with their magnitudes");
2551 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2552
2553 prop = RNA_def_property(srna, "vector_show_mac_x", PROP_BOOLEAN, PROP_NONE);
2554 RNA_def_property_boolean_sdna(prop, nullptr, "vector_draw_mac_components", VECTOR_DRAW_MAC_X);
2555 RNA_def_property_ui_text(prop, "X", "Show X-component of MAC Grid");
2556 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2557
2558 prop = RNA_def_property(srna, "vector_show_mac_y", PROP_BOOLEAN, PROP_NONE);
2559 RNA_def_property_boolean_sdna(prop, nullptr, "vector_draw_mac_components", VECTOR_DRAW_MAC_Y);
2560 RNA_def_property_ui_text(prop, "Y", "Show Y-component of MAC Grid");
2561 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2562
2563 prop = RNA_def_property(srna, "vector_show_mac_z", PROP_BOOLEAN, PROP_NONE);
2564 RNA_def_property_boolean_sdna(prop, nullptr, "vector_draw_mac_components", VECTOR_DRAW_MAC_Z);
2565 RNA_def_property_ui_text(prop, "Z", "Show Z-component of MAC Grid");
2566 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2567
2568 prop = RNA_def_property(srna, "vector_scale", PROP_FLOAT, PROP_NONE);
2569 RNA_def_property_float_sdna(prop, nullptr, "vector_scale");
2570 RNA_def_property_range(prop, 0.0, 1000.0);
2571 RNA_def_property_ui_range(prop, 0.0, 100.0, 0.1, 3);
2572 RNA_def_property_ui_text(prop, "Scale", "Multiplier for scaling the vectors");
2573 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2574
2575 /* --------- Color mapping. --------- */
2576
2577 prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
2578 RNA_def_property_boolean_sdna(prop, nullptr, "use_coba", 0);
2579 RNA_def_property_boolean_funcs(prop, nullptr, "rna_Fluid_use_color_ramp_set");
2581 "Grid Display",
2582 "Render a simulation field while mapping its voxels values to the "
2583 "colors of a ramp or using a predefined color code");
2584 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2585
2586 /* Color ramp field items are generated dynamically based on domain type. */
2587 static const EnumPropertyItem coba_field_items[] = {
2588 {0, "NONE", 0, "", ""},
2589 {0, nullptr, 0, nullptr, nullptr},
2590 };
2591
2592 prop = RNA_def_property(srna, "color_ramp_field", PROP_ENUM, PROP_NONE);
2593 RNA_def_property_enum_sdna(prop, nullptr, "coba_field");
2594 RNA_def_property_enum_items(prop, coba_field_items);
2595 RNA_def_property_enum_funcs(prop, nullptr, nullptr, "rna_Fluid_cobafield_itemf");
2596 RNA_def_property_ui_text(prop, "Field", "Simulation field to color map");
2597 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2598
2599 prop = RNA_def_property(srna, "color_ramp_field_scale", PROP_FLOAT, PROP_NONE);
2600 RNA_def_property_float_sdna(prop, nullptr, "grid_scale");
2601 RNA_def_property_range(prop, 0.001, 100000.0);
2602 RNA_def_property_ui_range(prop, 0.001, 1000.0, 0.1, 3);
2604 prop, "Scale", "Multiplier for scaling the selected field to color map");
2606
2607 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
2608 RNA_def_property_pointer_sdna(prop, nullptr, "coba");
2609 RNA_def_property_struct_type(prop, "ColorRamp");
2610 RNA_def_property_ui_text(prop, "Color Ramp", "");
2611 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2612
2613 prop = RNA_def_property(srna, "clipping", PROP_FLOAT, PROP_NONE);
2614 RNA_def_property_float_sdna(prop, nullptr, "clipping");
2615 RNA_def_property_range(prop, 0.0, 1.0);
2616 RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 6);
2618 prop,
2619 "Clipping",
2620 "Value under which voxels are considered empty space to optimize rendering");
2622
2623 prop = RNA_def_property(srna, "gridlines_color_field", PROP_ENUM, PROP_NONE);
2624 RNA_def_property_enum_sdna(prop, nullptr, "gridlines_color_field");
2625 RNA_def_property_enum_items(prop, gridlines_color_field_items);
2627 prop, "Color Gridlines", "Simulation field to color map onto gridlines");
2628 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2629
2630 prop = RNA_def_property(srna, "gridlines_lower_bound", PROP_FLOAT, PROP_NONE);
2631 RNA_def_property_float_sdna(prop, nullptr, "gridlines_lower_bound");
2633 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1, 6);
2634 RNA_def_property_ui_text(prop, "Lower Bound", "Lower bound of the highlighting range");
2636
2637 prop = RNA_def_property(srna, "gridlines_upper_bound", PROP_FLOAT, PROP_NONE);
2638 RNA_def_property_float_sdna(prop, nullptr, "gridlines_upper_bound");
2640 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1, 6);
2641 RNA_def_property_ui_text(prop, "Upper Bound", "Upper bound of the highlighting range");
2643
2644 prop = RNA_def_property(srna, "gridlines_range_color", PROP_FLOAT, PROP_COLOR_GAMMA);
2645 RNA_def_property_float_sdna(prop, nullptr, "gridlines_range_color");
2646 RNA_def_property_array(prop, 4);
2647 RNA_def_property_ui_text(prop, "Color", "Color used to highlight the range");
2649
2650 prop = RNA_def_property(srna, "gridlines_cell_filter", PROP_ENUM, PROP_NONE);
2651 RNA_def_property_enum_sdna(prop, nullptr, "gridlines_cell_filter");
2652 RNA_def_property_enum_items(prop, gridlines_cell_filter_items);
2653 RNA_def_property_ui_text(prop, "Cell Type", "Cell type to be highlighted");
2654 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, nullptr);
2655
2656 prop = RNA_def_property(srna, "velocity_scale", PROP_FLOAT, PROP_NONE);
2657 RNA_def_property_float_sdna(prop, nullptr, "velocity_scale");
2658 RNA_def_property_range(prop, 0.0f, FLT_MAX);
2659 RNA_def_property_ui_text(prop, "Velocity Scale", "Factor to control the amount of motion blur");
2660 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_update");
2661}
2662
2664{
2665 StructRNA *srna;
2666 PropertyRNA *prop;
2667
2668 static const EnumPropertyItem flow_type_items[] = {
2669 {FLUID_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
2670 {FLUID_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
2671 {FLUID_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
2672 {FLUID_FLOW_TYPE_LIQUID, "LIQUID", 0, "Liquid", "Add liquid"},
2673 {0, nullptr, 0, nullptr, nullptr},
2674 };
2675
2676 static const EnumPropertyItem flow_behavior_items[] = {
2677 {FLUID_FLOW_BEHAVIOR_INFLOW, "INFLOW", 0, "Inflow", "Add fluid to simulation"},
2678 {FLUID_FLOW_BEHAVIOR_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete fluid from simulation"},
2680 "GEOMETRY",
2681 0,
2682 "Geometry",
2683 "Only use given geometry for fluid"},
2684 {0, nullptr, 0, nullptr, nullptr},
2685 };
2686
2687 /* Flow source - generated dynamically based on flow type. */
2688 static const EnumPropertyItem flow_sources[] = {
2689 {0, "NONE", 0, "", ""},
2690 {0, nullptr, 0, nullptr, nullptr},
2691 };
2692
2693 static const EnumPropertyItem flow_texture_types[] = {
2695 "AUTO",
2696 0,
2697 "Generated",
2698 "Generated coordinates centered to flow object"},
2699 {FLUID_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
2700 {0, nullptr, 0, nullptr, nullptr},
2701 };
2702
2703 srna = RNA_def_struct(brna, "FluidFlowSettings", nullptr);
2704 RNA_def_struct_ui_text(srna, "Flow Settings", "Fluid flow settings");
2705 RNA_def_struct_sdna(srna, "FluidFlowSettings");
2706 RNA_def_struct_path_func(srna, "rna_FluidFlowSettings_path");
2707
2708 prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
2709 RNA_def_property_float_sdna(prop, nullptr, "density");
2710 RNA_def_property_range(prop, 0.0, 10);
2711 RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
2712 RNA_def_property_ui_text(prop, "Density", "");
2713 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2714
2715 prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
2716 RNA_def_property_float_sdna(prop, nullptr, "color");
2717 RNA_def_property_array(prop, 3);
2718 RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke");
2719 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2720
2721 prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE);
2722 RNA_def_property_range(prop, 0.0, 10);
2723 RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4);
2724 RNA_def_property_ui_text(prop, "Flame Rate", "");
2725 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2726
2727 prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
2728 RNA_def_property_float_sdna(prop, nullptr, "temperature");
2729 RNA_def_property_range(prop, -10, 10);
2730 RNA_def_property_ui_range(prop, -10, 10, 1, 1);
2732 prop, "Temperature Difference", "Temperature difference to ambient temperature");
2733 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2734
2735 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
2736 RNA_def_property_pointer_sdna(prop, nullptr, "psys");
2737 RNA_def_property_struct_type(prop, "ParticleSystem");
2739 RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
2740 RNA_def_property_update(prop, 0, "rna_Fluid_reset_dependency");
2741
2742 prop = RNA_def_property(srna, "flow_type", PROP_ENUM, PROP_NONE);
2743 RNA_def_property_enum_sdna(prop, nullptr, "type");
2744 RNA_def_property_enum_items(prop, flow_type_items);
2745 RNA_def_property_enum_funcs(prop, nullptr, "rna_Fluid_flowtype_set", nullptr);
2746 RNA_def_property_ui_text(prop, "Flow Type", "Change type of fluid in the simulation");
2747 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2748
2749 prop = RNA_def_property(srna, "flow_behavior", PROP_ENUM, PROP_NONE);
2750 RNA_def_property_enum_sdna(prop, nullptr, "behavior");
2751 RNA_def_property_enum_items(prop, flow_behavior_items);
2752 RNA_def_property_ui_text(prop, "Flow Behavior", "Change flow behavior in the simulation");
2753 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2754
2755 prop = RNA_def_property(srna, "flow_source", PROP_ENUM, PROP_NONE);
2756 RNA_def_property_enum_sdna(prop, nullptr, "source");
2757 RNA_def_property_enum_items(prop, flow_sources);
2759 prop, nullptr, "rna_Fluid_flowsource_set", "rna_Fluid_flowsource_itemf");
2760 RNA_def_property_ui_text(prop, "Source", "Change how fluid is emitted");
2761 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2762
2763 prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
2764 RNA_def_property_boolean_sdna(prop, nullptr, "flags", FLUID_FLOW_ABSOLUTE);
2766 "Absolute Density",
2767 "Only allow given density value in emitter area and will not add up");
2768 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2769
2770 prop = RNA_def_property(srna, "use_initial_velocity", PROP_BOOLEAN, PROP_NONE);
2773 prop, "Initial Velocity", "Fluid has some initial velocity when it is emitted");
2774 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2775
2776 prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
2777 RNA_def_property_float_sdna(prop, nullptr, "vel_multi");
2778 RNA_def_property_range(prop, -100.0, 100.0);
2779 RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
2781 "Source",
2782 "Multiplier of source velocity passed to fluid (source velocity is "
2783 "non-zero only if object is moving)");
2784 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2785
2786 prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE);
2787 RNA_def_property_float_sdna(prop, nullptr, "vel_normal");
2788 RNA_def_property_range(prop, -100.0, 100.0);
2789 RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
2790 RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity");
2791 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2792
2793 prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE);
2794 RNA_def_property_float_sdna(prop, nullptr, "vel_random");
2795 RNA_def_property_range(prop, 0.0, 10.0);
2796 RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5);
2797 RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
2798 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2799
2800 prop = RNA_def_property(srna, "velocity_coord", PROP_FLOAT, PROP_VELOCITY);
2801 RNA_def_property_float_sdna(prop, nullptr, "vel_coord");
2802 RNA_def_property_array(prop, 3);
2803 RNA_def_property_range(prop, -1000.1, 1000.1);
2805 prop,
2806 "Initial",
2807 "Additional initial velocity in X, Y and Z direction (added to source velocity)");
2808 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2809
2810 prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_NONE);
2811 RNA_def_property_range(prop, 0.0, 1.0);
2812 RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
2814 "Volume Emission",
2815 "Controls fluid emission from within the mesh (higher value results in "
2816 "greater emissions from inside the mesh)");
2817 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2818
2819 prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
2820 RNA_def_property_range(prop, 0.0, 10.0);
2821 RNA_def_property_ui_range(prop, 0.0, 10.0, 0.05, 5);
2823 prop,
2824 "Surface Emission",
2825 "Height (in domain grid units) of fluid emission above the mesh surface. Higher values "
2826 "result in emission further away from the mesh surface. If this value and the emitter size "
2827 "are smaller than the domain grid unit, fluid will not be created");
2828 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2829
2830 prop = RNA_def_property(srna, "use_plane_init", PROP_BOOLEAN, PROP_NONE);
2833 prop,
2834 "Is Planar",
2835 "Treat this object as a planar and unclosed mesh. Fluid will only be emitted from the mesh "
2836 "surface and based on the surface emission value.");
2837 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2838
2839 prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
2840 RNA_def_property_range(prop, 0.1, FLT_MAX);
2841 RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
2842 RNA_def_property_ui_text(prop, "Size", "Particle size in simulation cells");
2843 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2844
2845 prop = RNA_def_property(srna, "use_particle_size", PROP_BOOLEAN, PROP_NONE);
2848 prop, "Set Size", "Set particle size in simulation cells or use nearest cell");
2849 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2850
2851 prop = RNA_def_property(srna, "use_inflow", PROP_BOOLEAN, PROP_NONE);
2853 RNA_def_property_ui_text(prop, "Use Flow", "Control when to apply fluid flow");
2854 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2855
2856 prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2857 RNA_def_property_range(prop, 0, 200);
2858 RNA_def_property_ui_range(prop, 0, 10, 1, -1);
2860 "Subframes",
2861 "Number of additional samples to take between frames to improve "
2862 "quality of fast moving flows");
2863 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2864
2865 prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE);
2867 "rna_FluidFlow_density_vgroup_get",
2868 "rna_FluidFlow_density_vgroup_length",
2869 "rna_FluidFlow_density_vgroup_set");
2871 prop, "Vertex Group", "Name of vertex group which determines surface emission rate");
2872 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2873
2874 prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
2876 RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength");
2877 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2878
2879 prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE);
2880 RNA_def_property_enum_sdna(prop, nullptr, "texture_type");
2881 RNA_def_property_enum_items(prop, flow_texture_types);
2883 RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type");
2884 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2885
2886 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
2887 RNA_def_property_string_sdna(prop, nullptr, "uvlayer_name");
2888 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
2889 RNA_def_property_string_funcs(prop, nullptr, nullptr, "rna_FluidFlow_uvlayer_set");
2890 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2891
2892 prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE);
2894 RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength");
2895 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2896
2897 prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE);
2898 RNA_def_property_range(prop, 0.01, 10.0);
2899 RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5);
2900 RNA_def_property_ui_text(prop, "Size", "Size of texture mapping");
2901 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2902
2903 prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE);
2904 RNA_def_property_range(prop, 0.0, 200.0);
2905 RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5);
2906 RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping");
2907 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_flow_reset");
2908}
2909
2911{
2912 static const EnumPropertyItem effector_type_items[] = {
2913 {FLUID_EFFECTOR_TYPE_COLLISION, "COLLISION", 0, "Collision", "Create collision object"},
2914 {FLUID_EFFECTOR_TYPE_GUIDE, "GUIDE", 0, "Guide", "Create guide object"},
2915 {0, nullptr, 0, nullptr, nullptr},
2916 };
2917
2918 static const EnumPropertyItem fluid_guide_mode_items[] = {
2920 "MAXIMUM",
2921 0,
2922 "Maximize",
2923 "Compare velocities from previous frame with new velocities from current frame and keep "
2924 "the maximum"},
2926 "MINIMUM",
2927 0,
2928 "Minimize",
2929 "Compare velocities from previous frame with new velocities from current frame and keep "
2930 "the minimum"},
2932 "OVERRIDE",
2933 0,
2934 "Override",
2935 "Always write new guide velocities for every frame (each frame only contains current "
2936 "velocities from guiding objects)"},
2938 "AVERAGED",
2939 0,
2940 "Averaged",
2941 "Take average of velocities from previous frame and new velocities from current frame"},
2942 {0, nullptr, 0, nullptr, nullptr},
2943 };
2944
2945 StructRNA *srna;
2946 PropertyRNA *prop;
2947
2948 srna = RNA_def_struct(brna, "FluidEffectorSettings", nullptr);
2949 RNA_def_struct_ui_text(srna, "Effector Settings", "Smoke collision settings");
2950 RNA_def_struct_sdna(srna, "FluidEffectorSettings");
2951 RNA_def_struct_path_func(srna, "rna_FluidEffectorSettings_path");
2952
2953 prop = RNA_def_property(srna, "effector_type", PROP_ENUM, PROP_NONE);
2954 RNA_def_property_enum_sdna(prop, nullptr, "type");
2955 RNA_def_property_enum_items(prop, effector_type_items);
2956 RNA_def_property_ui_text(prop, "Effector Type", "Change type of effector in the simulation");
2957 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_effector_reset");
2958
2959 prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_NONE);
2960 RNA_def_property_range(prop, 0.0, 10.0);
2961 RNA_def_property_ui_range(prop, 0.0, 10.0, 0.05, 5);
2963 prop, "Surface", "Additional distance around mesh surface to consider as effector");
2964 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_effector_reset");
2965
2966 prop = RNA_def_property(srna, "use_plane_init", PROP_BOOLEAN, PROP_NONE);
2968 RNA_def_property_ui_text(prop, "Is Planar", "Treat this object as a planar, unclosed mesh");
2969 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_domain_data_reset");
2970
2971 prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
2972 RNA_def_property_float_sdna(prop, nullptr, "vel_multi");
2973 RNA_def_property_range(prop, -100.0, 100.0);
2974 RNA_def_property_ui_text(prop, "Source", "Multiplier of obstacle velocity");
2975 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_effector_reset");
2976
2977 prop = RNA_def_property(srna, "guide_mode", PROP_ENUM, PROP_NONE);
2978 RNA_def_property_enum_sdna(prop, nullptr, "guide_mode");
2979 RNA_def_property_enum_items(prop, fluid_guide_mode_items);
2980 RNA_def_property_ui_text(prop, "Guiding mode", "How to create guiding velocities");
2981 RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_effector_reset");
2982
2983 prop = RNA_def_property(srna, "use_effector", PROP_BOOLEAN, PROP_NONE);
2985 RNA_def_property_ui_text(prop, "Enabled", "Control when to apply the effector");
2986 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_effector_reset");
2987
2988 prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
2989 RNA_def_property_range(prop, 0, 200);
2990 RNA_def_property_ui_range(prop, 0, 10, 1, -1);
2992 "Subframes",
2993 "Number of additional samples to take between frames to improve "
2994 "quality of fast moving effector objects");
2995 RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_effector_reset");
2996}
2997
3004
3005#endif
ColorBand * BKE_colorband_add(bool rangetype)
Definition colorband.cc:298
void BKE_fluid_modifier_reset(struct FluidModifierData *fmd)
Definition fluid.cc:4759
void BKE_fluid_particle_system_destroy(struct Object *ob, int particle_type)
void BKE_fluid_cache_endframe_set(struct FluidDomainSettings *settings, int value)
Definition fluid.cc:4496
void BKE_fluid_domain_type_set(struct Object *object, struct FluidDomainSettings *settings, int type)
Definition fluid.cc:4558
void BKE_fluid_cache_startframe_set(struct FluidDomainSettings *settings, int value)
Definition fluid.cc:4490
void BKE_fluid_cachetype_noise_set(struct FluidDomainSettings *settings, int cache_noise_format)
Definition fluid.cc:4529
void BKE_fluid_particle_system_create(struct Main *bmain, struct Object *ob, const char *pset_name, const char *parts_name, const char *psys_name, int psys_type)
void BKE_fluid_cachetype_particle_set(struct FluidDomainSettings *settings, int cache_particle_format)
Definition fluid.cc:4520
void BKE_fluid_fields_sanitize(struct FluidDomainSettings *settings)
Definition fluid.cc:4610
void BKE_fluid_cachetype_mesh_set(struct FluidDomainSettings *settings, int cache_mesh_format)
Definition fluid.cc:4502
void BKE_fluid_cachetype_data_set(struct FluidDomainSettings *settings, int cache_data_format)
Definition fluid.cc:4511
void BKE_fluid_cache_free(struct FluidDomainSettings *fds, struct Object *ob, int cache_map)
ModifierData * BKE_modifiers_findby_type(const Object *ob, ModifierType type)
MINLINE void copy_v3_v3_int(int r[3], const int a[3])
#define FILE_MAX
char * STRNCPY(char(&dst)[N], const char *src)
Definition BLI_string.h:693
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
pthread_rwlock_t ThreadRWMutex
#define THREAD_LOCK_READ
void BLI_rw_mutex_lock(ThreadRWMutex *mutex, int mode)
Definition threads.cc:467
void BLI_rw_mutex_unlock(ThreadRWMutex *mutex)
Definition threads.cc:477
#define UNUSED_VARS(...)
#define STREQ(a, b)
#define BLT_I18NCONTEXT_AMOUNT
#define BLT_I18NCONTEXT_ID_TEXTURE
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ FLUID_DOMAIN_GUIDE_SRC_EFFECTOR
@ FLUID_DOMAIN_GUIDE_SRC_DOMAIN
@ FLUID_FLOW_ABSOLUTE
@ FLUID_FLOW_TEXTUREEMIT
@ FLUID_FLOW_USE_PART_SIZE
@ FLUID_FLOW_NEEDS_UPDATE
@ FLUID_FLOW_USE_PLANE_INIT
@ FLUID_FLOW_INITVELOCITY
@ FLUID_FLOW_USE_INFLOW
@ FLUID_DOMAIN_BORDER_BOTTOM
@ FLUID_DOMAIN_BORDER_LEFT
@ FLUID_DOMAIN_BORDER_RIGHT
@ FLUID_DOMAIN_BORDER_FRONT
@ FLUID_DOMAIN_BORDER_TOP
@ FLUID_DOMAIN_BORDER_BACK
@ FLUID_DOMAIN_MESH_UNION
@ FLUID_DOMAIN_MESH_IMPROVED
@ FLUID_GRIDLINE_COLOR_TYPE_FLAGS
@ FLUID_GRIDLINE_COLOR_TYPE_RANGE
@ FLUID_GRIDLINE_COLOR_TYPE_NONE
@ VDB_COMPRESSION_NONE
@ VDB_COMPRESSION_ZIP
@ VDB_COMPRESSION_BLOSC
@ SNDPARTICLE_BOUNDARY_DELETE
@ SNDPARTICLE_BOUNDARY_PUSHOUT
@ FLUID_DOMAIN_FIELD_COLOR_B
@ FLUID_DOMAIN_FIELD_FLAME
@ FLUID_DOMAIN_FIELD_PHI_OUT
@ FLUID_DOMAIN_FIELD_FORCE_Z
@ FLUID_DOMAIN_FIELD_PHI_OBSTACLE
@ FLUID_DOMAIN_FIELD_FLAGS
@ FLUID_DOMAIN_FIELD_VELOCITY_Z
@ FLUID_DOMAIN_FIELD_FORCE_Y
@ FLUID_DOMAIN_FIELD_PHI
@ FLUID_DOMAIN_FIELD_PRESSURE
@ FLUID_DOMAIN_FIELD_VELOCITY_X
@ FLUID_DOMAIN_FIELD_DENSITY
@ FLUID_DOMAIN_FIELD_VELOCITY_Y
@ FLUID_DOMAIN_FIELD_PHI_IN
@ FLUID_DOMAIN_FIELD_HEAT
@ FLUID_DOMAIN_FIELD_COLOR_G
@ FLUID_DOMAIN_FIELD_FORCE_X
@ FLUID_DOMAIN_FIELD_FUEL
@ FLUID_DOMAIN_FIELD_COLOR_R
@ FLUID_FLOW_TYPE_FIRE
@ FLUID_FLOW_TYPE_SMOKEFIRE
@ FLUID_FLOW_TYPE_LIQUID
@ FLUID_FLOW_TYPE_SMOKE
@ FLUID_CELL_TYPE_OUTFLOW
@ FLUID_CELL_TYPE_FLUID
@ FLUID_CELL_TYPE_EMPTY
@ FLUID_CELL_TYPE_NONE
@ FLUID_CELL_TYPE_OBSTACLE
@ FLUID_CELL_TYPE_INFLOW
@ VECTOR_DRAW_NEEDLE
@ VECTOR_DRAW_STREAMLINE
@ VECTOR_DRAW_MAC
@ FLUID_DISPLAY_INTERP_CLOSEST
@ FLUID_DISPLAY_INTERP_CUBIC
@ FLUID_DISPLAY_INTERP_LINEAR
@ VECTOR_DRAW_MAC_X
@ VECTOR_DRAW_MAC_Y
@ VECTOR_DRAW_MAC_Z
@ FLUID_DOMAIN_TYPE_GAS
@ FLUID_DOMAIN_TYPE_LIQUID
@ SNDPARTICLE_COMBINED_EXPORT_OFF
@ SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM
@ SNDPARTICLE_COMBINED_EXPORT_SPRAY_BUBBLE
@ SNDPARTICLE_COMBINED_EXPORT_SPRAY_FOAM_BUBBLE
@ SNDPARTICLE_COMBINED_EXPORT_FOAM_BUBBLE
@ VDB_PRECISION_MINI_FLOAT
@ VDB_PRECISION_FULL_FLOAT
@ VDB_PRECISION_HALF_FLOAT
@ FLUID_EFFECTOR_NEEDS_UPDATE
@ FLUID_EFFECTOR_USE_EFFEC
@ FLUID_EFFECTOR_USE_PLANE_INIT
@ FLUID_DOMAIN_BAKED_DATA
@ FLUID_DOMAIN_OUTDATED_GUIDE
@ FLUID_DOMAIN_OUTDATED_PARTICLES
@ FLUID_DOMAIN_BAKING_MESH
@ FLUID_DOMAIN_BAKING_NOISE
@ FLUID_DOMAIN_BAKING_GUIDE
@ FLUID_DOMAIN_OUTDATED_NOISE
@ FLUID_DOMAIN_BAKED_NOISE
@ FLUID_DOMAIN_BAKED_MESH
@ FLUID_DOMAIN_OUTDATED_MESH
@ FLUID_DOMAIN_BAKING_DATA
@ FLUID_DOMAIN_BAKED_GUIDE
@ FLUID_DOMAIN_BAKED_PARTICLES
@ FLUID_DOMAIN_OUTDATED_DATA
@ FLUID_DOMAIN_BAKING_PARTICLES
@ SLICE_AXIS_X
@ SLICE_AXIS_AUTO
@ SLICE_AXIS_Z
@ SLICE_AXIS_Y
@ FLUID_DOMAIN_METHOD_FLIP
@ FLUID_DOMAIN_METHOD_APIC
@ FLUID_EFFECTOR_GUIDE_MAX
@ FLUID_EFFECTOR_GUIDE_OVERRIDE
@ FLUID_EFFECTOR_GUIDE_AVERAGED
@ FLUID_EFFECTOR_GUIDE_MIN
@ SM_HRES_NEAREST
@ SM_HRES_LINEAR
@ SM_HRES_FULLSAMPLE
@ FLUID_DOMAIN_FILE_BIN_OBJECT
@ FLUID_DOMAIN_FILE_RAW
@ FLUID_DOMAIN_FILE_OBJECT
@ FLUID_DOMAIN_FILE_UNI
@ FLUID_DOMAIN_FILE_OPENVDB
@ FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN
@ FLUID_DOMAIN_USE_MESH
@ FLUID_DOMAIN_DELETE_IN_OBSTACLE
@ FLUID_DOMAIN_USE_RESUMABLE_CACHE
@ FLUID_DOMAIN_USE_DISSOLVE_LOG
@ FLUID_DOMAIN_USE_DIFFUSION
@ FLUID_DOMAIN_USE_ADAPTIVE_TIME
@ FLUID_DOMAIN_USE_GUIDE
@ FLUID_DOMAIN_EXPORT_MANTA_SCRIPT
@ FLUID_DOMAIN_USE_VISCOSITY
@ FLUID_DOMAIN_USE_SPEED_VECTORS
@ FLUID_DOMAIN_USE_NOISE
@ FLUID_DOMAIN_USE_FRACTIONS
@ FLUID_DOMAIN_USE_DISSOLVE
@ FLUID_DOMAIN_CACHE_ALL
@ FLUID_DOMAIN_CACHE_REPLAY
@ FLUID_DOMAIN_CACHE_MODULAR
@ FLUID_FLOW_BEHAVIOR_GEOMETRY
@ FLUID_FLOW_BEHAVIOR_OUTFLOW
@ FLUID_FLOW_BEHAVIOR_INFLOW
@ FLUID_FLOW_TEXTURE_MAP_UV
@ FLUID_FLOW_TEXTURE_MAP_AUTO
@ FLUID_DOMAIN_VECTOR_FIELD_FORCE
@ FLUID_DOMAIN_VECTOR_FIELD_VELOCITY
@ FLUID_DOMAIN_VECTOR_FIELD_GUIDE_VELOCITY
#define FLUID_DOMAIN_BAKED_ALL
@ FLUID_FLOW_SOURCE_PARTICLES
@ FLUID_FLOW_SOURCE_MESH
@ FLUID_DOMAIN_PARTICLE_SPRAY
@ FLUID_DOMAIN_PARTICLE_FOAM
@ FLUID_DOMAIN_PARTICLE_TRACER
@ FLUID_DOMAIN_PARTICLE_FLIP
@ FLUID_DOMAIN_PARTICLE_BUBBLE
@ FLUID_EFFECTOR_TYPE_GUIDE
@ FLUID_EFFECTOR_TYPE_COLLISION
@ AXIS_SLICE_SINGLE
#define FLUID_DOMAIN_BAKING_ALL
@ eModifierType_Fluid
@ OB_MESH
@ PART_FLUID_FLIP
@ PART_FLUID_BUBBLE
@ PART_FLUID_SPRAYBUBBLE
@ PART_FLUID_TRACER
@ PART_FLUID_FOAM
@ PART_FLUID_SPRAYFOAMBUBBLE
@ PART_FLUID_SPRAYFOAM
@ PART_FLUID_SPRAY
@ PART_FLUID_FOAMBUBBLE
#define MAXFRAME
#define RNA_MAX_ARRAY_DIMENSION
Definition RNA_define.hh:27
@ PROP_FLOAT
Definition RNA_types.hh:164
@ PROP_BOOLEAN
Definition RNA_types.hh:162
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_INT
Definition RNA_types.hh:163
@ PROP_STRING
Definition RNA_types.hh:165
@ PROP_POINTER
Definition RNA_types.hh:167
@ PROPOVERRIDE_OVERRIDABLE_LIBRARY
Definition RNA_types.hh:503
@ PROP_DYNAMIC
Definition RNA_types.hh:428
@ PROP_ANIMATABLE
Definition RNA_types.hh:319
@ PROP_PATH_SUPPORTS_BLEND_RELATIVE
Definition RNA_types.hh:456
@ PROP_EDITABLE
Definition RNA_types.hh:306
@ PROP_NEVER_NULL
Definition RNA_types.hh:377
@ PROP_TIME
Definition RNA_types.hh:253
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_ACCELERATION
Definition RNA_types.hh:264
@ PROP_NONE
Definition RNA_types.hh:233
@ PROP_DIRPATH
Definition RNA_types.hh:237
@ PROP_FACTOR
Definition RNA_types.hh:251
@ PROP_COLOR_GAMMA
Definition RNA_types.hh:272
@ PROP_VELOCITY
Definition RNA_types.hh:263
#define ND_DRAW
Definition WM_types.hh:461
#define ND_MODIFIER
Definition WM_types.hh:462
#define NC_OBJECT
Definition WM_types.hh:379
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
#define printf(...)
float length(VecOp< float, D >) RET
float * manta_noise_get_density(struct MANTA *smoke)
bool manta_noise_has_colors(struct MANTA *smoke)
void manta_noise_get_rgba(struct MANTA *smoke, float *data, int sequential)
void manta_noise_get_res(struct MANTA *smoke, int *res)
float * manta_get_velocity_y(struct MANTA *fluid)
float * manta_smoke_get_density(struct MANTA *smoke)
float * manta_get_velocity_z(struct MANTA *fluid)
bool manta_smoke_has_colors(struct MANTA *smoke)
float * manta_get_velocity_x(struct MANTA *fluid)
void manta_noise_get_rgba_fixed_color(struct MANTA *smoke, float color[3], float *data, int sequential)
float * manta_smoke_get_heat(struct MANTA *smoke)
void manta_smoke_get_rgba(struct MANTA *smoke, float *data, int sequential)
float * manta_smoke_get_flame(struct MANTA *smoke)
float * manta_noise_get_flame(struct MANTA *smoke)
void manta_smoke_get_rgba_fixed_color(struct MANTA *smoke, float color[3], float *data, int sequential)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
static void rna_def_fluid_domain_settings(BlenderRNA *brna)
void RNA_def_fluid(BlenderRNA *brna)
static void rna_def_fluid_flow_settings(BlenderRNA *brna)
static void rna_def_fluid_effector_settings(BlenderRNA *brna)
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int result_maxncpy)
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
#define FLT_MAX
Definition stdcycles.h:14
const char * identifier
Definition RNA_types.hh:657
const char * name
Definition RNA_types.hh:661
const char * description
Definition RNA_types.hh:663
struct FluidDomainSettings * domain
ParticleSettings * part
struct ParticleSystem * next
i
Definition text_draw.cc:230
#define N_(msgid)
void WM_main_add_notifier(uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238