diff options
author | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:43 +0300 |
---|---|---|
committer | Peter Kim <pk15950@gmail.com> | 2022-09-08 07:00:43 +0300 |
commit | e83f88c951e26b01893acee4f24b40a46062a41c (patch) | |
tree | 09f60bf7d4fc2ae1ef50668823e416fc675b252e /io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py | |
parent | ec84e3294593e2e26475f18c81e847bf00dc201e (diff) | |
parent | 0cd92169d40ae1c7e103ff269e850eaf1b901646 (diff) |
Merge branch 'master' into xr-devxr-dev
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py index 1ee98a29..5c8011ed 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_samplers.py @@ -414,6 +414,7 @@ def __gather_output(channels: typing.Tuple[bpy.types.FCurve], transform = parent_inverse values = [] + fps = bpy.context.scene.render.fps for keyframe in keyframes: # Transform the data and build gltf control points value = gltf2_blender_math.transform(keyframe.value, target_datapath, transform, need_rotation_correction) @@ -426,11 +427,11 @@ def __gather_output(channels: typing.Tuple[bpy.types.FCurve], in_tangent = gltf2_blender_math.transform(keyframe.in_tangent, target_datapath, transform, need_rotation_correction) if is_yup and blender_object_if_armature is None: in_tangent = gltf2_blender_math.swizzle_yup(in_tangent, target_datapath) - # the tangent in glTF is relative to the keyframe value + # the tangent in glTF is relative to the keyframe value and uses seconds if not isinstance(value, list): - in_tangent = value - in_tangent + in_tangent = fps * (in_tangent - value) else: - in_tangent = [value[i] - in_tangent[i] for i in range(len(value))] + in_tangent = [fps * (in_tangent[i] - value[i]) for i in range(len(value))] keyframe_value = gltf2_blender_math.mathutils_to_gltf(in_tangent) + keyframe_value # append if keyframe.out_tangent is not None: @@ -438,11 +439,11 @@ def __gather_output(channels: typing.Tuple[bpy.types.FCurve], out_tangent = gltf2_blender_math.transform(keyframe.out_tangent, target_datapath, transform, need_rotation_correction) if is_yup and blender_object_if_armature is None: out_tangent = gltf2_blender_math.swizzle_yup(out_tangent, target_datapath) - # the tangent in glTF is relative to the keyframe value + # the tangent in glTF is relative to the keyframe value and uses seconds if not isinstance(value, list): - out_tangent = value - out_tangent + out_tangent = fps * (out_tangent - value) else: - out_tangent = [value[i] - out_tangent[i] for i in range(len(value))] + out_tangent = [fps * (out_tangent[i] - value[i]) for i in range(len(value))] keyframe_value = keyframe_value + gltf2_blender_math.mathutils_to_gltf(out_tangent) # append values += keyframe_value |