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

Method _reparent_node_func

scene/debugger/scene_debugger.cpp:1457–1498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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();
1459 if (!scene_tree) {
1460 return;
1461 }
1462
1463 Node *base = nullptr;
1464 if (scene_tree->root->has_node(live_edit_root)) {
1465 base = scene_tree->root->get_node(live_edit_root);
1466 }
1467
1468 HashMap<String, HashSet<Node *>>::Iterator E = live_scene_edit_cache.find(live_edit_scene);
1469 if (!E) {
1470 return; //scene not editable
1471 }
1472
1473 for (Node *F : E->value) {
1474 Node *n = F;
1475
1476 if (base && !base->is_ancestor_of(n)) {
1477 continue;
1478 }
1479
1480 if (!n->has_node(p_at)) {
1481 continue;
1482 }
1483 Node *nfrom = n->get_node(p_at);
1484
1485 if (!n->has_node(p_new_place)) {
1486 continue;
1487 }
1488 Node *nto = n->get_node(p_new_place);
1489
1490 nfrom->get_parent()->remove_child(nfrom);
1491 nfrom->set_name(p_new_name);
1492
1493 nto->add_child(nfrom);
1494 if (p_at_pos >= 0) {
1495 nto->move_child(nfrom, p_at_pos);
1496 }
1497 }
1498}
1499
1500/// RuntimeNodeSelect
1501RuntimeNodeSelect *RuntimeNodeSelect::get_singleton() {

Callers 1

Calls 9

is_ancestor_ofMethod · 0.80
move_childMethod · 0.80
has_nodeMethod · 0.45
get_nodeMethod · 0.45
findMethod · 0.45
remove_childMethod · 0.45
get_parentMethod · 0.45
set_nameMethod · 0.45
add_childMethod · 0.45

Tested by

no test coverage detected