glTF exporter: Armature extports all actions
When scene contains only 1 armature, it will export all actions, not only active + NLA
This commit is contained in:
parent
64f4623585
commit
9818afc829
|
@ -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',
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue