initial support for template in output base path and slots

This commit is contained in:
pullusb
2024-04-18 18:12:18 +02:00
parent ad083e45b6
commit de66ed85ba
2 changed files with 84 additions and 24 deletions
+32 -15
View File
@@ -1930,6 +1930,7 @@ def connect_to_file_output(node_list, file_out=None, base_path='', excludes=None
if not fo:
# color = (0.2,0.3,0.5)
fo = create_node('CompositorNodeOutputFile', tree=scene.node_tree, location=(real_loc(node)[0]+500, real_loc(node)[1]+50), width=600)
fo.inputs.remove(fo.inputs[0]) # Remove default image input
if file_format:
for k, v in file_format.items():
setattr(fo.format, k, v)
@@ -1952,11 +1953,21 @@ def connect_to_file_output(node_list, file_out=None, base_path='', excludes=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)
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)
# 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)
fs = fo.file_slots.new('tmp') # slot_name)
ls = fo.layer_slots.new('tmp') # slot_name + 'layer')
ls = fo.layer_slots[-1]
ls.name = slot_name
fs = fo.file_slots[-1]
fs.path = f'{slot_name}/{slot_name}_' # Error 'NodeSocketColor' object has no attribute 'path'
out_input = fo.inputs[-1]
links.new(o, out_input)
@@ -1972,6 +1983,7 @@ def connect_to_file_output(node_list, file_out=None, base_path='', excludes=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)
fo.inputs.remove(fo.inputs[0]) # Remove default image input
if file_format:
for k, v in file_format.items():
setattr(fo.format, k, v)
@@ -2001,17 +2013,22 @@ def connect_to_file_output(node_list, file_out=None, base_path='', excludes=None
slot_name = bpy.path.clean_name(o.name) # directly use name in multi layer exr
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)
# 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)
# Setting both file_slots and layer_slots...
fs = fo.file_slots.new('tmp')
ls = fo.layer_slots.new('tmp')
ls = fo.layer_slots[-1]
ls.name = slot_name
fs = fo.file_slots[-1]
fs.path = f'{slot_name}/{slot_name}_' # Error 'NodeSocketColor' object has no attribute 'path'
## Setting both file_slots and layer_slots...
# fs = fo.file_slots.new(slot_name)
# fs.path = f'{slot_name}/{slot_name}_' # Error 'NodeSocketColor' object has no attribute 'path'
# ls = fo.layer_slots.new(slot_name)
# ls.name = slot_name
out_input = fo.inputs[-1]
links.new(o, out_input)