[Bf-blender-cvs] [846d196] fluid-mantaflow: script generation and readme updates

Sebastián Barschkis noreply at git.blender.org
Thu Jan 28 12:37:28 CET 2016


Commit: 846d196c4e8edb2aa5267cf2ecd27429ed9005e1
Author: Sebastián Barschkis
Date:   Tue Jan 12 23:10:19 2016 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB846d196c4e8edb2aa5267cf2ecd27429ed9005e1

script generation and readme updates

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

M	CMakeLists.txt
M	intern/smoke/intern/FLUID_3D.cpp
M	intern/smoke/intern/MANTA.cpp
M	intern/smoke/intern/scenarios/smoke.h
M	readme.md
M	release/scripts/startup/bl_ui/properties_physics_smoke.py
M	source/blender/makesrna/intern/rna_smoke.c

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d67e3a4..62d1842 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -522,7 +522,7 @@ if(APPLE)
 	
 	execute_process(COMMAND uname -r OUTPUT_VARIABLE MAC_SYS) # check for actual system-version
 	if(${MAC_SYS} MATCHES 15)
-		set(OSX_SYSTEM 10.10)
+		set(OSX_SYSTEM 10.11)
 		# throw an error here, older cmake cannot handle 2 digit subversion!
 		cmake_minimum_required(VERSION 3.0.0)
 	elseif(${MAC_SYS} MATCHES 14)
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index e25b34d..001e0c9 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -657,7 +657,7 @@ void FLUID_3D::initColors(float init_r, float init_g, float init_b)
 		PyRun_SimpleString(ss.str().c_str());
 		PyRun_SimpleString(alloc_colors_low.c_str());
 		PyRun_SimpleString(init_colors_low.c_str());
-		PyRun_SimpleString(with_fire.c_str());
+		PyRun_SimpleString(with_colors.c_str());
 		PyGILState_Release(gilstate);
 		Manta_API::update_pointers(this);
 	}
diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index ae130b6..f00f883 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -419,7 +419,6 @@ void Manta_API::start_mantaflow()
 std::string Manta_API::get_real_value( const std::string& varName, SmokeModifierData *smd)
 {
 	ostringstream ss;
-	cout << "name is " << varName << endl;
 	bool is2D = smd->domain->fluid->manta_resoution == 2;
 	if (varName == "UVS_CNT")
 		ss << smd->domain->manta_uvs_num ;
@@ -574,30 +573,67 @@ void Manta_API::manta_export_script(SmokeModifierData *smd)
 	std::string manta_script =
 		manta_import +
 		solver_setup_low +
-		alloc_base_grids_low +
-		alloc_colors_low +
-		noise_low +
-		prep_domain_low +
-		flags;
+		uv_setup +
+		alloc_base_grids_low;
+	
+	// Add heat grid low if needed
+	if (smd->domain->fluid->using_heat) {
+		manta_script += alloc_heat_low;
+	}
+	
+	// Add color grids low if needed
+	if (smd->domain->fluid->using_colors) {
+		manta_script += alloc_colors_low;
+	}
+	
+	// Add fire grids low if needed
+	if (smd->domain->fluid->using_fire) {
+		manta_script += alloc_fire_low;
+	}
+	
+	// Rest of low res setup
+	manta_script += prep_domain_low + flags;
 	
 	// Setup high
 	if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
 		manta_script +=
 			solver_setup_high +
-			alloc_base_grids_high +
-			noise_high +
-			prep_domain_high +
-			wavelet_turbulence_noise;
+			alloc_base_grids_high;
+	}
+	
+	// Add color grids high if needed
+	if (smd->domain->flags & MOD_SMOKE_HIGHRES && smd->domain->fluid->using_colors) {
+		manta_script += alloc_colors_high;
 	}
 	
+	// Add fire grids high if needed
+	if (smd->domain->flags & MOD_SMOKE_HIGHRES && smd->domain->fluid->using_fire) {
+		manta_script += alloc_fire_high;
+	}
+
+	// Rest of low res setup
+	manta_script += prep_domain_high + wavelet_turbulence_noise;
+	
+	// Noise low
+	// TODO. Maybe drop this grid, because it can only be used for inflow
+	
+	// Noise high
+	// TODO, Same as noise low
+	
 	// Import low
 	manta_script += smoke_import_low;
 	
 	// Import high
 	if (smd->domain->flags & MOD_SMOKE_HIGHRES) {
-		manta_script += smoke_step_high;
+		manta_script += smoke_import_high;
 	}
 	
+	// Inflow low
+	manta_script += smoke_inflow_low;
+	
+	// Inflow High
+	// TODO
+	
 	// Step low
 	manta_script += smoke_step_low;
 	
diff --git a/intern/smoke/intern/scenarios/smoke.h b/intern/smoke/intern/scenarios/smoke.h
index 4c133b3..edc97ae 100644
--- a/intern/smoke/intern/scenarios/smoke.h
+++ b/intern/smoke/intern/scenarios/smoke.h
@@ -120,7 +120,7 @@ xl_flags.fillGrid()\n";
 const string wavelet_turbulence_noise = "\n\
 # wavelet turbulence noise field\n\
 xl_wltnoise = s.create(NoiseField, loadFromFile=True)\n\
-xl_wltnoise.posScale = vec3( int(1.0*gs.x) ) * 0.5\n\
+xl_wltnoise.posScale = vec3(int(1.0*gs.x)) * 0.5\n\
 xl_wltnoise.timeAnim = 0.1\n\
 if(upres>0):\n\
   xl_wltnoise.posScale = xl_wltnoise.posScale * (1./upres)\n";
@@ -135,7 +135,7 @@ color_r = s.create(RealGrid)\n\
 color_g = s.create(RealGrid)\n\
 color_b = s.create(RealGrid)\n";
 
-const string alloc_colors_high = "\n\
+const string alloc_colors_high = "\
 print('Allocating colors high')\n\
 xl_color_r = xl.create(RealGrid)\n\
 xl_color_g = xl.create(RealGrid)\n\
@@ -194,6 +194,7 @@ if (GUI):\n\
   gui.show()\n\
   gui.pause()\n\
 \n\
+# import *.uni files\n\
 import_grids_low()\n\
 if using_wavelets:\n\
   import_grids_high()\n\
@@ -261,6 +262,7 @@ del using_colors\n\
 del using_heat\n\
 del using_fire\n\
 del flags\n\
+del uvs\n\
 del vel\n\
 del x_vel\n\
 del y_vel\n\
@@ -278,7 +280,6 @@ print('Deleting base grids high')\n\
 del upres\n\
 del xl_gs\n\
 del xl\n\
-del uvs\n\
 del wltStrength\n\
 del octaves\n\
 del xl_flags\n\
@@ -402,6 +403,8 @@ def step_high():\n\
     advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_density, order=$ADVECT_ORDER$)\n\
   \n\
   xl.step()\n\
+  \n\
+  timings.display()\n\
 \n\
 def process_burn_high():\n\
   print('Process burn high')\n\
@@ -454,9 +457,10 @@ def sim_step_low(t):\n\
 
 const string smoke_export_low = "\n\
 import os\n\
-print('Exporting grids')\n\
+print('Exporting grids low')\n\
 density.save(os.path.join('$MANTA_EXPORT_PATH$','density.uni'))\n\
 flags.save(os.path.join('$MANTA_EXPORT_PATH$','flags.uni'))\n\
+vel.save(os.path.join('$MANTA_EXPORT_PATH$','vel.uni'))\n\
 forces.save(os.path.join('$MANTA_EXPORT_PATH$','forces.uni'))\n\
 inflow_grid.save(os.path.join('$MANTA_EXPORT_PATH$','inflow_low.uni'))\n\
 fuel_inflow.save(os.path.join('$MANTA_EXPORT_PATH$','fuel_inflow.uni'))\n\
@@ -472,7 +476,7 @@ if using_fire:\n\
   react.save(os.path.join('$MANTA_EXPORT_PATH$','react.uni'))\n";
 
 const string smoke_export_high = "\n\
-print('Exporting grids')\n\
+print('Exporting grids high')\n\
 xl_density.save(os.path.join('$MANTA_EXPORT_PATH$','xl_density.uni'))\n\
 xl_flags.save(os.path.join('$MANTA_EXPORT_PATH$','xl_flags.uni'))\n\
 if using_colors:\n\
@@ -490,21 +494,19 @@ if using_fire:\n\
 
 const string smoke_import_low = "\n\
 def import_grids_low():\n\
-  print('Importing grids')\n\
+  print('Importing grids low')\n\
   density.load('$MANTA_EXPORT_PATH$density.uni')\n\
   flags.load('$MANTA_EXPORT_PATH$flags.uni')\n\
+  vel.save(os.path.join('$MANTA_EXPORT_PATH$','vel.uni'))\n\
   forces.load('$MANTA_EXPORT_PATH$forces.uni')\n\
   inflow_grid.load('$MANTA_EXPORT_PATH$inflow_low.uni')\n\
   fuel_inflow.load('$MANTA_EXPORT_PATH$fuel_inflow.uni')\n\
-  \n\
   if using_colors:\n\
     color_r.load('$MANTA_EXPORT_PATH$color_r.uni')\n\
     color_g.load('$MANTA_EXPORT_PATH$color_g.uni')\n\
     color_b.load('$MANTA_EXPORT_PATH$color_b.uni')\n\
-  \n\
   if using_heat:\n\
     heat.load('$MANTA_EXPORT_PATH$heat.uni')\n\
-  \n\
   if using_fire:\n\
     flame.load('$MANTA_EXPORT_PATH$flame.uni')\n\
     fuel.load('$MANTA_EXPORT_PATH$fuel.uni')\n\
@@ -512,8 +514,7 @@ def import_grids_low():\n\
 
 const string smoke_import_high = "\n\
 def import_grids_high():\n\
-  print('Importing grids')\n\
-  vel.load('$MANTA_EXPORT_PATH$vel.uni')\n\
+  print('Importing grids high')\n\
   xl_density.load('$MANTA_EXPORT_PATH$xl_density.uni')\n\
   xl_flags.load('$MANTA_EXPORT_PATH$xl_flags.uni')\n\
   if using_colors:\n\
@@ -535,7 +536,8 @@ def apply_inflow():\n\
   #inflow_grid.multConst(0.1)\n\
   #fuel_inflow.multConst(0.1)\n\
   density.add(inflow_grid)\n\
-  fuel.add(fuel_inflow)\n";
+  if using_fire:\n\
+    fuel.add(fuel_inflow)\n";
 
 const string smoke_inflow_high = "\n\
  # TODO\n";
diff --git a/readme.md b/readme.md
index 86df51f..e3f24dc 100644
--- a/readme.md
+++ b/readme.md
@@ -97,12 +97,11 @@ Some fire renderings can be found on [Vimeo](https://vimeo.com/sebbas/videos). F
 
 ### Mac OSX
 
-If you have problems building under Mac OS 10.11 "El Capitan" and with Xcode 7 (I did) then one possible workaround is to use an older Mac OSX SDK. I used the SDK from 10.10. 
-
- 1. Get a copy of the Mac OSX 10.10 SDK. It can be found in Xcode 6 under `Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk`. You might find Xcode 6 itself on your Time Machine Backup or you can download it from [Apple](https://developer.apple.com/downloads/).
- 
- 2. Copy `MacOSX10.10.sdk` into your current Xcode 7 app, alongside the 10.11 SDK which is located in `/ApplicationsXcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/`.
- 
- 3. In the Blender source directory and in `CMakeLists.txt`, change all instance of 10.11 to 10.10 (I just needed to make one change).
- 
- Hope this works for you, if you know a better fix then please let me know!
+If you have problems building under Mac OS 10.11 "El Capitan" and with Xcode 7 (I did) then set the `OSX_SYSTEM` setting manually.
+
+You can do this in CMakeLists.txt by changing:
+
+        elseif(${MAC_SYS} MATCHES 14)
+    -               set(OSX_SYSTEM 10.10)
+    +               set(OSX_SYSTEM 10.11)
+
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index adac39a..b00165f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -416,14 +416,14 @@ class OBJECT_OT_RunMantaButton(bpy.types.Operator):
         #bpy.ops.manta.sim_step()
         return{'FINISHED'}
 
-class OBJECT_OT_StopMantaButton(bpy.types.Operator):
-    bl_idname = "manta_stop_sim.button"
-    bl_label = "Stop Mantaflow Simulation"
-    def execute(self, context):
-        domain = context.smoke.domain_settings
-        #setting manta_sim_frame to "stop" value 
-        domain.manta_sim_frame = -1
-        return{'FINISHED'}
+#class OBJECT_OT_StopMantaButton(bpy.types.Operator):
+#    bl_idname = "manta_stop_sim.button"
+#    bl_label = "Stop Mantaflow Simulation"
+#    def execute(self, context):
+#        domain = context.smoke.domain_settings
+#        #setting manta_sim_frame to "stop" value 
+#        domain.manta_sim_frame = -1
+#        return{'FINISHED'}
 
 
 class PHYSICS_PT_smoke_manta_settings(PhysicButtonsPanel, Panel):
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
in

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list