FBX IO: Export normals matching the mesh's normals_domain #104976

Merged
Thomas Barlow merged 4 commits from Mysteryem/blender-addons:fbx_update_for_auto_smooth into main 2023-11-03 16:42:29 +01:00

4 Commits

Author SHA1 Message Date
09ac5449e6 Increase FBX minor version
This patch changes the output format of normals in some cases, so is
worth a minor version increase.
2023-11-03 15:17:28 +00:00
408b8b8e23 Merge remote-tracking branch 'upstream/main' into fbx_update_for_auto_smooth 2023-11-03 15:16:48 +00:00
a811d2fce8 Rename missed unused variables
Since the normals are no longer always loop/corner normals the "l" in
the variable names doesn't make sense anymore.

A few variable names were missed in the disabled "IndexToDirect"
code and comments.
2023-11-03 13:13:44 +00:00
f78321c58c FBX IO: Export normals matching the mesh's normals_domain
The appropriate normals array and FBX layer mapping are now used
according to the Mesh.normals_domain property.

This results in slightly faster exports with smaller file size when
meshes are either fully smooth shaded or fully flat shaded because the
FACE and POINT domains almost always have fewer normals than the CORNER
domain and never have more (a fully smooth shaded mesh where each face
has its own vertices would be POINT domain with as many vertices as
corners).

Additionally, getting the normals from the new Mesh.corner_normals
property runs in about 60% of the time of getting the normals through
MeshLoop.normal.

For me with a subdivided cube with 185856 corners:
MeshLoop.normal: ~6.7ms
Mesh.corner_normals: ~4.0ms

Import is unaffected, because only custom split normals can be set.
2023-10-28 14:57:19 +01:00