Reimplemented node deletion

This commit is contained in:
Rodolphe Suescun 2019-08-19 16:37:17 +02:00
parent d8d9aaa9b4
commit 9d650c98a1
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,13 @@ func get_port_source(gen_name: String, input_index: int) -> OutputPort:
return OutputPort.new(get_node(c.from), c.from_port) return OutputPort.new(get_node(c.from), c.from_port)
return null return null
func remove_generator(generator : MMGenBase):
var new_connections = []
for c in connections:
if c.from != generator.name and c.to != generator.name:
new_connections.append(c)
connections = new_connections
func connect_children(from, from_port : int, to, to_port : int): func connect_children(from, from_port : int, to, to_port : int):
# disconnect target # disconnect target
while true: while true:

View File

@ -54,7 +54,7 @@ func disconnect_node(from, from_slot, to, to_slot):
send_changed_signal(); send_changed_signal();
func remove_node(node): func remove_node(node):
generator.remove_node(node.generator) generator.remove_generator(node.generator)
var node_name = node.name var node_name = node.name
for c in get_connection_list(): for c in get_connection_list():
if c.from == node_name or c.to == node_name: if c.from == node_name or c.to == node_name: