[Bf-extensions-cvs] [bb1d6eda] master: glTF importer: fix bug importing file with no mesh / bug with faceless primitives

Julien Duroure noreply at git.blender.org
Wed Oct 2 05:18:14 CEST 2019


Commit: bb1d6edaa65191f79ddd0fc425540758eb93cab0
Author: Julien Duroure
Date:   Wed Oct 2 05:17:24 2019 +0200
Branches: master
https://developer.blender.org/rBAbb1d6edaa65191f79ddd0fc425540758eb93cab0

glTF importer: fix bug importing file with no mesh / bug with faceless primitives

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
M	io_scene_gltf2/blender/imp/gltf2_blender_primitive.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 7b53aa41..749a0b0b 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, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (0, 9, 80),
+    "version": (0, 9, 81),
     'blender': (2, 81, 6),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
index 1bccf9a2..6d2181fc 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
@@ -278,7 +278,7 @@ class BlenderGlTF():
                 mesh.is_weight_animated = False
 
         # Calculate names for each mesh's shapekeys
-        for mesh in gltf.data.meshes:
+        for mesh in gltf.data.meshes or []:
             mesh.shapekey_names = []
             used_names = set()
 
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py b/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py
index dcdd0ac8..8ebee354 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_primitive.py
@@ -81,7 +81,7 @@ class BlenderPrimitive():
         bme_verts.ensure_lookup_table()
 
         # Add edges/faces to bmesh
-        mode = pyprimitive.mode or 4
+        mode = 4 if pyprimitive.mode is None else pyprimitive.mode
         edges, faces = BlenderPrimitive.edges_and_faces(mode, indices)
         # NOTE: edges and vertices are in terms of pidxs!
         for edge in edges:



More information about the Bf-extensions-cvs mailing list