KetchupMonki

renderAnim.py

May 5th, 2019
880
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. #Modified copy of https://blender.stackexchange.com/questions/8850/how-to-take-images-with-multiple-cameras-with-script
  2. #Turned to a sprite sheet after using imagemagick - montage *.png -tile 8x15 -geometry 100x100 scott.png; convert scott.png -fuzz 30% -transparent "rgba(255, 0, 0, 1)" scott.png
  3. import bpy
  4. import os
  5.  
  6. animationName = "newWalk"
  7.  
  8. scene = bpy.context.scene
  9.  
  10. for action in bpy.data.actions:
  11.     if (action.name == animationName):
  12.         animationFrames = int(action.frame_range.y)
  13.         for currentFrame in range(0, animationFrames):
  14.             bpy.context.scene.frame_set(currentFrame)
  15.             for ob in scene.objects:
  16.                 if ob.type == 'CAMERA' and ob.name != "guideCam":
  17.                     bpy.context.scene.camera = ob
  18.                     print('Set camera %s' % ob.name )
  19.                     file = ob.name + "_" + str(currentFrame)
  20.                     bpy.context.scene.render.filepath = file
  21.                     bpy.ops.render.render( write_still=True )
Advertisement
Add Comment
Please, Sign In to add comment