diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-02 12:15:24 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-02 12:15:24 +0300 |
commit | f4128711758e92a755001e51a88d3d4f67100974 (patch) | |
tree | d6660ea8982e703f356724fcb3c56912d673e0e5 | |
parent | 8d11c9e82893e231b2abc093d815deb79866e03b (diff) |
Fix T69358: Missing Quaternions interpolqtion in importer.
Based on investigation and patch by Yannick (@kschoice), many thanks!
-rw-r--r-- | io_scene_fbx/__init__.py | 2 | ||||
-rw-r--r-- | io_scene_fbx/import_fbx.py | 12 |
2 files changed, 9 insertions, 5 deletions
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' |