Skip to content

Commit

Permalink
Merge pull request #45193 from fstiewitz/gltf-without-buffers-4
Browse files Browse the repository at this point in the history
Fix glTF import of scenes without buffers
  • Loading branch information
akien-mga authored Jan 14, 2021
2 parents 70a70a4 + 934277b commit e3b523a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit e3b523a

Please sign in to comment.