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

Method _create_node_func

scene/debugger/scene_debugger.cpp:1205–1241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203}
1204
1205void LiveEditor::_create_node_func(const NodePath &p_parent, const String &p_type, const String &p_name) {
1206 SceneTree *scene_tree = SceneTree::get_singleton();
1207 if (!scene_tree) {
1208 return;
1209 }
1210
1211 Node *base = nullptr;
1212 if (scene_tree->root->has_node(live_edit_root)) {
1213 base = scene_tree->root->get_node(live_edit_root);
1214 }
1215
1216 HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
1217 if (!E) {
1218 return; //scene not editable
1219 }
1220
1221 for (Node *F : E->value) {
1222 Node *n = F;
1223
1224 if (base && !base->is_ancestor_of(n)) {
1225 continue;
1226 }
1227
1228 if (!n->has_node(p_parent)) {
1229 continue;
1230 }
1231 Node *n2 = n->get_node(p_parent);
1232
1233 Node *no = Object::cast_to<Node>(ClassDB::instantiate(p_type));
1234 if (!no) {
1235 continue;
1236 }
1237
1238 no->set_name(p_name);
1239 n2->add_child(no);
1240 }
1241}
1242
1243void LiveEditor::_instance_node_func(const NodePath &p_parent, const String &p_path, const String &p_name) {
1244 SceneTree *scene_tree = SceneTree::get_singleton();

Callers 1

_msg_live_create_nodeMethod · 0.80

Calls 6

is_ancestor_ofMethod · 0.80
has_nodeMethod · 0.45
get_nodeMethod · 0.45
findMethod · 0.45
set_nameMethod · 0.45
add_childMethod · 0.45

Tested by

no test coverage detected