bevy/crates/bevy_asset/src
Carter Anderson cc6c4d65ed
Fix GLTF scene dependencies and make full scene renders predictable (#10745)
# Objective

Fixes #10688

There were a number of issues at play:

1. The GLTF loader was not registering Scene dependencies properly. They
were being registered at the root instead of on the scene assets. This
made `LoadedWithDependencies` fire immediately on load.
2. Recursive labeled assets _inside_ of labeled assets were not being
loaded. This only became relevant for scenes after fixing (1) because we
now add labeled assets to the nested scene `LoadContext` instead of the
root load context. I'm surprised nobody has hit this yet. I'm glad I
caught it before somebody hit it.
3. Accessing "loaded with dependencies" state on the Asset Server is
boilerplatey + error prone (because you need to manually query two
states).

## Solution

1. In GltfLoader, use a nested LoadContext for scenes and load
dependencies through that context.
2. In the `AssetServer`, load labeled assets recursively.
3. Added a simple `asset_server.is_loaded_with_dependencies(id)`

I also added some docs to `LoadContext` to help prevent this problem in
the future.

---

## Changelog

- Added `AssetServer::is_loaded_with_dependencies`
- Fixed GLTF Scene dependencies
- Fixed nested labeled assets not being loaded

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2023-11-27 22:42:28 +00:00
..
io Do not panic when failing to create assets folder (#10613) (#10614) 2023-11-17 22:06:08 +00:00
processor AssetMetaMode (#10623) 2023-11-27 22:32:36 +00:00
server Fix GLTF scene dependencies and make full scene renders predictable (#10745) 2023-11-27 22:42:28 +00:00
assets.rs Non-blocking load_untyped using a wrapper asset (#10198) 2023-10-26 22:14:32 +00:00
event.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
folder.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
handle.rs remove double-hasing of typeid for handle (#10699) 2023-11-23 01:04:37 +00:00
id.rs Fix Asset Loading Bug (#10698) 2023-11-22 13:39:44 +00:00
lib.rs AssetMetaMode (#10623) 2023-11-27 22:32:36 +00:00
loader.rs Fix GLTF scene dependencies and make full scene renders predictable (#10745) 2023-11-27 22:42:28 +00:00
meta.rs assets: use blake3 instead of md5 (#10208) 2023-10-23 04:15:04 +00:00
path.rs delete methods deprecated in 0.12 (#10693) 2023-11-24 16:15:47 +00:00
reflect.rs Bevy Asset V2 (#8624) 2023-09-07 02:07:27 +00:00
saver.rs Make AssetLoader/Saver Error type bounds compatible with anyhow::Error (#10493) 2023-11-14 01:25:06 +00:00