Fluid: Fix T72971

Incorporated suggestions from the task discussion
This commit is contained in:
Sebastián Barschkis 2020-01-15 15:51:33 +01:00
parent adcc9d014c
commit cdd937c6dd
Notes: blender-bot 2023-02-14 09:48:25 +01:00
Referenced by issue #72971, [Mantaflow] FLIP particles not visible
3 changed files with 9 additions and 5 deletions

View File

@ -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()

View File

@ -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;
}

View File

@ -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 */