Fix #137768: new FBX importer does not import some animations correctly

- FBX "root bone" should become the Armature object itself, and not
  an extra bone (follow same logic as Python importer did).
- "World to armature matrix" was not correct for armatures that are
  parented under some other objects with transforms.
- Parenting imported meshes under an Armature was not taking into
  account that the mesh bind transform might not be the same as the
  current mesh node transform (i.e. was not setting "matrix parent
  inverse" to compensate like the Python importer did).
- The repro file in #137768 also exposed an issue that importing custom
  vertex normals was not working correctly in the new importer, when
  mesh is partially invalid (validation alters the mesh, custom normals
  have to be set afterwards).

Pull Request: https://projects.blender.org/blender/blender/pulls/138736
This commit is contained in:
Aras Pranckevicius
2025-05-12 10:56:07 +02:00
committed by Aras Pranckevicius
parent 6a31554394
commit a96ecd2834
14 changed files with 672 additions and 1465 deletions

View File

@@ -490,6 +490,13 @@ class Report:
if obj.parent_type == 'BONE':
desc.write(f" par_bone:'{obj.parent_bone}'")
desc.write(f"\n")
mtx = obj.matrix_parent_inverse
if not is_approx_identity(mtx):
desc.write(f" - matrix_parent_inverse:\n")
desc.write(f" {fmtf(mtx[0][0])} {fmtf(mtx[0][1])} {fmtf(mtx[0][2])} {fmtf(mtx[0][3])}\n")
desc.write(f" {fmtf(mtx[1][0])} {fmtf(mtx[1][1])} {fmtf(mtx[1][2])} {fmtf(mtx[1][3])}\n")
desc.write(f" {fmtf(mtx[2][0])} {fmtf(mtx[2][1])} {fmtf(mtx[2][2])} {fmtf(mtx[2][3])}\n")
desc.write(f" - pos {fmtf(obj.location[0])}, {fmtf(obj.location[1])}, {fmtf(obj.location[2])}\n")
desc.write(
f" - rot {fmtrot(obj.rotation_euler[0])}, {fmtrot(obj.rotation_euler[1])}, {fmtrot(obj.rotation_euler[2])} ({obj.rotation_mode})\n")