diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-05-09 14:50:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-09 14:50:48 +0200 |
commit | 992317957800aa4f309cd561c7ed6c8adb99afa4 (patch) | |
tree | b4a5bec3f353bec3a86f197f5cb0adfb3a829218 /scene | |
parent | a7c69bd95a61fc393033e9b4e000d16ba471bde1 (diff) | |
parent | 2b53826ee6872d48acafb9ece1b9027467d2611d (diff) |
Merge pull request #60893 from KoBeWi/node_rescue
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/packed_scene.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index d649942188..eaf26c5225 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -112,6 +112,7 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { const NodeData &n = nd[i]; Node *parent = nullptr; + String old_parent_path; if (i > 0) { ERR_FAIL_COND_V_MSG(n.parent == -1, nullptr, vformat("Invalid scene: node %s does not specify its parent node.", snames[n.name])); @@ -119,6 +120,8 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { #ifdef DEBUG_ENABLED if (!nparent && (n.parent & FLAG_ID_IS_PATH)) { WARN_PRINT(String("Parent path '" + String(node_paths[n.parent & FLAG_MASK]) + "' for node '" + String(snames[n.name]) + "' has vanished when instancing: '" + get_path() + "'.").ascii().get_data()); + old_parent_path = String(node_paths[n.parent & FLAG_MASK]).trim_prefix("./").replace("/", "@"); + nparent = ret_nodes[0]; } #endif parent = nparent; @@ -332,6 +335,10 @@ Node *SceneState::instantiate(GenEditState p_edit_state) const { } } + if (!old_parent_path.is_empty()) { + node->_set_name_nocheck(old_parent_path + "@" + node->get_name()); + } + if (n.owner >= 0) { NODE_FROM_ID(owner, n.owner); if (owner) { |