From 2f4339818280e545e4c4811be71534d4147299aa Mon Sep 17 00:00:00 2001 From: Yuri Rubinsky Date: Wed, 27 Jul 2022 08:06:34 +0300 Subject: [PATCH] Add a check to prevent duplicating connections in visual shader --- scene/resources/visual_shader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index b68cce9dda6..3cf643221bd 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -967,6 +967,12 @@ void VisualShader::connect_nodes_forced(Type p_type, int p_from_node, int p_from ERR_FAIL_COND(!g->nodes.has(p_to_node)); ERR_FAIL_INDEX(p_to_port, g->nodes[p_to_node].node->get_input_port_count()); + for (const Connection &E : g->connections) { + if (E.from_node == p_from_node && E.from_port == p_from_port && E.to_node == p_to_node && E.to_port == p_to_port) { + return; + } + } + Connection c; c.from_node = p_from_node; c.from_port = p_from_port;