Speed up FBX export of UVs with numpy #104453
Closed
Thomas Barlow
wants to merge 1 commits from
When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Mysteryem/blender-addons:fbx_numpy_uvs_pr_standalone
into main
pull from: Mysteryem/blender-addons:fbx_numpy_uvs_pr_standalone
merge into: blender:main
blender:main
blender:blender-v3.6-release
blender:blender-v4.1-release
blender:blender-v4.0-release
blender:blender-v3.3-release
blender:blender-v3.5-release
blender:brush-assets-project
blender:blender-v2.93-release
blender:blender-v3.4-release
blender:xr-dev
blender:blender-v3.2-release
blender:blender-v3.1-release
blender:screenshots-manual
blender:gltf_vtree
blender:blender-v2.83-release
blender:blender-v3.0-release
blender:xr-controller-support
blender:studio-sprite-fright
blender:asset-browser-poselib
blender:blender-v2.92-release
blender:blender-v2.91-release
blender:blender-v2.90-release
blender:greasepencil-addon
blender:xr-world-navigation
blender:soc-2019-openxr
blender:blender-v2.82-release
blender:blender-v2.81-release
blender:filebrowser_redesign
blender:blender-v2.80-release
blender:blender2.7
blender:blender-v2.79b-release
blender:blender-v2.79a-release
blender:blender-v2.79-release
blender:fbx_experiments
blender:blender-v2.78b-release
blender:collada-2
blender:blender-v2.78-release
blender:rigify_fixes
blender:fbx_io_export_ignore_parents
When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
65a1a580e9 |
Speed up FBX export of UVs 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. Uses sorting-based uniqueness in the same way as numpy.unique, but avoids creating an array of triplets by keeping the uvs and vertex indices arrays separate and splits up the work needed for both arrays, since the vertex indices are the same for every uv layer, so only need to be sorted once. Adds a specific check and exception for NaN values since the original code would also raise an exception when NaN values were encountered in uvs. About 10-20 times faster with 1 uv layer, with further speedup the more uv layers there are. It is possible to export uvs in a similar manner as the original code, but with only a single iteration rather than the original two iterations, in which case, this patch is about 6-12 times faster with 1 uv layer. This does change the exported fbx because the uvs are sorted (albeit not in order because they are viewed as a different type for sorting performance), causing the "UV" array to be in a different order and the "UVIndex" array to match the new ordering, but the full array of uvs reconstructed by indexing the "UV" array with each "UVIndex" in sequence does remain the same, so while the exported file may be different, the result of importing the different file will still be the same. |