Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bevy Asset V2 #8624

Merged
merged 149 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
149 commits
Select commit Hold shift + click to select a range
5151860
Bevy Asset V2
cart Apr 23, 2023
e04acbb
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart May 18, 2023
00c9d4c
Fix ImageLoader init: make sure it has access to Device
cart May 23, 2023
d919f15
.imported_assets -> imported_assets
cart May 23, 2023
a681099
Fix loading multiple sub-assets at the same time (didn't properly ded…
cart May 23, 2023
03331b9
Retrieve hash where relevant for read_asset_bytes
cart May 24, 2023
b8afe10
Don't skip processing assets without loader, Meta constructor, remove…
cart May 24, 2023
f95d4c0
Nicer path debug
cart May 24, 2023
c3c8eee
Produce processed state for ignored assets
cart May 24, 2023
7241b41
Use "load" for images in GLTF loader (enabling preprocessing), fix Pr…
cart May 29, 2023
0fa8e5b
is_srgb setting on ImageLoader. Detect srgb in compressed image saver
cart May 29, 2023
a4c9cc1
Remove unused import
cart May 31, 2023
4ea2b4d
fix build errors
cart May 31, 2023
b31e2fd
clippy
cart Jun 1, 2023
79a1e71
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Jun 1, 2023
9041806
Loader settings overrides
cart Jun 11, 2023
f6f91b6
Repeatable meta transforms (fixes hot reloading)
cart Jun 11, 2023
f31f5a2
Use md5 hash (aHash was a bad choice for a variety of reasons)
cart Jun 11, 2023
afaf223
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Jun 14, 2023
6952197
Remove on_loaded (just an experiment ... this deserves its own design…
cart Jun 14, 2023
2cb8ab0
WASM support
cart Jun 15, 2023
b1ed3ee
Update examples readme
cart Jun 15, 2023
ec60bc1
Update features
cart Jun 15, 2023
2af337d
Android support
cart Jun 16, 2023
f9fe116
Port EXR loader
cart Jun 16, 2023
b00264d
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Jul 11, 2023
36dad96
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Jul 11, 2023
dd3757c
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Jul 13, 2023
2569180
Document Assets, Events, Handles, LoadedAsset, AssetId, AssetPlugin, …
cart Jul 15, 2023
ec7a595
Document loader.rs
cart Jul 18, 2023
eddb93d
Document meta
cart Jul 19, 2023
db502f0
Document AssetSaver and path.rs
cart Jul 19, 2023
30a9bd7
Make mismatched settings a runtime error instead of a panic
cart Jul 20, 2023
66f7a63
Document AssetServer
cart Jul 21, 2023
28b14d9
Document ProcessorTransactionLog
cart Jul 21, 2023
987ed9e
Document AssetProcessor, Process, LoadAndSave, and more
cart Jul 21, 2023
011c02f
Document the rest of `io`
cart Jul 21, 2023
f0f4879
Allow AssetSavers to save labeled assets
cart Jul 21, 2023
e4720c1
Formatting tweaks
cart Jul 24, 2023
93c8144
Add public ProcessContext::asset_bytes()
cart Jul 24, 2023
ff54e02
Actual Reflect impl for Handle. Support reflect serializing and deser…
cart Jul 24, 2023
22b362a
Enable spawning scenes with strong handles by impling reflect_value f…
cart Jul 25, 2023
d389aec
File change event debouncing + delays. Improves change reliability, f…
cart Jul 25, 2023
a4e376b
Use RecommendedWatcher instead of INotifyWatcher (#31)
BeastLe9enD Jul 26, 2023
b824136
Remove unnecessary serialize / deserialize impls from AssetId
cart Jul 25, 2023
94c30cc
Handle removal and "move back in" file events. Fix blocking on event …
cart Jul 27, 2023
278d56c
Handle rename events in processor
cart Aug 2, 2023
64c06df
Update bevy_asset example meta
cart Aug 2, 2023
c75b14f
Check for asset source existence before creating meta files. Handle m…
cart Aug 2, 2023
99c84c1
Fill in remaining events. Add "unrecoverable error" type to transacti…
cart Aug 3, 2023
92b5a9e
Fill in file events that happen on windows and fix broken refactor
cart Aug 4, 2023
5650375
Add docs about transaction log entries
cart Aug 4, 2023
0a44a11
Cleanup empty processed directories
cart Aug 4, 2023
5bcf6ab
Handle remaining process errors and add write helpers
cart Aug 5, 2023
60454e2
Remove processed_dev() from load_gltf example
cart Aug 5, 2023
f24cf5d
Use noun form "dependant" when relevant.
cart Aug 5, 2023
a32030e
Tweak processor logs
cart Aug 6, 2023
fe3f319
Fix "write to destination" bug introduced during refactor
cart Aug 6, 2023
fd29fd3
Ignore assets without extensions from inside process_asset
cart Aug 6, 2023
c34b4b7
Track and reload "load dependants" when watching for changes in the A…
cart Aug 6, 2023
7bbc4b0
Track and store actual loading and failed dependencies. Stop "hacking…
cart Aug 6, 2023
cb80146
AssetDependencyVisitor -> VisitAssetDependencies
cart Aug 6, 2023
0ee1bde
Re-add filesystem_watcher / make watcher optional
cart Aug 6, 2023
5b3f24b
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Aug 6, 2023
0142d09
Update cargo_features.md
cart Aug 7, 2023
e1fed03
Re-add BEVY_ASSET_ROOT env variable
cart Aug 25, 2023
ce2b2ef
Add RenderAssets::iter_mut
cart Aug 25, 2023
eaba64c
Add a more reasonable loader setting in the loader example
cart Aug 25, 2023
962f849
Add multi-threaded setting in-line with general bevy pattern
cart Aug 25, 2023
da58dc9
recycled_queue_receiver doc comment
cart Aug 25, 2023
3d0f76e
Impl Copy for AssetEvent
cart Aug 25, 2023
e0533d6
use get_short_name in Handle Debug impl
cart Aug 25, 2023
86dc30d
Fix typed_debug_checked docs and expand them a bit
cart Aug 25, 2023
d593092
Document AssetWriter methods
cart Aug 25, 2023
8956519
wasm: also fail on non-200 status codes
cart Aug 25, 2023
2230200
Disable processing in sprite example
cart Aug 25, 2023
16bccf2
not(target = "wasm32") -> not(target_arch = "wasm32")
cart Aug 25, 2023
f4a9613
Remove filesystem_watcher from default features (doesn't compile on w…
cart Aug 25, 2023
ccc34c9
Improve HttpWasmAssetReader error handling (and refactor)
cart Aug 25, 2023
cf1837c
Refactor asset_providers init
cart Aug 25, 2023
901907f
TrackAssets set
cart Aug 25, 2023
6e22b3e
remove duplicate comment
cart Aug 25, 2023
9b421cc
should_load_dependencies
cart Aug 25, 2023
aa9b678
Add begin_labeled_asset doc example
cart Aug 25, 2023
ef637c5
Fix non-multithreaded non-wasm bevy_asset builds
cart Aug 25, 2023
a8f6624
Document AssetPath / labels and link to it from LoadContext
cart Aug 25, 2023
412d819
Fix/improve some AssetPath docs
cart Aug 25, 2023
5558758
interface -> trait
cart Aug 25, 2023
9dca687
Re-enable set_state (signaling issue is fixed)
cart Aug 25, 2023
6f9b0e2
Apply suggestions from code review
cart Aug 25, 2023
2decbd2
Update crates/bevy_asset/src/loader.rs
cart Aug 25, 2023
18acf0b
loop/break instead of while
cart Aug 26, 2023
dccd694
Apply suggestions from code review
cart Aug 26, 2023
0f6400c
println -> trace
cart Aug 25, 2023
e57bb34
Add syn err for Asset derive on unsupported types
cart Aug 26, 2023
3ba07e8
Clarifying allocator comment
cart Aug 26, 2023
61cd36e
use better phrasing than "global"
cart Aug 30, 2023
f8adad8
Check if asset exists before sending modified event.
cart Aug 30, 2023
2040e2d
move dense id iter implementation to DenseAssetStorage
cart Aug 30, 2023
7006cbb
Dedupe debug+display impl. Add link to Handle in docs.
cart Aug 30, 2023
cec0fd7
Use internal Ord impl
cart Aug 30, 2023
074ccb7
Improve display impl for UntypedAssetId
cart Aug 30, 2023
95aa10f
InternalAssetHandle -> StrongHandle
cart Aug 30, 2023
6e3d9df
Apply suggestions from code review
cart Aug 30, 2023
e308ac5
Simplify AssetEvent::is_X impls
cart Aug 30, 2023
822d554
Replace mismatched doc with useful doc.
cart Aug 30, 2023
670fb0d
Re-add folder loading example
cart Aug 30, 2023
aee8128
Remove old panic docs
cart Aug 31, 2023
4b2328f
add "safety" comment
cart Aug 31, 2023
0799fd9
Update crates/bevy_asset/src/server/mod.rs
cart Aug 31, 2023
957077b
Load images as srgb by default
cart Aug 31, 2023
6dec24a
Properly handle invalid generations
cart Aug 31, 2023
f99930d
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Aug 31, 2023
75c1b7d
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Aug 31, 2023
0ed8579
AssetLoader preregistration and async resolution
cart Sep 1, 2023
531665d
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Sep 1, 2023
1502bf0
Update cargo_features.md
cart Sep 1, 2023
78d6023
cargo fmt
cart Sep 1, 2023
29ac8b7
fix test imports
cart Sep 1, 2023
1ae9c53
Clippy
cart Sep 1, 2023
65e5aa7
Use async RwLock for file_transaction_lock
cart Sep 1, 2023
6ba6279
More clippy
cart Sep 1, 2023
6ed7029
fix scene_viewer paths
cart Sep 1, 2023
766e15a
Support upgrading AssetId to Handle from AssetServer. Fix animation_p…
cart Sep 1, 2023
c89269d
Ignore NotFound error when removing destination directory
cart Sep 1, 2023
d5dadf9
Revert AssetProvider refactor as it regressed ability to configure pr…
cart Sep 1, 2023
d38a594
Fix doc tests
cart Sep 1, 2023
c4ab305
Fix potential for timing error in test
cart Sep 1, 2023
592d7f3
Add toml metadata
cart Sep 1, 2023
b9036a5
try fixing a potential test race condition
cart Sep 1, 2023
46f84cc
Revert "fix scene_viewer paths"
cart Sep 1, 2023
11ae5c6
Ok maybe we just need more iterations
cart Sep 1, 2023
657b708
Update and track Assets after First, apply events after PostUpdate (…
cart Sep 6, 2023
93b3595
Merge remote-tracking branch 'upstream/main' into bevy_asset_v2
cart Sep 6, 2023
654faa0
Improve "cannot watch" error message
cart Sep 6, 2023
44ef6d6
Use async_broadcast instead of async_channel for MaybeAssetLoader
cart Sep 6, 2023
d0098c3
Better error messages for uninitialized asset types
cart Sep 6, 2023
7b0fbb7
Initialize empty () asset
cart Sep 6, 2023
261c922
Re-export anyhow from bevy_asset
cart Sep 6, 2023
c1e7f6f
fix doc
cart Sep 6, 2023
b80eb74
fix manual_asset_management test
cart Sep 6, 2023
341e506
Correctly format CANNOT_WATCH_ERROR_MESSAGE
cart Sep 6, 2023
ce714f5
Move loader example to top level bevy crate
cart Sep 7, 2023
ca328ad
rename processing example file
cart Sep 7, 2023
1e0281d
Add some documentation to the processing example
cart Sep 7, 2023
6f82ef8
print line about hot reloading
cart Sep 7, 2023
ecd4155
Update examples readme
cart Sep 7, 2023
4239af1
Fix docs in processing example
cart Sep 7, 2023
f636aac
Fix import
cart Sep 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ dxil.dll

# Generated by "examples/scene/scene.rs"
assets/scenes/load_scene_example-new.scn.ron

crates/bevy_asset/imported_assets
cart marked this conversation as resolved.
Show resolved Hide resolved
imported_assets
19 changes: 8 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ default = [
"bevy_sprite",
"bevy_text",
"bevy_ui",
"filesystem_watcher",
"multi-threaded",
"png",
"hdr",
"ktx2",
"zstd",
"vorbis",
"x11",
"filesystem_watcher",
"bevy_gizmos",
"android_shared_stdcxx",
"tonemapping_luts",
Expand Down Expand Up @@ -194,9 +194,6 @@ symphonia-vorbis = ["bevy_internal/symphonia-vorbis"]
# WAV audio format support (through symphonia)
symphonia-wav = ["bevy_internal/symphonia-wav"]

# Enable watching file system for asset hot reload
filesystem_watcher = ["bevy_internal/filesystem_watcher"]

# Enable serialization support through serde
serialize = ["bevy_internal/serialize"]

Expand All @@ -215,9 +212,6 @@ subpixel_glyph_atlas = ["bevy_internal/subpixel_glyph_atlas"]
# Enable systems that allow for automated testing on CI
bevy_ci_testing = ["bevy_internal/bevy_ci_testing"]

# Enable the "debug asset server" for hot reloading internal assets
debug_asset_server = ["bevy_internal/debug_asset_server"]

# Enable animation support, and glTF animation loading
animation = ["bevy_internal/animation", "bevy_animation"]

Expand Down Expand Up @@ -248,6 +242,9 @@ shader_format_spirv = ["bevy_internal/shader_format_spirv"]
# Enable some limitations to be able to use WebGL2. If not enabled, it will default to WebGPU in Wasm
webgl2 = ["bevy_internal/webgl"]

# Enables watching the filesystem for Bevy Asset hot-reloading
filesystem_watcher = ["bevy_internal/filesystem_watcher"]

[dependencies]
bevy_dylib = { path = "crates/bevy_dylib", version = "0.12.0-dev", default-features = false, optional = true }
bevy_internal = { path = "crates/bevy_internal", version = "0.12.0-dev", default-features = false }
Expand Down Expand Up @@ -952,12 +949,12 @@ category = "Assets"
wasm = true

[[example]]
name = "custom_asset_io"
path = "examples/asset/custom_asset_io.rs"
name = "custom_asset_reader"
path = "examples/asset/custom_asset_reader.rs"

[package.metadata.example.custom_asset_io]
[package.metadata.example.custom_asset_reader]
name = "Custom Asset IO"
description = "Implements a custom asset io loader"
description = "Implements a custom AssetReader"
category = "Assets"
wasm = true

Expand Down
9 changes: 4 additions & 5 deletions crates/bevy_animation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use std::ops::Deref;
use std::time::Duration;

use bevy_app::{App, Plugin, PostUpdate};
use bevy_asset::{AddAsset, Assets, Handle};
use bevy_asset::{Asset, AssetApp, Assets, Handle};
use bevy_core::Name;
use bevy_ecs::prelude::*;
use bevy_hierarchy::{Children, Parent};
use bevy_math::{Quat, Vec3};
use bevy_reflect::{Reflect, TypeUuid};
use bevy_reflect::Reflect;
use bevy_render::mesh::morph::MorphWeights;
use bevy_time::Time;
use bevy_transform::{prelude::Transform, TransformSystem};
Expand Down Expand Up @@ -65,8 +65,7 @@ pub struct EntityPath {
}

/// A list of [`VariableCurve`], and the [`EntityPath`] to which they apply.
#[derive(Reflect, Clone, TypeUuid, Debug, Default)]
#[uuid = "d81b7179-0448-4eb0-89fe-c067222725bf"]
#[derive(Asset, Reflect, Clone, Debug, Default)]
pub struct AnimationClip {
curves: Vec<Vec<VariableCurve>>,
paths: HashMap<EntityPath, usize>,
Expand Down Expand Up @@ -603,7 +602,7 @@ pub struct AnimationPlugin;

impl Plugin for AnimationPlugin {
fn build(&self, app: &mut App) {
app.add_asset::<AnimationClip>()
app.init_asset::<AnimationClip>()
.register_asset_reflect::<AnimationClip>()
.register_type::<AnimationPlayer>()
.register_type::<PlayingAnimation>()
Expand Down
39 changes: 18 additions & 21 deletions crates/bevy_asset/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,35 @@
name = "bevy_asset"
version = "0.12.0-dev"
edition = "2021"
description = "Provides asset functionality for Bevy Engine"
homepage = "https://bevyengine.org"
repository = "https://github.com/bevyengine/bevy"
license = "MIT OR Apache-2.0"
keywords = ["bevy"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = []
filesystem_watcher = ["notify"]
debug_asset_server = ["filesystem_watcher"]
filesystem_watcher = ["notify-debouncer-full"]

[dependencies]
# bevy
bevy_app = { path = "../bevy_app", version = "0.12.0-dev" }
bevy_diagnostic = { path = "../bevy_diagnostic", version = "0.12.0-dev" }
bevy_asset_macros = { path = "macros", version = "0.12.0-dev" }
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0-dev" }
bevy_log = { path = "../bevy_log", version = "0.12.0-dev" }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0-dev", features = ["bevy"] }
bevy_reflect = { path = "../bevy_reflect", version = "0.12.0-dev" }
bevy_tasks = { path = "../bevy_tasks", version = "0.12.0-dev" }
bevy_utils = { path = "../bevy_utils", version = "0.12.0-dev" }

# other
anyhow = "1.0"
async-broadcast = "0.5"
async-fs = "1.5"
async-lock = "2.7"
crossbeam-channel = "0.5"
downcast-rs = "1.2"
futures-io = "0.3"
futures-lite = "1.12"
md5 = "0.7"
parking_lot = { version = "0.12", features = ["arc_lock", "send_guard"] }
ron = "0.8"
serde = { version = "1", features = ["derive"] }
crossbeam-channel = "0.5.0"
anyhow = "1.0.4"
thiserror = "1.0"
downcast-rs = "1.2.0"
fastrand = "1.7.0"
notify = { version = "6.0.0", optional = true }
parking_lot = "0.12.1"
notify-debouncer-full = { version = "0.2.0", optional = true }

[target.'cfg(target_os = "android")'.dependencies]
bevy_winit = { path = "../bevy_winit", version = "0.12.0-dev" }
Expand All @@ -43,6 +42,4 @@ wasm-bindgen-futures = "0.4"
js-sys = "0.3"

[dev-dependencies]
futures-lite = "1.4.0"
tempfile = "3.2.0"
bevy_core = { path = "../bevy_core", version = "0.12.0-dev" }
bevy_core = {path = "../bevy_core", version = "0.12.0-dev"}
8 changes: 8 additions & 0 deletions crates/bevy_asset/assets/a.cool.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(
text: "a",
dependencies: [
"foo/b.cool.ron",
"foo/c.cool.ron",
],
embedded_dependencies: [],
)
12 changes: 12 additions & 0 deletions crates/bevy_asset/assets/a.cool.ron.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(
meta_format_version: "1.0",
asset: Process(
processor: "bevy_asset::processor::process::LoadAndSave<loader::CoolTextLoader, loader::CoolTextSaver>",
settings: (
loader_settings: (),
saver_settings: (
appended: "",
),
),
),
)
8 changes: 8 additions & 0 deletions crates/bevy_asset/assets/d.cool.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(
text: "d",
dependencies: [
],
embedded_dependencies: [
"foo/c.cool.ron"
],
)
12 changes: 12 additions & 0 deletions crates/bevy_asset/assets/d.cool.ron.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(
meta_format_version: "1.0",
asset: Process(
processor: "bevy_asset::processor::process::LoadAndSave<loader::CoolTextLoader, loader::CoolTextSaver>",
settings: (
loader_settings: (),
saver_settings: (
appended: "",
),
),
),
)
5 changes: 5 additions & 0 deletions crates/bevy_asset/assets/foo/b.cool.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(
text: "b",
dependencies: [],
embedded_dependencies: [],
)
12 changes: 12 additions & 0 deletions crates/bevy_asset/assets/foo/b.cool.ron.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(
meta_format_version: "1.0",
asset: Process(
processor: "bevy_asset::processor::process::LoadAndSave<loader::CoolTextLoader, loader::CoolTextSaver>",
settings: (
loader_settings: (),
saver_settings: (
appended: "",
),
),
),
)
5 changes: 5 additions & 0 deletions crates/bevy_asset/assets/foo/c.cool.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(
text: "c",
dependencies: [],
embedded_dependencies: ["a.cool.ron", "foo/b.cool.ron"],
)
12 changes: 12 additions & 0 deletions crates/bevy_asset/assets/foo/c.cool.ron.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(
meta_format_version: "1.0",
asset: Process(
processor: "bevy_asset::processor::process::LoadAndSave<loader::CoolTextLoader, loader::CoolTextSaver>",
settings: (
loader_settings: (),
saver_settings: (
appended: "",
),
),
),
)
Loading
Loading