MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / remove_node

Method remove_node

scene/resources/visual_shader.cpp:1053–1080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1051}
1052
1053void 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
1082void VisualShader::replace_node(Type p_type, int p_id, const StringName &p_new_class) {
1083 ERR_FAIL_INDEX(p_type, TYPE_MAX);

Callers

nothing calls this directly

Calls 8

disconnect_changedMethod · 0.80
hasMethod · 0.45
eraseMethod · 0.45
frontMethod · 0.45
nextMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected