diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index d08c39ddd081721770265a89d107243c476e1dcc..9bb1939f60d87992a1ec9d502200b53731c3abf0 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -4,7 +4,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": (3, 2, 20), + "version": (3, 2, 21), 'blender': (3, 1, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py index c56517fb79a0463931910448d1447e27a732a5a7..0a513521207d3783475b7cd8b6aad5263107b3b0 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py @@ -9,6 +9,7 @@ from io_scene_gltf2.blender.exp import gltf2_blender_gather_animation_channels from io_scene_gltf2.io.com.gltf2_io_debug import print_console from ..com.gltf2_blender_extras import generate_extras from io_scene_gltf2.io.exp.gltf2_io_user_extensions import export_user_extensions +from io_scene_gltf2.blender.exp.gltf2_blender_gather_tree import VExportNode def __gather_channels_baked(obj_uuid, export_settings): @@ -307,6 +308,15 @@ def __get_blender_actions(blender_object: bpy.types.Object, blender_tracks[strip.action.name] = track.name # Always set after possible active action -> None will be overwrite action_on_type[strip.action.name] = "SHAPEKEY" + # If there are only 1 armature, include all animations, even if not in NLA + if blender_object.type == "ARMATURE": + if len(export_settings['vtree'].get_all_node_of_type(VExportNode.ARMATURE)) == 1: + # Keep all actions on objects (no keyframe animation) + # Some other object animation can be added here, and will affect armature object itself :-/ + for act in [a for a in bpy.data.actions if a.id_root == "OBJECT"]: + blender_actions.append(act) + blender_tracks[act.name] = None + export_user_extensions('gather_actions_hook', export_settings, blender_object, blender_actions, blender_tracks, action_on_type) # Remove duplicate actions. diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py index 3a7b0fa5fe9e760aaa31cd3bab296d5d77cbfc5b..cf4983e1c1d670805e816f7b63f9bf16789efeb2 100644 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py @@ -244,6 +244,9 @@ class VExportTree: else: return [] + def get_all_node_of_type(self, node_type): + return [n.uuid for n in self.nodes.values() if n.blender_type == node_type] + def display(self, mode): if mode == "simple": for n in self.roots: