[Bf-blender-cvs] [8067321] fluid-mantaflow: added particle number (discretization) field to ui
Sebastián Barschkis
noreply at git.blender.org
Fri Aug 19 18:56:08 CEST 2016
Commit: 806732120684d184df6cc726ec0a745d99aee1eb
Author: Sebastián Barschkis
Date: Wed Aug 17 19:21:24 2016 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB806732120684d184df6cc726ec0a745d99aee1eb
added particle number (discretization) field to ui
===================================================================
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 011de9e..f78e53d 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -581,6 +581,8 @@ std::string FLUID::getRealValue(const std::string& varName, SmokeModifierData *
ss << md->scene->r.cfra;
else if (varName == "RANDOMNESS")
ss << smd->domain->particle_randomness;
+ else if (varName == "PARTICLE_NUMBER")
+ ss << smd->domain->particle_number;
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 8e375ac..3109e9b 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -58,7 +58,7 @@ narrowBandWidth = 3\n\
combineBandWidth = narrowBandWidth - 1\n\
\n\
minParticles = pow(2,dim)\n\
-particleNumber = 2\n\
+particleNumber = $PARTICLE_NUMBER$\n\
radiusFactor = 1.0\n\
randomness = $RANDOMNESS$\n\
\n\
@@ -123,7 +123,7 @@ def manta_step(start_frame):\n\
s.timeTotal = s.frame * dt0\n\
last_frame = s.frame\n\
\n\
- sampleLevelsetWithParticles( phi=phiInit, flags=flags, parts=pp, discretization=2, randomness=randomness, refillEmpty=True )\n\
+ sampleLevelsetWithParticles( phi=phiInit, flags=flags, parts=pp, discretization=particleNumber, randomness=randomness, refillEmpty=True )\n\
mapGridToPartsVec3(source=vel, parts=pp, target=pVel )\n\
phi.join(phiInit)\n\
flags.updateFromLevelset(phi)\n\
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index 4169386..e20c9b5 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -111,6 +111,10 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
col.label(text="Liquid:")
col.prop(domain, "particle_randomness")
+ col = split.column(align=True)
+ col.label()
+ col.prop(domain, "particle_number")
+
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 f900069..0f7cbaa 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -590,6 +590,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
/* liquid */
smd->domain->particle_randomness = 0.1f;
+ smd->domain->particle_number = 2;
#ifdef WITH_MANTA
/*mantaflow settings*/
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 63e7279..bebaf17 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -187,7 +187,7 @@ typedef struct SmokeDomainSettings {
/* liquid parameters */
float particle_randomness;
- float mock_var2;
+ int particle_number;
/* mantaflow settings */
struct FLUID *fluid;
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index be89837..ee3f9e9 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -818,6 +818,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Randomness", "Randomness factor for particle sampling");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "particle_number", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 3);
+ RNA_def_property_ui_range(prop, 1, 3, 2, -1);
+ RNA_def_property_ui_text(prop, "Discretization", "Particle number factor (higher value results in more particles)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
}
static void rna_def_smoke_flow_settings(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list