Distributed rendering of single images #104327

Merged
David Zhang merged 22 commits from David-Zhang-10/flamenco:single-image-render into main 2024-09-03 06:47:49 +02:00
Showing only changes of commit 8f63daf110 - Show all commits

View File

@ -189,8 +189,6 @@ render.use_compositing = True
node_tree = bpy.context.scene.node_tree node_tree = bpy.context.scene.node_tree
overscan = 16 overscan = 16
# TODO: check if the render layers node actually exists
feed_in_input = None
render_layers_node = None render_layers_node = None
for node in node_tree.nodes: for node in node_tree.nodes:
if node.type == 'R_LAYERS': if node.type == 'R_LAYERS':
@ -198,8 +196,9 @@ for node in node_tree.nodes:
render_layers_node = node render_layers_node = node
break break
for link in node_tree.links: for link in node_tree.links:
if link.from_socket == feed_in_input: if feed_in_input is not None and link.from_socket == feed_in_input:
feed_in_output = link.to_socket feed_in_output = link.to_socket
break
from os import listdir from os import listdir
from os.path import isfile, join from os.path import isfile, join
@ -278,7 +277,10 @@ set_alpha_node = node_tree.nodes.new('CompositorNodeSetAlpha')
set_alpha_node.mode = 'REPLACE_ALPHA' set_alpha_node.mode = 'REPLACE_ALPHA'
node_tree.links.new(mix_adds[-1].outputs[0], set_alpha_node.inputs[0]) node_tree.links.new(mix_adds[-1].outputs[0], set_alpha_node.inputs[0])
node_tree.links.new(math_adds[-1].outputs[0], set_alpha_node.inputs[1]) node_tree.links.new(math_adds[-1].outputs[0], set_alpha_node.inputs[1])
node_tree.links.new(set_alpha_node.outputs[0], feed_in_output) if feed_in_input is not None:
node_tree.links.new(set_alpha_node.outputs[0], feed_in_output)
else:
raise Exception('No Render Layers Node found. Currently only supported with a Render Layers Node in the Compositor.')
node_tree.nodes.remove(render_layers_node) node_tree.nodes.remove(render_layers_node)
bpy.ops.render.render(write_still=True)` bpy.ops.render.render(write_still=True)`