You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Fix the absolute NodePath was calculated incorrectly when "Reparent to New Node"
Since the new parent node has not yet been added to the tree, the `new_base_path` needs to be calculated using the `base_path`.
This commit is contained in:
@@ -1966,7 +1966,6 @@ void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, HashMap<
|
|||||||
base_path.push_back(n->get_name());
|
base_path.push_back(n->get_name());
|
||||||
n = n->get_parent();
|
n = n->get_parent();
|
||||||
}
|
}
|
||||||
base_path.reverse();
|
|
||||||
|
|
||||||
Vector<StringName> new_base_path;
|
Vector<StringName> new_base_path;
|
||||||
if (p_new_parent) {
|
if (p_new_parent) {
|
||||||
@@ -1976,8 +1975,14 @@ void SceneTreeDock::fill_path_renames(Node *p_node, Node *p_new_parent, HashMap<
|
|||||||
n = n->get_parent();
|
n = n->get_parent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For the case Reparent to New Node, the new parent has not yet been added to the tree.
|
||||||
|
if (!p_new_parent->is_inside_tree()) {
|
||||||
|
new_base_path.append_array(base_path);
|
||||||
|
}
|
||||||
|
|
||||||
new_base_path.reverse();
|
new_base_path.reverse();
|
||||||
}
|
}
|
||||||
|
base_path.reverse();
|
||||||
|
|
||||||
_fill_path_renames(base_path, new_base_path, p_node, p_renames);
|
_fill_path_renames(base_path, new_base_path, p_node, p_renames);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ void MeshInstance3D::_resolve_skeleton_path() {
|
|||||||
Ref<SkinReference> new_skin_reference;
|
Ref<SkinReference> new_skin_reference;
|
||||||
|
|
||||||
if (!skeleton_path.is_empty()) {
|
if (!skeleton_path.is_empty()) {
|
||||||
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(get_node(skeleton_path));
|
Skeleton3D *skeleton = Object::cast_to<Skeleton3D>(get_node_or_null(skeleton_path)); // skeleton_path may be outdated when reparenting.
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
if (skin_internal.is_null()) {
|
if (skin_internal.is_null()) {
|
||||||
new_skin_reference = skeleton->register_skin(skeleton->create_skin_from_rest_transforms());
|
new_skin_reference = skeleton->register_skin(skeleton->create_skin_from_rest_transforms());
|
||||||
|
|||||||
Reference in New Issue
Block a user