Просмотр исходного кода

Merge pull request #45189 from fstiewitz/gltf-without-buffers

[3.2] Fix glTF import of scenes without buffers
Rémi Verschelde 4 лет назад
Родитель
Сommit
d8ad9b202c
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      editor/import/editor_scene_importer_gltf.cpp

+ 6 - 2
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++) {