From f9b035dea6489106bbf5fd1f81c12a61dd7e0ba1 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 01:18:03 -0400 Subject: [PATCH 01/17] 0.11 to 0.12 migration guide --- .../migration-guides/0.11-0.12/_index.md | 957 ++++++++++++++++++ .../learn/migration-guides/0.8-0.9/_index.md | 2 +- generate-release/src/changelog.rs | 2 +- generate-release/src/migration_guide.rs | 2 +- 4 files changed, 960 insertions(+), 3 deletions(-) create mode 100644 content/learn/migration-guides/0.11-0.12/_index.md diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md new file mode 100644 index 0000000000..4669ab9d57 --- /dev/null +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -0,0 +1,957 @@ ++++ +title = "0.11 to 0.12" +weight = 7 +sort_by = "weight" +template = "docs-section.html" +page_template = "docs-section.html" +insert_anchor_links = "right" +[extra] +long_title = "Migration Guide: 0.11 to 0.12" ++++ + +Bevy relies heavily on improvements in the Rust language and compiler. +As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable release" of Rust. +
+ +### [API updates to the AnimationPlayer](https://github.com/bevyengine/bevy/pull/9002) + +
+
Animation
+
+ +- Removed `set_elapsed`. +- Removed `stop_repeating` in favour of `AnimationPlayer::set_repeat(RepeatAnimation::Never)`. +- Introduced `seek_to` to seek to a given timestamp inside of the animation. +- Introduced `seek_time` accessor for the `PlayingAnimation::seek_to`. +- Introduced `AnimationPlayer::replay` to reset the `PlayingAnimation` to a state where no time has elapsed. + +### [fix run-once runners](https://github.com/bevyengine/bevy/pull/10195) + +
+
App
+
+ +- `app.ready()` has been replaced by `app.plugins_state()` which will return more details on the current state of plugins in the app + +### [Copy on Write AssetPaths](https://github.com/bevyengine/bevy/pull/9729) + +
+
Assets
+
+ +```rust +// Old +AssetPath::new("logo.png", None); + +// New +AssetPath::new("logo.png"); + +// Old +AssetPath::new("scene.gltf", Some("Mesh0"); + +// New +AssetPath::new("scene.gltf").with_label("Mesh0"); +``` + +`AssetPath` now serializes as `AssetPath("some_path.extension#Label")` instead of as `AssetPath { path: "some_path.extension", label: Some("Label) }` + +### [Removed `anyhow`](https://github.com/bevyengine/bevy/pull/10003) + +
+
Assets
+
+ +- `anyhow` is no longer exported by `bevy_asset`; Add it to your own project (if required). +- `AssetLoader` and `AssetSaver` have an associated type `Error`; Define an appropriate error type (e.g., using `thiserror`), or use a pre-made error type (e.g., `anyhow::Error`). Note that using `anyhow::Error` is a drop-in replacement. +- `AssetLoaderError` has been removed; Define a new error type, or use an alternative (e.g., `anyhow::Error`) +- All the first-party `AssetLoader`’s and `AssetSaver`’s now return relevant (and narrow) error types instead of a single ambiguous type; Match over the specific error type, or encapsulate (`Box`, `thiserror`, `anyhow`, etc.) + +### [More ergonomic spatial audio](https://github.com/bevyengine/bevy/pull/9800) + +
+
Audio
+
+ +Spatial audio now automatically uses the transform of the `AudioBundle` and of an entity with a `SpatialListener` component. + +If you were manually scaling emitter/listener positions, you can use the `spatial_scale` field of `AudioPlugin` instead. + +```rust + +// Old + +commands.spawn( + SpatialAudioBundle { + source: asset_server.load("sounds/Windless Slopes.ogg"), + settings: PlaybackSettings::LOOP, + spatial: SpatialSettings::new(listener_position, gap, emitter_position), + }, +); + +fn update( + emitter_query: Query<(&Transform, &SpatialAudioSink)>, + listener_query: Query<&Transform, With>, +) { + let listener = listener_query.single(); + + for (transform, sink) in &emitter_query { + sink.set_emitter_position(transform.translation); + sink.set_listener_position(*listener, gap); + } +} + +// New + +commands.spawn(( + SpatialBundle::from_transform(Transform::from_translation(emitter_position)), + AudioBundle { + source: asset_server.load("sounds/Windless Slopes.ogg"), + settings: PlaybackSettings::LOOP.with_spatial(true), + }, +)); + +commands.spawn(( + SpatialBundle::from_transform(Transform::from_translation(listener_position)), + SpatialListener::new(gap), +)); +``` + +### [Simplify parallel iteration methods](https://github.com/bevyengine/bevy/pull/8854) + +
+
ECS
+
+ +The method `QueryParIter::for_each_mut` has been deprecated and is no longer functional. Use `for_each` instead, which now supports mutable queries. + +```rust +// Before: +query.par_iter_mut().for_each_mut(|x| ...); + +// After: +query.par_iter_mut().for_each(|x| ...); +``` + +The method `QueryParIter::for_each` now takes ownership of the `QueryParIter`, rather than taking a shared reference. + +```rust +// Before: +let par_iter = my_query.par_iter().batching_strategy(my_batching_strategy); +par_iter.for_each(|x| { + // ...Do stuff with x... + par_iter.for_each(|y| { + // ...Do nested stuff with y... + }); +}); + +// After: +my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|x| { + // ...Do stuff with x... + my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|y| { + // ...Do nested stuff with y... + }); +}); +``` + +### [Fix safety invariants for `WorldQuery::fetch` and simplify cloning](https://github.com/bevyengine/bevy/pull/8246) + +
+
ECS
+
+ +__`fetch` invariants__ + +The function `WorldQuery::fetch` has had the following safety invariant added: + +> +If `update_component_access` includes any mutable accesses, then the caller must ensure that `fetch` is called no more than once for each `entity`/`table_row` in each archetype. +If `Self` implements `ReadOnlyWorldQuery`, then this can safely be called multiple times. + +This invariant was always required for soundness, but was previously undocumented. If you called this function manually anywhere, you should check to make sure that this invariant is not violated. + +__Removed `clone_fetch`__ + +The function `WorldQuery::clone_fetch` has been removed. The associated type `WorldQuery::Fetch` now has the bound `Clone`. + +Before: + +```rust +struct MyFetch<'w> { ... } + +unsafe impl WorldQuery for MyQuery { + ... + type Fetch<'w> = MyFetch<'w> + unsafe fn clone_fetch<'w>(fetch: &Self::Fetch<'w>) -> Self::Fetch<'w> { + MyFetch { + field1: fetch.field1, + field2: fetch.field2.clone(), + ... + } + } +} +``` + +After: + +```rust +#[derive(Clone)] +struct MyFetch<'w> { ... } + +unsafe impl WorldQuery for MyQuery { + ... + type Fetch<'w> = MyFetch<'w>; +} +``` + +### [opt-out `multi-threaded` feature flag](https://github.com/bevyengine/bevy/pull/9269) + +
+
ECS
+
+ +The `multi-threaded` feature in `bevy_ecs` and `bevy_tasks` is no longer enabled by default. However, this remains a default feature for the umbrella `bevy` crate. If you depend on `bevy_ecs` or `bevy_tasks` directly, you should consider enabling this to allow systems to run in parallel. + +### [Refactor build_schedule and related errors](https://github.com/bevyengine/bevy/pull/9579) + +
+
ECS
+
+ +`ScheduleBuildError` now has strings in more of its variants. You may need to adjust code that is handling these variants. + +### [Replaced EntityMap with HashMap](https://github.com/bevyengine/bevy/pull/9461) + +
+
ECS
+
+ +- Calls to `EntityMap::world_scope` can be directly replaced with the following: +`map.world_scope(&mut world)` -> `world.world_scope(&mut map)` +- Calls to legacy `EntityMap` methods such as `EntityMap::get` must explicitly include de/reference symbols: +`let entity = map.get(parent);` -> `let &entity = map.get(&parent);` + +### [Rename `ManualEventIterator`](https://github.com/bevyengine/bevy/pull/9592) + +
+
ECS
+
+ +The type `ManualEventIterator` has been renamed to `EventIterator`. Additonally, `ManualEventIteratorWithId` has been renamed to `EventIteratorWithId`. + +### [Replaced `EntityCommand` Implementation for `FnOnce`](https://github.com/bevyengine/bevy/pull/9604) + +
+
ECS
+
+ +__1. New-Type `FnOnce`__ + +Create an `EntityCommand` type which implements the method you previously wrote: + +```rust +pub struct ClassicEntityCommand(pub F); + +impl EntityCommand for ClassicEntityCommand +where + F: FnOnce(Entity, &mut World) + Send + 'static, +{ + fn apply(self, id: Entity, world: &mut World) { + (self.0)(id, world); + } +} + +commands.add(ClassicEntityCommand(|id: Entity, world: &mut World| { + /* ... */ +})); +``` + +__2. Extract `(Entity, &mut World)` from `EntityMut`__ + +The method `into_world_mut` can be used to gain access to the `World` from an `EntityMut`. + +```rust +let old = |id: Entity, world: &mut World| { + /* ... */ +}; + +let new = |mut entity: EntityMut| { + let id = entity.id(); + let world = entity.into_world_mut(); + /* ... */ +}; +``` + +### [Move schedule name into `Schedule`](https://github.com/bevyengine/bevy/pull/9600) + +
+
ECS
+
+ +`Schedule::new` and `App::add_schedule` + +```rust +// old +let schedule = Schedule::new(); +app.add_schedule(MyLabel, schedule); + +// new +let schedule = Schedule::new(MyLabel); +app.add_schedule(schedule); +``` + +if you aren’t inserting the schedule into the world and are using the schedule directly you can use the default constructor which reuses a default label. + +```rust +// old +let schedule = Schedule::new(); +schedule.run(world); + +// new +let schedule = Schedule::default(); +schedule.run(world); +``` + +`Schedules:insert` + +```rust +// old +let schedule = Schedule::new(); +schedules.insert(MyLabel, schedule); + +// new +let schedule = Schedule::new(MyLabel); +schedules.insert(schedule); +``` + +`World::add_schedule` + +```rust +// old +let schedule = Schedule::new(); +world.add_schedule(MyLabel, schedule); + +// new +let schedule = Schedule::new(MyLabel); +world.add_schedule(schedule); +``` + +### [Refactor `EventReader::iter` to `read`](https://github.com/bevyengine/bevy/pull/9631) + +
+
ECS
+
+ +- Existing usages of `EventReader::iter` and `EventReader::iter_with_id` will have to be changed to `EventReader::read` and `EventReader::read_with_id` respectively. +- Existing usages of `ManualEventReader::iter` and `ManualEventReader::iter_with_id` will have to be changed to `ManualEventReader::read` and `ManualEventReader::read_with_id` respectively. + +### [Replace `IntoSystemSetConfig` with `IntoSystemSetConfigs`](https://github.com/bevyengine/bevy/pull/9247) + +
+
ECS
+
+ +- Use `App::configure_sets` instead of `App::configure_set` +- Use `Schedule::configure_sets` instead of `Schedule::configure_set` + +### [Moved `get_component(_unchecked_mut)` from `Query` to `QueryState`](https://github.com/bevyengine/bevy/pull/9686) + +
+
ECS
+
+ +- `use bevy_ecs::system::QueryComponentError;` -> `use bevy_ecs::query::QueryComponentError;` + +### [Fix naming on "tick" Column and ComponentSparseSet methods](https://github.com/bevyengine/bevy/pull/9744) + +
+
ECS
+
+ +The following method names were renamed, from `foo_ticks_bar` to `foo_tick_bar` (`ticks` is now singular, `tick`): + +- `ComponentSparseSet::get_added_ticks` → `get_added_tick` +- `ComponentSparseSet::get_changed_ticks` → `get_changed_tick` +- `Column::get_added_ticks` → `get_added_tick` +- `Column::get_changed_ticks` → `get_changed_tick` +- `Column::get_added_ticks_unchecked` → `get_added_tick_unchecked` +- `Column::get_changed_ticks_unchecked` → `get_changed_tick_unchecked` + +### [Return a boolean from `set_if_neq`](https://github.com/bevyengine/bevy/pull/9801) + +
+
ECS
+
+ +The trait method `DetectChangesMut::set_if_neq` now returns a boolean value indicating whether or not the value was changed. If you were implementing this function manually, you must now return `true` if the value was overwritten and `false` if the value was not. + +### [Rename RemovedComponents::iter/iter_with_id to read/read_with_id](https://github.com/bevyengine/bevy/pull/9778) + +
+
ECS
+
+ +Rename calls of RemovedComponents::iter/iter_with_id to read/read_with_id + +Replace IntoIterator iteration (&mut ) with .read() + +### [Remove States::variants and remove enum-only restriction its derive](https://github.com/bevyengine/bevy/pull/9945) + +
+
ECS
+
+ +- `States::variants` no longer exists. If you relied on this function, consider using a library that provides enum iterators. + +### [Replace all labels with interned labels](https://github.com/bevyengine/bevy/pull/7762) + +
+
ECS
+
+ +- Replace `BoxedScheduleLabel` and `Box` with `InternedScheduleLabel` or `Interned`. +- Replace `BoxedSystemSet` and `Box` with `InternedSystemSet` or `Interned`. +- Replace `AppLabelId` with `InternedAppLabel` or `Interned`. +- Types manually implementing `ScheduleLabel`, `AppLabel` or `SystemSet` need to implement: + - `dyn_hash` directly instead of implementing `DynHash` + - `as_dyn_eq` + +- Pass labels to `World::try_schedule_scope`, `World::schedule_scope`, `World::try_run_schedule`. `World::run_schedule`, `Schedules::remove`, `Schedules::remove_entry`, `Schedules::contains`, `Schedules::get` and `Schedules::get_mut` by value instead of by reference. + +### [Only run event systems if they have tangible work to do](https://github.com/bevyengine/bevy/pull/7728) + +
+
ECS
+
App
+
+ +`Events::update_system` has been split off from the the type and can be found at `bevy_ecs::event::event_update_system`. + +### [Allow disjoint mutable world access via `EntityMut`](https://github.com/bevyengine/bevy/pull/9419) + +
+
ECS
+
Reflection
+
+ +**Note for maintainers: ensure that the guide for #9604 is updated accordingly.** + +Removed the method `EntityRef::world`, to fix a soundness issue with queries. If you need access to `&World` while using an `EntityRef`, consider passing the world as a separate parameter. + +`EntityMut` can no longer perform ‘structural’ world mutations, such as adding or removing components, or despawning the entity. Additionally, `EntityMut::world`, `EntityMut::world_mut` , and `EntityMut::world_scope` have been removed. +Instead, use the newly-added type `EntityWorldMut`, which is a helper type for working with `&mut World`. + +### [Make builder types take and return `Self`](https://github.com/bevyengine/bevy/pull/10001) + +
+
ECS
+
Scenes
+
+ +When using `bevy_ecs::DynamicSceneBuilder` and `bevy_ecs::SceneBuilder`, instead of binding the builder to a variable, directly use it. Methods on those types now consume `Self`, so you will need to re-bind the builder if you don’t `build` it immediately. + +Before: + +```rust +let mut scene_builder = DynamicSceneBuilder::from_world(&world); +let scene = scene_builder.extract_entity(a).extract_entity(b).build(); +``` + +After: + +```rust +let scene = DynamicSceneBuilder::from_world(&world) + .extract_entity(a) + .extract_entity(b) + .build(); +``` + +### [Change `AxisSettings` livezone default](https://github.com/bevyengine/bevy/pull/10090) + +
+
Input
+
+ +If the default 0.05 was relied on, the default or gamepad `AxisSettings` on the resource `GamepadSettings` will have to be changed. + +### [Rename bevy_math::rects conversion methods](https://github.com/bevyengine/bevy/pull/9159) + +
+
Math
+
+ +Replace `Rect::as_urect` with `Rect::as_irect`, `Rect::as_rect` with `Rect::as_urect`, and `URect::as_urect` with `URect::as_irect`. + +### [Remove the bevy_dylib feature](https://github.com/bevyengine/bevy/pull/9516) + +
+
Meta
+
+ +If you were using Bevy’s `bevy_dylib` feature, use Bevy’s `dynamic_linking` feature instead. + +```shell +# 0.11 +cargo run --features bevy/bevy_dylib + +# 0.12 +cargo run --features bevy/dynamic_linking +``` + +```toml +[dependencies] +# 0.11 +bevy = { version = "0.11", features = ["bevy_dylib"] } + +# 0.12 +bevy = { version = "0.12", features = ["dynamic_linking"] } +``` + +### [Fix typo in NamedTypePathDef](https://github.com/bevyengine/bevy/pull/9102) + +
+
Reflection
+
+ +- Renamed NamedTypePathDef::Primtive to NamedTypePathDef::Primitive + +Before: + +```rust +let type_path = NamedTypePathDef::Primtive(ident); +``` + +After: + +```rust +let type_path = NamedTypePathDef::Primitive(ident); +``` + +### [Refactor `path` module of `bevy_reflect`](https://github.com/bevyengine/bevy/pull/8887) + +
+
Reflection
+
+ +If you were matching on the `Err(ReflectPathError)` value returned by `GetPath` and `ParsedPath` methods, now only the parse-related errors and the offset are publicly accessible. You can always use the `fmt::Display` to get a clear error message, but if you need programmatic access to the error types, please open an issue. + +### [Make it so `ParsedPath` can be passed to GetPath](https://github.com/bevyengine/bevy/pull/9373) + +
+
Reflection
+
+ +`GetPath` now requires `Reflect`. This reduces a lot of boilerplate on bevy’s side. If you were implementing manually `GetPath` on your own type, please get in touch! + +`ParsedPath::element[_mut]` isn’t an inherent method of `ParsedPath`, you must now import `ReflectPath`. This is only relevant if you weren’t importing the bevy prelude. + +```diff +-use bevy::reflect::ParsedPath; ++use bevy::reflect::{ParsedPath, ReflectPath}; + + parsed_path.element(reflect_type).unwrap() + parsed_path.element(reflect_type).unwrap()``` + +### [Remove TypeRegistry re-export rename](https://github.com/bevyengine/bevy/pull/9807) + +
+
Reflection
+
+ +- `TypeRegistry` as re-exported by the wrapper `bevy` crate is now `TypeRegistryArc` +- `TypeRegistryInternal` as re-exported by the wrapper `bevy` crate is now `TypeRegistry` + +### [Provide getters for fields of ReflectFromPtr](https://github.com/bevyengine/bevy/pull/9748) + +
+
Reflection
+
+ +- `ReflectFromPtr::as_reflect_ptr` is now `ReflectFromPtr::as_reflect` +- `ReflectFromPtr::as_reflect_ptr_mut` is now `ReflectFromPtr::as_reflect_mut` + +### [bevy_reflect: Fix ignored/skipped field order](https://github.com/bevyengine/bevy/pull/7575) + +
+
Reflection
+
+ +- Fields marked `#[reflect(skip_serializing)]` now must implement `Default` or specify a custom default function with `#[reflect(default = "path::to::some_func")]` +```rust +#[derive(Reflect)] +struct MyStruct { + #[reflect(skip_serializing)] + #[reflect(default = "get_foo_default")] + foo: Foo, // <- `Foo` does not impl `Default` so requires a custom function + #[reflect(skip_serializing)] + bar: Bar, // <- `Bar` impls `Default` +} + +#[derive(Reflect)] +struct Foo(i32); + +#[derive(Reflect, Default)] +struct Bar(i32); + +fn get_foo_default() -> Foo { + Foo(123) +} +``` + +- `SerializationData::new` has been changed to expect an iterator of `(usize, SkippedField)` rather than one of just `usize` + +```rust +// BEFORE +SerializationData::new([0, 3].into_iter()); + +// AFTER +SerializationData::new([ + (0, SkippedField::new(field_0_default_fn)), + (3, SkippedField::new(field_3_default_fn)), +].into_iter()); +``` + +- `Serialization::is_ignored_field` has been renamed to `Serialization::is_field_skipped` +- Fields marked `#[reflect(skip_serializing)]` are now included in deserialization output. This may affect logic that expected those fields to be absent. + +### [Return URect instead of (UVec2, UVec2) in Camera::physical_viewport_rect](https://github.com/bevyengine/bevy/pull/9085) + +
+
Rendering
+
+ +Before: + +```rust +fn view_physical_camera_rect(camera_query: Query<&Camera>) { + let camera = camera_query.single(); + let Some((min, max)) = camera.physical_viewport_rect() else { return }; + dbg!(min, max); +} +``` + +After: + +```rust +fn view_physical_camera_rect(camera_query: Query<&Camera>) { + let camera = camera_query.single(); + let Some(URect { min, max }) = camera.physical_viewport_rect() else { return }; + dbg!(min, max); +} +``` + +### [Update `bevy_window::PresentMode` to mirror `wgpu::PresentMode`](https://github.com/bevyengine/bevy/pull/9230) + +
+
Rendering
+
+ +- Handle `bevy_window::PresentMode::FifoRelaxed` when tweaking window present mode manually. + +### [Split `ComputedVisibility` into two components to allow for accurate change detection and speed up visibility propagation](https://github.com/bevyengine/bevy/pull/9497) + +
+
Rendering
+
+ +The `ComputedVisibilty` component has been split into `InheritedVisiblity` and +`ViewVisibility`. Replace any usages of `ComputedVisibility::is_visible_in_hierarchy` +with `InheritedVisibility::get`, and replace `ComputedVisibility::is_visible_in_view` +with `ViewVisibility::get`. + +```rust +// Before: +commands.spawn(VisibilityBundle { + visibility: Visibility::Inherited, + computed_visibility: ComputedVisibility::default(), +}); + +// After: +commands.spawn(VisibilityBundle { + visibility: Visibility::Inherited, + inherited_visibility: InheritedVisibility::default(), + view_visibility: ViewVisibility::default(), +}); +``` + +```rust +// Before: +fn my_system(q: Query<&ComputedVisibilty>) { + for vis in &q { + if vis.is_visible_in_hierarchy() { + +// After: +fn my_system(q: Query<&InheritedVisibility>) { + for inherited_visibility in &q { + if inherited_visibility.get() { +``` + +```rust +// Before: +fn my_system(q: Query<&ComputedVisibilty>) { + for vis in &q { + if vis.is_visible_in_view() { + +// After: +fn my_system(q: Query<&ViewVisibility>) { + for view_visibility in &q { + if view_visibility.get() { +``` + +```rust +// Before: +fn my_system(mut q: Query<&mut ComputedVisibilty>) { + for vis in &mut q { + vis.set_visible_in_view(); + +// After: +fn my_system(mut q: Query<&mut ViewVisibility>) { + for view_visibility in &mut q { + view_visibility.set(); +``` + +### [Cleanup `visibility` module](https://github.com/bevyengine/bevy/pull/9850) + +
+
Rendering
+
+ +- The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been replaced by `Has`, if you were calling it manually, you should change the type to match it + +### [Update defaults for OrthographicProjection](https://github.com/bevyengine/bevy/pull/9878) + +
+
Rendering
+
+ +- Migration guide steps from #9537 should be removed for next release. + +### [Revert "Update defaults for OrthographicProjection (#9537)"](https://github.com/bevyengine/bevy/pull/9878) + +
+
Rendering
+
+ +- Migration guide steps from #9537 should be removed for next release. + +### [Allow overriding global wireframe setting.](https://github.com/bevyengine/bevy/pull/7328) + +
+
Rendering
+
+ + + +### [PCF For DirectionalLight/SpotLight Shadows](https://github.com/bevyengine/bevy/pull/8006) + +
+
Rendering
+
+ +- Shadows cast by directional lights or spotlights now have smoother edges. To revert to the old behavior, add `ShadowFilteringMethod::Hardware2x2` to your cameras. + +### [Deferred Renderer](https://github.com/bevyengine/bevy/pull/9258) + +
+
Rendering
+
+ + + +### [`*_PREPASS` Shader Def Cleanup](https://github.com/bevyengine/bevy/pull/10136) + +
+
Rendering
+
+ +- When using functions from `bevy_pbr::prepass_utils` (`prepass_depth()`, `prepass_normal()`, `prepass_motion_vector()`) in contexts where these prepasses might be disabled, you should now wrap your calls with the appropriate `#ifdef` guards, (`#ifdef DEPTH_PREPASS`, `#ifdef NORMAL_PREPASS`, `#ifdef MOTION_VECTOR_PREPASS`) providing fallback logic where applicable. + +### [allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820) + +
+
Rendering
+
+ +manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. + +### [Detect cubemap for dds textures](https://github.com/bevyengine/bevy/pull/10222) + +
+
Rendering
+
+ +If you are matching on a `TextureError`, you will need to add a new branch to handle `TextureError::IncompleteCubemap`. + +### [Add convenient methods for Image](https://github.com/bevyengine/bevy/pull/10221) + +
+
Rendering
+
+ +Replace calls to the `Image::size()` method with `size_f32()`. +Replace calls to the `Image::aspect_2d()` method with `aspect_ratio()`. + +### [Fix fog color being inaccurate](https://github.com/bevyengine/bevy/pull/10226) + +
+
Rendering
+
+ +- Colors in `FogSettings` struct (`color` and `directional_light_color`) are now sent to the GPU in linear space. If you were using `Color::rgb()`/`Color::rgba()` and would like to retain the previous colors, you can quickly fix it by switching to `Color::rgb_linear()`/`Color::rgba_linear()`. + +### [Move skin code to a separate module](https://github.com/bevyengine/bevy/pull/9899) + +
+
Rendering
+
Animation
+
+ +Renamed skinning systems, resources and components: + +- extract_skinned_meshes -> extract_skins +- prepare_skinned_meshes -> prepare_skins +- SkinnedMeshUniform -> SkinUniform +- SkinnedMeshJoints -> SkinIndex + +### [Move scene spawner systems to SpawnScene schedule](https://github.com/bevyengine/bevy/pull/9260) + +
+
Scenes
+
+ +- Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate] [Update] [SpawnScene] [PostUpdate]), you might remove system ordering code related to scene spawning as the execution order has been guaranteed by bevy engine. + +### [Remove Resource and add Debug to TaskPoolOptions](https://github.com/bevyengine/bevy/pull/9485) + +
+
Tasks
+
+ +If for some reason anyone is still using `TaskPoolOptions` as a Resource, they would now have to use a wrapper type: + +```rust +#[derive(Resource)] +pub struct MyTaskPoolOptions(pub TaskPoolOptions); +``` + +### [Global TaskPool API improvements](https://github.com/bevyengine/bevy/pull/10008) + +
+
Tasks
+
+ +- Uses of `ComputeTaskPool::init`, `AsyncComputeTaskPool::init` and `IoTaskPool::init` should be changed to `::get_or_init`. + +### [Unify `FixedTime` and `Time` while fixing several problems](https://github.com/bevyengine/bevy/pull/8964) + +
+
Time
+
+ +- Change all `Res
diff --git a/content/learn/migration-guides/0.8-0.9/_index.md b/content/learn/migration-guides/0.8-0.9/_index.md index 21d11d1f46..7590ad473e 100644 --- a/content/learn/migration-guides/0.8-0.9/_index.md +++ b/content/learn/migration-guides/0.8-0.9/_index.md @@ -1,6 +1,6 @@ +++ title = "0.8 to 0.9" -weight = 4 +weight = 5 template = "docs-section.html" insert_anchor_links = "right" aliases = ["learn/book/migration-guides/0.8-0.9"] diff --git a/generate-release/src/changelog.rs b/generate-release/src/changelog.rs index a0b190aa82..4f92773338 100644 --- a/generate-release/src/changelog.rs +++ b/generate-release/src/changelog.rs @@ -20,7 +20,7 @@ pub fn generate_changelog( let area = get_pr_area(pr); areas .entry(area) - .or_insert(Vec::new()) + .or_default() .push((title.clone(), pr.clone())); } diff --git a/generate-release/src/migration_guide.rs b/generate-release/src/migration_guide.rs index e68e8281c8..322730a8f5 100644 --- a/generate-release/src/migration_guide.rs +++ b/generate-release/src/migration_guide.rs @@ -42,7 +42,7 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel let area = get_pr_area(pr); areas .entry(area) - .or_insert(Vec::new()) + .or_default() .push((title.clone(), pr.clone())); } From b38abc706b0c80150abee8528437948a67a65275 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 01:29:45 -0400 Subject: [PATCH 02/17] various clean ups --- .../migration-guides/0.11-0.12/_index.md | 123 +++++++----------- 1 file changed, 48 insertions(+), 75 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 4669ab9d57..5e6d42b154 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -25,13 +25,13 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel - Introduced `seek_time` accessor for the `PlayingAnimation::seek_to`. - Introduced `AnimationPlayer::replay` to reset the `PlayingAnimation` to a state where no time has elapsed. -### [fix run-once runners](https://github.com/bevyengine/bevy/pull/10195) +### [Fix run-once runners](https://github.com/bevyengine/bevy/pull/10195)
App
-- `app.ready()` has been replaced by `app.plugins_state()` which will return more details on the current state of plugins in the app +`app.ready()` has been replaced by `app.plugins_state()` which will return more details on the current state of plugins in the app ### [Copy on Write AssetPaths](https://github.com/bevyengine/bevy/pull/9729) @@ -40,16 +40,16 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel ```rust -// Old +// 0.11 AssetPath::new("logo.png", None); -// New +// 0.12 AssetPath::new("logo.png"); -// Old -AssetPath::new("scene.gltf", Some("Mesh0"); +// 0.11 +AssetPath::new("scene.gltf", Some("Mesh0")); -// New +// 0.12 AssetPath::new("scene.gltf").with_label("Mesh0"); ``` @@ -77,9 +77,7 @@ Spatial audio now automatically uses the transform of the `AudioBundle` and of a If you were manually scaling emitter/listener positions, you can use the `spatial_scale` field of `AudioPlugin` instead. ```rust - -// Old - +// 0.11 commands.spawn( SpatialAudioBundle { source: asset_server.load("sounds/Windless Slopes.ogg"), @@ -100,8 +98,7 @@ fn update( } } -// New - +// 0.12 commands.spawn(( SpatialBundle::from_transform(Transform::from_translation(emitter_position)), AudioBundle { @@ -125,17 +122,17 @@ commands.spawn(( The method `QueryParIter::for_each_mut` has been deprecated and is no longer functional. Use `for_each` instead, which now supports mutable queries. ```rust -// Before: +// 0.11: query.par_iter_mut().for_each_mut(|x| ...); -// After: +// 0.12: query.par_iter_mut().for_each(|x| ...); ``` The method `QueryParIter::for_each` now takes ownership of the `QueryParIter`, rather than taking a shared reference. ```rust -// Before: +// 0.11: let par_iter = my_query.par_iter().batching_strategy(my_batching_strategy); par_iter.for_each(|x| { // ...Do stuff with x... @@ -144,7 +141,7 @@ par_iter.for_each(|x| { }); }); -// After: +// 0.12: my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|x| { // ...Do stuff with x... my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|y| { @@ -163,9 +160,9 @@ __`fetch` invariants__ The function `WorldQuery::fetch` has had the following safety invariant added: -> -If `update_component_access` includes any mutable accesses, then the caller must ensure that `fetch` is called no more than once for each `entity`/`table_row` in each archetype. -If `Self` implements `ReadOnlyWorldQuery`, then this can safely be called multiple times. +> If `update_component_access` includes any mutable accesses, then the caller must ensure that `fetch` is called no more than once for each `entity`/`table_row` in each archetype. +>
+> If `Self` implements `ReadOnlyWorldQuery`, then this can safely be called multiple times. This invariant was always required for soundness, but was previously undocumented. If you called this function manually anywhere, you should check to make sure that this invariant is not violated. @@ -173,9 +170,8 @@ __Removed `clone_fetch`__ The function `WorldQuery::clone_fetch` has been removed. The associated type `WorldQuery::Fetch` now has the bound `Clone`. -Before: - ```rust +// 0.11 struct MyFetch<'w> { ... } unsafe impl WorldQuery for MyQuery { @@ -189,11 +185,8 @@ unsafe impl WorldQuery for MyQuery { } } } -``` - -After: -```rust +// 0.12 #[derive(Clone)] struct MyFetch<'w> { ... } @@ -203,7 +196,7 @@ unsafe impl WorldQuery for MyQuery { } ``` -### [opt-out `multi-threaded` feature flag](https://github.com/bevyengine/bevy/pull/9269) +### [Opt-out `multi-threaded` feature flag](https://github.com/bevyengine/bevy/pull/9269)
ECS
@@ -290,11 +283,11 @@ let new = |mut entity: EntityMut| { `Schedule::new` and `App::add_schedule` ```rust -// old +// 0.11 let schedule = Schedule::new(); app.add_schedule(MyLabel, schedule); -// new +// 0.12 let schedule = Schedule::new(MyLabel); app.add_schedule(schedule); ``` @@ -302,11 +295,11 @@ app.add_schedule(schedule); if you aren’t inserting the schedule into the world and are using the schedule directly you can use the default constructor which reuses a default label. ```rust -// old +// 0.11 let schedule = Schedule::new(); schedule.run(world); -// new +// 0.12 let schedule = Schedule::default(); schedule.run(world); ``` @@ -314,11 +307,11 @@ schedule.run(world); `Schedules:insert` ```rust -// old +// 0.11 let schedule = Schedule::new(); schedules.insert(MyLabel, schedule); -// new +// 0.12 let schedule = Schedule::new(MyLabel); schedules.insert(schedule); ``` @@ -326,11 +319,11 @@ schedules.insert(schedule); `World::add_schedule` ```rust -// old +// 0.11 let schedule = Schedule::new(); world.add_schedule(MyLabel, schedule); -// new +// 0.12 let schedule = Schedule::new(MyLabel); world.add_schedule(schedule); ``` @@ -449,16 +442,12 @@ Instead, use the newly-added type `EntityWorldMut`, which is a helper type for w When using `bevy_ecs::DynamicSceneBuilder` and `bevy_ecs::SceneBuilder`, instead of binding the builder to a variable, directly use it. Methods on those types now consume `Self`, so you will need to re-bind the builder if you don’t `build` it immediately. -Before: - ```rust +// 0.11 let mut scene_builder = DynamicSceneBuilder::from_world(&world); let scene = scene_builder.extract_entity(a).extract_entity(b).build(); -``` - -After: -```rust +// 0.12 let scene = DynamicSceneBuilder::from_world(&world) .extract_entity(a) .extract_entity(b) @@ -512,17 +501,12 @@ bevy = { version = "0.12", features = ["dynamic_linking"] }
Reflection
-- Renamed NamedTypePathDef::Primtive to NamedTypePathDef::Primitive - -Before: +Renamed NamedTypePathDef::Primtive to NamedTypePathDef::Primitive ```rust +// 0.11 let type_path = NamedTypePathDef::Primtive(ident); -``` - -After: - -```rust +// 0.12 let type_path = NamedTypePathDef::Primitive(ident); ``` @@ -548,8 +532,8 @@ If you were matching on the `Err(ReflectPathError)` value returned by `GetPath` -use bevy::reflect::ParsedPath; +use bevy::reflect::{ParsedPath, ReflectPath}; - parsed_path.element(reflect_type).unwrap() - parsed_path.element(reflect_type).unwrap()``` +parsed_path.element(reflect_type).unwrap() +``` ### [Remove TypeRegistry re-export rename](https://github.com/bevyengine/bevy/pull/9807) @@ -576,6 +560,7 @@ If you were matching on the `Err(ReflectPathError)` value returned by `GetPath` - Fields marked `#[reflect(skip_serializing)]` now must implement `Default` or specify a custom default function with `#[reflect(default = "path::to::some_func")]` + ```rust #[derive(Reflect)] struct MyStruct { @@ -600,10 +585,10 @@ fn get_foo_default() -> Foo { - `SerializationData::new` has been changed to expect an iterator of `(usize, SkippedField)` rather than one of just `usize` ```rust -// BEFORE +// 0.11 SerializationData::new([0, 3].into_iter()); -// AFTER +// 0.12 SerializationData::new([ (0, SkippedField::new(field_0_default_fn)), (3, SkippedField::new(field_3_default_fn)), @@ -619,19 +604,15 @@ SerializationData::new([
Rendering
-Before: - ```rust +// 0.11 fn view_physical_camera_rect(camera_query: Query<&Camera>) { let camera = camera_query.single(); let Some((min, max)) = camera.physical_viewport_rect() else { return }; dbg!(min, max); } -``` - -After: -```rust +// 0.12 fn view_physical_camera_rect(camera_query: Query<&Camera>) { let camera = camera_query.single(); let Some(URect { min, max }) = camera.physical_viewport_rect() else { return }; @@ -645,7 +626,7 @@ fn view_physical_camera_rect(camera_query: Query<&Camera>) {
Rendering
-- Handle `bevy_window::PresentMode::FifoRelaxed` when tweaking window present mode manually. +Handle `bevy_window::PresentMode::FifoRelaxed` when tweaking window present mode manually. ### [Split `ComputedVisibility` into two components to allow for accurate change detection and speed up visibility propagation](https://github.com/bevyengine/bevy/pull/9497) @@ -659,13 +640,13 @@ with `InheritedVisibility::get`, and replace `ComputedVisibility::is_visible_in_ with `ViewVisibility::get`. ```rust -// Before: +// 0.11: commands.spawn(VisibilityBundle { visibility: Visibility::Inherited, computed_visibility: ComputedVisibility::default(), }); -// After: +// 0.12: commands.spawn(VisibilityBundle { visibility: Visibility::Inherited, inherited_visibility: InheritedVisibility::default(), @@ -674,36 +655,36 @@ commands.spawn(VisibilityBundle { ``` ```rust -// Before: +// 0.11: fn my_system(q: Query<&ComputedVisibilty>) { for vis in &q { if vis.is_visible_in_hierarchy() { -// After: +// 0.12: fn my_system(q: Query<&InheritedVisibility>) { for inherited_visibility in &q { if inherited_visibility.get() { ``` ```rust -// Before: +// 0.11: fn my_system(q: Query<&ComputedVisibilty>) { for vis in &q { if vis.is_visible_in_view() { -// After: +// 0.12: fn my_system(q: Query<&ViewVisibility>) { for view_visibility in &q { if view_visibility.get() { ``` ```rust -// Before: +// 0.11: fn my_system(mut q: Query<&mut ComputedVisibilty>) { for vis in &mut q { vis.set_visible_in_view(); -// After: +// 0.12: fn my_system(mut q: Query<&mut ViewVisibility>) { for view_visibility in &mut q { view_visibility.set(); @@ -733,14 +714,6 @@ fn my_system(mut q: Query<&mut ViewVisibility>) { - Migration guide steps from #9537 should be removed for next release. -### [Allow overriding global wireframe setting.](https://github.com/bevyengine/bevy/pull/7328) - -
-
Rendering
-
- - - ### [PCF For DirectionalLight/SpotLight Shadows](https://github.com/bevyengine/bevy/pull/8006)
From 87c5e4d66a5fa467730b41a8330446e1e36ab0de Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 01:32:25 -0400 Subject: [PATCH 03/17] more clean up --- .../migration-guides/0.11-0.12/_index.md | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 5e6d42b154..f66b30db9e 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -352,7 +352,7 @@ world.add_schedule(schedule);
ECS
-- `use bevy_ecs::system::QueryComponentError;` -> `use bevy_ecs::query::QueryComponentError;` +`use bevy_ecs::system::QueryComponentError;` -> `use bevy_ecs::query::QueryComponentError;` ### [Fix naming on "tick" Column and ComponentSparseSet methods](https://github.com/bevyengine/bevy/pull/9744) @@ -393,7 +393,7 @@ Replace IntoIterator iteration (&mut ) with .read()
ECS
-- `States::variants` no longer exists. If you relied on this function, consider using a library that provides enum iterators. +`States::variants` no longer exists. If you relied on this function, consider using a library that provides enum iterators. ### [Replace all labels with interned labels](https://github.com/bevyengine/bevy/pull/7762) @@ -696,23 +696,7 @@ fn my_system(mut q: Query<&mut ViewVisibility>) {
Rendering
-- The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been replaced by `Has`, if you were calling it manually, you should change the type to match it - -### [Update defaults for OrthographicProjection](https://github.com/bevyengine/bevy/pull/9878) - -
-
Rendering
-
- -- Migration guide steps from #9537 should be removed for next release. - -### [Revert "Update defaults for OrthographicProjection (#9537)"](https://github.com/bevyengine/bevy/pull/9878) - -
-
Rendering
-
- -- Migration guide steps from #9537 should be removed for next release. +The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been replaced by `Has`, if you were calling it manually, you should change the type to match it ### [PCF For DirectionalLight/SpotLight Shadows](https://github.com/bevyengine/bevy/pull/8006) @@ -720,7 +704,7 @@ fn my_system(mut q: Query<&mut ViewVisibility>) {
Rendering
-- Shadows cast by directional lights or spotlights now have smoother edges. To revert to the old behavior, add `ShadowFilteringMethod::Hardware2x2` to your cameras. +Shadows cast by directional lights or spotlights now have smoother edges. To revert to the old behavior, add `ShadowFilteringMethod::Hardware2x2` to your cameras. ### [Deferred Renderer](https://github.com/bevyengine/bevy/pull/9258) @@ -736,9 +720,9 @@ fn my_system(mut q: Query<&mut ViewVisibility>) {
Rendering
-- When using functions from `bevy_pbr::prepass_utils` (`prepass_depth()`, `prepass_normal()`, `prepass_motion_vector()`) in contexts where these prepasses might be disabled, you should now wrap your calls with the appropriate `#ifdef` guards, (`#ifdef DEPTH_PREPASS`, `#ifdef NORMAL_PREPASS`, `#ifdef MOTION_VECTOR_PREPASS`) providing fallback logic where applicable. +When using functions from `bevy_pbr::prepass_utils` (`prepass_depth()`, `prepass_normal()`, `prepass_motion_vector()`) in contexts where these prepasses might be disabled, you should now wrap your calls with the appropriate `#ifdef` guards, (`#ifdef DEPTH_PREPASS`, `#ifdef NORMAL_PREPASS`, `#ifdef MOTION_VECTOR_PREPASS`) providing fallback logic where applicable. -### [allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820) +### [Allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820)
Rendering
@@ -769,7 +753,7 @@ Replace calls to the `Image::aspect_2d()` method with `aspect_ratio()`.
Rendering
-- Colors in `FogSettings` struct (`color` and `directional_light_color`) are now sent to the GPU in linear space. If you were using `Color::rgb()`/`Color::rgba()` and would like to retain the previous colors, you can quickly fix it by switching to `Color::rgb_linear()`/`Color::rgba_linear()`. +Colors in `FogSettings` struct (`color` and `directional_light_color`) are now sent to the GPU in linear space. If you were using `Color::rgb()`/`Color::rgba()` and would like to retain the previous colors, you can quickly fix it by switching to `Color::rgb_linear()`/`Color::rgba_linear()`. ### [Move skin code to a separate module](https://github.com/bevyengine/bevy/pull/9899) @@ -791,7 +775,7 @@ Renamed skinning systems, resources and components:
Scenes
-- Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate] [Update] [SpawnScene] [PostUpdate]), you might remove system ordering code related to scene spawning as the execution order has been guaranteed by bevy engine. +Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate] [Update] [SpawnScene] [PostUpdate]), you might remove system ordering code related to scene spawning as the execution order has been guaranteed by bevy engine. ### [Remove Resource and add Debug to TaskPoolOptions](https://github.com/bevyengine/bevy/pull/9485) @@ -812,7 +796,7 @@ pub struct MyTaskPoolOptions(pub TaskPoolOptions);
Tasks
-- Uses of `ComputeTaskPool::init`, `AsyncComputeTaskPool::init` and `IoTaskPool::init` should be changed to `::get_or_init`. +Uses of `ComputeTaskPool::init`, `AsyncComputeTaskPool::init` and `IoTaskPool::init` should be changed to `::get_or_init`. ### [Unify `FixedTime` and `Time` while fixing several problems](https://github.com/bevyengine/bevy/pull/8964) @@ -908,7 +892,7 @@ The `num_font_atlases` method of `FontAtlasSet` has been renamed to `len`.
Windowing
-- Added an `enabled_buttons` member to the `Window` struct through which users can enable or disable specific window control buttons. +Added an `enabled_buttons` member to the `Window` struct through which users can enable or disable specific window control buttons. ### [Improve `bevy_winit` documentation](https://github.com/bevyengine/bevy/pull/7609) @@ -925,6 +909,6 @@ The `num_font_atlases` method of `FontAtlasSet` has been renamed to `len`.
No area label
-- `&mut EventReader` does not implement `IntoIterator` anymore. replace `for foo in &mut events` by `for foo in events.iter()` +`&mut EventReader` does not implement `IntoIterator` anymore. replace `for foo in &mut events` by `for foo in events.iter()` From 46f98317c7d2b596b465dff3af1a84a1e6ee3e8e Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 01:34:45 -0400 Subject: [PATCH 04/17] more --- content/learn/migration-guides/0.11-0.12/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index f66b30db9e..4150d5db70 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -728,7 +728,7 @@ When using functions from `bevy_pbr::prepass_utils` (`prepass_depth()`, `prepass
Rendering
-manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. +Manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. ### [Detect cubemap for dds textures](https://github.com/bevyengine/bevy/pull/10222) From ae0b985854e6b80532b3105c15f0d72a54d92b89 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 02:29:16 -0400 Subject: [PATCH 05/17] add missing guides --- .../migration-guides/0.11-0.12/_index.md | 624 +++++++++++++++++- 1 file changed, 622 insertions(+), 2 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 4150d5db70..dfcecfbb5a 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -33,6 +33,159 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel `app.ready()` has been replaced by `app.plugins_state()` which will return more details on the current state of plugins in the app +### [Add support for KHR_materials_emissive_strength](https://github.com/bevyengine/bevy/pull/9553) + +
+
Assets
+
+ +- The GLTF asset loader will now factor in `emissiveStrength` when converting to Bevy’s `StandardMaterial::emissive`. Blender will export emissive materials using this field. Remove the field from your GLTF files or manually modify your materials post-asset-load to match how Bevy would load these files in previous versions. + +### [Bevy Asset V2](https://github.com/bevyengine/bevy/pull/8624) + +
+
Assets
+
+ +__Migrating a custom asset loader__ + +Existing asset loaders will need a few small changes to get them to work with Bevy Assets V2. + +First, you’ll need to add the asset type as an associated type of the loader. This type is called `Asset` and represents the type of the “default asset” produced by the loader. + +You’ll also need to add a `Settings` type which represents options that can be passed to the loader when you request an asset. If your asset has no settings, then you can just set it to the unit type. + +```rust +pub struct MyAssetLoader; + +impl AssetLoader for MyAssetLoader { + type Asset = MyAsset; + type Settings = (); +``` + +You’ll need to make a couple small changes to the `load` function as well. The load function now takes a `settings` parameter whose type is, you guessed it, `Settings`: + +```rust + fn load<'a>( + &'a self, + reader: &'a mut Reader, + settings: &'a Self::Settings, + load_context: &'a mut LoadContext, + ) -> BoxedFuture<'a, Result> { +``` + +Again, if you are not using settings, then you can just ignore the parameter (prefix it with “_”). + +Also, the second argument is now a reader rather than vector of bytes. If your existing code expects bytes, you can simply read the entire stream: + +```rust + fn load<'a>( + &'a self, + reader: &'a mut Reader, + _settings: &'a Self::Settings, + load_context: &'a mut LoadContext, + ) -> BoxedFuture<'a, Result> { + Box::pin(async move { + let mut bytes = Vec::new(); + reader.read_to_end(&mut bytes).await?; +``` + +Finally, you’ll need to write the code which returns the default asset. This used to be done via a call to `load_context.set_default_asset()`, however in V2 you simply return the asset from the `load` function: + +```rust + fn load<'a>( + &'a self, + reader: &'a mut Reader, + _settings: &'a Self::Settings, + load_context: &'a mut LoadContext, + ) -> BoxedFuture<'a, Result> { + Box::pin(async move { + let mut bytes = Vec::new(); + reader.read_to_end(&mut bytes).await?; + let mut asset: MyAsset = + serde_json::from_slice(&bytes).expect("unable to decode asset"); + Ok(asset) + } +``` + +To use the new loader, make sure you register both the loader and the asset type: + +```rust +app.register_asset_loader(MyAssetLoader) + .init_asset::() +``` + +__Labeled assets__ + +If your loader allows labeled assets, there are a couple of different ways to handle them. The simplest is to call `load_context.labeled_asset_scope`: + +```rust +// Assume `asset.children` is a HashMap or something. +// Using `drain` here so that we take ownership and don't end up with +// multiple references to the same asset. +asset.children.drain().for_each(|(label, mut item)| { + load_context.labeled_asset_scope(label, |lc| { + // Do any additional processing on the item + // Use 'lc' to load dependencies + item + }); +}); +``` + +You can use the provided load context (`lc`) to load additional assets. These will automatically be registered as dependencies of the labeled asset. + +__Using assets__ + +The actual call to `load` hasn’t changed: + +```rust +let handle = server.load("path/to/my/asset.json"); + +// ... + +let data = assets.get(&handle).unwrap(); +``` + +__Asset events__ + +There are a few changes to asset events. The event no longer contains a `handle` field, instead the event contains a field called `id`: + +```rust +for ev in ev_template.read() { + match ev { + AssetEvent::Added { id } => { + println!("Asset added"); + } + + AssetEvent::LoadedWithDependencies { id } => { + println!("Asset loaded"); + } + + AssetEvent::Modified { id } => { + println!("Asset modified"); + } + + AssetEvent::Removed { id } => { + println!("Asset removed"); + } + } +} +``` + +The `id` can be used to get access to the asset data, the asset’s path or load status. Asset handles also contain an `id` field which can be used to compare for equality: + +```rust +AssetEvent::Modified { id } => { + for cmp in query.iter() { + if cmp.handle.id() == id { + println!("Found it!"); + } + } +} +``` + +Also, as you may have noticed, the set of events has changed. The most important of these is `LoadedWithDependencies` which tells you that the asset and all its dependencies have finished loading into memory. + ### [Copy on Write AssetPaths](https://github.com/bevyengine/bevy/pull/9729)
@@ -66,6 +219,41 @@ AssetPath::new("scene.gltf").with_label("Mesh0"); - `AssetLoaderError` has been removed; Define a new error type, or use an alternative (e.g., `anyhow::Error`) - All the first-party `AssetLoader`’s and `AssetSaver`’s now return relevant (and narrow) error types instead of a single ambiguous type; Match over the specific error type, or encapsulate (`Box`, `thiserror`, `anyhow`, etc.) +### [Non-blocking load_untyped using a wrapper asset](https://github.com/bevyengine/bevy/pull/10198) + +
+
Assets
+
+ +Whenever possible use the typed API in order to directly get a handle to your asset. If you do not know the type or need to use `load_untyped` for a different reason, Bevy 0.12 introduces an additional layer of indirection. The asset server will return a handle to a `LoadedUntypedAsset`, which will load in the background. Once it is loaded, the untyped handle to the asset file can be retrieved from the `LoadedUntypedAsset`s field `handle`. + +### [reflect: `TypePath` part 2](https://github.com/bevyengine/bevy/pull/8768) + +
+
Assets
+
Reflection
+
+ +- + +Rely on `TypePath` instead of `std::any::type_name` for all stability guarantees and for use in all reflection contexts, this is used through with one of the following APIs: + +- `TypePath::type_path` if you have a concrete type and not a value. +- `DynamicTypePath::reflect_type_path` if you have an `dyn Reflect` value without a concrete type. +- `TypeInfo::type_path` for use through the registry or if you want to work with the represented type of a `DynamicFoo`. + +- + +Remove `type_name` from manual `Reflect` implementations. + +- + +Use `type_path` and `type_path_table` in place of `type_name` on `TypeInfo`-like structs. + +- + +Use `get_with_type_path(_mut)` over `get_with_type_name(_mut)`. + ### [More ergonomic spatial audio](https://github.com/bevyengine/bevy/pull/9800)
@@ -212,6 +400,38 @@ The `multi-threaded` feature in `bevy_ecs` and `bevy_tasks` is no longer enabled `ScheduleBuildError` now has strings in more of its variants. You may need to adjust code that is handling these variants. +### [Add `system.map(...)` for transforming the output of a system](https://github.com/bevyengine/bevy/pull/8526) + +
+
ECS
+
+ +The `system_adapter` functions have been deprecated: use `.map` instead, which is a lightweight alternative to `.pipe`. + +```rust +// Before: +my_system.pipe(system_adapter::ignore) +my_system.pipe(system_adapter::unwrap) +my_system.pipe(system_adapter::new(T::from)) + +// After: +my_system.map(std::mem::drop) +my_system.map(Result::unwrap) +my_system.map(T::from) + +// Before: +my_system.pipe(system_adapter::info) +my_system.pipe(system_adapter::dbg) +my_system.pipe(system_adapter::warn) +my_system.pipe(system_adapter::error) + +// After: +my_system.map(bevy_utils::info) +my_system.map(bevy_utils::dbg) +my_system.map(bevy_utils::warn) +my_system.map(bevy_utils::error) +``` + ### [Replaced EntityMap with HashMap](https://github.com/bevyengine/bevy/pull/9461)
@@ -410,6 +630,27 @@ Replace IntoIterator iteration (&mut ) with .read() - Pass labels to `World::try_schedule_scope`, `World::schedule_scope`, `World::try_run_schedule`. `World::run_schedule`, `Schedules::remove`, `Schedules::remove_entry`, `Schedules::contains`, `Schedules::get` and `Schedules::get_mut` by value instead of by reference. +### [Add configure_schedules to App and Schedules to apply `ScheduleBuildSettings` to all schedules](https://github.com/bevyengine/bevy/pull/9514) + +
+
ECS
+
App
+
+ +- No breaking changes. +- Adds `Schedule::get_build_settings()` getter for the schedule’s `ScheduleBuildSettings`. +- Can replaced manual configuration of all schedules: + +```rust +// Old +for (_, schedule) in app.world.resource_mut::().iter_mut() { + schedule.set_build_settings(build_settings); +} + +// New +app.configure_schedules(build_settings); +``` + ### [Only run event systems if they have tangible work to do](https://github.com/bevyengine/bevy/pull/7728)
@@ -470,6 +711,14 @@ If the default 0.05 was relied on, the default or gamepad `AxisSettings` on the Replace `Rect::as_urect` with `Rect::as_irect`, `Rect::as_rect` with `Rect::as_urect`, and `URect::as_urect` with `URect::as_irect`. +### [Rename `Bezier` to `CubicBezier` for clarity](https://github.com/bevyengine/bevy/pull/9554) + +
+
Math
+
+ +- Change all `Bezier` references to `CubicBezier` + ### [Remove the bevy_dylib feature](https://github.com/bevyengine/bevy/pull/9516)
@@ -628,6 +877,81 @@ fn view_physical_camera_rect(camera_query: Query<&Camera>) { Handle `bevy_window::PresentMode::FifoRelaxed` when tweaking window present mode manually. +### [Use GpuArrayBuffer for MeshUniform](https://github.com/bevyengine/bevy/pull/9254) + +
+
Rendering
+
+ +Accessing the `model` member of an individual mesh object’s shader `Mesh` struct the old way where each `MeshUniform` was stored at its own dynamic offset: + +```rust +struct Vertex { + @location(0) position: vec3, +}; + +fn vertex(vertex: Vertex) -> VertexOutput { + var out: VertexOutput; + out.clip_position = mesh_position_local_to_clip( + mesh.model, + vec4(vertex.position, 1.0) + ); + return out; +} +``` + +The new way where one needs to index into the array of `Mesh`es for the batch: + +```rust +struct Vertex { + @builtin(instance_index) instance_index: u32, + @location(0) position: vec3, +}; + +fn vertex(vertex: Vertex) -> VertexOutput { + var out: VertexOutput; + out.clip_position = mesh_position_local_to_clip( + mesh[vertex.instance_index].model, + vec4(vertex.position, 1.0) + ); + return out; +} +``` + +Note that using the instance_index is the default way to pass the per-object index into the shader, but if you wish to do custom rendering approaches you can pass it in however you like. + +### [Reduce the size of MeshUniform to improve performance](https://github.com/bevyengine/bevy/pull/9416) + +
+
Rendering
+
+ +Shader code before: + +```rust +var model = mesh[instance_index].model; +``` + +Shader code after: + +```rust +#import bevy_pbr::mesh_functions affine_to_square + +var model = affine_to_square(mesh[instance_index].model); +``` + +### [Reorder render sets, refactor bevy_sprite to take advantage](https://github.com/bevyengine/bevy/pull/9236) + +
+
Rendering
+
+ +- Assets such as materials and meshes should now be created in `PrepareAssets` e.g. `prepare_assets` +- Queueing entities to `RenderPhase`s continues to be done in `Queue` e.g. `queue_sprites` +- Preparing resources (textures, buffers, etc.) should now be done in `PrepareResources`, e.g. `prepare_prepass_textures`, `prepare_mesh_uniforms` +- Prepare bind groups should now be done in `PrepareBindGroups` e.g. `prepare_mesh_bind_group` +- Any batching or instancing can now be done in `Prepare` where the order of the phase items is known e.g. `prepare_sprites` + ### [Split `ComputedVisibility` into two components to allow for accurate change detection and speed up visibility propagation](https://github.com/bevyengine/bevy/pull/9497)
@@ -698,6 +1022,98 @@ fn my_system(mut q: Query<&mut ViewVisibility>) { The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been replaced by `Has`, if you were calling it manually, you should change the type to match it +### [Update defaults for OrthographicProjection](https://github.com/bevyengine/bevy/pull/9878) + +
+
Rendering
+
+ +- Migration guide steps from #9537 should be removed for next release. + +### [Revert "Update defaults for OrthographicProjection (#9537)"](https://github.com/bevyengine/bevy/pull/9878) + +
+
Rendering
+
+ +- Migration guide steps from #9537 should be removed for next release. + +### [Allow other plugins to create renderer resources](https://github.com/bevyengine/bevy/pull/9925) + +
+
Rendering
+
+ +The `RenderPlugin` now takes a `RenderCreation` enum instead of `WgpuSettings`. `RenderSettings::default()` returns `RenderSettings::Automatic(WgpuSettings::default())`. `RenderSettings` also implements `From`. + +```rust +// before +RenderPlugin { + wgpu_settings: WgpuSettings { + ... + }, +} + +// now +RenderPlugin { + render_creation: RenderCreation::Automatic(WgpuSettings { + ... + }), +} +// or +RenderPlugin { + render_creation: WgpuSettings { + ... + }.into(), +} +``` + +### [Use EntityHashMap for render world entity storage for better performance](https://github.com/bevyengine/bevy/pull/9903) + +
+
Rendering
+
+ +Previously the render app extracted mesh entities and their component data from the main world and stored them as entities and components in the render world. Now they are extracted into essentially `EntityHashMap` where `T` are structs containing an appropriate group of data. This means that while extract set systems will continue to run extract queries against the main world they will store their data in hash maps. Also, systems in later sets will either need to look up entities in the available resources such as `RenderMeshInstances`, or maintain their own `EntityHashMap` for their own data. + +Before: + +```rust +fn queue_custom( + material_meshes: Query<(Entity, &MeshTransforms, &Handle), With>, +) { + ... + for (entity, mesh_transforms, mesh_handle) in &material_meshes { + ... + } +} +``` + +After: + +```rust +fn queue_custom( + render_mesh_instances: Res, + instance_entities: Query>, +) { + ... + for entity in &instance_entities { + let Some(mesh_instance) = render_mesh_instances.get(&entity) else { continue; }; + // The mesh handle in `AssetId` form, and the `MeshTransforms` can now + // be found in `mesh_instance` which is a `RenderMeshInstance` + ... + } +} +``` + +### [Allow overriding global wireframe setting.](https://github.com/bevyengine/bevy/pull/7328) + +
+
Rendering
+
+ + + ### [PCF For DirectionalLight/SpotLight Shadows](https://github.com/bevyengine/bevy/pull/8006)
@@ -706,6 +1122,14 @@ The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been Shadows cast by directional lights or spotlights now have smoother edges. To revert to the old behavior, add `ShadowFilteringMethod::Hardware2x2` to your cameras. +### [use `Material` for wireframes](https://github.com/bevyengine/bevy/pull/5314) + +
+
Rendering
+
+ +`WireframePipeline` was removed. If you were using it directly, please create an issue explaining your use case. + ### [Deferred Renderer](https://github.com/bevyengine/bevy/pull/9258)
@@ -714,6 +1138,22 @@ Shadows cast by directional lights or spotlights now have smoother edges. To rev +### [pbr shader cleanup](https://github.com/bevyengine/bevy/pull/10105) + +
+
Rendering
+
+ +in custom material shaders: + +- `pbr_functions::pbr` no longer calls to `pbr_functions::alpha_discard`. if you were using the `pbr` function in a custom shader with alpha mask mode you now also need to call alpha_discard manually +- rename imports of `bevy_pbr::mesh_vertex_output` to `bevy_pbr::forward_io` +- rename instances of `MeshVertexOutput` to `VertexOutput` + +in custom material prepass shaders: + +- rename instances of `VertexOutput::clip_position` to `VertexOutput::position` + ### [`*_PREPASS` Shader Def Cleanup](https://github.com/bevyengine/bevy/pull/10136)
@@ -722,13 +1162,94 @@ Shadows cast by directional lights or spotlights now have smoother edges. To rev When using functions from `bevy_pbr::prepass_utils` (`prepass_depth()`, `prepass_normal()`, `prepass_motion_vector()`) in contexts where these prepasses might be disabled, you should now wrap your calls with the appropriate `#ifdef` guards, (`#ifdef DEPTH_PREPASS`, `#ifdef NORMAL_PREPASS`, `#ifdef MOTION_VECTOR_PREPASS`) providing fallback logic where applicable. -### [Allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820) +### [allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820) + +
+
Rendering
+
+ +manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. + +### [chore: use ExtractComponent derive macro for EnvironmentMapLight and FogSettings](https://github.com/bevyengine/bevy/pull/10191) + +
+
Rendering
+
+ +No migration needed + +### [Variable `MeshPipeline` View Bind Group Layout](https://github.com/bevyengine/bevy/pull/10156) + +
+
Rendering
+
+ +- `MeshPipeline::view_layout` and `MeshPipeline::view_layout_multisampled` have been replaced with a private array to accomodate for variable view bind group layouts. To obtain a view bind group layout for the current pipeline state, use the new `MeshPipeline::get_view_layout()` or `MeshPipeline::get_view_layout_from_key()` methods. + +### [update shader imports](https://github.com/bevyengine/bevy/pull/10180) + +
+
Rendering
+
+ +naga_oil 0.10 reworks the import mechanism to support more syntax to make it more rusty, and test for item use before importing to determine which imports are modules and which are items, which allows: + +- use rust-style imports + +```rust +#import bevy_pbr::{ + pbr_functions::{alpha_discard as discard, apply_pbr_lighting}, + mesh_bindings, +} +``` + +- import partial paths: + +```rust +#import part::of::path +... +path::remainder::function(); +``` + +which will call to `part::of::path::remainder::function` + +- use fully qualified paths without importing: + +```rust +// #import bevy_pbr::pbr_functions +bevy_pbr::pbr_functions::pbr() +``` + +- use imported items without qualifying + +```rust +#import bevy_pbr::pbr_functions::pbr +// for backwards compatibility the old style is still supported: +// #import bevy_pbr::pbr_functions pbr +... +pbr() +``` + +- + +allows most imported items to end with `_` and numbers (naga_oil#30). still doesn’t allow struct members to end with `_` or numbers but it’s progress. + +- + +the vast majority of existing shader code will work without changes, but will emit “deprecated” warnings for old-style imports. these can be suppressed with the `allow-deprecated` feature. + +- + +partly breaks overrides (as far as i’m aware nobody uses these yet) - now overrides will only be applied if the overriding module is added as an additional import in the arguments to `Composer::make_naga_module` or `Composer::add_composable_module`. this is necessary to support determining whether imports are modules or items. + +### [Bind group entries](https://github.com/bevyengine/bevy/pull/9694)
Rendering
-Manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. +- Calls to `RenderDevice::create_bind_group({BindGroupDescriptor { label, layout, entries })` must be amended to `RenderDevice::create_bind_group(label, layout, entries)`. +- If `label`s have been specified as `"bind_group_name".into()`, they need to change to just `"bind_group_name"`. `Some("bind_group_name")` and `None` will still work, but `Some("bind_group_name")` can optionally be simplified to just `"bind_group_name"`. ### [Detect cubemap for dds textures](https://github.com/bevyengine/bevy/pull/10222) @@ -747,6 +1268,14 @@ If you are matching on a `TextureError`, you will need to add a new branch to ha Replace calls to the `Image::size()` method with `size_f32()`. Replace calls to the `Image::aspect_2d()` method with `aspect_ratio()`. +### [Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights](https://github.com/bevyengine/bevy/pull/10182) + +
+
Rendering
+
+ +- If Fresnel highlights from Ambient and Environment Map lights are no longer visible in your materials, make sure you’re using a higher, physically plausible value of `reflectance` (⪆ 0.35). + ### [Fix fog color being inaccurate](https://github.com/bevyengine/bevy/pull/10226)
@@ -755,6 +1284,15 @@ Replace calls to the `Image::aspect_2d()` method with `aspect_ratio()`. Colors in `FogSettings` struct (`color` and `directional_light_color`) are now sent to the GPU in linear space. If you were using `Color::rgb()`/`Color::rgba()` and would like to retain the previous colors, you can quickly fix it by switching to `Color::rgb_linear()`/`Color::rgba_linear()`. +### [Image Sampler Improvements](https://github.com/bevyengine/bevy/pull/10254) + +
+
Rendering
+
+ +- When using the `Image` API, use `ImageSamplerDescriptor` instead of `wgpu::SamplerDescriptor` +- If writing custom wgpu renderer features that work with `Image`, call `&image_sampler.as_wgpu()` to convert to a wgpu descriptor. + ### [Move skin code to a separate module](https://github.com/bevyengine/bevy/pull/9899)
@@ -840,6 +1378,14 @@ Replace initialization of `UiScale` like `UiScale { scale: 1.0 }` with `UiScale( - Other changes to `TextMeasureInfo` may also break your code if you were manually building it. Please consider using the new `TextMeasureInfo::from_text` to build one instead. - `TextPipeline::create_text_measure` has been removed in favor of `TextMeasureInfo::from_text` +### [Make `GridPlacement`'s fields non-zero and add accessor functions.](https://github.com/bevyengine/bevy/pull/9486) + +
+
UI
+
+ +`GridPlacement`’s constructor functions no longer accept values of `0`. Given any argument of `0` they will panic with a `GridPlacementError`. + ### [Remove `Val`'s `try_*` arithmetic methods](https://github.com/bevyengine/bevy/pull/9609)
@@ -886,6 +1432,34 @@ The `size` value of `TextLayoutInfo` is stored in logical pixels and has been re The `num_font_atlases` method of `FontAtlasSet` has been renamed to `len`. +### [Various accessibility API updates.](https://github.com/bevyengine/bevy/pull/9989) + +
+
UI
+
+ +__Change direct accesses of `AccessibilityRequested` to use `AccessibilityRequested.::get()`/`AccessibilityRequested::set()`__ + +__Before__ + +```rust +use std::sync::atomic::Ordering; + +// To access +accessibility_requested.load(Ordering::SeqCst) +// To update +accessibility_requested.store(true, Ordering::SeqCst); +``` + +__After__ + +```rust +// To access +accessibility_requested.get() +// To update +accessibility_requested.set(true); +``` + ### [Add option to toggle window control buttons](https://github.com/bevyengine/bevy/pull/9083)
@@ -903,6 +1477,52 @@ Added an `enabled_buttons` member to the `Window` struct through which users can - `UpdateMode::Reactive { max_wait: .. }` -> `UpdateMode::Reactive { wait: .. }` - `UpdateMode::ReactiveLowPower { max_wait: .. }` -> `UpdateMode::ReactiveLowPower { wait: .. }` +### [Prevent black frames during startup](https://github.com/bevyengine/bevy/pull/9826) + +
+
Windowing
+
+ +Because of this change, the timing of the first few frames might have changed, and I think it could be that some things one may expect to be initialized in a system may no longer be. To be honest, I feel out of my depth to judge the exact impact here. + +### [Work around naga/wgpu WGSL instance_index -> GLSL gl_InstanceID bug on WebGL2](https://github.com/bevyengine/bevy/pull/9383) + +
+
No area label
+
+ +Shader code before: + +```rust +struct Vertex { + @builtin(instance_index) instance_index: u32, +... +} + +@vertex +fn vertex(vertex_no_morph: Vertex) -> VertexOutput { +... + + var model = mesh[vertex_no_morph.instance_index].model; +``` + +After: + +```rust +#import bevy_render::instance_index + +struct Vertex { + @builtin(instance_index) instance_index: u32, +... +} + +@vertex +fn vertex(vertex_no_morph: Vertex) -> VertexOutput { +... + + var model = mesh[bevy_render::instance_index::get_instance_index(vertex_no_morph.instance_index)].model; +``` + ### [Remove `IntoIterator` impl for `&mut EventReader`](https://github.com/bevyengine/bevy/pull/9583)
From f9a8d832089c17c04b54e4c0cdd05dc50a2d1af6 Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 02:38:43 -0400 Subject: [PATCH 06/17] clean up new guides --- .../migration-guides/0.11-0.12/_index.md | 154 +++++------------- 1 file changed, 44 insertions(+), 110 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index dfcecfbb5a..abc9f117a7 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -39,7 +39,7 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel
Assets
-- The GLTF asset loader will now factor in `emissiveStrength` when converting to Bevy’s `StandardMaterial::emissive`. Blender will export emissive materials using this field. Remove the field from your GLTF files or manually modify your materials post-asset-load to match how Bevy would load these files in previous versions. +The GLTF asset loader will now factor in `emissiveStrength` when converting to Bevy’s `StandardMaterial::emissive`. Blender will export emissive materials using this field. Remove the field from your GLTF files or manually modify your materials post-asset-load to match how Bevy would load these files in previous versions. ### [Bevy Asset V2](https://github.com/bevyengine/bevy/pull/8624) @@ -156,15 +156,12 @@ for ev in ev_template.read() { AssetEvent::Added { id } => { println!("Asset added"); } - AssetEvent::LoadedWithDependencies { id } => { println!("Asset loaded"); } - AssetEvent::Modified { id } => { println!("Asset modified"); } - AssetEvent::Removed { id } => { println!("Asset removed"); } @@ -234,25 +231,13 @@ Whenever possible use the typed API in order to directly get a handle to your as
Reflection
-- - -Rely on `TypePath` instead of `std::any::type_name` for all stability guarantees and for use in all reflection contexts, this is used through with one of the following APIs: - -- `TypePath::type_path` if you have a concrete type and not a value. -- `DynamicTypePath::reflect_type_path` if you have an `dyn Reflect` value without a concrete type. -- `TypeInfo::type_path` for use through the registry or if you want to work with the represented type of a `DynamicFoo`. - -- - -Remove `type_name` from manual `Reflect` implementations. - -- - -Use `type_path` and `type_path_table` in place of `type_name` on `TypeInfo`-like structs. - -- - -Use `get_with_type_path(_mut)` over `get_with_type_name(_mut)`. +- Rely on `TypePath` instead of `std::any::type_name` for all stability guarantees and for use in all reflection contexts, this is used through with one of the following APIs: + - `TypePath::type_path` if you have a concrete type and not a value. + - `DynamicTypePath::reflect_type_path` if you have an `dyn Reflect` value without a concrete type. + - `TypeInfo::type_path` for use through the registry or if you want to work with the represented type of a `DynamicFoo`. +- Remove `type_name` from manual `Reflect` implementations. +- Use `type_path` and `type_path_table` in place of `type_name` on `TypeInfo`-like structs. +- Use `get_with_type_path(_mut)` over `get_with_type_name(_mut)`. ### [More ergonomic spatial audio](https://github.com/bevyengine/bevy/pull/9800) @@ -310,17 +295,17 @@ commands.spawn(( The method `QueryParIter::for_each_mut` has been deprecated and is no longer functional. Use `for_each` instead, which now supports mutable queries. ```rust -// 0.11: +// 0.11 query.par_iter_mut().for_each_mut(|x| ...); -// 0.12: +// 0.12 query.par_iter_mut().for_each(|x| ...); ``` The method `QueryParIter::for_each` now takes ownership of the `QueryParIter`, rather than taking a shared reference. ```rust -// 0.11: +// 0.11 let par_iter = my_query.par_iter().batching_strategy(my_batching_strategy); par_iter.for_each(|x| { // ...Do stuff with x... @@ -329,7 +314,7 @@ par_iter.for_each(|x| { }); }); -// 0.12: +// 0.12 my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|x| { // ...Do stuff with x... my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|y| { @@ -409,23 +394,23 @@ The `multi-threaded` feature in `bevy_ecs` and `bevy_tasks` is no longer enabled The `system_adapter` functions have been deprecated: use `.map` instead, which is a lightweight alternative to `.pipe`. ```rust -// Before: +// 0.11 my_system.pipe(system_adapter::ignore) my_system.pipe(system_adapter::unwrap) my_system.pipe(system_adapter::new(T::from)) -// After: +// 0.12 my_system.map(std::mem::drop) my_system.map(Result::unwrap) my_system.map(T::from) -// Before: +// 0.11 my_system.pipe(system_adapter::info) my_system.pipe(system_adapter::dbg) my_system.pipe(system_adapter::warn) my_system.pipe(system_adapter::error) -// After: +// 0.12 my_system.map(bevy_utils::info) my_system.map(bevy_utils::dbg) my_system.map(bevy_utils::warn) @@ -642,12 +627,12 @@ Replace IntoIterator iteration (&mut ) with .read() - Can replaced manual configuration of all schedules: ```rust -// Old +// 0.11 for (_, schedule) in app.world.resource_mut::().iter_mut() { schedule.set_build_settings(build_settings); } -// New +// 0.l2 app.configure_schedules(build_settings); ``` @@ -717,7 +702,7 @@ Replace `Rect::as_urect` with `Rect::as_irect`, `Rect::as_rect` with `Rect::as_u
Math
-- Change all `Bezier` references to `CubicBezier` +Change all `Bezier` references to `CubicBezier` ### [Remove the bevy_dylib feature](https://github.com/bevyengine/bevy/pull/9516) @@ -926,15 +911,11 @@ Note that using the instance_index is the default way to pass the per-object ind
Rendering
-Shader code before: - ```rust +// 0.11 var model = mesh[instance_index].model; -``` -Shader code after: - -```rust +// 0.12 #import bevy_pbr::mesh_functions affine_to_square var model = affine_to_square(mesh[instance_index].model); @@ -1022,22 +1003,6 @@ fn my_system(mut q: Query<&mut ViewVisibility>) { The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been replaced by `Has`, if you were calling it manually, you should change the type to match it -### [Update defaults for OrthographicProjection](https://github.com/bevyengine/bevy/pull/9878) - -
-
Rendering
-
- -- Migration guide steps from #9537 should be removed for next release. - -### [Revert "Update defaults for OrthographicProjection (#9537)"](https://github.com/bevyengine/bevy/pull/9878) - -
-
Rendering
-
- -- Migration guide steps from #9537 should be removed for next release. - ### [Allow other plugins to create renderer resources](https://github.com/bevyengine/bevy/pull/9925)
@@ -1047,14 +1012,14 @@ The `check_visibility` system’s `Option<&NoFrustumCulling>` parameter has been The `RenderPlugin` now takes a `RenderCreation` enum instead of `WgpuSettings`. `RenderSettings::default()` returns `RenderSettings::Automatic(WgpuSettings::default())`. `RenderSettings` also implements `From`. ```rust -// before +// 0.11 RenderPlugin { wgpu_settings: WgpuSettings { ... }, } -// now +// 0.12 RenderPlugin { render_creation: RenderCreation::Automatic(WgpuSettings { ... @@ -1076,9 +1041,8 @@ RenderPlugin { Previously the render app extracted mesh entities and their component data from the main world and stored them as entities and components in the render world. Now they are extracted into essentially `EntityHashMap` where `T` are structs containing an appropriate group of data. This means that while extract set systems will continue to run extract queries against the main world they will store their data in hash maps. Also, systems in later sets will either need to look up entities in the available resources such as `RenderMeshInstances`, or maintain their own `EntityHashMap` for their own data. -Before: - ```rust +// 0.11 fn queue_custom( material_meshes: Query<(Entity, &MeshTransforms, &Handle), With>, ) { @@ -1087,11 +1051,8 @@ fn queue_custom( ... } } -``` - -After: -```rust +// 0.12 fn queue_custom( render_mesh_instances: Res, instance_entities: Query>, @@ -1106,14 +1067,6 @@ fn queue_custom( } ``` -### [Allow overriding global wireframe setting.](https://github.com/bevyengine/bevy/pull/7328) - -
-
Rendering
-
- - - ### [PCF For DirectionalLight/SpotLight Shadows](https://github.com/bevyengine/bevy/pull/8006)
@@ -1162,21 +1115,13 @@ in custom material prepass shaders: When using functions from `bevy_pbr::prepass_utils` (`prepass_depth()`, `prepass_normal()`, `prepass_motion_vector()`) in contexts where these prepasses might be disabled, you should now wrap your calls with the appropriate `#ifdef` guards, (`#ifdef DEPTH_PREPASS`, `#ifdef NORMAL_PREPASS`, `#ifdef MOTION_VECTOR_PREPASS`) providing fallback logic where applicable. -### [allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820) +### [Allow extensions to StandardMaterial](https://github.com/bevyengine/bevy/pull/7820)
Rendering
-manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. - -### [chore: use ExtractComponent derive macro for EnvironmentMapLight and FogSettings](https://github.com/bevyengine/bevy/pull/10191) - -
-
Rendering
-
- -No migration needed +Manual implementations of `AsBindGroup` will need to be adjusted, the changes are pretty straightforward and can be seen in the diff for e.g. the `texture_binding_array` example. ### [Variable `MeshPipeline` View Bind Group Layout](https://github.com/bevyengine/bevy/pull/10156) @@ -1184,9 +1129,9 @@ No migration needed
Rendering
-- `MeshPipeline::view_layout` and `MeshPipeline::view_layout_multisampled` have been replaced with a private array to accomodate for variable view bind group layouts. To obtain a view bind group layout for the current pipeline state, use the new `MeshPipeline::get_view_layout()` or `MeshPipeline::get_view_layout_from_key()` methods. +`MeshPipeline::view_layout` and `MeshPipeline::view_layout_multisampled` have been replaced with a private array to accomodate for variable view bind group layouts. To obtain a view bind group layout for the current pipeline state, use the new `MeshPipeline::get_view_layout()` or `MeshPipeline::get_view_layout_from_key()` methods. -### [update shader imports](https://github.com/bevyengine/bevy/pull/10180) +### [Update shader imports](https://github.com/bevyengine/bevy/pull/10180)
Rendering
@@ -1207,7 +1152,7 @@ naga_oil 0.10 reworks the import mechanism to support more syntax to make it mor ```rust #import part::of::path -... +// ... path::remainder::function(); ``` @@ -1226,21 +1171,13 @@ bevy_pbr::pbr_functions::pbr() #import bevy_pbr::pbr_functions::pbr // for backwards compatibility the old style is still supported: // #import bevy_pbr::pbr_functions pbr -... +// ... pbr() ``` -- - -allows most imported items to end with `_` and numbers (naga_oil#30). still doesn’t allow struct members to end with `_` or numbers but it’s progress. - -- - -the vast majority of existing shader code will work without changes, but will emit “deprecated” warnings for old-style imports. these can be suppressed with the `allow-deprecated` feature. - -- - -partly breaks overrides (as far as i’m aware nobody uses these yet) - now overrides will only be applied if the overriding module is added as an additional import in the arguments to `Composer::make_naga_module` or `Composer::add_composable_module`. this is necessary to support determining whether imports are modules or items. +- allows most imported items to end with `_` and numbers (naga_oil#30). still doesn’t allow struct members to end with `_` or numbers but it’s progress. +- the vast majority of existing shader code will work without changes, but will emit “deprecated” warnings for old-style imports. these can be suppressed with the `allow-deprecated` feature. +- partly breaks overrides (as far as i’m aware nobody uses these yet) - now overrides will only be applied if the overriding module is added as an additional import in the arguments to `Composer::make_naga_module` or `Composer::add_composable_module`. this is necessary to support determining whether imports are modules or items. ### [Bind group entries](https://github.com/bevyengine/bevy/pull/9694) @@ -1438,22 +1375,18 @@ The `num_font_atlases` method of `FontAtlasSet` has been renamed to `len`.
UI
-__Change direct accesses of `AccessibilityRequested` to use `AccessibilityRequested.::get()`/`AccessibilityRequested::set()`__ - -__Before__ +Change direct accesses of `AccessibilityRequested` to use `AccessibilityRequested.::get()`/`AccessibilityRequested::set()` ```rust +// 0.11 use std::sync::atomic::Ordering; // To access accessibility_requested.load(Ordering::SeqCst) // To update accessibility_requested.store(true, Ordering::SeqCst); -``` -__After__ - -```rust +// 0.12 // To access accessibility_requested.get() // To update @@ -1501,9 +1434,9 @@ struct Vertex { @vertex fn vertex(vertex_no_morph: Vertex) -> VertexOutput { -... - + // ... var model = mesh[vertex_no_morph.instance_index].model; +} ``` After: @@ -1513,14 +1446,15 @@ After: struct Vertex { @builtin(instance_index) instance_index: u32, -... + // ... } @vertex fn vertex(vertex_no_morph: Vertex) -> VertexOutput { -... - - var model = mesh[bevy_render::instance_index::get_instance_index(vertex_no_morph.instance_index)].model; + // ... + let instance_index = bevy_render::instance_index::get_instance_index(vertex_no_morph.instance_index); + var model = mesh[instance_index].model; +} ``` ### [Remove `IntoIterator` impl for `&mut EventReader`](https://github.com/bevyengine/bevy/pull/9583) From 858ec1dc8dfc1228a753778458549c3e913a21be Mon Sep 17 00:00:00 2001 From: IceSentry Date: Fri, 27 Oct 2023 16:00:33 -0400 Subject: [PATCH 07/17] Update content/learn/migration-guides/0.8-0.9/_index.md --- content/learn/migration-guides/0.8-0.9/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.8-0.9/_index.md b/content/learn/migration-guides/0.8-0.9/_index.md index 7590ad473e..21d11d1f46 100644 --- a/content/learn/migration-guides/0.8-0.9/_index.md +++ b/content/learn/migration-guides/0.8-0.9/_index.md @@ -1,6 +1,6 @@ +++ title = "0.8 to 0.9" -weight = 5 +weight = 4 template = "docs-section.html" insert_anchor_links = "right" aliases = ["learn/book/migration-guides/0.8-0.9"] From 45c977de41914a6f4830edc980b957d67cbe55b9 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 11:18:18 -0700 Subject: [PATCH 08/17] AnimationPlayer --- content/learn/migration-guides/0.11-0.12/_index.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index abc9f117a7..f083e98af3 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -19,11 +19,13 @@ As a result, the Minimum Supported Rust Version (MSRV) is "the latest stable rel
Animation
-- Removed `set_elapsed`. -- Removed `stop_repeating` in favour of `AnimationPlayer::set_repeat(RepeatAnimation::Never)`. -- Introduced `seek_to` to seek to a given timestamp inside of the animation. -- Introduced `seek_time` accessor for the `PlayingAnimation::seek_to`. -- Introduced `AnimationPlayer::replay` to reset the `PlayingAnimation` to a state where no time has elapsed. +Some methods on [`AnimationPlayer`](https://docs.rs/bevy/0.12.0/bevy/animation/struct.AnimationPlayer.html) have changed. + +- `elapsed` was removed. Use `seek_time`. +- `set_elapsed` was removed. Use `seek_to`. +- `stop_repeating` was removed. Use `set_repeat(RepeatAnimation::Never)`. + +If you were manually resetting animation state, you can use the new `replay` method instead. ### [Fix run-once runners](https://github.com/bevyengine/bevy/pull/10195) From 638a6a0e7de8ffd0b74e84be258e59cd58a7f5f9 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:02:25 -0700 Subject: [PATCH 09/17] Apostrophes --- content/learn/migration-guides/0.11-0.12/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index f083e98af3..b6ee1db1b5 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -216,7 +216,7 @@ AssetPath::new("scene.gltf").with_label("Mesh0"); - `anyhow` is no longer exported by `bevy_asset`; Add it to your own project (if required). - `AssetLoader` and `AssetSaver` have an associated type `Error`; Define an appropriate error type (e.g., using `thiserror`), or use a pre-made error type (e.g., `anyhow::Error`). Note that using `anyhow::Error` is a drop-in replacement. - `AssetLoaderError` has been removed; Define a new error type, or use an alternative (e.g., `anyhow::Error`) -- All the first-party `AssetLoader`’s and `AssetSaver`’s now return relevant (and narrow) error types instead of a single ambiguous type; Match over the specific error type, or encapsulate (`Box`, `thiserror`, `anyhow`, etc.) +- All the first-party `AssetLoader`s and `AssetSaver`s now return relevant (and narrow) error types instead of a single ambiguous type; Match over the specific error type, or encapsulate (`Box`, `thiserror`, `anyhow`, etc.) ### [Non-blocking load_untyped using a wrapper asset](https://github.com/bevyengine/bevy/pull/10198) From 065a1ba04536f2ac75ac9f6e5fae52705b3fc2dd Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:02:39 -0700 Subject: [PATCH 10/17] Typo --- content/learn/migration-guides/0.11-0.12/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index b6ee1db1b5..e7281beeae 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -511,7 +511,7 @@ let schedule = Schedule::default(); schedule.run(world); ``` -`Schedules:insert` +`Schedules::insert` ```rust // 0.11 From bc15cda3091cda28156dac49f2a17a9f2beee4e4 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:03:16 -0700 Subject: [PATCH 11/17] Seems like code would be clearer here. --- .../learn/migration-guides/0.11-0.12/_index.md | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index e7281beeae..8c54208507 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -590,9 +590,19 @@ The trait method `DetectChangesMut::set_if_neq` now returns a boolean value indi
ECS
-Rename calls of RemovedComponents::iter/iter_with_id to read/read_with_id - -Replace IntoIterator iteration (&mut ) with .read() +```rust +fn react_on_removal(mut removed: RemovedComponents) { + // 0.11 + for entity in removed.iter() { /* ... */ } + for (entity, id) in removed.iter_with_id() { /* ... */ } + for entity in &mut removed { /* ... */ } + + // 0.12 + for entity in removed.read() { /* ... */ } + for (entity, id) in removed.read_with_id() { /* ... */ } + for entity in removed.read() { /* ... */ } +} +``` ### [Remove States::variants and remove enum-only restriction its derive](https://github.com/bevyengine/bevy/pull/9945) From 1ced648047699f54aef6137c8388a39c93124dc0 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:07:15 -0700 Subject: [PATCH 12/17] Fix wrong default being mentioned and add link/reasoning --- content/learn/migration-guides/0.11-0.12/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 8c54208507..fdb96a20cc 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -698,7 +698,7 @@ let scene = DynamicSceneBuilder::from_world(&world)
Input
-If the default 0.05 was relied on, the default or gamepad `AxisSettings` on the resource `GamepadSettings` will have to be changed. +The default live zone bounds have been changed from `-0.95..=0.95` to `-1.0..=1.0` to align with more common usage. If you were relying on the old default, you can change change this by modifying [`GamepadSettings::default_axis_settings`](https://docs.rs/bevy/0.12.0/bevy/input/gamepad/struct.GamepadSettings.html#structfield.default_axis_settings). ### [Rename bevy_math::rects conversion methods](https://github.com/bevyengine/bevy/pull/9159) From 2c10df75749c28012355b27949c06817aec86152 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:07:55 -0700 Subject: [PATCH 13/17] Add backticks to types --- content/learn/migration-guides/0.11-0.12/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index fdb96a20cc..5c120edb67 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -747,7 +747,7 @@ bevy = { version = "0.12", features = ["dynamic_linking"] }
Reflection
-Renamed NamedTypePathDef::Primtive to NamedTypePathDef::Primitive +Renamed `NamedTypePathDef::Primtive` to `NamedTypePathDef::Primitive` ```rust // 0.11 From 0178f658b32998151cb50da89245f47bab615ee8 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:08:25 -0700 Subject: [PATCH 14/17] Hopefully this is slightly more actionable advice --- content/learn/migration-guides/0.11-0.12/_index.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 5c120edb67..c3a9f537a9 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -1262,7 +1262,9 @@ Renamed skinning systems, resources and components:
Scenes
-Move scene spawner systems to a new SpawnScene schedule which is after Update and before PostUpdate (schedule order: [PreUpdate] [Update] [SpawnScene] [PostUpdate]), you might remove system ordering code related to scene spawning as the execution order has been guaranteed by bevy engine. +`scene_spawner_system` was moved to a new `SpawnScene` schedule which is run between `Update` and `PostUpdate`. + +If you were ordering your own systems to run before `scene_spawner_system` in `Update`, that might no longer be necessary. If your system needs to run after `scene_spawner_system`, it should be moved to the `SpawnScene` or `PostUpdate` schedule. ### [Remove Resource and add Debug to TaskPoolOptions](https://github.com/bevyengine/bevy/pull/9485) From 6053f6ef8846cd24ee8b88958110e1662dd14673 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:08:39 -0700 Subject: [PATCH 15/17] Fix missing tag --- content/learn/migration-guides/0.11-0.12/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index c3a9f537a9..387918f6d1 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -1435,7 +1435,7 @@ Because of this change, the timing of the first few frames might have changed, a ### [Work around naga/wgpu WGSL instance_index -> GLSL gl_InstanceID bug on WebGL2](https://github.com/bevyengine/bevy/pull/9383)
-
No area label
+
Rendering
Shader code before: From 0aff4873ca1e6f384eec083efd0009b0153a38f0 Mon Sep 17 00:00:00 2001 From: Rob Parrett Date: Fri, 27 Oct 2023 13:39:03 -0700 Subject: [PATCH 16/17] Also fix markdownlint lints --- content/learn/migration-guides/0.11-0.12/_index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 387918f6d1..5c063539e7 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -49,7 +49,7 @@ The GLTF asset loader will now factor in `emissiveStrength` when converting to B
Assets
-__Migrating a custom asset loader__ +#### Migrating a custom asset loader Existing asset loaders will need a few small changes to get them to work with Bevy Assets V2. @@ -117,7 +117,7 @@ app.register_asset_loader(MyAssetLoader) .init_asset::() ``` -__Labeled assets__ +#### Labeled assets If your loader allows labeled assets, there are a couple of different ways to handle them. The simplest is to call `load_context.labeled_asset_scope`: @@ -136,7 +136,7 @@ asset.children.drain().for_each(|(label, mut item)| { You can use the provided load context (`lc`) to load additional assets. These will automatically be registered as dependencies of the labeled asset. -__Using assets__ +#### Using assets The actual call to `load` hasn’t changed: @@ -148,7 +148,7 @@ let handle = server.load("path/to/my/asset.json"); let data = assets.get(&handle).unwrap(); ``` -__Asset events__ +#### Asset events There are a few changes to asset events. The event no longer contains a `handle` field, instead the event contains a field called `id`: From 1c311126102f7d3808291874df772c231721ce7b Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Thu, 2 Nov 2023 22:43:53 -0700 Subject: [PATCH 17/17] Consistent strong style --- content/learn/migration-guides/0.11-0.12/_index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/learn/migration-guides/0.11-0.12/_index.md b/content/learn/migration-guides/0.11-0.12/_index.md index 5c063539e7..0bb16780a1 100644 --- a/content/learn/migration-guides/0.11-0.12/_index.md +++ b/content/learn/migration-guides/0.11-0.12/_index.md @@ -331,7 +331,7 @@ my_query.par_iter().batching_strategy(my_batching_strategy).for_each(|x| {
ECS
-__`fetch` invariants__ +**`fetch` invariants** The function `WorldQuery::fetch` has had the following safety invariant added: @@ -341,7 +341,7 @@ The function `WorldQuery::fetch` has had the following safety invariant added: This invariant was always required for soundness, but was previously undocumented. If you called this function manually anywhere, you should check to make sure that this invariant is not violated. -__Removed `clone_fetch`__ +**Removed `clone_fetch`** The function `WorldQuery::clone_fetch` has been removed. The associated type `WorldQuery::Fetch` now has the bound `Clone`. @@ -444,7 +444,7 @@ The type `ManualEventIterator` has been renamed to `EventIterator`. Additonally,
ECS
-__1. New-Type `FnOnce`__ +**1. New-Type `FnOnce`** Create an `EntityCommand` type which implements the method you previously wrote: @@ -465,7 +465,7 @@ commands.add(ClassicEntityCommand(|id: Entity, world: &mut World| { })); ``` -__2. Extract `(Entity, &mut World)` from `EntityMut`__ +**2. Extract `(Entity, &mut World)` from `EntityMut`** The method `into_world_mut` can be used to gain access to the `World` from an `EntityMut`.