From 21dec856f2a7482fc69e18ffc60f64e90e10fcc5 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Mon, 16 Dec 2019 13:00:30 -0300 Subject: [PATCH] Use an internal skin unless one is supplied by user, fixes #32766 Even though this fixes the issue, the broken Skin resource in the inherited scene mesh will remain, it needs to be erased manually. --- scene/3d/mesh_instance.cpp | 7 ++++--- scene/3d/mesh_instance.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scene/3d/mesh_instance.cpp b/scene/3d/mesh_instance.cpp index 50ca466df3b..493806fc78b 100644 --- a/scene/3d/mesh_instance.cpp +++ b/scene/3d/mesh_instance.cpp @@ -154,10 +154,10 @@ void MeshInstance::_resolve_skeleton_path() { if (!skeleton_path.is_empty()) { Skeleton *skeleton = Object::cast_to(get_node(skeleton_path)); if (skeleton) { - new_skin_reference = skeleton->register_skin(skin); - if (skin.is_null()) { + new_skin_reference = skeleton->register_skin(skin_internal); + if (skin_internal.is_null()) { //a skin was created for us - skin = new_skin_reference->get_skin(); + skin_internal = new_skin_reference->get_skin(); _change_notify(); } } @@ -173,6 +173,7 @@ void MeshInstance::_resolve_skeleton_path() { } void MeshInstance::set_skin(const Ref &p_skin) { + skin_internal = p_skin; skin = p_skin; if (!is_inside_tree()) return; diff --git a/scene/3d/mesh_instance.h b/scene/3d/mesh_instance.h index 77ead75dd30..91617341ba8 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -43,6 +43,7 @@ class MeshInstance : public GeometryInstance { protected: Ref mesh; Ref skin; + Ref skin_internal; Ref skin_ref; NodePath skeleton_path;