Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2020-10-28 20:28:36 +0300
committerJulien Duroure <julien.duroure@gmail.com>2020-10-28 20:28:36 +0300
commita927d3e1bca8a9d2c5e16932e32866954435cc7b (patch)
tree7763e04052fe3c15b63f585b9f79e6050186994a
parentdf726ecd2bad8cdcdfec57ab0d161fa8ac4ef247 (diff)
glTF importer: Fix T82189 avoid traceback on non valid file with empty primitive tab
-rwxr-xr-xio_scene_gltf2/__init__.py2
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py7
2 files changed, 5 insertions, 4 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 03180b3f..75b5a497 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
- "version": (1, 4, 38),
+ "version": (1, 4, 39),
'blender': (2, 91, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
index 34e979b9..09ec325b 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
@@ -91,9 +91,10 @@ def do_primitives(gltf, mesh_idx, skin_idx, mesh, ob):
num_cols = max(i, num_cols)
num_shapekeys = 0
- for morph_i, _ in enumerate(pymesh.primitives[0].targets or []):
- if pymesh.shapekey_names[morph_i] is not None:
- num_shapekeys += 1
+ if len(pymesh.primitives) > 0: # Empty primitive tab is not allowed, but some invalid files...
+ for morph_i, _ in enumerate(pymesh.primitives[0].targets or []):
+ if pymesh.shapekey_names[morph_i] is not None:
+ num_shapekeys += 1
# -------------
# We'll process all the primitives gathering arrays to feed into the