[Bf-extensions-cvs] [117b36e1] master: glTF importer: manage antipodal quaternion for node animation

Julien Duroure noreply at git.blender.org
Sun Jan 27 18:27:39 CET 2019


Commit: 117b36e1b5ade3d81dfacbb4da5377ca3aabc92d
Author: Julien Duroure
Date:   Sun Jan 27 18:27:05 2019 +0100
Branches: master
https://developer.blender.org/rBA117b36e1b5ade3d81dfacbb4da5377ca3aabc92d

glTF importer: manage antipodal quaternion for node animation

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

M	io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py

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

diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
index 6a79ac67..0d36fb50 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -98,6 +98,12 @@ class BlenderNodeAnim():
                     else:
                         values = [quaternion_gltf_to_blender(vals) for vals in values]
 
+
+                    # Manage antipodal quaternions
+                    for i in range(1, len(values)):
+                        if values[i].dot(values[i-1]) < 0:
+                            values[i] = -values[i]
+
                 elif channel.target.path == "scale":
                     blender_path = "scale"
                     group_name = "scale"



More information about the Bf-extensions-cvs mailing list