From 14756e100ced915e3d95093181c742ee44b41988 Mon Sep 17 00:00:00 2001 From: atlv Date: Tue, 7 Oct 2025 15:06:20 -0400 Subject: [PATCH] Rename bevy_ui_picking_backend to ui_picking (#21435) # Objective - Only prefix features bevy_ if they correspond to a crate - Another step towards #20867 ## Solution - rename it ## Testing - ci --- Cargo.toml | 4 ++-- crates/bevy_feathers/Cargo.toml | 2 +- crates/bevy_internal/Cargo.toml | 2 +- crates/bevy_ui/Cargo.toml | 2 +- crates/bevy_ui/src/lib.rs | 8 +++---- crates/bevy_ui/src/widget/viewport.rs | 23 ++++++++----------- docs/cargo_features.md | 2 +- .../migration-guides/feature-cleanup.md | 3 ++- 8 files changed, 21 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 31abee680e..865fb1a352 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -158,7 +158,6 @@ default = [ "bevy_state", "bevy_text", "bevy_ui", - "bevy_ui_picking_backend", "bevy_ui_render", "bevy_window", "bevy_winit", @@ -175,6 +174,7 @@ default = [ "sprite_picking", "sysinfo_plugin", "tonemapping_luts", + "ui_picking", "vorbis", "webgl2", "x11", @@ -193,7 +193,7 @@ bevy_mesh_picking_backend = ["bevy_internal/bevy_mesh_picking_backend"] sprite_picking = ["bevy_internal/sprite_picking"] # Provides an implementation for picking UI -bevy_ui_picking_backend = ["bevy_internal/bevy_ui_picking_backend"] +ui_picking = ["bevy_internal/ui_picking"] # Provides a debug overlay for bevy UI bevy_ui_debug = ["bevy_internal/bevy_ui_debug"] diff --git a/crates/bevy_feathers/Cargo.toml b/crates/bevy_feathers/Cargo.toml index 2b59df1fe2..ef76d4c8aa 100644 --- a/crates/bevy_feathers/Cargo.toml +++ b/crates/bevy_feathers/Cargo.toml @@ -27,7 +27,7 @@ bevy_reflect = { path = "../bevy_reflect", version = "0.18.0-dev" } bevy_render = { path = "../bevy_render", version = "0.18.0-dev" } bevy_text = { path = "../bevy_text", version = "0.18.0-dev" } bevy_ui = { path = "../bevy_ui", version = "0.18.0-dev", features = [ - "bevy_ui_picking_backend", + "bevy_picking", ] } bevy_ui_render = { path = "../bevy_ui_render", version = "0.18.0-dev" } bevy_window = { path = "../bevy_window", version = "0.18.0-dev" } diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 06fec5d262..8028f62b4f 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -323,7 +323,7 @@ bevy_mesh_picking_backend = [ sprite_picking = ["bevy_picking", "bevy_sprite/bevy_picking"] # Provides a UI picking backend -bevy_ui_picking_backend = ["bevy_picking", "bevy_ui/bevy_ui_picking_backend"] +ui_picking = ["bevy_picking", "bevy_ui/bevy_picking"] # Provides a UI debug overlay bevy_ui_debug = ["bevy_ui_render?/bevy_ui_debug"] diff --git a/crates/bevy_ui/Cargo.toml b/crates/bevy_ui/Cargo.toml index d2dc1f187e..2f1f6a8eaf 100644 --- a/crates/bevy_ui/Cargo.toml +++ b/crates/bevy_ui/Cargo.toml @@ -54,7 +54,7 @@ serialize = [ "bevy_math/serialize", "bevy_platform/serialize", ] -bevy_ui_picking_backend = ["bevy_picking", "dep:uuid"] +bevy_picking = ["dep:bevy_picking", "dep:uuid"] # Experimental features ghost_nodes = [] diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index fb04343132..fdb9c7a117 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -16,12 +16,12 @@ pub mod update; pub mod widget; pub mod gradients; -#[cfg(feature = "bevy_ui_picking_backend")] +#[cfg(feature = "bevy_picking")] pub mod picking_backend; pub mod ui_transform; use bevy_derive::{Deref, DerefMut}; -#[cfg(feature = "bevy_ui_picking_backend")] +#[cfg(feature = "bevy_picking")] use bevy_picking::PickingSystems; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; mod accessibility; @@ -48,7 +48,7 @@ pub use ui_transform::*; /// This includes the most common types in this crate, re-exported for your convenience. pub mod prelude { #[doc(hidden)] - #[cfg(feature = "bevy_ui_picking_backend")] + #[cfg(feature = "bevy_picking")] pub use crate::picking_backend::{UiPickingCamera, UiPickingPlugin, UiPickingSettings}; #[doc(hidden)] pub use crate::widget::{Text, TextShadow, TextUiReader, TextUiWriter}; @@ -171,7 +171,7 @@ impl Plugin for UiPlugin { ui_focus_system.in_set(UiSystems::Focus).after(InputSystems), ); - #[cfg(feature = "bevy_ui_picking_backend")] + #[cfg(feature = "bevy_picking")] app.add_plugins(picking_backend::UiPickingPlugin) .add_systems( First, diff --git a/crates/bevy_ui/src/widget/viewport.rs b/crates/bevy_ui/src/widget/viewport.rs index 08b34ea5cb..5f4efb3f4f 100644 --- a/crates/bevy_ui/src/widget/viewport.rs +++ b/crates/bevy_ui/src/widget/viewport.rs @@ -1,7 +1,5 @@ use bevy_asset::Assets; use bevy_camera::Camera; -#[cfg(feature = "bevy_ui_picking_backend")] -use bevy_camera::NormalizedRenderTarget; use bevy_ecs::{ component::Component, entity::Entity, @@ -9,28 +7,22 @@ use bevy_ecs::{ reflect::ReflectComponent, system::{Query, ResMut}, }; -#[cfg(feature = "bevy_ui_picking_backend")] +#[cfg(feature = "bevy_picking")] use bevy_ecs::{ message::MessageReader, system::{Commands, Res}, }; use bevy_image::{Image, ToExtents}; -#[cfg(feature = "bevy_ui_picking_backend")] -use bevy_math::Rect; use bevy_math::UVec2; -#[cfg(feature = "bevy_ui_picking_backend")] +#[cfg(feature = "bevy_picking")] use bevy_picking::{ events::PointerState, hover::HoverMap, pointer::{Location, PointerId, PointerInput, PointerLocation}, }; -#[cfg(feature = "bevy_ui_picking_backend")] -use bevy_platform::collections::HashMap; use bevy_reflect::Reflect; -#[cfg(feature = "bevy_ui_picking_backend")] -use uuid::Uuid; -#[cfg(feature = "bevy_ui_picking_backend")] +#[cfg(feature = "bevy_picking")] use crate::UiGlobalTransform; use crate::{ComputedNode, Node}; @@ -43,8 +35,8 @@ use crate::{ComputedNode, Node}; #[reflect(Component, Debug)] #[require(Node)] #[cfg_attr( - feature = "bevy_ui_picking_backend", - require(PointerId::Custom(Uuid::new_v4())) + feature = "bevy_picking", + require(PointerId::Custom(uuid::Uuid::new_v4())) )] pub struct ViewportNode { /// The entity representing the [`Camera`] associated with this viewport. @@ -61,7 +53,7 @@ impl ViewportNode { } } -#[cfg(feature = "bevy_ui_picking_backend")] +#[cfg(feature = "bevy_picking")] /// Handles viewport picking logic. /// /// Viewport entities that are being hovered or dragged will have all pointer inputs sent to them. @@ -80,6 +72,9 @@ pub fn viewport_picking( pointer_state: Res, mut pointer_inputs: MessageReader, ) { + use bevy_camera::NormalizedRenderTarget; + use bevy_math::Rect; + use bevy_platform::collections::HashMap; // Handle hovered entities. let mut viewport_picks: HashMap = hover_map .iter() diff --git a/docs/cargo_features.md b/docs/cargo_features.md index 55a6d3e8d1..e3bda7850b 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -42,7 +42,6 @@ The default feature set enables most of the expected features of a game engine, |bevy_state|Enable built in global state machines| |bevy_text|Provides text functionality| |bevy_ui|A custom ECS-driven UI framework| -|bevy_ui_picking_backend|Provides an implementation for picking UI| |bevy_ui_render|Provides rendering functionality for bevy_ui| |bevy_window|Windowing layer| |bevy_winit|winit window and input backend| @@ -62,6 +61,7 @@ The default feature set enables most of the expected features of a game engine, |std|Allows access to the `std` crate.| |sysinfo_plugin|Enables system information diagnostic plugin| |tonemapping_luts|Include tonemapping Look Up Tables KTX2 files. If everything is pink, you need to enable this feature or change the `Tonemapping` method for your `Camera2d` or `Camera3d`.| +|ui_picking|Provides an implementation for picking UI| |vorbis|OGG/VORBIS audio format support| |wayland|Wayland display server support| |webgl2|Enable some limitations to be able to use WebGL2. Please refer to the [WebGL2 and WebGPU](https://github.com/bevyengine/bevy/tree/latest/examples#webgl2-and-webgpu) section of the examples README for more information on how to run Wasm builds with WebGPU.| diff --git a/release-content/migration-guides/feature-cleanup.md b/release-content/migration-guides/feature-cleanup.md index dd75b4b4e9..04186de905 100644 --- a/release-content/migration-guides/feature-cleanup.md +++ b/release-content/migration-guides/feature-cleanup.md @@ -1,7 +1,8 @@ --- title: Feature cleanup -pull_requests: [21388, 21437] +pull_requests: [21388, 21435, 21437] --- `animation` has been renamed to `gltf_animation`. `bevy_sprite_picking_backend` has been renamed to `sprite_picking`. +`bevy_ui_picking_backend` has been renamed to `ui_picking`.