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>2019-09-18 01:35:40 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-09-18 01:35:40 +0300
commit812cb318c4e0d3f744777bef3744041b5f7c995f (patch)
treec921d2262aabdc63b72e62a6fd3d10b7876a25e6 /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
parentcf2bb9e1256441c6148be79273da6f2116e63018 (diff)
glTF exporter: fix sample animation export when sampled is forced by context, not by user
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py')
-rwxr-xr-xio_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
index b2d69ae9..1ac3600e 100755
--- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
+++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_channels.py
@@ -31,24 +31,27 @@ def gather_animation_channels(blender_action: bpy.types.Action,
) -> typing.List[gltf2_io.AnimationChannel]:
channels = []
+
+ # First calculate range of animation for baking
+ # This is need if user set 'Force sampling' and in case we need to bake
+ bake_range_start = None
+ bake_range_end = None
+ groups = __get_channel_groups(blender_action, blender_object, export_settings)
+ for chans in groups:
+ ranges = [channel.range() for channel in chans]
+ if bake_range_start is None:
+ bake_range_start = min([channel.range()[0] for channel in chans])
+ else:
+ bake_range_start = min(bake_range_start, min([channel.range()[0] for channel in chans]))
+ if bake_range_end is None:
+ bake_range_end = max([channel.range()[1] for channel in chans])
+ else:
+ bake_range_end = max(bake_range_end, max([channel.range()[1] for channel in chans]))
+
+
if blender_object.type == "ARMATURE" and export_settings['gltf_force_sampling'] is True:
# We have to store sampled animation data for every deformation bones
- # First calculate range of animation for baking
- bake_range_start = None
- bake_range_end = None
- groups = __get_channel_groups(blender_action, blender_object, export_settings)
- for chans in groups:
- ranges = [channel.range() for channel in chans]
- if bake_range_start is None:
- bake_range_start = min([channel.range()[0] for channel in chans])
- else:
- bake_range_start = min(bake_range_start, min([channel.range()[0] for channel in chans]))
- if bake_range_end is None:
- bake_range_end = max([channel.range()[1] for channel in chans])
- else:
- bake_range_end = max(bake_range_end, max([channel.range()[1] for channel in chans]))
-
# Then bake all bones
for bone in blender_object.data.bones:
for p in ["location", "rotation_quaternion", "scale"]:
@@ -65,7 +68,7 @@ def gather_animation_channels(blender_action: bpy.types.Action,
else:
for channel_group in __get_channel_groups(blender_action, blender_object, export_settings):
channel_group_sorted = __get_channel_group_sorted(channel_group, blender_object)
- channel = __gather_animation_channel(channel_group_sorted, blender_object, export_settings, None, None, None, None, blender_action.name)
+ channel = __gather_animation_channel(channel_group_sorted, blender_object, export_settings, None, None, bake_range_start, bake_range_end, blender_action.name)
if channel is not None:
channels.append(channel)