diff options
-rw-r--r-- | intern/mantaflow/intern/MANTA_main.cpp | 1 | ||||
-rw-r--r-- | intern/mantaflow/intern/strings/liquid_script.h | 3 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/properties_physics_fluid.py | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 1 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_290.c | 13 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_fluid_defaults.h | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_fluid_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fluid.c | 12 |
8 files changed, 34 insertions, 3 deletions
diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp index ef7cd4721b0..e15fe809b2d 100644 --- a/intern/mantaflow/intern/MANTA_main.cpp +++ b/intern/mantaflow/intern/MANTA_main.cpp @@ -845,6 +845,7 @@ void MANTA::initializeRNAMap(FluidModifierData *fmd) mRNAMap["PARTICLE_MAXIMUM"] = to_string(fds->particle_maximum); mRNAMap["PARTICLE_RADIUS"] = to_string(fds->particle_radius); mRNAMap["FRACTIONS_THRESHOLD"] = to_string(fds->fractions_threshold); + mRNAMap["FRACTIONS_DISTANCE"] = to_string(fds->fractions_distance); mRNAMap["MESH_CONCAVE_UPPER"] = to_string(fds->mesh_concave_upper); mRNAMap["MESH_CONCAVE_LOWER"] = to_string(fds->mesh_concave_lower); mRNAMap["MESH_PARTICLE_RADIUS"] = to_string(fds->mesh_particle_radius); diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h index 6e78fce1d61..683d89a9cfc 100644 --- a/intern/mantaflow/intern/strings/liquid_script.h +++ b/intern/mantaflow/intern/strings/liquid_script.h @@ -41,6 +41,7 @@ using_mesh_s$ID$ = $USING_MESH$\n\ using_final_mesh_s$ID$ = $USING_IMPROVED_MESH$\n\ using_fractions_s$ID$ = $USING_FRACTIONS$\n\ fracThreshold_s$ID$ = $FRACTIONS_THRESHOLD$\n\ +fracDistance_s$ID$ = $FRACTIONS_DISTANCE$\n\ flipRatio_s$ID$ = $FLIP_RATIO$\n\ concaveUpper_s$ID$ = $MESH_CONCAVE_UPPER$\n\ concaveLower_s$ID$ = $MESH_CONCAVE_LOWER$\n\ @@ -243,6 +244,8 @@ def liquid_step_$ID$():\n\ pp_s$ID$.advectInGrid(flags=flags_s$ID$, vel=vel_s$ID$, integrationMode=IntRK4, deleteInObstacle=deleteInObstacle_s$ID$, stopInObstacle=False, skipNew=True)\n\ \n\ mantaMsg('Pushing particles out of obstacles')\n\ + if using_obstacle_s$ID$:\n\ + pushOutofObs(parts=pp_s$ID$, flags=flags_s$ID$, phiObs=phiObsIn_s$ID$, thresh=fracDistance_s$ID$)\n\ pushOutofObs(parts=pp_s$ID$, flags=flags_s$ID$, phiObs=phiObs_s$ID$)\n\ \n\ # save original states for later (used during mesh / secondary particle creation)\n\ diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py index 1f5a96f2705..779bdb5cd11 100644 --- a/release/scripts/startup/bl_ui/properties_physics_fluid.py +++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py @@ -507,7 +507,8 @@ class PHYSICS_PT_liquid(PhysicButtonsPanel, Panel): col.prop(domain, "use_fractions", text="Fractional Obstacles") sub = col.column() sub.active = domain.use_fractions - sub.prop(domain, "fractions_threshold", text="Obstacle-Fluid Threshold") + sub.prop(domain, "fractions_distance", text="Obstacle Distance") + sub.prop(domain, "fractions_threshold", text="Threshold") class PHYSICS_PT_flow_source(PhysicButtonsPanel, Panel): diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index f66ba428611..9ad352c8455 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -4985,6 +4985,7 @@ void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd, tfds->particle_radius = fds->particle_radius; tfds->particle_band_width = fds->particle_band_width; tfds->fractions_threshold = fds->fractions_threshold; + tfds->fractions_distance = fds->fractions_distance; tfds->sys_particle_maximum = fds->sys_particle_maximum; /* diffusion options*/ diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index f08e896744b..8622264188a 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -912,4 +912,17 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + if (!DNA_struct_elem_find(fd->filesdna, "FluidModifierData", "float", "fractions_distance")) { + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { + if (md->type == eModifierType_Fluid) { + FluidModifierData *fmd = (FluidModifierData *)md; + if (fmd->domain) { + fmd->domain->fractions_distance = 0.5; + } + } + } + } + } } diff --git a/source/blender/makesdna/DNA_fluid_defaults.h b/source/blender/makesdna/DNA_fluid_defaults.h index 14ea874a674..2ee83cf3387 100644 --- a/source/blender/makesdna/DNA_fluid_defaults.h +++ b/source/blender/makesdna/DNA_fluid_defaults.h @@ -109,6 +109,7 @@ .particle_radius = 1.0f, \ .particle_band_width = 3.0f, \ .fractions_threshold = 0.05f, \ + .fractions_distance = 0.5f, \ .flip_ratio = 0.97f, \ .sys_particle_maximum = 0, \ .simulation_method = FLUID_DOMAIN_METHOD_FLIP, \ diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h index afb2a294605..2786d4df868 100644 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@ -586,10 +586,11 @@ typedef struct FluidDomainSettings { float particle_radius; float particle_band_width; float fractions_threshold; + float fractions_distance; float flip_ratio; int sys_particle_maximum; short simulation_method; - char _pad4[2]; + char _pad4[6]; /* Diffusion options. */ float surface_tension; diff --git a/source/blender/makesrna/intern/rna_fluid.c b/source/blender/makesrna/intern/rna_fluid.c index 84187786c46..60eed60ace1 100644 --- a/source/blender/makesrna/intern/rna_fluid.c +++ b/source/blender/makesrna/intern/rna_fluid.c @@ -1895,12 +1895,22 @@ static void rna_def_fluid_domain_settings(BlenderRNA *brna) RNA_def_property_range(prop, 0.001, 1.0); RNA_def_property_ui_range(prop, 0.01, 1.0, 0.05, -1); RNA_def_property_ui_text(prop, - "Obstacle-Fluid Threshold", + "Obstacle Threshold", "Determines how much fluid is allowed in an obstacle cell " "(higher values will tag a boundary cell as an obstacle easier " "and reduce the boundary smoothening effect)"); RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); + prop = RNA_def_property(srna, "fractions_distance", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, -5.0, 5.0); + RNA_def_property_ui_range(prop, 0.01, 5.0, 0.1, -1); + RNA_def_property_ui_text(prop, + "Obstacle Distance", + "Determines how far apart fluid and obstacle are (higher values will " + "result in fluid being further away from obstacles, smaller values " + "will let fluid move towards the inside of obstacles)"); + RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Fluid_datacache_reset"); + prop = RNA_def_property(srna, "sys_particle_maximum", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "sys_particle_maximum"); RNA_def_property_range(prop, 0, INT_MAX); |