From 934277bad2474432d7c7ee98d42c32a74c9cf1f5 Mon Sep 17 00:00:00 2001 From: Fabian Stiewitz Date: Thu, 14 Jan 2021 19:13:47 +0100 Subject: fix gltf not importing files w/o bufferViews or accessors --- modules/gltf/gltf_document.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index 580bc006f5..ebf30b13f2 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -805,7 +805,9 @@ Error GLTFDocument::_encode_buffer_views(Ref state) { } Error GLTFDocument::_parse_buffer_views(Ref 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++) { const Dictionary &d = buffers[i]; @@ -942,7 +944,9 @@ GLTFDocument::GLTFType GLTFDocument::_get_type_from_str(const String &p_string) } Error GLTFDocument::_parse_accessors(Ref 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++) { const Dictionary &d = accessors[i]; -- cgit v1.2.3