1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Visual shader refacter use of connection

This commit is contained in:
Alistair Leslie-Hughes
2023-11-14 07:11:48 +11:00
parent 0c03d25ba4
commit bfd62d7cdf

View File

@@ -962,12 +962,13 @@ void VisualShader::remove_node(Type p_type, int p_id) {
for (List<Connection>::Element *E = g->connections.front(); E;) { for (List<Connection>::Element *E = g->connections.front(); E;) {
List<Connection>::Element *N = E->next(); List<Connection>::Element *N = E->next();
if (E->get().from_node == p_id || E->get().to_node == p_id) { const VisualShader::Connection &connection = E->get();
if (E->get().from_node == p_id) { if (connection.from_node == p_id || connection.to_node == p_id) {
g->nodes[E->get().to_node].prev_connected_nodes.erase(p_id); if (connection.from_node == p_id) {
g->nodes[E->get().to_node].node->set_input_port_connected(E->get().to_port, false); g->nodes[connection.to_node].prev_connected_nodes.erase(p_id);
} else if (E->get().to_node == p_id) { g->nodes[connection.to_node].node->set_input_port_connected(connection.to_port, false);
g->nodes[E->get().from_node].next_connected_nodes.erase(p_id); } else if (connection.to_node == p_id) {
g->nodes[connection.from_node].next_connected_nodes.erase(p_id);
} }
g->connections.erase(E); g->connections.erase(E);
} }