Repository: khronosgroup/gltf-blender-io
Issue: Blender 2.8 Beta GLTF Exporter Errors

Trying to export some models and some don't seem to work. In export, i check off everything except for 
General > +Y Up
and
Meshes > UVs and Normals

I would like to export the skinning stuff too, but it can't export just the mesh. I've attached the blend file in a zip file. Its a model of Venom.

[Venom_Final.zip](https://github.com/KhronosGroup/glTF-Blender-IO/files/2722747/Venom_Final.zip)


location: <unknown location>:-1
04:15:36 | INFO: Starting glTF 2.0 export
04:15:36 | INFO: Extracting primitive
04:15:36 | DEBUG: Adding primitive without splitting. Indices: 42 Vertices: 18
04:15:36 | INFO: Primitives created: 1
04:15:36 | INFO: Extracting primitive
04:15:36 | DEBUG: Adding primitive without splitting. Indices: 10404 Vertices: 2754
04:15:36 | INFO: Primitives created: 1
04:15:36 | INFO: Extracting primitive
04:15:37 | DEBUG: Adding primitive without splitting. Indices: 18234 Vertices: 3628
04:15:37 | INFO: Primitives created: 1
04:15:37 | INFO: Extracting primitive
04:15:37 | INFO: Primitives created: 0
Traceback (most recent call last):
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\__init__.py", line 356, in execute
    return gltf2_blender_export.save(context, export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_export.py", line 33, in save
    json, buffer = __export(export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_export.py", line 42, in __export
    __add_root_objects(exporter, export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_export.py", line 57, in __add_root_objects
    scenes, animations = gltf2_blender_gather.gather_gltf2(export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_gather.py", line 35, in gather_gltf2
    animations += __gather_animations(blender_scene, export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_gather.py", line 61, in __gather_animations
    animations += gltf2_blender_gather_animations.gather_animations(blender_object, export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_gather_animations.py", line 37, in gather_animations
    animation = __gather_animation(blender_action, blender_object, export_settings)
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_gather_animations.py", line 48, in __gather_animation
    if not __filter_animation(blender_action, blender_object, export_settings):
  File "C:\\Users\\Pedro\\Desktop\\blender-2.80.0-git.4d795cee4938-windows64\\2.80\\scripts\\addons\\io_scene_gltf2\\blender\\exp\\gltf2_blender_gather_animations.py", line 72, in __filter_animation
    if blender_action.users == 0:
AttributeError: 'NoneType' object has no attribute 'users'

Changed files:
addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py, addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py

diff --git a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
index 63b13393..8cd33c45 100644
--- a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -159,7 +159,8 @@ def __get_blender_actions(blender_object: bpy.types.Object
     if blender_object.type == "MESH" \\
             and blender_object.data is not None \\
             and blender_object.data.shape_keys is not None \\
-            and blender_object.data.shape_keys.animation_data is not None:
+            and blender_object.data.shape_keys.animation_data is not None \\
+            and blender_object.data.shape_keys.animation_data.action is not None:
         blender_actions.append(blender_object.data.shape_keys.animation_data.action)
 
     # Remove duplicate actions.
diff --git a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py
index 42128184..4f5977ca 100644
--- a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py
+++ b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_mesh.py
@@ -18,6 +18,7 @@ from io_scene_gltf2.blender.exp.gltf2_blender_gather_cache import cached
 from io_scene_gltf2.io.com import gltf2_io
 from io_scene_gltf2.blender.exp import gltf2_blender_gather_primitives
 from io_scene_gltf2.blender.exp import gltf2_blender_generate_extras
+from io_scene_gltf2.io.com.gltf2_io_debug import print_console
 
 
 @cached
@@ -38,6 +39,9 @@ def gather_mesh(blender_mesh: bpy.types.Mesh,
         weights=__gather_weights(blender_mesh, vertex_groups, modifiers, export_settings)
     )
 
+    if len(mesh.primitives) == 0:
+        print_console("WARNING", "Mesh '{}' has no primitives and will be omitted.".format(mesh.name))
+        return None
     return mesh