bevyengine / bevyengine/bevy

Add getter to assetserver for loaders

Open
#9,124 0 comments 0 reactions 0 assignees View on GitHub
A-Assets C-Usability
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## What problem does this solve or what need does it fill?

It would be nice if bevy allowed you to get a mutable reference to an asset loader after it has been added to the asset server, this would allow people to add customisable asset loaders, my specific use case is a 2d animation system that uses nodes, it would be nice if you could register animation nodes into the loader after the face at the moment I handle all the node loading outside the server and will have to come up with some workaround to allow custom nodes types to be added to the loader if I want to move it inside the asset server, the nodes are part of larger files so don't have specific file extension meaning I can't just add more loaders to the asset server.

## What solution would you like?

add a getter like fn get_asset_loader_mut(&self, extension: &str) -> Result<&mut Arc, AssetServerError>
this would allow me to add a way for users of the plugin to add their nodes.
this might need the Arc to be changed to a RWLock

## What alternative(s) have you considered?

make the current fn get_asset_loader(&self, extension: &str) -> Result, AssetServerError> pub so that it is at least possible to get the current loader to clone modify and add it back as a new loader with the same extension

## Additional context
I don't know it this is currently possible and I'm just missing it

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.