GitHub Project.
Subsystem designed in Unreal 5.4 for batch filtering, sorting, and loading assets.
The core use of a tool like this would be for viewing an inventory in a limited manner and not wanting to load all the item images/meshes/data all at once. Like flipping through pages of assets.
Supports multithreading for the heavy filtering and sorting task
This was inspired my the async loading work I did for Maximum Velocity but done in a much more modular form.
Uses a GameInstanceSubsystem to access the manager from anywhere and enforce its lifetime.
Libraries are retrieved by a simple Id.
Uses optional multithreading for the filtering and sorting.
Blueprint helper functions. Fully usable in blueprints.
Add a list of structs that represent an "asset" by a unique Id along with SoftObjectPaths to load for them, GamplayTag/float pairs that describe the asst, and a callback delegate for when the asset's SoftObjectPaths are loaded/unloaded.
Filter and sort the library by tags that the asset must have, tags that it must not have, tag order, and tag value ascending/descending. Supply a delegate to know when this is complete. Note that only the most recent request will trigger when it finishes. Optionally this can be done in a threaded task.
Set the target range in the sorted assets that are to be displayed along with how large of a buffer. Example: Setting a buffer by page is done by supplying a page size and what page is to be shown. Optionally there are buffer pages on either side of the target number that can be loaded. The main page is loaded with high priority while the buffer pages are loaded with normal priority. If there are 100 items and SetBufferTargetByPage() is called with PageIndex of 2, PageSize of 10, and NumBufferPages of 1, then items 20 -29 will be loaded with high priority and pages 10 -19 and 30 -39 will be loaded with normal priority. Items that were previously loaded will be unload. For the above this would be great for inventory item widgets that load and unload their thumbnail image depending on if they will be viewed soon.
I think the locking around the library variables could be more efficient.
The libraries need to return a handle of some sort that manages the library lifetime. Currently the libraries are explicitly destroyed and that can allow for dangling libraries since most of the time the designer will not want these to persist between worlds.
I would like to implement more performant sorting of the items.
Trace logging.