[Bf-blender-cvs] [d571e9055a0] master: Fluid: Fix T72971

Sebastián Barschkis noreply at git.blender.org
Wed Jan 15 15:52:11 CET 2020


Commit: d571e9055a0a81f4bd1fd9f574b81783d3f648fd
Author: Sebastián Barschkis
Date:   Wed Jan 15 15:51:33 2020 +0100
Branches: master
https://developer.blender.org/rBd571e9055a0a81f4bd1fd9f574b81783d3f648fd

Fluid: Fix T72971

Incorporated suggestions from the task discussion

===================================================================

M	release/scripts/startup/bl_operators/object_quick_effects.py
M	source/blender/blenkernel/intern/fluid.c
M	source/blender/makesrna/intern/rna_fluid.c

===================================================================

diff --git a/release/scripts/startup/bl_operators/object_quick_effects.py b/release/scripts/startup/bl_operators/object_quick_effects.py
index e49ca0320c7..009ae53fa80 100644
--- a/release/scripts/startup/bl_operators/object_quick_effects.py
+++ b/release/scripts/startup/bl_operators/object_quick_effects.py
@@ -499,7 +499,6 @@ class QuickLiquid(Operator):
         # setup liquid domain
         bpy.ops.object.modifier_add(type='FLUID')
         obj.modifiers[-1].fluid_type = 'DOMAIN'
-        obj.modifiers[-1].domain_settings.domain_type = 'LIQUID'
         # set all domain borders to obstacle
         obj.modifiers[-1].domain_settings.use_collision_border_front = True
         obj.modifiers[-1].domain_settings.use_collision_border_back = True
@@ -511,8 +510,8 @@ class QuickLiquid(Operator):
         # set correct cache file format for liquid
         obj.modifiers[-1].domain_settings.cache_mesh_format = 'BOBJECT'
 
-        # allocate and show particle system for FLIP
-        obj.modifiers[-1].domain_settings.use_flip_particles = True
+        # change domain type, will also allocate and show particle system for FLIP
+        obj.modifiers[-1].domain_settings.domain_type = 'LIQUID'
 
         # make the domain smooth so it renders nicely
         bpy.ops.object.shade_smooth()
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 1900f6ebaad..1bd86f3c690 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -4268,7 +4268,6 @@ void BKE_fluid_domain_type_set(Object *object, FluidDomainSettings *settings, in
     BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_LEFT, 0);
     BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_TOP, 0);
     BKE_fluid_collisionextents_set(settings, FLUID_DOMAIN_BORDER_BOTTOM, 0);
-    BKE_fluid_particles_set(settings, FLUID_DOMAIN_PARTICLE_FLIP, 0);
     object->dt = OB_SOLID;
   }
 
diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c
index 53fa863f6da..2e7170a32d6 100644
--- a/source/blender/makesrna/intern/rna_fluid.c
+++ b/source/blender/makesrna/intern/rna_fluid.c
@@ -176,6 +176,12 @@ static void rna_Fluid_flip_parts_update(Main *bmain, Scene *scene, PointerRNA *p
   mmd = (FluidModifierData *)modifiers_findByType(ob, eModifierType_Fluid);
   bool exists = rna_Fluid_parts_exists(ptr, PART_FLUID_FLIP);
 
+  /* Only create a particle system in liquid domain mode. */
+  if (mmd->domain->type != FLUID_DOMAIN_TYPE_LIQUID) {
+    rna_Fluid_reset(bmain, scene, ptr);
+    return;
+  }
+
   if (ob->type == OB_MESH && !exists) {
     rna_Fluid_parts_create(bmain,
                            ptr,
@@ -1330,7 +1336,7 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna)
   RNA_def_property_enum_items(prop, domain_types);
   RNA_def_property_enum_funcs(prop, NULL, "rna_Fluid_domaintype_set", NULL);
   RNA_def_property_ui_text(prop, "Domain Type", "Change domain type of the simulation");
-  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_reset");
+  RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Fluid_flip_parts_update");
 
   /* smoke domain options */



More information about the Bf-blender-cvs mailing list