Created
January 23, 2016 02:06
-
-
Save m4rk3r/b27509e6735143c0111b to your computer and use it in GitHub Desktop.
Run a batched animation render acrosss multiple blender files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import mkdir | |
from os.path import exists, join | |
from subprocess import Popen | |
blender = 'c:\\Program Files\\Blender Foundation\\Blender\\Blender.exe' | |
#blender = '/Applications/Blender/blender.app/Contents/MacOS/blender' | |
filepath = 'c:\\Users\\studio\\Dropbox\\files\\' | |
#filepath = '/Users/mark/Dropbox/files/' | |
output = 'c:\\Users\\studio\\Dropbox\\results\\batch\\' | |
#output = '/Users/mark/Dropbox/results/batch/' | |
files = [ | |
'file-a.blend', | |
'file-b.blend', | |
'file-c.blend', | |
] | |
def setup(config, index): | |
config.update({ | |
'blender':blender, | |
'filepath':filepath, | |
'output': output, | |
'dir':'render-part-%s' % index, | |
'target': 'Scene' | |
}) | |
outputpath = join(config['output'],config['dir']) | |
if not exists(outputpath): | |
mkdir(outputpath) | |
config['outputpath'] = outputpath | |
return config | |
# actual handywork | |
jobs = [ | |
{'file':files[0], 'start':2000, 'end':2002, }, | |
{'file':files[1], 'start':2000, 'end':2002, }, | |
{'file':files[0], 'start':4000, 'end':4002, }, | |
{'file':files[1], 'start':4000, 'end':4002, } | |
] | |
cmd = '{blender} -b {filepath}{file} -x 1 -o {outputpath}\ -F PNG -s {start} -e {end} -S {target} -a' | |
idx = 0 | |
for job in jobs: | |
p = Popen( cmd.format(**setup(job, idx)).split(' ') ) | |
p.wait() | |
idx += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment