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