I'm creating a scene from scratch in blender (2.83+) using python, and I'd like to turn on Intel denoiser for the Cycles render output.
I've got some code but it's not working yet:
bpy.context.view_layer.cycles.denoising_store_passes = True
bpy.context.scene.use_nodes = True
tree = bpy.context.scene.node_tree # inputs, outputs, nodes, links
comp = tree.nodes[0] # result goes into here
render = tree.nodes[1] # render layers: images come from here
denoise_node = tree.nodes.new(type='CompositorNodeDenoise')
# Link it in:
links = tree.links
# links.new(output ---> input)
link = links.new(denoise_node.outputs[0], comp.inputs[0])
# XXX: find outputs by name
# XXX: use "Noisy Image" output (31) rather than "Image" (0)?
link = links.new(render.outputs[0], denoise_node.inputs[0]) # Image
link = links.new(render.outputs[32], denoise_node.inputs[1]) # Denoising Normal
link = links.new(render.outputs[33], denoise_node.inputs[2]) # Denoising Albedo
The problem is that even though I've enabled bpy.context.view_layer.cycles.denoising_store_passes = True
it doesn't seem to have taken effect by the time the rest of my code runs; the render
node still only has 31 outputs. It should have 39.
Anyone know how I can wait for that setting to take effect before continuing?
bpy.context.view_layer.update()
but that doesn't help. $\endgroup$render.update()
-- also no effect. $\endgroup$