FBX importer with Force Connect Children doesn't work properly with objects parented to the bones #105217

Closed
opened 2024-03-05 14:24:17 +01:00 by Ivaylo-Haralampiev · 2 comments

System Information
Operating system: Windows 10 Pro
Graphics card: NVIDIA GeForce GTX 1650 Ti

Blender Version
Broken: 3.6.9 and 4.0.2
Worked: none

Short description of error
This problem occurs when you import an FBX file containing meshes parented to bones with the following option set:
Armature -> Force Connect Children

I made this very simple example model to illustrate the problem. It's just a cube attached to the second bone.
OriginalModel.png

This is what I get on import in the current version.
ForceConnect-Error.png

This is what I expected:
ForceConnect-OK.png

I could narrow down the problem to this line in the source of "import_fbx.py":

# Correction for children attached to a bone. FBX expects to attach to the head of a bone,
# while Blender attaches to the tail.
self.bone_child_matrix = Matrix.Translation(-bone_tail)

This doesn't take into account that bone.tail is changed in "child_connect_finalize" later on.
To fix this, remove the line above and add this after "child_connect_finalize(bone, connect_ctx)".

self.bone_child_matrix = (Matrix.Translation(bone.tail-bone.head) @ bone.matrix).inverted() @ bone_matrix

The problem seems to disappear.

Exact steps for others to reproduce the error
Open the attached Blender file and export it as FBX.
Import it back into blender without "Force Connect Childen". It works fine.
Import it back into blender with "Force Connect Childen". It looks wrong.

**System Information** Operating system: Windows 10 Pro Graphics card: NVIDIA GeForce GTX 1650 Ti **Blender Version** Broken: 3.6.9 and 4.0.2 Worked: none **Short description of error** This problem occurs when you import an FBX file containing meshes parented to bones with the following option set: Armature -> Force Connect Children I made this very simple example model to illustrate the problem. It's just a cube attached to the second bone. ![OriginalModel.png](/attachments/6d07c369-e4c8-4449-b825-9226322040a7) This is what I get on import in the current version. ![ForceConnect-Error.png](/attachments/e099a3f6-ee31-421e-aece-436215e0466f) This is what I expected: ![ForceConnect-OK.png](/attachments/6e23bc95-f813-44f0-afde-0a2117b25f76) I could narrow down the problem to this line in the source of "import_fbx.py": ``` # Correction for children attached to a bone. FBX expects to attach to the head of a bone, # while Blender attaches to the tail. self.bone_child_matrix = Matrix.Translation(-bone_tail) ``` This doesn't take into account that bone.tail is changed in "child_connect_finalize" later on. To fix this, remove the line above and add this after "child_connect_finalize(bone, connect_ctx)". ``` self.bone_child_matrix = (Matrix.Translation(bone.tail-bone.head) @ bone.matrix).inverted() @ bone_matrix ``` The problem seems to disappear. **Exact steps for others to reproduce the error** Open the attached Blender file and export it as FBX. Import it back into blender without "Force Connect Childen". It works fine. Import it back into blender with "Force Connect Childen". It looks wrong.
Ivaylo-Haralampiev added the
Status
Needs Triage
Priority
Normal
Type
Report
labels 2024-03-05 14:24:18 +01:00
Member

Hi, thanks for the report. Can confirm.
@Mysteryem maybe interested to check this further? :)

Hi, thanks for the report. Can confirm. @Mysteryem maybe interested to check this further? :)
Pratik Borhade added
Status
Confirmed
Module
Add-ons (BF-Blender)
and removed
Status
Needs Triage
labels 2024-03-08 10:12:10 +01:00
Member

Considering how Force Connect Children doesn't affect rigged meshes, I guess Objects parented to bones should also not be affected.

Either with or without this change, Force Connect Children breaks imported animations, so I don't think the effect on imported animations needs to be considered too much.

Considering how `Force Connect Children` doesn't affect rigged meshes, I guess Objects parented to bones should also not be affected. Either with or without this change, `Force Connect Children` breaks imported animations, so I don't think the effect on imported animations needs to be considered too much.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-22 13:53:57 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
3 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#105217
No description provided.