From 9d650c98a11ea2686987635b482fa41f7f982318 Mon Sep 17 00:00:00 2001 From: Rodolphe Suescun Date: Mon, 19 Aug 2019 16:37:17 +0200 Subject: [PATCH] Reimplemented node deletion --- addons/material_maker/engine/gen_graph.gd | 7 +++++++ addons/material_maker/graph_edit.gd | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/addons/material_maker/engine/gen_graph.gd b/addons/material_maker/engine/gen_graph.gd index 25b78b5..988094f 100644 --- a/addons/material_maker/engine/gen_graph.gd +++ b/addons/material_maker/engine/gen_graph.gd @@ -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 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): # disconnect target while true: diff --git a/addons/material_maker/graph_edit.gd b/addons/material_maker/graph_edit.gd index 4dc11ef..2b5fca7 100644 --- a/addons/material_maker/graph_edit.gd +++ b/addons/material_maker/graph_edit.gd @@ -54,7 +54,7 @@ func disconnect_node(from, from_slot, to, to_slot): send_changed_signal(); func remove_node(node): - generator.remove_node(node.generator) + generator.remove_generator(node.generator) var node_name = node.name for c in get_connection_list(): if c.from == node_name or c.to == node_name: