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 466d93cd66 - Show all commits

View File

@ -55,8 +55,8 @@ function compileJob(job) {
mergeTask.addDependency(rt);
}
job.addTask(mergeTask);
compositeTask.addDependency(mergeTask);
job.addTask(compositeTask);
compositeTask.addDependency(mergeTask);
job.addTask(compositeTask);
}
// Do field replacement on the render output path.
@ -76,15 +76,15 @@ function renderOutputPath(job) {
}
function tileChunker(tile_size) {
let tiles = [];
const rows = Math.ceil(100 / tile_size);
const columns = Math.ceil(100 / tile_size);
for (let row = 0; row < rows; row++) {
for (let column = 0; column < columns; column++) {
tiles.push({"row": row, "column": column});
}
}
return tiles;
let tiles = [];
const rows = Math.ceil(100 / tile_size);
const columns = Math.ceil(100 / tile_size);
for (let row = 0; row < rows; row++) {
for (let column = 0; column < columns; column++) {
tiles.push({"row": row, "column": column});
}
}
return tiles;
}
function authorRenderTasks(settings, renderDir, renderOutput) {
@ -111,8 +111,8 @@ render.border_max_y = tile_size_decimal + ${tile.row} * tile_size_decimal`;
if (settings.use_denoising) {
pythonExpression += `
for layer in bpy.context.scene.view_layers:
layer['cycles']['denoising_store_passes'] = 1
layer.use_pass_vector = True`;
layer['cycles']['denoising_store_passes'] = 1
layer.use_pass_vector = True`;
}
const command = author.Command("blender-render", {
exe: "{blender}",
@ -120,7 +120,7 @@ for layer in bpy.context.scene.view_layers:
argsBefore: [],
blendfile: settings.blendfile,
args: [
"--python-exit-code", 1,
"--python-exit-code", 1,
"--python-expr", pythonExpression,
"--render-output", path.join(renderDir, path.basename(renderOutput), "tiles", "r" + tile.row + "c" + tile.column + "_"),
"--render-frame", settings.frame
@ -269,19 +269,19 @@ bpy.ops.render.render(write_still=True)`;
}
function authorCreateCompositeTask(settings, renderOutput) {
let filename;
let pythonExpression = `
let filename;
let pythonExpression = `
import pathlib
import bpy
C = bpy.context
basepath = pathlib.Path("${renderOutput}")
filename = "MERGED.exr"
`;
if (settings.use_compositing) {
// Do the full composite+export pipeline
// uses snippets from
// https://github.com/state-of-the-art/BlendNet/blob/master/BlendNet/script-compose.py#L94
pythonExpression += `
if (settings.use_compositing) {
// Do the full composite+export pipeline
// uses snippets from
// https://github.com/state-of-the-art/BlendNet/blob/master/BlendNet/script-compose.py#L94
pythonExpression += `
bpy.ops.image.open(filepath=str(basepath / filename), use_sequence_detection=False)
image = bpy.data.images[bpy.path.basename(filename)]
image_node = C.scene.node_tree.nodes.new(type='CompositorNodeImage')
@ -319,21 +319,21 @@ for node in nodes_to_remove:
C.scene.node_tree.nodes.remove(node)
C.scene.render.filepath = str(basepath / "FINAL")
bpy.ops.render.render(write_still=True)`;
}
else {
if (settings.format == "OPEN_EXR_MULTILAYER") {
// Only rename
pythonExpression += `
}
else {
if (settings.format == "OPEN_EXR_MULTILAYER") {
// Only rename
pythonExpression += `
(basepath / filename).rename(basepath / 'FINAL.exr')`;
}
else {
// Only export
pythonExpression += `
}
else {
// Only export
pythonExpression += `
bpy.ops.image.open(filepath=str(basepath / filename), use_sequence_detection=False)
image = bpy.data.images[bpy.path.basename(filename)]
image.save_render(str(basepath / "FINAL") + "${settings.image_file_extension}")`;
}
}
}
}
const task = author.Task(`composite`, "blender");
const command = author.Command("blender-render", {
exe: "{blender}",