remove node if already exists in the tree

master
QuantumCoderQC 2021-12-03 14:23:02 +01:00
parent a67fb107b9
commit deb758c05b
1 changed files with 22 additions and 0 deletions

View File

@ -13,6 +13,28 @@ class GroupInputNode(ArmLogicTreeNode):
def __init__(self):
array_nodes[str(id(self))] = self
def init(self, context):
tree = bpy.context.space_data.edit_tree
nodeCount = 0
for node in tree.nodes:
if (node.bl_idname == 'LNGroupInputNode'):
nodeCount += 1
if(nodeCount > 1):
print("Too many nodes")
tree.nodes.remove(self)
else:
self.arm_init(context)
def copy(self, node):
tree = bpy.context.space_data.edit_tree
nodeCount = 0
for node in tree.nodes:
if (node.bl_idname == 'LNGroupInputNode'):
nodeCount += 1
if(nodeCount > 1):
print("Too many nodes")
tree.nodes.remove(self)
def arm_init(self, context):
self.add_output('ArmAnySocket', '')