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

This commit is contained in:
Julien Duroure 2019-11-24 10:30:54 +01:00
parent 7003720257
commit a6ce1b121e
2 changed files with 12 additions and 4 deletions

View File

@ -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',

View File

@ -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():