[Bf-blender-cvs] [0df08c66c1b] fluid-mantaflow: fix for smoke guiding and some cleanup

Sebastián Barschkis noreply at git.blender.org
Fri Jul 13 10:28:07 CEST 2018


Commit: 0df08c66c1bce0f6be51f73aca39a009c047d092
Author: Sebastián Barschkis
Date:   Fri Jul 13 10:27:41 2018 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB0df08c66c1bce0f6be51f73aca39a009c047d092

fix for smoke guiding and some cleanup

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

M	intern/mantaflow/intern/FLUID.cpp
M	intern/mantaflow/intern/strings/liquid_script.h
M	intern/mantaflow/intern/strings/smoke_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 e85fe585532..e2fa5884d70 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -351,7 +351,7 @@ void FLUID::initFireHigh(SmokeModifierData *smd)
 {
 	if (!mFuelHigh) {
 		std::vector<std::string> pythonCommands;
-		std::string tmpString = smoke_alloc_fire_high
+		std::string tmpString = smoke_alloc_fire_noise
 			+ smoke_with_fire;
 		std::string finalString = parseScript(tmpString, smd);
 		pythonCommands.push_back(finalString);
@@ -1476,7 +1476,7 @@ void FLUID::exportSmokeScript(SmokeModifierData *smd)
 		if (colors)
 			manta_script += smoke_alloc_colors_noise;
 		if (fire)
-			manta_script += smoke_alloc_fire_high;
+			manta_script += smoke_alloc_fire_noise;
 	}
 
 	manta_script += smoke_load_data;
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index e201619e5d3..29e5b418d62 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -34,7 +34,7 @@
 //////////////////////////////////////////////////////////////////////
 
 const std::string liquid_variables = "\n\
-mantaMsg('Liquid variables low')\n\
+mantaMsg('Liquid variables')\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\
@@ -57,7 +57,7 @@ surfaceTension_s$ID$   = $LIQUID_SURFACE_TENSION$\n";
 //////////////////////////////////////////////////////////////////////
 
 const std::string liquid_alloc = "\n\
-mantaMsg('Liquid alloc low')\n\
+mantaMsg('Liquid alloc')\n\
 phiParts_s$ID$   = s$ID$.create(LevelsetGrid)\n\
 phi_s$ID$        = s$ID$.create(LevelsetGrid)\n\
 phiTmp_s$ID$     = s$ID$.create(LevelsetGrid)\n\
@@ -82,7 +82,7 @@ liquid_data_dict_s$ID$ = dict(phiParts=phiParts_s$ID$, phi=phi_s$ID$, phiIn=phiI
 liquid_flip_dict_s$ID$ = dict(pp=pp_s$ID$, pVel=pVel_pp$ID$)\n";
 
 const std::string liquid_alloc_mesh = "\n\
-mantaMsg('Liquid alloc high')\n\
+mantaMsg('Liquid alloc mesh')\n\
 phiParts_sm$ID$ = sm$ID$.create(LevelsetGrid)\n\
 phi_sm$ID$      = sm$ID$.create(LevelsetGrid)\n\
 pp_sm$ID$       = sm$ID$.create(BasicParticleSystem)\n\
@@ -176,7 +176,7 @@ def liquid_adaptive_step_$ID$(framenr):\n\
     flags_s$ID$.updateFromLevelset(phi_s$ID$, phiObs_s$ID$)\n\
     mapWeights_s$ID$.clear() # clean up, mapweights grid used later again\n\
     \n\
-    mantaMsg('Low step / s$ID$.frame: ' + str(s$ID$.frame))\n\
+    mantaMsg('Liquid step / s$ID$.frame: ' + str(s$ID$.frame))\n\
     liquid_step_$ID$()\n\
     \n\
     s$ID$.step()\n\
@@ -185,7 +185,7 @@ def liquid_adaptive_step_$ID$(framenr):\n\
 
 const std::string liquid_step = "\n\
 def liquid_step_$ID$():\n\
-    mantaMsg('Liquid step low')\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\
diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h
index 22fbad2734b..c25233706ae 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -35,15 +35,15 @@
 
 const std::string smoke_bounds = "\n\
 # prepare domain low\n\
-mantaMsg('Smoke domain low')\n\
+mantaMsg('Smoke domain')\n\
 flags_s$ID$.initDomain(boundaryWidth=boundaryWidth_s$ID$)\n\
 flags_s$ID$.fillGrid()\n\
 if doOpen_s$ID$:\n\
     setOpenBound(flags=flags_s$ID$, bWidth=boundaryWidth_s$ID$, openBound=boundConditions_s$ID$, type=FlagOutflow|FlagEmpty)\n";
 
 const std::string smoke_bounds_noise = "\n\
-# prepare domain high\n\
-mantaMsg('Smoke domain high')\n\
+# prepare noise domain\n\
+mantaMsg('Smoke domain noise')\n\
 flags_sn$ID$.initDomain(boundaryWidth=boundaryWidth_s$ID$)\n\
 flags_sn$ID$.fillGrid()\n\
 if doOpen_s$ID$:\n\
@@ -65,7 +65,7 @@ buoyancy_heat_s$ID$   = $BUOYANCY_BETA$\n\
 absoluteFlow_s$ID$    = True\n";
 
 const std::string smoke_variables_noise = "\n\
-mantaMsg('Smoke variables high')\n\
+mantaMsg('Smoke variables noise')\n\
 wltStrength_s$ID$ = $WLT_STR$\n\
 octaves_s$ID$     = 0\n\
 uvs_s$ID$         = 2\n\
@@ -137,7 +137,7 @@ smoke_noise_dict_s$ID$.update(tmpDict_s$ID$)\n";
 //////////////////////////////////////////////////////////////////////
 
 const std::string smoke_alloc_colors = "\n\
-mantaMsg('Allocating colors low')\n\
+mantaMsg('Allocating colors')\n\
 color_r_s$ID$   = s$ID$.create(RealGrid)\n\
 color_g_s$ID$   = s$ID$.create(RealGrid)\n\
 color_b_s$ID$   = s$ID$.create(RealGrid)\n\
@@ -147,7 +147,7 @@ tmpDict_s$ID$ = dict(color_r=color_r_s$ID$, color_g=color_g_s$ID$, color_b=color
 smoke_data_dict_s$ID$.update(tmpDict_s$ID$)\n";
 
 const std::string smoke_alloc_colors_noise = "\
-mantaMsg('Allocating colors high')\n\
+mantaMsg('Allocating colors noise')\n\
 color_r_sn$ID$ = sn$ID$.create(RealGrid)\n\
 color_g_sn$ID$ = sn$ID$.create(RealGrid)\n\
 color_b_sn$ID$ = sn$ID$.create(RealGrid)\n\
@@ -157,7 +157,7 @@ tmpDict_s$ID$ = dict(color_r_noise=color_r_sn$ID$, color_g_noise=color_g_sn$ID$,
 smoke_noise_dict_s$ID$.update(tmpDict_s$ID$)\n";
 
 const std::string smoke_init_colors = "\n\
-mantaMsg('Initializing colors low')\n\
+mantaMsg('Initializing colors')\n\
 color_r_s$ID$.copyFrom(density_s$ID$) \n\
 color_r_s$ID$.multConst($COLOR_R$) \n\
 color_g_s$ID$.copyFrom(density_s$ID$) \n\
@@ -166,7 +166,7 @@ color_b_s$ID$.copyFrom(density_s$ID$) \n\
 color_b_s$ID$.multConst($COLOR_B$)\n";
 
 const std::string smoke_init_colors_noise = "\n\
-mantaMsg('Initializing colors high')\n\
+mantaMsg('Initializing colors noise')\n\
 color_r_sn$ID$.copyFrom(density_sn$ID$) \n\
 color_r_sn$ID$.multConst($COLOR_R$) \n\
 color_g_sn$ID$.copyFrom(density_sn$ID$) \n\
@@ -175,7 +175,7 @@ color_b_sn$ID$.copyFrom(density_sn$ID$) \n\
 color_b_sn$ID$.multConst($COLOR_B$)\n";
 
 const std::string smoke_alloc_heat = "\n\
-mantaMsg('Allocating heat low')\n\
+mantaMsg('Allocating heat')\n\
 heat_s$ID$   = s$ID$.create(RealGrid)\n\
 \n\
 # Add objects to dict to load them later on\n\
@@ -183,7 +183,7 @@ tmpDict_s$ID$ = dict(heat=heat_s$ID$)\n\
 smoke_data_dict_s$ID$.update(tmpDict_s$ID$)\n";
 
 const std::string smoke_alloc_fire = "\n\
-mantaMsg('Allocating fire low')\n\
+mantaMsg('Allocating fire')\n\
 flame_s$ID$  = s$ID$.create(RealGrid)\n\
 fuel_s$ID$   = s$ID$.create(RealGrid)\n\
 react_s$ID$  = s$ID$.create(RealGrid)\n\
@@ -192,8 +192,8 @@ react_s$ID$  = s$ID$.create(RealGrid)\n\
 tmpDict_s$ID$ = dict(flame=flame_s$ID$, fuel=fuel_s$ID$, react=react_s$ID$,)\n\
 smoke_data_dict_s$ID$.update(tmpDict_s$ID$)\n";
 
-const std::string smoke_alloc_fire_high = "\n\
-mantaMsg('Allocating fire high')\n\
+const std::string smoke_alloc_fire_noise = "\n\
+mantaMsg('Allocating fire noise')\n\
 flame_sn$ID$ = sn$ID$.create(RealGrid)\n\
 fuel_sn$ID$  = sn$ID$.create(RealGrid)\n\
 react_sn$ID$ = sn$ID$.create(RealGrid)\n\
@@ -207,8 +207,8 @@ smoke_noise_dict_s$ID$.update(tmpDict_s$ID$)\n";
 //////////////////////////////////////////////////////////////////////
 
 const std::string smoke_pre_step = "\n\
-def smoke_pre_step_low_$ID$():\n\
-    mantaMsg('Smoke pre step low')\n\
+def smoke_pre_step_$ID$():\n\
+    mantaMsg('Smoke pre step')\n\
     # translate obvels (world space) to grid space\n\
     if using_obstacle_s$ID$:\n\
         x_obvel_s$ID$.multConst(Real(gs_s$ID$.x))\n\
@@ -216,13 +216,6 @@ def smoke_pre_step_low_$ID$():\n\
         z_obvel_s$ID$.multConst(Real(gs_s$ID$.z))\n\
         copyRealToVec3(sourceX=x_obvel_s$ID$, sourceY=y_obvel_s$ID$, sourceZ=z_obvel_s$ID$, target=obvelC_s$ID$)\n\
     \n\
-    # translate guiding vels (world space) to grid space\n\
-    if using_guiding_s$ID$:\n\
-        x_guidevel_s$ID$.multConst(Real(gs_s$ID$.x))\n\
-        y_guidevel_s$ID$.multConst(Real(gs_s$ID$.y))\n\
-        z_guidevel_s$ID$.multConst(Real(gs_s$ID$.z))\n\
-        copyRealToVec3(sourceX=x_guidevel_s$ID$, sourceY=y_guidevel_s$ID$, sourceZ=z_guidevel_s$ID$, target=guidevelC_s$ID$)\n\
-    \n\
     # translate invels (world space) to grid space\n\
     if using_invel_s$ID$:\n\
         x_invel_s$ID$.multConst(Real(gs_s$ID$.x))\n\
@@ -234,12 +227,11 @@ def smoke_pre_step_low_$ID$():\n\
         weightGuide_s$ID$.multConst(0)\n\
         weightGuide_s$ID$.addConst(alpha_sg$ID$)\n\
         interpolateMACGrid(source=guidevel_sg$ID$, target=velT_s$ID$)\n\
-        guidevel_s$ID$.multConst(vec3(gamma_sg$ID$))\n\
+        velT_s$ID$.multConst(vec3(gamma_sg$ID$))\n\
     \n\
-    #x_vel_s$ID$.multConst(Real(gs_s$ID$.x))\n\
-    #y_vel_s$ID$.multConst(Real(gs_s$ID$.y))\n\
-    #z_vel_s$ID$.multConst(Real(gs_s$ID$.z))\n\
-    #copyRealToVec3(sourceX=x_vel_s$ID$, sourceY=y_vel_s$ID$, sourceZ=z_vel_s$ID$, target=vel_s$ID$)\n\
+    x_force_s$ID$.multConst(Real(gs_s$ID$.x))\n\
+    y_force_s$ID$.multConst(Real(gs_s$ID$.y))\n\
+    z_force_s$ID$.multConst(Real(gs_s$ID$.z))\n\
     copyRealToVec3(sourceX=x_force_s$ID$, sourceY=y_force_s$ID$, sourceZ=z_force_s$ID$, target=forces_s$ID$)\n\
     \n\
     # If obstacle has velocity, i.e. is moving switch to dynamic preconditioner\n\
@@ -252,7 +244,7 @@ def smoke_pre_step_low_$ID$():\n\
 
 const std::string smoke_pre_step_noise = "\n\
 def smoke_pre_step_noise_$ID$():\n\
-    mantaMsg('Smoke pre step high')\n\
+    mantaMsg('Smoke pre step noise')\n\
     # Create interpolated version of original phi grids for later use in (optional) high-res step\n\
     if using_obstacle_s$ID$:\n\
         interpolateGrid(target=phiOut_sn$ID$, source=phiOut_s$ID$)\n\
@@ -270,8 +262,8 @@ def smoke_pre_step_noise_$ID$():\n\
             resetUvGrid(uv_s$ID$[i])\n";
 
 const std::string smoke_post_step = "\n\
-def smoke_post_step_low_$ID$():\n\
-    mantaMsg('Smoke post step low')\n\
+def smoke_post_step_$ID$():\n\
+    mantaMsg('Smoke post step')\n\
     forces_s$ID$.clear()\n\
     if using_guiding_s$ID$:\n\
         weightGuide_s$ID$.clear()\n\
@@ -288,7 +280,7 @@ def smoke_post_step_low_$ID$():\n\
 
 const std::string smoke_post_step_noise = "\n\
 def smoke_post_step_noise_$ID$():\n\
-    

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list