diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-01-22 23:49:55 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-01-22 23:49:55 +0300 |
commit | 862b0bbd7d319104e7e5f8ab9576daa97be3298d (patch) | |
tree | 93d65279109d74c5067ea9da815185d3df087c87 /io_scene_gltf2/blender/imp/gltf2_blender_gltf.py | |
parent | 886111e38962e4c556135c3eef94a0611504e57d (diff) |
glTF importer: fix bug when glTF has no scene
In that case, create all nodes in current scene
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_gltf.py')
-rwxr-xr-x | io_scene_gltf2/blender/imp/gltf2_blender_gltf.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py index e4cb65f1..bdf8e7f6 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py @@ -28,8 +28,13 @@ class BlenderGlTF(): bpy.context.scene.render.engine = 'BLENDER_EEVEE' BlenderGlTF.pre_compute(gltf) - for scene_idx, scene in enumerate(gltf.data.scenes): - BlenderScene.create(gltf, scene_idx) + if gltf.data.scenes is not None: + for scene_idx, scene in enumerate(gltf.data.scenes): + BlenderScene.create(gltf, scene_idx) + else: + # special case where there is no scene in glTF file + # generate all objects in current scene + BlenderScene.create(gltf, None) # Armature correction # Try to detect bone chains, and set bone lengths |