From a1e2164339f0a91f1079eb40d8eb2c504bc47a73 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 28 Jun 2022 23:56:51 -0400 Subject: [PATCH 01/49] create guide --- .../learn/book/migration-guides/0.7-0.8/_index.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 content/learn/book/migration-guides/0.7-0.8/_index.md diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md new file mode 100644 index 0000000000..2fdb095d4e --- /dev/null +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -0,0 +1,12 @@ ++++ +title = "0.7 to 0.8" +weight = 4 +sort_by = "weight" +template = "book-section.html" +page_template = "book-section.html" +insert_anchor_links = "right" +[extra] +long_title = "Migration Guide: 0.7 to 0.8" ++++ + + From 02a8de787633f179a314fe53fc7dcf7be97c85f5 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Wed, 29 Jun 2022 00:36:08 -0400 Subject: [PATCH 02/49] first draft of all the PRs tagged as breaking change --- .../book/migration-guides/0.7-0.8/_index.md | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 2fdb095d4e..b538d9679a 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -10,3 +10,291 @@ long_title = "Migration Guide: 0.7 to 0.8" +++ + +### [Make ScalingMode more flexible](https://github.com/bevyengine/bevy/pull/3253) + +Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis for `FixedVertical` and `FixedHorizontal` and a new `ScalingMode` that is a mix of `FixedVertical` and `FixedHorizontal` + +### [Allow closing windows at runtime](https://github.com/bevyengine/bevy/pull/3575) + +`bevy::input::system::exit_on_esc_system` has been removed. Use `bevy::window::close_on_esc` instead. +`CloseWindow` has been removed. Use `Window::close` instead. +The Close variant has been added to `WindowCommand`. Handle this by closing the relevant window. + +### [Make RunOnce a non-manual System impl](https://github.com/bevyengine/bevy/pull/3922) + +The run criterion `RunOnce`, which would make the controlled systems run only once, has been replaced with a new run criterion function ShouldRun::once. Replace all instances of RunOnce with `ShouldRun::once`. + +### [Move system_param fetch struct into anonymous scope to avoid name collisions](https://github.com/bevyengine/bevy/pull/4100) + +For code that was using a system param's fetch struct, such as EventReader's EventReaderState, the fetch struct can now be identified via the SystemParam trait associated type Fetch, e.g. for `EventReader` it can be identified as `` as SystemParam>::Fetch + +### [Task doesn't impl Component](https://github.com/bevyengine/bevy/pull/4113) + +If you need a `Task` to be a `Component` you should use a wrapper type. + +```rs +// 0.7 +fn system(mut commands: Commands) { + let task = thread_pool.spawn(async move { + let start_time = Instant::now(); + while Instant::now() - start_time < Duration::from_secs_f32(5.0) { + // Spinning for 'duration', simulating doing hard + } + Vec2::ZERO + }); + commands.spawn().insert(task); +} + +// 0.8 +#[derive(Component)] +struct ComputeVec2(Task); + +fn system(mut commands: Commands) { + let task = thread_pool.spawn(async move { + let start_time = Instant::now(); + while Instant::now() - start_time < Duration::from_secs_f32(5.0) { + // Spinning for 'duration', simulating doing hard + } + Vec2::ZERO + }); + commands.spawn().insert(ComputeVec2(task)) +} +``` + +### [Split time functionality into bevy_time](https://github.com/bevyengine/bevy/pull/4187) + +* Time related types (e.g. `Time`, `Timer`, `Stopwatch`, `FixedTimestep`, etc.) should be imported from `bevy::time::*` rather than `bevy::core::*`. +* If you were adding `CorePlugin` manually, you'll also want to add `TimePlugin` from `bevy::time`. +* The `bevy::core::CorePlugin::Time` system label is replaced with `bevy::time::TimeSystem`. + +### [Move float_ord from bevy_core to bevy_utils](https://github.com/bevyengine/bevy/pull/4189) + +Replace imports of `bevy::core::FloatOrd` with `bevy::utils::FloatOrd`. + +### [Move Rect to bevy_ui and rename it to UiRect](https://github.com/bevyengine/bevy/pull/4276) + +The `Rect` type got renamed to `UiRect`. To migrate you just have to change every occurrence of `Rect` to `UiRect`. + +### [Rename ElementState to ButtonState](https://github.com/bevyengine/bevy/pull/4314) + +The `ElementState` type received a rename and is now called `ButtonState`. To migrate you just have to change every occurrence of `ElementState` to `ButtonState`. + +### [Improve docs and naming for RawWindowHandle functionality](https://github.com/bevyengine/bevy/pull/4335) + +rename `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper` + +### [Migrate to encase from crevice](https://github.com/bevyengine/bevy/pull/4339) + +#### StorageBuffer + +* removed set_body(), values(), values_mut(), clear(), push(), append() +* added set(), get(), get_mut() + +#### UniformVec -> UniformBuffer + +* renamed uniform_buffer() to buffer() +* removed len(), is_empty(), capacity(), push(), reserve(), clear(), values() +* added set(), get() + +#### DynamicUniformVec -> DynamicUniformBuffer + +* renamed uniform_buffer() to buffer() +* removed capacity(), reserve() + +### [Make paused timers update just_finished on tick](https://github.com/bevyengine/bevy/pull/4445) + +`Timer::times_finished has` been renamed to `Timer::times_finished_this_tick` for clarity. + +### [Change default Image FilterMode to Linear](https://github.com/bevyengine/bevy/pull/4465) + +```rs +// 0.7 + +//TODO + +// 0.8 + +// TODO +``` + +### [Remove .system()](https://github.com/bevyengine/bevy/pull/4499) + +You can no longer use `.system()`. It was deprecated in 0.7.0. You can just remove the method call. + +### [Change gamepad.rs tuples to normal structs](https://github.com/bevyengine/bevy/pull/4519) + +The `Gamepad`, `GamepadButton`, `GamepadAxis`, `GamepadEvent` and `GamepadEventRaw` types are now normal structs instead of tuple structs and have a new() function. To migrate change every instantiation to use the `new()` function instead and use the appropriate field names instead of .0 and .1. + +### [Remove EntityMut::get_unchecked](https://github.com/bevyengine/bevy/pull/4547) + +Replace calls to `EntityMut::get_unchecked` with calls to `EntityMut::get`. + +### [Replace ReadOnlyFetch with ReadOnlyWorldQuery](https://github.com/bevyengine/bevy/pull/4626) + +The trait ReadOnlyFetch has been replaced with ReadOnlyWorldQuery along with the WorldQueryGats::ReadOnlyFetch assoc type which has been replaced with ::Fetch + +The trait `ReadOnlyFetch` has been replaced with `ReadOnlyWorldQuery` along with the `WorldQueryGats::ReadOnlyFetch` assoc type which has been replaced with `::Fetch` + +* Any where clauses such as `QueryFetch: ReadOnlyFetch` should be replaced with `Q: ReadOnlyWorldQuery`. +* Any custom world query impls should implement `ReadOnlyWorldQuery` insead of `ReadOnlyFetch` + +Functions `update_component_access` and `update_archetype_component_access` have been moved from the `FetchState` trait to `WorldQuery` + +* Any callers should now call `Q::update_component_access(state` instead of `state.update_component_access` (and `update_archetype_component_access` respectively) +* Any custom world query impls should move the functions from the `FetchState` impl to `WorldQuery` impl + +`WorldQuery` has been made an `unsafe trait`, `FetchState` has been made a safe `trait`. (I think this is how it should have always been, but regardless this is _definitely_ necessary now that the two functions have been moved to `WorldQuery`) + +* If you have a custom `FetchState` impl make it a normal `impl` instead of `unsafe impl` +* If you have a custom `WorldQuery` impl make it an `unsafe impl`, if your code was sound before it is going to still be sound + +### [Fix unsoundness with Or/AnyOf/Option component access'](https://github.com/bevyengine/bevy/pull/4659) + + + +If you are now getting query conflicts from `Or`/`AnyOf`/`Option` rip to you and ur welcome for it now being caught. + +### [Remove task_pool parameter from par_for_each(_mut)](https://github.com/bevyengine/bevy/pull/4705) + +The `task_pool` parameter for `Query(State)::par_for_each(_mut)` has been removed. Remove these parameters from all calls to these functions. + +Before: + +```rust +fn parallel_system( + task_pool: Res, + query: Query<&MyComponent>, +) { + query.par_for_each(&task_pool, 32, |comp| { + ... + }); +} +``` + +After: + +```rust +fn parallel_system(query: Query<&MyComponent>) { + query.par_for_each(32, |comp| { + ... + }); +} +``` + +If using `Query(State)` outside of a system run by the scheduler, you may need to manually configure and initialize a `ComputeTaskPool` as a resource in the `World`. + +### [Fail to compile on 16-bit platforms](https://github.com/bevyengine/bevy/pull/4736) + +`bevy_ecs` will now explicitly fail to compile on 16-bit platforms. If this is required, there is currently no alternative. Please file an issue () to help detail your use case. + +### [Camera Driven Rendering](https://github.com/bevyengine/bevy/pull/4745) + + + +This is a very complicated change and it is recommended to read the linked PRs for more details + +```rust +// old 3d perspective camera +commands.spawn_bundle(PerspectiveCameraBundle::default()) + +// new 3d perspective camera +commands.spawn_bundle(Camera3dBundle::default()) +``` + +```rust +// old 2d orthographic camera +commands.spawn_bundle(OrthographicCameraBundle::new_2d()) + +// new 2d orthographic camera +commands.spawn_bundle(Camera2dBundle::default()) +``` + +```rust +// old 3d orthographic camera +commands.spawn_bundle(OrthographicCameraBundle::new_3d()) + +// new 3d orthographic camera +commands.spawn_bundle(Camera3dBundle { + projection: OrthographicProjection { + scale: 3.0, + scaling_mode: ScalingMode::FixedVertical, + ..default() + }.into(), + ..default() +}) +``` + +UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Camera2dBundle` and `Camera3dBundle` now both default to rendering UI as part of their own render graphs. To disable UI rendering for a camera, disable it using the CameraUi component: + +```rust +commands + .spawn_bundle(Camera3dBundle::default()) + .insert(CameraUi { + is_enabled: false, + ..default() + }) +``` + +### [Enforce type safe usage of Handle::get](https://github.com/bevyengine/bevy/pull/4794) + +`Assets::::get` and `Assets::::get_mut` now require that the passed handles are `Handle`, improving the type safety of handles. If you were previously passing in: + +* a `HandleId`, use `&Handle::weak(id)` instead, to create a weak handle. You may have been able to store a type safe `Handle` instead. +* a `HandleUntyped`, use `&handle_untyped.typed_weak()` to create a weak handle of the specified type. This is most likely to be the useful when using [load_folder](https://docs.rs/bevy_asset/latest/bevy_asset/struct.AssetServer.html#method.load_folder) +* a `Handle` of of a different type, consider whether this is the correct handle type to store. If it is (i.e. the same handle id is used for multiple different Asset types) use `Handle::weak(handle.id)` to cast to a different type. + +### [Allow higher order systems](https://github.com/bevyengine/bevy/pull/4833) + + + +### [Added offset parameter to TextureAtlas::from_grid_with_padding](https://github.com/bevyengine/bevy/pull/4836) + +Calls to `TextureAtlas::from_grid_with_padding` should be modified to include a new parameter, which can be set to `Vec2::ZERO` to retain old behaviour. + +```rust +from_grid_with_padding(texture, tile_size, columns, rows, padding) + | + V +from_grid_with_padding(texture, tile_size, columns, rows, padding, Vec2::ZERO) +``` + +### [Split mesh shader files](https://github.com/bevyengine/bevy/pull/4867) + +* In shaders for 3D meshes: + * `#import bevy_pbr::mesh_view_bind_group` -> `#import bevy_pbr::mesh_view_bindings` + * `#import bevy_pbr::mesh_struct` -> `#import bevy_pbr::mesh_types` + * NOTE: If you are using the mesh bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_pbr::mesh_bindings` which itself imports the mesh types needed for the bindings. +* In shaders for 2D meshes: + * `#import bevy_sprite::mesh2d_view_bind_group` -> `#import bevy_sprite::mesh2d_view_bindings` + * `#import bevy_sprite::mesh2d_struct` -> `#import bevy_sprite::mesh2d_types` + * NOTE: If you are using the mesh2d bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_sprite::mesh2d_bindings` which itself imports the mesh2d types needed for the bindings. + +### [Camera Driven Viewports](https://github.com/bevyengine/bevy/pull/4898) + +`Camera::projection_matrix` is no longer a public field. Use the new `Camera::projection_matrix()` method instead: + +```rust + +// 0.7 +let projection = camera.projection_matrix; + +// 0.8 +let projection = camera.projection_matrix(); +``` + +### [diagnostics: meaningful error when graph node has wrong number of inputs](https://github.com/bevyengine/bevy/pull/4924) + +Exhaustive matches on `RenderGraphRunnerError` will need to add a branch to handle the new `MismatchedInputCount` variant. + +### [Make Reflect safe to implement](https://github.com/bevyengine/bevy/pull/5010) + +* Reflect derives should not have to change anything +* Manual reflect impls will need to remove the `unsafe` keyword, add `any()` implementations, and rename the old `any` and `any_mut` to `as_any` and `as_mut_any`. +* Calls to `any`/`any_mut` must be changed to `as_any`/`as_mut_any` + +### [Mark mutable APIs under ECS storage as pub(crate)](https://github.com/bevyengine/bevy/pull/5065) + + + + \ No newline at end of file From 4d51cfe1a57a8f1d361e85e466972ae3a15817c1 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Wed, 29 Jun 2022 01:02:29 -0400 Subject: [PATCH 03/49] apply some suggestions --- content/learn/book/migration-guides/0.7-0.8/_index.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index b538d9679a..bd0888a1bd 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -122,6 +122,8 @@ rename `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper` You can no longer use `.system()`. It was deprecated in 0.7.0. You can just remove the method call. +If you needed this for tests purposes, you can use `bevy_ecs::system::assert_is_system` instead. + ### [Change gamepad.rs tuples to normal structs](https://github.com/bevyengine/bevy/pull/4519) The `Gamepad`, `GamepadButton`, `GamepadAxis`, `GamepadEvent` and `GamepadEventRaw` types are now normal structs instead of tuple structs and have a new() function. To migrate change every instantiation to use the `new()` function instead and use the appropriate field names instead of .0 and .1. @@ -295,6 +297,6 @@ Exhaustive matches on `RenderGraphRunnerError` will need to add a branch to hand ### [Mark mutable APIs under ECS storage as pub(crate)](https://github.com/bevyengine/bevy/pull/5065) - + - \ No newline at end of file +If you experienced any problems caused by this change, please [create an issue](https://github.com/bevyengine/bevy/issues) explaining _in details_ what you were doing with those apis. From c506e6c593a1ea059b2144b8824e15e6ed7cd4c1 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 11:30:54 -0400 Subject: [PATCH 04/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index bd0888a1bd..a617670d7b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -299,4 +299,4 @@ Exhaustive matches on `RenderGraphRunnerError` will need to add a branch to hand -If you experienced any problems caused by this change, please [create an issue](https://github.com/bevyengine/bevy/issues) explaining _in details_ what you were doing with those apis. +If you experienced any problems caused by this change, please [create an issue](https://github.com/bevyengine/bevy/issues) explaining _in detail_ what you were doing with those apis. From ccfff670dc5bef7cf6138d93e528391c9a22e8ee Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 15 Jul 2022 12:11:00 -0400 Subject: [PATCH 05/49] update CameraUi --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index a617670d7b..235a115b3b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -232,7 +232,7 @@ UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Ca ```rust commands .spawn_bundle(Camera3dBundle::default()) - .insert(CameraUi { + .insert(UiCameraConfig { is_enabled: false, ..default() }) From 586daf41a93c6263f7b9c690922da9b207718f36 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 15 Jul 2022 12:18:10 -0400 Subject: [PATCH 06/49] add global task pool section --- .../book/migration-guides/0.7-0.8/_index.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 235a115b3b..63cbb8a068 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -18,6 +18,7 @@ Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis ### [Allow closing windows at runtime](https://github.com/bevyengine/bevy/pull/3575) `bevy::input::system::exit_on_esc_system` has been removed. Use `bevy::window::close_on_esc` instead. + `CloseWindow` has been removed. Use `Window::close` instead. The Close variant has been added to `WindowCommand`. Handle this by closing the relevant window. @@ -300,3 +301,20 @@ Exhaustive matches on `RenderGraphRunnerError` will need to add a branch to hand If you experienced any problems caused by this change, please [create an issue](https://github.com/bevyengine/bevy/issues) explaining _in detail_ what you were doing with those apis. + +### [Add global init and get accessors for all newtyped TaskPools](https://github.com/bevyengine/bevy/pull/2250) + +Thread pools don't need to be stored in a resource anymore since they are now stored globally. You can now use `get()` to access it. + +```rust +// 0.7 +fn spawn_tasks(mut commands: Commands, thread_pool: Res) { + // Do something with thread_pool +} + +// 0.8 +fn spawn_tasks(mut commands: Commands) { + let thread_pool = AsyncComputeTaskPool::get(); + // Do something with thread_pool +} +``` From 81d4b6e39a1821b8086d14160c45f2c4c4753e48 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 15 Jul 2022 12:34:53 -0400 Subject: [PATCH 07/49] update migration guide --- .../book/migration-guides/0.7-0.8/_index.md | 83 ++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 63cbb8a068..c3ce0499b4 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -308,13 +308,92 @@ Thread pools don't need to be stored in a resource anymore since they are now st ```rust // 0.7 -fn spawn_tasks(mut commands: Commands, thread_pool: Res) { +fn spawn_tasks(thread_pool: Res) { // Do something with thread_pool } // 0.8 -fn spawn_tasks(mut commands: Commands) { +fn spawn_tasks() { let thread_pool = AsyncComputeTaskPool::get(); // Do something with thread_pool } ``` + +### [Simplify design for *Labels](https://github.com/bevyengine/bevy/pull/4957) + +* Any previous use of `Box` should be replaced with `SystemLabelId`. +* `AsSystemLabel` trait has been modified. + * No more output generics. + * Method `as_system_label` now returns `SystemLabelId`, removing an unnecessary level of indirection. +* If you _need_ a label that is determined at runtime, you can use `Box::leak`. Not recommended. + +### [Move get_short_name utility method from bevy_reflect into bevy_utils](https://github.com/bevyengine/bevy/pull/5174) + +* added bevy_utils::get_short_name, which strips the path from a type name for convenient display. +* removed the TypeRegistry::get_short_name method. Use the function in bevy_utils instead. + +### [Remove dead SystemLabelMarker struct](https://github.com/bevyengine/bevy/pull/5190) + +This struct had no internal use, docs, or intuitable external use. + +It has been removed. + +### [Add reflection for resources](https://github.com/bevyengine/bevy/pull/5175) + +Rename `ReflectComponent::add_component` into `ReflectComponent::insert_component`. + +### [Make reflect_partial_eq return more accurate results](https://github.com/bevyengine/bevy/pull/5210) + +Updated [struct_trait](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/struct_trait.rs#L455-L457), [tuple_struct](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/tuple_struct.rs#L366-L368), [tuple](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/tuple.rs#L386), [array](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/array.rs#L335-L337), [list](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/list.rs#L309-L311) and [map](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/map.rs#L361-L363) to return `None` when comparison couldn't be performed. + +### [Rename CameraUi](https://github.com/bevyengine/bevy/pull/5234) + +Rename CameraUi to UiCameraConfig + +### [Make RenderStage::Extract run on the render world](https://github.com/bevyengine/bevy/pull/4402) + +The `Extract` `RenderStage` now runs on the render world (instead of the main world as before). +You must use the `Extract` `SystemParam` to access the main world during the extract phase. `Extract` takes a single type parameter, which is any system parameter (such as `Res`, `Query` etc.). It will extract this from the main world, and returns the result of this extraction when `value` is called on it. + +```rust +// 0.7 +fn extract_clouds(mut commands: Commands, clouds: Query>) { + for cloud in clouds.iter() { + commands.get_or_spawn(cloud).insert(Cloud); + } +} + +// 0.8 +fn extract_clouds(mut commands: Commands, mut clouds: Extract>>) { + for cloud in clouds.value().iter() { + commands.get_or_spawn(cloud).insert(Cloud); + } +} +``` + +You can now also access resources from the render world using the normal system parameters during `Extract`: + +```rust +fn extract_assets(mut render_assets: ResMut, source_assets: Extract>) { + *render_assets = source_assets.clone(); +} +``` + +Please note that all existing extract systems need to be updated to match this new style; even if they currently compile they will not run as expected. A warning will be emitted on a best-effort basis if this is not met. + +### [Improve Gamepad DPad Button Detection](https://github.com/bevyengine/bevy/pull/5220) + +If your game reads gamepad events or queries the axis state of GamePadAxisType::DPadX or GamePadAxisType::DPadY, then you must migrate your code to check whether or not the GamepadButtonType::DPadUp, GamepadButtonType::DPadDown, etc. buttons were pressed instead. + +### [Change window position types from tuple to vec](https://github.com/bevyengine/bevy/pull/5276) + +Changed the following fields + +* `WindowCommand::SetWindowMode.resolution` from `(u32, u32)` to `UVec2` +* `WindowCommand::SetResolution.logical_resolution` from `(f32, f32)` to `Vec2` + +### [Full documentation for bevy_asset](https://github.com/bevyengine/bevy/pull/3536) + +* Rename `FileAssetIo::get_root_path` uses to `FileAssetIo::get_base_path` + + `FileAssetIo::root_path()` is a getter for the `root_path` field, while `FileAssetIo::get_root_path` returned the parent directory of the asset root path, which was the executable's directory unless `CARGO_MANIFEST_DIR` was set. This change solves the ambiguity between the two methods. From fe3970c13ed9d3d923c8454d3e0246b8f17eb5de Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 12:48:11 -0400 Subject: [PATCH 08/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Nicola Papale --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index c3ce0499b4..804292547b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -234,7 +234,7 @@ UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Ca commands .spawn_bundle(Camera3dBundle::default()) .insert(UiCameraConfig { - is_enabled: false, + show_ui: false, ..default() }) ``` From e62e2bfe812bd0907dbf7e6b1c7de1ec9caf71c1 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:18:37 -0400 Subject: [PATCH 09/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Nicola Papale --- content/learn/book/migration-guides/0.7-0.8/_index.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 804292547b..a18c405321 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -346,10 +346,6 @@ Rename `ReflectComponent::add_component` into `ReflectComponent::insert_componen Updated [struct_trait](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/struct_trait.rs#L455-L457), [tuple_struct](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/tuple_struct.rs#L366-L368), [tuple](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/tuple.rs#L386), [array](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/array.rs#L335-L337), [list](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/list.rs#L309-L311) and [map](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/map.rs#L361-L363) to return `None` when comparison couldn't be performed. -### [Rename CameraUi](https://github.com/bevyengine/bevy/pull/5234) - -Rename CameraUi to UiCameraConfig - ### [Make RenderStage::Extract run on the render world](https://github.com/bevyengine/bevy/pull/4402) The `Extract` `RenderStage` now runs on the render world (instead of the main world as before). From fd517ea5236c8c31ab50786ffc1c6000a19da77f Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:18:57 -0400 Subject: [PATCH 10/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index a18c405321..ea209933ef 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -75,7 +75,7 @@ Replace imports of `bevy::core::FloatOrd` with `bevy::utils::FloatOrd`. ### [Move Rect to bevy_ui and rename it to UiRect](https://github.com/bevyengine/bevy/pull/4276) -The `Rect` type got renamed to `UiRect`. To migrate you just have to change every occurrence of `Rect` to `UiRect`. +The `Rect` type has been renamed to `UiRect`. ### [Rename ElementState to ButtonState](https://github.com/bevyengine/bevy/pull/4314) From 0c22c520bf1619fd5da64abd7aeaba67cee2cb24 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:19:20 -0400 Subject: [PATCH 11/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index ea209933ef..1c56765192 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -79,7 +79,7 @@ The `Rect` type has been renamed to `UiRect`. ### [Rename ElementState to ButtonState](https://github.com/bevyengine/bevy/pull/4314) -The `ElementState` type received a rename and is now called `ButtonState`. To migrate you just have to change every occurrence of `ElementState` to `ButtonState`. +The `ElementState` type has been renamed to `ButtonState`. ### [Improve docs and naming for RawWindowHandle functionality](https://github.com/bevyengine/bevy/pull/4335) From f0039f9c8bba8e2b3ad7c0f4ab98921e6230c82c Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:20:08 -0400 Subject: [PATCH 12/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 1c56765192..16f863ffc5 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -83,7 +83,7 @@ The `ElementState` type has been renamed to `ButtonState`. ### [Improve docs and naming for RawWindowHandle functionality](https://github.com/bevyengine/bevy/pull/4335) -rename `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper` +Renamed `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper`. ### [Migrate to encase from crevice](https://github.com/bevyengine/bevy/pull/4339) From a14a65c676ae994df2fb116b4c825ac45b47b7de Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:20:24 -0400 Subject: [PATCH 13/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 16f863ffc5..fcc5bd5627 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -127,7 +127,8 @@ If you needed this for tests purposes, you can use `bevy_ecs::system::assert_is_ ### [Change gamepad.rs tuples to normal structs](https://github.com/bevyengine/bevy/pull/4519) -The `Gamepad`, `GamepadButton`, `GamepadAxis`, `GamepadEvent` and `GamepadEventRaw` types are now normal structs instead of tuple structs and have a new() function. To migrate change every instantiation to use the `new()` function instead and use the appropriate field names instead of .0 and .1. +The `Gamepad`, `GamepadButton`, `GamepadAxis`, `GamepadEvent` and `GamepadEventRaw` types are now normal structs instead of tuple structs and have a new() function. +To migrate change every instantiation to use the `new()` function instead and use the appropriate field names instead of .0 and .1. ### [Remove EntityMut::get_unchecked](https://github.com/bevyengine/bevy/pull/4547) From d1084fe0459690d59e868df8a0624b6edaf81caa Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:24:23 -0400 Subject: [PATCH 14/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index fcc5bd5627..ab8d26cae1 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -186,7 +186,7 @@ fn parallel_system(query: Query<&MyComponent>) { } ``` -If using `Query(State)` outside of a system run by the scheduler, you may need to manually configure and initialize a `ComputeTaskPool` as a resource in the `World`. +If using `Query` or `QueryState` outside of a system run by the scheduler, you may need to manually configure and initialize a `ComputeTaskPool` as a resource in the `World`. ### [Fail to compile on 16-bit platforms](https://github.com/bevyengine/bevy/pull/4736) From 43be73530a5151038371b3f02a3336583b942ab7 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:26:43 -0400 Subject: [PATCH 15/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index ab8d26cae1..681a5ff42b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -190,7 +190,10 @@ If using `Query` or `QueryState` outside of a system run by the scheduler, you m ### [Fail to compile on 16-bit platforms](https://github.com/bevyengine/bevy/pull/4736) -`bevy_ecs` will now explicitly fail to compile on 16-bit platforms. If this is required, there is currently no alternative. Please file an issue () to help detail your use case. +`bevy_ecs` will now explicitly fail to compile on 16-bit platforms, as the behavior was undefined. + +There is currently no alternative, but we're open to adding support. +Please file an issue () to help detail your use case. ### [Camera Driven Rendering](https://github.com/bevyengine/bevy/pull/4745) From 92c47b78f1b3c6fe7d9e0156e61724205748cff0 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 15 Jul 2022 13:27:05 -0400 Subject: [PATCH 16/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 681a5ff42b..05e58f8d7c 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -383,7 +383,8 @@ Please note that all existing extract systems need to be updated to match this n ### [Improve Gamepad DPad Button Detection](https://github.com/bevyengine/bevy/pull/5220) -If your game reads gamepad events or queries the axis state of GamePadAxisType::DPadX or GamePadAxisType::DPadY, then you must migrate your code to check whether or not the GamepadButtonType::DPadUp, GamepadButtonType::DPadDown, etc. buttons were pressed instead. +D-pad inputs can no longer be accessed as axes. +Acess them as gamepad buttons instead. ### [Change window position types from tuple to vec](https://github.com/bevyengine/bevy/pull/5276) From 8fce72133f532120a7f439d2d86ef8dfd1890924 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 10:42:45 -0400 Subject: [PATCH 17/49] add code blocks and move camera rendering section --- .../book/migration-guides/0.7-0.8/_index.md | 114 +++++++++--------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 05e58f8d7c..dd2170793b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -11,6 +11,56 @@ long_title = "Migration Guide: 0.7 to 0.8" +### [Camera Driven Rendering](https://github.com/bevyengine/bevy/pull/4745) + + + +This is a very complicated change and it is recommended to read the linked PRs for more details + +```rust +// old 3d perspective camera +commands.spawn_bundle(PerspectiveCameraBundle::default()) + +// new 3d perspective camera +commands.spawn_bundle(Camera3dBundle::default()) +``` + +```rust +// old 2d orthographic camera +commands.spawn_bundle(OrthographicCameraBundle::new_2d()) + +// new 2d orthographic camera +commands.spawn_bundle(Camera2dBundle::default()) +``` + +```rust +// old 3d orthographic camera +commands.spawn_bundle(OrthographicCameraBundle::new_3d()) + +// new 3d orthographic camera +commands.spawn_bundle(Camera3dBundle { + projection: OrthographicProjection { + scale: 3.0, + scaling_mode: ScalingMode::FixedVertical, + ..default() + }.into(), + ..default() +}) +``` + +UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Camera2dBundle` and `Camera3dBundle` now both default to rendering UI as part of their own render graphs. To disable UI rendering for a camera, disable it using the CameraUi component: + +```rust +commands + .spawn_bundle(Camera3dBundle::default()) + .insert(UiCameraConfig { + show_ui: false, + ..default() + }) +``` + + + ### [Make ScalingMode more flexible](https://github.com/bevyengine/bevy/pull/3253) Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis for `FixedVertical` and `FixedHorizontal` and a new `ScalingMode` that is a mix of `FixedVertical` and `FixedHorizontal` @@ -89,19 +139,19 @@ Renamed `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper`. #### StorageBuffer -* removed set_body(), values(), values_mut(), clear(), push(), append() -* added set(), get(), get_mut() +* removed `set_body()`, `values()`, `values_mut()`, `clear()`, `push()`, `append()` +* added `set()`, `get()`, `get_mut()` #### UniformVec -> UniformBuffer -* renamed uniform_buffer() to buffer() -* removed len(), is_empty(), capacity(), push(), reserve(), clear(), values() -* added set(), get() +* renamed `uniform_buffer()` to `buffer()` +* removed `len()`, `is_empty()`, `capacity()`, `push()`, `reserve()`, `clear()`, `values()` +* added `set()`, `get()` #### DynamicUniformVec -> DynamicUniformBuffer -* renamed uniform_buffer() to buffer() -* removed capacity(), reserve() +* renamed `uniform_buffer()` to `buffer()` +* removed `capacity()`, `reserve()` ### [Make paused timers update just_finished on tick](https://github.com/bevyengine/bevy/pull/4445) @@ -136,7 +186,7 @@ Replace calls to `EntityMut::get_unchecked` with calls to `EntityMut::get`. ### [Replace ReadOnlyFetch with ReadOnlyWorldQuery](https://github.com/bevyengine/bevy/pull/4626) -The trait ReadOnlyFetch has been replaced with ReadOnlyWorldQuery along with the WorldQueryGats::ReadOnlyFetch assoc type which has been replaced with ::Fetch +The trait `ReadOnlyFetch` has been replaced with `ReadOnlyWorldQuery` along with the `WorldQueryGats::ReadOnlyFetch` assoc type which has been replaced with `::Fetch` The trait `ReadOnlyFetch` has been replaced with `ReadOnlyWorldQuery` along with the `WorldQueryGats::ReadOnlyFetch` assoc type which has been replaced with `::Fetch` @@ -195,54 +245,6 @@ If using `Query` or `QueryState` outside of a system run by the scheduler, you m There is currently no alternative, but we're open to adding support. Please file an issue () to help detail your use case. -### [Camera Driven Rendering](https://github.com/bevyengine/bevy/pull/4745) - - - -This is a very complicated change and it is recommended to read the linked PRs for more details - -```rust -// old 3d perspective camera -commands.spawn_bundle(PerspectiveCameraBundle::default()) - -// new 3d perspective camera -commands.spawn_bundle(Camera3dBundle::default()) -``` - -```rust -// old 2d orthographic camera -commands.spawn_bundle(OrthographicCameraBundle::new_2d()) - -// new 2d orthographic camera -commands.spawn_bundle(Camera2dBundle::default()) -``` - -```rust -// old 3d orthographic camera -commands.spawn_bundle(OrthographicCameraBundle::new_3d()) - -// new 3d orthographic camera -commands.spawn_bundle(Camera3dBundle { - projection: OrthographicProjection { - scale: 3.0, - scaling_mode: ScalingMode::FixedVertical, - ..default() - }.into(), - ..default() -}) -``` - -UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Camera2dBundle` and `Camera3dBundle` now both default to rendering UI as part of their own render graphs. To disable UI rendering for a camera, disable it using the CameraUi component: - -```rust -commands - .spawn_bundle(Camera3dBundle::default()) - .insert(UiCameraConfig { - show_ui: false, - ..default() - }) -``` - ### [Enforce type safe usage of Handle::get](https://github.com/bevyengine/bevy/pull/4794) `Assets::::get` and `Assets::::get_mut` now require that the passed handles are `Handle`, improving the type safety of handles. If you were previously passing in: From 5f3016c6a756837bada80e5e0bd00ad0394028bb Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 10:51:10 -0400 Subject: [PATCH 18/49] update guide Co-Author: Alice --- content/learn/book/migration-guides/0.7-0.8/_index.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index dd2170793b..7e476e3d14 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -205,9 +205,8 @@ Functions `update_component_access` and `update_archetype_component_access` have ### [Fix unsoundness with Or/AnyOf/Option component access'](https://github.com/bevyengine/bevy/pull/4659) - - -If you are now getting query conflicts from `Or`/`AnyOf`/`Option` rip to you and ur welcome for it now being caught. +Query conflicts from `Or`/`AnyOf`/`Option` have been fixed, and made stricter to avoid undefined behaviour. +If you have new query conflicts due to this you must refactor your systems; consider using `ParamSet`. ### [Remove task_pool parameter from par_for_each(_mut)](https://github.com/bevyengine/bevy/pull/4705) From 463223c46b46e52d880c1966b0ade989a93ad3cb Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 12:06:00 -0400 Subject: [PATCH 19/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 7e476e3d14..c3bd948f35 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -155,7 +155,7 @@ Renamed `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper`. ### [Make paused timers update just_finished on tick](https://github.com/bevyengine/bevy/pull/4445) -`Timer::times_finished has` been renamed to `Timer::times_finished_this_tick` for clarity. +`Timer::times_finished` has been renamed to `Timer::times_finished_this_tick` for clarity. ### [Change default Image FilterMode to Linear](https://github.com/bevyengine/bevy/pull/4465) From bba25a29973b96b7f4fef62d8ce2443aa7d54cdf Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 12:07:16 -0400 Subject: [PATCH 20/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- content/learn/book/migration-guides/0.7-0.8/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index c3bd948f35..23c594252a 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -354,7 +354,9 @@ Updated [struct_trait](https://github.com/bevyengine/bevy/blob/dfe969005264fff54 ### [Make RenderStage::Extract run on the render world](https://github.com/bevyengine/bevy/pull/4402) The `Extract` `RenderStage` now runs on the render world (instead of the main world as before). -You must use the `Extract` `SystemParam` to access the main world during the extract phase. `Extract` takes a single type parameter, which is any system parameter (such as `Res`, `Query` etc.). It will extract this from the main world, and returns the result of this extraction when `value` is called on it. +You must use the `Extract` `SystemParam` to access the main world during the extract phase. `Extract` takes a single type parameter, which is any system parameter (such as `Res`, `Query` etc.). +It will extract this from the main world. +Note that `Commands` will not work correctly in `Extract` - it will currently silently do nothing. ```rust // 0.7 From a7767e19e29f2b87bbadc64dd4d72ec7e7298954 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 12:07:35 -0400 Subject: [PATCH 21/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- content/learn/book/migration-guides/0.7-0.8/_index.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 23c594252a..89807fe4a8 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -254,7 +254,11 @@ Please file an issue () to help detai ### [Allow higher order systems](https://github.com/bevyengine/bevy/pull/4833) - +`SystemParamFunction` has changed. It was not previously part of the public API, so no migration instructions are provided. (It is now included in the public API, although you still should not implement this trait for your own types). + +If possible, any custom `System` implementations should be migrated to use higher order systems, which are significantly less error-prone. + +Research is needed into allowing this to work for more cases. ### [Added offset parameter to TextureAtlas::from_grid_with_padding](https://github.com/bevyengine/bevy/pull/4836) From c3a78d1c5d9f127bd40c6dab079141af9967942c Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 12:07:43 -0400 Subject: [PATCH 22/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 89807fe4a8..4da9802d88 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -372,7 +372,7 @@ fn extract_clouds(mut commands: Commands, clouds: Query>) { // 0.8 fn extract_clouds(mut commands: Commands, mut clouds: Extract>>) { - for cloud in clouds.value().iter() { + for cloud in clouds.iter() { commands.get_or_spawn(cloud).insert(Cloud); } } From 83ad9aa33355970cf8c51fd5620be6d92e37739c Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 12:44:34 -0400 Subject: [PATCH 23/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 4da9802d88..6c4c409b91 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -239,7 +239,7 @@ If using `Query` or `QueryState` outside of a system run by the scheduler, you m ### [Fail to compile on 16-bit platforms](https://github.com/bevyengine/bevy/pull/4736) -`bevy_ecs` will now explicitly fail to compile on 16-bit platforms, as the behavior was undefined. +`bevy_ecs` will now explicitly fail to compile on 16-bit platforms, , due to an inability to write sound unsafe code for these platforms. There is currently no alternative, but we're open to adding support. Please file an issue () to help detail your use case. From b55d0104d5d2d2512195b044e009f1a34fff699f Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 12:53:47 -0400 Subject: [PATCH 24/49] address more feedback --- .../book/migration-guides/0.7-0.8/_index.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 6c4c409b91..83607d0cbe 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -59,6 +59,13 @@ commands }) ``` +```rust +// 0.7 +camera.world_to_screen(transform, world_position); +// 0.8 +camera.world_to_viewport(transform, world_position); +``` + ### [Make ScalingMode more flexible](https://github.com/bevyengine/bevy/pull/3253) @@ -405,3 +412,33 @@ Changed the following fields * Rename `FileAssetIo::get_root_path` uses to `FileAssetIo::get_base_path` `FileAssetIo::root_path()` is a getter for the `root_path` field, while `FileAssetIo::get_root_path` returned the parent directory of the asset root path, which was the executable's directory unless `CARGO_MANIFEST_DIR` was set. This change solves the ambiguity between the two methods. + +### [Hierarchy commandization](https://github.com/bevyengine/bevy/pull/4197) + +The `Parent` and `Children` component fields are now private. + +* Replace `parent.0` by `parent.get()` +* Replace `children.0` with `*children` +* You can't construct `Children` or `Parent` component anymore, you can use this as a stopgap measure, which may introduce a single frame delay + +```rust +#[derive(Component)] +pub struct MakeChildOf(pub Entity); + +fn add_parent( + mut commands: Commands, + orphans: Query<(Entity, &MakeChildOf)>, +) { + for (child, MakeChildOf(parent)) in &orphans { + commands.entity(parent).add_child(child); + commands.entity(child).remove::(); + } +} +``` + +### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) + +`GlobalTransform` fields have changed + +* Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) +* `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you From 6c6e7d7e515641ce19fa829c3b397d9f24a30e60 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 13:00:20 -0400 Subject: [PATCH 25/49] spatial bundle --- content/learn/book/migration-guides/0.7-0.8/_index.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 83607d0cbe..bf6eae6a7c 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -66,7 +66,9 @@ camera.world_to_screen(transform, world_position); camera.world_to_viewport(transform, world_position); ``` - +### [SpatialBundle](https://github.com/bevyengine/bevy/pull/5344) + +If you previously needed a `TransformBundle` and a `VisibilityBundle` you should now use a `SpatialBundle` ### [Make ScalingMode more flexible](https://github.com/bevyengine/bevy/pull/3253) @@ -442,3 +444,5 @@ fn add_parent( * Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) * `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you + + \ No newline at end of file From a4b7c283b57aa717130e3e504d4b654c4707ed8c Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 13:09:26 -0400 Subject: [PATCH 26/49] add more breaking PRs --- .../book/migration-guides/0.7-0.8/_index.md | 59 +++++++++++++++++-- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index bf6eae6a7c..8cc163a5a1 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -415,6 +415,15 @@ Changed the following fields `FileAssetIo::root_path()` is a getter for the `root_path` field, while `FileAssetIo::get_root_path` returned the parent directory of the asset root path, which was the executable's directory unless `CARGO_MANIFEST_DIR` was set. This change solves the ambiguity between the two methods. +### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) + +`GlobalTransform` fields have changed + +* Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) +* `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you + + + ### [Hierarchy commandization](https://github.com/bevyengine/bevy/pull/4197) The `Parent` and `Children` component fields are now private. @@ -438,11 +447,51 @@ fn add_parent( } ``` -### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) +### [Visibilty Inheritance, universal ComputedVisibility and RenderLayers support](https://github.com/bevyengine/bevy/pull/5310) -`GlobalTransform` fields have changed +If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: -* Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) -* `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you +```rust +// before (0.7) +fn system(query: Query<&Visibility>) { + for visibility in query.iter() { + if visibility.is_visible { + log!("found visible entity"); + } + } +} + +// after (0.8) +fn system(query: Query<&ComputedVisibility>) { + for visibility in query.iter() { + if visibility.is_visible() { + log!("found visible entity"); + } + } +} +``` + +### [remove blanket Serialize + Deserialize requirement for Reflect on generic types](https://github.com/bevyengine/bevy/pull/5197) + +* `.register_type` for generic types like `Option`, `Vec`, `HashMap` will no longer insert `ReflectSerialize` and `ReflectDeserialize` type data. Instead you need to register it separately for concrete generic types like so: + +```rust + .register_type::>() + .register_type_data::, ReflectSerialize>() + .register_type_data::, ReflectDeserialize>() +``` + +### [add a SceneBundle to spawn a scene](https://github.com/bevyengine/bevy/pull/2424) + +```rust +// 0.7 +commands.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0")); + +//0.8 +commands.spawn_bundle(SceneBundle { + scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"), + ..Default::default() +}); +``` - \ No newline at end of file +The scene will be spawned as a child of the entity with the `SceneBundle` From 9bd7ceb6d10742598f8fcb3f139fd41c4b501a69 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 13:17:33 -0400 Subject: [PATCH 27/49] fix TODOs --- .../book/migration-guides/0.7-0.8/_index.md | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 8cc163a5a1..4920cc3e68 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -13,7 +13,7 @@ long_title = "Migration Guide: 0.7 to 0.8" ### [Camera Driven Rendering](https://github.com/bevyengine/bevy/pull/4745) - + This is a very complicated change and it is recommended to read the linked PRs for more details @@ -168,14 +168,16 @@ Renamed `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper`. ### [Change default Image FilterMode to Linear](https://github.com/bevyengine/bevy/pull/4465) +Default `Image` filtering changed from `Nearest` to `Linear`. + ```rs // 0.7 -//TODO +// Nothing, nearest was the default // 0.8 - -// TODO +App::new() + .insert_resource(ImageSettings::default_nearest()) ``` ### [Remove .system()](https://github.com/bevyengine/bevy/pull/4499) @@ -421,8 +423,18 @@ Changed the following fields * Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) * `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you +* If you need the `scale`, `rotation` or `translation` property you can now use `global_transform.to_scale_rotation_translation()` - +```rust +// 0.7 +let transform = Transform::from(*global_transform); +transform.scale +transform.rotation +transform.translation + +// 0.8 +let (scale, rotation, translation) = global_transform.to_scale_rotation_translation(); +``` ### [Hierarchy commandization](https://github.com/bevyengine/bevy/pull/4197) From 32f7a67e1245bb49cf4be6265a82eb758a3d1fc8 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 13:28:47 -0400 Subject: [PATCH 28/49] reorder by importance --- .../book/migration-guides/0.7-0.8/_index.md | 116 +++++++++--------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 4920cc3e68..43e4026c73 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -66,6 +66,64 @@ camera.world_to_screen(transform, world_position); camera.world_to_viewport(transform, world_position); ``` +### [Visibilty Inheritance, universal ComputedVisibility and RenderLayers support](https://github.com/bevyengine/bevy/pull/5310) + +If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: + +```rust +// before (0.7) +fn system(query: Query<&Visibility>) { + for visibility in query.iter() { + if visibility.is_visible { + log!("found visible entity"); + } + } +} + +// after (0.8) +fn system(query: Query<&ComputedVisibility>) { + for visibility in query.iter() { + if visibility.is_visible() { + log!("found visible entity"); + } + } +} +``` + +### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) + +`GlobalTransform` fields have changed + +* Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) +* `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you +* If you need the `scale`, `rotation` or `translation` property you can now use `global_transform.to_scale_rotation_translation()` + +```rust +// 0.7 +let transform = Transform::from(*global_transform); +transform.scale +transform.rotation +transform.translation + +// 0.8 +let (scale, rotation, translation) = global_transform.to_scale_rotation_translation(); +``` + +### [add a SceneBundle to spawn a scene](https://github.com/bevyengine/bevy/pull/2424) + +```rust +// 0.7 +commands.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0")); + +//0.8 +commands.spawn_bundle(SceneBundle { + scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"), + ..Default::default() +}); +``` + +The scene will be spawned as a child of the entity with the `SceneBundle` + ### [SpatialBundle](https://github.com/bevyengine/bevy/pull/5344) If you previously needed a `TransformBundle` and a `VisibilityBundle` you should now use a `SpatialBundle` @@ -417,25 +475,6 @@ Changed the following fields `FileAssetIo::root_path()` is a getter for the `root_path` field, while `FileAssetIo::get_root_path` returned the parent directory of the asset root path, which was the executable's directory unless `CARGO_MANIFEST_DIR` was set. This change solves the ambiguity between the two methods. -### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) - -`GlobalTransform` fields have changed - -* Replace `global_transform.translation` by `global_transform.translation()` (For other fields, use the `compute_transform` method) -* `GlobalTransform` do not support non-linear scales anymore, we'd like to hear from you if it is an inconvenience for you -* If you need the `scale`, `rotation` or `translation` property you can now use `global_transform.to_scale_rotation_translation()` - -```rust -// 0.7 -let transform = Transform::from(*global_transform); -transform.scale -transform.rotation -transform.translation - -// 0.8 -let (scale, rotation, translation) = global_transform.to_scale_rotation_translation(); -``` - ### [Hierarchy commandization](https://github.com/bevyengine/bevy/pull/4197) The `Parent` and `Children` component fields are now private. @@ -459,30 +498,6 @@ fn add_parent( } ``` -### [Visibilty Inheritance, universal ComputedVisibility and RenderLayers support](https://github.com/bevyengine/bevy/pull/5310) - -If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: - -```rust -// before (0.7) -fn system(query: Query<&Visibility>) { - for visibility in query.iter() { - if visibility.is_visible { - log!("found visible entity"); - } - } -} - -// after (0.8) -fn system(query: Query<&ComputedVisibility>) { - for visibility in query.iter() { - if visibility.is_visible() { - log!("found visible entity"); - } - } -} -``` - ### [remove blanket Serialize + Deserialize requirement for Reflect on generic types](https://github.com/bevyengine/bevy/pull/5197) * `.register_type` for generic types like `Option`, `Vec`, `HashMap` will no longer insert `ReflectSerialize` and `ReflectDeserialize` type data. Instead you need to register it separately for concrete generic types like so: @@ -492,18 +507,3 @@ fn system(query: Query<&ComputedVisibility>) { .register_type_data::, ReflectSerialize>() .register_type_data::, ReflectDeserialize>() ``` - -### [add a SceneBundle to spawn a scene](https://github.com/bevyengine/bevy/pull/2424) - -```rust -// 0.7 -commands.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0")); - -//0.8 -commands.spawn_bundle(SceneBundle { - scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"), - ..Default::default() -}); -``` - -The scene will be spawned as a child of the entity with the `SceneBundle` From 9f3770d554f32b593140fe026f919e2050da19fc Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 13:29:45 -0400 Subject: [PATCH 29/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 43e4026c73..0ada315c5b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -246,7 +246,7 @@ If you needed this for tests purposes, you can use `bevy_ecs::system::assert_is_ ### [Change gamepad.rs tuples to normal structs](https://github.com/bevyengine/bevy/pull/4519) -The `Gamepad`, `GamepadButton`, `GamepadAxis`, `GamepadEvent` and `GamepadEventRaw` types are now normal structs instead of tuple structs and have a new() function. +The `Gamepad`, `GamepadButton`, `GamepadAxis`, `GamepadEvent` and `GamepadEventRaw` types are now normal structs instead of tuple structs and have a `new` function. To migrate change every instantiation to use the `new()` function instead and use the appropriate field names instead of .0 and .1. ### [Remove EntityMut::get_unchecked](https://github.com/bevyengine/bevy/pull/4547) From 46683e4c0def0fd76cfc715e39b9b015e71ef10c Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 13:43:29 -0400 Subject: [PATCH 30/49] move SpatialBundle closer to visibility stuff --- content/learn/book/migration-guides/0.7-0.8/_index.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 0ada315c5b..24819e7245 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -90,6 +90,12 @@ fn system(query: Query<&ComputedVisibility>) { } ``` +### [SpatialBundle](https://github.com/bevyengine/bevy/pull/5344) + +If you previously needed a `TransformBundle` and a `VisibilityBundle` you should now use a `SpatialBundle`. + +If things are misteriously not visible anymore, it's most likely because you need to use a `SpatialBundle`. + ### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) `GlobalTransform` fields have changed @@ -124,10 +130,6 @@ commands.spawn_bundle(SceneBundle { The scene will be spawned as a child of the entity with the `SceneBundle` -### [SpatialBundle](https://github.com/bevyengine/bevy/pull/5344) - -If you previously needed a `TransformBundle` and a `VisibilityBundle` you should now use a `SpatialBundle` - ### [Make ScalingMode more flexible](https://github.com/bevyengine/bevy/pull/3253) Adds ability to specify scaling factor for `WindowSize`, size of the fixed axis for `FixedVertical` and `FixedHorizontal` and a new `ScalingMode` that is a mix of `FixedVertical` and `FixedHorizontal` From 20aaf38178517f63822ab9ff60683a033a10905c Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 13:46:46 -0400 Subject: [PATCH 31/49] rephrase --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 24819e7245..716cc28fea 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -94,7 +94,7 @@ fn system(query: Query<&ComputedVisibility>) { If you previously needed a `TransformBundle` and a `VisibilityBundle` you should now use a `SpatialBundle`. -If things are misteriously not visible anymore, it's most likely because you need to use a `SpatialBundle`. +If you were defining your own bundle with `Transform` and `Visibility` components, make sure they now have a `ComputedVisiblity` component. ### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) From 9e564eb8e4cf297e1c16d02621840f8def216d73 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 14:11:24 -0400 Subject: [PATCH 32/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.7-0.8/_index.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 716cc28fea..b2d3b7539c 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -90,11 +90,16 @@ fn system(query: Query<&ComputedVisibility>) { } ``` -### [SpatialBundle](https://github.com/bevyengine/bevy/pull/5344) +### [Visibility Inheritance](https://github.com/bevyengine/bevy/pull/5310) -If you previously needed a `TransformBundle` and a `VisibilityBundle` you should now use a `SpatialBundle`. +`Visibility` is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. -If you were defining your own bundle with `Transform` and `Visibility` components, make sure they now have a `ComputedVisiblity` component. +[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. + +[`Visibility`]: https://docs.rs/bevy/0.8.0/bevy/render/view/struct.Visibility.html +[`ComputedVisiblity`]: https://docs.rs/bevy/0.8.0/bevy/render/view/struct.ComputedVisibility.html +[`SpatialBundle`]: https://docs.rs/bevy/0.8.0/bevy/prelude/struct.SpatialBundle.html +[`VisibilityBundle`]: https://docs.rs/bevy/0.8.0/bevy/prelude/struct.VisibilityBundle.html ### [Use Affine3A for GlobalTransform to allow any affine transformation](https://github.com/bevyengine/bevy/pull/4379) From f5c51626add676d1ce5e8b005df17b0ff5b7b1e4 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 14:12:07 -0400 Subject: [PATCH 33/49] merge with other section --- content/learn/book/migration-guides/0.7-0.8/_index.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index b2d3b7539c..c72fa624c7 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -68,6 +68,10 @@ camera.world_to_viewport(transform, world_position); ### [Visibilty Inheritance, universal ComputedVisibility and RenderLayers support](https://github.com/bevyengine/bevy/pull/5310) +`Visibility` is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. + +[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. + If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: ```rust @@ -90,12 +94,6 @@ fn system(query: Query<&ComputedVisibility>) { } ``` -### [Visibility Inheritance](https://github.com/bevyengine/bevy/pull/5310) - -`Visibility` is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. - -[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. - [`Visibility`]: https://docs.rs/bevy/0.8.0/bevy/render/view/struct.Visibility.html [`ComputedVisiblity`]: https://docs.rs/bevy/0.8.0/bevy/render/view/struct.ComputedVisibility.html [`SpatialBundle`]: https://docs.rs/bevy/0.8.0/bevy/prelude/struct.SpatialBundle.html From 18ccaa1c44adc56879e56b06dda5f0896b81abd6 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 14:26:33 -0400 Subject: [PATCH 34/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index c72fa624c7..7d5e228b4b 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -68,7 +68,7 @@ camera.world_to_viewport(transform, world_position); ### [Visibilty Inheritance, universal ComputedVisibility and RenderLayers support](https://github.com/bevyengine/bevy/pull/5310) -`Visibility` is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. +[`Visibility`] is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. [`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. From 01631ffb52e78e2200dce72186c07b29e73ee152 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 14:29:21 -0400 Subject: [PATCH 35/49] add small sentence --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index c72fa624c7..b1c71faa31 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -70,7 +70,7 @@ camera.world_to_viewport(transform, world_position); `Visibility` is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. -[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. +[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. If you were using a `TransformBundle` you should probably be using a `SpatialBundle` now. If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: From 5a739fe4a8e6e7240623db53444fbc2da88aa840 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 14:33:10 -0400 Subject: [PATCH 36/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Ida Iyes <40234599+inodentry@users.noreply.github.com> --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 6cebf14afc..a620da5a86 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -150,7 +150,7 @@ The run criterion `RunOnce`, which would make the controlled systems run only on ### [Move system_param fetch struct into anonymous scope to avoid name collisions](https://github.com/bevyengine/bevy/pull/4100) -For code that was using a system param's fetch struct, such as EventReader's EventReaderState, the fetch struct can now be identified via the SystemParam trait associated type Fetch, e.g. for `EventReader` it can be identified as `` as SystemParam>::Fetch +For code that was using a system param's fetch struct, such as EventReader's EventReaderState, the fetch struct can now be identified via the SystemParam trait associated type Fetch, e.g. for `EventReader` it can be identified as ` as SystemParam>::Fetch` ### [Task doesn't impl Component](https://github.com/bevyengine/bevy/pull/4113) From 8bbdd6169f876229433a339f0b7e222660644694 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 14:33:15 -0400 Subject: [PATCH 37/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index a620da5a86..e8f9a76152 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -465,7 +465,7 @@ Please note that all existing extract systems need to be updated to match this n ### [Improve Gamepad DPad Button Detection](https://github.com/bevyengine/bevy/pull/5220) D-pad inputs can no longer be accessed as axes. -Acess them as gamepad buttons instead. +Access them as gamepad buttons instead. ### [Change window position types from tuple to vec](https://github.com/bevyengine/bevy/pull/5276) From 492c8a28f18fbd35386150f3e2258f3bb246bfd2 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 14:33:21 -0400 Subject: [PATCH 38/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index e8f9a76152..b48364ae67 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -265,7 +265,7 @@ The trait `ReadOnlyFetch` has been replaced with `ReadOnlyWorldQuery` along with The trait `ReadOnlyFetch` has been replaced with `ReadOnlyWorldQuery` along with the `WorldQueryGats::ReadOnlyFetch` assoc type which has been replaced with `::Fetch` * Any where clauses such as `QueryFetch: ReadOnlyFetch` should be replaced with `Q: ReadOnlyWorldQuery`. -* Any custom world query impls should implement `ReadOnlyWorldQuery` insead of `ReadOnlyFetch` +* Any custom world query impls should implement `ReadOnlyWorldQuery` instead of `ReadOnlyFetch` Functions `update_component_access` and `update_archetype_component_access` have been moved from the `FetchState` trait to `WorldQuery` From 9d70e9acc2afb8b85032e6c038c66a7ebccbe925 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 22 Jul 2022 14:54:09 -0400 Subject: [PATCH 39/49] Apply suggestions from code review Co-authored-by: Rob Parrett --- .../learn/book/migration-guides/0.7-0.8/_index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index b48364ae67..c0a836d28f 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -79,7 +79,7 @@ If you were previously reading `Visibility::is_visible` as the "actual visibilit fn system(query: Query<&Visibility>) { for visibility in query.iter() { if visibility.is_visible { - log!("found visible entity"); + info!("found visible entity"); } } } @@ -88,7 +88,7 @@ fn system(query: Query<&Visibility>) { fn system(query: Query<&ComputedVisibility>) { for visibility in query.iter() { if visibility.is_visible() { - log!("found visible entity"); + info!("found visible entity"); } } } @@ -181,7 +181,7 @@ fn system(mut commands: Commands) { } Vec2::ZERO }); - commands.spawn().insert(ComputeVec2(task)) + commands.spawn().insert(ComputeVec2(task)); } ``` @@ -294,7 +294,7 @@ fn parallel_system( query: Query<&MyComponent>, ) { query.par_for_each(&task_pool, 32, |comp| { - ... + // ... }); } ``` @@ -304,7 +304,7 @@ After: ```rust fn parallel_system(query: Query<&MyComponent>) { query.par_for_each(32, |comp| { - ... + // ... }); } ``` @@ -497,7 +497,7 @@ fn add_parent( orphans: Query<(Entity, &MakeChildOf)>, ) { for (child, MakeChildOf(parent)) in &orphans { - commands.entity(parent).add_child(child); + commands.entity(*parent).add_child(child); commands.entity(child).remove::(); } } From 5456165c6a7aaee411f868b2f790318a58c33a38 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 22 Jul 2022 16:07:14 -0400 Subject: [PATCH 40/49] update 16-bit --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index c0a836d28f..02f2261b79 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -313,7 +313,7 @@ If using `Query` or `QueryState` outside of a system run by the scheduler, you m ### [Fail to compile on 16-bit platforms](https://github.com/bevyengine/bevy/pull/4736) -`bevy_ecs` will now explicitly fail to compile on 16-bit platforms, , due to an inability to write sound unsafe code for these platforms. +`bevy_ecs` will now explicitly fail to compile on 16-bit platforms, because it is unsound on those platforms due to various internal assumptions. There is currently no alternative, but we're open to adding support. Please file an issue () to help detail your use case. From bfcc0e2538bffddf21107b96f66bc2e681c7ebf4 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 23 Jul 2022 01:32:48 -0400 Subject: [PATCH 41/49] UiCameraConfig --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 02f2261b79..3e082949f6 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -48,7 +48,7 @@ commands.spawn_bundle(Camera3dBundle { }) ``` -UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Camera2dBundle` and `Camera3dBundle` now both default to rendering UI as part of their own render graphs. To disable UI rendering for a camera, disable it using the CameraUi component: +UI no longer requires a dedicated camera. `UiCameraBundle` has been removed. `Camera2dBundle` and `Camera3dBundle` now both default to rendering UI as part of their own render graphs. To disable UI rendering for a camera, disable it using the `UiCameraConfig` component: ```rust commands From 2b407891d52f3e7fbc46c5c4de8e930d0ce18842 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 23 Jul 2022 13:17:53 -0400 Subject: [PATCH 42/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.7-0.8/_index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 3e082949f6..8841e7f345 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -62,6 +62,7 @@ commands ```rust // 0.7 camera.world_to_screen(transform, world_position); + // 0.8 camera.world_to_viewport(transform, world_position); ``` From eb26d695e6d0aad6edb3214c5e0ff21c4843106a Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 23 Jul 2022 13:19:02 -0400 Subject: [PATCH 43/49] Apply suggestions from code review Co-authored-by: Rob Parrett --- .../book/migration-guides/0.7-0.8/_index.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 8841e7f345..15afbcd6fe 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -76,7 +76,7 @@ camera.world_to_viewport(transform, world_position); If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: ```rust -// before (0.7) +// 0.7 fn system(query: Query<&Visibility>) { for visibility in query.iter() { if visibility.is_visible { @@ -85,7 +85,7 @@ fn system(query: Query<&Visibility>) { } } -// after (0.8) +// 0.8 fn system(query: Query<&ComputedVisibility>) { for visibility in query.iter() { if visibility.is_visible() { @@ -125,7 +125,7 @@ let (scale, rotation, translation) = global_transform.to_scale_rotation_translat // 0.7 commands.spawn_scene(asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0")); -//0.8 +// 0.8 commands.spawn_bundle(SceneBundle { scene: asset_server.load("models/FlightHelmet/FlightHelmet.gltf#Scene0"), ..Default::default() @@ -287,9 +287,9 @@ If you have new query conflicts due to this you must refactor your systems; cons The `task_pool` parameter for `Query(State)::par_for_each(_mut)` has been removed. Remove these parameters from all calls to these functions. -Before: ```rust +// 0.7 fn parallel_system( task_pool: Res, query: Query<&MyComponent>, @@ -298,11 +298,8 @@ fn parallel_system( // ... }); } -``` - -After: -```rust +// 0.8 fn parallel_system(query: Query<&MyComponent>) { query.par_for_each(32, |comp| { // ... @@ -340,9 +337,10 @@ Research is needed into allowing this to work for more cases. Calls to `TextureAtlas::from_grid_with_padding` should be modified to include a new parameter, which can be set to `Vec2::ZERO` to retain old behaviour. ```rust +// 0.7 from_grid_with_padding(texture, tile_size, columns, rows, padding) - | - V + +// 0.8 from_grid_with_padding(texture, tile_size, columns, rows, padding, Vec2::ZERO) ``` From 4072013044551503f6c7340d520d6ee62bae4ec6 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 23 Jul 2022 13:31:23 -0400 Subject: [PATCH 44/49] various fixes --- .../book/migration-guides/0.7-0.8/_index.md | 47 +++++++++---------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 15afbcd6fe..4b3bf13f54 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -71,7 +71,7 @@ camera.world_to_viewport(transform, world_position); [`Visibility`] is now propagated into children in a similar way to `Transform`. Root elements of a hierarchy must now contain [`Visibility`] and [`ComputedVisiblity`] for visibility propagation to work. -[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. If you were using a `TransformBundle` you should probably be using a `SpatialBundle` now. +[`SpatialBundle`] and [`VisibilityBundle`] have been added for convenience. If you were using a `TransformBundle` you should probably be using a [`SpatialBundle`] now. If you were previously reading `Visibility::is_visible` as the "actual visibility" for sprites or lights, use `ComputedVisibilty::is_visible()` instead: @@ -119,7 +119,7 @@ transform.translation let (scale, rotation, translation) = global_transform.to_scale_rotation_translation(); ``` -### [add a SceneBundle to spawn a scene](https://github.com/bevyengine/bevy/pull/2424) +### [Add a SceneBundle to spawn a scene](https://github.com/bevyengine/bevy/pull/2424) ```rust // 0.7 @@ -161,10 +161,7 @@ If you need a `Task` to be a `Component` you should use a wrapper type. // 0.7 fn system(mut commands: Commands) { let task = thread_pool.spawn(async move { - let start_time = Instant::now(); - while Instant::now() - start_time < Duration::from_secs_f32(5.0) { - // Spinning for 'duration', simulating doing hard - } + // Complicated async work Vec2::ZERO }); commands.spawn().insert(task); @@ -176,10 +173,7 @@ struct ComputeVec2(Task); fn system(mut commands: Commands) { let task = thread_pool.spawn(async move { - let start_time = Instant::now(); - while Instant::now() - start_time < Duration::from_secs_f32(5.0) { - // Spinning for 'duration', simulating doing hard - } + // Complicated async work Vec2::ZERO }); commands.spawn().insert(ComputeVec2(task)); @@ -287,7 +281,6 @@ If you have new query conflicts due to this you must refactor your systems; cons The `task_pool` parameter for `Query(State)::par_for_each(_mut)` has been removed. Remove these parameters from all calls to these functions. - ```rust // 0.7 fn parallel_system( @@ -314,7 +307,7 @@ If using `Query` or `QueryState` outside of a system run by the scheduler, you m `bevy_ecs` will now explicitly fail to compile on 16-bit platforms, because it is unsound on those platforms due to various internal assumptions. There is currently no alternative, but we're open to adding support. -Please file an issue () to help detail your use case. +Please [file an issue](https://github.com/bevyengine/bevy/issues) to help detail your use case. ### [Enforce type safe usage of Handle::get](https://github.com/bevyengine/bevy/pull/4794) @@ -346,21 +339,23 @@ from_grid_with_padding(texture, tile_size, columns, rows, padding, Vec2::ZERO) ### [Split mesh shader files](https://github.com/bevyengine/bevy/pull/4867) -* In shaders for 3D meshes: - * `#import bevy_pbr::mesh_view_bind_group` -> `#import bevy_pbr::mesh_view_bindings` - * `#import bevy_pbr::mesh_struct` -> `#import bevy_pbr::mesh_types` - * NOTE: If you are using the mesh bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_pbr::mesh_bindings` which itself imports the mesh types needed for the bindings. -* In shaders for 2D meshes: - * `#import bevy_sprite::mesh2d_view_bind_group` -> `#import bevy_sprite::mesh2d_view_bindings` - * `#import bevy_sprite::mesh2d_struct` -> `#import bevy_sprite::mesh2d_types` - * NOTE: If you are using the mesh2d bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_sprite::mesh2d_bindings` which itself imports the mesh2d types needed for the bindings. +In shaders for 3D meshes: + +* `#import bevy_pbr::mesh_view_bind_group` -> `#import bevy_pbr::mesh_view_bindings` +* `#import bevy_pbr::mesh_struct` -> `#import bevy_pbr::mesh_types` + * NOTE: If you are using the mesh bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_pbr::mesh_bindings` which itself imports the mesh types needed for the bindings. + +In shaders for 2D meshes: + +* `#import bevy_sprite::mesh2d_view_bind_group` -> `#import bevy_sprite::mesh2d_view_bindings` +* `#import bevy_sprite::mesh2d_struct` -> `#import bevy_sprite::mesh2d_types` + * NOTE: If you are using the mesh2d bind group at bind group index 2, you can remove those binding statements in your shader and just use `#import bevy_sprite::mesh2d_bindings` which itself imports the mesh2d types needed for the bindings. ### [Camera Driven Viewports](https://github.com/bevyengine/bevy/pull/4898) `Camera::projection_matrix` is no longer a public field. Use the new `Camera::projection_matrix()` method instead: ```rust - // 0.7 let projection = camera.projection_matrix; @@ -368,7 +363,7 @@ let projection = camera.projection_matrix; let projection = camera.projection_matrix(); ``` -### [diagnostics: meaningful error when graph node has wrong number of inputs](https://github.com/bevyengine/bevy/pull/4924) +### [Diagnostics: meaningful error when graph node has wrong number of inputs](https://github.com/bevyengine/bevy/pull/4924) Exhaustive matches on `RenderGraphRunnerError` will need to add a branch to handle the new `MismatchedInputCount` variant. @@ -475,9 +470,9 @@ Changed the following fields ### [Full documentation for bevy_asset](https://github.com/bevyengine/bevy/pull/3536) -* Rename `FileAssetIo::get_root_path` uses to `FileAssetIo::get_base_path` +Rename `FileAssetIo::get_root_path` to `FileAssetIo::get_base_path` - `FileAssetIo::root_path()` is a getter for the `root_path` field, while `FileAssetIo::get_root_path` returned the parent directory of the asset root path, which was the executable's directory unless `CARGO_MANIFEST_DIR` was set. This change solves the ambiguity between the two methods. +`FileAssetIo::root_path()` is a getter for the `root_path` field, while `FileAssetIo::get_root_path` returned the parent directory of the asset root path, which was the executable's directory unless `CARGO_MANIFEST_DIR` was set. This change solves the ambiguity between the two methods. ### [Hierarchy commandization](https://github.com/bevyengine/bevy/pull/4197) @@ -502,9 +497,9 @@ fn add_parent( } ``` -### [remove blanket Serialize + Deserialize requirement for Reflect on generic types](https://github.com/bevyengine/bevy/pull/5197) +### [Remove blanket Serialize + Deserialize requirement for Reflect on generic types](https://github.com/bevyengine/bevy/pull/5197) -* `.register_type` for generic types like `Option`, `Vec`, `HashMap` will no longer insert `ReflectSerialize` and `ReflectDeserialize` type data. Instead you need to register it separately for concrete generic types like so: +`.register_type` for generic types like `Option`, `Vec`, `HashMap` will no longer insert `ReflectSerialize` and `ReflectDeserialize` type data. Instead you need to register it separately for concrete generic types like so: ```rust .register_type::>() From ec757aaf4a4e1f82a43f15a4e21e674db5997755 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 23 Jul 2022 13:43:05 -0400 Subject: [PATCH 45/49] update reflect_partial_eq --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 4b3bf13f54..3a3509f2ea 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -421,7 +421,7 @@ Rename `ReflectComponent::add_component` into `ReflectComponent::insert_componen ### [Make reflect_partial_eq return more accurate results](https://github.com/bevyengine/bevy/pull/5210) -Updated [struct_trait](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/struct_trait.rs#L455-L457), [tuple_struct](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/tuple_struct.rs#L366-L368), [tuple](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/tuple.rs#L386), [array](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/array.rs#L335-L337), [list](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/list.rs#L309-L311) and [map](https://github.com/bevyengine/bevy/blob/dfe969005264fff54060f9fb148639f80f9cfb29/crates/bevy_reflect/src/map.rs#L361-L363) to return `None` when comparison couldn't be performed. +Previously, all `reflect_***_partial_eq` helper methods returned `Some(false)` when the comparison could not be performed, which was misleading. They now return `None` when the comparison cannot be performed. ### [Make RenderStage::Extract run on the render world](https://github.com/bevyengine/bevy/pull/4402) From 754f295ae55a88091b48c6493628df238f27d2f0 Mon Sep 17 00:00:00 2001 From: Aevyrie Date: Tue, 26 Jul 2022 01:09:26 -0700 Subject: [PATCH 46/49] Add no default features from PR #5447 --- .../learn/book/migration-guides/0.7-0.8/_index.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 3a3509f2ea..1e69a59d68 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -506,3 +506,16 @@ fn add_parent( .register_type_data::, ReflectSerialize>() .register_type_data::, ReflectDeserialize>() ``` + +### [Lighter no default features](https://github.com/bevyengine/bevy/pull/5447) + +`bevy_asset` and `bevy_scene` are no longer enabled when `no-default-features` is used with the `bevy` dependency. + +- Crates that use bevy with `no-default-features` will need to add these features manually + +```toml +bevy = { version = "0.8", default-features = false, features = [ + "bevy_asset", + "bevy_scene", +] } +``` From de8f981c180a26b0c5a647d73aa54f3f15964b65 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 26 Jul 2022 10:13:54 -0400 Subject: [PATCH 47/49] show thread_pool origin --- content/learn/book/migration-guides/0.7-0.8/_index.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 1e69a59d68..4866c19aec 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -159,7 +159,7 @@ If you need a `Task` to be a `Component` you should use a wrapper type. ```rs // 0.7 -fn system(mut commands: Commands) { +fn system(mut commands: Commands, thread_pool: Res) { let task = thread_pool.spawn(async move { // Complicated async work Vec2::ZERO @@ -172,6 +172,7 @@ fn system(mut commands: Commands) { struct ComputeVec2(Task); fn system(mut commands: Commands) { + let thread_pool = AsyncComputeTaskPool::get(); let task = thread_pool.spawn(async move { // Complicated async work Vec2::ZERO @@ -511,7 +512,7 @@ fn add_parent( `bevy_asset` and `bevy_scene` are no longer enabled when `no-default-features` is used with the `bevy` dependency. -- Crates that use bevy with `no-default-features` will need to add these features manually +* Crates that use bevy with `no-default-features` will need to add these features manually ```toml bevy = { version = "0.8", default-features = false, features = [ From c739af9ab984a8b36047329b0cbbdceb9b52eb62 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 26 Jul 2022 10:25:56 -0400 Subject: [PATCH 48/49] Update content/learn/book/migration-guides/0.7-0.8/_index.md Co-authored-by: Alice Cecile --- content/learn/book/migration-guides/0.7-0.8/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 4866c19aec..233a47ec98 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -512,7 +512,7 @@ fn add_parent( `bevy_asset` and `bevy_scene` are no longer enabled when `no-default-features` is used with the `bevy` dependency. -* Crates that use bevy with `no-default-features` will need to add these features manually +* Crates that use Bevy with `no-default-features` will need to add these features manually if they rely on them. ```toml bevy = { version = "0.8", default-features = false, features = [ From 73a5529415a2ff4bab06298afdb709b609d6a896 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Fri, 29 Jul 2022 23:16:58 -0700 Subject: [PATCH 49/49] ShaderType --- .../book/migration-guides/0.7-0.8/_index.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/content/learn/book/migration-guides/0.7-0.8/_index.md b/content/learn/book/migration-guides/0.7-0.8/_index.md index 233a47ec98..23c7a5868a 100644 --- a/content/learn/book/migration-guides/0.7-0.8/_index.md +++ b/content/learn/book/migration-guides/0.7-0.8/_index.md @@ -205,6 +205,24 @@ Renamed `HasRawWindowHandleWrapper` to `ThreadLockedRawWindowHandleWrapper`. ### [Migrate to encase from crevice](https://github.com/bevyengine/bevy/pull/4339) +### Use ShaderType instead of AsStd140 and AsStd430 + +```rust +// old +#[derive(AsStd140)] +struct Foo { + a: Vec4, + b: Mat4, +} + +// new +#[derive(ShaderType)] +struct Foo { + a: Vec4, + b: Mat4, +} +``` + #### StorageBuffer * removed `set_body()`, `values()`, `values_mut()`, `clear()`, `push()`, `append()`