-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some missed migration guides for 0.15 (#1846)
Co-authored-by: BD103 <[email protected]>
- Loading branch information
1 parent
7ff7814
commit 6fc4724
Showing
24 changed files
with
607 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
release-content/0.15/migration-guides/14387_Deprecate_is_playing_animation.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The user will just need to replace functions named `is_playing_animation` with `animation_is_playing`. |
51 changes: 51 additions & 0 deletions
51
...nt/0.15/migration-guides/15482_bevy_reflect_Add_ReflectDeserializerProcessor.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
(Since I added `P = ()`, I don’t think this is actually a breaking change anymore, but I’ll leave this in) | ||
|
||
`bevy_reflect`’s `ReflectDeserializer` and `TypedReflectDeserializer` now take a `ReflectDeserializerProcessor` as the type parameter `P`, which allows you to customize deserialization for specific types when they are found. However, the rest of the API surface (`new`) remains the same. | ||
<details> | ||
<summary>Original implementation</summary> | ||
|
||
Add `ReflectDeserializerProcessor`: | ||
|
||
```rs | ||
struct ReflectDeserializerProcessor { | ||
pub can_deserialize: Box<dyn FnMut(&TypeRegistration) -> bool + 'p>, | ||
pub deserialize: Box< | ||
dyn FnMut( | ||
&TypeRegistration, | ||
&mut dyn erased_serde::Deserializer, | ||
) -> Result<Box<dyn PartialReflect>, erased_serde::Error> | ||
+ 'p, | ||
} | ||
``` | ||
|
||
Along with `ReflectDeserializer::new_with_processor` and `TypedReflectDeserializer::new_with_processor`. This does not touch the public API of the existing `new` fns. | ||
|
||
This is stored as an `Option<&mut ReflectDeserializerProcessor>` on the deserializer and any of the private `-Visitor` structs, and when we attempt to deserialize a value, we first pass it through this processor. | ||
|
||
Also added a very comprehensive doc test to `ReflectDeserializerProcessor`, which is actually a scaled down version of the code for the `bevy_animation_graph` loader. This should give users a good motivating example for when and why to use this feature. | ||
|
||
__Why `Box<dyn ..>`?__ | ||
|
||
When I originally implemented this, I added a type parameter to `ReflectDeserializer` to determine the processor used, with `()` being “no processor”. However when using this, I kept running into rustc errors where it failed to validate certain type bounds and led to overflows. I then switched to a dynamic dispatch approach. | ||
|
||
The dynamic dispatch should not be that expensive, nor should it be a performance regression, since it’s only used if there is `Some` processor. (Note: I have not benchmarked this, I am just speculating.) Also, it means that we don’t infect the rest of the code with an extra type parameter, which is nicer to maintain. | ||
|
||
__Why the `'p` on `ReflectDeserializerProcessor<'p>`?__ | ||
|
||
Without a lifetime here, the `Box`es would automatically become `Box<dyn FnMut(..) + 'static>`. This makes them practically useless, since any local data you would want to pass in must then be `'static`. In the motivating example, you couldn’t pass in that `&mut LoadContext` to the function. | ||
|
||
This means that the `'p` infects the rest of the Visitor types, but this is acceptable IMO. This PR also elides the lifetimes in the `impl<'de> Visitor<'de> for -Visitor` blocks where possible. | ||
|
||
__Future possibilities__ | ||
|
||
I think it’s technically possible to turn the processor into a trait, and make the deserializers generic over that trait. This would also open the door to an API like: | ||
|
||
```rs | ||
type Seed; | ||
|
||
fn seed_deserialize(&mut self, r: &TypeRegistration) -> Option<Self::Seed>; | ||
|
||
fn deserialize(&mut self, r: &TypeRegistration, d: &mut dyn erased_serde::Deserializer, s: Self::Seed) -> ...; | ||
``` | ||
|
||
A similar processor system should also be added to the serialization side, but that’s for another PR. Ideally, both PRs will be in the same release, since one isn’t very useful without the other. |
6 changes: 6 additions & 0 deletions
6
...tion-guides/15754_Rename_AppWorldobserve_to_add_observer_EntityWorldMutobser.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Various observer methods have been renamed for clarity. | ||
|
||
- `App::observe` -> `App::add_observer` | ||
- `World::observe` -> `World::add_observer` | ||
- `Commands::observe` -> `Commands::add_observer` | ||
- `EntityWorldMut::observe_entity` -> `EntityWorldMut::observe` |
9 changes: 9 additions & 0 deletions
9
release-content/0.15/migration-guides/16037_Use_enus_locale_for_typos.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
The following methods or fields have been renamed from `*dependants*` to `*dependents*`. | ||
|
||
- `ProcessorAssetInfo::dependants` | ||
- `ProcessorAssetInfos::add_dependant` | ||
- `ProcessorAssetInfos::non_existent_dependants` | ||
- `AssetInfo::dependants_waiting_on_load` | ||
- `AssetInfo::dependants_waiting_on_recursive_dep_load` | ||
- `AssetInfos::loader_dependants` | ||
- `AssetInfos::remove_dependants_and_labels` |
1 change: 1 addition & 0 deletions
1
...tion-guides/16069_Reduce_the_clusterable_object_UBO_size_below_16384_for_Web.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!-- TODO --> |
32 changes: 32 additions & 0 deletions
32
...tion-guides/16072_Move_TextureAtlas_into_UiImage_and_remove_impl_Component_f.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Before: | ||
|
||
```rust | ||
commands.spawn(( | ||
UiImage::new(image), | ||
TextureAtlas { index, layout }, | ||
)); | ||
``` | ||
|
||
After: | ||
|
||
```rust | ||
commands.spawn(UiImage::from_atlas_image(image, TextureAtlas { index, layout })); | ||
``` | ||
|
||
Before: | ||
|
||
```rust | ||
commands.spawn(UiImage { | ||
texture: some_image, | ||
..default() | ||
}) | ||
``` | ||
|
||
After: | ||
|
||
```rust | ||
commands.spawn(UiImage { | ||
image: some_image, | ||
..default() | ||
}) | ||
``` |
13 changes: 13 additions & 0 deletions
13
...tion-guides/16090_Adding_alpha_threshold_to_OrderIndependentTransparencySett.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
If you previously explicitly initialized OrderIndependentTransparencySettings with your own `layer_count`, you will now have to add either a `..default()` statement or an explicit `alpha_threshold` value: | ||
|
||
```rust | ||
fn setup(mut commands: Commands) { | ||
commands.spawn(( | ||
Camera3d::default(), | ||
OrderIndependentTransparencySettings { | ||
layer_count: 16, | ||
..default() | ||
}, | ||
)); | ||
} | ||
``` |
1 change: 1 addition & 0 deletions
1
release-content/0.15/migration-guides/16097_Remove_custom_rounding.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`UiSurface::get_layout` now also returns the final sizes before rounding. Call `.0` on the `Ok` result to get the previously returned `taffy::Layout` value. |
1 change: 1 addition & 0 deletions
1
release-content/0.15/migration-guides/16139_ReflectBundleremove_improvement.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
If you don’t need the returned value from `remove`, discard it. |
1 change: 1 addition & 0 deletions
1
...ontent/0.15/migration-guides/16163_Dont_reëxport_bevy_image_from_bevy_render.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Use `bevy_image` instead of `bevy_render::texture` items. |
2 changes: 2 additions & 0 deletions
2
release-content/0.15/migration-guides/16222_Gamepad_improvements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- `Gamepad` fields are now public. | ||
- Instead of using `Gamepad` delegates like `Gamepad::just_pressed`, call these methods directly on the fields. |
4 changes: 4 additions & 0 deletions
4
release-content/0.15/migration-guides/16233_Use_Name_component_for_gamepad.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- `GamepadInfo` no longer exists: | ||
- Name now accessible via `Name` component. | ||
- Other information available on `Gamepad` component directly. | ||
- `GamepadConnection::Connected` now stores all info fields directly. |
15 changes: 15 additions & 0 deletions
15
...content/0.15/migration-guides/16257_Remove_accesskit_reexport_from_bevy_a11y.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
```diff | ||
# main.rs | ||
-- use bevy_a11y::{ | ||
-- accesskit::{Node, Rect, Role}, | ||
-- AccessibilityNode, | ||
-- }; | ||
++ use bevy_a11y::AccessibilityNode; | ||
++ use accesskit::{Node, Rect, Role}; | ||
|
||
# Cargo.toml | ||
++ accesskit = "0.17" | ||
``` | ||
|
||
- Users will need to add `accesskit = "0.17"` to the dependencies section of their `Cargo.toml` file and update their `accesskit` use statements to come directly from the external crate instead of `bevy_a11y`. | ||
- Make sure to keep the versions of `accesskit` aligned with the versions Bevy uses. |
1 change: 1 addition & 0 deletions
1
release-content/0.15/migration-guides/16269_Make_ComponentTicks_field_public.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Instead of using `ComponentTicks::last_changed_tick` and `ComponentTicks::added_tick` methods, access fields directly. |
11 changes: 11 additions & 0 deletions
11
...nt/0.15/migration-guides/16271_UiImage__ImageNode_UiImageSize__ImageNodeSize.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Before: | ||
|
||
```rust | ||
commands.spawn(UiImage::new(image)); | ||
``` | ||
|
||
After: | ||
|
||
```rust | ||
commands.spawn(ImageNode::new(image)); | ||
``` |
1 change: 1 addition & 0 deletions
1
...tion-guides/16301_Expose_Pipeline_Compilation_Zero_Initialize_Workgroup_Memo.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- add `zero_initialize_workgroup_memory: false,` to `ComputePipelineDescriptor` or `RenderPipelineDescriptor` structs to preserve 0.14 functionality, add `zero_initialize_workgroup_memory: true,` to restore bevy 0.13 functionality. |
1 change: 1 addition & 0 deletions
1
...content/0.15/migration-guides/16327_Rename_Rot2angle_between_to_Rot2angle_to.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`Rot2::angle_between` has been deprecated, use `Rot2::angle_to` instead, the semantics of `Rot2::angle_between` will change in the future. |
2 changes: 2 additions & 0 deletions
2
...t/0.15/migration-guides/16375_Only_use_physical_coords_internally_in_bevy_ui.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
`ComputedNode`’s fields and methods now use physical coordinates. | ||
`ComputedNode` has a new field `inverse_scale_factor`. Multiplying the physical coordinates by the `inverse_scale_factor` will give the logical values. |
1 change: 1 addition & 0 deletions
1
...t/0.15/migration-guides/16405_Bind_only_the_written_parts_of_storage_buffers.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- Fixed a bug with StorageBuffer and DynamicStorageBuffer binding data from the previous frame(s) due to caching GPU buffers between frames. |
1 change: 1 addition & 0 deletions
1
...tion-guides/16468_Only_use_the_AABB_center_for_mesh_visibility_range_testing.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- The `VisibilityRange` component now has an extra field, `use_aabb`. Generally, you can safely set it to false. |
2 changes: 2 additions & 0 deletions
2
...tion-guides/16473_Add_flags_to_SpritePlugin_and_UiPlugin_to_allow_disabling_.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
- `UiPlugin` now contains an extra `add_picking` field if `bevy_ui_picking_backend` is enabled. | ||
- `SpritePlugin` is no longer a unit struct, and has one field if `bevy_sprite_picking_backend` is enabled (otherwise no fields). |
1 change: 1 addition & 0 deletions
1
release-content/0.15/migration-guides/16481_cleanup_bevy_renderlibrs.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`RenderCreation::Manual` variant fields are now wrapped in a struct called `RenderResources` |
Oops, something went wrong.