From bffedbe5ce8e3545cdf9f6947afbd37d946fdf4d Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Feb 2023 17:08:10 -0500 Subject: [PATCH 01/27] generate migration guide --- .../book/migration-guides/0.9-0.10/_index.md | 473 ++++++++++++++++++ 1 file changed, 473 insertions(+) create mode 100644 content/learn/book/migration-guides/0.9-0.10/_index.md diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md new file mode 100644 index 0000000000..3e3c322564 --- /dev/null +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -0,0 +1,473 @@ ++++ +title = "0.9 to 0.10" +weight = 6 +sort_by = "weight" +template = "book-section.html" +page_template = "book-section.html" +insert_anchor_links = "right" +[extra] +long_title = "Migration Guide: 0.9 to 0.10" ++++ + +Bevy relies heavily on improvements in the Rust language and compiler. +As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable release" of Rust. + +### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) + +* Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. +* Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. + +### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) + +_Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ + +The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. + +### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) + +before: + +```rust + app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + always_on_top: true, + ..default() + }), + ..default() + })); +``` + +after: + +```rust + app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + window_level: bevy::window::WindowLevel::AlwaysOnTop, + ..default() + }), + ..default() + })); +``` + +### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) + +* Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. + +### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) + +The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. +It’s unlikely to cause any issues with existing code. + +### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) + +* The `background_color` field of `ExtractedUiNode` is now named `color`. + +### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) + + + +### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) + + + +### [Remove App::add_sub_app](https://github.com/bevyengine/bevy/pull/7290) + +`App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` + +Old: + +```rust +let mut sub_app = App::new() +// Build subapp here +app.add_sub_app(MySubAppLabel, sub_app); +``` + +New: + +```rust +let mut sub_app = App::new() +// Build subapp here +app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); +``` + +### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) + +* `dynamic` feature was renamed to `dynamic_linking` + +### [bevy_reflect: Pre-parsed paths](https://github.com/bevyengine/bevy/pull/7321) + +`GetPath` methods have been renamed according to the following: + +* `path` -> `reflect_path` +* `path_mut` -> `reflect_path_mut` +* `get_path` -> `path` +* `get_path_mut` -> `path_mut` + +### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) + + + +### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) + +`RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. + +### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) + + + +### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) + +```rust +let multi = Msaa { samples: 4 } +// is now +let multi = Msaa::Sample4 + +multi.samples +// is now +multi.samples() +``` + +### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) + +The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. + +Before: + +```rust +fn parallel_system(query: Query<&MyComponent>) { + query.par_for_each(32, |comp| { + ... + }); +} +``` + +After: + +```rust +fn parallel_system(query: Query<&MyComponent>) { + query.par_iter().for_each(|comp| { + ... + }); +} +``` + +### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) + +### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) + +* Replace `WindowDescriptor` with `Window`. +* Change `width` and `height` fields in a `WindowResolution`, either by doing + +```rust +WindowResolution::new(width, height) // Explicitly +// or using From<_> for tuples for convenience +(1920., 1080.).into() +``` + +* Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: + +```rust +let window = commands.spawn(Window { ... }).id(); // open window +commands.entity(window).despawn(); // close window +``` + +### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) + +The `alignment` field of `Text` now only affects the text’s internal alignment. + +### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) + +* Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. + +### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) + +Exclusive systems (systems that access `&mut World`) now support system piping, so the `ExclusiveSystemParamFunction` trait now has generics for the `In`put and `Out`put types. + +```rust +// Before +fn my_generic_system(system_function: T) +where T: ExclusiveSystemParamFunction +{ ... } + +// After +fn my_generic_system(system_function: T) +where T: ExclusiveSystemParamFunction +{ ... } +``` + +### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) + +* `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` + +### [Document alignment requirements of `Ptr`, `PtrMut` and `OwningPtr`](https://github.com/bevyengine/bevy/pull/7151) + +* Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. + +### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) + +`GlobalTransform::translation_mut` has been removed without alternative, +if you were relying on this, update the `Transform` instead. If the given entity +had children or parent, you may need to remove its parent to make its transform +independent (in which case the new `Commands::set_parent_in_place` and +`Commands::remove_parent_in_place` may be of interest) + +Bevy may add in the future a way to toggle transform propagation on +an entity basis. + +### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) + +Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. + +### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) + +* Manual implementors of `List` need to implement the new methods `insert` and `remove` and +consider whether to use the new default implementation of `push` and `pop`. + +### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) + +TODO + +### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) + +Note: this replaces the migration guide for #6865. +This is relative to Bevy 0.9, not main. + +The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. + +```rust +// Before (0.9) +impl SystemParam for MyParam<'_, '_> { + type State = MyParamState; +} +unsafe impl SystemParamState for MyParamState { + fn init(world: &mut World, system_meta: &mut SystemMeta) -> Self { ... } +} +unsafe impl<'w, 's> SystemParamFetch<'w, 's> for MyParamState { + type Item = MyParam<'w, 's>; + fn get_param(&mut self, ...) -> Self::Item; +} +unsafe impl ReadOnlySystemParamFetch for MyParamState { } + +// After (0.10) +unsafe impl SystemParam for MyParam<'_, '_> { + type State = MyParamState; + type Item<'w, 's> = MyParam<'w, 's>; + fn init_state(world: &mut World, system_meta: &mut SystemMeta) -> Self::State { ... } + fn get_param<'w, 's>(state: &mut Self::State, ...) -> Self::Item<'w, 's>; +} +unsafe impl ReadOnlySystemParam for MyParam<'_, '_> { } +``` + +The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. + +```rust +// Before +unsafe impl ReadOnlySystemParamFetch for MyParamState {} + +// After +unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} +``` + +### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) + +* `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. + +### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) + +* Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. + +### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) + +A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. + +### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) + +* `MutUntyped::into_inner` now marks things as changed. + +### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) + + + +### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) + +* evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. +* setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. +* usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. +* `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. + +### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) + +`ExtractedJoints` has been removed. Read the bound bones from `SkinnedMeshJoints` instead. + +### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) + + + +### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) + +The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. + +### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) + +_Merged with the guide for #6919._ + +### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) + +`PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. + +### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) + + + +### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) + + + +### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) + +`EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: + +```rust +// Old (0.9) +fn clear_events(reader: EventReader) { + reader.clear(); +} + +// New (0.10) +fn clear_events(mut reader: EventReader) { + reader.clear(); +} +``` + +### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) + + + +### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) + +The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. + +```rust +// Before +#[derive(SystemParam)] +struct MessageWriter<'w, 's> { + events: EventWriter<'w, 's, Message>, +} + +// After +#[derive(SystemParam)] +struct MessageWriter<'w> { + events: EventWriter<'w, Message>, +} +``` + +### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) + + + +### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) + + + +### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) + + + +### [bevy_reflect: Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) + +This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types. This means any code relying on either of those type data existing for those glam types will need to not do that. + +This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: + +```rust +// BEFORE +( + "glam::f32::affine3a::Affine3A": (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), + +// AFTER + "glam::f32::affine3a::Affine3A": ( + matrix3: ( + x_axis: ( + x: 1.0, + y: 0.0, + z: 0.0, + ), + y_axis: ( + x: 0.0, + y: 1.0, + z: 0.0, + ), + z_axis: ( + x: 0.0, + y: 0.0, + z: 1.0, + ), + ), + translation: ( + x: 0.0, + y: 0.0, + z: 0.0, + ), + ) +) +``` + +### [Remove `BuildWorldChildren` impl from `WorldChildBuilder`](https://github.com/bevyengine/bevy/pull/6727) + +Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. +You can edit the hierarchy via `EntityMut` instead. + +### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) + +* replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` +* if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders + +### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) + +Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. +For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. + +Remove `.unwrap()` from `input_node`. +For cases where the option was handled, use `get_input_node` instead. + +### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) + + + +### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) + + + +### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) + +TODO + +### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) + + + +### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) + + + +### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) + +`Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. + +### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) + +Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. + +### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) + +just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. + +### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) + + + +### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) + + From 41264aecda180a74fd494f9d7d02c3e4444e3a53 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Feb 2023 19:33:45 -0500 Subject: [PATCH 02/27] add area label --- .../book/migration-guides/0.9-0.10/_index.md | 640 ++++++++++++------ 1 file changed, 450 insertions(+), 190 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 3e3c322564..e87809028e 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -11,69 +11,28 @@ long_title = "Migration Guide: 0.9 to 0.10" Bevy relies heavily on improvements in the Rust language and compiler. As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable release" of Rust. +
-### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) - -* Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. -* Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. - -### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) - -_Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ - -The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. - -### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) - -before: - -```rust - app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { - always_on_top: true, - ..default() - }), - ..default() - })); -``` - -after: - -```rust - app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { - window_level: bevy::window::WindowLevel::AlwaysOnTop, - ..default() - }), - ..default() - })); -``` - -### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) - -* Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. - -### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) - -The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. -It’s unlikely to cause any issues with existing code. - -### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) - -* The `background_color` field of `ExtractedUiNode` is now named `color`. - -### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) +### [bevy_reflect: Pre-parsed paths](https://github.com/bevyengine/bevy/pull/7321) - +
+
Animation
+
Reflection
+
-### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) +`GetPath` methods have been renamed according to the following: - +- `path` -> `reflect_path` +- `path_mut` -> `reflect_path_mut` +- `get_path` -> `path` +- `get_path_mut` -> `path_mut` ### [Remove App::add_sub_app](https://github.com/bevyengine/bevy/pull/7290) +
+
App
+
+ `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` Old: @@ -92,45 +51,63 @@ let mut sub_app = App::new() app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); ``` -### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) +### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) -* `dynamic` feature was renamed to `dynamic_linking` +
+
Assets
+
-### [bevy_reflect: Pre-parsed paths](https://github.com/bevyengine/bevy/pull/7321) +- Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. -`GetPath` methods have been renamed according to the following: +### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) -* `path` -> `reflect_path` -* `path_mut` -> `reflect_path_mut` -* `get_path` -> `path` -* `get_path_mut` -> `path_mut` +
+
Core
+
-### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) +- `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. - +### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) -### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) +
+
ECS
+
-`RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. +- Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. +- Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. -### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) +### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) + +
+
ECS
+
+ +_Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ + +The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. + +### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) + +
+
ECS
+
-### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) +### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) -```rust -let multi = Msaa { samples: 4 } -// is now -let multi = Msaa::Sample4 +
+
ECS
+
-multi.samples -// is now -multi.samples() -``` + ### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) +
+
ECS
+
+ The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. Before: @@ -153,36 +130,12 @@ fn parallel_system(query: Query<&MyComponent>) { } ``` -### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) - -### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) - -* Replace `WindowDescriptor` with `Window`. -* Change `width` and `height` fields in a `WindowResolution`, either by doing - -```rust -WindowResolution::new(width, height) // Explicitly -// or using From<_> for tuples for convenience -(1920., 1080.).into() -``` - -* Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: - -```rust -let window = commands.spawn(Window { ... }).id(); // open window -commands.entity(window).despawn(); // close window -``` - -### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) - -The `alignment` field of `Text` now only affects the text’s internal alignment. - -### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) - -* Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. - ### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) +
+
ECS
+
+ Exclusive systems (systems that access `&mut World`) now support system piping, so the `ExclusiveSystemParamFunction` trait now has generics for the `In`put and `Out`put types. ```rust @@ -197,40 +150,28 @@ where T: ExclusiveSystemParamFunction { ... } ``` -### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) - -* `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` - ### [Document alignment requirements of `Ptr`, `PtrMut` and `OwningPtr`](https://github.com/bevyengine/bevy/pull/7151) -* Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. - -### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) +
+
ECS
+
-`GlobalTransform::translation_mut` has been removed without alternative, -if you were relying on this, update the `Transform` instead. If the given entity -had children or parent, you may need to remove its parent to make its transform -independent (in which case the new `Commands::set_parent_in_place` and -`Commands::remove_parent_in_place` may be of interest) - -Bevy may add in the future a way to toggle transform propagation on -an entity basis. +- Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. ### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) -Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. - -### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) - -* Manual implementors of `List` need to implement the new methods `insert` and `remove` and -consider whether to use the new default implementation of `push` and `pop`. - -### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) +
+
ECS
+
-TODO +Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. ### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) +
+
ECS
+
+ Note: this replaces the migration guide for #6865. This is relative to Bevy 0.9, not main. @@ -270,63 +211,44 @@ unsafe impl ReadOnlySystemParamFetch for MyParamState {} unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} ``` -### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) - -* `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. - -### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) - -* Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. - ### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) +
+
ECS
+
+ A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. ### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) -* `MutUntyped::into_inner` now marks things as changed. - -### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) - - - -### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) - -* evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. -* setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. -* usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. -* `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. - -### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) +
+
ECS
+
-`ExtractedJoints` has been removed. Read the bound bones from `SkinnedMeshJoints` instead. - -### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) - - - -### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) - -The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. +- `MutUntyped::into_inner` now marks things as changed. ### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) -_Merged with the guide for #6919._ - -### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) +
+
ECS
+
-`PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. +_Merged with the guide for #6919._ ### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) - - -### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) +
+
ECS
+
### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) +
+
ECS
+
+ `EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: ```rust @@ -341,12 +263,12 @@ fn clear_events(mut reader: EventReader) { } ``` -### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) - - - ### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) +
+
ECS
+
+ The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. ```rust @@ -363,20 +285,106 @@ struct MessageWriter<'w> { } ``` -### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) +### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) + +
+
ECS
+
-### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) +### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) + +
+
ECS
+
-### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) +### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) + +
+
ECS
+
+ +TODO + +### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) + +
+
ECS
+
+ +`Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. + +### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) + +
+
ECS
+
+ +Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. + +### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) + +
+
ECS
+
Diagnostics
+
+### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) + +
+
ECS
+
Reflection
+
+ +- Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. + +### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) + +
+
ECS
+
Scenes
+
+ + + +### [Remove `BuildWorldChildren` impl from `WorldChildBuilder`](https://github.com/bevyengine/bevy/pull/6727) + +
+
Hierarchy
+
+ +Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. +You can edit the hierarchy via `EntityMut` instead. + +### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) + +
+
Meta
+
+ +- `dynamic` feature was renamed to `dynamic_linking` + +### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) + +
+
Reflection
+
+ +- Manual implementors of `List` need to implement the new methods `insert` and `remove` and +consider whether to use the new default implementation of `push` and `pop`. + ### [bevy_reflect: Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) +
+
Reflection
+
Scenes
+
+ This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types. This means any code relying on either of those type data existing for those glam types will need to not do that. This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: @@ -414,60 +422,312 @@ This also means that some serialized glam types will need to be updated. For exa ) ``` -### [Remove `BuildWorldChildren` impl from `WorldChildBuilder`](https://github.com/bevyengine/bevy/pull/6727) +### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) -Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. -You can edit the hierarchy via `EntityMut` instead. +
+
Rendering
+
+ +`RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. + +### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) + +
+
Rendering
+
+ +```rust +let multi = Msaa { samples: 4 } +// is now +let multi = Msaa::Sample4 + +multi.samples +// is now +multi.samples() +``` + +### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) + +
+
Rendering
+
+ +- Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. + +### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) + +
+
Rendering
+
+ +TODO + +### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) + +
+
Rendering
+
+ + + +### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) + +
+
Rendering
+
+ +- evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. +- setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. +- usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. +- `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. + +### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) + +
+
Rendering
+
+ +The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. + +### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) + +
+
Rendering
+
+ +`PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. ### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) -* replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` -* if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders +
+
Rendering
+
+ +- replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` +- if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders ### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) +
+
Rendering
+
+ Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. -### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) +### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) + +
+
Rendering
+
+ +just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. + +### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) + +
+
Rendering
+
+ + + +### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) + +
+
Rendering
+
Animation
+
+ +`ExtractedJoints` has been removed. Read the bound bones from `SkinnedMeshJoints` instead. + +### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) + +
+
Rendering
+
Assets
+
### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) +
+
Rendering
+
Core
+
Time
+
+ -### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) +### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) -TODO +
+
Rendering
+
Tasks
+
+ +### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) + +
+
Rendering
+
UI
+
+ +- The `background_color` field of `ExtractedUiNode` is now named `color`. ### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) +
+
Rendering
+
UI
+
+ ### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) +
+
Scenes
+
+ -### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) +### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) -`Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. +
+
Transform
+
-### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) + -Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. +### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) -### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) +
+
Transform
+
Hierarchy
+
-just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. +`GlobalTransform::translation_mut` has been removed without alternative, +if you were relying on this, update the `Transform` instead. If the given entity +had children or parent, you may need to remove its parent to make its transform +independent (in which case the new `Commands::set_parent_in_place` and +`Commands::remove_parent_in_place` may be of interest) -### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) +Bevy may add in the future a way to toggle transform propagation on +an entity basis. + +### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) + +
+
UI
+
+ +The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. +It’s unlikely to cause any issues with existing code. + +### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) + +
+
UI
+
+ + + +### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) + +
+
UI
+
+ +The `alignment` field of `Text` now only affects the text’s internal alignment. + +### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) + +
+
UI
+
+ +- `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` + +### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) + +
+
UI
+
### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) +
+
UI
+
+ + + +### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) + +
+
Windowing
+
+ +before: + +```rust + app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + always_on_top: true, + ..default() + }), + ..default() + })); +``` + +after: + +```rust + app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + window_level: bevy::window::WindowLevel::AlwaysOnTop, + ..default() + }), + ..default() + })); +``` + +### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) + +
+
Windowing
+
+ + +### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) + +
+
Windowing
+
+ +- Replace `WindowDescriptor` with `Window`. +- Change `width` and `height` fields in a `WindowResolution`, either by doing + +```rust +WindowResolution::new(width, height) // Explicitly +// or using From<_> for tuples for convenience +(1920., 1080.).into() +``` + +- Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: + +```rust +let window = commands.spawn(Window { ... }).id(); // open window +commands.entity(window).despawn(); // close window +``` + +
From 0245c9e09900b09ea6b2df6a5178c0ad8045ff31 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Feb 2023 20:32:29 -0500 Subject: [PATCH 03/27] Update content/learn/book/migration-guides/0.9-0.10/_index.md Co-authored-by: James Liu --- content/learn/book/migration-guides/0.9-0.10/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index e87809028e..5aee93c285 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -217,7 +217,7 @@ unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {}
ECS
-A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. +A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. ### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) From 21f380a766f3fff6a5eef849d5a99075d409c5a9 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 15:20:57 -0500 Subject: [PATCH 04/27] clean up more clean up fix pipeline rendering guide more guides todo clean up re-generate clean up trying out some new style style clean up update style re-generate manual clean up clean up clean up re generate headings and soft breaks --- .../book/migration-guides/0.9-0.10/_index.md | 306 ++++++++++++------ sass/pages/_migration_guide.scss | 21 +- 2 files changed, 225 insertions(+), 102 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 5aee93c285..25a238f589 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -35,29 +35,25 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` -Old: - ```rust +// 0.9 let mut sub_app = App::new() // Build subapp here app.add_sub_app(MySubAppLabel, sub_app); -``` - -New: -```rust +// 0.10 let mut sub_app = App::new() // Build subapp here app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); ``` -### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) +### [Make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076)
Assets
-- Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. +Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. ### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) @@ -65,7 +61,15 @@ app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn));
Core
-- `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. +`CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. + +### [Remove broken `DoubleEndedIterator` impls on event iterators](https://github.com/bevyengine/bevy/pull/7469) + +
+
ECS
+
+ +`ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. ### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) @@ -82,17 +86,18 @@ app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn));
ECS
+ _Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. -### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) +### [Add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404)
ECS
- + ### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) @@ -100,7 +105,8 @@ The trait method `ExclusiveSystemParamState::apply` has been removed. If you hav
ECS
- +- Changed `World::init_resource` to return the generated `ComponentId`. +- Changed `World::init_non_send_resource` to return the generated `ComponentId`. ### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) @@ -110,19 +116,15 @@ The trait method `ExclusiveSystemParamState::apply` has been removed. If you hav The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. -Before: - ```rust +// 0.9 fn parallel_system(query: Query<&MyComponent>) { query.par_for_each(32, |comp| { ... }); } -``` -After: - -```rust +// 0.10 fn parallel_system(query: Query<&MyComponent>) { query.par_iter().for_each(|comp| { ... @@ -139,12 +141,12 @@ fn parallel_system(query: Query<&MyComponent>) { Exclusive systems (systems that access `&mut World`) now support system piping, so the `ExclusiveSystemParamFunction` trait now has generics for the `In`put and `Out`put types. ```rust -// Before +// 0.9 fn my_generic_system(system_function: T) where T: ExclusiveSystemParamFunction { ... } -// After +// 0.10 fn my_generic_system(system_function: T) where T: ExclusiveSystemParamFunction { ... } @@ -156,7 +158,7 @@ where T: ExclusiveSystemParamFunction
ECS
-- Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. +Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. ### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) @@ -178,7 +180,7 @@ This is relative to Bevy 0.9, not main. The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. ```rust -// Before (0.9) +// 0.9 impl SystemParam for MyParam<'_, '_> { type State = MyParamState; } @@ -191,7 +193,7 @@ unsafe impl<'w, 's> SystemParamFetch<'w, 's> for MyParamState { } unsafe impl ReadOnlySystemParamFetch for MyParamState { } -// After (0.10) +// 0.10 unsafe impl SystemParam for MyParam<'_, '_> { type State = MyParamState; type Item<'w, 's> = MyParam<'w, 's>; @@ -204,10 +206,10 @@ unsafe impl ReadOnlySystemParam for MyParam<'_, '_> { } The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. ```rust -// Before +// 0.9 unsafe impl ReadOnlySystemParamFetch for MyParamState {} -// After +// 0.10 unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} ``` @@ -225,7 +227,7 @@ A `World` can only hold a maximum of 232 - 1 archetypes and tables no
ECS
-- `MutUntyped::into_inner` now marks things as changed. +`MutUntyped::into_inner` now marks things as changed. ### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) @@ -241,7 +243,7 @@ _Merged with the guide for #6919._
ECS
- +`Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`. ### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) @@ -252,12 +254,12 @@ _Merged with the guide for #6919._ `EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: ```rust -// Old (0.9) +// 0.9 fn clear_events(reader: EventReader) { reader.clear(); } -// New (0.10) +// 0.10 fn clear_events(mut reader: EventReader) { reader.clear(); } @@ -272,13 +274,13 @@ fn clear_events(mut reader: EventReader) { The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. ```rust -// Before +// 0.9 #[derive(SystemParam)] struct MessageWriter<'w, 's> { events: EventWriter<'w, 's, Message>, } -// After +// 0.10 #[derive(SystemParam)] struct MessageWriter<'w> { events: EventWriter<'w, Message>, @@ -291,7 +293,9 @@ struct MessageWriter<'w> {
ECS
- +`Entities`’s `Default` implementation has been removed. You can fetch a reference to a `World`’s `Entities` via `World::entities` and `World::entities_mut`. + +`Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue. ### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) @@ -299,7 +303,9 @@ struct MessageWriter<'w> {
ECS
- +`ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case. + +`Archetype` and `Archetypes` are not constructible outside of `bevy_ecs` now. Use `World::archetypes` to get a read-only reference to either of these types. ### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) @@ -307,7 +313,15 @@ struct MessageWriter<'w> {
ECS
-TODO +Various low level APIs interacting with the change detection ticks no longer return `&UnsafeCell`, instead returning `TickCells` which contains two separate `&UnsafeCell`s instead. + +```rust +// 0.9 +column.get_ticks(row).deref().changed + +// 0.10 +column.get_ticks(row).changed.deref() +``` ### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) @@ -332,16 +346,16 @@ Do I still need to do this? I really hope people were not relying on the public
Diagnostics
- + -### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) +### [ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206)
ECS
Reflection
-- Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. +Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. ### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) @@ -350,7 +364,7 @@ Do I still need to do this? I really hope people were not relying on the public
Scenes
- +`World::iter_entities` now returns an iterator of `EntityRef` instead of `Entity`. To get the actual ID, use `EntityRef::id` from the returned `EntityRef`s. ### [Remove `BuildWorldChildren` impl from `WorldChildBuilder`](https://github.com/bevyengine/bevy/pull/6727) @@ -358,8 +372,7 @@ Do I still need to do this? I really hope people were not relying on the public
Hierarchy
-Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. -You can edit the hierarchy via `EntityMut` instead. +Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. ### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) @@ -367,18 +380,17 @@ You can edit the hierarchy via `EntityMut` instead.
Meta
-- `dynamic` feature was renamed to `dynamic_linking` +`dynamic` feature was renamed to `dynamic_linking` -### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) +### [Add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063)
Reflection
-- Manual implementors of `List` need to implement the new methods `insert` and `remove` and -consider whether to use the new default implementation of `push` and `pop`. +Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. -### [bevy_reflect: Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) +### [Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580)
Reflection
@@ -390,11 +402,11 @@ This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from m This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: ```rust -// BEFORE +// 0.9 ( "glam::f32::affine3a::Affine3A": (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), -// AFTER +// 0.10 "glam::f32::affine3a::Affine3A": ( matrix3: ( x_axis: ( @@ -437,12 +449,12 @@ This also means that some serialized glam types will need to be updated. For exa
```rust +// 0.9 let multi = Msaa { samples: 4 } -// is now -let multi = Msaa::Sample4 - multi.samples -// is now + +// 0.10 +let multi = Msaa::Sample4 multi.samples() ``` @@ -452,7 +464,7 @@ multi.samples()
Rendering
-- Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. +Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. ### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) @@ -460,7 +472,21 @@ multi.samples()
Rendering
-TODO +`TrackedRenderPass` now requires a `RenderDevice` to construct. To make this easier, use `RenderContext.begin_tracked_render_pass` instead. + +```rust +// 0.9 +TrackedRenderPass::new(render_context.command_encoder.begin_render_pass( + &RenderPassDescriptor { + ... + }, +)); + +// 0.10 +render_context.begin_tracked_render_pass(RenderPassDescriptor { + ... +}); +``` ### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) @@ -468,9 +494,27 @@ TODO
Rendering
- +```rust +// 0.9 +Camera2dBundle { + camera: Camera { + priority: 1, + ..default() + }, + ..default() +} -### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) +// 0.10 +Camera2dBundle { + camera: Camera { + order: 1, + ..default() + }, + ..default() +} +``` + +### [Enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320)
Rendering
@@ -481,7 +525,7 @@ TODO - usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. - `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. -### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) +### [Run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878)
Rendering
@@ -489,7 +533,7 @@ TODO The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. -### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) +### [Get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820)
Rendering
@@ -512,11 +556,9 @@ The call to `clear_trackers` in `App` has been moved from the schedule to App::u
Rendering
-Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. -For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. +Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. -Remove `.unwrap()` from `input_node`. -For cases where the option was handled, use `get_input_node` instead. +Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. ### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) @@ -524,7 +566,7 @@ For cases where the option was handled, use `get_input_node` instead.
Rendering
-just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. +Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. ### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) @@ -532,7 +574,22 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Rendering
- +```rust +// 0.9 +shape::Icosphere { + radius: 0.5, + subdivisions: 5, +} +.into() + +// 0.10 +shape::Icosphere { + radius: 0.5, + subdivisions: 5, +} +.try_into() +.unwrap() +``` ### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) @@ -550,7 +607,7 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Assets
- +No api changes are required, but it's possible that your gltf meshes look different ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) @@ -560,7 +617,36 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Time
- +The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. + +### [Migrate engine to Schedule v3](https://github.com/bevyengine/bevy/pull/7267) + +
+
Rendering
+
ECS
+
+ +- Calls to `.label(MyLabel)` should be replaced with `.in_set(MySet)` +- Stages have been removed. Replace these with system sets, and then add command flushes using the `apply_system_buffers` exclusive system where needed. +- The `CoreStage`, `StartupStage,`RenderStage`and`AssetStage`enums have been replaced with`CoreSet`,`StartupSet, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. + - Systems are no longer added to `CoreSet::Update` by default. Add systems manually if this behavior is needed, although you should consider adding your game logic systems to `CoreSchedule::FixedTimestep` instead for more reliable framerate-independent behavior. + - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. + - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with + - `add_system(my_system.in_set(CoreSet::PostUpdate)` +- When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages +- Run criteria have been renamed to run conditions. These can now be combined with each other and with states. +- Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. +- For app-level control flow over which schedules get run when (such as for rollback networking), create your own schedule and insert it under the `CoreSchedule::Outer` label. +- Fixed timesteps are now evaluated in a schedule, rather than controlled via run criteria. The `run_fixed_timestep` system runs this schedule between `CoreSet::First` and `CoreSet::PreUpdate` by default. +- Command flush points introduced by `AssetStage` have been removed. If you were relying on these, add them back manually. +- the `calculate_bounds` system, with the `CalculateBounds` label, is now in `CoreSet::Update`, rather than in `CoreSet::PostUpdate` before commands are applied. You may need to order your movement systems to occur before this system in order to avoid system order ambiguities in culling behavior. +- the `RenderLabel` `AppLabel` was renamed to `RenderApp` for clarity +- `App::add_state` now takes 0 arguments: the starting state is set based on the `Default` impl. +- Instead of creating `SystemSet` containers for systems that run in stages, simply use `.on_enter::()` or its `on_exit` or `on_update` siblings. +- `SystemLabel` derives should be replaced with `SystemSet`. You will also need to add the `Debug`, `PartialEq`, `Eq`, and `Hash` traits to satisfy the new trait bounds. +- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a bool. +- States have been dramatically simplified: there is no longer a “state stack”. To queue a transition to the next state, call `NextState::set` +- Strings can no longer be used as a `SystemLabel` or `SystemSet`. Use a type, or use the system function instead. ### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) @@ -569,6 +655,10 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Tasks
+__App `runner` and SubApp `extract` functions are now required to be Send__ + +This was changed to enable pipelined rendering. If this breaks your use case please report it as these new bounds might be able to be relaxed. + ### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452)
@@ -576,7 +666,7 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
UI
-- The `background_color` field of `ExtractedUiNode` is now named `color`. +The `background_color` field of `ExtractedUiNode` is now named `color`. ### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) @@ -585,15 +675,15 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
UI
- +`ImageNode` never worked, if you were using it please create an issue. -### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) +### [Make `spawn_dynamic` return InstanceId](https://github.com/bevyengine/bevy/pull/6663)
Scenes
- + ### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) @@ -601,7 +691,7 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Transform
- + ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) @@ -610,14 +700,9 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Hierarchy
-`GlobalTransform::translation_mut` has been removed without alternative, -if you were relying on this, update the `Transform` instead. If the given entity -had children or parent, you may need to remove its parent to make its transform -independent (in which case the new `Commands::set_parent_in_place` and -`Commands::remove_parent_in_place` may be of interest) +`GlobalTransform::translation_mut` has been removed without alternative, if you were relying on this, update the `Transform` instead. If the given entity had children or parent, you may need to remove its parent to make its transform independent (in which case the new `Commands::set_parent_in_place` and `Commands::remove_parent_in_place` may be of interest) -Bevy may add in the future a way to toggle transform propagation on -an entity basis. +Bevy may add in the future a way to toggle transform propagation on an entity basis. ### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) @@ -625,8 +710,7 @@ an entity basis.
UI
-The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. -It’s unlikely to cause any issues with existing code. +The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It’s unlikely to cause any issues with existing code. ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) @@ -634,7 +718,7 @@ It’s unlikely to cause any issues with existing code.
UI
- +`QueuedText` was never meant to be user facing. If you relied on it, please make an issue. ### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) @@ -644,13 +728,23 @@ It’s unlikely to cause any issues with existing code. The `alignment` field of `Text` now only affects the text’s internal alignment. +__Change `TextAlignment` to TextAlignment` which is now an enum. Replace:__ + +- `TextAlignment::TOP_LEFT`, `TextAlignment::CENTER_LEFT`, `TextAlignment::BOTTOM_LEFT` with `TextAlignment::Left` +- `TextAlignment::TOP_CENTER`, `TextAlignment::CENTER_LEFT`, `TextAlignment::BOTTOM_CENTER` with `TextAlignment::Center` +- `TextAlignment::TOP_RIGHT`, `TextAlignment::CENTER_RIGHT`, `TextAlignment::BOTTOM_RIGHT` with `TextAlignment::Right` + +__Changes for `Text2dBundle`__ + +`Text2dBundle` has a new field ‘text_anchor’ that takes an `Anchor` component that controls its position relative to its transform. + ### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161)
UI
-- `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` +`FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` ### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) @@ -658,7 +752,7 @@ The `alignment` field of `Text` now only affects the text’s internal alignment
UI
- +`TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. ### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) @@ -666,33 +760,43 @@ The `alignment` field of `Text` now only affects the text’s internal alignment
UI
- +```rust +// 0.9 +commands.spawn(ImageBundle { + style: button_icon_style.clone(), + image: UiImage(icon), + ..default() +}); + +// 0.10 +commands.spawn(ImageBundle { + style: button_icon_style.clone(), + image: UiImage::new(icon), + ..default() +}); +``` -### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) +### [Update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480)
Windowing
-before: - ```rust - app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { +// 0.9 +app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { always_on_top: true, ..default() - }), - ..default() - })); -``` - -after: - -```rust - app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { + }), + ..default() + })); + +// 0.10 +app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { window_level: bevy::window::WindowLevel::AlwaysOnTop, ..default() }), @@ -706,7 +810,7 @@ after:
Windowing
- + ### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) diff --git a/sass/pages/_migration_guide.scss b/sass/pages/_migration_guide.scss index b87ad92618..82a78ae2d7 100644 --- a/sass/pages/_migration_guide.scss +++ b/sass/pages/_migration_guide.scss @@ -1,7 +1,24 @@ .migration-guide { - > h3 { + h3 { + margin-top: 3rem; margin-bottom: 0.2rem; + padding-bottom: 0.1rem; + border-bottom: solid darken($color-white, 60%) 0.15rem; } + + p, ul, li, code { + font-size: 1rem; + } + + // a { + // color: $color-white; + // // font-weight: normal; + // &:hover{ + // // font-weight: 500; + // color: $link-color; + // text-shadow: 0 0 0.9px $link-hover-shadow-color, 0 0 0.9px $link-hover-shadow-color; + // } + // } } .migration-guide-area-tags { @@ -18,6 +35,8 @@ padding-right: 0.2rem; padding-top: 0.2rem; padding-bottom: 0.2rem; + margin-top: 0.3rem; + margin-bottom: 0.3rem; line-height: 1; border-radius: 0.3rem; border-style: solid; From 2c05320526b128e24215be4865d741d2c34ba98b Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 16:05:09 -0500 Subject: [PATCH 05/27] remove tags --- .../book/migration-guides/0.9-0.10/_index.md | 266 ------------------ 1 file changed, 266 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 25a238f589..16c3537f98 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -15,11 +15,6 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel ### [bevy_reflect: Pre-parsed paths](https://github.com/bevyengine/bevy/pull/7321) -
-
Animation
-
Reflection
-
- `GetPath` methods have been renamed according to the following: - `path` -> `reflect_path` @@ -29,10 +24,6 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel ### [Remove App::add_sub_app](https://github.com/bevyengine/bevy/pull/7290) -
-
App
-
- `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` ```rust @@ -49,43 +40,23 @@ app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); ### [Make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) -
-
Assets
-
- Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. ### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) -
-
Core
-
- `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. ### [Remove broken `DoubleEndedIterator` impls on event iterators](https://github.com/bevyengine/bevy/pull/7469) -
-
ECS
-
- `ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. ### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) -
-
ECS
-
- - Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. - Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. ### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) -
-
ECS
-
- _Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ @@ -93,27 +64,15 @@ The trait method `ExclusiveSystemParamState::apply` has been removed. If you hav ### [Add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) -
-
ECS
-
- ### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) -
-
ECS
-
- - Changed `World::init_resource` to return the generated `ComponentId`. - Changed `World::init_non_send_resource` to return the generated `ComponentId`. ### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) -
-
ECS
-
- The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. ```rust @@ -134,10 +93,6 @@ fn parallel_system(query: Query<&MyComponent>) { ### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) -
-
ECS
-
- Exclusive systems (systems that access `&mut World`) now support system piping, so the `ExclusiveSystemParamFunction` trait now has generics for the `In`put and `Out`put types. ```rust @@ -154,26 +109,14 @@ where T: ExclusiveSystemParamFunction ### [Document alignment requirements of `Ptr`, `PtrMut` and `OwningPtr`](https://github.com/bevyengine/bevy/pull/7151) -
-
ECS
-
- Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. ### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) -
-
ECS
-
- Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. ### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) -
-
ECS
-
- Note: this replaces the migration guide for #6865. This is relative to Bevy 0.9, not main. @@ -215,42 +158,22 @@ unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} ### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) -
-
ECS
-
- A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. ### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) -
-
ECS
-
- `MutUntyped::into_inner` now marks things as changed. ### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) -
-
ECS
-
- _Merged with the guide for #6919._ ### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) -
-
ECS
-
- `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`. ### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) -
-
ECS
-
- `EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: ```rust @@ -267,10 +190,6 @@ fn clear_events(mut reader: EventReader) { ### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) -
-
ECS
-
- The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. ```rust @@ -289,30 +208,18 @@ struct MessageWriter<'w> { ### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) -
-
ECS
-
- `Entities`’s `Default` implementation has been removed. You can fetch a reference to a `World`’s `Entities` via `World::entities` and `World::entities_mut`. `Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue. ### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) -
-
ECS
-
- `ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case. `Archetype` and `Archetypes` are not constructible outside of `bevy_ecs` now. Use `World::archetypes` to get a read-only reference to either of these types. ### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) -
-
ECS
-
- Various low level APIs interacting with the change detection ticks no longer return `&UnsafeCell`, instead returning `TickCells` which contains two separate `&UnsafeCell`s instead. ```rust @@ -325,78 +232,38 @@ column.get_ticks(row).changed.deref() ### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) -
-
ECS
-
- `Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. ### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) -
-
ECS
-
- Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. ### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) -
-
ECS
-
Diagnostics
-
- ### [ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) -
-
ECS
-
Reflection
-
- Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. ### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) -
-
ECS
-
Scenes
-
- `World::iter_entities` now returns an iterator of `EntityRef` instead of `Entity`. To get the actual ID, use `EntityRef::id` from the returned `EntityRef`s. ### [Remove `BuildWorldChildren` impl from `WorldChildBuilder`](https://github.com/bevyengine/bevy/pull/6727) -
-
Hierarchy
-
- Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. ### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) -
-
Meta
-
- `dynamic` feature was renamed to `dynamic_linking` ### [Add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) -
-
Reflection
-
- Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. ### [Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) -
-
Reflection
-
Scenes
-
- This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types. This means any code relying on either of those type data existing for those glam types will need to not do that. This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: @@ -436,18 +303,10 @@ This also means that some serialized glam types will need to be updated. For exa ### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) -
-
Rendering
-
- `RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. ### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) -
-
Rendering
-
- ```rust // 0.9 let multi = Msaa { samples: 4 } @@ -460,18 +319,10 @@ multi.samples() ### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) -
-
Rendering
-
- Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. ### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) -
-
Rendering
-
- `TrackedRenderPass` now requires a `RenderDevice` to construct. To make this easier, use `RenderContext.begin_tracked_render_pass` instead. ```rust @@ -490,10 +341,6 @@ render_context.begin_tracked_render_pass(RenderPassDescriptor { ### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) -
-
Rendering
-
- ```rust // 0.9 Camera2dBundle { @@ -516,10 +363,6 @@ Camera2dBundle { ### [Enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) -
-
Rendering
-
- - evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. - setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. - usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. @@ -527,53 +370,29 @@ Camera2dBundle { ### [Run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) -
-
Rendering
-
- The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. ### [Get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) -
-
Rendering
-
- `PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. ### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) -
-
Rendering
-
- - replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` - if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders ### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) -
-
Rendering
-
- Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. ### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) -
-
Rendering
-
- Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. ### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) -
-
Rendering
-
- ```rust // 0.9 shape::Icosphere { @@ -593,39 +412,18 @@ shape::Icosphere { ### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) -
-
Rendering
-
Animation
-
- `ExtractedJoints` has been removed. Read the bound bones from `SkinnedMeshJoints` instead. ### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) -
-
Rendering
-
Assets
-
- No api changes are required, but it's possible that your gltf meshes look different ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) -
-
Rendering
-
Core
-
Time
-
- The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. ### [Migrate engine to Schedule v3](https://github.com/bevyengine/bevy/pull/7267) -
-
Rendering
-
ECS
-
- - Calls to `.label(MyLabel)` should be replaced with `.in_set(MySet)` - Stages have been removed. Replace these with system sets, and then add command flushes using the `apply_system_buffers` exclusive system where needed. - The `CoreStage`, `StartupStage,`RenderStage`and`AssetStage`enums have been replaced with`CoreSet`,`StartupSet, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. @@ -650,82 +448,42 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend ### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) -
-
Rendering
-
Tasks
-
- __App `runner` and SubApp `extract` functions are now required to be Send__ This was changed to enable pipelined rendering. If this breaks your use case please report it as these new bounds might be able to be relaxed. ### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) -
-
Rendering
-
UI
-
- The `background_color` field of `ExtractedUiNode` is now named `color`. ### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) -
-
Rendering
-
UI
-
- `ImageNode` never worked, if you were using it please create an issue. ### [Make `spawn_dynamic` return InstanceId](https://github.com/bevyengine/bevy/pull/6663) -
-
Scenes
-
- ### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) -
-
Transform
-
- ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) -
-
Transform
-
Hierarchy
-
- `GlobalTransform::translation_mut` has been removed without alternative, if you were relying on this, update the `Transform` instead. If the given entity had children or parent, you may need to remove its parent to make its transform independent (in which case the new `Commands::set_parent_in_place` and `Commands::remove_parent_in_place` may be of interest) Bevy may add in the future a way to toggle transform propagation on an entity basis. ### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) -
-
UI
-
- The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It’s unlikely to cause any issues with existing code. ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) -
-
UI
-
- `QueuedText` was never meant to be user facing. If you relied on it, please make an issue. ### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) -
-
UI
-
- The `alignment` field of `Text` now only affects the text’s internal alignment. __Change `TextAlignment` to TextAlignment` which is now an enum. Replace:__ @@ -740,26 +498,14 @@ __Changes for `Text2dBundle`__ ### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) -
-
UI
-
- `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` ### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) -
-
UI
-
- `TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. ### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) -
-
UI
-
- ```rust // 0.9 commands.spawn(ImageBundle { @@ -778,10 +524,6 @@ commands.spawn(ImageBundle { ### [Update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) -
-
Windowing
-
- ```rust // 0.9 app.new() @@ -806,18 +548,10 @@ app.new() ### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) -
-
Windowing
-
- ### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) -
-
Windowing
-
- - Replace `WindowDescriptor` with `Window`. - Change `width` and `height` fields in a `WindowResolution`, either by doing From f37dd4e45d80155c6aec065c3f5e2cd720e4a160 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 16:39:38 -0500 Subject: [PATCH 06/27] regenerate --- .../book/migration-guides/0.9-0.10/_index.md | 562 ++++++++++-------- 1 file changed, 330 insertions(+), 232 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 16c3537f98..a22cc32f0a 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -26,104 +26,120 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` +Old: + ```rust -// 0.9 let mut sub_app = App::new() // Build subapp here app.add_sub_app(MySubAppLabel, sub_app); +``` -// 0.10 +New: + +```rust let mut sub_app = App::new() // Build subapp here app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); ``` -### [Make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) +### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) -Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. +- Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. ### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) -`CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. +- `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. -### [Remove broken `DoubleEndedIterator` impls on event iterators](https://github.com/bevyengine/bevy/pull/7469) +### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) -`ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. +Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. -### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) +### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) -- Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. -- Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. +`Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. -### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) +### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) - -_Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ +Various low level APIs interacting with the change detection ticks no longer return `&UnsafeCell`, instead returning `TickCells` which contains two separate `&UnsafeCell`s instead. -The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. +```rust +// 0.9 +column.get_ticks(row).deref().changed -### [Add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) +// 0.10 +column.get_ticks(row).changed.deref() +``` - +### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) -### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) +`ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case. -- Changed `World::init_resource` to return the generated `ComponentId`. -- Changed `World::init_non_send_resource` to return the generated `ComponentId`. +`Archetype` and `Archetypes` are not constructible outside of `bevy_ecs` now. Use `World::archetypes` to get a read-only reference to either of these types. -### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) +### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) -The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. +`Entities`’s `Default` implementation has been removed. You can fetch a reference to a `World`’s `Entities` via `World::entities` and `World::entities_mut`. + +`Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue. + +### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) + +The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. ```rust -// 0.9 -fn parallel_system(query: Query<&MyComponent>) { - query.par_for_each(32, |comp| { - ... - }); +// Before +#[derive(SystemParam)] +struct MessageWriter<'w, 's> { + events: EventWriter<'w, 's, Message>, } -// 0.10 -fn parallel_system(query: Query<&MyComponent>) { - query.par_iter().for_each(|comp| { - ... - }); +// After +#[derive(SystemParam)] +struct MessageWriter<'w> { + events: EventWriter<'w, Message>, } ``` -### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) +### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) -Exclusive systems (systems that access `&mut World`) now support system piping, so the `ExclusiveSystemParamFunction` trait now has generics for the `In`put and `Out`put types. +`EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: ```rust -// 0.9 -fn my_generic_system(system_function: T) -where T: ExclusiveSystemParamFunction -{ ... } +// Old (0.9) +fn clear_events(reader: EventReader) { + reader.clear(); +} -// 0.10 -fn my_generic_system(system_function: T) -where T: ExclusiveSystemParamFunction -{ ... } +// New (0.10) +fn clear_events(mut reader: EventReader) { + reader.clear(); +} ``` -### [Document alignment requirements of `Ptr`, `PtrMut` and `OwningPtr`](https://github.com/bevyengine/bevy/pull/7151) +### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) -Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. + -### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) +### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) -Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. +_Merged with the guide for #6919._ + +### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) + +- `MutUntyped::into_inner` now marks things as changed. + +### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) + +A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. ### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) -Note: this replaces the migration guide for #6865. -This is relative to Bevy 0.9, not main. +Note: this replaces the migration guide for #6865. This is relative to Bevy 0.9, not main. The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. ```rust -// 0.9 +// Before (0.9) impl SystemParam for MyParam<'_, '_> { type State = MyParamState; } @@ -136,7 +152,7 @@ unsafe impl<'w, 's> SystemParamFetch<'w, 's> for MyParamState { } unsafe impl ReadOnlySystemParamFetch for MyParamState { } -// 0.10 +// After (0.10) unsafe impl SystemParam for MyParam<'_, '_> { type State = MyParamState; type Item<'w, 's> = MyParam<'w, 's>; @@ -149,102 +165,135 @@ unsafe impl ReadOnlySystemParam for MyParam<'_, '_> { } The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. ```rust -// 0.9 +// Before unsafe impl ReadOnlySystemParamFetch for MyParamState {} -// 0.10 +// After unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} ``` -### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) - -A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. +### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) -### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) +Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. -`MutUntyped::into_inner` now marks things as changed. +### [Document alignment requirements of `Ptr`, `PtrMut` and `OwningPtr`](https://github.com/bevyengine/bevy/pull/7151) -### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) +- Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. -_Merged with the guide for #6919._ +### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) -### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) +_Merged with the guide for #7675_. -`Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`. +### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) -### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) +The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. -`EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: +Before: ```rust -// 0.9 -fn clear_events(reader: EventReader) { - reader.clear(); +fn parallel_system(query: Query<&MyComponent>) { + query.par_for_each(32, |comp| { + ... + }); } +``` -// 0.10 -fn clear_events(mut reader: EventReader) { - reader.clear(); +After: + +```rust +fn parallel_system(query: Query<&MyComponent>) { + query.par_iter().for_each(|comp| { + ... + }); } ``` -### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) +### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) -The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. + -```rust -// 0.9 -#[derive(SystemParam)] -struct MessageWriter<'w, 's> { - events: EventWriter<'w, 's, Message>, -} +### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) -// 0.10 -#[derive(SystemParam)] -struct MessageWriter<'w> { - events: EventWriter<'w, Message>, -} -``` + -### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) +### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) -`Entities`’s `Default` implementation has been removed. You can fetch a reference to a `World`’s `Entities` via `World::entities` and `World::entities_mut`. +_Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ -`Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue. +The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. -### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) +### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) -`ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case. +- Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. +- Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. -`Archetype` and `Archetypes` are not constructible outside of `bevy_ecs` now. Use `World::archetypes` to get a read-only reference to either of these types. +### [Remove broken `DoubleEndedIterator` impls on event iterators](https://github.com/bevyengine/bevy/pull/7469) -### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) +`ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. -Various low level APIs interacting with the change detection ticks no longer return `&UnsafeCell`, instead returning `TickCells` which contains two separate `&UnsafeCell`s instead. +### [Rename `Tick::is_older_than` to `Tick::is_newer_than`](https://github.com/bevyengine/bevy/pull/7561) + +- Replace usages of `Tick::is_older_than` with `Tick::is_newer_than`. + +### [Rename `UnsafeWorldCellEntityRef` to `UnsafeEntityCell`](https://github.com/bevyengine/bevy/pull/7568) + +_Note for maintainers:_ This PR has no breaking changes relative to bevy 0.9. Instead of this PR having its own migration guide, we should just edit the changelog for #6404. + +The type `UnsafeWorldCellEntityRef` has been renamed to `UnsafeEntityCell`. + +### [Cleanup system sets called labels](https://github.com/bevyengine/bevy/pull/7678) + +`PrepareAssetLabel` is now called `PrepareAssetSet` + +### [Simplify generics for the `SystemParamFunction` trait](https://github.com/bevyengine/bevy/pull/7675) + +_The guide for #7023 has been merged into this one._ + +For the `SystemParamFunction` trait, the type parameters `In`, `Out`, and `Param` have been turned into associated types. ```rust -// 0.9 -column.get_ticks(row).deref().changed +// Before +fn my_generic_system(system_function: T) +where + T: SystemParamFunction, + T: Param: SystemParam, +{ ... } -// 0.10 -column.get_ticks(row).changed.deref() +// After +fn my_generic_system(system_function: T) +where + T: SystemParamFunction, +{ ... } ``` -### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) +For the `ExclusiveSystemParamFunction` trait, the type parameter `Param` has been turned into an associated type. Also, `In` and `Out` associated types have been added, since exclusive systems now support system piping. -`Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. +```rust +// Before +fn my_exclusive_system(system_function: T) +where + T: ExclusiveSystemParamFunction, + T: Param: ExclusiveSystemParam, +{ ... } -### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) +// After +fn my_exclusive_system(system_function: T) +where + T: ExclusiveSystemParamFunction, +{ ... } +``` -Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. +### [Cleanup ScheduleBuildSettings](https://github.com/bevyengine/bevy/pull/7721) + + ### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) - + -### [ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) +### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) -Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. +- Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. ### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) @@ -256,24 +305,77 @@ Hierarchy editing methods such as `with_children` and `push_children` have been ### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) -`dynamic` feature was renamed to `dynamic_linking` +- `dynamic` feature was renamed to `dynamic_linking` + +### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) + +- Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. + +### [bevy_reflect: Decouple `List` and `Array` traits](https://github.com/bevyengine/bevy/pull/7467) + +My guess for why we originally made `List` a subtrait of `Array` is that they share a lot of common operations. We could potentially move these overlapping methods to a `Sequence` (name taken from #7059) trait and make that a supertrait of both. This would allow functions to contain logic that simply operates on a sequence rather than “list vs array”. + +However, this means that we’d need to add methods for converting to a `dyn Sequence`. It also might be confusing since we wouldn’t add a `ReflectRef::Sequence` or anything like that. Is such a trait worth adding (either in this PR or a followup one)? -### [Add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) +The `List` trait is no longer dependent on `Array`. Implementors of `List` can remove the `Array` impl and move its methods into the `List` impl (with only a couple tweaks). -Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. +```rust +// BEFORE +impl Array for Foo { + fn get(&self, index: usize) -> Option<&dyn Reflect> {/* ... */} + fn get_mut(&mut self, index: usize) -> Option<&mut dyn Reflect> {/* ... */} + fn len(&self) -> usize {/* ... */} + fn is_empty(&self) -> bool {/* ... */} + fn iter(&self) -> ArrayIter {/* ... */} + fn drain(self: Box) -> Vec> {/* ... */} + fn clone_dynamic(&self) -> DynamicArray {/* ... */} +} + +impl List for Foo { + fn insert(&mut self, index: usize, element: Box) {/* ... */} + fn remove(&mut self, index: usize) -> Box {/* ... */} + fn push(&mut self, value: Box) {/* ... */} + fn pop(&mut self) -> Option> {/* ... */} + fn clone_dynamic(&self) -> DynamicList {/* ... */} +} -### [Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) +// AFTER +impl List for Foo { + fn get(&self, index: usize) -> Option<&dyn Reflect> {/* ... */} + fn get_mut(&mut self, index: usize) -> Option<&mut dyn Reflect> {/* ... */} + fn insert(&mut self, index: usize, element: Box) {/* ... */} + fn remove(&mut self, index: usize) -> Box {/* ... */} + fn push(&mut self, value: Box) {/* ... */} + fn pop(&mut self) -> Option> {/* ... */} + fn len(&self) -> usize {/* ... */} + fn is_empty(&self) -> bool {/* ... */} + fn iter(&self) -> ListIter {/* ... */} + fn drain(self: Box) -> Vec> {/* ... */} + fn clone_dynamic(&self) -> DynamicList {/* ... */} +} +``` + +Some other small tweaks that will need to be made include: + +- Use `ListIter` for `List::iter` instead of `ArrayIter` (the return type from `Array::iter`) +- Replace `array_hash` with `list_hash` in `Reflect::reflect_hash` for implementors of `List` + +### [implement `TypeUuid` for primitives and fix multiple-parameter generics having the same `TypeUuid`](https://github.com/bevyengine/bevy/pull/6633) + + + +### [bevy_reflect: Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types. This means any code relying on either of those type data existing for those glam types will need to not do that. This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: ```rust -// 0.9 +// BEFORE ( "glam::f32::affine3a::Affine3A": (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), -// 0.10 +// AFTER "glam::f32::affine3a::Affine3A": ( matrix3: ( x_axis: ( @@ -301,25 +403,43 @@ This also means that some serialized glam types will need to be updated. For exa ) ``` -### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) +### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) -`RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. +just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. -### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) +### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) -```rust -// 0.9 -let multi = Msaa { samples: 4 } -multi.samples + -// 0.10 -let multi = Msaa::Sample4 -multi.samples() -``` +### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) -### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) +Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. + +Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. + +### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) + +- replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` +- if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders + +### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) + +`PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. + +### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) + +The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. If you were ordering systems with clear_trackers this is no longer possible. -Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. +### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) + + + +### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) + +- evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. +- setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. +- usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. +- `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. ### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) @@ -339,76 +459,55 @@ render_context.begin_tracked_render_pass(RenderPassDescriptor { }); ``` -### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) +### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) + +- Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. + +### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) ```rust -// 0.9 -Camera2dBundle { - camera: Camera { - priority: 1, - ..default() - }, - ..default() -} +let multi = Msaa { samples: 4 } +// is now +let multi = Msaa::Sample4 -// 0.10 -Camera2dBundle { - camera: Camera { - order: 1, - ..default() - }, - ..default() -} +multi.samples +// is now +multi.samples() ``` -### [Enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) +### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) -- evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. -- setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. -- usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. -- `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. +`RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. -### [Run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) +### [Improve `OrthographicCamera` consistency and usability](https://github.com/bevyengine/bevy/pull/6201) -The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. +- Change `window_origin` to `viewport_origin`; replace `WindowOrigin::Center` with `Vec2::new(0.5, 0.5)` and `WindowOrigin::BottomLeft` with `Vec2::new(0.0, 0.0)` +- For shadow projections and such, replace `left`, `right`, `bottom`, and `top` with `area: Rect::new(left, bottom, right, top)` +- For camera projections, remove l/r/b/t values from `OrthographicProjection` instantiations, as they no longer have any effect in any `ScalingMode` +- Change `ScalingMode::None` to `ScalingMode::Fixed` + - Replace manual changes of l/r/b/t with: + - Arguments in `ScalingMode::Fixed` to specify size + - `viewport_origin` to specify offset -### [Get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) +- Change `ScalingMode::WindowSize` to `ScalingMode::WindowSize(1.0)` -`PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. +### [Changed &mut PipelineCache to &PipelineCache](https://github.com/bevyengine/bevy/pull/7598) -### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) +- `SpecializedComputePipelines::specialize` now takes a `&PipelineCache` instead of a `&mut PipelineCache` -- replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` -- if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders +### [Introduce detailed_trace macro, use in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7639) -### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) - -Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. +- Some detailed bevy trace events now require the use of the cargo feature `detailed_trace` in addition to enabling `TRACE` level logging to view. Should you wish to see these logs, please compile your code with the bevy feature `detailed_trace`. Currently, the only logs that are affected are the renderer logs pertaining to `TrackedRenderPass` functions -Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. +### [added subdivisions to shape::Plane](https://github.com/bevyengine/bevy/pull/7546) -### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) +All the examples needed to be updated to initalize the subdivisions field. Also there were two tests in tests/window that need to be updated. -Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. +A user would have to update all their uses of shape::Plane to initalize the subdivisions field. -### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) +### [Change standard material defaults and update docs](https://github.com/bevyengine/bevy/pull/7664) -```rust -// 0.9 -shape::Icosphere { - radius: 0.5, - subdivisions: 5, -} -.into() - -// 0.10 -shape::Icosphere { - radius: 0.5, - subdivisions: 5, -} -.try_into() -.unwrap() -``` +`StandardMaterial`’s default have now changed to be a fully dielectric material with medium roughness. If you want to use the old defaults, you can set `perceptual_roughness = 0.089` and `metallic = 0.01` (though metallic should generally only be set to 0.0 or 1.0). ### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) @@ -416,11 +515,11 @@ shape::Icosphere { ### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) -No api changes are required, but it's possible that your gltf meshes look different + ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) -The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. + ### [Migrate engine to Schedule v3](https://github.com/bevyengine/bevy/pull/7267) @@ -431,6 +530,7 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - `add_system(my_system.in_set(CoreSet::PostUpdate)` + - When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages - Run criteria have been renamed to run conditions. These can now be combined with each other and with states. - Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. @@ -452,21 +552,21 @@ __App `runner` and SubApp `extract` functions are now required to be Send__ This was changed to enable pipelined rendering. If this breaks your use case please report it as these new bounds might be able to be relaxed. -### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) +### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) -The `background_color` field of `ExtractedUiNode` is now named `color`. + -### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) +### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) -`ImageNode` never worked, if you were using it please create an issue. +- The `background_color` field of `ExtractedUiNode` is now named `color`. -### [Make `spawn_dynamic` return InstanceId](https://github.com/bevyengine/bevy/pull/6663) +### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) - + ### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) - + ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) @@ -474,13 +574,17 @@ The `background_color` field of `ExtractedUiNode` is now named `color`. Bevy may add in the future a way to toggle transform propagation on an entity basis. -### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) +### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) -The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It’s unlikely to cause any issues with existing code. + -### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) +### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) + + + +### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) -`QueuedText` was never meant to be user facing. If you relied on it, please make an issue. +- `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` ### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) @@ -496,64 +600,26 @@ __Changes for `Text2dBundle`__ `Text2dBundle` has a new field ‘text_anchor’ that takes an `Anchor` component that controls its position relative to its transform. -### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) - -`FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` - -### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) - -`TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. - -### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) +### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) -```rust -// 0.9 -commands.spawn(ImageBundle { - style: button_icon_style.clone(), - image: UiImage(icon), - ..default() -}); + -// 0.10 -commands.spawn(ImageBundle { - style: button_icon_style.clone(), - image: UiImage::new(icon), - ..default() -}); -``` +### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) -### [Update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) +The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It’s unlikely to cause any issues with existing code. -```rust -// 0.9 -app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { - always_on_top: true, - ..default() - }), - ..default() - })); +### [Fix the `Size` helper functions using the wrong default value and improve the UI examples](https://github.com/bevyengine/bevy/pull/7626) -// 0.10 -app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { - window_level: bevy::window::WindowLevel::AlwaysOnTop, - ..default() - }), - ..default() - })); -``` +The `Size::width` constructor function now sets the `height` to `Val::Auto` instead of `Val::Undefined`. The `Size::height` constructor function now sets the `width` to `Val::Auto` instead of `Val::Undefined`. -### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) +### [The `size` field of `CalculatedSize` should not be a `Size`](https://github.com/bevyengine/bevy/pull/7641) - +- The size field of `CalculatedSize` has been changed to a `Vec2`. ### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) - Replace `WindowDescriptor` with `Window`. -- Change `width` and `height` fields in a `WindowResolution`, either by doing + - Change `width` and `height` fields in a `WindowResolution`, either by doing ```rust WindowResolution::new(width, height) // Explicitly @@ -568,4 +634,36 @@ let window = commands.spawn(Window { ... }).id(); // open window commands.entity(window).despawn(); // close window ``` +### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) + + + +### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) + +before: + +```rust + app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + always_on_top: true, + ..default() + }), + ..default() + })); +``` + +after: + +```rust + app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + window_level: bevy::window::WindowLevel::AlwaysOnTop, + ..default() + }), + ..default() + })); +``` + From e6c91348f3f5b7f5e40763ccb4a9c3f16260fa48 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 16:46:05 -0500 Subject: [PATCH 07/27] manual clean up --- .../book/migration-guides/0.9-0.10/_index.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index a22cc32f0a..cae5b1d0ae 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -118,7 +118,7 @@ fn clear_events(mut reader: EventReader) { ### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) - +`Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`. ### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) @@ -130,7 +130,7 @@ _Merged with the guide for #6919._ ### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) -A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. +A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. ### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) @@ -210,11 +210,12 @@ fn parallel_system(query: Query<&MyComponent>) { ### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) - +- Changed `World::init_resource` to return the generated `ComponentId`. +- Changed `World::init_non_send_resource` to return the generated `ComponentId`. ### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) - + ### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) @@ -289,7 +290,7 @@ where ### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) - + ### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) @@ -515,11 +516,11 @@ A user would have to update all their uses of shape::Plane to initalize the subd ### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) - +No api changes are required, but it's possible that your gltf meshes look different ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) - +The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. ### [Migrate engine to Schedule v3](https://github.com/bevyengine/bevy/pull/7267) @@ -530,7 +531,6 @@ A user would have to update all their uses of shape::Plane to initalize the subd - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - `add_system(my_system.in_set(CoreSet::PostUpdate)` - - When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages - Run criteria have been renamed to run conditions. These can now be combined with each other and with states. - Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. @@ -554,7 +554,7 @@ This was changed to enable pipelined rendering. If this breaks your use case ple ### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) - +`ImageNode` never worked, if you were using it please create an issue. ### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) @@ -562,11 +562,11 @@ This was changed to enable pipelined rendering. If this breaks your use case ple ### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) - + ### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) - + ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) @@ -580,7 +580,7 @@ Bevy may add in the future a way to toggle transform propagation on an entity ba ### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) - +TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. ### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) @@ -602,7 +602,7 @@ __Changes for `Text2dBundle`__ ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) - +`QueuedText` was never meant to be user facing. If you relied on it, please make an issue. ### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) @@ -636,7 +636,7 @@ commands.entity(window).despawn(); // close window ### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) - + ### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) From c7f1236f45dc8ecdf2a62b64061bd7302fa96a8a Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 16:53:40 -0500 Subject: [PATCH 08/27] re add tags --- .../book/migration-guides/0.9-0.10/_index.md | 322 ++++++++++++++++++ 1 file changed, 322 insertions(+) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index cae5b1d0ae..38c964eec7 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -15,6 +15,11 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel ### [bevy_reflect: Pre-parsed paths](https://github.com/bevyengine/bevy/pull/7321) +
+
Animation
+
Reflection
+
+ `GetPath` methods have been renamed according to the following: - `path` -> `reflect_path` @@ -24,6 +29,10 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel ### [Remove App::add_sub_app](https://github.com/bevyengine/bevy/pull/7290) +
+
App
+
+ `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` Old: @@ -44,22 +53,42 @@ app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); ### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) +
+
Assets
+
+ - Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. ### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) +
+
Core
+
+ - `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. ### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) +
+
ECS
+
+ Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. ### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) +
+
ECS
+
+ `Table::component_capacity()` has been removed as Tables do not support adding/removing columns after construction. ### [Split Component Ticks](https://github.com/bevyengine/bevy/pull/6547) +
+
ECS
+
+ Various low level APIs interacting with the change detection ticks no longer return `&UnsafeCell`, instead returning `TickCells` which contains two separate `&UnsafeCell`s instead. ```rust @@ -72,18 +101,30 @@ column.get_ticks(row).changed.deref() ### [Document and lock down types in bevy_ecs::archetype](https://github.com/bevyengine/bevy/pull/6742) +
+
ECS
+
+ `ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case. `Archetype` and `Archetypes` are not constructible outside of `bevy_ecs` now. Use `World::archetypes` to get a read-only reference to either of these types. ### [Lock down access to Entities](https://github.com/bevyengine/bevy/pull/6740) +
+
ECS
+
+ `Entities`’s `Default` implementation has been removed. You can fetch a reference to a `World`’s `Entities` via `World::entities` and `World::entities_mut`. `Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue. ### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) +
+
ECS
+
+ The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. ```rust @@ -102,6 +143,10 @@ struct MessageWriter<'w> { ### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851) +
+
ECS
+
+ `EventReader::clear` now takes a mutable reference instead of consuming the event reader. This means that `clear` now needs explicit mutable access to the reader variable, which previously could have been omitted in some cases: ```rust @@ -118,22 +163,42 @@ fn clear_events(mut reader: EventReader) { ### [Newtype ArchetypeRow and TableRow](https://github.com/bevyengine/bevy/pull/4878) +
+
ECS
+
+ `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`. ### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) +
+
ECS
+
+ _Merged with the guide for #6919._ ### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) +
+
ECS
+
+ - `MutUntyped::into_inner` now marks things as changed. ### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) +
+
ECS
+
+ A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. ### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) +
+
ECS
+
+ Note: this replaces the migration guide for #6865. This is relative to Bevy 0.9, not main. The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. @@ -174,18 +239,34 @@ unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} ### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534) +
+
ECS
+
+ Normal resources and `NonSend` resources no longer share the same backing storage. If `R: Resource`, then `NonSend` and `Res` will return different instances from each other. If you are using both `Res` and `NonSend` (or their mutable variants), to fetch the same resources, it’s strongly advised to use `Res`. ### [Document alignment requirements of `Ptr`, `PtrMut` and `OwningPtr`](https://github.com/bevyengine/bevy/pull/7151) +
+
ECS
+
+ - Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. ### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) +
+
ECS
+
+ _Merged with the guide for #7675_. ### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) +
+
ECS
+
+ The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. Before: @@ -210,44 +291,80 @@ fn parallel_system(query: Query<&MyComponent>) { ### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284) +
+
ECS
+
+ - Changed `World::init_resource` to return the generated `ComponentId`. - Changed `World::init_non_send_resource` to return the generated `ComponentId`. ### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) +
+
ECS
+
+ ### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) +
+
ECS
+
+ _Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. ### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) +
+
ECS
+
+ - Add a `mut` for `removed: RemovedComponents` since we are now modifying an event reader internally. - Iterating over removed components now requires `&mut removed_components` or `removed_components.iter()` instead of `&removed_components`. ### [Remove broken `DoubleEndedIterator` impls on event iterators](https://github.com/bevyengine/bevy/pull/7469) +
+
ECS
+
+ `ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. ### [Rename `Tick::is_older_than` to `Tick::is_newer_than`](https://github.com/bevyengine/bevy/pull/7561) +
+
ECS
+
+ - Replace usages of `Tick::is_older_than` with `Tick::is_newer_than`. ### [Rename `UnsafeWorldCellEntityRef` to `UnsafeEntityCell`](https://github.com/bevyengine/bevy/pull/7568) +
+
ECS
+
+ _Note for maintainers:_ This PR has no breaking changes relative to bevy 0.9. Instead of this PR having its own migration guide, we should just edit the changelog for #6404. The type `UnsafeWorldCellEntityRef` has been renamed to `UnsafeEntityCell`. ### [Cleanup system sets called labels](https://github.com/bevyengine/bevy/pull/7678) +
+
ECS
+
+ `PrepareAssetLabel` is now called `PrepareAssetSet` ### [Simplify generics for the `SystemParamFunction` trait](https://github.com/bevyengine/bevy/pull/7675) +
+
ECS
+
+ _The guide for #7023 has been merged into this one._ For the `SystemParamFunction` trait, the type parameters `In`, `Out`, and `Param` have been turned into associated types. @@ -286,34 +403,69 @@ where ### [Cleanup ScheduleBuildSettings](https://github.com/bevyengine/bevy/pull/7721) +
+
ECS
+
+ ### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) +
+
ECS
+
Diagnostics
+
+ ### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206) +
+
ECS
+
Reflection
+
+ - Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. ### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) +
+
ECS
+
Scenes
+
+ `World::iter_entities` now returns an iterator of `EntityRef` instead of `Entity`. To get the actual ID, use `EntityRef::id` from the returned `EntityRef`s. ### [Remove `BuildWorldChildren` impl from `WorldChildBuilder`](https://github.com/bevyengine/bevy/pull/6727) +
+
Hierarchy
+
+ Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. ### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) +
+
Meta
+
+ - `dynamic` feature was renamed to `dynamic_linking` ### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) +
+
Reflection
+
+ - Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. ### [bevy_reflect: Decouple `List` and `Array` traits](https://github.com/bevyengine/bevy/pull/7467) +
+
Reflection
+
+ My guess for why we originally made `List` a subtrait of `Array` is that they share a lot of common operations. We could potentially move these overlapping methods to a `Sequence` (name taken from #7059) trait and make that a supertrait of both. This would allow functions to contain logic that simply operates on a sequence rather than “list vs array”. However, this means that we’d need to add methods for converting to a `dyn Sequence`. It also might be confusing since we wouldn’t add a `ReflectRef::Sequence` or anything like that. Is such a trait worth adding (either in this PR or a followup one)? @@ -363,10 +515,19 @@ Some other small tweaks that will need to be made include: ### [implement `TypeUuid` for primitives and fix multiple-parameter generics having the same `TypeUuid`](https://github.com/bevyengine/bevy/pull/6633) +
+
Reflection
+
+ ### [bevy_reflect: Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580) +
+
Reflection
+
Scenes
+
+ This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types. This means any code relying on either of those type data existing for those glam types will need to not do that. This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: @@ -406,37 +567,69 @@ This also means that some serialized glam types will need to be updated. For exa ### [Add AutoMax next to ScalingMode::AutoMin](https://github.com/bevyengine/bevy/pull/6496) +
+
Rendering
+
+ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. ### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) +
+
Rendering
+
+ ### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) +
+
Rendering
+
+ Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. ### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) +
+
Rendering
+
+ - replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` - if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders ### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) +
+
Rendering
+
+ `PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. ### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) +
+
Rendering
+
+ The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. If you were ordering systems with clear_trackers this is no longer possible. ### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) +
+
Rendering
+
+ ### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) +
+
Rendering
+
+ - evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. - setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. - usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. @@ -444,6 +637,10 @@ The call to `clear_trackers` in `App` has been moved from the schedule to App::u ### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) +
+
Rendering
+
+ `TrackedRenderPass` now requires a `RenderDevice` to construct. To make this easier, use `RenderContext.begin_tracked_render_pass` instead. ```rust @@ -462,10 +659,18 @@ render_context.begin_tracked_render_pass(RenderPassDescriptor { ### [Make PipelineCache internally mutable.](https://github.com/bevyengine/bevy/pull/7205) +
+
Rendering
+
+ - Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. ### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) +
+
Rendering
+
+ ```rust let multi = Msaa { samples: 4 } // is now @@ -478,10 +683,18 @@ multi.samples() ### [Support recording multiple CommandBuffers in RenderContext](https://github.com/bevyengine/bevy/pull/7248) +
+
Rendering
+
+ `RenderContext`’s fields are now private. Use the accessors on `RenderContext` instead, and construct it with `RenderContext::new`. ### [Improve `OrthographicCamera` consistency and usability](https://github.com/bevyengine/bevy/pull/6201) +
+
Rendering
+
+ - Change `window_origin` to `viewport_origin`; replace `WindowOrigin::Center` with `Vec2::new(0.5, 0.5)` and `WindowOrigin::BottomLeft` with `Vec2::new(0.0, 0.0)` - For shadow projections and such, replace `left`, `right`, `bottom`, and `top` with `area: Rect::new(left, bottom, right, top)` - For camera projections, remove l/r/b/t values from `OrthographicProjection` instantiations, as they no longer have any effect in any `ScalingMode` @@ -494,36 +707,73 @@ multi.samples() ### [Changed &mut PipelineCache to &PipelineCache](https://github.com/bevyengine/bevy/pull/7598) +
+
Rendering
+
+ - `SpecializedComputePipelines::specialize` now takes a `&PipelineCache` instead of a `&mut PipelineCache` ### [Introduce detailed_trace macro, use in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7639) +
+
Rendering
+
+ - Some detailed bevy trace events now require the use of the cargo feature `detailed_trace` in addition to enabling `TRACE` level logging to view. Should you wish to see these logs, please compile your code with the bevy feature `detailed_trace`. Currently, the only logs that are affected are the renderer logs pertaining to `TrackedRenderPass` functions ### [added subdivisions to shape::Plane](https://github.com/bevyengine/bevy/pull/7546) +
+
Rendering
+
+ All the examples needed to be updated to initalize the subdivisions field. Also there were two tests in tests/window that need to be updated. A user would have to update all their uses of shape::Plane to initalize the subdivisions field. ### [Change standard material defaults and update docs](https://github.com/bevyengine/bevy/pull/7664) +
+
Rendering
+
+ `StandardMaterial`’s default have now changed to be a fully dielectric material with medium roughness. If you want to use the old defaults, you can set `perceptual_roughness = 0.089` and `metallic = 0.01` (though metallic should generally only be set to 0.0 or 1.0). ### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) +
+
Rendering
+
Animation
+
+ `ExtractedJoints` has been removed. Read the bound bones from `SkinnedMeshJoints` instead. ### [Intepret glTF colors as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/6828) +
+
Rendering
+
Assets
+
+ No api changes are required, but it's possible that your gltf meshes look different ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676) +
+
Rendering
+
Core
+
Time
+
+ The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. ### [Migrate engine to Schedule v3](https://github.com/bevyengine/bevy/pull/7267) +
+
Rendering
+
ECS
+
+ - Calls to `.label(MyLabel)` should be replaced with `.in_set(MySet)` - Stages have been removed. Replace these with system sets, and then add command flushes using the `apply_system_buffers` exclusive system where needed. - The `CoreStage`, `StartupStage,`RenderStage`and`AssetStage`enums have been replaced with`CoreSet`,`StartupSet, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. @@ -548,46 +798,90 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend ### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) +
+
Rendering
+
Tasks
+
+ __App `runner` and SubApp `extract` functions are now required to be Send__ This was changed to enable pipelined rendering. If this breaks your use case please report it as these new bounds might be able to be relaxed. ### [Remove ImageMode](https://github.com/bevyengine/bevy/pull/6674) +
+
Rendering
+
UI
+
+ `ImageNode` never worked, if you were using it please create an issue. ### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) +
+
Rendering
+
UI
+
+ - The `background_color` field of `ExtractedUiNode` is now named `color`. ### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) +
+
Scenes
+
+ ### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) +
+
Transform
+
+ ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) +
+
Transform
+
Hierarchy
+
+ `GlobalTransform::translation_mut` has been removed without alternative, if you were relying on this, update the `Transform` instead. If the given entity had children or parent, you may need to remove its parent to make its transform independent (in which case the new `Commands::set_parent_in_place` and `Commands::remove_parent_in_place` may be of interest) Bevy may add in the future a way to toggle transform propagation on an entity basis. ### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) +
+
UI
+
+ ### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) +
+
UI
+
+ TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. ### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) +
+
UI
+
+ - `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` ### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) +
+
UI
+
+ The `alignment` field of `Text` now only affects the text’s internal alignment. __Change `TextAlignment` to TextAlignment` which is now an enum. Replace:__ @@ -602,22 +896,42 @@ __Changes for `Text2dBundle`__ ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) +
+
UI
+
+ `QueuedText` was never meant to be user facing. If you relied on it, please make an issue. ### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) +
+
UI
+
+ The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It’s unlikely to cause any issues with existing code. ### [Fix the `Size` helper functions using the wrong default value and improve the UI examples](https://github.com/bevyengine/bevy/pull/7626) +
+
UI
+
+ The `Size::width` constructor function now sets the `height` to `Val::Auto` instead of `Val::Undefined`. The `Size::height` constructor function now sets the `width` to `Val::Auto` instead of `Val::Undefined`. ### [The `size` field of `CalculatedSize` should not be a `Size`](https://github.com/bevyengine/bevy/pull/7641) +
+
UI
+
+ - The size field of `CalculatedSize` has been changed to a `Vec2`. ### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) +
+
Windowing
+
+ - Replace `WindowDescriptor` with `Window`. - Change `width` and `height` fields in a `WindowResolution`, either by doing @@ -636,10 +950,18 @@ commands.entity(window).despawn(); // close window ### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) +
+
Windowing
+
+ ### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) +
+
Windowing
+
+ before: ```rust From 10c9ed4f3dfd46f386e2a94d0aac6e98e357524a Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 21:27:42 -0500 Subject: [PATCH 09/27] remove unnecessary part --- content/learn/book/migration-guides/0.9-0.10/_index.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 38c964eec7..e631751109 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -466,10 +466,6 @@ Hierarchy editing methods such as `with_children` and `push_children` have been
Reflection
-My guess for why we originally made `List` a subtrait of `Array` is that they share a lot of common operations. We could potentially move these overlapping methods to a `Sequence` (name taken from #7059) trait and make that a supertrait of both. This would allow functions to contain logic that simply operates on a sequence rather than “list vs array”. - -However, this means that we’d need to add methods for converting to a `dyn Sequence`. It also might be confusing since we wouldn’t add a `ReflectRef::Sequence` or anything like that. Is such a trait worth adding (either in this PR or a followup one)? - The `List` trait is no longer dependent on `Array`. Implementors of `List` can remove the `Array` impl and move its methods into the `List` impl (with only a couple tweaks). ```rust From 3eaa8c653544d833da3f6f40b8f933be30d70626 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 21:29:24 -0500 Subject: [PATCH 10/27] soft breaks --- .../book/migration-guides/0.9-0.10/_index.md | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index e631751109..c95082f7d6 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -199,7 +199,8 @@ A `World` can only hold a maximum of 232 - 1 archetypes and tables no
ECS
-Note: this replaces the migration guide for #6865. This is relative to Bevy 0.9, not main. +Note: this replaces the migration guide for #6865. +This is relative to Bevy 0.9, not main. The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. @@ -384,7 +385,8 @@ where { ... } ``` -For the `ExclusiveSystemParamFunction` trait, the type parameter `Param` has been turned into an associated type. Also, `In` and `Out` associated types have been added, since exclusive systems now support system piping. +For the `ExclusiveSystemParamFunction` trait, the type parameter `Param` has been turned into an associated type. +Also, `In` and `Out` associated types have been added, since exclusive systems now support system piping. ```rust // Before @@ -442,7 +444,8 @@ where
Hierarchy
-Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. You can edit the hierarchy via `EntityMut` instead. +Hierarchy editing methods such as `with_children` and `push_children` have been removed from `WorldChildBuilder`. +You can edit the hierarchy via `EntityMut` instead. ### [Rename dynamic feature](https://github.com/bevyengine/bevy/pull/7340) @@ -583,9 +586,11 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Rendering
-Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. +Remove `.unwrap()` from `add_node_edge` and `add_slot_edge`. +For cases where the error was handled, use `try_add_node_edge` and `try_add_slot_edge` instead. -Remove `.unwrap()` from `input_node`. For cases where the option was handled, use `get_input_node` instead. +Remove `.unwrap()` from `input_node`. +For cases where the option was handled, use `get_input_node` instead. ### [Shader defs can now have a value](https://github.com/bevyengine/bevy/pull/5900) @@ -723,7 +728,8 @@ multi.samples()
Rendering
-All the examples needed to be updated to initalize the subdivisions field. Also there were two tests in tests/window that need to be updated. +All the examples needed to be updated to initalize the subdivisions field. +Also there were two tests in tests/window that need to be updated. A user would have to update all their uses of shape::Plane to initalize the subdivisions field. @@ -844,9 +850,14 @@ This was changed to enable pipelined rendering. If this breaks your use case ple
Hierarchy
-`GlobalTransform::translation_mut` has been removed without alternative, if you were relying on this, update the `Transform` instead. If the given entity had children or parent, you may need to remove its parent to make its transform independent (in which case the new `Commands::set_parent_in_place` and `Commands::remove_parent_in_place` may be of interest) +`GlobalTransform::translation_mut` has been removed without alternative, +if you were relying on this, update the `Transform` instead. If the given entity +had children or parent, you may need to remove its parent to make its transform +independent (in which case the new `Commands::set_parent_in_place` and +`Commands::remove_parent_in_place` may be of interest) -Bevy may add in the future a way to toggle transform propagation on an entity basis. +Bevy may add in the future a way to toggle transform propagation on +an entity basis. ### [Flip UI image](https://github.com/bevyengine/bevy/pull/6292) @@ -904,7 +915,8 @@ __Changes for `Text2dBundle`__
UI
-The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. It’s unlikely to cause any issues with existing code. +The default values for `Size` `width` and `height` have been changed from `Val::Undefined` to `Val::Auto`. +It’s unlikely to cause any issues with existing code. ### [Fix the `Size` helper functions using the wrong default value and improve the UI examples](https://github.com/bevyengine/bevy/pull/7626) @@ -912,7 +924,8 @@ The default values for `Size` `width` and `height` have been changed from `Val::
UI
-The `Size::width` constructor function now sets the `height` to `Val::Auto` instead of `Val::Undefined`. The `Size::height` constructor function now sets the `width` to `Val::Auto` instead of `Val::Undefined`. +The `Size::width` constructor function now sets the `height` to `Val::Auto` instead of `Val::Undefined`. +The `Size::height` constructor function now sets the `width` to `Val::Auto` instead of `Val::Undefined`. ### [The `size` field of `CalculatedSize` should not be a `Size`](https://github.com/bevyengine/bevy/pull/7641) From 174a418d177871d953146f29024e296b8906799f Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 18 Feb 2023 22:13:45 -0500 Subject: [PATCH 11/27] icosphere --- .../book/migration-guides/0.9-0.10/_index.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index c95082f7d6..5f3c912205 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -578,7 +578,22 @@ just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it.
Rendering
- +```rust +// 0.9 +shape::Icosphere { + radius: 0.5, + subdivisions: 5, +} +.into() + +// 0.10 +shape::Icosphere { + radius: 0.5, + subdivisions: 5, +} +.try_into() +.unwrap() +``` ### [Add try_* to add_slot_edge, add_node_edge](https://github.com/bevyengine/bevy/pull/6720) From 51474f94207b6eaae8ff3685407843fa7de7ff7e Mon Sep 17 00:00:00 2001 From: IceSentry Date: Mon, 20 Feb 2023 15:20:37 -0500 Subject: [PATCH 12/27] generate --- .../book/migration-guides/0.9-0.10/_index.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 5f3c912205..f3615dcf4b 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -411,6 +411,34 @@ where +### [Deprecate `ChangeTrackers` in favor of `Ref`](https://github.com/bevyengine/bevy/pull/7306) + +
+
ECS
+
+ +`ChangeTrackers` has been deprecated, and will be removed in the next release. Any usage should be replaced with `Ref`. + +```rust +// Before (0.9) +fn my_system(q: Query<(&MyComponent, ChangeTrackers)>) { + for (value, trackers) in &q { + if trackers.is_changed() { + // Do something with `value`. + } + } +} + +// After (0.10) +fn my_system(q: Query>) { + for value in &q { + if value.is_changed() { + // Do something with `value`. + } + } +} +``` + ### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900)
From 4349dc1187105ebd66df531c5c0df1741c1bb62e Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 00:55:24 -0500 Subject: [PATCH 13/27] generate --- .../book/migration-guides/0.9-0.10/_index.md | 62 +++++++++++++++---- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index f3615dcf4b..f8a863af4f 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -204,6 +204,8 @@ This is relative to Bevy 0.9, not main. The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. +The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. + ```rust // Before (0.9) impl SystemParam for MyParam<'_, '_> { @@ -228,16 +230,6 @@ unsafe impl SystemParam for MyParam<'_, '_> { unsafe impl ReadOnlySystemParam for MyParam<'_, '_> { } ``` -The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. - -```rust -// Before -unsafe impl ReadOnlySystemParamFetch for MyParamState {} - -// After -unsafe impl ReadOnlySystemParam for MyParam<'_, '_> {} -``` - ### [Panic on dropping NonSend in non-origin thread.](https://github.com/bevyengine/bevy/pull/6534)
@@ -439,6 +431,44 @@ fn my_system(q: Query>) { } ``` +### [Make boxed conditions read-only](https://github.com/bevyengine/bevy/pull/7786) + +
+
ECS
+
+ + + +### [`EntityMut`: rename `remove_intersection` to `remove` and `remove` to `take`](https://github.com/bevyengine/bevy/pull/7810) + +
+
ECS
+
+ +Before + +```rust +fn clear_children(parent: Entity, world: &mut World) { + if let Some(children) = world.entity_mut(parent).remove::() { + for &child in &children.0 { + world.entity_mut(child).remove_intersection::(); + } + } +} +``` + +After + +```rust +fn clear_children(parent: Entity, world: &mut World) { + if let Some(children) = world.entity_mut(parent).take::() { + for &child in &children.0 { + world.entity_mut(child).remove::(); + } + } +} +``` + ### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900)
@@ -489,7 +519,8 @@ You can edit the hierarchy via `EntityMut` instead.
Reflection
-- Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. +- Manual implementors of `List` need to implement the new methods `insert` and `remove` and +consider whether to use the new default implementation of `push` and `pop`. ### [bevy_reflect: Decouple `List` and `Array` traits](https://github.com/bevyengine/bevy/pull/7467) @@ -784,6 +815,14 @@ A user would have to update all their uses of shape::Plane to initalize the subd `StandardMaterial`’s default have now changed to be a fully dielectric material with medium roughness. If you want to use the old defaults, you can set `perceptual_roughness = 0.089` and `metallic = 0.01` (though metallic should generally only be set to 0.0 or 1.0). +### [Remove dead code after #7784](https://github.com/bevyengine/bevy/pull/7875) + +
+
Rendering
+
+ +- Removed `SetShadowViewBindGroup`, `queue_shadow_view_bind_group()`, and `LightMeta::shadow_view_bind_group` in favor of reusing the prepass view bind group. + ### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833)
@@ -826,6 +865,7 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - `add_system(my_system.in_set(CoreSet::PostUpdate)` + - When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages - Run criteria have been renamed to run conditions. These can now be combined with each other and with states. - Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. From 7a9b83158c67267c98202bade736de9bd07607f7 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 01:07:18 -0500 Subject: [PATCH 14/27] Apply suggestions from code review Co-authored-by: Edgar Geier Co-authored-by: Afonso Lage Co-authored-by: TimJentzsch Co-authored-by: Rob Parrett --- .../book/migration-guides/0.9-0.10/_index.md | 141 ++++-------------- 1 file changed, 26 insertions(+), 115 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index f8a863af4f..0401458965 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -33,14 +33,15 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel
App
-`App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::add_sub_app` +`App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::insert_sub_app` + Old: ```rust let mut sub_app = App::new() // Build subapp here -app.add_sub_app(MySubAppLabel, sub_app); +app.add_sub_app(MySubAppLabel, sub_app, extract_fn); ``` New: @@ -67,14 +68,6 @@ app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); - `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. -### [Remove redundant table and sparse set component IDs from Archetype](https://github.com/bevyengine/bevy/pull/4927) - -
-
ECS
-
- -Do I still need to do this? I really hope people were not relying on the public facing APIs changed here. - ### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928)
@@ -105,7 +98,7 @@ column.get_ticks(row).changed.deref()
ECS
-`ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case. +`ArchetypeId`, `ArchetypeGeneration`, and `ArchetypeComponentId` are all now opaque IDs and cannot be turned into a numeric value. Please file an issue if this does not work for your use case or check [bevy_ecs is excessively public](https://github.com/bevyengine/bevy/issues/3362) for more info. `Archetype` and `Archetypes` are not constructible outside of `bevy_ecs` now. Use `World::archetypes` to get a read-only reference to either of these types. @@ -117,7 +110,7 @@ column.get_ticks(row).changed.deref() `Entities`’s `Default` implementation has been removed. You can fetch a reference to a `World`’s `Entities` via `World::entities` and `World::entities_mut`. -`Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue. +`Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue or check [bevy_ecs is excessively public](https://github.com/bevyengine/bevy/issues/3362) for more info. ### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) @@ -169,29 +162,28 @@ fn clear_events(mut reader: EventReader) { `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`. -### [Simplify trait hierarchy for `SystemParam`](https://github.com/bevyengine/bevy/pull/6865) +### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009)
ECS
-_Merged with the guide for #6919._ +- `MutUntyped::into_inner` now marks things as changed. -### [Round out the untyped api s](https://github.com/bevyengine/bevy/pull/7009) +### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681)
ECS
-- `MutUntyped::into_inner` now marks things as changed. - -### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) +A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. +### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489)
ECS
-A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. +The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. ### [Remove the `SystemParamState` trait and remove types like `ResState`](https://github.com/bevyengine/bevy/pull/6919) @@ -199,9 +191,6 @@ A `World` can only hold a maximum of 232 - 1 archetypes and tables no
ECS
-Note: this replaces the migration guide for #6865. -This is relative to Bevy 0.9, not main. - The traits `SystemParamState` and `SystemParamFetch` have been removed, and their functionality has been transferred to `SystemParam`. The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. @@ -246,14 +235,6 @@ Normal resources and `NonSend` resources no longer share the same backing storag - Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. -### [Support piping exclusive systems](https://github.com/bevyengine/bevy/pull/7023) - -
-
ECS
-
- -_Merged with the guide for #7675_. - ### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777)
@@ -287,7 +268,7 @@ fn parallel_system(query: Query<&MyComponent>) {
ECS
- +- Added `Components::resource_id`. - Changed `World::init_resource` to return the generated `ComponentId`. - Changed `World::init_non_send_resource` to return the generated `ComponentId`. @@ -297,17 +278,7 @@ fn parallel_system(query: Query<&MyComponent>) {
ECS
- - -### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489) - -
-
ECS
-
- -_Note for maintainers: this migration guide makes more sense if it’s placed above the one for #6919._ - -The trait method `ExclusiveSystemParamState::apply` has been removed. If you have an exclusive system with buffers that must be applied, you should apply them within the body of the exclusive system. +The type UnsafeWorldCellEntityRef has been renamed to UnsafeEntityCell ### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) @@ -324,7 +295,7 @@ The trait method `ExclusiveSystemParamState::apply` has been removed. If you hav
ECS
-`ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s. +`ManualEventIterator` and `ManualEventIteratorWithId` are no longer `DoubleEndedIterator`s since the impls didn't work correctly, and any code using this was likely broken. ### [Rename `Tick::is_older_than` to `Tick::is_newer_than`](https://github.com/bevyengine/bevy/pull/7561) @@ -334,16 +305,6 @@ The trait method `ExclusiveSystemParamState::apply` has been removed. If you hav - Replace usages of `Tick::is_older_than` with `Tick::is_newer_than`. -### [Rename `UnsafeWorldCellEntityRef` to `UnsafeEntityCell`](https://github.com/bevyengine/bevy/pull/7568) - -
-
ECS
-
- -_Note for maintainers:_ This PR has no breaking changes relative to bevy 0.9. Instead of this PR having its own migration guide, we should just edit the changelog for #6404. - -The type `UnsafeWorldCellEntityRef` has been renamed to `UnsafeEntityCell`. - ### [Cleanup system sets called labels](https://github.com/bevyengine/bevy/pull/7678)
@@ -358,8 +319,6 @@ The type `UnsafeWorldCellEntityRef` has been renamed to `UnsafeEntityCell`.
ECS
-_The guide for #7023 has been merged into this one._ - For the `SystemParamFunction` trait, the type parameters `In`, `Out`, and `Param` have been turned into associated types. ```rust @@ -395,14 +354,6 @@ where { ... } ``` -### [Cleanup ScheduleBuildSettings](https://github.com/bevyengine/bevy/pull/7721) - -
-
ECS
-
- - - ### [Deprecate `ChangeTrackers` in favor of `Ref`](https://github.com/bevyengine/bevy/pull/7306)
@@ -469,15 +420,6 @@ fn clear_children(parent: Entity, world: &mut World) { } ``` -### [Move system_commands spans into apply_buffers](https://github.com/bevyengine/bevy/pull/6900) - -
-
ECS
-
Diagnostics
-
- - - ### [bevy_ecs: ReflectComponentFns without World](https://github.com/bevyengine/bevy/pull/7206)
@@ -571,14 +513,6 @@ Some other small tweaks that will need to be made include: - Use `ListIter` for `List::iter` instead of `ArrayIter` (the return type from `Array::iter`) - Replace `array_hash` with `list_hash` in `Reflect::reflect_hash` for implementors of `List` -### [implement `TypeUuid` for primitives and fix multiple-parameter generics having the same `TypeUuid`](https://github.com/bevyengine/bevy/pull/6633) - -
-
Reflection
-
- - - ### [bevy_reflect: Remove `ReflectSerialize` and `ReflectDeserialize` registrations from most glam types](https://github.com/bevyengine/bevy/pull/6580)
@@ -629,7 +563,7 @@ This also means that some serialized glam types will need to be updated. For exa
Rendering
-just rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. + - Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. ### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) @@ -673,7 +607,7 @@ For cases where the option was handled, use `get_input_node` instead.
- replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` -- if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in Bevy default shaders +- if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in [Bevy default shaders](https://github.com/bevyengine/bevy/blob/3ec87e49ca49767fad658e72fbae353f6687198c/crates/bevy_pbr/src/render/mesh_view_bindings.wgsl#L28) ### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) @@ -689,7 +623,7 @@ For cases where the option was handled, use `get_input_node` instead.
Rendering
-The call to `clear_trackers` in `App` has been moved from the schedule to App::update for the main world and calls to `clear_trackers` have been added for sub_apps in the same function. This was due to needing stronger guarantees. If clear_trackers isn’t called on a world it can lead to memory leaks in `RemovedComponents`. If you were ordering systems with clear_trackers this is no longer possible. +The call to `clear_trackers` in `App` has been moved from the schedule to `App::update` for the main world and calls to `clear_trackers` have been added for `sub_apps` in the same function. This was due to needing stronger guarantees. If `clear_trackers` isn’t called on a world it can lead to memory leaks in `RemovedComponents`. If you were ordering systems with `clear_trackers` this is no longer possible. ### [Rename camera "priority" to "order"](https://github.com/bevyengine/bevy/pull/6908) @@ -697,7 +631,7 @@ The call to `clear_trackers` in `App` has been moved from the schedule to App::u
Rendering
- +- Rename `priority` to `order` in usage of `Camera`. ### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) @@ -802,10 +736,7 @@ multi.samples()
Rendering
-All the examples needed to be updated to initalize the subdivisions field. -Also there were two tests in tests/window that need to be updated. - -A user would have to update all their uses of shape::Plane to initalize the subdivisions field. +- `shape::Plane` now takes an additional `subdivisions` parameter so users should provide it or use the new `shape::Plane::from_size`. ### [Change standard material defaults and update docs](https://github.com/bevyengine/bevy/pull/7664) @@ -864,7 +795,8 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend - Systems are no longer added to `CoreSet::Update` by default. Add systems manually if this behavior is needed, although you should consider adding your game logic systems to `CoreSchedule::FixedTimestep` instead for more reliable framerate-independent behavior. - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - - `add_system(my_system.in_set(CoreSet::PostUpdate)` + - `add_system(my_system.in_base_set(CoreSet::PostUpdate)` + - When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages - Run criteria have been renamed to run conditions. These can now be combined with each other and with states. @@ -877,7 +809,8 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend - `App::add_state` now takes 0 arguments: the starting state is set based on the `Default` impl. - Instead of creating `SystemSet` containers for systems that run in stages, simply use `.on_enter::()` or its `on_exit` or `on_update` siblings. - `SystemLabel` derives should be replaced with `SystemSet`. You will also need to add the `Debug`, `PartialEq`, `Eq`, and `Hash` traits to satisfy the new trait bounds. -- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a bool. +- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a `bool` instead of `schedule::ShouldRun`. + - States have been dramatically simplified: there is no longer a “state stack”. To queue a transition to the next state, call `NextState::set` - Strings can no longer be used as a `SystemLabel` or `SystemSet`. Use a type, or use the system function instead. @@ -910,22 +843,6 @@ This was changed to enable pipelined rendering. If this breaks your use case ple - The `background_color` field of `ExtractedUiNode` is now named `color`. -### [Make spawn_dynamic return InstanceId](https://github.com/bevyengine/bevy/pull/6663) - -
-
Scenes
-
- - - -### [Parallelized transform propagation](https://github.com/bevyengine/bevy/pull/4775) - -
-
Transform
-
- - - ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134)
@@ -948,7 +865,8 @@ an entity basis.
UI
- +- `UiImage` is a struct now, so use `UiImage::new(handler)` instead of `UiImage(handler)` +- `UiImage` no longer implements `Deref` and `DereftMut`, so use `&image.texture` or ``&mut image.texture` instead ### [Remove `TextError::ExceedMaxTextAtlases(usize)` variant](https://github.com/bevyengine/bevy/pull/6796) @@ -984,6 +902,7 @@ __Changes for `Text2dBundle`__ `Text2dBundle` has a new field ‘text_anchor’ that takes an `Anchor` component that controls its position relative to its transform. +`Text2dSize` was removed. Use `TextLayoutInfo` instead. ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414)
@@ -1040,14 +959,6 @@ let window = commands.spawn(Window { ... }).id(); // open window commands.entity(window).despawn(); // close window ``` -### [Allow not preventing default event behaviors on wasm](https://github.com/bevyengine/bevy/pull/7304) - -
-
Windowing
-
- - - ### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480)
From 98ca8a8b3279a084e89958daf1eeff77d7949b13 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 01:10:06 -0500 Subject: [PATCH 15/27] clean up --- .../book/migration-guides/0.9-0.10/_index.md | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 0401458965..cc25bcc49a 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -35,7 +35,6 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::insert_sub_app` - Old: ```rust @@ -177,6 +176,7 @@ fn clear_events(mut reader: EventReader) {
A `World` can only hold a maximum of 232 - 1 archetypes and tables now. If your use case requires more than this, please file an issue explaining your use case. + ### [Remove `ExclusiveSystemParam::apply`](https://github.com/bevyengine/bevy/pull/7489)
@@ -563,7 +563,7 @@ This also means that some serialized glam types will need to be updated. For exa
Rendering
- - Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. +- Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. ### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) @@ -797,7 +797,6 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - `add_system(my_system.in_base_set(CoreSet::PostUpdate)` - - When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages - Run criteria have been renamed to run conditions. These can now be combined with each other and with states. - Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. @@ -903,6 +902,7 @@ __Changes for `Text2dBundle`__ `Text2dBundle` has a new field ‘text_anchor’ that takes an `Anchor` component that controls its position relative to its transform. `Text2dSize` was removed. Use `TextLayoutInfo` instead. + ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414)
@@ -959,6 +959,26 @@ let window = commands.spawn(Window { ... }).id(); // open window commands.entity(window).despawn(); // close window ``` +Now that windows are components on entity, you should use `Query` instead of `Res` to access windows. + +```rust +// 0.9 +fn count_pixels(windows: Res) { + let Some(primary) = windows.get_primary() else { + return; + }; + println!("{}", primary.width() * primary.height()); +} + +// 0.10 +fn count_pixels(primary_query: Query<&Window, With>) { + let Ok(primary) = primary_query.get_single() else { + return; + }; + println!("{}", primary.width() * primary.height()); +} +``` + ### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480)
From 0835eada9cc783639117b0a02cf307676ef204ce Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 01:10:32 -0500 Subject: [PATCH 16/27] Apply suggestions from code review Co-authored-by: ickshonpe Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.9-0.10/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index cc25bcc49a..487da27971 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -831,7 +831,7 @@ This was changed to enable pipelined rendering. If this breaks your use case ple
UI
-`ImageNode` never worked, if you were using it please create an issue. +`ImageMode` never worked, if you were using it please create an issue. ### [Rename the `background_color` of 'ExtractedUiNode` to `color`](https://github.com/bevyengine/bevy/pull/7452) @@ -901,6 +901,7 @@ __Changes for `Text2dBundle`__ `Text2dBundle` has a new field ‘text_anchor’ that takes an `Anchor` component that controls its position relative to its transform. +`Text2dSize` was removed. Use `TextLayoutInfo` instead. `Text2dSize` was removed. Use `TextLayoutInfo` instead. ### [Remove `QueuedText`](https://github.com/bevyengine/bevy/pull/7414) From ffd1f72568c883bd856e4016195be7b1fcf18f96 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 01:34:48 -0500 Subject: [PATCH 17/27] Clean up --- .../book/migration-guides/0.9-0.10/_index.md | 151 ++++++++---------- 1 file changed, 69 insertions(+), 82 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 487da27971..a2eacbd9c2 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -35,29 +35,25 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel `App::add_sub_app` has been removed in favor of `App::insert_sub_app`. Use `SubApp::new` and insert it via `App::insert_sub_app` -Old: - ```rust +// 0.9 let mut sub_app = App::new() // Build subapp here app.add_sub_app(MySubAppLabel, sub_app, extract_fn); -``` -New: - -```rust +// 0.10 let mut sub_app = App::new() // Build subapp here app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn)); ``` -### [asset: make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076) +### [Make HandleUntyped::id private](https://github.com/bevyengine/bevy/pull/7076)
Assets
-- Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. +Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use the new getter `handle.id()`. ### [Break `CorePlugin` into `TaskPoolPlugin`, `TypeRegistrationPlugin`, `FrameCountPlugin`.](https://github.com/bevyengine/bevy/pull/7083) @@ -65,7 +61,7 @@ app.insert_sub_app(MySubAppLabel, SubApp::new(sub_app, extract_fn));
Core
-- `CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. +`CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. ### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) @@ -120,13 +116,13 @@ column.get_ticks(row).changed.deref() The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. ```rust -// Before +// 0.9 #[derive(SystemParam)] struct MessageWriter<'w, 's> { events: EventWriter<'w, 's, Message>, } -// After +// 0.10 #[derive(SystemParam)] struct MessageWriter<'w> { events: EventWriter<'w, Message>, @@ -167,7 +163,7 @@ fn clear_events(mut reader: EventReader) {
ECS
-- `MutUntyped::into_inner` now marks things as changed. +`MutUntyped::into_inner` now marks things as changed. ### [Extend EntityLocation with TableId and TableRow](https://github.com/bevyengine/bevy/pull/6681) @@ -196,7 +192,7 @@ The traits `SystemParamState` and `SystemParamFetch` have been removed, and thei The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. ```rust -// Before (0.9) +// 0.9 (0.9) impl SystemParam for MyParam<'_, '_> { type State = MyParamState; } @@ -209,7 +205,7 @@ unsafe impl<'w, 's> SystemParamFetch<'w, 's> for MyParamState { } unsafe impl ReadOnlySystemParamFetch for MyParamState { } -// After (0.10) +// 0.10 (0.10) unsafe impl SystemParam for MyParam<'_, '_> { type State = MyParamState; type Item<'w, 's> = MyParam<'w, 's>; @@ -233,7 +229,7 @@ Normal resources and `NonSend` resources no longer share the same backing storag
ECS
-- Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. +Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. ### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) @@ -243,19 +239,15 @@ Normal resources and `NonSend` resources no longer share the same backing storag The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. -Before: - ```rust +// 0.9 fn parallel_system(query: Query<&MyComponent>) { query.par_for_each(32, |comp| { ... }); } -``` - -After: -```rust +// 0.10 fn parallel_system(query: Query<&MyComponent>) { query.par_iter().for_each(|comp| { ... @@ -268,11 +260,12 @@ fn parallel_system(query: Query<&MyComponent>) {
ECS
+ - Added `Components::resource_id`. - Changed `World::init_resource` to return the generated `ComponentId`. - Changed `World::init_non_send_resource` to return the generated `ComponentId`. -### [add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404) +### [Add `UnsafeWorldCell` abstraction](https://github.com/bevyengine/bevy/pull/6404)
ECS
@@ -303,7 +296,7 @@ The type UnsafeWorldCellEntityRef has been renamed to UnsafeEntityCell
ECS
-- Replace usages of `Tick::is_older_than` with `Tick::is_newer_than`. +Replace usages of `Tick::is_older_than` with `Tick::is_newer_than`. ### [Cleanup system sets called labels](https://github.com/bevyengine/bevy/pull/7678) @@ -322,14 +315,14 @@ The type UnsafeWorldCellEntityRef has been renamed to UnsafeEntityCell For the `SystemParamFunction` trait, the type parameters `In`, `Out`, and `Param` have been turned into associated types. ```rust -// Before +// 0.9 fn my_generic_system(system_function: T) where T: SystemParamFunction, T: Param: SystemParam, { ... } -// After +// 0.10 fn my_generic_system(system_function: T) where T: SystemParamFunction, @@ -340,14 +333,14 @@ For the `ExclusiveSystemParamFunction` trait, the type parameter `Param` has bee Also, `In` and `Out` associated types have been added, since exclusive systems now support system piping. ```rust -// Before +// 0.9 fn my_exclusive_system(system_function: T) where T: ExclusiveSystemParamFunction, T: Param: ExclusiveSystemParam, { ... } -// After +// 0.10 fn my_exclusive_system(system_function: T) where T: ExclusiveSystemParamFunction, @@ -363,7 +356,7 @@ where `ChangeTrackers` has been deprecated, and will be removed in the next release. Any usage should be replaced with `Ref`. ```rust -// Before (0.9) +// 0.9 (0.9) fn my_system(q: Query<(&MyComponent, ChangeTrackers)>) { for (value, trackers) in &q { if trackers.is_changed() { @@ -372,7 +365,7 @@ fn my_system(q: Query<(&MyComponent, ChangeTrackers)>) { } } -// After (0.10) +// 0.10 (0.10) fn my_system(q: Query>) { for value in &q { if value.is_changed() { @@ -396,9 +389,8 @@ fn my_system(q: Query>) {
ECS
-Before - ```rust +// 0.9 fn clear_children(parent: Entity, world: &mut World) { if let Some(children) = world.entity_mut(parent).remove::() { for &child in &children.0 { @@ -406,11 +398,8 @@ fn clear_children(parent: Entity, world: &mut World) { } } } -``` - -After -```rust +// 0.10 fn clear_children(parent: Entity, world: &mut World) { if let Some(children) = world.entity_mut(parent).take::() { for &child in &children.0 { @@ -427,7 +416,7 @@ fn clear_children(parent: Entity, world: &mut World) {
Reflection
-- Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. +Call `World::entity` before calling into the changed `ReflectComponent` methods, most likely user already has a `EntityRef` or `EntityMut` which was being queried redundantly. ### [Allow iterating over with EntityRef over the entire World](https://github.com/bevyengine/bevy/pull/6843) @@ -453,15 +442,15 @@ You can edit the hierarchy via `EntityMut` instead.
Meta
-- `dynamic` feature was renamed to `dynamic_linking` +`dynamic` feature was renamed to `dynamic_linking` -### [reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063) +### [bevy_reflect: add `insert` and `remove` methods to `List`](https://github.com/bevyengine/bevy/pull/7063)
Reflection
-- Manual implementors of `List` need to implement the new methods `insert` and `remove` and +Manual implementors of `List` need to implement the new methods `insert` and `remove` and consider whether to use the new default implementation of `push` and `pop`. ### [bevy_reflect: Decouple `List` and `Array` traits](https://github.com/bevyengine/bevy/pull/7467) @@ -473,7 +462,7 @@ consider whether to use the new default implementation of `push` and `pop`. The `List` trait is no longer dependent on `Array`. Implementors of `List` can remove the `Array` impl and move its methods into the `List` impl (with only a couple tweaks). ```rust -// BEFORE +// 0.9 impl Array for Foo { fn get(&self, index: usize) -> Option<&dyn Reflect> {/* ... */} fn get_mut(&mut self, index: usize) -> Option<&mut dyn Reflect> {/* ... */} @@ -492,7 +481,7 @@ impl List for Foo { fn clone_dynamic(&self) -> DynamicList {/* ... */} } -// AFTER +// 0.10 impl List for Foo { fn get(&self, index: usize) -> Option<&dyn Reflect> {/* ... */} fn get_mut(&mut self, index: usize) -> Option<&mut dyn Reflect> {/* ... */} @@ -525,11 +514,11 @@ This PR removes `ReflectSerialize` and `ReflectDeserialize` registrations from m This also means that some serialized glam types will need to be updated. For example, here is `Affine3A`: ```rust -// BEFORE +// 0.9 ( "glam::f32::affine3a::Affine3A": (1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0), -// AFTER +// 0.10 "glam::f32::affine3a::Affine3A": ( matrix3: ( x_axis: ( @@ -563,7 +552,7 @@ This also means that some serialized glam types will need to be updated. For exa
Rendering
-- Rename `ScalingMode::Auto` to `ScalingMode::AutoMin` if you are using it. +Rename `ScalingMode::Auto` to `ScalingMode::AutoMin`. ### [Change `From` to `TryFrom`](https://github.com/bevyengine/bevy/pull/6484) @@ -609,7 +598,7 @@ For cases where the option was handled, use `get_input_node` instead. - replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` - if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in [Bevy default shaders](https://github.com/bevyengine/bevy/blob/3ec87e49ca49767fad658e72fbae353f6687198c/crates/bevy_pbr/src/render/mesh_view_bindings.wgsl#L28) -### [get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) +### [Get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820)
Rendering
@@ -617,7 +606,7 @@ For cases where the option was handled, use `get_input_node` instead. `PixelInfo` has been removed. `PixelInfo::components` is equivalent to `texture_format.describe().components`. `PixelInfo::type_size` can be gotten from `texture_format.describe().block_size/ texture_format.describe().components`. But note this can yield incorrect results for some texture types like Rg11b10Float. -### [run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878) +### [Run clear trackers on render world](https://github.com/bevyengine/bevy/pull/6878)
Rendering
@@ -631,7 +620,7 @@ The call to `clear_trackers` in `App` has been moved from the schedule to `App::
Rendering
-- Rename `priority` to `order` in usage of `Camera`. +Rename `priority` to `order` in usage of `Camera`. ### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) @@ -672,7 +661,7 @@ render_context.begin_tracked_render_pass(RenderPassDescriptor {
Rendering
-- Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. +Most usages of `resource_mut::` and `ResMut` can be changed to `resource::` and `Res` as long as they don’t use any methods requiring mutability - the only public method requiring it is `process_queue`. ### [Changed Msaa to Enum](https://github.com/bevyengine/bevy/pull/7292) @@ -681,12 +670,14 @@ render_context.begin_tracked_render_pass(RenderPassDescriptor { ```rust +// 0.9 let multi = Msaa { samples: 4 } -// is now +// 0.10 let multi = Msaa::Sample4 +// 0.9 multi.samples -// is now +// 0.10 multi.samples() ``` @@ -714,13 +705,13 @@ multi.samples() - Change `ScalingMode::WindowSize` to `ScalingMode::WindowSize(1.0)` -### [Changed &mut PipelineCache to &PipelineCache](https://github.com/bevyengine/bevy/pull/7598) +### [Changed `&mut PipelineCache` to `&PipelineCache`](https://github.com/bevyengine/bevy/pull/7598)
Rendering
-- `SpecializedComputePipelines::specialize` now takes a `&PipelineCache` instead of a `&mut PipelineCache` +`SpecializedComputePipelines::specialize` now takes a `&PipelineCache` instead of a `&mut PipelineCache` ### [Introduce detailed_trace macro, use in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7639) @@ -728,15 +719,15 @@ multi.samples()
Rendering
-- Some detailed bevy trace events now require the use of the cargo feature `detailed_trace` in addition to enabling `TRACE` level logging to view. Should you wish to see these logs, please compile your code with the bevy feature `detailed_trace`. Currently, the only logs that are affected are the renderer logs pertaining to `TrackedRenderPass` functions +Some detailed bevy trace events now require the use of the cargo feature `detailed_trace` in addition to enabling `TRACE` level logging to view. Should you wish to see these logs, please compile your code with the bevy feature `detailed_trace`. Currently, the only logs that are affected are the renderer logs pertaining to `TrackedRenderPass` functions -### [added subdivisions to shape::Plane](https://github.com/bevyengine/bevy/pull/7546) +### [Added subdivisions to shape::Plane](https://github.com/bevyengine/bevy/pull/7546)
Rendering
-- `shape::Plane` now takes an additional `subdivisions` parameter so users should provide it or use the new `shape::Plane::from_size`. +`shape::Plane` now takes an additional `subdivisions` parameter so users should provide it or use the new `shape::Plane::from_size()`. ### [Change standard material defaults and update docs](https://github.com/bevyengine/bevy/pull/7664) @@ -782,7 +773,7 @@ No api changes are required, but it's possible that your gltf meshes look differ The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. -### [Migrate engine to Schedule v3](https://github.com/bevyengine/bevy/pull/7267) +### [Migrate engine to Schedule v3 (stageless)](https://github.com/bevyengine/bevy/pull/7267)
Rendering
@@ -840,7 +831,7 @@ This was changed to enable pipelined rendering. If this breaks your use case ple
UI
-- The `background_color` field of `ExtractedUiNode` is now named `color`. +The `background_color` field of `ExtractedUiNode` is now named `color`. ### [Remove the `GlobalTransform::translation_mut` method](https://github.com/bevyengine/bevy/pull/7134) @@ -881,7 +872,7 @@ TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching
UI
-- `FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` +`FocusPolicy` default has changed from `FocusPolicy::Block` to `FocusPolicy::Pass` ### [Remove VerticalAlign from TextAlignment](https://github.com/bevyengine/bevy/pull/6807) @@ -912,7 +903,7 @@ __Changes for `Text2dBundle`__ `QueuedText` was never meant to be user facing. If you relied on it, please make an issue. -### [change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475) +### [Change the default `width` and `height` of `Size` to `Val::Auto`](https://github.com/bevyengine/bevy/pull/7475)
UI
@@ -936,7 +927,7 @@ The `Size::height` constructor function now sets the `width` to `Val::Auto` inst
UI
-- The size field of `CalculatedSize` has been changed to a `Vec2`. +The size field of `CalculatedSize` has been changed to a `Vec2`. ### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) @@ -960,7 +951,7 @@ let window = commands.spawn(Window { ... }).id(); // open window commands.entity(window).despawn(); // close window ``` -Now that windows are components on entity, you should use `Query` instead of `Res` to access windows. +- To get a window, you now need to use a `Query` instead of a `Res` ```rust // 0.9 @@ -980,36 +971,32 @@ fn count_pixels(primary_query: Query<&Window, With>) { } ``` -### [update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480) +### [Update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480)
Windowing
-before: - ```rust - app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { - always_on_top: true, - ..default() - }), +// 0.9 +app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + always_on_top: true, ..default() - })); -``` - -after: + }), + ..default() + })); -```rust - app.new() - .add_plugins(DefaultPlugins.set(WindowPlugin { - primary_window: Some(Window { - window_level: bevy::window::WindowLevel::AlwaysOnTop, - ..default() - }), +// 0.9 +app.new() + .add_plugins(DefaultPlugins.set(WindowPlugin { + primary_window: Some(Window { + window_level: bevy::window::WindowLevel::AlwaysOnTop, ..default() - })); + }), + ..default() + })); ``` From ebbddc61efed78024be45c7aac23c79075c167de Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 01:43:50 -0500 Subject: [PATCH 18/27] more clean up --- .../book/migration-guides/0.9-0.10/_index.md | 47 ++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index a2eacbd9c2..a1fdc4847d 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -61,7 +61,7 @@ Instead of directly accessing the ID of a `HandleUntyped` as `handle.id`, use th
Core
-`CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. +`CorePlugin` broken into separate plugins. If not using `DefaultPlugins` or `MinimalPlugins` `PluginGroup`s, the replacement for `CorePlugin` is now to add `TaskPoolPlugin`, `TypeRegistrationPlugin`, and `FrameCountPlugin` to the app. ### [Immutable sparse sets for metadata storage](https://github.com/bevyengine/bevy/pull/4928) @@ -192,7 +192,7 @@ The traits `SystemParamState` and `SystemParamFetch` have been removed, and thei The trait `ReadOnlySystemParamFetch` has been replaced with `ReadOnlySystemParam`. ```rust -// 0.9 (0.9) +// 0.9 impl SystemParam for MyParam<'_, '_> { type State = MyParamState; } @@ -205,7 +205,7 @@ unsafe impl<'w, 's> SystemParamFetch<'w, 's> for MyParamState { } unsafe impl ReadOnlySystemParamFetch for MyParamState { } -// 0.10 (0.10) +// 0.10 unsafe impl SystemParam for MyParam<'_, '_> { type State = MyParamState; type Item<'w, 's> = MyParam<'w, 's>; @@ -271,7 +271,7 @@ fn parallel_system(query: Query<&MyComponent>) {
ECS
-The type UnsafeWorldCellEntityRef has been renamed to UnsafeEntityCell +The type `UnsafeWorldCellEntityRef` has been renamed to UnsafeEntityCell ### [Replace `RemovedComponents` backing with `Events`](https://github.com/bevyengine/bevy/pull/5680) @@ -356,7 +356,7 @@ where `ChangeTrackers` has been deprecated, and will be removed in the next release. Any usage should be replaced with `Ref`. ```rust -// 0.9 (0.9) +// 0.9 fn my_system(q: Query<(&MyComponent, ChangeTrackers)>) { for (value, trackers) in &q { if trackers.is_changed() { @@ -365,7 +365,7 @@ fn my_system(q: Query<(&MyComponent, ChangeTrackers)>) { } } -// 0.10 (0.10) +// 0.10 fn my_system(q: Query>) { for value in &q { if value.is_changed() { @@ -375,14 +375,6 @@ fn my_system(q: Query>) { } ``` -### [Make boxed conditions read-only](https://github.com/bevyengine/bevy/pull/7786) - -
-
ECS
-
- - - ### [`EntityMut`: rename `remove_intersection` to `remove` and `remove` to `take`](https://github.com/bevyengine/bevy/pull/7810)
@@ -595,8 +587,8 @@ For cases where the option was handled, use `get_input_node` instead.
Rendering
-- replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` -- if you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in [Bevy default shaders](https://github.com/bevyengine/bevy/blob/3ec87e49ca49767fad658e72fbae353f6687198c/crates/bevy_pbr/src/render/mesh_view_bindings.wgsl#L28) +- Replace `shader_defs.push(String::from("NAME"));` by `shader_defs.push("NAME".into());` +- If you used shader def `NO_STORAGE_BUFFERS_SUPPORT`, check how `AVAILABLE_STORAGE_BUFFER_BINDINGS` is now used in [Bevy default shaders](https://github.com/bevyengine/bevy/blob/3ec87e49ca49767fad658e72fbae353f6687198c/crates/bevy_pbr/src/render/mesh_view_bindings.wgsl#L28) ### [Get pixel size from wgpu](https://github.com/bevyengine/bevy/pull/6820) @@ -622,15 +614,15 @@ The call to `clear_trackers` in `App` has been moved from the schedule to `App:: Rename `priority` to `order` in usage of `Camera`. -### [enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) +### [Enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320)
Rendering
-- evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. -- setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. -- usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. +- Evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. +- Setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. +- Usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. - `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. ### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053) @@ -743,7 +735,7 @@ Some detailed bevy trace events now require the use of the cargo feature `detail
Rendering
-- Removed `SetShadowViewBindGroup`, `queue_shadow_view_bind_group()`, and `LightMeta::shadow_view_bind_group` in favor of reusing the prepass view bind group. +Removed `SetShadowViewBindGroup`, `queue_shadow_view_bind_group()`, and `LightMeta::shadow_view_bind_group` in favor of reusing the prepass view bind group. ### [Directly extract joints into SkinnedMeshJoints](https://github.com/bevyengine/bevy/pull/6833) @@ -864,7 +856,7 @@ an entity basis.
UI
-TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. +`TextError::ExceedMaxTextAtlases(usize)` was never thrown so if you were matching on this variant you can simply remove it. ### [Change default FocusPolicy to Pass](https://github.com/bevyengine/bevy/pull/7161) @@ -890,7 +882,7 @@ __Change `TextAlignment` to TextAlignment` which is now an enum. Replace:__ __Changes for `Text2dBundle`__ -`Text2dBundle` has a new field ‘text_anchor’ that takes an `Anchor` component that controls its position relative to its transform. +`Text2dBundle` has a new field `text_anchor` that takes an `Anchor` component that controls its position relative to its transform. `Text2dSize` was removed. Use `TextLayoutInfo` instead. `Text2dSize` was removed. Use `TextLayoutInfo` instead. @@ -935,8 +927,9 @@ The size field of `CalculatedSize` has been changed to a `Vec2`.
Windowing
-- Replace `WindowDescriptor` with `Window`. - - Change `width` and `height` fields in a `WindowResolution`, either by doing +Replace `WindowDescriptor` with `Window`. + +Change `width` and `height` fields in a `WindowResolution`, either by doing ```rust WindowResolution::new(width, height) // Explicitly @@ -944,14 +937,14 @@ WindowResolution::new(width, height) // Explicitly (1920., 1080.).into() ``` -- Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: +Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: ```rust let window = commands.spawn(Window { ... }).id(); // open window commands.entity(window).despawn(); // close window ``` -- To get a window, you now need to use a `Query` instead of a `Res` +To get a window, you now need to use a `Query` instead of a `Res` ```rust // 0.9 From 86c42101b2697cf158e50c15b4df9535847cabd7 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 02:04:06 -0500 Subject: [PATCH 19/27] css --- sass/pages/_migration_guide.scss | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sass/pages/_migration_guide.scss b/sass/pages/_migration_guide.scss index 82a78ae2d7..fe15c8cd8a 100644 --- a/sass/pages/_migration_guide.scss +++ b/sass/pages/_migration_guide.scss @@ -1,24 +1,14 @@ .migration-guide { h3 { - margin-top: 3rem; - margin-bottom: 0.2rem; - padding-bottom: 0.1rem; - border-bottom: solid darken($color-white, 60%) 0.15rem; + margin-top: 2rem; + padding-top: 2rem; + margin-bottom: 0.1rem; + border-top: solid darken($color-white, 60%) 1px; } p, ul, li, code { font-size: 1rem; } - - // a { - // color: $color-white; - // // font-weight: normal; - // &:hover{ - // // font-weight: 500; - // color: $link-color; - // text-shadow: 0 0 0.9px $link-hover-shadow-color, 0 0 0.9px $link-hover-shadow-color; - // } - // } } .migration-guide-area-tags { From 540e62b6134bf308deb1e5540cfa84316db52752 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 3 Mar 2023 02:15:20 -0500 Subject: [PATCH 20/27] Update content/learn/book/migration-guides/0.9-0.10/_index.md Co-authored-by: Liam Gallagher --- content/learn/book/migration-guides/0.9-0.10/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index a1fdc4847d..01315c1d79 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -981,7 +981,7 @@ app.new() ..default() })); -// 0.9 +// 0.10 app.new() .add_plugins(DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { From f603009ed891f8f7aff3d20bba751accd6c3f86a Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Mar 2023 14:07:46 -0500 Subject: [PATCH 21/27] Update content/learn/book/migration-guides/0.9-0.10/_index.md Co-authored-by: JoJoJet <21144246+JoJoJet@users.noreply.github.com> --- content/learn/book/migration-guides/0.9-0.10/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 01315c1d79..786e17244f 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -319,7 +319,7 @@ For the `SystemParamFunction` trait, the type parameters `In`, `Out`, and `Param fn my_generic_system(system_function: T) where T: SystemParamFunction, - T: Param: SystemParam, + Param: SystemParam, { ... } // 0.10 From d48a0e781ab22368535c6acff1ac710c87b31e6b Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Mar 2023 15:41:03 -0500 Subject: [PATCH 22/27] fixed timestep --- content/learn/book/migration-guides/0.9-0.10/_index.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 786e17244f..7b0a745a27 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -796,6 +796,10 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend - States have been dramatically simplified: there is no longer a “state stack”. To queue a transition to the next state, call `NextState::set` - Strings can no longer be used as a `SystemLabel` or `SystemSet`. Use a type, or use the system function instead. +#### Multiple fixed timesteps + +Only one fixed timestep is supported. If you were relying on this functionality, you should swap to using timers, via the on_timer(MY_PERIOD) run condition. + ### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503)
From 3364610d7f2c1b40b4895d98033de1520f22281c Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Mar 2023 16:19:24 -0500 Subject: [PATCH 23/27] Update content/learn/book/migration-guides/0.9-0.10/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.9-0.10/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 7b0a745a27..032f128a80 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -798,7 +798,8 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend #### Multiple fixed timesteps -Only one fixed timestep is supported. If you were relying on this functionality, you should swap to using timers, via the on_timer(MY_PERIOD) run condition. +Apps may now only have one unified fixed timestep. If you were relying on this functionality, you should swap to using timers, via the `on_timer(MY_PERIOD)` run condition. + ### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503) From 68a703e162245f6e47b46100cc76b9388b7787c6 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 4 Mar 2023 16:23:46 -0500 Subject: [PATCH 24/27] fix --- content/learn/book/migration-guides/0.9-0.10/_index.md | 1 - 1 file changed, 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 032f128a80..11d981a892 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -800,7 +800,6 @@ The `FrameCount` resource was previously only updated when using the `bevy_rend Apps may now only have one unified fixed timestep. If you were relying on this functionality, you should swap to using timers, via the `on_timer(MY_PERIOD)` run condition. - ### [Pipelined Rendering](https://github.com/bevyengine/bevy/pull/6503)
From 628c3d15cc978d05307ea73fa6c725652eb175e1 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sat, 4 Mar 2023 15:48:09 -0800 Subject: [PATCH 25/27] Update content/learn/book/migration-guides/0.9-0.10/_index.md Co-authored-by: Marco Buono --- content/learn/book/migration-guides/0.9-0.10/_index.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 11d981a892..7d58dc711e 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -755,6 +755,13 @@ Removed `SetShadowViewBindGroup`, `queue_shadow_view_bind_group()`, and `LightMe No api changes are required, but it's possible that your gltf meshes look different +### [Send emissive color to uniform as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/7897) + +- If you have previously manually specified emissive values with `Color::rgb()` and would like to retain the old visual results, you must now use `Color::rgb_linear()` instead; +- If you have previously manually specified emissive values with `Color::rgb_linear()` and would like to retain the old visual results, you'll need to apply a one-time gamma calculation to your channels manually to get the _actual_ linear RGB value: + - For channel values greater than `0.0031308`, use `(1.055 * value.powf(1.0 / 2.4)) - 0.055`; + - For channel values lower than or equal to `0.0031308`, use `value * 12.92`; +- Otherwise, the results should now be more consistent with other tools/engines. ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676)
From 6b48f6f0084af7165075aec869d8a14ed2e6ad65 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sat, 4 Mar 2023 15:53:49 -0800 Subject: [PATCH 26/27] bump highly relevant sections to the top --- .../book/migration-guides/0.9-0.10/_index.md | 265 +++++++++--------- 1 file changed, 133 insertions(+), 132 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 7d58dc711e..8fd8da3a2f 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -13,6 +13,137 @@ Bevy relies heavily on improvements in the Rust language and compiler. As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable release" of Rust.
+### [Migrate engine to Schedule v3 (stageless)](https://github.com/bevyengine/bevy/pull/7267) + +
+
Rendering
+
ECS
+
+ +- Calls to `.label(MyLabel)` should be replaced with `.in_set(MySet)` +- Stages have been removed. Replace these with system sets, and then add command flushes using the `apply_system_buffers` exclusive system where needed. +- The `CoreStage`, `StartupStage,`RenderStage`and`AssetStage`enums have been replaced with`CoreSet`,`StartupSet, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. + - Systems are no longer added to `CoreSet::Update` by default. Add systems manually if this behavior is needed, although you should consider adding your game logic systems to `CoreSchedule::FixedTimestep` instead for more reliable framerate-independent behavior. + - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. + - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with + - `add_system(my_system.in_base_set(CoreSet::PostUpdate)` + +- When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages +- Run criteria have been renamed to run conditions. These can now be combined with each other and with states. +- Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. +- For app-level control flow over which schedules get run when (such as for rollback networking), create your own schedule and insert it under the `CoreSchedule::Outer` label. +- Fixed timesteps are now evaluated in a schedule, rather than controlled via run criteria. The `run_fixed_timestep` system runs this schedule between `CoreSet::First` and `CoreSet::PreUpdate` by default. +- Command flush points introduced by `AssetStage` have been removed. If you were relying on these, add them back manually. +- the `calculate_bounds` system, with the `CalculateBounds` label, is now in `CoreSet::Update`, rather than in `CoreSet::PostUpdate` before commands are applied. You may need to order your movement systems to occur before this system in order to avoid system order ambiguities in culling behavior. +- the `RenderLabel` `AppLabel` was renamed to `RenderApp` for clarity +- `App::add_state` now takes 0 arguments: the starting state is set based on the `Default` impl. +- Instead of creating `SystemSet` containers for systems that run in stages, simply use `.on_enter::()` or its `on_exit` or `on_update` siblings. +- `SystemLabel` derives should be replaced with `SystemSet`. You will also need to add the `Debug`, `PartialEq`, `Eq`, and `Hash` traits to satisfy the new trait bounds. +- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a `bool` instead of `schedule::ShouldRun`. + +- States have been dramatically simplified: there is no longer a “state stack”. To queue a transition to the next state, call `NextState::set` +- Strings can no longer be used as a `SystemLabel` or `SystemSet`. Use a type, or use the system function instead. + +### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) + +
+
Windowing
+
+ +Replace `WindowDescriptor` with `Window`. + +Change `width` and `height` fields in a `WindowResolution`, either by doing + +```rust +WindowResolution::new(width, height) // Explicitly +// or using From<_> for tuples for convenience +(1920., 1080.).into() +``` + +Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: + +```rust +let window = commands.spawn(Window { ... }).id(); // open window +commands.entity(window).despawn(); // close window +``` + +To get a window, you now need to use a `Query` instead of a `Res` + +```rust +// 0.9 +fn count_pixels(windows: Res) { + let Some(primary) = windows.get_primary() else { + return; + }; + println!("{}", primary.width() * primary.height()); +} + +// 0.10 +fn count_pixels(primary_query: Query<&Window, With>) { + let Ok(primary) = primary_query.get_single() else { + return; + }; + println!("{}", primary.width() * primary.height()); +} +``` + +### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) + +
+
ECS
+
+ +The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. + +```rust +// 0.9 +#[derive(SystemParam)] +struct MessageWriter<'w, 's> { + events: EventWriter<'w, 's, Message>, +} + +// 0.10 +#[derive(SystemParam)] +struct MessageWriter<'w> { + events: EventWriter<'w, Message>, +} +``` + +### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) + +
+
ECS
+
+ +The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. + +```rust +// 0.9 +fn parallel_system(query: Query<&MyComponent>) { + query.par_for_each(32, |comp| { + ... + }); +} + +// 0.10 +fn parallel_system(query: Query<&MyComponent>) { + query.par_iter().for_each(|comp| { + ... + }); +} +``` + +### [Enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) + +
+
Rendering
+
+ +- Evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. +- Setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. +- Usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. +- `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. + ### [bevy_reflect: Pre-parsed paths](https://github.com/bevyengine/bevy/pull/7321)
@@ -107,28 +238,6 @@ column.get_ticks(row).changed.deref() `Entities::alloc_at_without_replacement` and `AllocAtWithoutReplacement` has been made private due to difficulty in using it properly outside of `bevy_ecs`. If you still need use of this API, please file an issue or check [bevy_ecs is excessively public](https://github.com/bevyengine/bevy/issues/3362) for more info. -### [Make the `SystemParam` derive macro more flexible](https://github.com/bevyengine/bevy/pull/6694) - -
-
ECS
-
- -The lifetime `'s` has been removed from `EventWriter`. Any code that explicitly specified the lifetimes for this type will need to be updated. - -```rust -// 0.9 -#[derive(SystemParam)] -struct MessageWriter<'w, 's> { - events: EventWriter<'w, 's, Message>, -} - -// 0.10 -#[derive(SystemParam)] -struct MessageWriter<'w> { - events: EventWriter<'w, Message>, -} -``` - ### [Borrow instead of consuming in `EventReader::clear`](https://github.com/bevyengine/bevy/pull/6851)
@@ -231,30 +340,6 @@ Normal resources and `NonSend` resources no longer share the same backing storag Safety invariants on `bevy_ptr` types’ `new` `byte_add` and `byte_offset` methods have been changed. All callers should re-audit for soundness. -### [Basic adaptive batching for parallel query iteration](https://github.com/bevyengine/bevy/pull/4777) - -
-
ECS
-
- -The `batch_size` parameter for `Query(State)::par_for_each(_mut)` has been removed. These calls will automatically compute a batch size for you. Remove these parameters from all calls to these functions. - -```rust -// 0.9 -fn parallel_system(query: Query<&MyComponent>) { - query.par_for_each(32, |comp| { - ... - }); -} - -// 0.10 -fn parallel_system(query: Query<&MyComponent>) { - query.par_iter().for_each(|comp| { - ... - }); -} -``` - ### [Added `resource_id` and changed `init_resource` and `init_non_send_resource` to return `ComponentId`](https://github.com/bevyengine/bevy/pull/7284)
@@ -614,17 +699,6 @@ The call to `clear_trackers` in `App` has been moved from the schedule to `App:: Rename `priority` to `order` in usage of `Camera`. -### [Enum `Visibility` component](https://github.com/bevyengine/bevy/pull/6320) - -
-
Rendering
-
- -- Evaluation of the `visibility.is_visible` field should now check for `visibility == Visibility::Inherited`. -- Setting the `visibility.is_visible` field should now directly set the value: `*visibility = Visibility::Inherited`. -- Usage of `Visibility::VISIBLE` or `Visibility::INVISIBLE` should now use `Visibility::Inherited` or `Visibility::Hidden` respectively. -- `ComputedVisibility::INVISIBLE` and `SpatialBundle::VISIBLE_IDENTITY` have been renamed to `ComputedVisibility::HIDDEN` and `SpatialBundle::INHERITED_IDENTITY` respectively. - ### [Reduce branching in TrackedRenderPass](https://github.com/bevyengine/bevy/pull/7053)
@@ -758,10 +832,11 @@ No api changes are required, but it's possible that your gltf meshes look differ ### [Send emissive color to uniform as linear instead of sRGB](https://github.com/bevyengine/bevy/pull/7897) - If you have previously manually specified emissive values with `Color::rgb()` and would like to retain the old visual results, you must now use `Color::rgb_linear()` instead; -- If you have previously manually specified emissive values with `Color::rgb_linear()` and would like to retain the old visual results, you'll need to apply a one-time gamma calculation to your channels manually to get the _actual_ linear RGB value: +- If you have previously manually specified emissive values with `Color::rgb_linear()` and would like to retain the old visual results, you'll need to apply a one-time gamma calculation to your channels manually to get the _actual_ linear RGB value: - For channel values greater than `0.0031308`, use `(1.055 * value.powf(1.0 / 2.4)) - 0.055`; - For channel values lower than or equal to `0.0031308`, use `value * 12.92`; - Otherwise, the results should now be more consistent with other tools/engines. + ### [The `update_frame_count` system should be placed in CorePlugin](https://github.com/bevyengine/bevy/pull/6676)
@@ -772,37 +847,6 @@ No api changes are required, but it's possible that your gltf meshes look differ The `FrameCount` resource was previously only updated when using the `bevy_render` feature. If you are not using this feature but still want the `FrameCount` it will now be updated correctly. -### [Migrate engine to Schedule v3 (stageless)](https://github.com/bevyengine/bevy/pull/7267) - -
-
Rendering
-
ECS
-
- -- Calls to `.label(MyLabel)` should be replaced with `.in_set(MySet)` -- Stages have been removed. Replace these with system sets, and then add command flushes using the `apply_system_buffers` exclusive system where needed. -- The `CoreStage`, `StartupStage,`RenderStage`and`AssetStage`enums have been replaced with`CoreSet`,`StartupSet, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. - - Systems are no longer added to `CoreSet::Update` by default. Add systems manually if this behavior is needed, although you should consider adding your game logic systems to `CoreSchedule::FixedTimestep` instead for more reliable framerate-independent behavior. - - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. - - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - - `add_system(my_system.in_base_set(CoreSet::PostUpdate)` - -- When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages -- Run criteria have been renamed to run conditions. These can now be combined with each other and with states. -- Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. -- For app-level control flow over which schedules get run when (such as for rollback networking), create your own schedule and insert it under the `CoreSchedule::Outer` label. -- Fixed timesteps are now evaluated in a schedule, rather than controlled via run criteria. The `run_fixed_timestep` system runs this schedule between `CoreSet::First` and `CoreSet::PreUpdate` by default. -- Command flush points introduced by `AssetStage` have been removed. If you were relying on these, add them back manually. -- the `calculate_bounds` system, with the `CalculateBounds` label, is now in `CoreSet::Update`, rather than in `CoreSet::PostUpdate` before commands are applied. You may need to order your movement systems to occur before this system in order to avoid system order ambiguities in culling behavior. -- the `RenderLabel` `AppLabel` was renamed to `RenderApp` for clarity -- `App::add_state` now takes 0 arguments: the starting state is set based on the `Default` impl. -- Instead of creating `SystemSet` containers for systems that run in stages, simply use `.on_enter::()` or its `on_exit` or `on_update` siblings. -- `SystemLabel` derives should be replaced with `SystemSet`. You will also need to add the `Debug`, `PartialEq`, `Eq`, and `Hash` traits to satisfy the new trait bounds. -- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a `bool` instead of `schedule::ShouldRun`. - -- States have been dramatically simplified: there is no longer a “state stack”. To queue a transition to the next state, call `NextState::set` -- Strings can no longer be used as a `SystemLabel` or `SystemSet`. Use a type, or use the system function instead. - #### Multiple fixed timesteps Apps may now only have one unified fixed timestep. If you were relying on this functionality, you should swap to using timers, via the `on_timer(MY_PERIOD)` run condition. @@ -932,49 +976,6 @@ The `Size::height` constructor function now sets the `width` to `Val::Auto` inst The size field of `CalculatedSize` has been changed to a `Vec2`. -### [Windows as Entities](https://github.com/bevyengine/bevy/pull/5589) - -
-
Windowing
-
- -Replace `WindowDescriptor` with `Window`. - -Change `width` and `height` fields in a `WindowResolution`, either by doing - -```rust -WindowResolution::new(width, height) // Explicitly -// or using From<_> for tuples for convenience -(1920., 1080.).into() -``` - -Replace any `WindowCommand` code to just modify the `Window`’s fields directly and creating/closing windows is now by spawning/despawning an entity with a `Window` component like so: - -```rust -let window = commands.spawn(Window { ... }).id(); // open window -commands.entity(window).despawn(); // close window -``` - -To get a window, you now need to use a `Query` instead of a `Res` - -```rust -// 0.9 -fn count_pixels(windows: Res) { - let Some(primary) = windows.get_primary() else { - return; - }; - println!("{}", primary.width() * primary.height()); -} - -// 0.10 -fn count_pixels(primary_query: Query<&Window, With>) { - let Ok(primary) = primary_query.get_single() else { - return; - }; - println!("{}", primary.width() * primary.height()); -} -``` - ### [Update winit to 0.28](https://github.com/bevyengine/bevy/pull/7480)
From 8d8408d8e2ed3772742fc6fafc47c788f0f6900c Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sat, 4 Mar 2023 15:58:29 -0800 Subject: [PATCH 27/27] Clean up Schedule v3 migration guide, reorder, and remove irrelevant lines --- .../book/migration-guides/0.9-0.10/_index.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/content/learn/book/migration-guides/0.9-0.10/_index.md b/content/learn/book/migration-guides/0.9-0.10/_index.md index 8fd8da3a2f..265d996ab4 100644 --- a/content/learn/book/migration-guides/0.9-0.10/_index.md +++ b/content/learn/book/migration-guides/0.9-0.10/_index.md @@ -21,25 +21,19 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel
- Calls to `.label(MyLabel)` should be replaced with `.in_set(MySet)` +- `SystemLabel` derives should be replaced with `SystemSet`. You will also need to add the `Debug`, `PartialEq`, `Eq`, and `Hash` traits to satisfy the new trait bounds. - Stages have been removed. Replace these with system sets, and then add command flushes using the `apply_system_buffers` exclusive system where needed. -- The `CoreStage`, `StartupStage,`RenderStage`and`AssetStage`enums have been replaced with`CoreSet`,`StartupSet, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. - - Systems are no longer added to `CoreSet::Update` by default. Add systems manually if this behavior is needed, although you should consider adding your game logic systems to `CoreSchedule::FixedTimestep` instead for more reliable framerate-independent behavior. - - Similarly, startup systems are no longer part of `StartupSet::Startup` by default. In most cases, this won’t matter to you. - - For example, `add_system_to_stage(CoreStage::PostUpdate, my_system)` should be replaced with - - `add_system(my_system.in_base_set(CoreSet::PostUpdate)` - -- When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages -- Run criteria have been renamed to run conditions. These can now be combined with each other and with states. +- The `CoreStage`, `StartupStage`, `RenderStage`, and `AssetStage` enums have been replaced with `CoreSet`, `StartupSet`, `RenderSet` and `AssetSet`. The same scheduling guarantees have been preserved. +- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a `bool` instead of `schedule::ShouldRun`. - Looping run criteria and state stacks have been removed. Use an exclusive system that runs a schedule if you need this level of control over system control flow. +- `App::add_state` now takes 0 arguments: the starting state is set based on the `Default` impl. +- Instead of creating `SystemSet` containers for systems that run in stages, simply use `.on_enter::()` or its `on_exit` sibling. - For app-level control flow over which schedules get run when (such as for rollback networking), create your own schedule and insert it under the `CoreSchedule::Outer` label. - Fixed timesteps are now evaluated in a schedule, rather than controlled via run criteria. The `run_fixed_timestep` system runs this schedule between `CoreSet::First` and `CoreSet::PreUpdate` by default. - Command flush points introduced by `AssetStage` have been removed. If you were relying on these, add them back manually. - the `calculate_bounds` system, with the `CalculateBounds` label, is now in `CoreSet::Update`, rather than in `CoreSet::PostUpdate` before commands are applied. You may need to order your movement systems to occur before this system in order to avoid system order ambiguities in culling behavior. - the `RenderLabel` `AppLabel` was renamed to `RenderApp` for clarity -- `App::add_state` now takes 0 arguments: the starting state is set based on the `Default` impl. -- Instead of creating `SystemSet` containers for systems that run in stages, simply use `.on_enter::()` or its `on_exit` or `on_update` siblings. -- `SystemLabel` derives should be replaced with `SystemSet`. You will also need to add the `Debug`, `PartialEq`, `Eq`, and `Hash` traits to satisfy the new trait bounds. -- `with_run_criteria` has been renamed to `run_if`. Run criteria have been renamed to run conditions for clarity, and should now simply return a `bool` instead of `schedule::ShouldRun`. +- When testing systems or otherwise running them in a headless fashion, simply construct and run a schedule using `Schedule::new()` and `World::run_schedule` rather than constructing stages - States have been dramatically simplified: there is no longer a “state stack”. To queue a transition to the next state, call `NextState::set` - Strings can no longer be used as a `SystemLabel` or `SystemSet`. Use a type, or use the system function instead.