Speed up FBX export of polygon indices and edges with numpy #104451

Merged
Bastien Montagne merged 2 commits from Mysteryem/blender-addons:fbx_numpy_polygon_indices_and_edges_pr into main 2023-03-06 15:17:07 +01:00

2 Commits

Author SHA1 Message Date
23e3fad929 Merge branch 'main' into fbx_numpy_polygon_indices_and_edges_pr 2023-03-06 15:11:10 +01:00
dabe504e28 Speed up FBX export of polygon indices and edges with numpy
Use buffers matching the C types of the data in foreach_get to avoid having to iterate and cast every single element in the C foreach_getset function.

Get the edge index for each exported edge key and use this to map per-edge data, such as creases, to the exported edges.

~9-17 times faster for a minimal export (no loose edges, smoothing or creases exported)
~16-23 times faster for a maximal export with FACE smoothing (loose edges, face smoothing and creases exported)
~32-40 times faster for a maximal export with EDGE smoothing (loose edges, edge smoothing and creases exported)

Isolated parts:
~5-7 times faster loose edges processing
~2-4 times faster face smoothing export
~73-96 times faster edge smoothing export
~62-75 times faster creases export

In the rare case where there exist multiple edges with the same edge-key, this patch can result in a different export because the single edge exported from those multiple edges will have the per-edge data of the first found edge in loops. Before this patch, the per-edge data would be from whichever edge with the same edge-key was iterated last since it would overwrite the previously set per-edge data of the exported edge.
2023-02-28 18:07:02 +01:00