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

Method add_sibling

scene/main/node.cpp:1735–1745  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1733}
1734
1735void Node::add_sibling(Node *p_sibling, bool p_force_readable_name) {
1736 ERR_FAIL_COND_MSG(data.tree && !Thread::is_main_thread(), "Adding a sibling to a node inside the SceneTree is only allowed from the main thread. Use call_deferred(\"add_sibling\",node).");
1737 ERR_FAIL_NULL(p_sibling);
1738 ERR_FAIL_COND_MSG(p_sibling == this, vformat("Can't add sibling '%s' to itself.", p_sibling->get_name())); // adding to itself!
1739 ERR_FAIL_NULL(data.parent);
1740 ERR_FAIL_COND_MSG(data.parent->data.blocked > 0, "Parent node is busy setting up children, `add_sibling()` failed. Consider using `add_sibling.call_deferred(sibling)` instead.");
1741
1742 data.parent->add_child(p_sibling, p_force_readable_name, data.internal_mode);
1743 data.parent->_update_children_cache();
1744 data.parent->_move_child(p_sibling, get_index() + 1);
1745}
1746
1747void Node::remove_child(Node *p_child) {
1748 ERR_FAIL_COND_MSG(data.tree && !Thread::is_main_thread(), "Removing children from a node inside the SceneTree is only allowed from the main thread. Use call_deferred(\"remove_child\",node).");

Callers 5

ScriptTextEditorMethod · 0.80
update_propertyMethod · 0.80
set_propMethod · 0.80
set_key_propMethod · 0.80
test_node.hFile · 0.80

Calls 5

vformatFunction · 0.85
_move_childMethod · 0.80
get_nameMethod · 0.45
add_childMethod · 0.45

Tested by

no test coverage detected