[Bf-extensions-cvs] [a6ce1b12] master: glTF exporter: more general checks for armature action linked to mesh objects

Julien Duroure noreply at git.blender.org
Sun Nov 24 10:31:26 CET 2019


Commit: a6ce1b121eb708f9c4cbfe64a651e058824e0147
Author: Julien Duroure
Date:   Sun Nov 24 10:30:54 2019 +0100
Branches: master
https://developer.blender.org/rBAa6ce1b121eb708f9c4cbfe64a651e058824e0147

glTF exporter: more general checks for armature action linked to mesh objects

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 0c215977..3b72e89d 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": (1, 1, 14),
+    "version": (1, 1, 15),
     'blender': (2, 81, 6),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
index 81a528cf..d217b217 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
@@ -81,6 +81,9 @@ def gather_animation_channels(blender_action: bpy.types.Action,
     else:
         for channel_group in __get_channel_groups(blender_action, blender_object, export_settings):
             channel_group_sorted = __get_channel_group_sorted(channel_group, blender_object)
+            if len(channel_group_sorted) == 0:
+                # Only errors on channels, ignoring
+                continue
             channel = __gather_animation_channel(channel_group_sorted, blender_object, export_settings, None, None, bake_range_start, bake_range_end, blender_action.name)
             if channel is not None:
                 channels.append(channel)
@@ -114,9 +117,14 @@ def __get_channel_group_sorted(channels: typing.Tuple[bpy.types.FCurve], blender
             idx_channel_mapping = []
             all_sorted_channels = []
             for sk_c in channels:
-                sk_name = blender_object.data.shape_keys.path_resolve(get_target_object_path(sk_c.data_path)).name
-                idx = shapekeys_idx[sk_name]
-                idx_channel_mapping.append((shapekeys_idx[sk_name], sk_c))
+                try:
+                    sk_name = blender_object.data.shape_keys.path_resolve(get_target_object_path(sk_c.data_path)).name
+                    idx = shapekeys_idx[sk_name]
+                    idx_channel_mapping.append((shapekeys_idx[sk_name], sk_c))
+                except:
+                    # Something is wrong. For example, an armature action linked to a mesh object
+                    continue
+
             existing_idx = dict(idx_channel_mapping)
             for i in range(0, cpt_sk):
                 if i not in existing_idx.keys():



More information about the Bf-extensions-cvs mailing list