Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2022-03-29 18:54:13 +0300
committerJulien Duroure <julien.duroure@gmail.com>2022-03-29 18:54:13 +0300
commit9818afc829a06185440c431e520016f1d4286d06 (patch)
tree8065983bbef50f0fc0803411f2c0c3e72600a820
parent64f462358522f914cad4828b3a2e7a4aba900676 (diff)
glTF exporter: Armature extports all actionsscreenshots-manual
When scene contains only 1 armature, it will export all actions, not only active + NLA
-rwxr-xr-xio_scene_gltf2/__init__.py2
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py10
-rw-r--r--io_scene_gltf2/blender/exp/gltf2_blender_gather_tree.py3
3 files changed, 14 insertions, 1 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index d08c39dd..9bb1939f 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 c56517fb..0a513521 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 3a7b0fa5..cf4983e1 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: