#Asset loader disambiguation question

3 messages · Page 1 of 1 (latest)

autumn orchid
#

I've been implementing some AssetLoaders and I wondered if anyone has a good understanding of how asset loading works if there are two AssetLoaders that share the same extensions. For instance, I'm working on a AssetLoader that reads Pico-8 carts, which are stored stenographically(!) in PNGs. It seems like Bevy's asset loading uses both the expected Handle<AssetType> and extension, which is great so that I can do this:

// WORKS!
let image: Handle<Image> = asset_server.load("cart.p8.png");
let pico8_asset: Handle<Pico8Asset> = asset_server.load("cart.p8.png");

I guess the trouble I'm running into is where the root asset type is omitted for instance when using asset labels.

// DOES NOT WORK.
let script: Handle<ScriptAsset> = asset_server.load("cart.p8.png#lua"); 

The above doesn't work probably because it has chosen to use the standard image loader not my Pico8AssetLoader. Hmm, maybe this is the case where the get_asset_loader_* methods on AssetServer become important? Is that how one would disambiguate the above?

vagrant owl
#

not certain on this, but labeled assets might only be loadable once the main asset has been loaded

quasi hill
#

AssetTransformer from Image to Pico8Asset?