fix merge function for blender4
parent
74d94e2cdb
commit
a6e8da6973
29
fn.py
29
fn.py
|
@ -447,15 +447,28 @@ def remove_nodes_by_viewlayer(viewlayer_list, scene=None):
|
|||
# remove input and output from group
|
||||
# grp.inputs.remove(sockin) # do not clear inside !!
|
||||
# grp.outputs.remove(sockout) # do not clear inside !!
|
||||
|
||||
ngroup = grp.node_tree
|
||||
for i in range(len(grp.inputs))[::-1]:
|
||||
if grp.inputs[i].name == sockin.name:
|
||||
ngroup.inputs.remove(ngroup.inputs[i])
|
||||
break
|
||||
for i in range(len(grp.outputs))[::-1]:
|
||||
if grp.outputs[i].name == sockout.name:
|
||||
ngroup.outputs.remove(ngroup.outputs[i])
|
||||
break
|
||||
if bpy.app.version < (4,0,0):
|
||||
for i in range(len(grp.inputs))[::-1]:
|
||||
if grp.inputs[i].name == sockin.name:
|
||||
ngroup.inputs.remove(ngroup.inputs[i])
|
||||
break
|
||||
for i in range(len(grp.outputs))[::-1]:
|
||||
if grp.outputs[i].name == sockout.name:
|
||||
ngroup.outputs.remove(ngroup.outputs[i])
|
||||
break
|
||||
else:
|
||||
g_inputs = [s for s in ngroup.interface.items_tree if s.in_out == 'INPUT']
|
||||
g_outputs = [s for s in ngroup.interface.items_tree if s.in_out == 'OUTPUT']
|
||||
for i in range(len(grp.inputs))[::-1]:
|
||||
if grp.inputs[i].name == sockin.name:
|
||||
ngroup.interface.remove(g_inputs[i])
|
||||
break
|
||||
for i in range(len(grp.outputs))[::-1]:
|
||||
if grp.outputs[i].name == sockout.name:
|
||||
ngroup.interface.remove(g_outputs[i])
|
||||
break
|
||||
|
||||
# Remove render_layer node
|
||||
scene.node_tree.nodes.remove(n)
|
||||
|
|
Loading…
Reference in New Issue