WIP: Initial version of a single-frame job compiler #104189

Closed
k8ie wants to merge 26 commits from k8ie/flamenco:single-frame into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Showing only changes of commit c7d5d8fe9a - Show all commits

View File

@ -162,23 +162,28 @@ bpy.context.scene.node_tree.nodes.clear()
bpy.context.scene.render.image_settings.file_format = 'OPEN_EXR_MULTILAYER' bpy.context.scene.render.image_settings.file_format = 'OPEN_EXR_MULTILAYER'
bpy.context.scene.render.filepath = basepath + "MERGED" bpy.context.scene.render.filepath = basepath + "MERGED"
def create_translate(index, dimensions):
translate_node = bpy.context.scene.node_tree.nodes.new(type='CompositorNodeTranslate')
translate_node.use_relative = True
for dimension in dimensions:
if dimensions[dimension] == 0:
translate_node.inputs[dimension].default_value = normalize(${settings.tile_size} / 100 / 2)
elif dimensions[dimension] == row_max and 100 % ${settings.tile_size} != 0:
translate_node.inputs[dimension].default_value = normalize((${settings.tile_size} / 100 + (dimensions[dimension] - 1) * ${settings.tile_size} / 100) + ((100 % ${settings.tile_size}) / 100) / 2)
else:
translate_node.inputs[dimension].default_value = normalize((${settings.tile_size} / 100 + (dimensions[dimension] - 1) * ${settings.tile_size} / 100) + (${settings.tile_size} / 100) / 2)
return translate_node
image_node_translates = [] image_node_translates = []
for index, image in enumerate(filenames): for index, image in enumerate(filenames):
dimensions = {'X': int(image.split('c')[-1].split('_')[0]), 'Y': int(image.split('c')[0].replace('r', ''))} dimensions = {'X': int(image.split('c')[-1].split('_')[0]), 'Y': int(image.split('c')[0].replace('r', ''))}
bpy.ops.image.open(filepath=renders + image, use_sequence_detection=False) bpy.ops.image.open(filepath=renders + image, use_sequence_detection=False)
image = bpy.data.images[bpy.path.basename(image)] image = bpy.data.images[bpy.path.basename(image)]
image_node = bpy.context.scene.node_tree.nodes.new(type='CompositorNodeImage') image_node = bpy.context.scene.node_tree.nodes.new(type='CompositorNodeImage')
image_node_translates.append(bpy.context.scene.node_tree.nodes.new(type='CompositorNodeTranslate')) image_node_translates.append(create_translate(index, dimensions))
image_node.image = image image_node.image = image
image_node_translates[index].use_relative = True
bpy.context.scene.node_tree.links.new(image_node.outputs['Combined'], image_node_translates[index].inputs['Image']) bpy.context.scene.node_tree.links.new(image_node.outputs['Combined'], image_node_translates[index].inputs['Image'])
for dimension in dimensions:
if dimensions[dimension] == 0:
image_node_translates[index].inputs[dimension].default_value = normalize(${settings.tile_size} / 100 / 2)
elif dimensions[dimension] == row_max and 100 % ${settings.tile_size} != 0:
image_node_translates[index].inputs[dimension].default_value = normalize((${settings.tile_size} / 100 + (dimensions[dimension] - 1) * ${settings.tile_size} / 100) + ((100 % ${settings.tile_size}) / 100) / 2)
else:
image_node_translates[index].inputs[dimension].default_value = normalize((${settings.tile_size} / 100 + (dimensions[dimension] - 1) * ${settings.tile_size} / 100) + (${settings.tile_size} / 100) / 2)
output_node = bpy.context.scene.node_tree.nodes.new(type='CompositorNodeComposite') output_node = bpy.context.scene.node_tree.nodes.new(type='CompositorNodeComposite')
denoising = "${settings.use_denoising}" == "true" denoising = "${settings.use_denoising}" == "true"