From 536494cc336cc53c8b42e7842694098b9e6d8b5f Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 8 Apr 2022 22:26:52 -0400 Subject: [PATCH 01/22] create empty 0.7 migration guide --- content/learn/book/migration-guides/0.6-0.7/_index.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 content/learn/book/migration-guides/0.6-0.7/_index.md diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md new file mode 100644 index 0000000000..361372cb78 --- /dev/null +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -0,0 +1,10 @@ ++++ +title = "0.6 to 0.7" +weight = 1 +sort_by = "weight" +template = "book-section.html" +page_template = "book-section.html" +insert_anchor_links = "right" +[extra] +long_title = "Migration Guide: 0.6 to 0.7" ++++ From 86622b70c6909b0d7be1cc125e732fb67e04d83f Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 8 Apr 2022 23:10:21 -0400 Subject: [PATCH 02/22] add some early migrations --- .../book/migration-guides/0.6-0.7/_index.md | 85 ++++++++++++++++++- 1 file changed, 83 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 361372cb78..93eacce3e7 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -1,4 +1,4 @@ -+++ + + +### AliasedMutability + + + +The QueryEntityError enum now has a `AliasedMutability variant, and returns the offending entity + +### Remove Margins + + + +The Margins type got removed. To migrate you just have to change every occurrence of Margins to UiRect. + +### Remove face_toward.rs + + + +The FaceToward trait got removed. To migrate you just have to change every occurrence of Mat4::face_toward to Mat4::look_at_rh. + +### unsafeify World::entities_mut + + + +```rs +// 0.6 +world.entities_mut() + +// 0.7 +unsafe { world.entities_mut() } +``` + +### Mesh vertex buffer layouts + + + +TODO + +### Remove the need for '.system' when using run criteria piping + + + +```rs +// 0.6 +.with_run_criteria(RunCriteria::pipe( + "is_done_label", + IntoSystem::into_system(inverse), +)) + +// 0.7 +.with_run_criteria(RunCriteria::pipe("is_done_label", inverse)) +``` + +### Obviate the need for RunSystem, and remove it + + + +TODO + +### Replace VSync with PresentMode + +https://github.com/bevyengine/bevy/pull/3812 + +TODO link to PresentMode enum + +```rs +// 0.6 +App::new() + .insert_resource(WindowDescriptor { + vsync: false, + ..Default::default() + }) + +// 0.7 +App::new() + .insert_resource(WindowDescriptor { + vsync: false, + present_mode: PresentMode::Mailbox, + ..Default::default() + }) +``` + From f7a0e6dc51fa8c1a4439da94171f2786ae879f57 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 8 Apr 2022 23:35:06 -0400 Subject: [PATCH 03/22] add more migrations --- .../book/migration-guides/0.6-0.7/_index.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 93eacce3e7..29489adcbb 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -89,3 +89,68 @@ App::new() }) ``` +### Fix mul_vec3 tranformation order + + + +Fixes order of transformations to scale -> rotate -> translate. This doesn't require any code changes, but it means SpriteBundle will behave as expected when rotating. + +### Use marker components for cameras instead of name strings + + + +TODO + +### Remove the config api + + + +TODO + +### Add capability to render to a texture + + + +```rs +// 0.6 +commands.spawn_bundle(PerspectiveCameraBundle { + camera: Camera { + window: window_id, + ..Default::default() + }, + ..Default::default() +}); + +// 0.7 +commands.spawn_bundle(PerspectiveCameraBundle { + camera: Camera { + target: RenderTarget::Window(window_id), + ..Default::default() + }, + ..Default::default() +}); +``` + +### Implement init_resource for Commands and World + + + +```rs +#[derive(Default)] +struct Scoreboard { + current_score: u32, + high_score: u32, +} + +// 0.6 +commands.insert_resource(Scoreboard::Default()); + +// 0.7 +commands.init_resource::(); +``` + +### ParamSet for conflicting SystemParam + + + +TODO \ No newline at end of file From 90481eccc384078ed1ef4e3df3c4dd8b832a29ed Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 8 Apr 2022 23:39:35 -0400 Subject: [PATCH 04/22] uncomment zola block --- content/learn/book/migration-guides/0.6-0.7/_index.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 29489adcbb..df98b85cfb 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -1,4 +1,4 @@ - ++++ ### AliasedMutability -The QueryEntityError enum now has a `AliasedMutability variant, and returns the offending entity +The QueryEntityError enum now has a `AliasedMutability` variant, and returns the offending entity ### Remove Margins From 273b170a54abd57fb21c77d74f643eea0d51fee6 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 8 Apr 2022 23:49:51 -0400 Subject: [PATCH 05/22] clean up some stuff --- content/learn/book/migration-guides/0.6-0.7/_index.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index df98b85cfb..2715e1e542 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -15,7 +15,7 @@ long_title = "Migration Guide: 0.6 to 0.7" The QueryEntityError enum now has a `AliasedMutability` variant, and returns the offending entity -### Remove Margins +### Remove margins.rs @@ -45,7 +45,7 @@ unsafe { world.entities_mut() } TODO -### Remove the need for '.system' when using run criteria piping +### Remove the need for 'IntoSystem::into_system()' when using run criteria piping @@ -70,7 +70,7 @@ TODO https://github.com/bevyengine/bevy/pull/3812 -TODO link to PresentMode enum +Instead of using a boolean flag for vsync we switched to using a [`PresentMode`](https://github.com/bevyengine/bevy/blob/e8cd2fc7275d0799115d6db57090c2f99d9a99a5/crates/bevy_window/src/window.rs#L24) enum with multiple variants. ```rs // 0.6 @@ -83,7 +83,6 @@ App::new() // 0.7 App::new() .insert_resource(WindowDescriptor { - vsync: false, present_mode: PresentMode::Mailbox, ..Default::default() }) From 0448fea403a16a63900daf2bd56722efdf0bb581 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 8 Apr 2022 23:57:16 -0400 Subject: [PATCH 06/22] use shortcode --- content/learn/book/migration-guides/0.6-0.7/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 2715e1e542..e4b130f173 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -9,6 +9,8 @@ insert_anchor_links = "right" long_title = "Migration Guide: 0.6 to 0.7" +++ + + ### AliasedMutability @@ -70,7 +72,7 @@ TODO https://github.com/bevyengine/bevy/pull/3812 -Instead of using a boolean flag for vsync we switched to using a [`PresentMode`](https://github.com/bevyengine/bevy/blob/e8cd2fc7275d0799115d6db57090c2f99d9a99a5/crates/bevy_window/src/window.rs#L24) enum with multiple variants. +Instead of using a boolean flag for vsync we switched to using a {{rust_type(type="struct" crate="bevy" mod="window" version="0.7.0" name="PresentMode" no_mod=true)}} enum with multiple variants. ```rs // 0.6 From 68a07993c4db218b64318bfbfb0f5576d2d6705c Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 9 Apr 2022 00:21:52 -0400 Subject: [PATCH 07/22] apply alice suggestions --- .../book/migration-guides/0.6-0.7/_index.md | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index e4b130f173..5a8b48a9d5 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -15,21 +15,21 @@ long_title = "Migration Guide: 0.6 to 0.7" -The QueryEntityError enum now has a `AliasedMutability` variant, and returns the offending entity +The `QueryEntityError` enum now has a `AliasedMutability` variant, and returns the offending entity. ### Remove margins.rs -The Margins type got removed. To migrate you just have to change every occurrence of Margins to UiRect. +The `Margins` type was removed. To migrate, replace of `Margins` with `UiRect`. ### Remove face_toward.rs -The FaceToward trait got removed. To migrate you just have to change every occurrence of Mat4::face_toward to Mat4::look_at_rh. +The `FaceToward` trait was removed. To migrate, replace every occurrence of `Mat4::face_toward` to `Mat4::look_at_rh`. -### unsafeify World::entities_mut +### `World::entities_mut` is now unsafe @@ -94,7 +94,7 @@ App::new() -Fixes order of transformations to scale -> rotate -> translate. This doesn't require any code changes, but it means SpriteBundle will behave as expected when rotating. +Transforms are now consistently applied in the standard scale -> rotate -> translate. This doesn't require any code changes, but it means SpriteBundle will behave as expected when rotating. ### Use marker components for cameras instead of name strings @@ -154,4 +154,16 @@ commands.init_resource::(); -TODO \ No newline at end of file +TODO + +### Infallabile resource getters + + + +```rs +// 0.6 +let score = world.get_resource::().unwrap(); + +// 0.7 +let score = world.resource::(); +``` \ No newline at end of file From 7fc68edf107a40b85e0378705b782d10d432521d Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 9 Apr 2022 00:28:23 -0400 Subject: [PATCH 08/22] remove shortcode --- content/learn/book/migration-guides/0.6-0.7/_index.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 5a8b48a9d5..8d41d1f84d 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -72,7 +72,7 @@ TODO https://github.com/bevyengine/bevy/pull/3812 -Instead of using a boolean flag for vsync we switched to using a {{rust_type(type="struct" crate="bevy" mod="window" version="0.7.0" name="PresentMode" no_mod=true)}} enum with multiple variants. +Instead of using a boolean flag for vsync we switched to using a [`PresentMode`] enum with multiple variants. ```rs // 0.6 @@ -90,6 +90,9 @@ App::new() }) ``` + +[`PresentMode`]: http://dev-docs.bevyengine.org/bevy/window/enum.PresentMode.html + ### Fix mul_vec3 tranformation order From 41f9408e25dcc88eb4664709ba31d5c87728cb9b Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 9 Apr 2022 14:01:02 -0400 Subject: [PATCH 09/22] more PR suggestions --- .../book/migration-guides/0.6-0.7/_index.md | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 8d41d1f84d..4ffeaf7db3 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -111,10 +111,12 @@ TODO TODO -### Add capability to render to a texture +### Cameras now point at RenderTarget rather than Window +This change was made to support rendering to textures. Users working with multiple windows may be affected. + ```rs // 0.6 commands.spawn_bundle(PerspectiveCameraBundle { @@ -157,7 +159,30 @@ commands.init_resource::(); -TODO +```rs +// 0.6 +fn system( + mut transforms: QuerySet<( + QueryState<&mut Transform, With>, + QueryState<&Transform>, + )>, +) { + for transform in transforms.q1().iter() { + // ... + } +} +// 0.7 +fn system( + mut transforms: ParamSet<( + Query<&mut Transform, With>, + Query<&Transform> + )>, +) { + for transform in transforms.p1().iter() { + // ... + } +} +``` ### Infallabile resource getters From 5c296b9635ad112ea52376b4b6c0eb2f5fb83404 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Sat, 9 Apr 2022 17:22:34 -0400 Subject: [PATCH 10/22] more migrations --- .../book/migration-guides/0.6-0.7/_index.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 4ffeaf7db3..3bd8ccb63b 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -85,7 +85,7 @@ App::new() // 0.7 App::new() .insert_resource(WindowDescriptor { - present_mode: PresentMode::Mailbox, + present_mode: PresentMode::Immediate, ..Default::default() }) ``` @@ -194,4 +194,18 @@ let score = world.get_resource::().unwrap(); // 0.7 let score = world.resource::(); +``` + +### Events have been moved form bevy_app to bevy_ecs + + + +If you are using the prelude it won't change anything. + +```rs +// 0.6 +use bevy::app::Events; + +// 0.7 +use bevy::ecs::event::Events; ``` \ No newline at end of file From b4a446a31cde1a0bbe6b16867044474d8619dbfc Mon Sep 17 00:00:00 2001 From: IceSentry Date: Mon, 11 Apr 2022 18:18:49 -0400 Subject: [PATCH 11/22] more suggestions --- .../book/migration-guides/0.6-0.7/_index.md | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 3bd8ccb63b..1c1a4147dd 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -11,6 +11,35 @@ long_title = "Migration Guide: 0.6 to 0.7" +### ParamSet for conflicting SystemParam + + + +```rs +// 0.6 +fn system( + mut transforms: QuerySet<( + QueryState<&mut Transform, With>, + QueryState<&Transform>, + )>, +) { + for transform in transforms.q1().iter() { + // ... + } +} +// 0.7 +fn system( + mut transforms: ParamSet<( + Query<&mut Transform, With>, + Query<&Transform> + )>, +) { + for transform in transforms.p1().iter() { + // ... + } +} +``` + ### AliasedMutability @@ -70,7 +99,7 @@ TODO ### Replace VSync with PresentMode -https://github.com/bevyengine/bevy/pull/3812 + Instead of using a boolean flag for vsync we switched to using a [`PresentMode`] enum with multiple variants. @@ -149,41 +178,12 @@ struct Scoreboard { } // 0.6 -commands.insert_resource(Scoreboard::Default()); +commands.insert_resource(Scoreboard::default()); // 0.7 commands.init_resource::(); ``` -### ParamSet for conflicting SystemParam - - - -```rs -// 0.6 -fn system( - mut transforms: QuerySet<( - QueryState<&mut Transform, With>, - QueryState<&Transform>, - )>, -) { - for transform in transforms.q1().iter() { - // ... - } -} -// 0.7 -fn system( - mut transforms: ParamSet<( - Query<&mut Transform, With>, - Query<&Transform> - )>, -) { - for transform in transforms.p1().iter() { - // ... - } -} -``` - ### Infallabile resource getters @@ -196,16 +196,16 @@ let score = world.get_resource::().unwrap(); let score = world.resource::(); ``` -### Events have been moved form bevy_app to bevy_ecs +### Event handling types are no longer re-exported from bevy_app -If you are using the prelude it won't change anything. +This only affects users who were importing these types directly from `bevy_app` and not through bevy's prelude. ```rs // 0.6 -use bevy::app::Events; +use bevy::app::{EventId, EventReader, EventWriter, Events, ManualEventReader}; // 0.7 -use bevy::ecs::event::Events; -``` \ No newline at end of file +use bevy::ecs::event::{EventId, EventReader, EventWriter, Events, ManualEventReader}; +``` From 9615fdeb07b36ff7fd0213f78edc472db6f7c2e1 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Mon, 11 Apr 2022 18:56:40 -0400 Subject: [PATCH 12/22] more suggestions --- content/learn/book/migration-guides/0.6-0.7/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 1c1a4147dd..ba83b040e9 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -50,7 +50,7 @@ The `QueryEntityError` enum now has a `AliasedMutability` variant, and returns t -The `Margins` type was removed. To migrate, replace of `Margins` with `UiRect`. +The `Margins` type was removed. To migrate, replace of `Margins` with `Rect`. ### Remove face_toward.rs From cbc1bb5d26a82f780e28a4f85f03b9f39318cff5 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 10:24:56 -0400 Subject: [PATCH 13/22] vertex buffer layout suggestion --- .../book/migration-guides/0.6-0.7/_index.md | 50 ++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index ba83b040e9..11709364ca 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -70,11 +70,59 @@ world.entities_mut() unsafe { world.entities_mut() } ``` +### Custom vertex attributes + + + +Custom vertex attributes are now referenced by a `MeshVertexAttribute` rather than a simple string and `set_attribute` has been renamed to `insert_attribute` better reflect its behavior. + +```rs +// 0.6 +mesh.set_attribute("Vertex_Custom", VertexAttributeValues::Sint32x4(vec![])); + +// 0.7 +// Generate your own random identifier here. +// https://play.rust-lang.org/?gist=cc7e824724ba023e9bff25db35ef1f5e +pub const ATTRIBUTE_CUSTOM: MeshVertexAttribute = + MeshVertexAttribute::new("Custom", 17351772347970238659, VertexFormat::Sint32x4); +mesh.insert_attribute( + ATTRIBUTE_CUSTOM, + VertexAttributeValues::Sint32x4(vec![]), +); +``` + ### Mesh vertex buffer layouts -TODO +Vertex buffers no longer need to be manually laid out with offset and stride values in a `RenderPipelineDescriptor`. + +```rs +// 0.6 +let vertex_buffer_layout = VertexBufferLayout { + array_stride: 20, + step_mode: VertexStepMode::Vertex, + attributes: vec![ + VertexAttribute { + format: VertexFormat::Float32x3, + offset: 0, + shader_location: 0, + }, + VertexAttribute { + format: VertexFormat::Float32x2, + offset: 12, + shader_location: 1, + }, + ], +}; + +// 0.7 +let mut formats = vec![ + VertexFormat::Float32x3, + VertexFormat::Float32x2, +]; +let vertex_layout = VertexBufferLayout::from_vertex_formats(VertexStepMode::Vertex, formats); +``` ### Remove the need for 'IntoSystem::into_system()' when using run criteria piping From ffb87f6fbb70c5edaf25e28d45da73d7bd7c7ec5 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 21:13:23 -0400 Subject: [PATCH 14/22] move PR link to header --- .../book/migration-guides/0.6-0.7/_index.md | 72 +++++-------------- 1 file changed, 19 insertions(+), 53 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 11709364ca..98237c5f56 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -11,9 +11,7 @@ long_title = "Migration Guide: 0.6 to 0.7" -### ParamSet for conflicting SystemParam - - +### [ParamSet for conflicting SystemParam](https://github.com/bevyengine/bevy/pull/2765) ```rs // 0.6 @@ -40,27 +38,19 @@ fn system( } ``` -### AliasedMutability - - +### [AliasedMutability](https://github.com/bevyengine/bevy/pull/4298) The `QueryEntityError` enum now has a `AliasedMutability` variant, and returns the offending entity. -### Remove margins.rs - - +### [Remove margins.rs](https://github.com/bevyengine/bevy/pull/4284) -The `Margins` type was removed. To migrate, replace of `Margins` with `Rect`. +The `Margins` type was removed. To migrate, replace every occurrence of `Margins` with `Rect`. -### Remove face_toward.rs - - +### [Remove face_toward.rs](https://github.com/bevyengine/bevy/pull/4277https://github.com/bevyengine/bevy/pull/4277) The `FaceToward` trait was removed. To migrate, replace every occurrence of `Mat4::face_toward` to `Mat4::look_at_rh`. -### `World::entities_mut` is now unsafe - - +### [`World::entities_mut` is now unsafe](https://github.com/bevyengine/bevy/pull/4093) ```rs // 0.6 @@ -70,9 +60,7 @@ world.entities_mut() unsafe { world.entities_mut() } ``` -### Custom vertex attributes - - +### [Custom vertex attributes](https://github.com/bevyengine/bevy/pull/3959) Custom vertex attributes are now referenced by a `MeshVertexAttribute` rather than a simple string and `set_attribute` has been renamed to `insert_attribute` better reflect its behavior. @@ -91,9 +79,7 @@ mesh.insert_attribute( ); ``` -### Mesh vertex buffer layouts - - +### [Mesh vertex buffer layouts](https://github.com/bevyengine/bevy/pull/3959) Vertex buffers no longer need to be manually laid out with offset and stride values in a `RenderPipelineDescriptor`. @@ -124,9 +110,7 @@ let mut formats = vec![ let vertex_layout = VertexBufferLayout::from_vertex_formats(VertexStepMode::Vertex, formats); ``` -### Remove the need for 'IntoSystem::into_system()' when using run criteria piping - - +### [Remove the need for 'IntoSystem::into_system()' when using run criteria piping](https://github.com/bevyengine/bevy/pull/3923) ```rs // 0.6 @@ -139,15 +123,11 @@ let vertex_layout = VertexBufferLayout::from_vertex_formats(VertexStepMode::Vert .with_run_criteria(RunCriteria::pipe("is_done_label", inverse)) ``` -### Obviate the need for RunSystem, and remove it - - +### [Obviate the need for RunSystem, and remove it](https://github.com/bevyengine/bevy/pull/3817) TODO -### Replace VSync with PresentMode - - +### [Replace VSync with PresentMode](https://github.com/bevyengine/bevy/pull/3812) Instead of using a boolean flag for vsync we switched to using a [`PresentMode`] enum with multiple variants. @@ -170,27 +150,19 @@ App::new() [`PresentMode`]: http://dev-docs.bevyengine.org/bevy/window/enum.PresentMode.html -### Fix mul_vec3 tranformation order - - +### [Fix mul_vec3 tranformation order](https://github.com/bevyengine/bevy/pull/3811) -Transforms are now consistently applied in the standard scale -> rotate -> translate. This doesn't require any code changes, but it means SpriteBundle will behave as expected when rotating. +Transforms are now consistently applied in the standard scale -> rotate -> translate. This doesn't require any code changes unless you had something to handle the wrong behaviour, but it means SpriteBundle will now behave as expected when rotating. -### Use marker components for cameras instead of name strings - - +### [Use marker components for cameras instead of name strings](https://github.com/bevyengine/bevy/pull/3635https://github.com/bevyengine/bevy/pull/3635) TODO -### Remove the config api - - +### [Remove the config api](https://github.com/bevyengine/bevy/pull/3633) TODO -### Cameras now point at RenderTarget rather than Window - - +### [Cameras now point at RenderTarget rather than Window](https://github.com/bevyengine/bevy/pull/3412) This change was made to support rendering to textures. Users working with multiple windows may be affected. @@ -214,9 +186,7 @@ commands.spawn_bundle(PerspectiveCameraBundle { }); ``` -### Implement init_resource for Commands and World - - +### [Implement init_resource for Commands and World](https://github.com/bevyengine/bevy/pull/3079) ```rs #[derive(Default)] @@ -232,9 +202,7 @@ commands.insert_resource(Scoreboard::default()); commands.init_resource::(); ``` -### Infallabile resource getters - - +### [Infallabile resource getters](https://github.com/bevyengine/bevy/pull/4047) ```rs // 0.6 @@ -244,9 +212,7 @@ let score = world.get_resource::().unwrap(); let score = world.resource::(); ``` -### Event handling types are no longer re-exported from bevy_app - - +### [Event handling types are no longer re-exported from bevy_app](https://github.com/bevyengine/bevy/pull/4066) This only affects users who were importing these types directly from `bevy_app` and not through bevy's prelude. From 492ba58d05830447f05e3c32f0e9b0edf5c4bfe4 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 21:39:11 -0400 Subject: [PATCH 15/22] obviate RunSystem --- content/learn/book/migration-guides/0.6-0.7/_index.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 98237c5f56..e2d61f0287 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -123,9 +123,11 @@ let vertex_layout = VertexBufferLayout::from_vertex_formats(VertexStepMode::Vert .with_run_criteria(RunCriteria::pipe("is_done_label", inverse)) ``` -### [Obviate the need for RunSystem, and remove it](https://github.com/bevyengine/bevy/pull/3817) +### [Remove RunSystem](https://github.com/bevyengine/bevy/pull/3817) -TODO +You probably should not have been using [`RunSystem`] or [`ParamSystem`], but if you were and you really need it, please make sure to let us know by creating a new discussion over at + + ### [Replace VSync with PresentMode](https://github.com/bevyengine/bevy/pull/3812) From 216542eb8687ef70bbc6dad5269d8439c03ece18 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 21:39:36 -0400 Subject: [PATCH 16/22] Fix PresentMode link --- content/learn/book/migration-guides/0.6-0.7/_index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index e2d61f0287..124336077f 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -149,8 +149,8 @@ App::new() }) ``` - -[`PresentMode`]: http://dev-docs.bevyengine.org/bevy/window/enum.PresentMode.html + +[`PresentMode`]: https://docs.rs/bevy/0.7/bevy/window/enum.PresentMode.html ### [Fix mul_vec3 tranformation order](https://github.com/bevyengine/bevy/pull/3811) From c55512edd7cfe6d6a24716eea4434da87220175c Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 21:39:50 -0400 Subject: [PATCH 17/22] camera marker component --- .../book/migration-guides/0.6-0.7/_index.md | 45 ++++++++++++++++++- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 124336077f..f2d8c8805f 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -156,9 +156,50 @@ App::new() Transforms are now consistently applied in the standard scale -> rotate -> translate. This doesn't require any code changes unless you had something to handle the wrong behaviour, but it means SpriteBundle will now behave as expected when rotating. -### [Use marker components for cameras instead of name strings](https://github.com/bevyengine/bevy/pull/3635https://github.com/bevyengine/bevy/pull/3635) +### [Use marker components for cameras instead of name strings](https://github.com/bevyengine/bevy/pull/3635) -TODO +```rs +// 0.6 +pub const FIRST_PASS_CAMERA: &str = "first_pass_camera"; +fn setup(mut commands: Commands) { + commands.spawn_bundle(PerspectiveCameraBundle { + camera: Camera { + name: Some(FIRST_PASS_CAMERA.to_string()), + ..Default::default() + }, + transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0)) + .looking_at(Vec3::default(), Vec3::Y), + ..Default::default() + }); +} + +fn camera_system(cameras: Query<&Camera>) { + for camera in cameras.iter() { + if camera.name == Some(FIRST_PASS_CAMERA.to_string()) { + // Do something with a camera + } + } +} + +// 0.7 +#[derive(Component, Default)] +pub struct FirstPassCamera; + +fn setup(mut commands: Commands) { + commands.spawn_bundle(PerspectiveCameraBundle:: { + camera: Camera::default(), + transform: Transform::from_translation(Vec3::new(0.0, 0.0, 15.0)) + .looking_at(Vec3::default(), Vec3::Y), + ..PerspectiveCameraBundle::new() + }); +} + +fn camera_system(cameras: Query<&Camera, With>) { + for camera in cameras.iter() { + // Do something with camera + } +} +``` ### [Remove the config api](https://github.com/bevyengine/bevy/pull/3633) From 45b400d3a385fd0883c2fd5ddadf828dde22b2d4 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 21:45:26 -0400 Subject: [PATCH 18/22] fix ordering --- content/learn/book/migration-guides/0.5-0.6/_index.md | 7 ++++--- content/learn/book/migration-guides/0.6-0.7/_index.md | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/content/learn/book/migration-guides/0.5-0.6/_index.md b/content/learn/book/migration-guides/0.5-0.6/_index.md index 88503ef5f8..08b17a8179 100644 --- a/content/learn/book/migration-guides/0.5-0.6/_index.md +++ b/content/learn/book/migration-guides/0.5-0.6/_index.md @@ -1,6 +1,6 @@ +++ title = "0.5 to 0.6" -weight = 1 +weight = 2 sort_by = "weight" template = "book-section.html" page_template = "book-section.html" @@ -309,8 +309,9 @@ SpriteBundle { } ``` -### Visible is now Visibility -The {{rust_type(type="struct" crate="bevy" mod="render::draw" version="0.5.0" name="Visible" no_mod=true)}} struct, which is used in a number of components to set visibility, was renamed to {{rust_type(type="struct" crate="bevy" mod="render::view" version="0.6.0" name="Visibility" no_mod=true)}}. Additionally, the field `is_transparent` was removed from the struct. For 3D, transparency can be set using the `alpha_mode` field on a material. Transparency is now automatically enabled for all objects in 2D. +### Visible is now Visibility + +The {{rust_type(type="struct" crate="bevy" mod="render::draw" version="0.5.0" name="Visible" no_mod=true)}} struct, which is used in a number of components to set visibility, was renamed to {{rust_type(type="struct" crate="bevy" mod="render::view" version="0.6.0" name="Visibility" no_mod=true)}}. Additionally, the field `is_transparent` was removed from the struct. For 3D, transparency can be set using the `alpha_mode` field on a material. Transparency is now automatically enabled for all objects in 2D. ```rust // 0.5 diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index f2d8c8805f..7f39a0ee1a 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -1,6 +1,6 @@ +++ title = "0.6 to 0.7" -weight = 1 +weight = 3 sort_by = "weight" template = "book-section.html" page_template = "book-section.html" From 648dc1fa0ac290d106f4d484bc1b8ca1dc9a9e78 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 22:25:29 -0400 Subject: [PATCH 19/22] add WIP config api migration --- .../book/migration-guides/0.6-0.7/_index.md | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 7f39a0ee1a..1b1b51c024 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -203,7 +203,36 @@ fn camera_system(cameras: Query<&Camera, With>) { ### [Remove the config api](https://github.com/bevyengine/bevy/pull/3633) -TODO +```rs +// 0.6 +struct Config(u32); + +fn local_config(local: Local) { + assert_eq!(*local.0, 42); +} + +fn main() { + App::new() + .add_system(local_is_42.config(|params| params.0 = Some(Config(42)))) + .run(); +} + +// 0.7 +struct Config(u32); +struct Myu32Wrapper(u32); + +fn local_config(local: Config) -> impl FnMut(ResMut) { + move |mut val| val.0 = local.0; + + assert_eq!(*local.0, 42); +} + +fn main() { + App::new() + .add_system(local_config(Config(42))) + .run(); +} +``` ### [Cameras now point at RenderTarget rather than Window](https://github.com/bevyengine/bevy/pull/3412) From 318c433a4390b089b4e3c8a1946834354d7f4720 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Tue, 12 Apr 2022 22:46:32 -0400 Subject: [PATCH 20/22] fix 0.7 config --- content/learn/book/migration-guides/0.6-0.7/_index.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 1b1b51c024..186a99d7cb 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -219,12 +219,13 @@ fn main() { // 0.7 struct Config(u32); -struct Myu32Wrapper(u32); -fn local_config(local: Config) -> impl FnMut(ResMut) { - move |mut val| val.0 = local.0; +fn local_config(local: u32) -> impl FnMut(ResMut) { + move |mut val| { + val.0 = local; - assert_eq!(*local.0, 42); + assert_eq!(val.0, 42); + } } fn main() { From 23e0ceaaba0fa1bad9935426348c81a4470732aa Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 12 Apr 2022 23:12:08 -0400 Subject: [PATCH 21/22] Update content/learn/book/migration-guides/0.6-0.7/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.6-0.7/_index.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index 186a99d7cb..d9ea5243c3 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -125,9 +125,10 @@ let vertex_layout = VertexBufferLayout::from_vertex_formats(VertexStepMode::Vert ### [Remove RunSystem](https://github.com/bevyengine/bevy/pull/3817) -You probably should not have been using [`RunSystem`] or [`ParamSystem`], but if you were and you really need it, please make sure to let us know by creating a new discussion over at +You probably should not have been using [`RunSystem`] or [`ParamSystem`], but if you were and you really need it, please make sure to let us know by [creating a new discussion](https://github.com/bevyengine/bevy/discussions). - +[`RunSystem`]: https://docs.rs/bevy/0.6.1/bevy/ecs/system/trait.RunSystem.html +[`ParamSystem`]: https://docs.rs/bevy/0.6.1/bevy/ecs/system/struct.ParamSystem.html ### [Replace VSync with PresentMode](https://github.com/bevyengine/bevy/pull/3812) From 4156ee3b76389a7678324ace265456e432ced848 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 12 Apr 2022 23:37:58 -0400 Subject: [PATCH 22/22] Update content/learn/book/migration-guides/0.6-0.7/_index.md Co-authored-by: Rob Parrett --- content/learn/book/migration-guides/0.6-0.7/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/book/migration-guides/0.6-0.7/_index.md b/content/learn/book/migration-guides/0.6-0.7/_index.md index d9ea5243c3..73c903cc08 100644 --- a/content/learn/book/migration-guides/0.6-0.7/_index.md +++ b/content/learn/book/migration-guides/0.6-0.7/_index.md @@ -50,7 +50,7 @@ The `Margins` type was removed. To migrate, replace every occurrence of `Margins The `FaceToward` trait was removed. To migrate, replace every occurrence of `Mat4::face_toward` to `Mat4::look_at_rh`. -### [`World::entities_mut` is now unsafe](https://github.com/bevyengine/bevy/pull/4093) +### [World::entities_mut is now unsafe](https://github.com/bevyengine/bevy/pull/4093) ```rs // 0.6