[Bf-blender-cvs] [8b7a20de97c] fluid-mantaflow: added narrow band field to UI
Sebastián Barschkis
noreply at git.blender.org
Tue Jun 13 15:22:13 CEST 2017
Commit: 8b7a20de97cc806b50eb0b6417fa30814a1b7a68
Author: Sebastián Barschkis
Date: Sun Jun 11 01:45:14 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB8b7a20de97cc806b50eb0b6417fa30814a1b7a68
added narrow band field to UI
being able to control the particle band width is useful when working with the FLIP particle cache. with a higher band width you can fill up the entire fluid volume with particles
===================================================================
M intern/mantaflow/intern/FLUID.cpp
M intern/mantaflow/intern/strings/liquid_script.h
M release/scripts/startup/bl_ui/properties_physics_smoke.py
M source/blender/blenkernel/intern/smoke.c
M source/blender/makesdna/DNA_smoke_types.h
M source/blender/makesrna/intern/rna_smoke.c
===================================================================
diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index a668922a335..6db78409b44 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -634,6 +634,8 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
ss << smd->domain->particle_number;
else if (varName == "PARTICLE_RADIUS")
ss << smd->domain->particle_radius;
+ else if (varName == "PARTICLE_BAND_WIDTH")
+ ss << smd->domain->particle_band_width;
else if (varName == "GRAVITY_X")
ss << smd->domain->gravity[0];
else if (varName == "GRAVITY_Y")
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index 6dc6600177b..05d1c508b8e 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -53,8 +53,9 @@ if doOpen_s$ID$:\n\
const std::string liquid_variables_low = "\n\
mantaMsg('Liquid variables low')\n\
-narrowBandWidth_s$ID$ = 3\n\
-combineBandWidth_s$ID$ = narrowBandWidth_s$ID$ - 1\n\
+narrowBandWidth_s$ID$ = 3\n\
+combineBandWidth_s$ID$ = narrowBandWidth_s$ID$ - 1\n\
+adjustedNarrowBandWidth_s$ID$ = $PARTICLE_BAND_WIDTH$ # only used in adjustNumber to control band width\n\
\n\
particleNumber_s$ID$ = $PARTICLE_NUMBER$\n\
minParticles_s$ID$ = pow(particleNumber_s$ID$, dim_s$ID$)\n\
@@ -258,7 +259,7 @@ def liquid_step_$ID$():\n\
\n\
# set source grids for resampling, used in adjustNumber!\n\
pVel_s$ID$.setSource(vel_s$ID$, isMAC=True)\n\
- adjustNumber(parts=pp_s$ID$, vel=vel_s$ID$, flags=flags_s$ID$, minParticles=1*minParticles_s$ID$, maxParticles=2*minParticles_s$ID$, phi=phi_s$ID$, exclude=phiObs_s$ID$, radiusFactor=radiusFactor_s$ID$, narrowBand=narrowBandWidth_s$ID$)\n\
+ adjustNumber(parts=pp_s$ID$, vel=vel_s$ID$, flags=flags_s$ID$, minParticles=1*minParticles_s$ID$, maxParticles=2*minParticles_s$ID$, phi=phi_s$ID$, exclude=phiObs_s$ID$, radiusFactor=radiusFactor_s$ID$, narrowBand=adjustedNarrowBandWidth_s$ID$)\n\
flipVelocityUpdate(vel=vel_s$ID$, velOld=velOld_s$ID$, flags=flags_s$ID$, parts=pp_s$ID$, partVel=pVel_s$ID$, flipRatio=0.97)\n";
const std::string liquid_step_high = "\n\
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 05ed6a66e71..93e775a886d 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -133,6 +133,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel, Panel):
col = split.column()
col.label()
col.prop(domain, "particle_number")
+ col.prop(domain, "particle_band_width")
elif md.smoke_type == 'FLOW':
flow = md.flow_settings
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 44bb8ddda16..34c6e239f04 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -600,6 +600,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->particle_randomness = 0.1f;
smd->domain->particle_number = 2;
smd->domain->particle_radius = 1.0f;
+ smd->domain->particle_band_width = 3.0f;
/*mantaflow settings*/
smd->domain->manta_solver_res = 3;
@@ -721,6 +722,7 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
tsmd->domain->particle_randomness = smd->domain->particle_randomness;
tsmd->domain->particle_number = smd->domain->particle_number;
tsmd->domain->particle_radius = smd->domain->particle_radius;
+ tsmd->domain->particle_band_width = smd->domain->particle_band_width;
tsmd->domain->manta_solver_res = smd->domain->manta_solver_res;
tsmd->domain->noise_pos_scale = smd->domain->noise_pos_scale;
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index e93425d2f00..d015888bf6c 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -243,7 +243,7 @@ typedef struct SmokeDomainSettings {
float particle_randomness;
int particle_number;
float particle_radius;
- int pad4;
+ float particle_band_width;
/* Display settings */
char slice_method, axis_slice_method;
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 4ea2933f487..e220895c489 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -1030,7 +1030,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.0, 10.0, 0.02, 5);
RNA_def_property_ui_text(prop, "Radius", "Particle radius factor (higher value results in larger particles)");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
+
+ prop = RNA_def_property(srna, "particle_band_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_range(prop, 0.0, 10.0, 0.02, 5);
+ RNA_def_property_ui_text(prop, "Width", "Particle (narrow) band width (higher value results in thicker band and more particles)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
RNA_def_property_float_sdna(prop, NULL, "gravity");
RNA_def_property_array(prop, 3);
More information about the Bf-blender-cvs
mailing list