[Bf-blender-cvs] [0607338] soc-2014-fluid: repositioned domain handling; quick smoke working

Roman Pogribnyi noreply at git.blender.org
Fri Aug 15 22:19:14 CEST 2014


Commit: 0607338884be4666db72e2511fe8127b7302f71f
Author: Roman Pogribnyi
Date:   Fri Aug 15 21:48:15 2014 +0200
Branches: soc-2014-fluid
https://developer.blender.org/rB0607338884be4666db72e2511fe8127b7302f71f

repositioned domain handling; quick smoke working

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

M	intern/smoke/intern/MANTA.cpp
M	release/scripts/startup/bl_ui/properties_physics_smoke.py

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

diff --git a/intern/smoke/intern/MANTA.cpp b/intern/smoke/intern/MANTA.cpp
index c02de39..7c5a49d 100644
--- a/intern/smoke/intern/MANTA.cpp
+++ b/intern/smoke/intern/MANTA.cpp
@@ -556,9 +556,9 @@ void generate_manta_sim_file(Scene *scene, SmokeModifierData *smd)
 		ss << "    advectSemiLagrange(flags=xl_flags, vel=xl_vel, grid=xl_density, order=2)  \n";
 		ss << "  if (applyInflow): \n";
 		if (noise_val_scale > 0.)
-			ss << "    densityInflowMesh(flags=xl_flags, density=xl_density, mesh=source, value=1)\n";
-		else
 		ss << "    densityInflowMeshNoise( flags=xl_flags, density=xl_density, noise=xl_noise, mesh=xl_source, scale=3, sigma=0.5 ) \n";
+		else
+			ss << "    densityInflowMesh(flags=xl_flags, density=xl_density, mesh=source, value=1)\n";
 		ss << "  xl_density.save('densityXl_%04d.uni' % t)\n";
 		//ss << "    densityInflow( flags=xl_flags, density=xl_density, noise=xl_noise, shape=xl_source, scale=1, sigma=0.5 ) \n";
 //		ss << "  xl.step()   \n";
diff --git a/release/scripts/startup/bl_ui/properties_physics_smoke.py b/release/scripts/startup/bl_ui/properties_physics_smoke.py
index ea776d8..fc8ed4f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_smoke.py
+++ b/release/scripts/startup/bl_ui/properties_physics_smoke.py
@@ -339,26 +339,38 @@ class OBJECT_OT_RunMantaButton(bpy.types.Operator):
         #need these methods to account for rotated objects
         def transform_objgroup(obj_list, domain_obj):
             old_scale = deepcopy(domain_obj.scale)
+            old_loc = deepcopy(domain_obj.location)
             #link all objects to new reference- domain
             domain_obj.scale = (1,1,1)
+            domain_obj.location = (0,0,0)
             for obj in obj_list:
                 obj.select = True
+                obj.location[0] -= old_loc[0]
+                obj.location[1] -= old_loc[1]
+                obj.location[2] -= old_loc[2]
                 obj.constraints.new('CHILD_OF')
                 obj.constraints.active.target = domain_obj
             #scale domain down
             domain_obj.scale[0] /= old_scale[0]
             domain_obj.scale[1] /= old_scale[1]
             domain_obj.scale[2] /= old_scale[2]
-            return old_scale
+            return old_scale, old_loc
             
         def transform_objgroup_back(obj_list, domain_obj, old_data):
-            domain_obj.scale[0] =  old_data[0]
-            domain_obj.scale[1] =  old_data[1]
-            domain_obj.scale[2] =  old_data[2]
+            old_scale, old_loc = old_data
+            domain_obj.scale[0] =  old_scale[0]
+            domain_obj.scale[1] =  old_scale[1]
+            domain_obj.scale[2] =  old_scale[2]
+            domain_obj.location[0] =  old_loc[0]
+            domain_obj.location[1] =  old_loc[1]
+            domain_obj.location[2] =  old_loc[2]
             #remove used constraint and deselect objects
             for obj in obj_list:
                 obj.select = False
                 obj.constraints.remove(obj.constraints.active)
+                obj.location[0] += old_loc[0]
+                obj.location[1] += old_loc[1]
+                obj.location[2] += old_loc[2]
         
         coll_objs = []
         flow_objs = []




More information about the Bf-blender-cvs mailing list