mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 22:23:07 +00:00
gltf: Fail gracefully when a mesh instance fails.
(cherry picked from commit 5a9eee6b1a
)
This commit is contained in:
parent
2ec691e274
commit
997f8f5d29
@ -3176,13 +3176,15 @@ void EditorSceneImporterGLTF::_process_mesh_instances(GLTFState &state, Spatial
|
||||
const GLTFSkinIndex skin_i = node->skin;
|
||||
|
||||
Map<GLTFNodeIndex, Node *>::Element *mi_element = state.scene_nodes.find(node_i);
|
||||
ERR_CONTINUE_MSG(mi_element == nullptr, vformat("Unable to find node %d", node_i));
|
||||
|
||||
MeshInstance *mi = Object::cast_to<MeshInstance>(mi_element->get());
|
||||
ERR_FAIL_COND(mi == nullptr);
|
||||
ERR_CONTINUE_MSG(mi == nullptr, vformat("Unable to cast node %d of type %s to MeshInstance", node_i, mi_element->get()->get_class_name()));
|
||||
|
||||
const GLTFSkeletonIndex skel_i = state.skins[node->skin].skeleton;
|
||||
const GLTFSkeleton &gltf_skeleton = state.skeletons[skel_i];
|
||||
Skeleton *skeleton = gltf_skeleton.godot_skeleton;
|
||||
ERR_FAIL_COND(skeleton == nullptr);
|
||||
ERR_CONTINUE_MSG(skeleton == nullptr, vformat("Unable to find Skeleton for node %d skin %d", node_i, skin_i));
|
||||
|
||||
mi->get_parent()->remove_child(mi);
|
||||
skeleton->add_child(mi);
|
||||
|
Loading…
Reference in New Issue
Block a user