|
@@ -227,10 +227,6 @@ void Node::_notification(int p_notification) {
|
|
|
GDVIRTUAL_CALL(_ready);
|
|
|
} break;
|
|
|
|
|
|
- case NOTIFICATION_POSTINITIALIZE: {
|
|
|
- data.in_constructor = false;
|
|
|
- } break;
|
|
|
-
|
|
|
case NOTIFICATION_PREDELETE: {
|
|
|
if (data.inside_tree && !Thread::is_main_thread()) {
|
|
|
cancel_free();
|
|
@@ -1640,8 +1636,6 @@ void Node::_add_child_nocheck(Node *p_child, const StringName &p_name, InternalM
|
|
|
}
|
|
|
|
|
|
/* Notify */
|
|
|
- //recognize children created in this node constructor
|
|
|
- p_child->data.parent_owned = data.in_constructor;
|
|
|
add_child_notify(p_child);
|
|
|
notification(NOTIFICATION_CHILD_ORDER_CHANGED);
|
|
|
emit_signal(SNAME("child_order_changed"));
|
|
@@ -2795,12 +2789,8 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
|
|
instance_roots.push_back(this);
|
|
|
|
|
|
for (List<const Node *>::Element *N = node_tree.front(); N; N = N->next()) {
|
|
|
- for (int i = 0; i < N->get()->get_child_count(); ++i) {
|
|
|
- Node *descendant = N->get()->get_child(i);
|
|
|
-
|
|
|
- if (!descendant->get_owner()) {
|
|
|
- continue; // Internal nodes or nodes added by scripts.
|
|
|
- }
|
|
|
+ for (int i = 0; i < N->get()->get_child_count(false); ++i) {
|
|
|
+ Node *descendant = N->get()->get_child(i, false);
|
|
|
|
|
|
// Skip nodes not really belonging to the instantiated hierarchy; they'll be processed normally later
|
|
|
// but remember non-instantiated nodes that are hidden below instantiated ones
|
|
@@ -2844,10 +2834,7 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < get_child_count(); i++) {
|
|
|
- if (get_child(i)->data.parent_owned) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ for (int i = 0; i < get_child_count(false); i++) {
|
|
|
if (instantiated && get_child(i)->data.owner == this) {
|
|
|
continue; //part of instance
|
|
|
}
|
|
@@ -3041,10 +3028,10 @@ void Node::_duplicate_properties(const Node *p_root, const Node *p_original, Nod
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for (int i = 0; i < p_original->get_child_count(); i++) {
|
|
|
- Node *copy_child = p_copy->get_child(i);
|
|
|
+ for (int i = 0; i < p_original->get_child_count(false); i++) {
|
|
|
+ Node *copy_child = p_copy->get_child(i, false);
|
|
|
ERR_FAIL_NULL_MSG(copy_child, "Child node disappeared while duplicating.");
|
|
|
- _duplicate_properties(p_root, p_original->get_child(i), copy_child, p_flags);
|
|
|
+ _duplicate_properties(p_root, p_original->get_child(i, false), copy_child, p_flags);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3161,8 +3148,8 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) {
|
|
|
while (get_child_count()) {
|
|
|
Node *child = get_child(0);
|
|
|
remove_child(child);
|
|
|
- if (!child->is_owned_by_parent()) {
|
|
|
- // add the custom children to the p_node
|
|
|
+ if (!child->is_internal()) {
|
|
|
+ // Add the custom children to the p_node.
|
|
|
Node *child_owner = child->get_owner() == this ? p_node : child->get_owner();
|
|
|
child->set_owner(nullptr);
|
|
|
p_node->add_child(child);
|
|
@@ -3440,10 +3427,6 @@ void Node::update_configuration_warnings() {
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-bool Node::is_owned_by_parent() const {
|
|
|
- return data.parent_owned;
|
|
|
-}
|
|
|
-
|
|
|
void Node::set_display_folded(bool p_folded) {
|
|
|
ERR_THREAD_GUARD
|
|
|
data.display_folded = p_folded;
|
|
@@ -3953,8 +3936,6 @@ Node::Node() {
|
|
|
data.physics_interpolated_client_side = false;
|
|
|
data.use_identity_transform = false;
|
|
|
|
|
|
- data.parent_owned = false;
|
|
|
- data.in_constructor = true;
|
|
|
data.use_placeholder = false;
|
|
|
|
|
|
data.display_folded = false;
|