summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/3d/mesh_instance.cpp7
-rw-r--r--scene/3d/mesh_instance.h1
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;