glTF exporter: call hook for each action, including the active one

This commit is contained in:
Julien Duroure 2024-06-29 09:16:02 +02:00
parent db5cc08714
commit 77a382ba2f
2 changed files with 33 additions and 1 deletions

@ -5,7 +5,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": (4, 2, 53),
"version": (4, 2, 54),
'blender': (4, 2, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',

@ -337,6 +337,22 @@ def gather_action_animations(obj_uuid: int,
"Animation '{}' could not be exported. Cause: {}".format(
blender_action.name, error))
continue
else:
# No need to switch action, but we call the hook anyway, in case of user extension
export_user_extensions(
'pre_animation_switch_hook',
export_settings,
blender_object,
blender_action,
track_name,
on_type)
export_user_extensions(
'post_animation_switch_hook',
export_settings,
blender_object,
blender_action,
track_name,
on_type)
if on_type == "SHAPEKEY":
if blender_object.data.shape_keys.animation_data.action is None \
@ -359,6 +375,22 @@ def gather_action_animations(obj_uuid: int,
blender_action,
track_name,
on_type)
else:
# No need to switch action, but we call the hook anyway, in case of user extension
export_user_extensions(
'pre_animation_switch_hook',
export_settings,
blender_object,
blender_action,
track_name,
on_type)
export_user_extensions(
'post_animation_switch_hook',
export_settings,
blender_object,
blender_action,
track_name,
on_type)
if export_settings['gltf_force_sampling'] is True:
if export_settings['vtree'].nodes[obj_uuid].blender_object.type == "ARMATURE":