[Bf-extensions-cvs] [f4128711] master: Fix T69358: Missing Quaternions interpolqtion in importer.

Bastien Montagne noreply at git.blender.org
Mon Sep 2 11:16:59 CEST 2019


Commit: f4128711758e92a755001e51a88d3d4f67100974
Author: Bastien Montagne
Date:   Mon Sep 2 11:15:24 2019 +0200
Branches: master
https://developer.blender.org/rBAf4128711758e92a755001e51a88d3d4f67100974

Fix T69358: Missing Quaternions interpolqtion in importer.

Based on investigation and patch by Yannick (@kschoice), many thanks!

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

M	io_scene_fbx/__init__.py
M	io_scene_fbx/import_fbx.py

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

diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index ebbf2a19..bf25261c 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (4, 15, 0),
+    "version": (4, 15, 1),
     "blender": (2, 80, 0),
     "location": "File > Import-Export",
     "description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index 90c27e5b..c63cc0db 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -649,7 +649,9 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
             bl_obj = item.bl_obj
 
         transform_data = item.fbx_transform_data
-        rot_prev = bl_obj.rotation_euler.copy()
+        rot_eul_prev = bl_obj.rotation_euler.copy()
+        rot_quat_prev = bl_obj.rotation_quaternion.copy()
+
 
         # Pre-compute inverted local rest matrix of the bone, if relevant.
         restmat_inv = item.get_bind_matrix().inverted_safe() if item.is_bone else None
@@ -683,13 +685,15 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset):
             # Now we have a virtual matrix of transform from AnimCurves, we can insert keyframes!
             loc, rot, sca = mat.decompose()
             if rot_mode == 'QUATERNION':
-                pass  # nothing to do!
+                if rot_quat_prev.dot(rot) < 0.0:
+                    rot = -rot
+                rot_quat_prev = rot
             elif rot_mode == 'AXIS_ANGLE':
                 vec, ang = rot.to_axis_angle()
                 rot = ang, vec.x, vec.y, vec.z
             else:  # Euler
-                rot = rot.to_euler(rot_mode, rot_prev)
-                rot_prev = rot
+                rot = rot.to_euler(rot_mode, rot_eul_prev)
+                rot_eul_prev = rot
             for fc, value in zip(blen_curves, chain(loc, rot, sca)):
                 fc.keyframe_points.insert(frame, value, options={'NEEDED', 'FAST'}).interpolation = 'LINEAR'



More information about the Bf-extensions-cvs mailing list