From e4d0d1344b68796cba86a6c60be1275316748116 Mon Sep 17 00:00:00 2001 From: warriormaster12 Date: Sun, 2 Jun 2024 13:27:35 +0300 Subject: [PATCH] Duplicate properties first before remapping resources --- scene/main/node.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 884fc6de074..e9e40a222e1 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -2771,12 +2771,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; } @@ -2789,6 +2789,8 @@ Node *Node::duplicate_from_editor(HashMap &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); @@ -2799,8 +2801,6 @@ Node *Node::duplicate_from_editor(HashMap &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; }