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 371c731a79 - Show all commits

View File

@ -97,7 +97,6 @@ function authorRenderTasks(settings, renderDir, renderOutput) {
let pythonExpression = ` let pythonExpression = `
import bpy import bpy
render = bpy.context.scene.render render = bpy.context.scene.render
render.engine = 'CYCLES'
render.use_compositing = False render.use_compositing = False
bpy.context.scene.cycles.use_denoising = False bpy.context.scene.cycles.use_denoising = False
render.image_settings.file_format = 'OPEN_EXR_MULTILAYER' render.image_settings.file_format = 'OPEN_EXR_MULTILAYER'
@ -133,7 +132,6 @@ for layer in bpy.context.scene.view_layers:
function authorCreateMergeTask(settings, renderOutput) { function authorCreateMergeTask(settings, renderOutput) {
const task = author.Task(`merge`, "blender"); const task = author.Task(`merge`, "blender");
let pythonExpression = ` let pythonExpression = `
import os
import pathlib import pathlib
import bpy import bpy
import math import math
@ -143,12 +141,12 @@ def normalize(number):
basepath = "${renderOutput}/" basepath = "${renderOutput}/"
renders = basepath + "tiles/" renders = basepath + "tiles/"
filenames = [f for f in os.listdir(renders) if os.path.isfile(renders + f)] filenames = list(pathlib.Path(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] + ' to ' + basepath + 'MERGED.exr') print('Moving ' + renders + filenames[0].name + ' to ' + basepath + 'MERGED.exr')
pathlib.Path(renders + filenames[0]).rename(basepath + 'MERGED.exr') pathlib.Path(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
@ -187,9 +185,9 @@ def align_tiles(input):
# Create a list of image nodes # Create a list of image nodes
image_nodes = [] image_nodes = []
for index, image in enumerate(filenames): for index, file in enumerate(filenames):
bpy.ops.image.open(filepath=renders + image, use_sequence_detection=False) bpy.ops.image.open(filepath=renders + file.name, use_sequence_detection=False)
image = bpy.data.images[bpy.path.basename(image)] image = bpy.data.images[bpy.path.basename(file.name)]
image_nodes.append(bpy.context.scene.node_tree.nodes.new(type='CompositorNodeImage')) image_nodes.append(bpy.context.scene.node_tree.nodes.new(type='CompositorNodeImage'))
image_nodes[index].image = image image_nodes[index].image = image