| 1051 | } |
| 1052 | |
| 1053 | void VisualShader::remove_node(Type p_type, int p_id) { |
| 1054 | ERR_FAIL_INDEX(p_type, TYPE_MAX); |
| 1055 | ERR_FAIL_COND(p_id < 2); |
| 1056 | Graph *g = &graph[p_type]; |
| 1057 | ERR_FAIL_COND(!g->nodes.has(p_id)); |
| 1058 | |
| 1059 | g->nodes[p_id].node->disconnect_changed(callable_mp(this, &VisualShader::_queue_update)); |
| 1060 | |
| 1061 | g->nodes.erase(p_id); |
| 1062 | |
| 1063 | for (List<Connection>::Element *E = g->connections.front(); E;) { |
| 1064 | List<Connection>::Element *N = E->next(); |
| 1065 | const VisualShader::Connection &connection = E->get(); |
| 1066 | if (connection.from_node == p_id || connection.to_node == p_id) { |
| 1067 | if (connection.from_node == p_id) { |
| 1068 | g->nodes[connection.to_node].prev_connected_nodes.erase(p_id); |
| 1069 | g->nodes[connection.to_node].node->set_input_port_connected(connection.to_port, false); |
| 1070 | } else if (connection.to_node == p_id) { |
| 1071 | g->nodes[connection.from_node].next_connected_nodes.erase(p_id); |
| 1072 | g->nodes[connection.from_node].node->set_output_port_connected(connection.from_port, false); |
| 1073 | } |
| 1074 | g->connections.erase(E); |
| 1075 | } |
| 1076 | E = N; |
| 1077 | } |
| 1078 | |
| 1079 | _queue_update(); |
| 1080 | } |
| 1081 | |
| 1082 | void VisualShader::replace_node(Type p_type, int p_id, const StringName &p_new_class) { |
| 1083 | ERR_FAIL_INDEX(p_type, TYPE_MAX); |
nothing calls this directly
no test coverage detected