[Bf-extensions-cvs] [41699ae8] master: glTF exporter: Bake animation when targeting a quaternion with bezier interpolation

Julien Duroure noreply at git.blender.org
Sat Mar 16 15:56:16 CET 2019


Commit: 41699ae84a7d1f29f4938752c24e61da6c101aa5
Author: Julien Duroure
Date:   Sat Mar 16 15:55:13 2019 +0100
Branches: master
https://developer.blender.org/rBA41699ae84a7d1f29f4938752c24e61da6c101aa5

glTF exporter: Bake animation when targeting a quaternion with bezier interpolation

===================================================================

M	io_scene_gltf2/blender/exp/gltf2_blender_gather_animation_sampler_keyframes.py

===================================================================

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



More information about the Bf-extensions-cvs mailing list