WIP: Single-frame job compiler #104194
@ -7,7 +7,7 @@ const JOB_TYPE = {
|
|||||||
{ key: "frame", type: "int32", required: true, eval: "C.scene.frame_current",
|
{ key: "frame", type: "int32", required: true, eval: "C.scene.frame_current",
|
||||||
description: "Frame to render" },
|
description: "Frame to render" },
|
||||||
{ key: "tile_size", type: "int32", default: 5, propargs: {min: 1, max: 100}, description: "Tile size for each Task (sizes are in % of each dimension)" },
|
{ key: "tile_size", type: "int32", default: 5, propargs: {min: 1, max: 100}, description: "Tile size for each Task (sizes are in % of each dimension)" },
|
||||||
|
|
||||||
// render_output_root + add_path_components determine the value of render_output_path.
|
// render_output_root + add_path_components determine the value of render_output_path.
|
||||||
{ key: "render_output_root", type: "string", subtype: "dir_path", required: true, visible: "submission",
|
{ key: "render_output_root", type: "string", subtype: "dir_path", required: true, visible: "submission",
|
||||||
description: "Base directory of where render output is stored. Will have some job-specific parts appended to it" },
|
description: "Base directory of where render output is stored. Will have some job-specific parts appended to it" },
|
||||||
@ -274,7 +274,7 @@ function authorCreateCompositeTask(settings, renderOutput) {
|
|||||||
import pathlib
|
import pathlib
|
||||||
import bpy
|
import bpy
|
||||||
C = bpy.context
|
C = bpy.context
|
||||||
basepath = "${renderOutput}/"
|
basepath = pathlib.Path("${renderOutput}")
|
||||||
filename = "MERGED.exr"
|
filename = "MERGED.exr"
|
||||||
`;
|
`;
|
||||||
if (settings.use_compositing) {
|
if (settings.use_compositing) {
|
||||||
@ -282,7 +282,7 @@ filename = "MERGED.exr"
|
|||||||
// uses snippets from
|
// uses snippets from
|
||||||
// https://github.com/state-of-the-art/BlendNet/blob/master/BlendNet/script-compose.py#L94
|
// https://github.com/state-of-the-art/BlendNet/blob/master/BlendNet/script-compose.py#L94
|
||||||
pythonExpression += `
|
pythonExpression += `
|
||||||
bpy.ops.image.open(filepath=basepath + filename, use_sequence_detection=False)
|
bpy.ops.image.open(filepath=str(basepath / filename), use_sequence_detection=False)
|
||||||
image = bpy.data.images[bpy.path.basename(filename)]
|
image = bpy.data.images[bpy.path.basename(filename)]
|
||||||
image_node = C.scene.node_tree.nodes.new(type='CompositorNodeImage')
|
image_node = C.scene.node_tree.nodes.new(type='CompositorNodeImage')
|
||||||
image_node.image = image
|
image_node.image = image
|
||||||
@ -317,21 +317,21 @@ print("Removing the nodes could potentially break the pipeline")
|
|||||||
for node in nodes_to_remove:
|
for node in nodes_to_remove:
|
||||||
print('INFO: Removing %s' % (node,))
|
print('INFO: Removing %s' % (node,))
|
||||||
C.scene.node_tree.nodes.remove(node)
|
C.scene.node_tree.nodes.remove(node)
|
||||||
C.scene.render.filepath = basepath + "FINAL"
|
C.scene.render.filepath = str(basepath / "FINAL")
|
||||||
bpy.ops.render.render(write_still=True)`;
|
bpy.ops.render.render(write_still=True)`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (settings.format == "OPEN_EXR_MULTILAYER") {
|
if (settings.format == "OPEN_EXR_MULTILAYER") {
|
||||||
// Only rename
|
// Only rename
|
||||||
pythonExpression += `
|
pythonExpression += `
|
||||||
pathlib.Path(basepath + filename).rename(basepath + 'FINAL.exr')`;
|
(basepath / filename).rename(basepath / 'FINAL.exr')`;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Only export
|
// Only export
|
||||||
pythonExpression += `
|
pythonExpression += `
|
||||||
bpy.ops.image.open(filepath=basepath + filename, use_sequence_detection=False)
|
bpy.ops.image.open(filepath=str(basepath / filename), use_sequence_detection=False)
|
||||||
image = bpy.data.images[bpy.path.basename(filename)]
|
image = bpy.data.images[bpy.path.basename(filename)]
|
||||||
image.save_render(basepath + "FINAL" + "${settings.image_file_extension}")`;
|
image.save_render(str(basepath / "FINAL") + "${settings.image_file_extension}")`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const task = author.Task(`composite`, "blender");
|
const task = author.Task(`composite`, "blender");
|
||||||
|
Loading…
Reference in New Issue
Block a user