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>2019-11-24 12:30:54 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-11-24 12:30:54 +0300
commita6ce1b121eb708f9c4cbfe64a651e058824e0147 (patch)
tree9516a7eea546c35264f2d778f0c1729b369c1f60 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
parent7003720257c96b3ec9ec870e19249ffc27db1caf (diff)
glTF exporter: more general checks for armature action linked to mesh objects
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py14
1 files changed, 11 insertions, 3 deletions
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():