From d7e3c22f2414525389c037fd1174e9367109a210 Mon Sep 17 00:00:00 2001 From: Sebastian Sille Date: Sun, 19 May 2024 23:48:26 +0200 Subject: [PATCH] Import_3ds: Added euler compat to rotation keyframes Use euler compat for quaternion to euler conversion --- source/import_3ds.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/import_3ds.py b/source/import_3ds.py index 120d5bd..6a9c51c 100644 --- a/source/import_3ds.py +++ b/source/import_3ds.py @@ -1597,10 +1597,11 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI new_chunk.bytes_read += SZ_4FLOAT keyframe_rotation[nframe] = rotation rad, axis_x, axis_y, axis_z = keyframe_rotation[0] - child.rotation_euler = mathutils.Quaternion((axis_x, axis_y, axis_z), -rad).to_euler() # Why negative? + cpt = matrix_dictionary.get(child.name, child.matrix_world).to_euler() + child.rotation_euler = mathutils.Quaternion((axis_x, axis_y, axis_z), -rad).to_euler('XYZ', cpt) # Why negative? for keydata in keyframe_rotation.items(): rad, axis_x, axis_y, axis_z = keydata[1] - child.rotation_euler = mathutils.Quaternion((axis_x, axis_y, axis_z), -rad).to_euler() + child.rotation_euler = mathutils.Quaternion((axis_x, axis_y, axis_z), -rad).to_euler('XYZ', cpt) if hierarchy == ROOT_OBJECT: child.rotation_euler.rotate(CONVERSE) if not tflags & 0x100: # Flag 0x100 unlinks X axis @@ -1689,7 +1690,8 @@ def process_next_chunk(context, file, previous_chunk, imported_objects, CONSTRAI if child_obj and parent_obj is not None: child_obj.parent = parent_obj - # Assign parents to objects. Check if we need to assign first because doing so recalcs the depsgraph + # Assign parents to objects + # Check if we need to assign first because doing so recalcs the depsgraph parent_dictionary.pop(None, ...) for ind, ob in enumerate(object_list): if ob is None: -- 2.30.2