Fix file output base path

1.7.1

- fix: file output base path depending on file format
- fix: problem when connecting render layers
This commit is contained in:
pullusb
2024-04-17 14:37:44 +02:00
parent 4627b50248
commit 16a4014da9
5 changed files with 59 additions and 29 deletions
+24 -13
View File
@@ -1906,18 +1906,20 @@ def connect_to_file_output(node_list, file_out=None):
fo.name = out_name
if node.parent:
fo.parent = node.parent
fo.base_path = f'//render/{out_base}'
if fo.format.file_format == 'OPEN_EXR_MULTILAYER':
fo.base_path = f'//render/{out_base}/{out_base}_'
else:
fo.base_path = f'//render/{out_base}'
for o in outs:
# if o.name == 'Deprecated':
# continue
## Skip if already connected to current FO
# if next((l for l in o.links if l.to_node == fo), None):
if next((l for l in o.links if recursive_node_connect_check(l, fo)), None):
continue
slot_name = bpy.path.clean_name(o.name)
slot_name = f'{slot_name}/{slot_name}_'
if fo.format.file_format == 'OPEN_EXR_MULTILAYER':
slot_name = slot_name
else:
slot_name = f'{slot_name}/{slot_name}_'
fo.file_slots.new(slot_name)
out_input = fo.inputs[-1]
links.new(o, out_input)
@@ -1933,15 +1935,18 @@ def connect_to_file_output(node_list, file_out=None):
if not fo:
# color = (0.2,0.3,0.5)
fo = create_node('CompositorNodeOutputFile', tree=scene.node_tree, location=(real_loc(node)[0]+400, real_loc(node)[1]-200), width=220)
set_file_output_format(fo)
fo.format.file_format = 'OPEN_EXR_MULTILAYER'
fo.format.color_mode = 'RGBA'
set_file_output_format(fo) # OPEN_EXR_MULTILAYER, RGBA, ZIP
fo.format.color_depth = '32'
fo.format.exr_codec = 'ZIP'
fo.name = out_name
if node.parent:
fo.parent = node.parent
fo.base_path = f'//render/{out_base}/cryptos/cryptos_'
if fo.format.file_format == 'OPEN_EXR_MULTILAYER':
## FIXME: find a better organization for separated crypto pass
fo.base_path = f'//render/{out_base}/cryptos/cryptos_'
else:
fo.base_path = f'//render/{out_base}'
# fo.base_path = f'//render/{out_base}/cryptos'
for o in cryptout:
## Skip already connected
@@ -1949,8 +1954,14 @@ def connect_to_file_output(node_list, file_out=None):
# if next((l for l in o.links if l.to_node == fo), None):
if next((l for l in o.links if recursive_node_connect_check(l, fo)), None):
continue
slot_name = bpy.path.clean_name(o.name) # directly use name in multi layer exr
# slot_name = f'{slot_name}/{slot_name}_'
if fo.format.file_format == 'OPEN_EXR_MULTILAYER':
slot_name = slot_name
else:
slot_name = f'{slot_name}/{slot_name}_'
fo.file_slots.new(slot_name)
out_input = fo.inputs[-1]
links.new(o, out_input)