Created
April 7, 2013 07:56
-
-
Save robomojo/5329497 to your computer and use it in GitHub Desktop.
For blender. Automates custom scene configurations for the selected renderlayer. Works as is but WIP!
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
import bpy | |
# SETTING DATA VALUES: LIST[VISIBLE LAYERS], STRING(WORLD NAME) | |
animRange=[0,250] | |
singleFrame=[0,0] | |
#ob_bg = bpy.data.objects['Environment_proxy'] | |
#material_shad = bpy.data.materials['LightingPass_Shadow'] | |
#material_boun = bpy.data.materials['LightingPass_Bounce'] | |
noMaterialOverides = [] | |
#overides_bg_useShad = [[ob_bg,material_shad]] | |
#overides_bg_useBoun = [[ob_bg,material_boun]] | |
data={} | |
#data["HEADS"] = [[1,5,6,7], 'World', animRange, noMaterialOverides] # verified | |
#data["BG_BL"] = [[0,2,4], 'World_Bounce', singleFrame, overides_bg_useBoun] # verified | |
#data["BG"] = [[0,1,2], 'World', singleFrame, noMaterialOverides] # verified | |
#data["JARS"] = [[1,2,3,4], 'World', singleFrame, noMaterialOverides] # verified | |
#data["BG_AO"] = [[2,3], 'World_AO', singleFrame, overides_bg_useShad] # verified | |
#data["WATER"] = [[4], 'World', singleFrame, noMaterialOverides] # verified | |
#data["WATER_RIPPLES"] = [[1,2,14], 'World', animRange, noMaterialOverides] # verified | |
context = bpy.data.scenes["animation"] | |
renderLayer = context.render.layers.active | |
key = renderLayer.name | |
visibleLayers = data[key][0] | |
worldSetting = data[key][1] | |
frameRange = data[key][2] | |
matOverides = data[key][3] | |
# MATERIAL OVERIDES - this can break easily. | |
#if len(each[0].material_slots) is 0: | |
# bpy.ops.object.material_slot_add() | |
for each in matOverides: | |
each[0].material_slots[each[0].active_material_index].material=each[1] | |
# SET OUTPUT | |
context.render.filepath = '//render\\'+key+'\\' | |
# SET FRAME RANGE | |
context.frame_start=frameRange[0] | |
context.frame_end=frameRange[1] | |
# SET WORLD SETTING | |
context.world = bpy.data.worlds[worldSetting] | |
# TURN OTHER LAYERS OFF - could use render.use_single_layer instead? | |
for rlayer in context.render.layers: | |
rlayer.use=False | |
renderLayer.use=True | |
# SET layer visibility | |
# set ON first, as active_layer is readonly, and interferes. | |
for layerIndex in visibleLayers: | |
context.layers[layerIndex] = True | |
for index in range(0,19): | |
if index not in visibleLayers: | |
context.layers[index] = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment