Fix crash when exporting gltf mesh that has no skin.

(cherry picked from commit 209ac9569c4c5180aea4b330ed7f6d2a572d5e82)
This commit is contained in:
jitspoe 2021-11-22 22:44:30 -05:00
parent 3970f28f67
commit 734b4a46bc

View file

@ -6068,7 +6068,10 @@ void GLTFDocument::_convert_mesh_instances(Ref<GLTFState> state) {
int bone_cnt = skeleton->get_bone_count(); int bone_cnt = skeleton->get_bone_count();
ERR_FAIL_COND(bone_cnt != gltf_skeleton->joints.size()); ERR_FAIL_COND(bone_cnt != gltf_skeleton->joints.size());
ObjectID gltf_skin_key = skin->get_instance_id(); ObjectID gltf_skin_key = 0;
if (skin.is_valid()) {
gltf_skin_key = skin->get_instance_id();
}
ObjectID gltf_skel_key = godot_skeleton->get_instance_id(); ObjectID gltf_skel_key = godot_skeleton->get_instance_id();
GLTFSkinIndex skin_gltf_i = -1; GLTFSkinIndex skin_gltf_i = -1;
GLTFNodeIndex root_gltf_i = -1; GLTFNodeIndex root_gltf_i = -1;