glTF exporter: fix crash when trying to export some muted driver(s)

This commit is contained in:
Julien Duroure 2021-08-23 19:08:27 +02:00
parent 060d0e76fb
commit 902b8ba11e
2 changed files with 6 additions and 2 deletions

View File

@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (1, 7, 19),
"version": (1, 7, 20),
'blender': (2, 91, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -56,6 +56,9 @@ def get_sk_drivers(blender_armature):
sk_name = child.data.shape_keys.path_resolve(get_target_object_path(sk_c.data_path)).name
except:
continue
# Do not take into account this driver if corresponding SK is disabled
if child.data.shape_keys.key_blocks[sk_name].mute is True:
continue
idx = shapekeys_idx[sk_name]
idx_channel_mapping.append((shapekeys_idx[sk_name], sk_c))
existing_idx = dict(idx_channel_mapping)
@ -65,7 +68,8 @@ def get_sk_drivers(blender_armature):
else:
all_sorted_channels.append(existing_idx[i])
drivers.append((child, tuple(all_sorted_channels)))
if len(all_sorted_channels) > 0:
drivers.append((child, tuple(all_sorted_channels)))
return tuple(drivers)