Add a check to prevent duplicating connections in visual shader

This commit is contained in:
Yuri Rubinsky 2022-07-27 08:06:34 +03:00
parent ad9a8e70f4
commit 2f43398182

View file

@ -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;