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:
Diffstat (limited to 'io_scene_gltf2/blender/imp/gltf2_blender_node.py')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_node.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_node.py
index 041bf1eb..8e0d7cbb 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_node.py
@@ -184,6 +184,10 @@ class BlenderNode():
@staticmethod
def create_mesh_object(gltf, vnode):
pynode = gltf.data.nodes[vnode.mesh_node_idx]
+ if not (0 <= pynode.mesh < len(gltf.data.meshes)):
+ # Avoid traceback for invalid gltf file: invalid reference to meshes array
+ # So return an empty blender object)
+ return bpy.data.objects.new(vnode.name or mesh.name, None)
pymesh = gltf.data.meshes[pynode.mesh]
# Key to cache the Blender mesh by.