From ba81e8ca09e28743d984c09b74398f5bd2b4d928 Mon Sep 17 00:00:00 2001 From: Fabian Stiewitz Date: Thu, 14 Jan 2021 00:14:55 +0100 Subject: [PATCH] fix gltf not importing files w/o bufferViews or accessors --- editor/import/editor_scene_importer_gltf.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp index 55ee6c6c31f..5d33cf4a6fa 100644 --- a/editor/import/editor_scene_importer_gltf.cpp +++ b/editor/import/editor_scene_importer_gltf.cpp @@ -425,7 +425,9 @@ Error EditorSceneImporterGLTF::_parse_buffers(GLTFState &state, const String &p_ Error EditorSceneImporterGLTF::_parse_buffer_views(GLTFState &state) { - ERR_FAIL_COND_V(!state.json.has("bufferViews"), ERR_FILE_CORRUPT); + if (!state.json.has("bufferViews")) + return OK; + const Array &buffers = state.json["bufferViews"]; for (GLTFBufferViewIndex i = 0; i < buffers.size(); i++) { @@ -483,7 +485,9 @@ EditorSceneImporterGLTF::GLTFType EditorSceneImporterGLTF::_get_type_from_str(co Error EditorSceneImporterGLTF::_parse_accessors(GLTFState &state) { - ERR_FAIL_COND_V(!state.json.has("accessors"), ERR_FILE_CORRUPT); + if (!state.json.has("accessors")) + return OK; + const Array &accessors = state.json["accessors"]; for (GLTFAccessorIndex i = 0; i < accessors.size(); i++) {