bevy/crates
Nicola Papale f7f7e326e5
Add methods to directly load assets from World (#12023)
# Objective

`FromWorld` is often used to group loading and creation of assets for
resources.

With this setup, users often end up repetitively calling
`.resource::<AssetServer>` and `.resource_mut::<Assets<T>>`, and may
have difficulties handling lifetimes of the returned references.

## Solution

Add extension methods to `World` to add and load assets, through a new
extension trait defined in `bevy_asset`.

### Other considerations

* This might be a bit too "magic", as it makes implicit the resource
access.
* We could also implement `DirectAssetAccessExt` on `App`, but it didn't
feel necessary, as `FromWorld` is the principal use-case here.

---

## Changelog

* Add the `DirectAssetAccessExt` trait, which adds the `add_asset`,
`load_asset` and `load_asset_with_settings` method to the `World` type.
2024-02-27 00:28:26 +00:00
..
bevy_a11y Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_animation Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_app Use immutable key for HashMap and HashSet (#12086) 2024-02-26 16:27:40 +00:00
bevy_asset Add methods to directly load assets from World (#12023) 2024-02-27 00:28:26 +00:00
bevy_audio Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_color Use LinearRgba in bevy_gizmos internals (#12128) 2024-02-26 23:50:33 +00:00
bevy_core Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00
bevy_core_pipeline Port bevy_core_pipeline to LinearRgba (#12116) 2024-02-26 12:25:11 +00:00
bevy_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_diagnostic Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dylib Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_dynamic_plugin Document all members of bevy_dynamic_plugin (#12029) 2024-02-22 13:28:52 +00:00
bevy_ecs Fix typos (#12131) 2024-02-26 17:46:01 +00:00
bevy_ecs_compile_fail_tests Remove APIs deprecated in 0.13 (#11974) 2024-02-19 19:04:47 +00:00
bevy_encase_derive Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_gilrs Make Gilrs a normal resource on non-Wasm targets (#12092) 2024-02-26 00:23:42 +00:00
bevy_gizmos Use LinearRgba in bevy_gizmos internals (#12128) 2024-02-26 23:50:33 +00:00
bevy_gltf Use immutable key for HashMap and HashSet (#12086) 2024-02-26 16:27:40 +00:00
bevy_hierarchy Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_input Fix missing renaming of Input -> ButtonInput (#12096) 2024-02-24 18:41:17 +00:00
bevy_internal Rename bevy_render::Color to LegacyColor (#12069) 2024-02-24 21:35:32 +00:00
bevy_log Remove unnecessary wildcards from LogPlugin and convert warnings to errors. (#12046) 2024-02-23 18:49:32 +00:00
bevy_macro_utils fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_macros_compile_fail_tests Standardize toml format with taplo (#10594) 2023-11-21 01:04:14 +00:00
bevy_math Add Direction3dA and move direction types out of primitives (#12018) 2024-02-26 13:57:49 +00:00
bevy_mikktspace fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_pbr Add random shader utils, fix cluster_debug_visualization (#11956) 2024-02-26 15:59:44 +00:00
bevy_ptr Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_reflect Added reflect support for std::HashSet, BTreeSet and BTreeMap. (#12124) 2024-02-26 16:36:04 +00:00
bevy_reflect_compile_fail_tests bevy_reflect_derive: Clean up attribute logic (#11777) 2024-02-12 15:16:27 +00:00
bevy_render bevy_color: Add Laba to support Lab Color Model (#12115) 2024-02-26 22:30:50 +00:00
bevy_scene Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_sprite Prefer UVec2 when working with texture dimensions (#11698) 2024-02-25 15:23:04 +00:00
bevy_tasks Loosen lifetime requirements for single-threaded Scope::spawn to match the multi-threaded version. (#12073) 2024-02-24 06:01:34 +00:00
bevy_text Prefer UVec2 when working with texture dimensions (#11698) 2024-02-25 15:23:04 +00:00
bevy_time Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_transform Add Direction3dA and move direction types out of primitives (#12018) 2024-02-26 13:57:49 +00:00
bevy_ui Prefer UVec2 when working with texture dimensions (#11698) 2024-02-25 15:23:04 +00:00
bevy_utils fix some typos (#12038) 2024-02-22 18:55:22 +00:00
bevy_window Bump Version after Release (#12020) 2024-02-21 20:58:59 +00:00
bevy_winit Check cfg during CI and fix feature typos (#12103) 2024-02-25 15:19:27 +00:00