From dd49dc71d216fac476d87ed5416c48db7c8fcd77 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Tue, 3 Dec 2024 19:43:26 +0000 Subject: [PATCH] Rename `UiBoxShadowSamples` to `BoxShadowSamples`. (#16505) # Objective The `UiBoxShadowSamples` resource should be renamed to `BoxShadowSamples` so it matches the `BoxShadow` component. ## Migration Guide `UiBoxShadowSamples` has been renamed to `BoxShadowSamples` --- crates/bevy_ui/src/lib.rs | 2 +- crates/bevy_ui/src/render/box_shadow.rs | 6 +++--- crates/bevy_ui/src/render/mod.rs | 8 ++++---- crates/bevy_ui/src/ui_node.rs | 6 +++--- examples/testbed/ui.rs | 2 +- examples/ui/box_shadow.rs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index eb2ede9fb0..20e7c55b77 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -170,7 +170,7 @@ impl Plugin for UiPlugin { .register_type::() .register_type::() .register_type::() - .register_type::() + .register_type::() .register_type::() .configure_sets( PostUpdate, diff --git a/crates/bevy_ui/src/render/box_shadow.rs b/crates/bevy_ui/src/render/box_shadow.rs index e850db3b4a..d0f8cafdc6 100644 --- a/crates/bevy_ui/src/render/box_shadow.rs +++ b/crates/bevy_ui/src/render/box_shadow.rs @@ -3,8 +3,8 @@ use core::{hash::Hash, ops::Range}; use crate::{ - BoxShadow, CalculatedClip, ComputedNode, DefaultUiCamera, RenderUiSystem, ResolvedBorderRadius, - TargetCamera, TransparentUi, UiBoxShadowSamples, Val, + BoxShadow, BoxShadowSamples, CalculatedClip, ComputedNode, DefaultUiCamera, RenderUiSystem, + ResolvedBorderRadius, TargetCamera, TransparentUi, Val, }; use bevy_app::prelude::*; use bevy_asset::*; @@ -344,7 +344,7 @@ pub fn queue_shadows( box_shadow_pipeline: Res, mut pipelines: ResMut>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView, Option<&UiBoxShadowSamples>)>, + mut views: Query<(Entity, &ExtractedView, Option<&BoxShadowSamples>)>, pipeline_cache: Res, draw_functions: Res>, ) { diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index 8badc68771..22d12e2179 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -6,8 +6,8 @@ pub mod ui_texture_slice_pipeline; use crate::widget::ImageNode; use crate::{ - experimental::UiChildren, BackgroundColor, BorderColor, CalculatedClip, ComputedNode, - DefaultUiCamera, Outline, ResolvedBorderRadius, TargetCamera, UiAntiAlias, UiBoxShadowSamples, + experimental::UiChildren, BackgroundColor, BorderColor, BoxShadowSamples, CalculatedClip, + ComputedNode, DefaultUiCamera, Outline, ResolvedBorderRadius, TargetCamera, UiAntiAlias, }; use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, AssetEvent, AssetId, Assets, Handle}; @@ -537,7 +537,7 @@ pub fn extract_default_ui_camera_view( RenderEntity, &Camera, Option<&UiAntiAlias>, - Option<&UiBoxShadowSamples>, + Option<&BoxShadowSamples>, ), Or<(With, With)>, >, @@ -552,7 +552,7 @@ pub fn extract_default_ui_camera_view( commands .get_entity(entity) .expect("Camera entity wasn't synced.") - .remove::<(DefaultCameraView, UiAntiAlias, UiBoxShadowSamples)>(); + .remove::<(DefaultCameraView, UiAntiAlias, BoxShadowSamples)>(); continue; } diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index b9658f794d..4bdd35192f 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -2682,14 +2682,14 @@ pub enum UiAntiAlias { /// fn spawn_camera(mut commands: Commands) { /// commands.spawn(( /// Camera2d, -/// UiBoxShadowSamples(6), +/// BoxShadowSamples(6), /// )); /// } /// ``` #[derive(Component, Clone, Copy, Debug, Reflect, Eq, PartialEq)] -pub struct UiBoxShadowSamples(pub u32); +pub struct BoxShadowSamples(pub u32); -impl Default for UiBoxShadowSamples { +impl Default for BoxShadowSamples { fn default() -> Self { Self(4) } diff --git a/examples/testbed/ui.rs b/examples/testbed/ui.rs index 098afe7523..d33013d19a 100644 --- a/examples/testbed/ui.rs +++ b/examples/testbed/ui.rs @@ -29,7 +29,7 @@ fn main() { fn setup(mut commands: Commands, asset_server: Res) { // Camera - commands.spawn((Camera2d, IsDefaultUiCamera, UiBoxShadowSamples(6))); + commands.spawn((Camera2d, IsDefaultUiCamera, BoxShadowSamples(6))); // root node commands diff --git a/examples/ui/box_shadow.rs b/examples/ui/box_shadow.rs index d3715ab383..c30a1d6ce7 100644 --- a/examples/ui/box_shadow.rs +++ b/examples/ui/box_shadow.rs @@ -35,7 +35,7 @@ fn setup(mut commands: Commands) { let args = Args::from_args(&[], &[]).unwrap(); // ui camera - commands.spawn((Camera2d, UiBoxShadowSamples(args.samples))); + commands.spawn((Camera2d, BoxShadowSamples(args.samples))); commands .spawn((