WIP: Single-frame job compiler #104194
@ -127,7 +127,7 @@ for layer in bpy.context.scene.view_layers:
|
||||
args: [
|
||||
"--python-exit-code", 1,
|
||||
"--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
|
||||
]
|
||||
});
|
||||
@ -145,17 +145,14 @@ import pathlib
|
||||
import bpy
|
||||
|
||||
basepath = "${renderOutput}/"
|
||||
renders = basepath + "samples/"
|
||||
tmp = basepath + 'merge_tmp/'
|
||||
filenames = [f for f in os.listdir(basepath) if os.path.isfile(basepath + f)]
|
||||
if 'MERGED.exr' in filenames:
|
||||
filenames.remove('MERGED.exr')
|
||||
if 'DENOISED.exr' in filenames:
|
||||
filenames.remove('DENOISED.exr')
|
||||
filenames = [f for f in os.listdir(renders) if os.path.isfile(renders + f)]
|
||||
filenames.sort()
|
||||
if len(filenames) <= 1:
|
||||
print('This job only has one file, merging not required.')
|
||||
print('Renaming ' + basepath + filenames[0] + ' to ' + basepath + 'MERGED.exr')
|
||||
pathlib.Path(basepath + filenames[0]).rename(basepath + 'MERGED.exr')
|
||||
print('Moving ' + renders + filenames[0] + ' to ' + basepath + 'MERGED.exr')
|
||||
pathlib.Path(renders + filenames[0]).rename(basepath + 'MERGED.exr')
|
||||
exit()
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
@ -163,13 +160,13 @@ if not os.path.exists(tmp):
|
||||
index = 0
|
||||
while len(filenames) > 0:
|
||||
if index == 0:
|
||||
print('Merging ' + basepath + filenames[0] + ' and ' + basepath + filenames[1])
|
||||
bpy.ops.cycles.merge_images(input_filepath1=basepath+filenames[0], input_filepath2=basepath + filenames[1], output_filepath=tmp+str(index)+'.exr')
|
||||
print('Merging ' + renders + filenames[0] + ' and ' + renders + filenames[1])
|
||||
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]
|
||||
else:
|
||||
print('Merging ' + tmp + str(index - 1) + '.exr' + ' and ' + basepath + 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')
|
||||
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=renders + filenames[0], output_filepath=tmp + str(index) + '.exr')
|
||||
del filenames[0]
|
||||
index += 1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user