Add a check to prevent duplicating connections in visual shader
This commit is contained in:
parent
ad9a8e70f4
commit
2f43398182
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue