Speed up FBX export of polygon indices and edges with numpy #104451
No reviewers
Labels
No Label
Interest
Animation & Rigging
Interest
Blender Cloud
Interest
Collada
Interest
Core
Interest
Documentation
Interest
Eevee & Viewport
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
Import and Export
Interest
Modeling
Interest
Modifiers
Interest
Nodes & Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds, Tests & Devices
Interest
Python API
Interest
Rendering & Cycles
Interest
Sculpt, Paint & Texture
Interest
Translations
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Meta
Good First Issue
Meta
Papercut
Module
Add-ons (BF-Blender)
Module
Add-ons (Community)
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender-addons#104451
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Mysteryem/blender-addons:fbx_numpy_polygon_indices_and_edges_pr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
Polygon indices and per-edge data are interconnected so had to be part of one patch. This covers the export of polygons and edges, loose edges, edge/face smoothing and edge creases for subdivision.
The
t_lvi
array used in this patch could be re-used in the export of UVs and/or Vertex Colors since the patches for both of those areas require the same data albeit without any extra elements that have been added for loose edges. As a note on doing thist_pvi
array may currently be a view oft_lvi
, but fort_lvi
to be re-used for UVs/Vertex Colors,t_pvi
would have to always be a created as a copy oft_lvi
so that modifyingt_pvi
does not also modifyt_lvi
. This can be achieved by replacingt_pvi = astype_view_signedness(t_lvi, pvi_fbx_dtype)
witht_pvi = t_lvi.astype(pvi_fbx_dtype)
See #104453 and #104454
This patch depends on
#104447
I wasn't sure if I should include its commit in this PR, I have included it for now.
b2db1885e0
todabe504e28
Such case is actually an invalid mesh in Blender, so modified behavior here is not an issue.