WIP: Initial version of a single-frame job compiler #104189

Closed
k8ie wants to merge 26 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 57c2ed5b61 - Show all commits

View File

@ -127,7 +127,7 @@ for layer in bpy.context.scene.view_layers:
args: [ args: [
"--python-exit-code", 1, "--python-exit-code", 1,
"--python-expr", pythonExpression, "--python-expr", pythonExpression,
"--render-output", path.join(renderDir, path.basename(renderOutput), chunk), "--render-output", path.join(renderDir, path.basename(renderOutput), "samples", chunk),
"--render-frame", settings.frame "--render-frame", settings.frame
] ]
}); });
@ -145,17 +145,14 @@ import pathlib
import bpy import bpy
basepath = "${renderOutput}/" basepath = "${renderOutput}/"
renders = basepath + "samples/"
tmp = basepath + 'merge_tmp/' tmp = basepath + 'merge_tmp/'
filenames = [f for f in os.listdir(basepath) if os.path.isfile(basepath + f)] filenames = [f for f in os.listdir(renders) if os.path.isfile(renders + f)]
if 'MERGED.exr' in filenames:
filenames.remove('MERGED.exr')
if 'DENOISED.exr' in filenames:
filenames.remove('DENOISED.exr')
filenames.sort() filenames.sort()
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('Renaming ' + basepath + filenames[0] + ' to ' + basepath + 'MERGED.exr') print('Moving ' + renders + filenames[0] + ' to ' + basepath + 'MERGED.exr')
pathlib.Path(basepath + filenames[0]).rename(basepath + 'MERGED.exr') pathlib.Path(renders + filenames[0]).rename(basepath + 'MERGED.exr')
exit() exit()
if not os.path.exists(tmp): if not os.path.exists(tmp):
os.makedirs(tmp) os.makedirs(tmp)
@ -163,13 +160,13 @@ if not os.path.exists(tmp):
index = 0 index = 0
while len(filenames) > 0: while len(filenames) > 0:
if index == 0: if index == 0:
print('Merging ' + basepath + filenames[0] + ' and ' + basepath + filenames[1]) print('Merging ' + renders + filenames[0] + ' and ' + renders + filenames[1])
bpy.ops.cycles.merge_images(input_filepath1=basepath+filenames[0], input_filepath2=basepath + filenames[1], output_filepath=tmp+str(index)+'.exr') bpy.ops.cycles.merge_images(input_filepath1=renders + filenames[0], input_filepath2=renders + filenames[1], output_filepath=tmp + str(index)+'.exr')
del filenames[0] del filenames[0]
del filenames[0] del filenames[0]
else: else:
print('Merging ' + tmp + str(index - 1) + '.exr' + ' and ' + basepath + filenames[0]) print('Merging ' + tmp + str(index - 1) + '.exr' + ' and ' + renders + filenames[0])
bpy.ops.cycles.merge_images(input_filepath1=tmp + str(index - 1) + '.exr', input_filepath2=basepath + filenames[0], output_filepath=tmp+str(index)+'.exr') bpy.ops.cycles.merge_images(input_filepath1=tmp + str(index - 1) + '.exr', input_filepath2=renders + filenames[0], output_filepath=tmp + str(index) + '.exr')
del filenames[0] del filenames[0]
index += 1 index += 1