Advertisement
henryiii

RenderLabManual.py

Jun 24th, 2015
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.42 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import os
  4. from os.path import getmtime, exists
  5. import subprocess
  6.  
  7. def run(file,output=None,scene=None):
  8.  
  9.     filename = file + '.blend'
  10.     imagename = (output if output else file) + '_#.png'
  11.     imagefilename = imagename.replace('#','1')
  12.  
  13.     # Note: to speed up, remove -t 4
  14.     if not exists(imagefilename) or getmtime(filename) > getmtime(imagefilename):
  15.         retcode = subprocess.call('blender -b -t 4 {filename} {scene} -o //{output} -F PNG -f 1'
  16.                   .format(
  17.                       filename = filename,
  18.                       scene = '-S ' + scene if scene else '',
  19.                       output = imagename), shell=True)
  20.         if retcode < 0:
  21.             RuntimeError('Process terminated.')
  22.  
  23. if __name__ == '__main__':
  24.     run('Chap1')
  25.     run('Chap2')
  26.     run('Chap3','Chap3','Scene')
  27.     run('Chap5','Chap3_tilt','Scene3')
  28.     run('Chap5','Chap3_hanging','Scene4')
  29.     run('Chap3','Chap4','Scene1')
  30.     run('Chap5','Chap5_carts','Scene')
  31.     run('Chap5','Chap5','Scene2')
  32.     run('Chap6','Chap6a','Scene')
  33.     run('Chap6','Chap6b','Scene1')
  34.     run('Chap6Bar')
  35.     run('Chap7','Chap7a','Scene1')
  36.     run('Chap7','Chap7b','Scene')
  37.     run('Chap7','Chap7c','Scene2')
  38.     run('Chap7Bar')
  39.     run('Chap8')
  40.     run('Chap9')
  41.     run('Chap10','Chap10a','Scene')
  42.     run('Chap10','Chap10b','Scene1')
  43.     run('Chap11','Chap11a','Scene')
  44.     run('Chap11','Chap11b','Scene1')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement