[Durian-svn] [3761] script for batch rendering opengl animations
campbell
institute at blender.org
Mon May 24 08:23:10 CEST 2010
Revision: 3761
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=3761
Author: campbell
Date: 2010-05-24 08:23:10 +0200 (Mon, 24 May 2010)
Log Message:
-----------
script for batch rendering opengl animations
Added Paths:
-----------
pro/scripts/utilities/batch_ogl.py
Added: pro/scripts/utilities/batch_ogl.py
===================================================================
--- pro/scripts/utilities/batch_ogl.py (rev 0)
+++ pro/scripts/utilities/batch_ogl.py 2010-05-24 06:23:10 UTC (rev 3761)
@@ -0,0 +1,106 @@
+# replace
+
+# python /d/pro/scripts/utilities/batch_bake.py > /tmp/hair/bake.sh # build list
+# ./B -b /d/pro/scenes/05.8_ambushfight/05.8b_comp.blend -P /d/pro/scripts/utilities/batch_bake.py
+# ./B bzz /d/pro/scenes/05.8_ambushfight/05.8b_comp.blend -P /d/pro/scripts/utilities/batch_bake.py
+
+# BIN = "/media/data/blender_ideasman42/blender/blender"
+BIN = "/b/B"
+
+import os
+
+__file__ = "/d/pro/scripts//utilities/batch_ogl.py"
+
+def blend_path_list(path):
+ for dirpath, dirnames, filenames in os.walk(path):
+ for filename in filenames:
+ if filename.endswith(".blend"):
+ yield os.path.join(dirpath, filename)
+
+
+def use_simplify():
+ scene = bpy.context.scene
+ while scene:
+ scene.render.use_simplify = True
+ scene.render.simplify_subdivision = 1
+ scene.render.simplify_child_particles = 0.0
+ scene = scene.set
+
+def get_svn_rev(f):
+ os.system("svn log %s > /tmp/foo.txt" % f)
+ file = open("/tmp/foo.txt", 'r')
+ for l in file.readlines():
+ if l.startswith("r"):
+ try:
+ val = int(l.split()[0][1:])
+ except:
+ continue
+
+ return val
+
+ return -1
+
+
+def blender_fg_render():
+ # render
+ use_simplify()
+
+ bpy.context.scene.render.resolution_percentage = 100
+ bpy.context.scene.render.resolution_x = 2048
+ bpy.context.scene.render.resolution_y = 872
+ bpy.context.scene.render.file_format = 'AVI_JPEG'
+ bpy.context.scene.render.file_quality = 90
+
+ image_dir = "/shared/durian/anim_daily"
+ filename = bpy.data.filename.replace(".blend", ".avi")
+ bpy.context.scene.render.output_path = os.path.join(image_dir, os.path.basename(filename))
+
+ # hey, lets make sintel pretty
+ for mat in bpy.data.materials:
+ if mat.name == "Sintel_Skin1_layer":
+ mat.diffuse_color = 0.49, 0.31, 0.22
+ elif mat.name == "sintel_hair_shabuffe":
+ mat.diffuse_color = 0.6, 0.33, 0.25
+
+ bpy.ops.render.opengl({}, animation=True, view_context=False)
+
+ import sys
+ sys.exit()
+
+
+def noblender_print_tasks():
+
+ files = list(blend_path_list("/d/pro/scenes"))
+ files_anim = []
+
+ for f in files:
+ if "_layout" in f:
+ continue
+ if "_phys" in f:
+ continue
+ if not f.split("/")[-1].startswith("0"):
+ continue
+
+ files_anim.append((get_svn_rev(f), f))
+
+ files_anim.sort()
+ files_anim.reverse() # newest first
+
+ i = 0
+ for r, f in files_anim:
+ print("# %d %d" % (i, r))
+ print(" ".join(["DISPLAY=:1", "LD_PRELOAD=/shared/software/mesa-7.8/lib/libGL.so", BIN, f, "-P", __file__])) # render
+ i += 1
+
+
+if __name__ == "__main__":
+ try:
+ import bpy
+ except:
+ bpy = None
+
+ # OUTSIDE OF BLENDER
+ if bpy is None:
+ noblender_print_tasks()
+ else:
+ blender_fg_render()
More information about the Durian-svn
mailing list