WIP: Single-frame job compiler #104194

Draft
k8ie wants to merge 30 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 9048b23eb6 - Show all commits

View File

@ -142,14 +142,14 @@ import math
def normalize(number): def normalize(number):
return round(-0.5 + (number - 0) * (0.5 - -0.5) / 1 - 0, 10) return round(-0.5 + (number - 0) * (0.5 - -0.5) / 1 - 0, 10)
basepath = "${renderOutput}/" basepath = pathlib.Path("${renderOutput}")
renders = basepath + "tiles/" renders = basepath / "tiles"
filenames = list(pathlib.Path(renders).iterdir()) filenames = list(renders.iterdir())
if len(filenames) <= 1: if len(filenames) <= 1:
print('This job only has one file, merging not required.') print('This job only has one file, merging not required.')
print('Moving ' + renders + filenames[0].name + ' to ' + basepath + 'MERGED.exr') print('Moving ' + str(renders / filenames[0].name) + ' to ' + str(basepath / 'MERGED.exr'))
pathlib.Path(renders + filenames[0].name).rename(basepath + 'MERGED.exr') (renders / filenames[0].name).rename(basepath / 'MERGED.exr')
exit() exit()
row_max = math.ceil(100 / ${settings.tile_size}) - 1 row_max = math.ceil(100 / ${settings.tile_size}) - 1
@ -165,7 +165,7 @@ bpy_render.use_compositing = True
bpy_scene.use_nodes = True bpy_scene.use_nodes = True
node_tree.nodes.clear() node_tree.nodes.clear()
bpy_render.image_settings.file_format = 'OPEN_EXR_MULTILAYER' bpy_render.image_settings.file_format = 'OPEN_EXR_MULTILAYER'
bpy_render.filepath = basepath + "MERGED" bpy_render.filepath = str(basepath / "MERGED")
denoising = "${settings.use_denoising}" == "true" denoising = "${settings.use_denoising}" == "true"
tile_size_decimal = ${settings.tile_size} / 100 tile_size_decimal = ${settings.tile_size} / 100
@ -197,7 +197,7 @@ def align_tiles(input):
# Create a list of image nodes # Create a list of image nodes
image_nodes = [] image_nodes = []
for index, file in enumerate(filenames): for index, file in enumerate(filenames):
bpy.ops.image.open(filepath=renders + file.name, use_sequence_detection=False) bpy.ops.image.open(filepath=str(renders / file.name), use_sequence_detection=False)
image = bpy.data.images[bpy.path.basename(file.name)] image = bpy.data.images[bpy.path.basename(file.name)]
image_nodes.append(node_tree.nodes.new(type='CompositorNodeImage')) image_nodes.append(node_tree.nodes.new(type='CompositorNodeImage'))
image_nodes[index].image = image image_nodes[index].image = image