[Bf-blender-cvs] [544d8fe9b51] fluid-mantaflow: cleanup in manta script exporter

Sebastián Barschkis noreply at git.blender.org
Sun Sep 3 02:24:18 CEST 2017


Commit: 544d8fe9b51a84d5899459a3bc5d749fc8f0056b
Author: Sebastián Barschkis
Date:   Sat Sep 2 15:40:16 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB544d8fe9b51a84d5899459a3bc5d749fc8f0056b

cleanup in manta script exporter

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

M	intern/mantaflow/intern/FLUID.cpp
M	intern/mantaflow/intern/strings/liquid_script.h
M	intern/mantaflow/intern/strings/shared_script.h
M	intern/mantaflow/intern/strings/smoke_script.h

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

diff --git a/intern/mantaflow/intern/FLUID.cpp b/intern/mantaflow/intern/FLUID.cpp
index 39bde6e313e..991e93faf62 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -878,6 +878,7 @@ void FLUID::exportSmokeScript(SmokeModifierData *smd)
 	manta_script += smoke_adaptive_step
 			+ smoke_inflow_low
 			+ smoke_standalone_load
+			+ fluid_standalone_load
 			+ fluid_standalone;
 	
 	// Fill in missing variables in script
@@ -940,20 +941,21 @@ void FLUID::exportLiquidScript(SmokeModifierData *smd)
 	manta_script += liquid_import_low;
 	if (highres)
 		manta_script += liquid_import_high;
+	if (obstacle)
+		manta_script += fluid_obstacle_import_low;
+	if (guiding)
+		manta_script += fluid_guiding_import_low;
 	
 	manta_script += liquid_pre_step_low;
 	manta_script += liquid_post_step_low;
 	
 	manta_script += liquid_step_low;
-	if (obstacle)
-		manta_script += fluid_obstacle_import_low;
-	if (guiding)
-		manta_script += fluid_guiding_import_low;
 	if (highres)
 		manta_script += liquid_step_high;
 
 	manta_script += liquid_adaptive_step
 			+ liquid_standalone_load
+			+ fluid_standalone_load
 			+ fluid_standalone;
 
 	std::string final_script = FLUID::parseScript(manta_script, smd);
@@ -968,11 +970,17 @@ void FLUID::exportLiquidScript(SmokeModifierData *smd)
 void FLUID::exportLiquidData(SmokeModifierData *smd)
 {
 	bool highres = smd->domain->flags & MOD_SMOKE_HIGHRES;
+	bool obstacle = smd->domain->active_fields & SM_ACTIVE_OBSTACLE;
+	bool guiding  = smd->domain->active_fields & SM_ACTIVE_GUIDING;
 
 	char parent_dir[1024];
 	BLI_split_dir_part(smd->domain->manta_filepath, parent_dir, sizeof(parent_dir));
 	
 	FLUID::saveLiquidData(parent_dir);
+	if (obstacle)
+		FLUID::saveFluidObstacleData(parent_dir);
+	if (guiding)
+		FLUID::saveFluidGuidingData(parent_dir);
 	if (highres)
 		FLUID::saveLiquidDataHigh(parent_dir);
 }
diff --git a/intern/mantaflow/intern/strings/liquid_script.h b/intern/mantaflow/intern/strings/liquid_script.h
index a119daea241..127f8762b15 100644
--- a/intern/mantaflow/intern/strings/liquid_script.h
+++ b/intern/mantaflow/intern/strings/liquid_script.h
@@ -161,13 +161,6 @@ def liquid_post_step_low_$ID$():\n\
     phiOut_s$ID$.setConst(9999)\n\
     phiOutIn_s$ID$.setConst(9999)\n\
     \n\
-    if using_obstacle_s$ID$:\n\
-        phiObsIn_s$ID$.setConst(9999)\n\
-        obvelC_s$ID$.clear()\n\
-    \n\
-    if using_guiding_s$ID$:\n\
-        phiGuideIn_s$ID$.setConst(9999)\n\
-        guidevelC_s$ID$.clear()\n\
     copyVec3ToReal(source=vel_s$ID$, targetX=x_vel_s$ID$, targetY=y_vel_s$ID$, targetZ=z_vel_s$ID$)\n";
 
 //////////////////////////////////////////////////////////////////////
diff --git a/intern/mantaflow/intern/strings/shared_script.h b/intern/mantaflow/intern/strings/shared_script.h
index 50ca2091d9e..0c7b9823ddf 100644
--- a/intern/mantaflow/intern/strings/shared_script.h
+++ b/intern/mantaflow/intern/strings/shared_script.h
@@ -248,7 +248,7 @@ def load_fluid_guiding_data_low_$ID$(path):\n\
 
 const std::string fluid_obstacle_export_low = "\n\
 def save_fluid_obstacle_data_low_$ID$(path):\n\
-    numObs_s$ID$.save(path + '_numObs_s.uni')\n\
+    numObs_s$ID$.save(path + '_numObs.uni')\n\
     phiObsIn_s$ID$.save(path + '_phiObsIn.uni')\n\
     obvel_s$ID$.save(path + '_obvel.uni')\n\
     x_obvel_s$ID$.save(path + '_x_obvel.uni')\n\
@@ -269,6 +269,16 @@ def save_fluid_guiding_data_low_$ID$(path):\n\
 // STANDALONE MODE
 //////////////////////////////////////////////////////////////////////
 
+//////////////////////////////////////////////////////////////////////
+// STANDALONE MODE
+//////////////////////////////////////////////////////////////////////
+
+const std::string fluid_standalone_load = "\n\
+if using_obstacle_s$ID$:\n\
+    load_fluid_obstacle_data_low_$ID$(path_prefix_$ID$)\n\
+if using_guiding_s$ID$:\n\
+    load_fluid_guiding_data_low_$ID$(path_prefix_$ID$)\n";
+
 const std::string fluid_standalone = "\n\
 if (GUI):\n\
     gui=Gui()\n\
diff --git a/intern/mantaflow/intern/strings/smoke_script.h b/intern/mantaflow/intern/strings/smoke_script.h
index ea11bb43840..9cdd544aecb 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -224,13 +224,6 @@ def smoke_post_step_low_$ID$():\n\
     invel_s$ID$.clear()\n\
     phiOutIn_s$ID$.setConst(9999)\n\
     \n\
-    if using_obstacle_s$ID$:\n\
-        phiObsIn_s$ID$.setConst(9999)\n\
-        obvelC_s$ID$.clear()\n\
-    \n\
-    if using_guiding_s$ID$:\n\
-        phiGuideIn_s$ID$.setConst(9999)\n\
-        guidevelC_s$ID$.clear()\n\
     copyVec3ToReal(source=vel_s$ID$, targetX=x_vel_s$ID$, targetY=y_vel_s$ID$, targetZ=z_vel_s$ID$)\n";
 
 const std::string smoke_post_step_high = "\n\
@@ -691,6 +684,5 @@ const std::string smoke_standalone_load = "\n\
 # import *.uni files\n\
 path_prefix = '$MANTA_EXPORT_PATH$'\n\
 load_smoke_data_low_$ID$(path_prefix)\n\
-load_fluid_data_low_$ID$(path_prefix)\n\
 if using_highres_s$ID$:\n\
     load_smoke_data_high_$ID$(path_prefix)\n";



More information about the Bf-blender-cvs mailing list