summaryrefslogtreecommitdiff
path: root/modules/gltf
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gltf')
-rw-r--r--modules/gltf/gltf_document.cpp8
-rw-r--r--modules/gltf/register_types.cpp4
2 files changed, 8 insertions, 4 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];
diff --git a/modules/gltf/register_types.cpp b/modules/gltf/register_types.cpp
index 85da4a0dd7..dc995c9249 100644
--- a/modules/gltf/register_types.cpp
+++ b/modules/gltf/register_types.cpp
@@ -60,9 +60,10 @@ static void _editor_init() {
void register_gltf_types() {
#ifndef _3D_DISABLED
#ifdef TOOLS_ENABLED
- ClassDB::register_class<EditorSceneImporterGLTF>();
ClassDB::APIType prev_api = ClassDB::get_current_api();
ClassDB::set_current_api(ClassDB::API_EDITOR);
+ ClassDB::register_class<EditorSceneImporterGLTF>();
+ ClassDB::register_class<GLTFMesh>();
EditorPlugins::add_by_type<SceneExporterGLTFPlugin>();
ClassDB::set_current_api(prev_api);
EditorNode::add_init_callback(_editor_init);
@@ -75,7 +76,6 @@ void register_gltf_types() {
ClassDB::register_class<GLTFTexture>();
ClassDB::register_class<GLTFSkeleton>();
ClassDB::register_class<GLTFSkin>();
- ClassDB::register_class<GLTFMesh>();
ClassDB::register_class<GLTFCamera>();
ClassDB::register_class<GLTFLight>();
ClassDB::register_class<GLTFState>();