diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-03-04 19:23:09 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-03-04 20:46:48 +0300 |
commit | 6958ec3f7fc23b0ad605c0cfbdbb38417e89f81f (patch) | |
tree | 864d104ad32ae399abc4d609bce5455c0b7d0f8f | |
parent | b32fd73b244a5c72b46926ffc1d20e3796fc2138 (diff) |
Fluid: Added an option to delete fluid inside obstacles
Simple checkbox that - if enabled - will tell the solver to clear density or liquid particles in obstacle cells.
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.cpp | 2 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/fluid_script.h | 7 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 2 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/smoke_script.h | 3 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_fluid.py | 2 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_fluid_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluid.c | 5 |
7 files changed, 17 insertions, 7 deletions
diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index 2566e9b45b8..89e505fcf97 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -977,6 +977,8 @@ std::string MANTA::getRealValue(const std::string &varName, FluidModifierData *m ss << (mmd->domain->flags & FLUID_DOMAIN_USE_SPEED_VECTORS ? "True" : "False"); else if (varName == "USING_FRACTIONS") ss << (mmd->domain->flags & FLUID_DOMAIN_USE_FRACTIONS ? "True" : "False"); + else if (varName == "DELETE_IN_OBSTACLE") + ss << (mmd->domain->flags & FLUID_DOMAIN_DELETE_IN_OBSTACLE ? "True" : "False"); else std::cout << "ERROR: Unknown option: " << varName << std::endl; return ss.str(); diff --git a/intern/mantaflow/intern/strings/fluid_script.h b/intern/mantaflow/intern/strings/fluid_script.h index 6ddf97e7b3f..0442609a15d 100644 --- a/intern/mantaflow/intern/strings/fluid_script.h +++ b/intern/mantaflow/intern/strings/fluid_script.h @@ -96,9 +96,10 @@ gravity_s$ID$ = vec3($GRAVITY_X$, $GRAVITY_Y$, $GRAVITY_Z$)\n\ gs_s$ID$ = vec3($RESX$, $RESY$, $RESZ$)\n\ maxVel_s$ID$ = 0\n\ \n\ -doOpen_s$ID$ = $DO_OPEN$\n\ -boundConditions_s$ID$ = '$BOUND_CONDITIONS$'\n\ -boundaryWidth_s$ID$ = $BOUNDARY_WIDTH$\n\ +doOpen_s$ID$ = $DO_OPEN$\n\ +boundConditions_s$ID$ = '$BOUND_CONDITIONS$'\n\ +boundaryWidth_s$ID$ = $BOUNDARY_WIDTH$\n\ +deleteInObstacle_s$ID$ = $DELETE_IN_OBSTACLE$\n\ \n\ using_smoke_s$ID$ = $USING_SMOKE$\n\ using_liquid_s$ID$ = $USING_LIQUID$\n\ diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index d885296ec17..0d20c4cb204 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -212,7 +212,7 @@ def liquid_step_$ID$():\n\ mantaMsg('Liquid step')\n\ \n\ mantaMsg('Advecting particles')\n\ - pp_s$ID$.advectInGrid(flags=flags_s$ID$, vel=vel_s$ID$, integrationMode=IntRK4, deleteInObstacle=False, stopInObstacle=False)\n\ + pp_s$ID$.advectInGrid(flags=flags_s$ID$, vel=vel_s$ID$, integrationMode=IntRK4, deleteInObstacle=deleteInObstacle_s$ID$, stopInObstacle=False)\n\ \n\ mantaMsg('Pushing particles out of obstacles')\n\ pushOutofObs(parts=pp_s$ID$, flags=flags_s$ID$, phiObs=phiObs_s$ID$)\n\ diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h index 119f5cd0a88..719ebbfef3e 100644 --- a/intern/mantaflow/intern/strings/smoke_script.h +++ b/intern/mantaflow/intern/strings/smoke_script.h @@ -379,7 +379,8 @@ def smoke_step_$ID$():\n\ resampleVec3ToMac(source=obvelC_s$ID$, target=obvel_s$ID$)\n\ \n\ # Cells inside obstacle should not contain any density, fire, etc.\n\ - resetInObstacle(flags=flags_s$ID$, density=density_s$ID$, vel=vel_s$ID$, heat=heat_s$ID$, fuel=fuel_s$ID$, flame=flame_s$ID$, red=color_r_s$ID$, green=color_g_s$ID$, blue=color_b_s$ID$)\n\ + if deleteInObstacle_s$ID$:\n\ + resetInObstacle(flags=flags_s$ID$, density=density_s$ID$, vel=vel_s$ID$, heat=heat_s$ID$, fuel=fuel_s$ID$, flame=flame_s$ID$, red=color_r_s$ID$, green=color_g_s$ID$, blue=color_b_s$ID$)\n\ \n\ # add initial velocity\n\ if using_invel_s$ID$:\n\ diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 4d6d3d8f607..04297fc725b 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -271,10 +271,10 @@ class PHYSICS_PT_settings(PhysicButtonsPanel, Panel): col.prop(effector_settings, "use_plane_init", text="Is Planar") col.prop(effector_settings, "surface_distance", text="Surface Thickness") + col.prop(effector_settings, "delete_in_obstacle", text="Delete In Obstacle") if effector_settings.effector_type == 'GUIDE': col.prop(effector_settings, "velocity_factor", text="Velocity Factor") - col = flow.column() col.prop(effector_settings, "guide_mode", text="Guide Mode") diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h index e12bee13ebc..783babdaa1c 100644 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@ -41,6 +41,7 @@ enum { FLUID_DOMAIN_USE_SPEED_VECTORS = (1 << 11), /* Generate mesh speed vectors. */ FLUID_DOMAIN_EXPORT_MANTA_SCRIPT = (1 << 12), /* Export mantaflow script during bake. */ FLUID_DOMAIN_USE_FRACTIONS = (1 << 13), /* Use second order obstacles. */ + FLUID_DOMAIN_DELETE_IN_OBSTACLE = (1 << 14), /* Delete fluid inside obstacles. */ }; /* Border collisions. */ @@ -494,7 +495,7 @@ enum { FLUID_FLOW_USE_PART_SIZE = (1 << 4), /* Control when to apply inflow. */ FLUID_FLOW_USE_INFLOW = (1 << 5), - /* Control when to apply inflow. */ + /* Control how to initialize flow objects. */ FLUID_FLOW_USE_PLANE_INIT = (1 << 6), }; diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index d4bc02bbf3e..7edb1cfaa81 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -2539,6 +2539,11 @@ static void rna_def_fluid_effector_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Is Planar", "Treat this object as a planar, unclosed mesh"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); + prop = RNA_def_property(srna, "delete_in_obstacle", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flags", FLUID_DOMAIN_DELETE_IN_OBSTACLE); + RNA_def_property_ui_text(prop, "Clear In Obstacle", "Delete fluid inside obstacles"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_reset"); + prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "vel_multi"); RNA_def_property_range(prop, -100.0, 100.0); |