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

Method _duplicate_node_func

scene/debugger/scene_debugger.cpp:1418–1455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1416}
1417
1418void LiveEditor::_duplicate_node_func(const NodePath &p_at, const String &p_new_name) {
1419 SceneTree *scene_tree = SceneTree::get_singleton();
1420 if (!scene_tree) {
1421 return;
1422 }
1423
1424 Node *base = nullptr;
1425 if (scene_tree->root->has_node(live_edit_root)) {
1426 base = scene_tree->root->get_node(live_edit_root);
1427 }
1428
1429 HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
1430 if (!E) {
1431 return; //scene not editable
1432 }
1433
1434 for (Node *F : E->value) {
1435 Node *n = F;
1436
1437 if (base && !base->is_ancestor_of(n)) {
1438 continue;
1439 }
1440
1441 if (!n->has_node(p_at)) {
1442 continue;
1443 }
1444 Node *n2 = n->get_node(p_at);
1445
1446 Node *dup = n2->duplicate(Node::DUPLICATE_SIGNALS | Node::DUPLICATE_GROUPS | Node::DUPLICATE_SCRIPTS);
1447
1448 if (!dup) {
1449 continue;
1450 }
1451
1452 dup->set_name(p_new_name);
1453 n2->get_parent()->add_child(dup);
1454 }
1455}
1456
1457void LiveEditor::_reparent_node_func(const NodePath &p_at, const NodePath &p_new_place, const String &p_new_name, int p_at_pos) {
1458 SceneTree *scene_tree = SceneTree::get_singleton();

Callers 1

Calls 8

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

Tested by

no test coverage detected