mirror of
https://github.com/bevyengine/bevy
synced 2024-12-22 11:03:06 +00:00
26df1c1179
# Objective - Introduce variants of `LoadContext::load_direct` which allow picking asset type & configuring settings. - Fixes #12963. ## Solution - Implements `ErasedLoadedAsset::downcast` and adds some accessors to `LoadedAsset<A>`. - Changes `load_direct`/`load_direct_with_reader` to be typed, and introduces `load_direct_untyped`/`load_direct_untyped_with_reader`. - Introduces `load_direct_with_settings` and `load_direct_with_reader_and_settings`. ## Testing - I've run cargo test and played with the examples which use `load_direct`. - I also extended the `asset_processing` example to use the new typed version of `load_direct` and use `load_direct_with_settings`. --- ## Changelog - Introduced new `load_direct` methods in `LoadContext` to allow specifying type & settings ## Migration Guide - `LoadContext::load_direct` has been renamed to `LoadContext::load_direct_untyped`. You may find the new `load_direct` is more appropriate for your use case (and the migration may only be moving one type parameter). - `LoadContext::load_direct_with_reader` has been renamed to `LoadContext::load_direct_untyped_with_reader`. --- This might not be an obvious win as a solution because it introduces quite a few new `load_direct` alternatives - but it does follow the existing pattern pretty well. I'm very open to alternatives. 😅
12 lines
268 B
Text
12 lines
268 B
Text
(
|
|
text: "d",
|
|
dependencies: [
|
|
],
|
|
embedded_dependencies: [
|
|
"foo/c.cool.ron",
|
|
"embedded://asset_processing/e.txt"
|
|
],
|
|
dependencies_with_settings: [
|
|
("embedded://asset_processing/e.txt", (text_override: Some("E"))),
|
|
],
|
|
)
|