FBX IO: Add utility to schedule tasks to run on separate threads #105017
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#105017
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "Mysteryem/blender-addons:fbx_multithread_utils_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?
Adds a class intended for processing lots of smaller CPU-bound tasks
that release the GIL. This class allows a function to be wrapped such
that calling the wrapper will schedule the wrapped function to be called
on another thread.
When multithreading is not available on the current system, the function
to wrap is returned instead, resulting in single-threaded execution, so
the calling code doesn't need to be aware of whether multithreading is
available.
The class starts its own threads as needed using a ThreadPoolExecutor
and a context manager is used to wait for its threads to shut down when
exiting the context.
Longer tasks, such as those which are IO related may be more suited to
using a ThreadPoolExecutor directly.
This patch on its own makes no changes to FBX import/export.
I intend to update #104739 to use this new functionality, but the main speedup will come from #105018 that multithreads array compression on export.
It's worth noting thatfbx2json.py
andjson2fbx.py
won't be able to make use of this new utility because they can't importfbx_utils
due tofbx_utils
importingbpy
.edit: The new utility has been moved into a new module
fbx_utils_threading
which doesn't require thebpy
module.LGTM from quick overview of the code.
Think this could be in it's own module though (
fbx_utils_thrading.py
?). That way it can also be used by non-Blender utils...Since this PR does nothing on its own, I'm intending to only merge it when one of the PRs that use it are also approved.