Merge pull request #63521 from Chaosus/vs_fix_connections

Add a check to prevent duplicating connections in visual shader
This commit is contained in:
Rémi Verschelde 2022-07-27 08:30:48 +02:00 committed by GitHub
commit 8a5c1dfd12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;