better check for connect selection to output node
parent
1a97f75692
commit
c176f7ab6a
19
fn.py
19
fn.py
|
@ -1788,6 +1788,15 @@ def clean_mats_duplication(ob, skip_different_materials=True):
|
||||||
print(f'{diff_ct} mat skipped >> same name but different color settings!')
|
print(f'{diff_ct} mat skipped >> same name but different color settings!')
|
||||||
# return ('INFO', f'{diff_ct} mat skipped >> same name but different color settings!')
|
# return ('INFO', f'{diff_ct} mat skipped >> same name but different color settings!')
|
||||||
|
|
||||||
|
def recursive_node_connect_check(l, target_node):
|
||||||
|
if l.to_node == target_node:
|
||||||
|
return True
|
||||||
|
for o in l.to_node.outputs:
|
||||||
|
for sl in o.links:
|
||||||
|
if recursive_node_connect_check(sl, target_node):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def connect_to_file_output(node_list, file_out=None):
|
def connect_to_file_output(node_list, file_out=None):
|
||||||
scene = bpy.context.scene
|
scene = bpy.context.scene
|
||||||
nodes = scene.node_tree.nodes
|
nodes = scene.node_tree.nodes
|
||||||
|
@ -1828,6 +1837,11 @@ def connect_to_file_output(node_list, file_out=None):
|
||||||
for o in outs:
|
for o in outs:
|
||||||
# if o.name == 'Deprecated':
|
# if o.name == 'Deprecated':
|
||||||
# continue
|
# 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 = bpy.path.clean_name(o.name)
|
||||||
slot_name = f'{slot_name}/{slot_name}_'
|
slot_name = f'{slot_name}/{slot_name}_'
|
||||||
fo.file_slots.new(slot_name)
|
fo.file_slots.new(slot_name)
|
||||||
|
@ -1856,6 +1870,11 @@ def connect_to_file_output(node_list, file_out=None):
|
||||||
fo.base_path = f'//render/{out_base}/cryptos/cryptos_'
|
fo.base_path = f'//render/{out_base}/cryptos/cryptos_'
|
||||||
|
|
||||||
for o in cryptout:
|
for o in cryptout:
|
||||||
|
## Skip already connected
|
||||||
|
## TODO Test recusively to find fo (some have interconnected sockets)
|
||||||
|
# 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 = bpy.path.clean_name(o.name) # directly use name in multi layer exr
|
||||||
# slot_name = f'{slot_name}/{slot_name}_'
|
# slot_name = f'{slot_name}/{slot_name}_'
|
||||||
fo.file_slots.new(slot_name)
|
fo.file_slots.new(slot_name)
|
||||||
|
|
Loading…
Reference in New Issue