diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-03-16 17:55:13 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-03-16 17:55:13 +0300 |
commit | 41699ae84a7d1f29f4938752c24e61da6c101aa5 (patch) | |
tree | fc3556ea595e09cc2f72a2d5361a259a1807b0b5 | |
parent | d3dd36adfe100c6b687e88d87e1777baf98396e3 (diff) |
glTF exporter: Bake animation when targeting a quaternion with bezier interpolation
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py index 351a036a..4ec68c88 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py @@ -160,10 +160,11 @@ def needs_baking(channels: typing.Tuple[bpy.types.FCurve], def all_equal(lst): return lst[1:] == lst[:-1] - + # Sampling is forced if export_settings[gltf2_blender_export_keys.FORCE_SAMPLING]: return True + # Sampling due to unsupported interpolation interpolation = channels[0].keyframe_points[0].interpolation if interpolation not in ["BEZIER", "LINEAR", "CONSTANT"]: gltf2_io_debug.print_console("WARNING", @@ -175,7 +176,7 @@ def needs_baking(channels: typing.Tuple[bpy.types.FCurve], if any(any(k.interpolation != interpolation for k in c.keyframe_points) for c in channels): # There are different interpolation methods in one action group gltf2_io_debug.print_console("WARNING", - "Baking animation because there are different " + "Baking animation because there are keyframes with different " "interpolation methods in one channel" ) return True @@ -196,5 +197,11 @@ def needs_baking(channels: typing.Tuple[bpy.types.FCurve], "Baking animation because of differently located keyframes in one channel") return True + # Baking is required when the animation targets a quaternion with bezier interpolation + if channels[0].data_path == "rotation_quaternion" and interpolation == "BEZIER": + gltf2_io_debug.print_console("WARNING", + "Baking animation because targeting a quaternion with bezier interpolation") + return True + return False |