summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-01-14 19:48:53 +0100
committerGitHub <noreply@github.com>2021-01-14 19:48:53 +0100
commite3b523a0887be350626b46a08cee87e5b5b3b78b (patch)
tree8fdb008d6877b86d120605652c7c7c2d352d8913 /modules
parent70a70a4f2be376a26536d3829e0236dad7b143f9 (diff)
parent934277bad2474432d7c7ee98d42c32a74c9cf1f5 (diff)
Merge pull request #45193 from fstiewitz/gltf-without-buffers-4
Fix glTF import of scenes without buffers
Diffstat (limited to 'modules')
-rw-r--r--modules/gltf/gltf_document.cpp8
1 files changed, 6 insertions, 2 deletions
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<GLTFState> state) {
}
Error GLTFDocument::_parse_buffer_views(Ref<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++) {
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<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++) {
const Dictionary &d = accessors[i];