From 4dfa42398544d9b075a361859f380f7c1f75839e Mon Sep 17 00:00:00 2001 From: MiniaczQ Date: Sun, 13 Oct 2024 21:05:23 +0200 Subject: [PATCH 01/11] normalize names --- crates/bevy_dev_tools/src/fps_overlay.rs | 8 +++---- crates/bevy_text/src/lib.rs | 4 ++-- crates/bevy_text/src/text2d.rs | 6 ++--- crates/bevy_text/src/text_access.rs | 2 +- crates/bevy_ui/src/accessibility.rs | 10 ++++---- crates/bevy_ui/src/lib.rs | 8 +++---- crates/bevy_ui/src/widget/image.rs | 2 +- crates/bevy_ui/src/widget/text.rs | 22 ++++++++--------- examples/2d/2d_shapes.rs | 2 +- examples/2d/bloom_2d.rs | 4 ++-- examples/2d/bounding_2d.rs | 4 ++-- examples/2d/sprite_animation.rs | 2 +- examples/2d/wireframe_2d.rs | 4 ++-- examples/3d/3d_shapes.rs | 2 +- examples/3d/anisotropy.rs | 6 ++--- examples/3d/anti_aliasing.rs | 4 ++-- examples/3d/atmospheric_fog.rs | 2 +- examples/3d/auto_exposure.rs | 6 ++--- examples/3d/blend_modes.rs | 8 +++---- examples/3d/bloom_3d.rs | 4 ++-- examples/3d/clearcoat.rs | 6 ++--- examples/3d/color_grading.rs | 8 +++---- examples/3d/deferred_rendering.rs | 4 ++-- examples/3d/depth_of_field.rs | 4 ++-- examples/3d/fog.rs | 4 ++-- examples/3d/generate_custom_mesh.rs | 2 +- examples/3d/irradiance_volumes.rs | 4 ++-- examples/3d/lighting.rs | 6 ++--- examples/3d/load_gltf_extras.rs | 4 ++-- examples/3d/motion_blur.rs | 6 ++--- examples/3d/order_independent_transparency.rs | 6 ++--- examples/3d/parallax_mapping.rs | 14 +++++------ examples/3d/pbr.rs | 6 ++--- examples/3d/pcss.rs | 4 ++-- examples/3d/post_processing.rs | 4 ++-- examples/3d/reflection_probes.rs | 4 ++-- examples/3d/shadow_biases.rs | 22 ++++++++--------- examples/3d/split_screen.rs | 4 ++-- examples/3d/spotlight.rs | 2 +- examples/3d/ssao.rs | 4 ++-- examples/3d/ssr.rs | 4 ++-- examples/3d/tonemapping.rs | 8 +++---- examples/3d/transmission.rs | 4 ++-- examples/3d/visibility_range.rs | 4 ++-- examples/3d/volumetric_fog.rs | 4 ++-- examples/3d/wireframe.rs | 4 ++-- examples/animation/animated_ui.rs | 2 +- examples/animation/animation_graph.rs | 8 +++---- examples/animation/animation_masks.rs | 10 ++++---- examples/animation/easing_functions.rs | 4 ++-- examples/app/log_layers_ecs.rs | 2 +- examples/app/logs.rs | 2 +- examples/asset/alter_mesh.rs | 4 ++-- examples/asset/alter_sprite.rs | 4 ++-- examples/asset/multi_asset_sync.rs | 4 ++-- examples/audio/spatial_audio_2d.rs | 2 +- examples/audio/spatial_audio_3d.rs | 2 +- examples/camera/2d_screen_shake.rs | 2 +- examples/camera/2d_top_down_camera.rs | 2 +- examples/camera/camera_orbit.rs | 6 ++--- examples/camera/first_person_view_model.rs | 2 +- examples/camera/projection_zoom.rs | 4 ++-- examples/dev_tools/fps_overlay.rs | 2 +- examples/ecs/observers.rs | 2 +- examples/ecs/one_shot_systems.rs | 6 ++--- examples/games/alien_cake_addict.rs | 6 ++--- examples/games/breakout.rs | 6 ++--- examples/games/contributors.rs | 8 +++---- examples/games/game_menu.rs | 24 +++++++++---------- examples/games/loading_screen.rs | 4 ++-- examples/games/stepping.rs | 6 ++--- examples/gizmos/2d_gizmos.rs | 2 +- examples/gizmos/3d_gizmos.rs | 2 +- examples/gizmos/light_gizmos.rs | 6 ++--- examples/helpers/widgets.rs | 4 ++-- examples/input/text_input.rs | 10 ++++---- examples/math/cubic_splines.rs | 10 ++++---- examples/math/custom_primitives.rs | 2 +- examples/math/random_sampling.rs | 2 +- examples/math/render_primitives.rs | 4 ++-- examples/math/sampling_primitives.rs | 4 ++-- examples/mobile/src/lib.rs | 2 +- .../movement/physics_in_fixed_timestep.rs | 2 +- examples/picking/mesh_picking.rs | 2 +- examples/picking/simple_picking.rs | 2 +- examples/scene/scene.rs | 2 +- examples/shader/shader_prepass.rs | 6 ++--- examples/state/computed_states.rs | 20 ++++++++-------- examples/state/custom_transitions.rs | 2 +- examples/state/states.rs | 2 +- examples/state/sub_states.rs | 4 ++-- examples/stress_tests/bevymark.rs | 4 ++-- examples/stress_tests/many_buttons.rs | 4 ++-- examples/stress_tests/many_gizmos.rs | 4 ++-- examples/stress_tests/many_glyphs.rs | 2 +- examples/time/virtual_time.rs | 13 ++++++---- examples/tools/gamepad_viewer.rs | 8 +++---- .../tools/scene_viewer/morph_viewer_plugin.rs | 6 ++--- examples/transforms/align.rs | 2 +- examples/ui/borders.rs | 8 +++---- examples/ui/button.rs | 4 ++-- examples/ui/display_and_visibility.rs | 14 +++++------ examples/ui/flex_layout.rs | 2 +- examples/ui/font_atlas_debug.rs | 4 ++-- examples/ui/ghost_nodes.rs | 6 ++--- examples/ui/grid.rs | 6 ++--- examples/ui/overflow.rs | 2 +- examples/ui/overflow_debug.rs | 8 +++---- examples/ui/relative_cursor_position.rs | 4 ++-- examples/ui/render_ui_to_texture.rs | 2 +- examples/ui/scroll.rs | 16 ++++++------- examples/ui/size_constraints.rs | 6 ++--- examples/ui/text.rs | 8 +++---- examples/ui/text_debug.rs | 18 +++++++------- examples/ui/text_wrap_debug.rs | 2 +- examples/ui/transparency_ui.rs | 4 ++-- examples/ui/ui.rs | 12 +++++----- examples/ui/ui_scaling.rs | 2 +- examples/ui/ui_texture_atlas.rs | 2 +- examples/ui/ui_texture_atlas_slice.rs | 4 ++-- examples/ui/ui_texture_slice.rs | 4 ++-- examples/ui/window_fallthrough.rs | 2 +- examples/window/low_power.rs | 4 ++-- examples/window/monitor_info.rs | 2 +- examples/window/multiple_windows.rs | 4 ++-- examples/window/scale_factor_override.rs | 4 ++-- examples/window/screenshot.rs | 2 +- examples/window/window_resizing.rs | 4 ++-- 128 files changed, 338 insertions(+), 335 deletions(-) diff --git a/crates/bevy_dev_tools/src/fps_overlay.rs b/crates/bevy_dev_tools/src/fps_overlay.rs index c846fff492d2b..c7cc8bc1d339e 100644 --- a/crates/bevy_dev_tools/src/fps_overlay.rs +++ b/crates/bevy_dev_tools/src/fps_overlay.rs @@ -17,7 +17,7 @@ use bevy_render::view::Visibility; use bevy_text::{Font, TextColor, TextFont, TextSpan}; use bevy_ui::{ node_bundles::NodeBundle, - widget::{Text, UiTextWriter}, + widget::{TextUi, TextUiWriter}, GlobalZIndex, PositionType, Style, }; use bevy_utils::default; @@ -102,7 +102,7 @@ fn setup(mut commands: Commands, overlay_config: Res) { )) .with_children(|p| { p.spawn(( - Text::new("FPS: "), + TextUi::new("FPS: "), overlay_config.text_config.clone(), TextColor(overlay_config.text_color), FpsText, @@ -114,7 +114,7 @@ fn setup(mut commands: Commands, overlay_config: Res) { fn update_text( diagnostic: Res, query: Query>, - mut writer: UiTextWriter, + mut writer: TextUiWriter, ) { for entity in &query { if let Some(fps) = diagnostic.get(&FrameTimeDiagnosticsPlugin::FPS) { @@ -128,7 +128,7 @@ fn update_text( fn customize_text( overlay_config: Res, query: Query>, - mut writer: UiTextWriter, + mut writer: TextUiWriter, ) { for entity in &query { writer.for_each_font(entity, |mut font| { diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index da68e5aecb3c9..ab4b7cbb61510 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -65,8 +65,8 @@ pub use text_access::*; pub mod prelude { #[doc(hidden)] pub use crate::{ - Font, JustifyText, LineBreak, Text2d, TextColor, TextError, TextFont, TextLayout, - TextReader2d, TextSpan, TextWriter2d, + Font, JustifyText, LineBreak, Text2d, Text2dReader, Text2dWriter, TextColor, TextError, + TextFont, TextLayout, TextSpan, }; } diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index ad4eacd25ba3b..7cb79d32ba89f 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -120,10 +120,10 @@ impl From for Text2d { } /// 2d alias for [`TextReader`]. -pub type TextReader2d<'w, 's> = TextReader<'w, 's, Text2d>; +pub type Text2dReader<'w, 's> = TextReader<'w, 's, Text2d>; /// 2d alias for [`TextWriter`]. -pub type TextWriter2d<'w, 's> = TextWriter<'w, 's, Text2d>; +pub type Text2dWriter<'w, 's> = TextWriter<'w, 's, Text2d>; /// This system extracts the sprites from the 2D text components and adds them to the /// "render world". @@ -239,7 +239,7 @@ pub fn update_text2d_layout( &mut TextLayoutInfo, &mut ComputedTextBlock, )>, - mut text_reader: TextReader2d, + mut text_reader: Text2dReader, mut font_system: ResMut, mut swash_cache: ResMut, ) { diff --git a/crates/bevy_text/src/text_access.rs b/crates/bevy_text/src/text_access.rs index e5699328f8233..a0c3409282770 100644 --- a/crates/bevy_text/src/text_access.rs +++ b/crates/bevy_text/src/text_access.rs @@ -45,7 +45,7 @@ impl TextIterScratch { /// System parameter for reading text spans in a text block. /// -/// `R` is the root text component, and `S` is the text span component on children. +/// `R` is the root text component. #[derive(SystemParam)] pub struct TextReader<'w, 's, R: TextRoot> { // This is a local to avoid system ambiguities when TextReaders run in parallel. diff --git a/crates/bevy_ui/src/accessibility.rs b/crates/bevy_ui/src/accessibility.rs index 69c1b824ed8fb..2a5944f40a371 100644 --- a/crates/bevy_ui/src/accessibility.rs +++ b/crates/bevy_ui/src/accessibility.rs @@ -1,6 +1,6 @@ use crate::{ prelude::{Button, Label}, - widget::UiTextReader, + widget::TextUiReader, Node, UiChildren, UiImage, }; use bevy_a11y::{ @@ -19,7 +19,7 @@ use bevy_render::{camera::CameraUpdateSystem, prelude::Camera}; use bevy_transform::prelude::GlobalTransform; fn calc_name( - text_reader: &mut UiTextReader, + text_reader: &mut TextUiReader, children: impl Iterator, ) -> Option> { let mut name = None; @@ -62,7 +62,7 @@ fn button_changed( mut commands: Commands, mut query: Query<(Entity, Option<&mut AccessibilityNode>), Changed