diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2022-06-25 07:45:38 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2022-06-25 07:45:38 +0300 |
commit | 501c97628f1597bab7571951fc090771b88c824f (patch) | |
tree | a4975e878b138da56164ecf9f08a1212d5b9105b /io_scene_gltf2 | |
parent | a2650c0158eeb6488e21204887c98d376d881f72 (diff) |
glTF exporter: Allow custom name for merged animation
Diffstat (limited to 'io_scene_gltf2')
-rwxr-xr-x | io_scene_gltf2/__init__.py | 13 | ||||
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather.py | 7 |
2 files changed, 17 insertions, 3 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index e9e6660e..616ba2f2 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, 3, 6), + "version": (3, 3, 7), 'blender': (3, 3, 0), 'location': 'File > Import-Export', 'description': 'Import-Export as glTF 2.0', @@ -372,6 +372,14 @@ class ExportGLTF2_Base: default=True ) + export_nla_strips_merged_animation_name: StringProperty( + name='Merged Animation Name', + description=( + "Name of single glTF animation to be exported" + ), + default='Animation' + ) + export_def_bones: BoolProperty( name='Export Deformation Bones Only', description='Export Deformation bones only (and needed bones for hierarchy)', @@ -568,6 +576,7 @@ class ExportGLTF2_Base: else: export_settings['gltf_def_bones'] = False export_settings['gltf_nla_strips'] = self.export_nla_strips + export_settings['gltf_nla_strips_merged_animation_name'] = self.export_nla_strips_merged_animation_name export_settings['gltf_optimize_animation'] = self.optimize_animation_size else: export_settings['gltf_frame_range'] = False @@ -863,6 +872,8 @@ class GLTF_PT_export_animation_export(bpy.types.Panel): layout.prop(operator, 'export_frame_step') layout.prop(operator, 'export_force_sampling') layout.prop(operator, 'export_nla_strips') + if operator.export_nla_strips is False: + layout.prop(operator, 'export_nla_strips_merged_animation_name') layout.prop(operator, 'optimize_animation_size') row = layout.row() diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather.py index 6153bc33..4eb8baed 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather.py @@ -94,9 +94,12 @@ def __gather_animations(blender_scene, export_settings): if export_settings['gltf_nla_strips'] is False: # Fake an animation with all animations of the scene merged_tracks = {} - merged_tracks['Animation'] = [] + merged_tracks_name = 'Animation' + if(len(export_settings['gltf_nla_strips_merged_animation_name']) > 0): + merged_tracks_name = export_settings['gltf_nla_strips_merged_animation_name'] + merged_tracks[merged_tracks_name] = [] for idx, animation in enumerate(animations): - merged_tracks['Animation'].append(idx) + merged_tracks[merged_tracks_name].append(idx) to_delete_idx = [] |