1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-16 14:00:40 +00:00

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()) { if (!skeleton_path.is_empty()) {
Skeleton *skeleton = Object::cast_to<Skeleton>(get_node(skeleton_path)); Skeleton *skeleton = Object::cast_to<Skeleton>(get_node(skeleton_path));
if (skeleton) { if (skeleton) {
new_skin_reference = skeleton->register_skin(skin); new_skin_reference = skeleton->register_skin(skin_internal);
if (skin.is_null()) { if (skin_internal.is_null()) {
//a skin was created for us //a skin was created for us
skin = new_skin_reference->get_skin(); skin_internal = new_skin_reference->get_skin();
_change_notify(); _change_notify();
} }
} }
@@ -173,6 +173,7 @@ void MeshInstance::_resolve_skeleton_path() {
} }
void MeshInstance::set_skin(const Ref<Skin> &p_skin) { void MeshInstance::set_skin(const Ref<Skin> &p_skin) {
skin_internal = p_skin;
skin = p_skin; skin = p_skin;
if (!is_inside_tree()) if (!is_inside_tree())
return; return;

View File

@@ -43,6 +43,7 @@ class MeshInstance : public GeometryInstance {
protected: protected:
Ref<Mesh> mesh; Ref<Mesh> mesh;
Ref<Skin> skin; Ref<Skin> skin;
Ref<Skin> skin_internal;
Ref<SkinReference> skin_ref; Ref<SkinReference> skin_ref;
NodePath skeleton_path; NodePath skeleton_path;