I'm trying to render an animation simultaneously from 32 points of view and integrate the result in a composed animation.
I followed this answer: How to create a render layer in blender python
and this one: How to combine renders from multiple cameras
However using:
basescene=bpy.context.screen.scene
for i in Hs:
for j in Ws:
bpy.context.screen.scene=basescene
bpy.ops.scene.new(type='LINK_OBJECTS')
newscene=bpy.context.screen.scene
newscene.name='scene_h_'+ str(i)+'_w_'+str(j)
new_render_layer = scene.render.layers.new('rl_h_'+ str(i)+'_w_'+str(j))
newscene.render.layers.active=new_render_layer
Each scene render.layers.active is equal to:
bpy.data.scenes['scene_h_0_w_4'].render.layers["RenderLayer"]
Or in other words, whatever scene is selected the following is true:
bpy.context.scene.render.layers.active.name == "RenderLayer"
Also the scenes would always miss only the last render layer created
e.g. rl_h_0_w_4 not in scene_h_0_w_4 but scene_h_0_w_4 in scene_h_0_w_5
How can I associate each scene to a different render layer and compose them in the final scene?