[Durian-svn] [3516] initial batch hair baking script

campbell institute at blender.org
Tue May 18 12:12:02 CEST 2010


Revision: 3516
          https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=3516
Author:   campbell
Date:     2010-05-18 12:12:02 +0200 (Tue, 18 May 2010)
Log Message:
-----------
initial batch hair baking script

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

Added: pro/scripts/utilities/batch_bake.py
===================================================================
--- pro/scripts/utilities/batch_bake.py	                        (rev 0)
+++ pro/scripts/utilities/batch_bake.py	2010-05-18 10:12:02 UTC (rev 3516)
@@ -0,0 +1,40 @@
+# replace
+import os
+
+def text_replace(text_block, from_text, to_text):
+    st = text_block.as_string()
+    st = text_block.replace(from_text, to_text)
+    text_block.from_string(st)
+
+def main():
+    import finals_config
+    
+    # start 
+    init_script = bpy.data.texts.get("durian_init.py")
+    if init_script:
+        text_replace(init_script, "baked=True", "baked=False")
+
+    # run script
+    reload(__import__("durian_init"))
+
+
+    # start bake
+    bpy.ops.ptcache.free_bake_all()
+    
+    '''
+    obj = bpy.data.objects['Mesh']
+    point_cache = obj.modifiers["Cloth"].point_cache
+    bpy.ops.ptcache.bake({"point_cache": point_cache}, bake=True)
+    '''
+
+    # hair
+    obj, psys = get_pointcache_sintel_hair()
+    bpy.ops.ptcache.bake({"point_cache": psys.point_cache}, bake=True)
+    
+    for cmd in pointcache_commands():
+        os.system(cmd)
+
+
+    # end script, should we save?
+    if init_script:
+        text_replace(init_script, "baked=False", "baked=True")



More information about the Durian-svn mailing list