Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ unsafe_op_in_unsafe_fn = "warn"
unused_qualifications = "warn"

[workspace.dependencies]
bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "85eceb022da0326b47ac2b0d9202c9c9f01835bb", features = [
bevy = { git = "https://github.com/bevyengine/bevy.git", rev = "909b02e9de418fcf3b8960e98c3de423505eadd5", features = [
"wayland",
] }
bevy_derive = { git = "https://github.com/bevyengine/bevy.git", rev = "85eceb022da0326b47ac2b0d9202c9c9f01835bb" }
bevy_macro_utils = { git = "https://github.com/bevyengine/bevy.git", rev = "85eceb022da0326b47ac2b0d9202c9c9f01835bb" }
bevy_derive = { git = "https://github.com/bevyengine/bevy.git", rev = "909b02e9de418fcf3b8960e98c3de423505eadd5" }
bevy_macro_utils = { git = "https://github.com/bevyengine/bevy.git", rev = "909b02e9de418fcf3b8960e98c3de423505eadd5" }
thiserror = "1"
serde = { version = "1", features = ["derive"] }
tracing-test = "0.2.5"
Expand Down
2 changes: 1 addition & 1 deletion bevy_widgets/bevy_field_forms/examples/nickname.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This example demonstrates how to use the `ValidatedInputFieldPlugin` to create a validated input field for a character name.

use bevy::{prelude::*, utils::HashSet};
use bevy::{platform_support::collections::HashSet, prelude::*};
use bevy_field_forms::{
input_field::{InputField, InputFieldPlugin, Validable, ValidationChanged, ValidationState},
validate_highlight::SimpleBorderHighlight,
Expand Down
15 changes: 5 additions & 10 deletions bevy_widgets/bevy_i-cant-believe-its-not-bsn/src/hierarchy.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::marker::PhantomData;

use bevy::ecs::{
component::{ComponentHooks, ComponentId, Immutable, StorageType},
component::{ComponentHooks, HookContext, Immutable, StorageType},
prelude::*,
world::DeferredWorld,
};
Expand Down Expand Up @@ -51,14 +51,10 @@ impl<B: Bundle> Component for WithChild<B> {
/// A hook that runs whenever [`WithChild`] is added to an entity.
///
/// Generates a [`WithChildCommand`].
fn with_child_hook<B: Bundle>(
mut world: DeferredWorld<'_>,
entity: Entity,
_component_id: ComponentId,
) {
fn with_child_hook<B: Bundle>(mut world: DeferredWorld<'_>, context: HookContext) {
// Component hooks can't perform structural changes, so we need to rely on commands.
world.commands().queue(WithChildCommand {
parent_entity: entity,
parent_entity: context.entity,
_phantom: PhantomData::<B>,
});
}
Expand Down Expand Up @@ -160,12 +156,11 @@ impl<B: Bundle, I: IntoIterator<Item = B> + Send + Sync + 'static> Component
/// Generates a [`WithChildrenCommand`].
fn with_children_hook<B: Bundle, I: IntoIterator<Item = B> + Send + Sync + 'static>(
mut world: DeferredWorld<'_>,
entity: Entity,
_component_id: ComponentId,
context: HookContext,
) {
// Component hooks can't perform structural changes, so we need to rely on commands.
world.commands().queue(WithChildrenCommand {
parent_entity: entity,
parent_entity: context.entity,
_phantom: PhantomData::<(B, I)>,
});
}
Expand Down
6 changes: 3 additions & 3 deletions bevy_widgets/bevy_i-cant-believe-its-not-bsn/src/maybe.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::marker::PhantomData;

use bevy::ecs::{
component::{ComponentHooks, ComponentId, Immutable, StorageType},
component::{ComponentHooks, HookContext, Immutable, StorageType},
prelude::*,
world::DeferredWorld,
};
Expand Down Expand Up @@ -90,10 +90,10 @@ impl<B: Bundle> Default for Maybe<B> {
/// A hook that runs whenever [`Maybe`] is added to an entity.
///
/// Generates a [`MaybeCommand`].
fn maybe_hook<B: Bundle>(mut world: DeferredWorld<'_>, entity: Entity, _component_id: ComponentId) {
fn maybe_hook<B: Bundle>(mut world: DeferredWorld<'_>, context: HookContext) {
// Component hooks can't perform structural changes, so we need to rely on commands.
world.commands().queue(MaybeCommand {
entity,
entity: context.entity,
_phantom: PhantomData::<B>,
});
}
Expand Down
13 changes: 7 additions & 6 deletions bevy_widgets/bevy_i-cant-believe-its-not-bsn/src/template.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::{HashMap, HashSet};
use std::mem;

use bevy::ecs::component::HookContext;
use bevy::ecs::{
component::ComponentId, prelude::*, system::IntoObserverSystem, world::DeferredWorld,
};
Expand Down Expand Up @@ -258,23 +259,23 @@ impl From<Observer> for Callback {
}
}

fn insert_callback(mut world: DeferredWorld, entity_id: Entity, _component: ComponentId) {
let mut callback = world.get_mut::<Callback>(entity_id).unwrap();
fn insert_callback(mut world: DeferredWorld, context: HookContext) {
let mut callback = world.get_mut::<Callback>(context.entity).unwrap();
let Some(mut observer) = mem::take(&mut callback.observer) else {
return;
};
if let Some(parent_id) = world.get::<ChildOf>(entity_id).map(ChildOf::get) {
if let Some(parent_id) = world.get::<ChildOf>(context.entity).map(ChildOf::get) {
observer.watch_entity(parent_id);
}
let mut commands = world.commands();
let mut entity_commands = commands.entity(entity_id);
let mut entity_commands = commands.entity(context.entity);
entity_commands.remove::<Observer>();
entity_commands.insert(observer);
}

fn remove_callback(mut world: DeferredWorld, entity_id: Entity, _component: ComponentId) {
fn remove_callback(mut world: DeferredWorld, context: HookContext) {
let mut commands = world.commands();
commands.entity(entity_id).remove::<Observer>();
commands.entity(context.entity).remove::<Observer>();
}

// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion bevy_widgets/bevy_text_editing/src/editable_text_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
mod input;
mod render;

use bevy::{prelude::*, utils::HashSet};
use bevy::{platform_support::collections::HashSet, prelude::*};
use bevy_clipboard::ClipboardPlugin;
use bevy_focus::{FocusPlugin, Focusable, SetFocus};

Expand Down
13 changes: 8 additions & 5 deletions crates/bevy_bsn/src/construct_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,20 @@ impl Component for ConstructTextFont {
type Mutability = Immutable;

fn register_component_hooks(hooks: &mut ComponentHooks) {
hooks.on_insert(|mut world, entity, _component_id| {
let constructable = world.get::<ConstructTextFont>(entity).unwrap().clone();
world.commands().entity(entity).insert(TextFont {
hooks.on_insert(|mut world, context| {
let constructable = world
.get::<ConstructTextFont>(context.entity)
.unwrap()
.clone();
world.commands().entity(context.entity).insert(TextFont {
font: constructable.font.into(),
font_size: constructable.font_size,
font_smoothing: constructable.font_smoothing,
line_height: constructable.line_height,
});
});
hooks.on_remove(|mut world, entity, _component_id| {
if let Some(mut entity) = world.commands().get_entity(entity) {
hooks.on_remove(|mut world, context| {
if let Some(mut entity) = world.commands().get_entity(context.entity) {
entity.remove::<TextFont>();
}
});
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_editor_cam/src/extensions/dolly_zoom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ use std::time::Duration;
use bevy::app::prelude::*;
use bevy::ecs::prelude::*;
use bevy::math::prelude::*;
use bevy::platform_support::collections::HashMap;
use bevy::platform_support::time::Instant;
use bevy::reflect::prelude::*;
use bevy::render::{camera::ScalingMode, prelude::*};
use bevy::transform::prelude::*;
use bevy::utils::HashMap;
use bevy::window::RequestRedraw;

use crate::prelude::{motion::CurrentMotion, EditorCam, EnabledMotion};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_editor_cam/src/extensions/look_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use std::{f32::consts::PI, time::Duration};
use bevy::app::prelude::*;
use bevy::ecs::prelude::*;
use bevy::math::{prelude::*, DQuat, DVec3};
use bevy::platform_support::collections::HashMap;
use bevy::platform_support::time::Instant;
use bevy::reflect::prelude::*;
use bevy::transform::prelude::*;
use bevy::utils::HashMap;
use bevy::window::RequestRedraw;

use crate::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_editor_cam/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use bevy::input::{
prelude::*,
};
use bevy::math::{prelude::*, DVec2, DVec3};
use bevy::platform_support::collections::HashMap;
use bevy::reflect::prelude::*;
use bevy::render::{camera::CameraProjection, prelude::*};
use bevy::transform::prelude::*;
use bevy::utils::hashbrown::HashMap;
use bevy::window::PrimaryWindow;
use bevy::{app::prelude::*, picking::pointer::PointerInput};
use bevy::{ecs::prelude::*, picking::pointer::PointerAction};
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pane_layout/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use bevy::{
ecs::system::{BoxedSystem, SystemId},
platform_support::collections::HashMap,
prelude::*,
utils::HashMap,
};

use crate::{PaneLayoutSet, PaneRootNode};
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_undo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//! use bevy::prelude::*;
//! use bevy_undo::*;
//! use std::sync::Arc;
//! use bevy::utils::hashbrown::HashMap;
//! use bevy::platform_support::collections::HashMap;
//!
//! fn main() {
//! App::new()
Expand Down Expand Up @@ -134,7 +134,7 @@
#![allow(clippy::type_complexity)]
use std::sync::Arc;

use bevy::{prelude::*, utils::hashbrown::HashMap};
use bevy::{platform_support::collections::HashMap, prelude::*};

const MAX_REFLECT_RECURSION: i32 = 10;
const AUTO_UNDO_LATENCY: i32 = 2;
Expand Down Expand Up @@ -1094,7 +1094,7 @@ pub struct AutoUndoStorage<T: Component> {
impl<T: Component> Default for AutoUndoStorage<T> {
fn default() -> Self {
Self {
storage: HashMap::new(),
storage: HashMap::default(),
}
}
}
Expand Down