[Bf-blender-cvs] [d724a450927] fluid-mantaflow: added bubble control to UI

Sebastián Barschkis noreply at git.blender.org
Fri Jul 21 16:17:38 CEST 2017


Commit: d724a450927666d5935421050b4f66c67fe8fc64
Author: Sebastián Barschkis
Date:   Wed Jul 19 00:41:37 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rBd724a450927666d5935421050b4f66c67fe8fc64

added bubble control to UI

control how much gravity affects bubbles, i.e. control how fast they rise

===================================================================

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 4e09415c683..0a8b8c77b76 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -659,6 +659,8 @@ std::string FLUID::getRealValue(const std::string& varName,  SmokeModifierData *
 		ss << smd->domain->particle_band_width;
 	else if (varName == "SNDPARTICLE_VEL_THRESH")
 		ss << smd->domain->particle_velocity_threshold;
+	else if (varName == "SNDPARTICLE_BUBBLE_RISE")
+		ss << smd->domain->particle_bubble_rise;
 	else if (varName == "USING_DROP_PARTS")
 		ss << (smd->domain->particle_type & MOD_SMOKE_PARTICLE_DROP ? "True" : "False");
 	else if (varName == "USING_BUBBLE_PARTS")
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index 0e42b170964..76e59a6c26b 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -204,7 +204,7 @@ def liquid_step_$ID$():\n\
     \n\
     mantaMsg('Sampling secondary particles')\n\
     if (using_drops_s$ID$ or using_bubbles_s$ID$ or using_floats_s$ID$ or using_tracers_s$ID$):\n\
-        sampleSndParts(parts=ppSnd_s$ID$, flags=flags_s$ID$, vel=vel_s$ID$, partVel=pVelSnd_pp$ID$, partType=pTypeSnd_pp$ID$, phi=phi_s$ID$, dropVelThresh=$SNDPARTICLE_VEL_THRESH$, bubbleRise=0.5, minParticles=2, maxParticles=8, gravity=gravity_s$ID$, drops=using_drops_s$ID$, bubbles=using_bubbles_s$ID$, floats=using_floats_s$ID$, tracers=using_tracers_s$ID$)\n\
+        sampleSndParts(parts=ppSnd_s$ID$, flags=flags_s$ID$, vel=vel_s$ID$, partVel=pVelSnd_pp$ID$, partType=pTypeSnd_pp$ID$, phi=phi_s$ID$, dropVelThresh=$SNDPARTICLE_VEL_THRESH$, bubbleRise=$SNDPARTICLE_BUBBLE_RISE$, minParticles=2, maxParticles=8, gravity=gravity_s$ID$, drops=using_drops_s$ID$, bubbles=using_bubbles_s$ID$, floats=using_floats_s$ID$, tracers=using_tracers_s$ID$)\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/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index c2092a606ca..b89c596da36 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -372,6 +372,7 @@ class PHYSICS_PT_smoke_particles(PhysicButtonsPanel, Panel):
         sub.active = domain.use_drop_particles
         sub.label()
         sub.prop(domain, "particle_velocity_threshold", text="Threshold")
+        sub.prop(domain, "particle_bubble_rise", text="Rise")
 
 class PHYSICS_PT_smoke_groups(PhysicButtonsPanel, Panel):
     bl_label = "Fluid Groups"
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 51a565e002f..f58fb029729 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -543,6 +543,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
 			smd->domain->particle_radius = 1.0f;
 			smd->domain->particle_band_width = 3.0f;
 			smd->domain->particle_velocity_threshold = 2.0f;
+			smd->domain->particle_bubble_rise = 0.5f;
 			smd->domain->particle_type = 0;
 
 			/*mantaflow settings*/
@@ -669,6 +670,7 @@ void smokeModifier_copy(struct SmokeModifierData *smd, struct SmokeModifierData
 		tsmd->domain->particle_radius = smd->domain->particle_radius;
 		tsmd->domain->particle_band_width = smd->domain->particle_band_width;
 		tsmd->domain->particle_velocity_threshold = smd->domain->particle_velocity_threshold;
+		tsmd->domain->particle_bubble_rise = smd->domain->particle_bubble_rise;
 
 		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 c241ee6835a..85c51db71ac 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -248,7 +248,9 @@ typedef struct SmokeDomainSettings {
 	float particle_radius;
 	float particle_band_width;
 	float particle_velocity_threshold;
+	float particle_bubble_rise;
 	int particle_type;
+	float pad4;
 
 	/* 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 b6e4b75f439..ac165898fe0 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -1296,6 +1296,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Threshold", "Velocity threshold for drop particle generation (higher value results in fewer drops)");
 	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
 
+	prop = RNA_def_property(srna, "particle_bubble_rise", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_range(prop, 0.0, 1.0);
+	RNA_def_property_ui_range(prop, 0.0, 1.0, 0.02, 5);
+	RNA_def_property_ui_text(prop, "Rise", "How much of inverse gravity to apply on bubbles (higher value results in faster rising bubbles)");
+	RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
 	/* display settings */
 
 	prop = RNA_def_property(srna, "slice_method", PROP_ENUM, PROP_NONE);




More information about the Bf-blender-cvs mailing list