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 /io_scene_gltf2/blender/imp/gltf2_blender_mesh.py
parentdf726ecd2bad8cdcdfec57ab0d161fa8ac4ef247 (diff)
glTF importer: Fix T82189 avoid traceback on non valid file with empty primitive tab
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_mesh.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_mesh.py7
1 files changed, 4 insertions, 3 deletions
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