Merge pull request #45193 from fstiewitz/gltf-without-buffers-4

Fix glTF import of scenes without buffers
This commit is contained in:
Rémi Verschelde 2021-01-14 19:48:53 +01:00 committed by GitHub
commit e3b523a088
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -805,7 +805,9 @@ Error GLTFDocument::_encode_buffer_views(Ref<GLTFState> state) {
} }
Error GLTFDocument::_parse_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"]; const Array &buffers = state->json["bufferViews"];
for (GLTFBufferViewIndex i = 0; i < buffers.size(); i++) { for (GLTFBufferViewIndex i = 0; i < buffers.size(); i++) {
const Dictionary &d = buffers[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) { 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"]; const Array &accessors = state->json["accessors"];
for (GLTFAccessorIndex i = 0; i < accessors.size(); i++) { for (GLTFAccessorIndex i = 0; i < accessors.size(); i++) {
const Dictionary &d = accessors[i]; const Dictionary &d = accessors[i];