Merge pull request #92678 from warriormaster12/dup_prop_before_remap_resources

Duplicate properties first before remapping resources
This commit is contained in:
Rémi Verschelde 2024-06-18 14:08:39 +02:00
commit 0ec023f101
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -2777,12 +2777,12 @@ Node *Node::duplicate(int p_flags) const {
ERR_THREAD_GUARD_V(nullptr);
Node *dupe = _duplicate(p_flags);
_duplicate_properties(this, this, dupe, p_flags);
if (dupe && (p_flags & DUPLICATE_SIGNALS)) {
_duplicate_signals(this, dupe);
}
_duplicate_properties(this, this, dupe, p_flags);
return dupe;
}
@ -2795,6 +2795,8 @@ Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, con
int flags = DUPLICATE_SIGNALS | DUPLICATE_GROUPS | DUPLICATE_SCRIPTS | DUPLICATE_USE_INSTANTIATION | DUPLICATE_FROM_EDITOR;
Node *dupe = _duplicate(flags, &r_duplimap);
_duplicate_properties(this, this, dupe, flags);
// This is used by SceneTreeDock's paste functionality. When pasting to foreign scene, resources are duplicated.
if (!p_resource_remap.is_empty()) {
remap_node_resources(dupe, p_resource_remap);
@ -2805,8 +2807,6 @@ Node *Node::duplicate_from_editor(HashMap<const Node *, Node *> &r_duplimap, con
// if the emitter node comes later in tree order than the receiver
_duplicate_signals(this, dupe);
_duplicate_properties(this, this, dupe, flags);
return dupe;
}