WIP: Single-frame job compiler #104194
@ -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