Skip to content

Commit ebbfdca

Browse files
committed
Merge branch 'main' into wireframe-material-no-color
2 parents 4983a41 + a962240 commit ebbfdca

File tree

106 files changed

+1554
-664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1554
-664
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[![MIT/Apache 2.0](https://img.shields.io/badge/license-MIT%2FApache-blue.svg)](https://github.com/bevyengine/bevy#license)
55
[![Crates.io](https://img.shields.io/crates/d/bevy.svg)](https://crates.io/crates/bevy)
66
[![Rust](https://github.com/bevyengine/bevy/workflows/CI/badge.svg)](https://github.com/bevyengine/bevy/actions)
7-
![iOS cron CI](https://github.com/bevyengine/bevy/workflows/iOS%20cron%20CI/badge.svg)
87
[![Discord](https://img.shields.io/discord/691052431525675048.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/bevy)
98

109
## What is Bevy?

benches/benches/bevy_ecs/iteration/iter_frag.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl<'w> Benchmark<'w> {
2727
Self(world, query)
2828
}
2929

30+
#[inline(never)]
3031
pub fn run(&mut self) {
3132
for mut data in self.1.iter_mut(&mut self.0) {
3233
data.0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_foreach.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ impl<'w> Benchmark<'w> {
2727
Self(world, query)
2828
}
2929

30+
#[inline(never)]
3031
pub fn run(&mut self) {
3132
self.1.for_each_mut(&mut self.0, |mut data| {
3233
data.0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_foreach_sparse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'w> Benchmark<'w> {
3838
Self(world, query)
3939
}
4040

41+
#[inline(never)]
4142
pub fn run(&mut self) {
4243
self.1.for_each_mut(&mut self.0, |mut data| {
4344
data.0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_foreach_wide.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl<'w> Benchmark<'w> {
5555
Self(world, query)
5656
}
5757

58+
#[inline(never)]
5859
pub fn run(&mut self) {
5960
self.1.for_each_mut(&mut self.0, |mut data| {
6061
data.0 .0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_foreach_wide_sparse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ impl<'w> Benchmark<'w> {
6565
Self(world, query)
6666
}
6767

68+
#[inline(never)]
6869
pub fn run(&mut self) {
6970
self.1.for_each_mut(&mut self.0, |mut data| {
7071
data.0 .0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_sparse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<'w> Benchmark<'w> {
3838
Self(world, query)
3939
}
4040

41+
#[inline(never)]
4142
pub fn run(&mut self) {
4243
for mut data in self.1.iter_mut(&mut self.0) {
4344
data.0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_wide.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl<'w> Benchmark<'w> {
5555
Self(world, query)
5656
}
5757

58+
#[inline(never)]
5859
pub fn run(&mut self) {
5960
for mut data in self.1.iter_mut(&mut self.0) {
6061
data.0 .0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_frag_wide_sparse.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ impl<'w> Benchmark<'w> {
6565
Self(world, query)
6666
}
6767

68+
#[inline(never)]
6869
pub fn run(&mut self) {
6970
for mut data in self.1.iter_mut(&mut self.0) {
7071
data.0 .0 *= 2.0;

benches/benches/bevy_ecs/iteration/iter_simple.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ impl<'w> Benchmark<'w> {
3333
Self(world, query)
3434
}
3535

36+
#[inline(never)]
3637
pub fn run(&mut self) {
3738
for (velocity, mut position) in self.1.iter_mut(&mut self.0) {
3839
position.0 += velocity.0;

benches/benches/bevy_ecs/iteration/iter_simple_foreach.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ impl<'w> Benchmark<'w> {
3333
Self(world, query)
3434
}
3535

36+
#[inline(never)]
3637
pub fn run(&mut self) {
3738
self.1
3839
.for_each_mut(&mut self.0, |(velocity, mut position)| {

benches/benches/bevy_ecs/iteration/iter_simple_foreach_sparse_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl<'w> Benchmark<'w> {
3535
Self(world, query)
3636
}
3737

38+
#[inline(never)]
3839
pub fn run(&mut self) {
3940
self.1
4041
.for_each_mut(&mut self.0, |(velocity, mut position)| {

benches/benches/bevy_ecs/iteration/iter_simple_foreach_wide.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl<'w> Benchmark<'w> {
5555
Self(world, query)
5656
}
5757

58+
#[inline(never)]
5859
pub fn run(&mut self) {
5960
self.1.for_each_mut(&mut self.0, |mut item| {
6061
item.1 .0 += item.0 .0;

benches/benches/bevy_ecs/iteration/iter_simple_foreach_wide_sparse_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ impl<'w> Benchmark<'w> {
5757
Self(world, query)
5858
}
5959

60+
#[inline(never)]
6061
pub fn run(&mut self) {
6162
self.1.for_each_mut(&mut self.0, |mut item| {
6263
item.1 .0 += item.0 .0;

benches/benches/bevy_ecs/iteration/iter_simple_sparse_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl<'w> Benchmark<'w> {
3535
Self(world, query)
3636
}
3737

38+
#[inline(never)]
3839
pub fn run(&mut self) {
3940
for (velocity, mut position) in self.1.iter_mut(&mut self.0) {
4041
position.0 += velocity.0;

benches/benches/bevy_ecs/iteration/iter_simple_system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ impl Benchmark {
4141
Self(world, Box::new(system))
4242
}
4343

44+
#[inline(never)]
4445
pub fn run(&mut self) {
4546
self.1.run((), &mut self.0);
4647
}

benches/benches/bevy_ecs/iteration/iter_simple_wide.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ impl<'w> Benchmark<'w> {
5555
Self(world, query)
5656
}
5757

58+
#[inline(never)]
5859
pub fn run(&mut self) {
5960
for mut item in self.1.iter_mut(&mut self.0) {
6061
item.1 .0 += item.0 .0;

benches/benches/bevy_ecs/iteration/iter_simple_wide_sparse_set.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ impl<'w> Benchmark<'w> {
5757
Self(world, query)
5858
}
5959

60+
#[inline(never)]
6061
pub fn run(&mut self) {
6162
for mut item in self.1.iter_mut(&mut self.0) {
6263
item.1 .0 += item.0 .0;

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
doc-valid-idents = ["sRGB", "NaN", "iOS", "glTF", "GitHub", "WebGPU"]
1+
doc-valid-idents = ["sRGB", "NaN", "iOS", "glTF", "GitHub", "WebGPU", "GilRs"]

crates/bevy_a11y/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ bevy_app = { path = "../bevy_app", version = "0.12.0-dev" }
1414
bevy_derive = { path = "../bevy_derive", version = "0.12.0-dev" }
1515
bevy_ecs = { path = "../bevy_ecs", version = "0.12.0-dev" }
1616

17-
accesskit = "0.11"
17+
accesskit = "0.12"

crates/bevy_a11y/src/lib.rs

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
#![allow(clippy::type_complexity)]
55
#![forbid(unsafe_code)]
66

7-
use std::{
8-
num::NonZeroU128,
9-
sync::{atomic::AtomicBool, Arc},
7+
use std::sync::{
8+
atomic::{AtomicBool, Ordering},
9+
Arc,
1010
};
1111

1212
pub use accesskit;
13-
use accesskit::{NodeBuilder, NodeId};
13+
use accesskit::NodeBuilder;
1414
use bevy_app::Plugin;
1515
use bevy_derive::{Deref, DerefMut};
1616
use bevy_ecs::{
1717
prelude::{Component, Entity, Event},
18+
schedule::SystemSet,
1819
system::Resource,
1920
};
2021

@@ -30,6 +31,46 @@ pub struct ActionRequest(pub accesskit::ActionRequest);
3031
#[derive(Resource, Default, Clone, Debug, Deref, DerefMut)]
3132
pub struct AccessibilityRequested(Arc<AtomicBool>);
3233

34+
impl AccessibilityRequested {
35+
/// Returns `true` if an access technology is active and accessibility tree
36+
/// updates should be sent.
37+
pub fn get(&self) -> bool {
38+
self.load(Ordering::SeqCst)
39+
}
40+
41+
/// Sets whether accessibility updates were requested by an access technology.
42+
pub fn set(&self, value: bool) {
43+
self.store(value, Ordering::SeqCst);
44+
}
45+
}
46+
47+
/// Resource whose value determines whether the accessibility tree is updated
48+
/// via the ECS.
49+
///
50+
/// Set to `false` in cases where an external GUI library is sending
51+
/// accessibility updates instead. Without this, the external library and ECS
52+
/// will generate conflicting updates.
53+
#[derive(Resource, Clone, Debug, Deref, DerefMut)]
54+
pub struct ManageAccessibilityUpdates(bool);
55+
56+
impl Default for ManageAccessibilityUpdates {
57+
fn default() -> Self {
58+
Self(true)
59+
}
60+
}
61+
62+
impl ManageAccessibilityUpdates {
63+
/// Returns `true` if the ECS should update the accessibility tree.
64+
pub fn get(&self) -> bool {
65+
self.0
66+
}
67+
68+
/// Sets whether the ECS should update the accessibility tree.
69+
pub fn set(&mut self, value: bool) {
70+
self.0 = value;
71+
}
72+
}
73+
3374
/// Component to wrap a [`accesskit::Node`], representing this entity to the platform's
3475
/// accessibility API.
3576
///
@@ -47,29 +88,24 @@ impl From<NodeBuilder> for AccessibilityNode {
4788
}
4889
}
4990

50-
/// Extensions to ease integrating entities with [`AccessKit`](https://accesskit.dev).
51-
pub trait AccessKitEntityExt {
52-
/// Convert an entity to a stable [`NodeId`].
53-
fn to_node_id(&self) -> NodeId;
54-
}
55-
56-
impl AccessKitEntityExt for Entity {
57-
fn to_node_id(&self) -> NodeId {
58-
let id = NonZeroU128::new(self.to_bits() as u128 + 1);
59-
NodeId(id.unwrap())
60-
}
61-
}
62-
6391
/// Resource representing which entity has keyboard focus, if any.
6492
#[derive(Resource, Default, Deref, DerefMut)]
65-
pub struct Focus(Option<Entity>);
93+
pub struct Focus(pub Option<Entity>);
94+
95+
/// Set enum for the systems relating to accessibility
96+
#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
97+
pub enum AccessibilitySystem {
98+
/// Update the accessibility tree
99+
Update,
100+
}
66101

67102
/// Plugin managing non-GUI aspects of integrating with accessibility APIs.
68103
pub struct AccessibilityPlugin;
69104

70105
impl Plugin for AccessibilityPlugin {
71106
fn build(&self, app: &mut bevy_app::App) {
72107
app.init_resource::<AccessibilityRequested>()
108+
.init_resource::<ManageAccessibilityUpdates>()
73109
.init_resource::<Focus>();
74110
}
75111
}

crates/bevy_animation/src/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,16 +453,16 @@ fn entity_from_path(
453453
/// Verify that there are no ancestors of a given entity that have an [`AnimationPlayer`].
454454
fn verify_no_ancestor_player(
455455
player_parent: Option<&Parent>,
456-
parents: &Query<(Option<With<AnimationPlayer>>, Option<&Parent>)>,
456+
parents: &Query<(Has<AnimationPlayer>, Option<&Parent>)>,
457457
) -> bool {
458458
let Some(mut current) = player_parent.map(Parent::get) else {
459459
return true;
460460
};
461461
loop {
462-
let Ok((maybe_player, parent)) = parents.get(current) else {
462+
let Ok((has_player, parent)) = parents.get(current) else {
463463
return true;
464464
};
465-
if maybe_player.is_some() {
465+
if has_player {
466466
return false;
467467
}
468468
if let Some(parent) = parent {
@@ -483,7 +483,7 @@ pub fn animation_player(
483483
names: Query<&Name>,
484484
transforms: Query<&mut Transform>,
485485
morphs: Query<&mut MorphWeights>,
486-
parents: Query<(Option<With<AnimationPlayer>>, Option<&Parent>)>,
486+
parents: Query<(Has<AnimationPlayer>, Option<&Parent>)>,
487487
mut animation_players: Query<(Entity, Option<&Parent>, &mut AnimationPlayer)>,
488488
) {
489489
animation_players
@@ -515,7 +515,7 @@ fn run_animation_player(
515515
transforms: &Query<&mut Transform>,
516516
morphs: &Query<&mut MorphWeights>,
517517
maybe_parent: Option<&Parent>,
518-
parents: &Query<(Option<With<AnimationPlayer>>, Option<&Parent>)>,
518+
parents: &Query<(Has<AnimationPlayer>, Option<&Parent>)>,
519519
children: &Query<&Children>,
520520
) {
521521
let paused = player.paused;
@@ -601,7 +601,7 @@ fn apply_animation(
601601
transforms: &Query<&mut Transform>,
602602
morphs: &Query<&mut MorphWeights>,
603603
maybe_parent: Option<&Parent>,
604-
parents: &Query<(Option<With<AnimationPlayer>>, Option<&Parent>)>,
604+
parents: &Query<(Has<AnimationPlayer>, Option<&Parent>)>,
605605
children: &Query<&Children>,
606606
) {
607607
if let Some(animation_clip) = animations.get(&animation.animation_clip) {

crates/bevy_app/src/app.rs

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,83 @@ impl App {
859859
.configure_schedules(schedule_build_settings);
860860
self
861861
}
862+
863+
/// When doing [ambiguity checking](bevy_ecs::schedule::ScheduleBuildSettings) this
864+
/// ignores systems that are ambiguious on [`Component`] T.
865+
///
866+
/// This settings only applies to the main world. To apply this to other worlds call the
867+
/// [corresponding method](World::allow_ambiguous_component) on World
868+
///
869+
/// ## Example
870+
///
871+
/// ```rust
872+
/// # use bevy_app::prelude::*;
873+
/// # use bevy_ecs::prelude::*;
874+
/// # use bevy_ecs::schedule::{LogLevel, ScheduleBuildSettings};
875+
/// # use bevy_utils::default;
876+
///
877+
/// #[derive(Component)]
878+
/// struct A;
879+
///
880+
/// // these systems are ambiguous on A
881+
/// fn system_1(_: Query<&mut A>) {}
882+
/// fn system_2(_: Query<&A>) {}
883+
///
884+
/// let mut app = App::new();
885+
/// app.configure_schedules(ScheduleBuildSettings {
886+
/// ambiguity_detection: LogLevel::Error,
887+
/// ..default()
888+
/// });
889+
///
890+
/// app.add_systems(Update, ( system_1, system_2 ));
891+
/// app.allow_ambiguous_component::<A>();
892+
///
893+
/// // running the app does not error.
894+
/// app.update();
895+
/// ```
896+
pub fn allow_ambiguous_component<T: Component>(&mut self) -> &mut Self {
897+
self.world.allow_ambiguous_component::<T>();
898+
self
899+
}
900+
901+
/// When doing [ambiguity checking](bevy_ecs::schedule::ScheduleBuildSettings) this
902+
/// ignores systems that are ambiguious on [`Resource`] T.
903+
///
904+
/// This settings only applies to the main world. To apply this to other worlds call the
905+
/// [corresponding method](World::allow_ambiguous_resource) on World
906+
///
907+
/// ## Example
908+
///
909+
/// ```rust
910+
/// # use bevy_app::prelude::*;
911+
/// # use bevy_ecs::prelude::*;
912+
/// # use bevy_ecs::schedule::{LogLevel, ScheduleBuildSettings};
913+
/// # use bevy_utils::default;
914+
///
915+
/// #[derive(Resource)]
916+
/// struct R;
917+
///
918+
/// // these systems are ambiguous on R
919+
/// fn system_1(_: ResMut<R>) {}
920+
/// fn system_2(_: Res<R>) {}
921+
///
922+
/// let mut app = App::new();
923+
/// app.configure_schedules(ScheduleBuildSettings {
924+
/// ambiguity_detection: LogLevel::Error,
925+
/// ..default()
926+
/// });
927+
/// app.insert_resource(R);
928+
///
929+
/// app.add_systems(Update, ( system_1, system_2 ));
930+
/// app.allow_ambiguous_resource::<R>();
931+
///
932+
/// // running the app does not error.
933+
/// app.update();
934+
/// ```
935+
pub fn allow_ambiguous_resource<T: Resource>(&mut self) -> &mut Self {
936+
self.world.allow_ambiguous_resource::<T>();
937+
self
938+
}
862939
}
863940

864941
fn run_once(mut app: App) {

0 commit comments

Comments
 (0)