[Bf-extensions-cvs] [334ca375] master: glTF exporter: export action custom props as animation extras
Julien Duroure
noreply at git.blender.org
Sat Oct 12 17:44:31 CEST 2019
Commit: 334ca375b5e67d668c5413e1ca432a4fc23274e1
Author: Julien Duroure
Date: Sat Oct 12 17:43:57 2019 +0200
Branches: master
https://developer.blender.org/rBA334ca375b5e67d668c5413e1ca432a4fc23274e1
glTF exporter: export action custom props as animation extras
===================================================================
M io_scene_gltf2/__init__.py
M io_scene_gltf2/blender/exp/gltf2_blender_gather.py
M io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
===================================================================
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index faade612..15908f68 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -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": (1, 0, 7),
+ "version": (1, 0, 8),
'blender': (2, 81, 6),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather.py
index 80e0c3b2..f4fd70dd 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather.py
@@ -97,6 +97,14 @@ def __gather_animations(blender_scene, export_settings):
to_delete_idx.append(anim_idx)
+ # Merging extras
+ # Warning, some values can be overwritten if present in multiple merged animations
+ if animations[anim_idx].extras is not None:
+ for k in animations[anim_idx].extras.keys():
+ if animations[base_animation_idx].extras is None:
+ animations[base_animation_idx].extras = {}
+ animations[base_animation_idx].extras[k] = animations[anim_idx].extras[k]
+
offset_sampler = len(animations[base_animation_idx].samplers)
for sampler in animations[anim_idx].samplers:
animations[base_animation_idx].samplers.append(sampler)
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 de205913..d55c20b1 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animations.py
@@ -18,6 +18,7 @@ import typing
from io_scene_gltf2.io.com import gltf2_io
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
def gather_animations(blender_object: bpy.types.Object,
@@ -139,6 +140,9 @@ def __gather_extras(blender_action: bpy.types.Action,
blender_object: bpy.types.Object,
export_settings
) -> typing.Any:
+
+ if export_settings['gltf_extras']:
+ return generate_extras(blender_action)
return None
More information about the Bf-extensions-cvs
mailing list