[Bf-extensions-cvs] [22214fda] master: glTF importer: Fix some antipodal issue in bone rotation
Julien Duroure
noreply at git.blender.org
Fri Feb 1 19:42:01 CET 2019
Commit: 22214fda573811ec0a083396174fb56dbf28de1c
Author: Julien Duroure
Date: Fri Feb 1 19:41:26 2019 +0100
Branches: master
https://developer.blender.org/rBA22214fda573811ec0a083396174fb56dbf28de1c
glTF importer: Fix some antipodal issue in bone rotation
===================================================================
M io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
===================================================================
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
index bdafae5e..e05f1f64 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
@@ -100,12 +100,20 @@ class BlenderBoneAnim():
if animation.samplers[channel.sampler].interpolation == "CUBICSPLINE":
# TODO manage tangent?
- quat_keyframes = (
+ quat_keyframes = [
quaternion_gltf_to_blender(values[idx * 3 + 1])
for idx in range(0, len(keys))
- )
+ ]
else:
- quat_keyframes = (quaternion_gltf_to_blender(vals) for vals in values)
+ quat_keyframes = [quaternion_gltf_to_blender(vals) for vals in values]
+
+ # Manage antipodal quaternions
+ # (but is not suffisant, we also convert quaternion --> euler --> quaternion)
+ for i in range(1, len(quat_keyframes)):
+ if quat_keyframes[i].dot(quat_keyframes[i-1]) < 0:
+ quat_keyframes[i] = -quat_keyframes[i]
+
+
if not node.parent:
final_rots = [
bind_rotation.inverted() @ quat_keyframe
More information about the Bf-extensions-cvs
mailing list