diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-12-16 13:00:30 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-12-16 13:00:30 -0300 |
commit | 21dec856f2a7482fc69e18ffc60f64e90e10fcc5 (patch) | |
tree | 96b68ebeded4ee9f9a3a9ad400a28a0daf2a2feb | |
parent | 817165b96cd04adb29e4eef797f9dcc6dd9d022f (diff) |
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.
-rw-r--r-- | scene/3d/mesh_instance.cpp | 7 | ||||
-rw-r--r-- | 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 50ca466df3..493806fc78 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<Skeleton>(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<Skin> &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 77ead75dd3..91617341ba 100644 --- a/scene/3d/mesh_instance.h +++ b/scene/3d/mesh_instance.h @@ -43,6 +43,7 @@ class MeshInstance : public GeometryInstance { protected: Ref<Mesh> mesh; Ref<Skin> skin; + Ref<Skin> skin_internal; Ref<SkinReference> skin_ref; NodePath skeleton_path; |