From 9d0871898fbdb0adc3e29ec9c73020c0eb177b23 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Wed, 1 Nov 2023 18:01:59 -0700 Subject: [PATCH] 0.12: UI Outlines, unified configure_sets, Disjoint EntityMut --- content/news/2023-10-21-bevy-0.12/index.md | 74 ++++++++++++++++++ .../news/2023-10-21-bevy-0.12/ui_outlines.png | Bin 0 -> 7528 bytes 2 files changed, 74 insertions(+) create mode 100644 content/news/2023-10-21-bevy-0.12/ui_outlines.png diff --git a/content/news/2023-10-21-bevy-0.12/index.md b/content/news/2023-10-21-bevy-0.12/index.md index e23420885d..f5bf53eb67 100644 --- a/content/news/2023-10-21-bevy-0.12/index.md +++ b/content/news/2023-10-21-bevy-0.12/index.md @@ -15,6 +15,80 @@ Since our last release a few months ago we've added a _ton_ of new features, bug +## UI Node Outlines + +
authors: @ickshonpe
+ +Bevy's UI nodes now support outlines "outside the borders" of UI nodes via the new [`Outline`] component. [`Outline`] does not occupy any space in the layout. This is different than [`Style::border`], which exists "as part of" the node in the layout: + +![ui outlines](ui_outlines.png) + +```rust +commands.spawn(( + NodeBundle::default(), + Outline { + width: Val::Px(6.), + offset: Val::Px(6.), + color: Color::WHITE, + }, +)) +``` + +[`Outline`]: https://dev-docs.bevyengine.org/bevy/ui/struct.Outline.html +[`Style::border`]: https://dev-docs.bevyengine.org/bevy/ui/struct.Style.html + +## Disjoint Mutable World Access Via EntityMut + +
authors: @JoJoJet
+ +**Bevy 0.12** supports safely accessing multiple [`EntityMut`] values at once, meaning you can mutate multiple entities (with access to _all of their components_) at the same time. + +```rust +let [entity1, entity2] = world.many_entities_mut([id1, id2]); +*entity1.get_mut::().unwrap() = *entity2.get::().unwrap(); +``` + +This also works in queries: + +```rust +// This would not have been expressible in previous Bevy versions +// Now it is totally valid! +fn system(q1: Query<&mut A>, q2: Query>) { +} +``` + +You can now mutably iterate all entities and access arbitrary components within them: + +```rust +for mut entity in world.iter_entities_mut() { + let mut transform = entity.get_mut::().unwrap(); + transform.translation.x += 2.0; +} +``` + +This required reducing the access scope of [`EntityMut`] to _only_ the entity it accesses (previously it had escape hatches that allowed direct [`World`] access). + +[`EntityMut`]: https://dev-docs.bevyengine.org/bevy/ecs/world/struct.EntityMut.html +[`World`]: https://dev-docs.bevyengine.org/bevy/ecs/world/struct.World.html + +## Unified configure_sets API + +
authors: @geieredgar
+ +Bevy's [Schedule-First API](/news/bevy-0-11/#schedule-first-ecs-apis) introduced in **Bevy 0.11** unified most of the ECS scheduler API surface under a single `add_systems` API. However, we didn't do a unified API for `configure_sets`, meaning there were two different APIs: + +```rust +app.configure_set(Update, A.after(B)); +app.configure_sets(Update, (A.after(B), B.after(C)); +``` + +In **Bevy 0.12**, we have unified these under a single API to align with the patterns we've used elsewhere and cut down on unnecessary API surface: + +```rust +app.configure_sets(Update, A.after(B)); +app.configure_sets(Update, (A.after(B), B.after(C)); +``` + ## Rusty Shader Imports
authors: @robtfm
diff --git a/content/news/2023-10-21-bevy-0.12/ui_outlines.png b/content/news/2023-10-21-bevy-0.12/ui_outlines.png new file mode 100644 index 0000000000000000000000000000000000000000..7f7f62356e724daf4cdd5fe8f7b0bc558080cbf9 GIT binary patch literal 7528 zcmeHMdsI{R9lwES5Cx=46~RQyx--k1IyTWJ5v{i9Y{hOqj)=URMu(J8XC9DOeSmA# zbRLzeP1rf?l%69y{3G{w zbARV|@BMurpYP}My?@%gDLE{3UMK`XVH?)3`z-`b0jEKK519%EC0DZz4AbcAcN~PE z@GHm0#+puoU7FPO*=1y+xh70d~xPJ{{-oyHL!fL0#dn+V$+prLS9e=wc zd+F+m>x;v0$lk~k!E=SASqr~;qs{en#LVY$ap2a_X%CHxjL_To)yNPs3qr0hcpt)p zL9i4z6S>;{e={j5w(1gGRz1lOiM*J))ttn;oJ>;02#~)se+mVGVf7bK2=X^8XaO=D zohCqr7bhbOZHvED>aEAMEDk44ICw?TTMf@3DsWIoMQHmq`hmY}f7sXr-C)UmG1xEv&5cY z)+N0)^ZMNaNUg3k1?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