Skip to content

Instantly share code, notes, and snippets.

@Pullusb
Created October 4, 2015 17:25
Show Gist options
  • Save Pullusb/2ba7e5c174d92bf7b2e6 to your computer and use it in GitHub Desktop.
Save Pullusb/2ba7e5c174d92bf7b2e6 to your computer and use it in GitHub Desktop.
blenderSB batch render layers
import bpy
from math import radians
# Render all specified layers in //layers/ folder with layer names
# (based on layers name with layers manager addon)
C = bpy.context
def render(lay, sup=[]):
lay = lay - 1
for i in range(0,20):
C.scene.layers[i] = False
C.scene.layers[lay] = True
C.scene.layers[9] = True
if sup:
for L in sup:
C.scene.layers[L-1] = True
imgName = C.scene.namedlayers.layers[lay].name
print("rendering:", imgName)
bpy.context.scene.render.filepath = "//layers/" + imgName
bpy.ops.render.render(write_still=True)
print('done')
render(3,[5]) # with list in second arg to add layers
render(1)
render(2)
render(6)
render(7)
render(8)
render(9)
render(11)
print("all done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment