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.
This commit is contained in:
Juan Linietsky 2019-12-16 13:00:30 -03:00
parent 817165b96c
commit 21dec856f2
2 changed files with 5 additions and 3 deletions

View file

@ -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;

View file

@ -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;