Fix #105217: FBX Force Connect Children transforms Objects parented to Bones #105249

Merged
Thomas Barlow merged 3 commits from Mysteryem/blender-addons:fbx_105217_force_connect_child_objects into main 2024-03-22 13:53:55 +01:00
Member

Force Connect Children can change the length and rotation of imported
bones, which was affecting Objects parented to bones.

This patch updates the correction matrix for child Objects attached to
bones to account for any changes made by forcing children bones to
connect to their parents.

Meshes rigged to bones weren't affected because it was only the rest
pose that was changed.


I rearranged the formula for calculating the correction matrix that was provided in the issue into a form that I find clearer:
$(Translation(bone.tail-bone.head) ⋅ bone.matrix)^{-1} ⋅ bone_matrix$
$= bone.matrix^{-1} ⋅ (Translation(bone.tail-bone.head))^{-1} ⋅ bone_matrix$
= bone.matrix^{-1} ⋅ Translation(bone.head-bone.tail) ⋅ bone\_matrix

$(T(tail-head) ⋅ A)^{-1} ⋅ B$
$= A^{-1} ⋅ (T(tail-head))^{-1} ⋅ B$
= A^{-1} ⋅ T(head-tail) ⋅ B

Force Connect Children can change the length and rotation of imported bones, which was affecting Objects parented to bones. This patch updates the correction matrix for child Objects attached to bones to account for any changes made by forcing children bones to connect to their parents. Meshes rigged to bones weren't affected because it was only the rest pose that was changed. --- I rearranged the formula for calculating the correction matrix that was provided in the issue into a form that I find clearer: $(Translation(bone.tail-bone.head) ⋅ bone.matrix)^{-1} ⋅ bone\_matrix$ $= bone.matrix^{-1} ⋅ (Translation(bone.tail-bone.head))^{-1} ⋅ bone\_matrix$ $= bone.matrix^{-1} ⋅ Translation(bone.head-bone.tail) ⋅ bone\_matrix$ $(T(tail-head) ⋅ A)^{-1} ⋅ B$ $= A^{-1} ⋅ (T(tail-head))^{-1} ⋅ B$ $= A^{-1} ⋅ T(head-tail) ⋅ B$
Thomas Barlow added 1 commit 2024-03-21 02:15:19 +01:00
f3877b4b08 Fix #105217: FBX Force Connect Children transforms Objects parented to Bones
Force Connect Children can change the length and rotation of imported
bones, which was affecting Objects parented to bones.

This patch updates the correction matrix for child Objects attached to
bones to account for any changes made by forcing children bones to
connect to their parents.

Rigged meshes weren't affected because it was only the rest pose that
was changed.
Thomas Barlow requested review from Bastien Montagne 2024-03-21 03:16:32 +01:00
Bastien Montagne approved these changes 2024-03-21 11:17:58 +01:00
Bastien Montagne left a comment
Owner

LGTM

LGTM
Thomas Barlow added 2 commits 2024-03-22 13:52:18 +01:00
Thomas Barlow merged commit 689081bcbb into main 2024-03-22 13:53:55 +01:00
Thomas Barlow deleted branch fbx_105217_force_connect_child_objects 2024-03-22 13:53:57 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#105249
No description provided.