[Durian-svn] [3943] updates for baking some objects but not others

campbell institute at blender.org
Wed May 26 21:23:43 CEST 2010


Revision: 3943
          https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=3943
Author:   campbell
Date:     2010-05-26 21:23:43 +0200 (Wed, 26 May 2010)
Log Message:
-----------
updates for baking some objects but not others

Modified Paths:
--------------
    pro/scripts/utilities/batch_bake.py

Modified: pro/scripts/utilities/batch_bake.py
===================================================================
--- pro/scripts/utilities/batch_bake.py	2010-05-26 19:13:05 UTC (rev 3942)
+++ pro/scripts/utilities/batch_bake.py	2010-05-26 19:23:43 UTC (rev 3943)
@@ -8,10 +8,25 @@
 OVERRIDE = True
 BIN = "/b/B"
 
+MULTIPROCESS = False
+
+# what to bake!!
+DO_SINTEL = False
+DO_DRAGON_BABY = True
+
+
+
+
+
+
+
+
+
 # print("running", __file__)
 import os
 import sys
 
+
 def blend_path_list(path):
 	for dirpath, dirnames, filenames in os.walk(path):
 		for filename in filenames:
@@ -80,15 +95,17 @@
     '''
     ok = 0
 
-    if "GEO-sintel_hair_emit" not in bpy.data.objects:
-        print("GEO-sintel_hair_emit not found...")
-    else:
-        ok |= 1
+    if DO_SINTEL:
+        if "GEO-sintel_hair_emit" not in bpy.data.objects:
+            print("GEO-sintel_hair_emit not found...")
+        else:
+            ok |= 1
     
-    if "GEO-wing_sim" not in bpy.data.objects:
-        print("GEO-wing_sim not found...")
-    else:
-        ok |= 1
+    if DO_DRAGON_BABY:
+        if "GEO-wing_sim" not in bpy.data.objects:
+            print("GEO-wing_sim not found...")
+        else:
+            ok |= 1
 
     if not ok:
         sys.exit(0)
@@ -103,12 +120,17 @@
 finals_config.setup_dragon_adult(baked=False)"""
         textblock = bpy.data.texts.new("durian_init.py")
         
-    
+
 def use_simplify():
     scene = bpy.context.scene
     while scene:
         scene.render.use_simplify = True
-        scene.render.simplify_subdivision = 0
+        
+        if DO_DRAGON_BABY: # needed for mdef
+            scene.render.simplify_subdivision = 1
+        else:
+            scene.render.simplify_subdivision = 0
+
         scene.render.simplify_child_particles = 0.5
         scene = scene.set
 
@@ -150,72 +172,71 @@
     }
 
 
-    # sintel (hair)
-    for obj in [obj for obj_name, obj in object_items if obj_name == "GEO-sintel_hair_emit"]:
-        obj, psys = finals_config.get_pointcache_sintel_hair(obj)
+    if DO_SINTEL:
+        # sintel (hair)
+        for obj in [obj for obj_name, obj in object_items if obj_name == "GEO-sintel_hair_emit"]:
+            obj, psys = finals_config.get_pointcache_sintel_hair(obj)
 
-        context = base_context.copy()
-        
-        context["point_cache"] = psys.point_cache
-        
-        lay = get_object_layers(get_group_instance(obj))
-        bpy.context.scene.layers = lay
+            context = base_context.copy()
+            
+            context["point_cache"] = psys.point_cache
+            
+            lay = get_object_layers(get_group_instance(obj))
+            bpy.context.scene.layers = lay
 
-        if True not in lay:
-            print("Skipping", obj, "no instance")
-            continue        
+            if True not in lay:
+                print("Skipping", obj, "no instance")
+                continue        
 
-        print("layers:", lay)
+            print("layers:", lay)
 
-        finals_config.setup_sintel(baked=False, pre_roll=0) # <--- why is this needed?
-        bpy.ops.ptcache.free_bake(context)
+            finals_config.setup_sintel(baked=False, pre_roll=0) # <--- why is this needed?
+            bpy.ops.ptcache.free_bake(context)
 
-        if OVERRIDE:
-            finals_config.setup_sintel(baked=False, pre_roll=0)
-        else:
-            reload(durian_init) # <--- why is this needed?
+            if OVERRIDE:
+                finals_config.setup_sintel(baked=False, pre_roll=0)
+            else:
+                reload(durian_init) # <--- why is this needed?
 
-        bpy.ops.ptcache.bake(context, bake=True)
+            bpy.ops.ptcache.bake(context, bake=True)
 
-        for cmd in finals_config.pointcache_commands(psys.point_cache):
-            os.system(cmd)
+            for cmd in finals_config.pointcache_commands(psys.point_cache):
+                os.system(cmd)
 
 
 
 
 
-
-
-
     # dragon (cloth)
-    for obj in [obj for obj_name, obj in object_items if obj_name == "GEO-wing_sim"]:
-        obj, mod_cloth = finals_config.get_pointcache_dragon_baby_cloth(obj)
+    if DO_DRAGON_BABY:
+        for obj in [obj for obj_name, obj in object_items if obj_name == "GEO-wing_sim"]:
+            obj, mod_cloth = finals_config.get_pointcache_dragon_baby_cloth(obj)
 
-        context = base_context.copy()
-        
-        context["point_cache"] = mod_cloth.point_cache
+            context = base_context.copy()
+            
+            context["point_cache"] = mod_cloth.point_cache
 
-        lay = get_object_layers(get_group_instance(obj))
-        bpy.context.scene.layers = lay
+            lay = get_object_layers(get_group_instance(obj))
+            bpy.context.scene.layers = lay
 
-        if True not in lay:
-            print("Skipping", obj, "no instance")
-            continue        
+            if True not in lay:
+                print("Skipping", obj, "no instance")
+                continue        
 
-        print("layers:", lay)
+            print("layers:", lay)
 
-        finals_config.setup_dragon_baby(baked=False, pre_roll=0) # <--- why is this needed?
-        bpy.ops.ptcache.free_bake(context)
+            finals_config.setup_dragon_baby(baked=False, pre_roll=0) # <--- why is this needed?
+            bpy.ops.ptcache.free_bake(context)
 
-        if OVERRIDE:
-            finals_config.setup_dragon_baby(baked=False, pre_roll=0)
-        else:
-            reload(durian_init) # <--- why is this needed?
+            if OVERRIDE:
+                finals_config.setup_dragon_baby(baked=False, pre_roll=0)
+            else:
+                reload(durian_init) # <--- why is this needed?
 
-        bpy.ops.ptcache.bake(context, bake=True)
+            bpy.ops.ptcache.bake(context, bake=True)
 
-        for cmd in finals_config.pointcache_commands(mod_cloth.point_cache):
-            os.system(cmd)
+            for cmd in finals_config.pointcache_commands(mod_cloth.point_cache):
+                os.system(cmd)
 
 
 
@@ -303,10 +324,11 @@
     for f in files:
         task_bake_1 = " ".join(["DISPLAY=:1", "LD_PRELOAD=$LIBGL", BIN, "-b", f, "-P", __file__])
         task_render_2 = " ".join(["DISPLAY=:1", "LD_PRELOAD=$LIBGL", BIN, f, "-P", __file__])
-        cmd = task_bake_1 + " && " + task_render_2 + " &"
+        cmd = task_bake_1 + " && " + task_render_2 + (" &" if MULTIPROCESS else "")
         print(cmd)
 
-        print(("echo \"%s\" ; " % f) + "sleep 1 ; " + "while [ `jobs | wc -l` -gt $TOT_PROP ] ; do sleep 1 ; done")
+        if MULTIPROCESS:
+            print(("echo \"%s\" ; " % f) + "sleep 1 ; " + "while [ `jobs | wc -l` -gt $TOT_PROP ] ; do sleep 1 ; done")
 
 
 if __name__ == "__main__":



More information about the Durian-svn mailing list