Skip to content

Commit 4ee2cc6

Browse files
committed
Add a migration guide and release notes for short type path asset procesors.
1 parent 9394b20 commit 4ee2cc6

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: Traits `AssetLoader`, `AssetTransformer`, `AssetSaver`, and `Process` all now require `TypePath`
3+
pull_requests: [21339]
4+
---
5+
6+
The `AssetLoader`, `AssetTransformer`, `AssetSaver`, and `Process` traits now include a super trait
7+
of `TypePath`. This means if you previously had a loader like:
8+
9+
```rust
10+
struct MyFunkyLoader {
11+
add_funk: u32,
12+
}
13+
```
14+
15+
You will need to add the following derive:
16+
17+
```rust
18+
#[derive(TypePath)]
19+
struct MyFunkyLoader {
20+
add_funk: u32,
21+
}
22+
```
23+
24+
`TypePath` comes from `bevy_reflect`, so libraries may also need to add a dependency on
25+
`bevy_reflect`.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: Short-type-path asset processors
3+
authors: ["@andriyDev"]
4+
pull_requests: [21339]
5+
---
6+
7+
Asset processors allow manipulating assets at "publish-time" to convert them into a more optimal
8+
form when loading the data at runtime. This can either be done using a default processor, which
9+
processes all assets with a particular file extension, or by specifying the processor in the asset's
10+
meta file.
11+
12+
In previous versions of Bevy, the processor had to be **fully** specified in the asset's meta file.
13+
For example:
14+
15+
```
16+
(
17+
meta_format_version: "1.0",
18+
asset: Process(
19+
processor: "bevy_asset::processor::process::LoadTransformAndSave<asset_processing::CoolTextLoader, asset_processing::CoolTextTransformer, asset_processing::CoolTextSaver>",
20+
settings: (
21+
loader_settings: (),
22+
transformer_settings: (),
23+
saver_settings: (),
24+
),
25+
),
26+
)
27+
```
28+
29+
As you can see, processor types can be very verbose! In order to make these meta files easier to
30+
manipulate, we now also support using the "short type path" of the asset. This would look like:
31+
32+
```
33+
(
34+
meta_format_version: "1.0",
35+
asset: Process(
36+
processor: "LoadTransformAndSave<CoolTextLoader, CoolTextTransformer, CoolTextSaver>",
37+
settings: (
38+
loader_settings: (),
39+
transformer_settings: (),
40+
saver_settings: (),
41+
),
42+
),
43+
)
44+
```

0 commit comments

Comments
 (0)