| 1733 | } |
| 1734 | |
| 1735 | void 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 | |
| 1747 | void 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)."); |
no test coverage detected