glTF exporter: take into account NLA tracks for shapekeys animation

This commit is contained in:
Julien Duroure 2019-08-05 19:16:16 +02:00
parent 19166e3172
commit 7f732e373a
2 changed files with 13 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": (0, 9, 42),
"version": (0, 9, 43),
'blender': (2, 80, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

View File

@ -193,9 +193,18 @@ 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.action is not None:
blender_actions.append(blender_object.data.shape_keys.animation_data.action)
and blender_object.data.shape_keys.animation_data is not None:
if blender_object.data.shape_keys.animation_data.action is not None:
blender_actions.append(blender_object.data.shape_keys.animation_data.action)
for track in blender_object.data.shape_keys.animation_data.nla_tracks:
# Multi-strip tracks do not export correctly yet (they need to be baked),
# so skip them for now and only write single-strip tracks.
if track.strips is None or len(track.strips) != 1:
continue
for strip in track.strips:
blender_actions.append(strip.action)
# Remove duplicate actions.
blender_actions = list(set(blender_actions))