From d99528accb1b8d0a19040f43fab36398b6963af4 Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Sun, 17 Nov 2024 05:20:06 +0100 Subject: [PATCH 1/6] remove deprecated code --- crates/bevy_animation/src/lib.rs | 7 - crates/bevy_asset/src/processor/process.rs | 20 -- crates/bevy_audio/src/audio.rs | 54 --- crates/bevy_audio/src/lib.rs | 6 +- crates/bevy_audio/src/pitch.rs | 11 +- crates/bevy_color/src/color.rs | 46 --- .../src/auto_exposure/mod.rs | 3 +- .../src/auto_exposure/settings.rs | 3 - crates/bevy_core_pipeline/src/bloom/mod.rs | 5 +- .../bevy_core_pipeline/src/bloom/settings.rs | 6 - .../src/contrast_adaptive_sharpening/mod.rs | 3 - .../src/core_2d/camera_2d.rs | 89 +---- .../src/core_3d/camera_3d.rs | 58 +-- crates/bevy_core_pipeline/src/dof/mod.rs | 3 - crates/bevy_core_pipeline/src/lib.rs | 10 +- .../bevy_core_pipeline/src/motion_blur/mod.rs | 17 +- crates/bevy_core_pipeline/src/smaa/mod.rs | 3 - crates/bevy_core_pipeline/src/taa/mod.rs | 20 +- crates/bevy_ecs/src/event/collections.rs | 22 -- crates/bevy_ecs/src/event/event_cursor.rs | 11 - crates/bevy_ecs/src/query/builder.rs | 1 - crates/bevy_ecs/src/query/state.rs | 1 - crates/bevy_ecs/src/schedule/condition.rs | 113 +----- crates/bevy_ecs/src/system/commands/mod.rs | 28 +- crates/bevy_ecs/src/world/entity_fetch.rs | 2 - crates/bevy_ecs/src/world/mod.rs | 332 +----------------- crates/bevy_math/src/direction.rs | 14 - crates/bevy_math/src/rotation2d.rs | 10 - crates/bevy_pbr/src/bundle.rs | 131 +------ crates/bevy_pbr/src/fog.rs | 3 - crates/bevy_pbr/src/lib.rs | 16 +- .../src/light_probe/environment_map.rs | 30 +- crates/bevy_pbr/src/meshlet/mod.rs | 44 +-- crates/bevy_pbr/src/ssao/mod.rs | 19 +- crates/bevy_pbr/src/ssr/mod.rs | 22 -- crates/bevy_pbr/src/volumetric_fog/mod.rs | 37 +- crates/bevy_reflect/src/array.rs | 5 - crates/bevy_render/src/lib.rs | 5 +- crates/bevy_render/src/spatial_bundle.rs | 72 ---- crates/bevy_render/src/view/visibility/mod.rs | 24 -- crates/bevy_scene/src/bundle.rs | 65 +--- crates/bevy_scene/src/lib.rs | 5 +- crates/bevy_sprite/src/bundle.rs | 31 -- crates/bevy_sprite/src/lib.rs | 6 +- .../bevy_sprite/src/mesh2d/color_material.rs | 11 +- crates/bevy_sprite/src/mesh2d/material.rs | 38 +- .../bevy_sprite/src/texture_atlas_builder.rs | 10 - crates/bevy_text/src/lib.rs | 3 - crates/bevy_text/src/text2d.rs | 12 - crates/bevy_transform/src/bundles.rs | 66 ---- .../src/components/global_transform.rs | 2 - .../src/components/transform.rs | 2 - crates/bevy_transform/src/lib.rs | 6 - crates/bevy_ui/src/lib.rs | 5 - crates/bevy_ui/src/node_bundles.rs | 227 ------------ crates/bevy_ui/src/widget/text.rs | 12 - crates/bevy_utils/src/lib.rs | 24 -- errors/B0004.md | 4 +- examples/ecs/dynamic.rs | 2 - 59 files changed, 46 insertions(+), 1791 deletions(-) delete mode 100644 crates/bevy_render/src/spatial_bundle.rs delete mode 100644 crates/bevy_sprite/src/bundle.rs delete mode 100644 crates/bevy_transform/src/bundles.rs delete mode 100644 crates/bevy_ui/src/node_bundles.rs diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 8d55cb7ea5c81..a2fc99763d3d8 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -943,13 +943,6 @@ impl AnimationPlayer { pub fn animation_mut(&mut self, animation: AnimationNodeIndex) -> Option<&mut ActiveAnimation> { self.active_animations.get_mut(&animation) } - - #[deprecated = "Use `is_playing_animation` instead"] - /// Returns true if the animation is currently playing or paused, or false - /// if the animation is stopped. - pub fn animation_is_playing(&self, animation: AnimationNodeIndex) -> bool { - self.active_animations.contains_key(&animation) - } } /// A system that triggers untargeted animation events for the currently-playing animations. diff --git a/crates/bevy_asset/src/processor/process.rs b/crates/bevy_asset/src/processor/process.rs index b9d2cd3b47025..72d6ce4753075 100644 --- a/crates/bevy_asset/src/processor/process.rs +++ b/crates/bevy_asset/src/processor/process.rs @@ -105,26 +105,6 @@ impl< } } -/// A flexible [`Process`] implementation that loads the source [`Asset`] using the `L` [`AssetLoader`], then -/// saves that `L` asset using the `S` [`AssetSaver`]. -/// -/// This is a specialized use case of [`LoadTransformAndSave`] and is useful where there is no asset manipulation -/// such as when compressing assets. -/// -/// This uses [`LoadAndSaveSettings`] to configure the processor. -/// -/// [`Asset`]: crate::Asset -#[deprecated = "Use `LoadTransformAndSave::Asset>, S>` instead"] -pub type LoadAndSave = - LoadTransformAndSave::Asset>, S>; - -/// Settings for the [`LoadAndSave`] [`Process::Settings`] implementation. -/// -/// `LoaderSettings` corresponds to [`AssetLoader::Settings`] and `SaverSettings` corresponds to [`AssetSaver::Settings`]. -#[deprecated = "Use `LoadTransformAndSaveSettings` instead"] -pub type LoadAndSaveSettings = - LoadTransformAndSaveSettings; - /// An error that is encountered during [`Process::process`]. #[derive(Error, Display, Debug, From)] pub enum ProcessError { diff --git a/crates/bevy_audio/src/audio.rs b/crates/bevy_audio/src/audio.rs index 7c020a0333fa2..ad82c104745c2 100644 --- a/crates/bevy_audio/src/audio.rs +++ b/crates/bevy_audio/src/audio.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - use crate::{AudioSource, Decodable}; use bevy_asset::{Asset, Handle}; use bevy_derive::Deref; @@ -229,13 +227,6 @@ impl Default for SpatialScale { #[reflect(Resource, Default)] pub struct DefaultSpatialScale(pub SpatialScale); -/// Bundle for playing a standard bevy audio asset -#[deprecated( - since = "0.15.0", - note = "Use the `AudioPlayer` component instead. Inserting it will now also insert a `PlaybackSettings` component automatically." -)] -pub type AudioBundle = AudioSourceBundle; - /// A component for playing a sound. /// /// Insert this component onto an entity to trigger an audio source to begin playing. @@ -274,48 +265,3 @@ impl AudioPlayer { Self(source) } } - -/// Bundle for playing a sound. -/// -/// Insert this bundle onto an entity to trigger a sound source to begin playing. -/// -/// If the handle refers to an unavailable asset (such as if it has not finished loading yet), -/// the audio will not begin playing immediately. The audio will play when the asset is ready. -/// -/// When Bevy begins the audio playback, an [`AudioSink`][crate::AudioSink] component will be -/// added to the entity. You can use that component to control the audio settings during playback. -#[derive(Bundle)] -#[deprecated( - since = "0.15.0", - note = "Use the `AudioPlayer` component instead. Inserting it will now also insert a `PlaybackSettings` component automatically." -)] -pub struct AudioSourceBundle -where - Source: Asset + Decodable, -{ - /// Asset containing the audio data to play. - pub source: AudioPlayer, - /// Initial settings that the audio starts playing with. - /// If you would like to control the audio while it is playing, - /// query for the [`AudioSink`][crate::AudioSink] component. - /// Changes to this component will *not* be applied to already-playing audio. - pub settings: PlaybackSettings, -} - -impl Clone for AudioSourceBundle { - fn clone(&self) -> Self { - Self { - source: self.source.clone(), - settings: self.settings, - } - } -} - -impl Default for AudioSourceBundle { - fn default() -> Self { - Self { - source: AudioPlayer(Handle::default()), - settings: Default::default(), - } - } -} diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index 1519987a4b155..a3f4ffb09e258 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -38,13 +38,11 @@ mod sinks; /// The audio prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] pub use crate::{ - AudioBundle, AudioPlayer, AudioSink, AudioSinkPlayback, AudioSource, AudioSourceBundle, - Decodable, GlobalVolume, Pitch, PitchBundle, PlaybackSettings, SpatialAudioSink, - SpatialListener, + AudioPlayer, AudioSink, AudioSinkPlayback, AudioSource, Decodable, GlobalVolume, Pitch, + PlaybackSettings, SpatialAudioSink, SpatialListener, }; } diff --git a/crates/bevy_audio/src/pitch.rs b/crates/bevy_audio/src/pitch.rs index 02863d6c62781..d85b9b31cf071 100644 --- a/crates/bevy_audio/src/pitch.rs +++ b/crates/bevy_audio/src/pitch.rs @@ -1,6 +1,4 @@ -#![expect(deprecated)] - -use crate::{AudioSourceBundle, Decodable}; +use crate::Decodable; use bevy_asset::Asset; use bevy_reflect::TypePath; use rodio::{ @@ -35,10 +33,3 @@ impl Decodable for Pitch { SineWave::new(self.frequency).take_duration(self.duration) } } - -/// Bundle for playing a bevy note sound -#[deprecated( - since = "0.15.0", - note = "Use the `AudioPlayer` component instead. Inserting it will now also insert a `PlaybackSettings` component automatically." -)] -pub type PitchBundle = AudioSourceBundle; diff --git a/crates/bevy_color/src/color.rs b/crates/bevy_color/src/color.rs index d2e4cb792187c..29a1b4853cc77 100644 --- a/crates/bevy_color/src/color.rs +++ b/crates/bevy_color/src/color.rs @@ -84,12 +84,6 @@ impl Color { (*self).into() } - #[deprecated = "Use `Color::srgba` instead"] - /// Creates a new [`Color`] object storing a [`Srgba`] color. - pub const fn rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self { - Self::srgba(red, green, blue, alpha) - } - /// Creates a new [`Color`] object storing a [`Srgba`] color. pub const fn srgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self { Self::Srgba(Srgba { @@ -100,12 +94,6 @@ impl Color { }) } - #[deprecated = "Use `Color::srgb` instead"] - /// Creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0. - pub const fn rgb(red: f32, green: f32, blue: f32) -> Self { - Self::srgb(red, green, blue) - } - /// Creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0. pub const fn srgb(red: f32, green: f32, blue: f32) -> Self { Self::Srgba(Srgba { @@ -116,12 +104,6 @@ impl Color { }) } - #[deprecated = "Use `Color::srgb_from_array` instead"] - /// Reads an array of floats to creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0. - pub fn rgb_from_array([r, g, b]: [f32; 3]) -> Self { - Self::Srgba(Srgba::rgb(r, g, b)) - } - /// Reads an array of floats to creates a new [`Color`] object storing a [`Srgba`] color with an alpha of 1.0. pub const fn srgb_from_array(array: [f32; 3]) -> Self { Self::Srgba(Srgba { @@ -132,14 +114,6 @@ impl Color { }) } - #[deprecated = "Use `Color::srgba_u8` instead"] - /// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values. - /// - /// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0. - pub fn rgba_u8(red: u8, green: u8, blue: u8, alpha: u8) -> Self { - Self::srgba_u8(red, green, blue, alpha) - } - /// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values. /// /// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0. @@ -152,14 +126,6 @@ impl Color { }) } - #[deprecated = "Use `Color::srgb_u8` instead"] - /// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values with an alpha of 1.0. - /// - /// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0. - pub fn rgb_u8(red: u8, green: u8, blue: u8) -> Self { - Self::srgb_u8(red, green, blue) - } - /// Creates a new [`Color`] object storing a [`Srgba`] color from [`u8`] values with an alpha of 1.0. /// /// A value of 0 is interpreted as 0.0, and a value of 255 is interpreted as 1.0. @@ -172,12 +138,6 @@ impl Color { }) } - #[deprecated = "Use Color::linear_rgba instead."] - /// Creates a new [`Color`] object storing a [`LinearRgba`] color. - pub const fn rbga_linear(red: f32, green: f32, blue: f32, alpha: f32) -> Self { - Self::linear_rgba(red, green, blue, alpha) - } - /// Creates a new [`Color`] object storing a [`LinearRgba`] color. pub const fn linear_rgba(red: f32, green: f32, blue: f32, alpha: f32) -> Self { Self::LinearRgba(LinearRgba { @@ -188,12 +148,6 @@ impl Color { }) } - #[deprecated = "Use Color::linear_rgb instead."] - /// Creates a new [`Color`] object storing a [`LinearRgba`] color with an alpha of 1.0. - pub const fn rgb_linear(red: f32, green: f32, blue: f32) -> Self { - Self::linear_rgb(red, green, blue) - } - /// Creates a new [`Color`] object storing a [`LinearRgba`] color with an alpha of 1.0. pub const fn linear_rgb(red: f32, green: f32, blue: f32) -> Self { Self::LinearRgba(LinearRgba { diff --git a/crates/bevy_core_pipeline/src/auto_exposure/mod.rs b/crates/bevy_core_pipeline/src/auto_exposure/mod.rs index 59f314d12e1ab..f94a61d09be16 100644 --- a/crates/bevy_core_pipeline/src/auto_exposure/mod.rs +++ b/crates/bevy_core_pipeline/src/auto_exposure/mod.rs @@ -24,8 +24,7 @@ use node::AutoExposureNode; use pipeline::{ AutoExposurePass, AutoExposurePipeline, ViewAutoExposurePipeline, METERING_SHADER_HANDLE, }; -#[allow(deprecated)] -pub use settings::{AutoExposure, AutoExposureSettings}; +pub use settings::AutoExposure; use crate::{ auto_exposure::compensation_curve::GpuAutoExposureCompensationCurve, diff --git a/crates/bevy_core_pipeline/src/auto_exposure/settings.rs b/crates/bevy_core_pipeline/src/auto_exposure/settings.rs index 91bdf836eebee..b5039030ac969 100644 --- a/crates/bevy_core_pipeline/src/auto_exposure/settings.rs +++ b/crates/bevy_core_pipeline/src/auto_exposure/settings.rs @@ -88,9 +88,6 @@ pub struct AutoExposure { pub compensation_curve: Handle, } -#[deprecated(since = "0.15.0", note = "Renamed to `AutoExposure`")] -pub type AutoExposureSettings = AutoExposure; - impl Default for AutoExposure { fn default() -> Self { Self { diff --git a/crates/bevy_core_pipeline/src/bloom/mod.rs b/crates/bevy_core_pipeline/src/bloom/mod.rs index bfd7ee22dbd10..8f242931d71cf 100644 --- a/crates/bevy_core_pipeline/src/bloom/mod.rs +++ b/crates/bevy_core_pipeline/src/bloom/mod.rs @@ -3,10 +3,7 @@ mod settings; mod upsampling_pipeline; use bevy_color::{Gray, LinearRgba}; -#[allow(deprecated)] -pub use settings::{ - Bloom, BloomCompositeMode, BloomPrefilter, BloomPrefilterSettings, BloomSettings, -}; +pub use settings::{Bloom, BloomCompositeMode, BloomPrefilter}; use crate::{ core_2d::graph::{Core2d, Node2d}, diff --git a/crates/bevy_core_pipeline/src/bloom/settings.rs b/crates/bevy_core_pipeline/src/bloom/settings.rs index effa135677f3b..7816eece51d7c 100644 --- a/crates/bevy_core_pipeline/src/bloom/settings.rs +++ b/crates/bevy_core_pipeline/src/bloom/settings.rs @@ -118,9 +118,6 @@ pub struct Bloom { pub uv_offset: f32, } -#[deprecated(since = "0.15.0", note = "Renamed to `Bloom`")] -pub type BloomSettings = Bloom; - impl Bloom { const DEFAULT_MAX_MIP_DIMENSION: u32 = 512; const DEFAULT_UV_OFFSET: f32 = 0.004; @@ -203,9 +200,6 @@ pub struct BloomPrefilter { pub threshold_softness: f32, } -#[deprecated(since = "0.15.0", note = "Renamed to `BloomPrefilter`")] -pub type BloomPrefilterSettings = BloomPrefilter; - #[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash, Copy)] pub enum BloomCompositeMode { EnergyConserving, diff --git a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs index e76be196d59f8..50184b95a66ba 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs @@ -54,9 +54,6 @@ pub struct ContrastAdaptiveSharpening { pub denoise: bool, } -#[deprecated(since = "0.15.0", note = "Renamed to `ContrastAdaptiveSharpening`")] -pub type ContrastAdaptiveSharpeningSettings = ContrastAdaptiveSharpening; - impl Default for ContrastAdaptiveSharpening { fn default() -> Self { ContrastAdaptiveSharpening { diff --git a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs index 9f8073e3f51df..dc5044fa830aa 100644 --- a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs +++ b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs @@ -1,21 +1,13 @@ -#![expect(deprecated)] - use crate::{ core_2d::graph::Core2d, tonemapping::{DebandDither, Tonemapping}, }; use bevy_ecs::prelude::*; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -use bevy_render::sync_world::SyncToRenderWorld; use bevy_render::{ - camera::{ - Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph, - OrthographicProjection, - }, + camera::{Camera, CameraProjection, CameraRenderGraph, OrthographicProjection}, extract_component::ExtractComponent, - prelude::Msaa, primitives::Frustum, - view::VisibleEntities, }; use bevy_transform::prelude::{GlobalTransform, Transform}; @@ -32,82 +24,3 @@ use bevy_transform::prelude::{GlobalTransform, Transform}; Tonemapping(|| Tonemapping::None), )] pub struct Camera2d; - -#[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `Camera2d` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct Camera2dBundle { - pub camera: Camera, - pub camera_render_graph: CameraRenderGraph, - pub projection: OrthographicProjection, - pub visible_entities: VisibleEntities, - pub frustum: Frustum, - pub transform: Transform, - pub global_transform: GlobalTransform, - pub camera_2d: Camera2d, - pub tonemapping: Tonemapping, - pub deband_dither: DebandDither, - pub main_texture_usages: CameraMainTextureUsages, - pub msaa: Msaa, - /// Marker component that indicates that its entity needs to be synchronized to the render world - pub sync: SyncToRenderWorld, -} - -impl Default for Camera2dBundle { - fn default() -> Self { - let projection = OrthographicProjection::default_2d(); - let transform = Transform::default(); - let frustum = projection.compute_frustum(&GlobalTransform::from(transform)); - Self { - camera_render_graph: CameraRenderGraph::new(Core2d), - projection, - visible_entities: VisibleEntities::default(), - frustum, - transform, - global_transform: Default::default(), - camera: Camera::default(), - camera_2d: Camera2d, - tonemapping: Tonemapping::None, - deband_dither: DebandDither::Disabled, - main_texture_usages: Default::default(), - msaa: Default::default(), - sync: Default::default(), - } - } -} - -impl Camera2dBundle { - /// Create an orthographic projection camera with a custom `Z` position. - /// - /// The camera is placed at `Z=far-0.1`, looking toward the world origin `(0,0,0)`. - /// Its orthographic projection extends from `0.0` to `-far` in camera view space, - /// corresponding to `Z=far-0.1` (closest to camera) to `Z=-0.1` (furthest away from - /// camera) in world space. - pub fn new_with_far(far: f32) -> Self { - // we want 0 to be "closest" and +far to be "farthest" in 2d, so we offset - // the camera's translation by far and use a right handed coordinate system - let projection = OrthographicProjection { - far, - ..OrthographicProjection::default_2d() - }; - let transform = Transform::from_xyz(0.0, 0.0, far - 0.1); - let frustum = projection.compute_frustum(&GlobalTransform::from(transform)); - Self { - camera_render_graph: CameraRenderGraph::new(Core2d), - projection, - visible_entities: VisibleEntities::default(), - frustum, - transform, - global_transform: Default::default(), - camera: Camera::default(), - camera_2d: Camera2d, - tonemapping: Tonemapping::None, - deband_dither: DebandDither::Disabled, - main_texture_usages: Default::default(), - msaa: Default::default(), - sync: Default::default(), - } - } -} diff --git a/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs b/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs index 3b60d8fde6b06..755e7f3f4e29b 100644 --- a/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs +++ b/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - use crate::{ core_3d::graph::Core3d, tonemapping::{DebandDither, Tonemapping}, @@ -7,14 +5,11 @@ use crate::{ use bevy_ecs::prelude::*; use bevy_reflect::{std_traits::ReflectDefault, Reflect, ReflectDeserialize, ReflectSerialize}; use bevy_render::{ - camera::{Camera, CameraMainTextureUsages, CameraRenderGraph, Exposure, Projection}, + camera::{Camera, CameraRenderGraph, Exposure, Projection}, extract_component::ExtractComponent, - primitives::Frustum, render_resource::{LoadOp, TextureUsages}, - sync_world::SyncToRenderWorld, - view::{ColorGrading, Msaa, VisibleEntities}, + view::ColorGrading, }; -use bevy_transform::prelude::{GlobalTransform, Transform}; use serde::{Deserialize, Serialize}; /// A 3D camera component. Enables the main 3D render graph for a [`Camera`]. @@ -147,52 +142,3 @@ pub enum ScreenSpaceTransmissionQuality { /// `num_taps` = 32 Ultra, } - -/// The camera coordinate space is right-handed x-right, y-up, z-back. -/// This means "forward" is -Z. -#[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `Camera3d` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct Camera3dBundle { - pub camera: Camera, - pub camera_render_graph: CameraRenderGraph, - pub projection: Projection, - pub visible_entities: VisibleEntities, - pub frustum: Frustum, - pub transform: Transform, - pub global_transform: GlobalTransform, - pub camera_3d: Camera3d, - pub tonemapping: Tonemapping, - pub deband_dither: DebandDither, - pub color_grading: ColorGrading, - pub exposure: Exposure, - pub main_texture_usages: CameraMainTextureUsages, - pub msaa: Msaa, - /// Marker component that indicates that its entity needs to be synchronized to the render world - pub sync: SyncToRenderWorld, -} - -// NOTE: ideally Perspective and Orthographic defaults can share the same impl, but sadly it breaks rust's type inference -impl Default for Camera3dBundle { - fn default() -> Self { - Self { - camera_render_graph: CameraRenderGraph::new(Core3d), - camera: Default::default(), - projection: Default::default(), - visible_entities: Default::default(), - frustum: Default::default(), - transform: Default::default(), - global_transform: Default::default(), - camera_3d: Default::default(), - tonemapping: Default::default(), - color_grading: Default::default(), - exposure: Default::default(), - main_texture_usages: Default::default(), - deband_dither: DebandDither::Enabled, - msaa: Default::default(), - sync: Default::default(), - } - } -} diff --git a/crates/bevy_core_pipeline/src/dof/mod.rs b/crates/bevy_core_pipeline/src/dof/mod.rs index 06cbbe3e9d312..88e25e75c2430 100644 --- a/crates/bevy_core_pipeline/src/dof/mod.rs +++ b/crates/bevy_core_pipeline/src/dof/mod.rs @@ -119,9 +119,6 @@ pub struct DepthOfField { pub max_depth: f32, } -#[deprecated(since = "0.15.0", note = "Renamed to `DepthOfField`")] -pub type DepthOfFieldSettings = DepthOfField; - /// Controls the appearance of the effect. #[derive(Clone, Copy, Default, PartialEq, Debug, Reflect)] #[reflect(Default, PartialEq)] diff --git a/crates/bevy_core_pipeline/src/lib.rs b/crates/bevy_core_pipeline/src/lib.rs index 731b50a7576ea..b01187c639e32 100644 --- a/crates/bevy_core_pipeline/src/lib.rs +++ b/crates/bevy_core_pipeline/src/lib.rs @@ -34,11 +34,9 @@ pub use skybox::Skybox; /// /// Expect bugs, missing features, compatibility issues, low performance, and/or future breaking changes. pub mod experimental { - #[expect(deprecated)] pub mod taa { pub use crate::taa::{ - TemporalAntiAliasBundle, TemporalAntiAliasNode, TemporalAntiAliasPlugin, - TemporalAntiAliasSettings, TemporalAntiAliasing, + TemporalAntiAliasNode, TemporalAntiAliasPlugin, TemporalAntiAliasing, }; } } @@ -46,13 +44,9 @@ pub mod experimental { /// The core pipeline prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] - pub use crate::{ - core_2d::{Camera2d, Camera2dBundle}, - core_3d::{Camera3d, Camera3dBundle}, - }; + pub use crate::{core_2d::Camera2d, core_3d::Camera3d}; } use crate::{ diff --git a/crates/bevy_core_pipeline/src/motion_blur/mod.rs b/crates/bevy_core_pipeline/src/motion_blur/mod.rs index 2195e296f5590..fb71760d31b29 100644 --- a/crates/bevy_core_pipeline/src/motion_blur/mod.rs +++ b/crates/bevy_core_pipeline/src/motion_blur/mod.rs @@ -2,8 +2,6 @@ //! //! Add the [`MotionBlur`] component to a camera to enable motion blur. -#![expect(deprecated)] - use crate::{ core_3d::graph::{Core3d, Node3d}, prepass::{DepthPrepass, MotionVectorPrepass}, @@ -11,8 +9,7 @@ use crate::{ use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Handle}; use bevy_ecs::{ - bundle::Bundle, component::Component, query::With, reflect::ReflectComponent, - schedule::IntoSystemConfigs, + component::Component, query::With, reflect::ReflectComponent, schedule::IntoSystemConfigs, }; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ @@ -26,18 +23,6 @@ use bevy_render::{ pub mod node; pub mod pipeline; -/// Adds [`MotionBlur`] and the required depth and motion vector prepasses to a camera entity. -#[derive(Bundle, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `MotionBlur` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct MotionBlurBundle { - pub motion_blur: MotionBlur, - pub depth_prepass: DepthPrepass, - pub motion_vector_prepass: MotionVectorPrepass, -} - /// A component that enables and configures motion blur when added to a camera. /// /// Motion blur is an effect that simulates how moving objects blur as they change position during diff --git a/crates/bevy_core_pipeline/src/smaa/mod.rs b/crates/bevy_core_pipeline/src/smaa/mod.rs index 7471cdb09ab76..d8eb1c90e76e3 100644 --- a/crates/bevy_core_pipeline/src/smaa/mod.rs +++ b/crates/bevy_core_pipeline/src/smaa/mod.rs @@ -101,9 +101,6 @@ pub struct Smaa { pub preset: SmaaPreset, } -#[deprecated(since = "0.15.0", note = "Renamed to `Smaa`")] -pub type SmaaSettings = Smaa; - /// A preset quality level for SMAA. /// /// Higher values are slower but result in a higher-quality image. diff --git a/crates/bevy_core_pipeline/src/taa/mod.rs b/crates/bevy_core_pipeline/src/taa/mod.rs index e9f8f1ac3d6a2..6bedb3f3bb735 100644 --- a/crates/bevy_core_pipeline/src/taa/mod.rs +++ b/crates/bevy_core_pipeline/src/taa/mod.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - use crate::{ core_3d::graph::{Core3d, Node3d}, fullscreen_vertex_shader::fullscreen_shader_vertex_state, @@ -10,7 +8,7 @@ use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Handle}; use bevy_core::FrameCount; use bevy_ecs::{ - prelude::{Bundle, Component, Entity, ReflectComponent}, + prelude::{Component, Entity, ReflectComponent}, query::{QueryItem, With}, schedule::IntoSystemConfigs, system::{Commands, Query, Res, ResMut, Resource}, @@ -92,19 +90,6 @@ impl Plugin for TemporalAntiAliasPlugin { } } -/// Bundle to apply temporal anti-aliasing. -#[derive(Bundle, Default, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `TemporalAntiAlias` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct TemporalAntiAliasBundle { - pub settings: TemporalAntiAliasing, - pub jitter: TemporalJitter, - pub depth_prepass: DepthPrepass, - pub motion_vector_prepass: MotionVectorPrepass, -} - /// Component to apply temporal anti-aliasing to a 3D perspective camera. /// /// Temporal anti-aliasing (TAA) is a form of image smoothing/filtering, like @@ -159,9 +144,6 @@ pub struct TemporalAntiAliasing { pub reset: bool, } -#[deprecated(since = "0.15.0", note = "Renamed to `TemporalAntiAliasing`")] -pub type TemporalAntiAliasSettings = TemporalAntiAliasing; - impl Default for TemporalAntiAliasing { fn default() -> Self { Self { reset: true } diff --git a/crates/bevy_ecs/src/event/collections.rs b/crates/bevy_ecs/src/event/collections.rs index c04512ba62bba..3b491ebf5b8cf 100644 --- a/crates/bevy_ecs/src/event/collections.rs +++ b/crates/bevy_ecs/src/event/collections.rs @@ -173,28 +173,6 @@ impl Events { } } - #[deprecated( - since = "0.14.0", - note = "`get_reader` has been deprecated. Please use `get_cursor` instead." - )] - /// Gets a new [`EventCursor`]. This will include all events already in the event buffers. - pub fn get_reader(&self) -> EventCursor { - EventCursor::default() - } - - #[deprecated( - since = "0.14.0", - note = "`get_reader_current` has been replaced. Please use `get_cursor_current` instead." - )] - /// Gets a new [`EventCursor`]. This will ignore all events already in the event buffers. - /// It will read all future events. - pub fn get_reader_current(&self) -> EventCursor { - EventCursor { - last_event_count: self.event_count, - ..Default::default() - } - } - /// Swaps the event buffers and clears the oldest event buffer. In general, this should be /// called once per frame/update. /// diff --git a/crates/bevy_ecs/src/event/event_cursor.rs b/crates/bevy_ecs/src/event/event_cursor.rs index 8fdcea8d244c5..ca1be152e5caa 100644 --- a/crates/bevy_ecs/src/event/event_cursor.rs +++ b/crates/bevy_ecs/src/event/event_cursor.rs @@ -6,17 +6,6 @@ use bevy_ecs::event::{ use bevy_ecs::event::{EventMutParIter, EventParIter}; use core::marker::PhantomData; -// Deprecated in favor of `EventCursor`, there is no nice way to deprecate this -// because generic constraints are not allowed in type aliases, so this will always -// 'dead code'. Hence the `#[allow(dead_code)]`. -#[deprecated( - since = "0.14.0", - note = "`ManualEventReader` has been replaced. Please use `EventCursor` instead." -)] -#[doc(alias = "EventCursor")] -#[allow(dead_code)] -pub type ManualEventReader = EventCursor; - /// Stores the state for an [`EventReader`] or [`EventMutator`]. /// /// Access to the [`Events`] resource is required to read any incoming events. diff --git a/crates/bevy_ecs/src/query/builder.rs b/crates/bevy_ecs/src/query/builder.rs index af1af7749e89b..b17346db73605 100644 --- a/crates/bevy_ecs/src/query/builder.rs +++ b/crates/bevy_ecs/src/query/builder.rs @@ -81,7 +81,6 @@ impl<'w, D: QueryData, F: QueryFilter> QueryBuilder<'w, D, F> { .map_or(false, |info| info.storage_type() == StorageType::Table) }; - #[allow(deprecated)] let (mut component_reads_and_writes, component_reads_and_writes_inverted) = self.access.access().component_reads_and_writes(); if component_reads_and_writes_inverted { diff --git a/crates/bevy_ecs/src/query/state.rs b/crates/bevy_ecs/src/query/state.rs index 69b67368fe4f3..282522f4b3b0b 100644 --- a/crates/bevy_ecs/src/query/state.rs +++ b/crates/bevy_ecs/src/query/state.rs @@ -510,7 +510,6 @@ impl QueryState { ) { // As a fast path, we can iterate directly over the components involved // if the `access` isn't inverted. - #[allow(deprecated)] let (component_reads_and_writes, component_reads_and_writes_inverted) = self.component_access.access.component_reads_and_writes(); let (component_writes, component_writes_inverted) = diff --git a/crates/bevy_ecs/src/schedule/condition.rs b/crates/bevy_ecs/src/schedule/condition.rs index 6956d2715069f..f0692fab8a99c 100644 --- a/crates/bevy_ecs/src/schedule/condition.rs +++ b/crates/bevy_ecs/src/schedule/condition.rs @@ -123,57 +123,6 @@ pub trait Condition: sealed::Condition CombinatorSystem::new(a, b, Cow::Owned(name)) } - /// Returns a new run condition that only returns `true` - /// if both this one and the passed `and_then` return `true`. - /// - /// The returned run condition is short-circuiting, meaning - /// `and_then` will only be invoked if `self` returns `true`. - /// - /// # Examples - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// #[derive(Resource, PartialEq)] - /// struct R(u32); - /// - /// # let mut app = Schedule::default(); - /// # let mut world = World::new(); - /// # fn my_system() {} - /// app.add_systems( - /// // The `resource_equals` run condition will fail since we don't initialize `R`, - /// // just like if we used `Res` in a system. - /// my_system.run_if(resource_equals(R(0))), - /// ); - /// # app.run(&mut world); - /// ``` - /// - /// Use `.and_then()` to avoid checking the condition. - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # #[derive(Resource, PartialEq)] - /// # struct R(u32); - /// # let mut app = Schedule::default(); - /// # let mut world = World::new(); - /// # fn my_system() {} - /// app.add_systems( - /// // `resource_equals` will only get run if the resource `R` exists. - /// my_system.run_if(resource_exists::.and_then(resource_equals(R(0)))), - /// ); - /// # app.run(&mut world); - /// ``` - /// - /// Note that in this case, it's better to just use the run condition [`resource_exists_and_equals`]. - /// - /// [`resource_exists_and_equals`]: common_conditions::resource_exists_and_equals - #[deprecated( - note = "Users should use the `.and(condition)` method in lieu of `.and_then(condition)`" - )] - fn and_then>(self, and_then: C) -> And { - self.and(and_then) - } - /// Returns a new run condition that only returns `false` /// if both this one and the passed `nand` return `true`. /// @@ -325,53 +274,6 @@ pub trait Condition: sealed::Condition CombinatorSystem::new(a, b, Cow::Owned(name)) } - /// Returns a new run condition that returns `true` - /// if either this one or the passed `or` return `true`. - /// - /// The returned run condition is short-circuiting, meaning - /// `or` will only be invoked if `self` returns `false`. - /// - /// # Examples - /// - /// ``` - /// use bevy_ecs::prelude::*; - /// - /// #[derive(Resource, PartialEq)] - /// struct A(u32); - /// - /// #[derive(Resource, PartialEq)] - /// struct B(u32); - /// - /// # let mut app = Schedule::default(); - /// # let mut world = World::new(); - /// # #[derive(Resource)] struct C(bool); - /// # fn my_system(mut c: ResMut) { c.0 = true; } - /// app.add_systems( - /// // Only run the system if either `A` or `B` exist. - /// my_system.run_if(resource_exists::.or(resource_exists::)), - /// ); - /// # - /// # world.insert_resource(C(false)); - /// # app.run(&mut world); - /// # assert!(!world.resource::().0); - /// # - /// # world.insert_resource(A(0)); - /// # app.run(&mut world); - /// # assert!(world.resource::().0); - /// # - /// # world.remove_resource::(); - /// # world.insert_resource(B(0)); - /// # world.insert_resource(C(false)); - /// # app.run(&mut world); - /// # assert!(world.resource::().0); - /// ``` - #[deprecated( - note = "Users should use the `.or(condition)` method in lieu of `.or_else(condition)`" - )] - fn or_else>(self, or_else: C) -> Or { - self.or(or_else) - } - /// Returns a new run condition that only returns `true` /// if `self` and `xnor` **both** return `false` or **both** return `true`. /// @@ -1406,7 +1308,6 @@ mod tests { } #[test] - #[allow(deprecated)] fn run_condition_combinators() { let mut world = World::new(); world.init_resource::(); @@ -1415,15 +1316,15 @@ mod tests { schedule.add_systems( ( increment_counter.run_if(every_other_time.and(|| true)), // Run every odd cycle. - increment_counter.run_if(every_other_time.and_then(|| true)), // Run every odd cycle. - increment_counter.run_if(every_other_time.nand(|| false)), // Always run. - double_counter.run_if(every_other_time.nor(|| false)), // Run every even cycle. - increment_counter.run_if(every_other_time.or(|| true)), // Always run. - increment_counter.run_if(every_other_time.or_else(|| true)), // Always run. + increment_counter.run_if(every_other_time.and(|| true)), // Run every odd cycle. + increment_counter.run_if(every_other_time.nand(|| false)), // Always run. + double_counter.run_if(every_other_time.nor(|| false)), // Run every even cycle. + increment_counter.run_if(every_other_time.or(|| true)), // Always run. + increment_counter.run_if(every_other_time.or(|| true)), // Always run. increment_counter.run_if(every_other_time.xnor(|| true)), // Run every odd cycle. - double_counter.run_if(every_other_time.xnor(|| false)), // Run every even cycle. + double_counter.run_if(every_other_time.xnor(|| false)), // Run every even cycle. increment_counter.run_if(every_other_time.xor(|| false)), // Run every odd cycle. - double_counter.run_if(every_other_time.xor(|| true)), // Run every even cycle. + double_counter.run_if(every_other_time.xor(|| true)), // Run every even cycle. ) .chain(), ); diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index 1480c200abb29..f13754b69cf38 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -312,32 +312,6 @@ impl<'w, 's> Commands<'w, 's> { } } - /// Pushes a [`Command`] to the queue for creating a new [`Entity`] if the given one does not exists, - /// and returns its corresponding [`EntityCommands`]. - /// - /// This method silently fails by returning [`EntityCommands`] - /// even if the given `Entity` cannot be spawned. - /// - /// See [`World::get_or_spawn`] for more details. - /// - /// # Note - /// - /// Spawning a specific `entity` value is rarely the right choice. Most apps should favor - /// [`Commands::spawn`]. This method should generally only be used for sharing entities across - /// apps, and only when they have a scheme worked out to share an ID space (which doesn't happen - /// by default). - #[deprecated(since = "0.15.0", note = "use Commands::spawn instead")] - pub fn get_or_spawn(&mut self, entity: Entity) -> EntityCommands { - self.queue(move |world: &mut World| { - #[allow(deprecated)] - world.get_or_spawn(entity); - }); - EntityCommands { - entity, - commands: self.reborrow(), - } - } - /// Pushes a [`Command`] to the queue for creating a new entity with the given [`Bundle`]'s components, /// and returns its corresponding [`EntityCommands`]. /// @@ -595,7 +569,7 @@ impl<'w, 's> Commands<'w, 's> { /// Then, the `Bundle` is added to the entity. /// /// This method is equivalent to iterating `bundles_iter`, - /// calling [`get_or_spawn`](Self::get_or_spawn) for each bundle, + /// calling [`spawn`](Self::spawn) for each bundle, /// and passing it to [`insert`](EntityCommands::insert), /// but it is faster due to memory pre-allocation. /// diff --git a/crates/bevy_ecs/src/world/entity_fetch.rs b/crates/bevy_ecs/src/world/entity_fetch.rs index 62d63ced54fb7..326fd581a0871 100644 --- a/crates/bevy_ecs/src/world/entity_fetch.rs +++ b/crates/bevy_ecs/src/world/entity_fetch.rs @@ -22,8 +22,6 @@ use crate::{ /// /// - The slice and array implementations perform an aliased mutabiltiy check /// in [`WorldEntityFetch::fetch_mut`] that is `O(N^2)`. -/// - The [`EntityHashSet`] implementation performs no such check as the type -/// itself guarantees no duplicates. /// - The single [`Entity`] implementation performs no such check as only one /// reference is returned. /// diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index d50f8f421cfc2..fcfbd78751d59 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -37,10 +37,10 @@ use crate::{ Component, ComponentDescriptor, ComponentHooks, ComponentId, ComponentInfo, ComponentTicks, Components, RequiredComponents, RequiredComponentsError, Tick, }, - entity::{AllocAtWithoutReplacement, Entities, Entity, EntityHashSet, EntityLocation}, + entity::{AllocAtWithoutReplacement, Entities, Entity, EntityLocation}, event::{Event, EventId, Events, SendBatchIds}, observer::Observers, - query::{DebugCheckedUnwrap, QueryData, QueryEntityError, QueryFilter, QueryState}, + query::{DebugCheckedUnwrap, QueryData, QueryFilter, QueryState}, removal_detection::RemovedComponentEvents, schedule::{Schedule, ScheduleLabel, Schedules}, storage::{ResourceData, Storages}, @@ -608,8 +608,6 @@ impl World { /// - Pass an [`Entity`] to receive a single [`EntityRef`]. /// - Pass a slice of [`Entity`]s to receive a [`Vec`]. /// - Pass an array of [`Entity`]s to receive an equally-sized array of [`EntityRef`]s. - /// - Pass a reference to a [`EntityHashSet`] to receive an - /// [`EntityHashMap`](crate::entity::EntityHashMap). /// /// # Panics /// @@ -675,27 +673,6 @@ impl World { /// assert_eq!(eref.get::().unwrap().y, 1.0); /// } /// ``` - /// - /// ## [`EntityHashSet`] - /// - /// ``` - /// # use bevy_ecs::{prelude::*, entity::EntityHashSet}; - /// #[derive(Component)] - /// struct Position { - /// x: f32, - /// y: f32, - /// } - /// - /// let mut world = World::new(); - /// let e1 = world.spawn(Position { x: 0.0, y: 1.0 }).id(); - /// let e2 = world.spawn(Position { x: 0.0, y: 1.0 }).id(); - /// let e3 = world.spawn(Position { x: 0.0, y: 1.0 }).id(); - /// - /// let ids = EntityHashSet::from_iter([e1, e2, e3]); - /// for (_id, eref) in world.entity(&ids) { - /// assert_eq!(eref.get::().unwrap().y, 1.0); - /// } - /// ``` #[inline] #[track_caller] pub fn entity(&self, entities: F) -> F::Ref<'_> { @@ -723,8 +700,6 @@ impl World { /// such as adding or removing components, or despawning the entity. /// - Pass a slice of [`Entity`]s to receive a [`Vec`]. /// - Pass an array of [`Entity`]s to receive an equally-sized array of [`EntityMut`]s. - /// - Pass a reference to a [`EntityHashSet`] to receive an - /// [`EntityHashMap`](crate::entity::EntityHashMap). /// /// In order to perform structural changes on the returned entity reference, /// such as adding or removing components, or despawning the entity, only a @@ -804,29 +779,6 @@ impl World { /// assert_eq!(pos.y, 2.0); /// } /// ``` - /// - /// ## [`EntityHashSet`] - /// - /// ``` - /// # use bevy_ecs::{prelude::*, entity::EntityHashSet}; - /// #[derive(Component)] - /// struct Position { - /// x: f32, - /// y: f32, - /// } - /// - /// let mut world = World::new(); - /// let e1 = world.spawn(Position { x: 0.0, y: 1.0 }).id(); - /// let e2 = world.spawn(Position { x: 0.0, y: 1.0 }).id(); - /// let e3 = world.spawn(Position { x: 0.0, y: 1.0 }).id(); - /// - /// let ids = EntityHashSet::from_iter([e1, e2, e3]); - /// for (_id, mut eref) in world.entity_mut(&ids) { - /// let mut pos = eref.get_mut::().unwrap(); - /// pos.y = 2.0; - /// assert_eq!(pos.y, 2.0); - /// } - /// ``` #[inline] #[track_caller] pub fn entity_mut(&mut self, entities: F) -> F::Mut<'_> { @@ -843,76 +795,6 @@ impl World { } } - /// Gets an [`EntityRef`] for multiple entities at once. - /// - /// # Panics - /// - /// If any entity does not exist in the world. - /// - /// # Examples - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Getting multiple entities. - /// let [entity1, entity2] = world.many_entities([id1, id2]); - /// ``` - /// - /// ```should_panic - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Trying to get a despawned entity will fail. - /// world.despawn(id2); - /// world.many_entities([id1, id2]); - /// ``` - #[deprecated(since = "0.15.0", note = "Use `World::entity::<[Entity; N]>` instead")] - pub fn many_entities(&mut self, entities: [Entity; N]) -> [EntityRef<'_>; N] { - self.entity(entities) - } - - /// Gets mutable access to multiple entities at once. - /// - /// # Panics - /// - /// If any entities do not exist in the world, - /// or if the same entity is specified multiple times. - /// - /// # Examples - /// - /// Disjoint mutable access. - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Disjoint mutable access. - /// let [entity1, entity2] = world.many_entities_mut([id1, id2]); - /// ``` - /// - /// Trying to access the same entity multiple times will fail. - /// - /// ```should_panic - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id = world.spawn_empty().id(); - /// world.many_entities_mut([id, id]); - /// ``` - #[deprecated( - since = "0.15.0", - note = "Use `World::entity_mut::<[Entity; N]>` instead" - )] - pub fn many_entities_mut( - &mut self, - entities: [Entity; N], - ) -> [EntityMut<'_>; N] { - self.entity_mut(entities) - } - /// Returns the components of an [`Entity`] through [`ComponentInfo`]. #[inline] pub fn inspect_entity(&self, entity: Entity) -> impl Iterator { @@ -936,30 +818,6 @@ impl World { .filter_map(|id| self.components().get_info(id)) } - /// Returns an [`EntityWorldMut`] for the given `entity` (if it exists) or spawns one if it doesn't exist. - /// This will return [`None`] if the `entity` exists with a different generation. - /// - /// # Note - /// Spawning a specific `entity` value is rarely the right choice. Most apps should favor [`World::spawn`]. - /// This method should generally only be used for sharing entities across apps, and only when they have a - /// scheme worked out to share an ID space (which doesn't happen by default). - #[inline] - #[deprecated(since = "0.15.0", note = "use `World::spawn` instead")] - pub fn get_or_spawn(&mut self, entity: Entity) -> Option { - self.flush(); - match self.entities.alloc_at_without_replacement(entity) { - AllocAtWithoutReplacement::Exists(location) => { - // SAFETY: `entity` exists and `location` is that entity's location - Some(unsafe { EntityWorldMut::new(self, entity, location) }) - } - AllocAtWithoutReplacement::DidNotExist => { - // SAFETY: entity was just allocated - Some(unsafe { self.spawn_at_empty_internal(entity) }) - } - AllocAtWithoutReplacement::ExistsWithWrongGeneration => None, - } - } - /// Returns [`EntityRef`]s that expose read-only operations for the given /// `entities`, returning [`Err`] if any of the given entities do not exist. /// Instead of immediately unwrapping the value returned from this function, @@ -969,8 +827,6 @@ impl World { /// - Pass an [`Entity`] to receive a single [`EntityRef`]. /// - Pass a slice of [`Entity`]s to receive a [`Vec`]. /// - Pass an array of [`Entity`]s to receive an equally-sized array of [`EntityRef`]s. - /// - Pass a reference to a [`EntityHashSet`] to receive an - /// [`EntityHashMap`](crate::entity::EntityHashMap). /// /// # Errors /// @@ -987,70 +843,6 @@ impl World { unsafe { entities.fetch_ref(cell) } } - /// Gets an [`EntityRef`] for multiple entities at once. - /// - /// # Errors - /// - /// If any entity does not exist in the world. - /// - /// # Examples - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Getting multiple entities. - /// let [entity1, entity2] = world.get_many_entities([id1, id2]).unwrap(); - /// - /// // Trying to get a despawned entity will fail. - /// world.despawn(id2); - /// assert!(world.get_many_entities([id1, id2]).is_err()); - /// ``` - #[deprecated( - since = "0.15.0", - note = "Use `World::get_entity::<[Entity; N]>` instead" - )] - pub fn get_many_entities( - &self, - entities: [Entity; N], - ) -> Result<[EntityRef<'_>; N], Entity> { - self.get_entity(entities) - } - - /// Gets an [`EntityRef`] for multiple entities at once, whose number is determined at runtime. - /// - /// # Errors - /// - /// If any entity does not exist in the world. - /// - /// # Examples - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Getting multiple entities. - /// let entities = world.get_many_entities_dynamic(&[id1, id2]).unwrap(); - /// let entity1 = entities.get(0).unwrap(); - /// let entity2 = entities.get(1).unwrap(); - /// - /// // Trying to get a despawned entity will fail. - /// world.despawn(id2); - /// assert!(world.get_many_entities_dynamic(&[id1, id2]).is_err()); - /// ``` - #[deprecated( - since = "0.15.0", - note = "Use `World::get_entity::<&[Entity]>` instead" - )] - pub fn get_many_entities_dynamic<'w>( - &'w self, - entities: &[Entity], - ) -> Result>, Entity> { - self.get_entity(entities) - } - /// Returns [`EntityMut`]s that expose read and write operations for the /// given `entities`, returning [`Err`] if any of the given entities do not /// exist. Instead of immediately unwrapping the value returned from this @@ -1062,8 +854,6 @@ impl World { /// such as adding or removing components, or despawning the entity. /// - Pass a slice of [`Entity`]s to receive a [`Vec`]. /// - Pass an array of [`Entity`]s to receive an equally-sized array of [`EntityMut`]s. - /// - Pass a reference to a [`EntityHashSet`] to receive an - /// [`EntityHashMap`](crate::entity::EntityHashMap). /// /// In order to perform structural changes on the returned entity reference, /// such as adding or removing components, or despawning the entity, only a @@ -1148,124 +938,6 @@ impl World { }) } - /// Gets mutable access to multiple entities. - /// - /// # Errors - /// - /// If any entities do not exist in the world, - /// or if the same entity is specified multiple times. - /// - /// # Examples - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Disjoint mutable access. - /// let [entity1, entity2] = world.get_many_entities_mut([id1, id2]).unwrap(); - /// - /// // Trying to access the same entity multiple times will fail. - /// assert!(world.get_many_entities_mut([id1, id1]).is_err()); - /// ``` - #[deprecated( - since = "0.15.0", - note = "Use `World::get_entity_mut::<[Entity; N]>` instead" - )] - pub fn get_many_entities_mut( - &mut self, - entities: [Entity; N], - ) -> Result<[EntityMut<'_>; N], QueryEntityError<'_>> { - self.get_entity_mut(entities).map_err(|e| match e { - EntityFetchError::NoSuchEntity(entity) => QueryEntityError::NoSuchEntity(entity), - EntityFetchError::AliasedMutability(entity) => { - QueryEntityError::AliasedMutability(entity) - } - }) - } - - /// Gets mutable access to multiple entities, whose number is determined at runtime. - /// - /// # Errors - /// - /// If any entities do not exist in the world, - /// or if the same entity is specified multiple times. - /// - /// # Examples - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// // Disjoint mutable access. - /// let mut entities = world.get_many_entities_dynamic_mut(&[id1, id2]).unwrap(); - /// let entity1 = entities.get_mut(0).unwrap(); - /// - /// // Trying to access the same entity multiple times will fail. - /// assert!(world.get_many_entities_dynamic_mut(&[id1, id1]).is_err()); - /// ``` - #[deprecated( - since = "0.15.0", - note = "Use `World::get_entity_mut::<&[Entity]>` instead" - )] - pub fn get_many_entities_dynamic_mut<'w>( - &'w mut self, - entities: &[Entity], - ) -> Result>, QueryEntityError<'w>> { - self.get_entity_mut(entities).map_err(|e| match e { - EntityFetchError::NoSuchEntity(entity) => QueryEntityError::NoSuchEntity(entity), - EntityFetchError::AliasedMutability(entity) => { - QueryEntityError::AliasedMutability(entity) - } - }) - } - - /// Gets mutable access to multiple entities, contained in a [`EntityHashSet`]. - /// The uniqueness of items in a [`EntityHashSet`] allows us to avoid checking for duplicates. - /// - /// # Errors - /// - /// If any entities do not exist in the world. - /// - /// # Examples - /// - /// ``` - /// # use bevy_ecs::prelude::*; - /// # use bevy_ecs::entity::EntityHash; - /// # use bevy_ecs::entity::EntityHashSet; - /// # use bevy_utils::hashbrown::HashSet; - /// # use bevy_utils::hashbrown::hash_map::DefaultHashBuilder; - /// # let mut world = World::new(); - /// # let id1 = world.spawn_empty().id(); - /// # let id2 = world.spawn_empty().id(); - /// let s = EntityHash::default(); - /// let mut set = EntityHashSet::with_hasher(s); - /// set.insert(id1); - /// set.insert(id2); - /// - /// // Disjoint mutable access. - /// let mut entities = world.get_many_entities_from_set_mut(&set).unwrap(); - /// let entity1 = entities.get_mut(0).unwrap(); - /// ``` - #[deprecated( - since = "0.15.0", - note = "Use `World::get_entity_mut::<&EntityHashSet>` instead." - )] - pub fn get_many_entities_from_set_mut<'w>( - &'w mut self, - entities: &EntityHashSet, - ) -> Result>, QueryEntityError<'w>> { - self.get_entity_mut(entities) - .map(|fetched| fetched.into_values().collect()) - .map_err(|e| match e { - EntityFetchError::NoSuchEntity(entity) => QueryEntityError::NoSuchEntity(entity), - EntityFetchError::AliasedMutability(entity) => { - QueryEntityError::AliasedMutability(entity) - } - }) - } - /// Spawns a new [`Entity`] and returns a corresponding [`EntityWorldMut`], which can be used /// to add components to the entity or retrieve its id. /// diff --git a/crates/bevy_math/src/direction.rs b/crates/bevy_math/src/direction.rs index acbc5816ad3f2..cce7c8a4ff6d0 100644 --- a/crates/bevy_math/src/direction.rs +++ b/crates/bevy_math/src/direction.rs @@ -70,20 +70,6 @@ fn assert_is_normalized(message: &str, length_squared: f32) { } } -/// A normalized vector pointing in a direction in 2D space -#[deprecated( - since = "0.14.0", - note = "`Direction2d` has been renamed. Please use `Dir2` instead." -)] -pub type Direction2d = Dir2; - -/// A normalized vector pointing in a direction in 3D space -#[deprecated( - since = "0.14.0", - note = "`Direction3d` has been renamed. Please use `Dir3` instead." -)] -pub type Direction3d = Dir3; - /// A normalized vector pointing in a direction in 2D space #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] diff --git a/crates/bevy_math/src/rotation2d.rs b/crates/bevy_math/src/rotation2d.rs index 4ad267d83da87..8106756bcb135 100644 --- a/crates/bevy_math/src/rotation2d.rs +++ b/crates/bevy_math/src/rotation2d.rs @@ -329,16 +329,6 @@ impl Rot2 { self.cos > 0.0 && self.sin.abs() < threshold_angle_sin } - /// Returns the angle in radians needed to make `self` and `other` coincide. - #[inline] - #[deprecated( - since = "0.15.0", - note = "Use `angle_to` instead, the semantics of `angle_between` will change in the future." - )] - pub fn angle_between(self, other: Self) -> f32 { - self.angle_to(other) - } - /// Returns the angle in radians needed to make `self` and `other` coincide. #[inline] pub fn angle_to(self, other: Self) -> f32 { diff --git a/crates/bevy_pbr/src/bundle.rs b/crates/bevy_pbr/src/bundle.rs index bdfdd695f5904..189862cc55e9a 100644 --- a/crates/bevy_pbr/src/bundle.rs +++ b/crates/bevy_pbr/src/bundle.rs @@ -1,66 +1,9 @@ -#![expect(deprecated)] - -use crate::{ - CascadeShadowConfig, Cascades, DirectionalLight, Material, MeshMaterial3d, PointLight, - SpotLight, StandardMaterial, -}; use bevy_derive::{Deref, DerefMut}; -use bevy_ecs::{ - bundle::Bundle, - component::Component, - entity::{Entity, EntityHashMap}, - reflect::ReflectComponent, -}; +use bevy_ecs::component::Component; +use bevy_ecs::entity::{Entity, EntityHashMap}; +use bevy_ecs::reflect::ReflectComponent; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::sync_world::MainEntity; -use bevy_render::{ - mesh::Mesh3d, - primitives::{CascadesFrusta, CubemapFrusta, Frustum}, - sync_world::SyncToRenderWorld, - view::{InheritedVisibility, ViewVisibility, Visibility}, -}; -use bevy_transform::components::{GlobalTransform, Transform}; - -/// A component bundle for PBR entities with a [`Mesh3d`] and a [`MeshMaterial3d`]. -#[deprecated( - since = "0.15.0", - note = "Use the `Mesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically." -)] -pub type PbrBundle = MaterialMeshBundle; - -/// A component bundle for entities with a [`Mesh3d`] and a [`MeshMaterial3d`]. -#[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `Mesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically." -)] -pub struct MaterialMeshBundle { - pub mesh: Mesh3d, - pub material: MeshMaterial3d, - pub transform: Transform, - pub global_transform: GlobalTransform, - /// User indication of whether an entity is visible - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, -} - -impl Default for MaterialMeshBundle { - fn default() -> Self { - Self { - mesh: Default::default(), - material: Default::default(), - transform: Default::default(), - global_transform: Default::default(), - visibility: Default::default(), - inherited_visibility: Default::default(), - view_visibility: Default::default(), - } - } -} - /// Collection of mesh entities visible for 3D lighting. /// /// This component contains all mesh entities visible from the current light view. @@ -144,71 +87,3 @@ pub struct RenderCascadesVisibleEntities { #[reflect(ignore)] pub entities: EntityHashMap>, } - -/// A component bundle for [`PointLight`] entities. -#[derive(Debug, Bundle, Default, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `PointLight` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct PointLightBundle { - pub point_light: PointLight, - pub cubemap_visible_entities: CubemapVisibleEntities, - pub cubemap_frusta: CubemapFrusta, - pub transform: Transform, - pub global_transform: GlobalTransform, - /// Enables or disables the light - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Marker component that indicates that its entity needs to be synchronized to the render world - pub sync: SyncToRenderWorld, -} - -/// A component bundle for spot light entities -#[derive(Debug, Bundle, Default, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `SpotLight` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct SpotLightBundle { - pub spot_light: SpotLight, - pub visible_entities: VisibleMeshEntities, - pub frustum: Frustum, - pub transform: Transform, - pub global_transform: GlobalTransform, - /// Enables or disables the light - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Marker component that indicates that its entity needs to be synchronized to the render world - pub sync: SyncToRenderWorld, -} - -/// A component bundle for [`DirectionalLight`] entities. -#[derive(Debug, Bundle, Default, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `DirectionalLight` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct DirectionalLightBundle { - pub directional_light: DirectionalLight, - pub frusta: CascadesFrusta, - pub cascades: Cascades, - pub cascade_shadow_config: CascadeShadowConfig, - pub visible_entities: CascadesVisibleEntities, - pub transform: Transform, - pub global_transform: GlobalTransform, - /// Enables or disables the light - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Marker component that indicates that its entity needs to be synchronized to the render world - pub sync: SyncToRenderWorld, -} diff --git a/crates/bevy_pbr/src/fog.rs b/crates/bevy_pbr/src/fog.rs index 198d218334dc2..831ec6928c424 100644 --- a/crates/bevy_pbr/src/fog.rs +++ b/crates/bevy_pbr/src/fog.rs @@ -70,9 +70,6 @@ pub struct DistanceFog { pub falloff: FogFalloff, } -#[deprecated(since = "0.15.0", note = "Renamed to `DistanceFog`")] -pub type FogSettings = DistanceFog; - /// Allows switching between different fog falloff modes, and configuring their parameters. /// /// ## Convenience Methods diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 7526f384e2fe5..6b7c3668fce17 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -61,29 +61,17 @@ pub use prepass::*; pub use render::*; pub use ssao::*; pub use ssr::*; -#[allow(deprecated)] -pub use volumetric_fog::{ - FogVolume, FogVolumeBundle, VolumetricFog, VolumetricFogPlugin, VolumetricFogSettings, - VolumetricLight, -}; +pub use volumetric_fog::{FogVolume, VolumetricFog, VolumetricFogPlugin, VolumetricLight}; /// The PBR prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] pub use crate::{ - bundle::{ - DirectionalLightBundle, MaterialMeshBundle, PbrBundle, PointLightBundle, - SpotLightBundle, - }, fog::{DistanceFog, FogFalloff}, light::{light_consts, AmbientLight, DirectionalLight, PointLight, SpotLight}, - light_probe::{ - environment_map::{EnvironmentMapLight, ReflectionProbeBundle}, - LightProbe, - }, + light_probe::{environment_map::EnvironmentMapLight, LightProbe}, material::{Material, MaterialPlugin}, mesh_material::MeshMaterial3d, parallax::ParallaxMappingMethod, diff --git a/crates/bevy_pbr/src/light_probe/environment_map.rs b/crates/bevy_pbr/src/light_probe/environment_map.rs index 6b47c9915a836..67a5ee6fc3447 100644 --- a/crates/bevy_pbr/src/light_probe/environment_map.rs +++ b/crates/bevy_pbr/src/light_probe/environment_map.rs @@ -15,7 +15,7 @@ //! environment maps are added to every point of the scene, including //! interior enclosed areas. //! -//! 2. If attached to a [`LightProbe`], environment maps represent the immediate +//! 2. If attached to a [`crate::LightProbe`], environment maps represent the immediate //! surroundings of a specific location in the scene. These types of //! environment maps are known as *reflection probes*. //! @@ -44,19 +44,15 @@ //! //! [several pre-filtered environment maps]: https://github.com/KhronosGroup/glTF-Sample-Environments -#![expect(deprecated)] - use bevy_asset::{AssetId, Handle}; use bevy_ecs::{ - bundle::Bundle, component::Component, query::QueryItem, reflect::ReflectComponent, - system::lifetimeless::Read, + component::Component, query::QueryItem, reflect::ReflectComponent, system::lifetimeless::Read, }; use bevy_image::Image; use bevy_math::Quat; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ extract_instances::ExtractInstance, - prelude::SpatialBundle, render_asset::RenderAssets, render_resource::{ binding_types::{self, uniform_buffer}, @@ -70,7 +66,7 @@ use bevy_render::{ use core::{num::NonZero, ops::Deref}; use crate::{ - add_cubemap_texture_view, binding_arrays_are_usable, EnvironmentMapUniform, LightProbe, + add_cubemap_texture_view, binding_arrays_are_usable, EnvironmentMapUniform, MAX_VIEW_LIGHT_PROBES, }; @@ -131,26 +127,6 @@ pub struct EnvironmentMapIds { pub(crate) specular: AssetId, } -/// A bundle that contains everything needed to make an entity a reflection -/// probe. -/// -/// A reflection probe is a type of environment map that specifies the light -/// surrounding a region in space. For more information, see -/// [`crate::environment_map`]. -#[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `LightProbe` and `EnvironmentMapLight` components instead. Inserting them will now also insert the other components required by them automatically." -)] -pub struct ReflectionProbeBundle { - /// Contains a transform that specifies the position of this reflection probe in space. - pub spatial: SpatialBundle, - /// Marks this environment map as a light probe. - pub light_probe: LightProbe, - /// The cubemaps that make up this environment map. - pub environment_map: EnvironmentMapLight, -} - /// All the bind group entries necessary for PBR shaders to access the /// environment maps exposed to a view. pub(crate) enum RenderViewEnvironmentMapBindGroupEntries<'a> { diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index 70da162be4ef1..ea20c0825bf41 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -1,4 +1,3 @@ -#![expect(deprecated)] //! Render high-poly 3d meshes using an efficient GPU-driven method. See [`MeshletPlugin`] and [`MeshletMesh`] for details. mod asset; @@ -58,7 +57,7 @@ use self::{ }, visibility_buffer_raster_node::MeshletVisibilityBufferRasterPassNode, }; -use crate::{graph::NodePbr, Material, MeshMaterial3d, PreviousGlobalTransform}; +use crate::{graph::NodePbr, PreviousGlobalTransform}; use bevy_app::{App, Plugin, PostUpdate}; use bevy_asset::{load_internal_asset, AssetApp, AssetId, Handle}; use bevy_core_pipeline::{ @@ -67,7 +66,6 @@ use bevy_core_pipeline::{ }; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - bundle::Bundle, component::Component, entity::Entity, prelude::With, @@ -82,13 +80,10 @@ use bevy_render::{ render_resource::Shader, renderer::RenderDevice, settings::WgpuFeatures, - view::{ - check_visibility, prepare_view_targets, InheritedVisibility, Msaa, ViewVisibility, - Visibility, VisibilitySystems, - }, + view::{check_visibility, prepare_view_targets, Msaa, Visibility, VisibilitySystems}, ExtractSchedule, Render, RenderApp, RenderSet, }; -use bevy_transform::components::{GlobalTransform, Transform}; +use bevy_transform::components::Transform; use bevy_utils::tracing::error; use derive_more::From; @@ -317,39 +312,6 @@ impl From<&MeshletMesh3d> for AssetId { } } -/// A component bundle for entities with a [`MeshletMesh`] and a [`Material`]. -#[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `MeshletMesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically." -)] -pub struct MaterialMeshletMeshBundle { - pub meshlet_mesh: MeshletMesh3d, - pub material: MeshMaterial3d, - pub transform: Transform, - pub global_transform: GlobalTransform, - /// User indication of whether an entity is visible - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, -} - -impl Default for MaterialMeshletMeshBundle { - fn default() -> Self { - Self { - meshlet_mesh: Default::default(), - material: Default::default(), - transform: Default::default(), - global_transform: Default::default(), - visibility: Default::default(), - inherited_visibility: Default::default(), - view_visibility: Default::default(), - } - } -} - fn configure_meshlet_views( mut views_3d: Query<( Entity, diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 366ac91e22acd..1aa011b58ed60 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - use crate::NodePbr; use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Handle}; @@ -9,7 +7,7 @@ use bevy_core_pipeline::{ prepass::{DepthPrepass, NormalPrepass, ViewPrepassTextures}, }; use bevy_ecs::{ - prelude::{Bundle, Component, Entity}, + prelude::{Component, Entity}, query::{Has, QueryItem, With}, reflect::ReflectComponent, schedule::IntoSystemConfigs, @@ -132,18 +130,6 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin { } } -/// Bundle to apply screen space ambient occlusion. -#[derive(Bundle, Default, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `ScreenSpaceAmbientOcclusion` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct ScreenSpaceAmbientOcclusionBundle { - pub settings: ScreenSpaceAmbientOcclusion, - pub depth_prepass: DepthPrepass, - pub normal_prepass: NormalPrepass, -} - /// Component to apply screen space ambient occlusion to a 3d camera. /// /// Screen space ambient occlusion (SSAO) approximates small-scale, @@ -185,9 +171,6 @@ impl Default for ScreenSpaceAmbientOcclusion { } } -#[deprecated(since = "0.15.0", note = "Renamed to `ScreenSpaceAmbientOcclusion`")] -pub type ScreenSpaceAmbientOcclusionSettings = ScreenSpaceAmbientOcclusion; - #[derive(Reflect, PartialEq, Eq, Hash, Clone, Copy, Default, Debug)] pub enum ScreenSpaceAmbientOcclusionQualityLevel { Low, diff --git a/crates/bevy_pbr/src/ssr/mod.rs b/crates/bevy_pbr/src/ssr/mod.rs index 935e5f5b8f22e..7bb4ce48329a6 100644 --- a/crates/bevy_pbr/src/ssr/mod.rs +++ b/crates/bevy_pbr/src/ssr/mod.rs @@ -1,7 +1,5 @@ //! Screen space reflections implemented via raymarching. -#![expect(deprecated)] - use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Handle}; use bevy_core_pipeline::{ @@ -14,7 +12,6 @@ use bevy_core_pipeline::{ }; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - bundle::Bundle, component::Component, entity::Entity, query::{Has, QueryItem, With}, @@ -57,22 +54,6 @@ const RAYMARCH_SHADER_HANDLE: Handle = Handle::weak_from_u128(8517409683 /// Screen-space reflections are currently only supported with deferred rendering. pub struct ScreenSpaceReflectionsPlugin; -/// A convenient bundle to add screen space reflections to a camera, along with -/// the depth and deferred prepasses required to enable them. -#[derive(Bundle, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `ScreenSpaceReflections` components instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct ScreenSpaceReflectionsBundle { - /// The component that enables SSR. - pub settings: ScreenSpaceReflections, - /// The depth prepass, needed for SSR. - pub depth_prepass: DepthPrepass, - /// The deferred prepass, needed for SSR. - pub deferred_prepass: DeferredPrepass, -} - /// Add this component to a camera to enable *screen-space reflections* (SSR). /// /// Screen-space reflections currently require deferred rendering in order to @@ -141,9 +122,6 @@ pub struct ScreenSpaceReflections { pub use_secant: bool, } -#[deprecated(since = "0.15.0", note = "Renamed to `ScreenSpaceReflections`")] -pub type ScreenSpaceReflectionsSettings = ScreenSpaceReflections; - /// A version of [`ScreenSpaceReflections`] for upload to the GPU. /// /// For more information on these fields, see the corresponding documentation in diff --git a/crates/bevy_pbr/src/volumetric_fog/mod.rs b/crates/bevy_pbr/src/volumetric_fog/mod.rs index 529127649529c..ff0b913f1d3cc 100644 --- a/crates/bevy_pbr/src/volumetric_fog/mod.rs +++ b/crates/bevy_pbr/src/volumetric_fog/mod.rs @@ -29,8 +29,6 @@ //! //! [Henyey-Greenstein phase function]: https://www.pbr-book.org/4ed/Volume_Scattering/Phase_Functions#TheHenyeyndashGreensteinPhaseFunction -#![expect(deprecated)] - use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Assets, Handle}; use bevy_color::Color; @@ -38,10 +36,7 @@ use bevy_core_pipeline::core_3d::{ graph::{Core3d, Node3d}, prepare_core_3d_depth_textures, }; -use bevy_ecs::{ - bundle::Bundle, component::Component, reflect::ReflectComponent, - schedule::IntoSystemConfigs as _, -}; +use bevy_ecs::{component::Component, reflect::ReflectComponent, schedule::IntoSystemConfigs as _}; use bevy_image::Image; use bevy_math::{ primitives::{Cuboid, Plane3d}, @@ -53,10 +48,10 @@ use bevy_render::{ render_graph::{RenderGraphApp, ViewNodeRunner}, render_resource::{Shader, SpecializedRenderPipelines}, sync_component::SyncComponentPlugin, - view::{InheritedVisibility, ViewVisibility, Visibility}, + view::Visibility, ExtractSchedule, Render, RenderApp, RenderSet, }; -use bevy_transform::components::{GlobalTransform, Transform}; +use bevy_transform::components::Transform; use render::{ VolumetricFogNode, VolumetricFogPipeline, VolumetricFogUniformBuffer, CUBE_MESH, PLANE_MESH, VOLUMETRIC_FOG_HANDLE, @@ -118,32 +113,6 @@ pub struct VolumetricFog { pub step_count: u32, } -#[deprecated(since = "0.15.0", note = "Renamed to `VolumetricFog`")] -pub type VolumetricFogSettings = VolumetricFog; - -/// A convenient [`Bundle`] that contains all components necessary to generate a -/// fog volume. -#[derive(Bundle, Clone, Debug, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `FogVolume` component instead. Inserting it will now also insert the other components required by it automatically." -)] -pub struct FogVolumeBundle { - /// The actual fog volume. - pub fog_volume: FogVolume, - /// Visibility. - pub visibility: Visibility, - /// Inherited visibility. - pub inherited_visibility: InheritedVisibility, - /// View visibility. - pub view_visibility: ViewVisibility, - /// The local transform. Set this to change the position, and scale of the - /// fog's axis-aligned bounding box (AABB). - pub transform: Transform, - /// The global transform. - pub global_transform: GlobalTransform, -} - #[derive(Clone, Component, Debug, Reflect)] #[reflect(Component, Default, Debug)] #[require(Transform, Visibility)] diff --git a/crates/bevy_reflect/src/array.rs b/crates/bevy_reflect/src/array.rs index 481b29648baa3..30cb630bf8889 100644 --- a/crates/bevy_reflect/src/array.rs +++ b/crates/bevy_reflect/src/array.rs @@ -174,11 +174,6 @@ impl DynamicArray { } } - #[deprecated(since = "0.15.0", note = "use from_iter")] - pub fn from_vec(values: Vec) -> Self { - Self::from_iter(values) - } - /// Sets the [type] to be represented by this `DynamicArray`. /// /// # Panics diff --git a/crates/bevy_render/src/lib.rs b/crates/bevy_render/src/lib.rs index c220470e48635..3b5ca2d78258c 100644 --- a/crates/bevy_render/src/lib.rs +++ b/crates/bevy_render/src/lib.rs @@ -36,7 +36,6 @@ pub mod render_phase; pub mod render_resource; pub mod renderer; pub mod settings; -mod spatial_bundle; pub mod storage; pub mod sync_component; pub mod sync_world; @@ -46,7 +45,6 @@ pub mod view; /// The render prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] pub use crate::{ @@ -60,9 +58,8 @@ pub mod prelude { Mesh3d, }, render_resource::Shader, - spatial_bundle::SpatialBundle, texture::ImagePlugin, - view::{InheritedVisibility, Msaa, ViewVisibility, Visibility, VisibilityBundle}, + view::{InheritedVisibility, Msaa, ViewVisibility, Visibility}, ExtractSchedule, }; } diff --git a/crates/bevy_render/src/spatial_bundle.rs b/crates/bevy_render/src/spatial_bundle.rs deleted file mode 100644 index d50bd31dfd3fd..0000000000000 --- a/crates/bevy_render/src/spatial_bundle.rs +++ /dev/null @@ -1,72 +0,0 @@ -#![expect(deprecated)] -use bevy_ecs::prelude::Bundle; -use bevy_transform::prelude::{GlobalTransform, Transform}; - -use crate::view::{InheritedVisibility, ViewVisibility, Visibility}; - -/// A [`Bundle`] that allows the correct positional rendering of an entity. -/// -/// It consists of transform components, -/// controlling position, rotation and scale of the entity, -/// but also visibility components, -/// which determine whether the entity is visible or not. -/// -/// Parent-child hierarchies of entities must contain -/// all the [`Component`]s in this `Bundle` -/// to be rendered correctly. -/// -/// [`Component`]: bevy_ecs::component::Component -#[derive(Bundle, Clone, Debug, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `Transform` and `Visibility` components instead. - Inserting `Transform` will now also insert a `GlobalTransform` automatically. - Inserting 'Visibility' will now also insert `InheritedVisibility` and `ViewVisibility` automatically." -)] -pub struct SpatialBundle { - /// The visibility of the entity. - pub visibility: Visibility, - /// The inherited visibility of the entity. - pub inherited_visibility: InheritedVisibility, - /// The view visibility of the entity. - pub view_visibility: ViewVisibility, - /// The transform of the entity. - pub transform: Transform, - /// The global transform of the entity. - pub global_transform: GlobalTransform, -} - -impl SpatialBundle { - /// Creates a new [`SpatialBundle`] from a [`Transform`]. - /// - /// This initializes [`GlobalTransform`] as identity, and visibility as visible - #[inline] - pub const fn from_transform(transform: Transform) -> Self { - SpatialBundle { - transform, - ..Self::INHERITED_IDENTITY - } - } - - /// A [`SpatialBundle`] with inherited visibility and identity transform. - pub const INHERITED_IDENTITY: Self = SpatialBundle { - visibility: Visibility::Inherited, - inherited_visibility: InheritedVisibility::HIDDEN, - view_visibility: ViewVisibility::HIDDEN, - transform: Transform::IDENTITY, - global_transform: GlobalTransform::IDENTITY, - }; - - /// An invisible [`SpatialBundle`] with identity transform. - pub const HIDDEN_IDENTITY: Self = SpatialBundle { - visibility: Visibility::Hidden, - ..Self::INHERITED_IDENTITY - }; -} - -impl From for SpatialBundle { - #[inline] - fn from(transform: Transform) -> Self { - Self::from_transform(transform) - } -} diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index e2e439ec79699..79aca012315da 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - mod range; mod render_layers; @@ -168,28 +166,6 @@ impl ViewVisibility { } } -/// A [`Bundle`] of the [`Visibility`], [`InheritedVisibility`], and [`ViewVisibility`] -/// [`Component`]s, which describe the visibility of an entity. -/// -/// * To show or hide an entity, you should set its [`Visibility`]. -/// * To get the inherited visibility of an entity, you should get its [`InheritedVisibility`]. -/// * For visibility hierarchies to work correctly, you must have both all of [`Visibility`], [`InheritedVisibility`], and [`ViewVisibility`]. -/// * ~~You may use the [`VisibilityBundle`] to guarantee this.~~ [`VisibilityBundle`] is now deprecated. -/// [`InheritedVisibility`] and [`ViewVisibility`] are automatically inserted whenever [`Visibility`] is inserted. -#[derive(Bundle, Debug, Clone, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `Visibility` component instead. Inserting it will now also insert `InheritedVisibility` and `ViewVisibility` automatically." -)] -pub struct VisibilityBundle { - /// The visibility of the entity. - pub visibility: Visibility, - // The inherited visibility of the entity. - pub inherited_visibility: InheritedVisibility, - // The computed visibility of the entity. - pub view_visibility: ViewVisibility, -} - /// Use this component to opt-out of built-in frustum culling for entities, see /// [`Frustum`]. /// diff --git a/crates/bevy_scene/src/bundle.rs b/crates/bevy_scene/src/bundle.rs index 0024b2f77729b..b9a3b5a67eedb 100644 --- a/crates/bevy_scene/src/bundle.rs +++ b/crates/bevy_scene/src/bundle.rs @@ -1,80 +1,17 @@ -#![expect(deprecated)] - +use crate::{DynamicSceneRoot, InstanceId, SceneRoot, SceneSpawner}; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - bundle::Bundle, change_detection::ResMut, entity::Entity, prelude::{Changed, Component, Without}, system::{Commands, Query}, }; -#[cfg(feature = "bevy_render")] -use bevy_render::prelude::{InheritedVisibility, ViewVisibility, Visibility}; -use bevy_transform::components::{GlobalTransform, Transform}; - -use crate::{DynamicSceneRoot, InstanceId, SceneRoot, SceneSpawner}; /// [`InstanceId`] of a spawned scene. It can be used with the [`SceneSpawner`] to /// interact with the spawned scene. #[derive(Component, Deref, DerefMut)] pub struct SceneInstance(pub(crate) InstanceId); -/// A component bundle for a [`Scene`](crate::Scene) root. -/// -/// The scene from `scene` will be spawned as a child of the entity with this component. -/// Once it's spawned, the entity will have a [`SceneInstance`] component. -#[derive(Default, Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `SceneRoot` component instead. Inserting `SceneRoot` will also insert the other components required by scenes automatically." -)] -pub struct SceneBundle { - /// Handle to the scene to spawn. - pub scene: SceneRoot, - /// Transform of the scene root entity. - pub transform: Transform, - /// Global transform of the scene root entity. - pub global_transform: GlobalTransform, - - /// User-driven visibility of the scene root entity. - #[cfg(feature = "bevy_render")] - pub visibility: Visibility, - /// Inherited visibility of the scene root entity. - #[cfg(feature = "bevy_render")] - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed visibility of the scene root entity for rendering. - #[cfg(feature = "bevy_render")] - pub view_visibility: ViewVisibility, -} - -/// A component bundle for a [`DynamicScene`](crate::DynamicScene) root. -/// -/// The dynamic scene from `scene` will be spawn as a child of the entity with this component. -/// Once it's spawned, the entity will have a [`SceneInstance`] component. -#[derive(Default, Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `DynamicSceneRoot` component instead. Inserting `DynamicSceneRoot` will also insert the other components required by scenes automatically." -)] -pub struct DynamicSceneBundle { - /// Handle to the scene to spawn. - pub scene: DynamicSceneRoot, - /// Transform of the scene root entity. - pub transform: Transform, - /// Global transform of the scene root entity. - pub global_transform: GlobalTransform, - - /// User-driven visibility of the scene root entity. - #[cfg(feature = "bevy_render")] - pub visibility: Visibility, - /// Inherited visibility of the scene root entity. - #[cfg(feature = "bevy_render")] - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed visibility of the scene root entity for rendering. - #[cfg(feature = "bevy_render")] - pub view_visibility: ViewVisibility, -} - /// System that will spawn scenes from the [`SceneRoot`] and [`DynamicSceneRoot`] components. pub fn scene_spawner( mut commands: Commands, diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index 8a21b2040d78e..1cf226beac603 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -41,12 +41,11 @@ pub use scene_spawner::*; /// The scene prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] pub use crate::{ - DynamicScene, DynamicSceneBuilder, DynamicSceneBundle, DynamicSceneRoot, Scene, - SceneBundle, SceneFilter, SceneRoot, SceneSpawner, + DynamicScene, DynamicSceneBuilder, DynamicSceneRoot, Scene, SceneFilter, SceneRoot, + SceneSpawner, }; } diff --git a/crates/bevy_sprite/src/bundle.rs b/crates/bevy_sprite/src/bundle.rs deleted file mode 100644 index fdc2f8ed515d1..0000000000000 --- a/crates/bevy_sprite/src/bundle.rs +++ /dev/null @@ -1,31 +0,0 @@ -#![expect(deprecated)] -use crate::Sprite; -use bevy_ecs::bundle::Bundle; -use bevy_render::{ - sync_world::SyncToRenderWorld, - view::{InheritedVisibility, ViewVisibility, Visibility}, -}; -use bevy_transform::components::{GlobalTransform, Transform}; - -/// A [`Bundle`] of components for drawing a single sprite from an image. -#[derive(Bundle, Clone, Debug, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `Sprite` component instead. Inserting it will now also insert `Transform` and `Visibility` automatically." -)] -pub struct SpriteBundle { - /// Specifies the rendering properties of the sprite, such as color tint and flip. - pub sprite: Sprite, - /// The local transform of the sprite, relative to its parent. - pub transform: Transform, - /// The absolute transform of the sprite. This should generally not be written to directly. - pub global_transform: GlobalTransform, - /// User indication of whether an entity is visible - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Marker component that indicates that its entity needs to be synchronized to the render world - pub sync: SyncToRenderWorld, -} diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index 8ea962eec291c..4f2a5d5e7de2b 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -11,7 +11,6 @@ extern crate alloc; -mod bundle; mod dynamic_texture_atlas_builder; mod mesh2d; #[cfg(feature = "bevy_sprite_picking_backend")] @@ -25,20 +24,17 @@ mod texture_slice; /// The sprite prelude. /// /// This includes the most common types in this crate, re-exported for your convenience. -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] pub use crate::{ - bundle::SpriteBundle, sprite::{Sprite, SpriteImageMode}, texture_atlas::{TextureAtlas, TextureAtlasLayout, TextureAtlasSources}, texture_slice::{BorderRect, SliceScaleMode, TextureSlice, TextureSlicer}, - ColorMaterial, ColorMesh2dBundle, MeshMaterial2d, TextureAtlasBuilder, + ColorMaterial, MeshMaterial2d, TextureAtlasBuilder, }; } use bevy_reflect::{std_traits::ReflectDefault, Reflect}; -pub use bundle::*; pub use dynamic_texture_atlas_builder::*; pub use mesh2d::*; pub use render::*; diff --git a/crates/bevy_sprite/src/mesh2d/color_material.rs b/crates/bevy_sprite/src/mesh2d/color_material.rs index 8c3267c40ba4d..e844fc3a997a8 100644 --- a/crates/bevy_sprite/src/mesh2d/color_material.rs +++ b/crates/bevy_sprite/src/mesh2d/color_material.rs @@ -1,6 +1,4 @@ -#![expect(deprecated)] - -use crate::{AlphaMode2d, Material2d, Material2dPlugin, MaterialMesh2dBundle}; +use crate::{AlphaMode2d, Material2d, Material2dPlugin}; use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Asset, AssetApp, Assets, Handle}; use bevy_color::{Alpha, Color, ColorToComponents, LinearRgba}; @@ -157,10 +155,3 @@ impl Material2d for ColorMaterial { self.alpha_mode } } - -/// A component bundle for entities with a [`Mesh2d`](crate::Mesh2d) and a [`ColorMaterial`]. -#[deprecated( - since = "0.15.0", - note = "Use the `Mesh3d` and `MeshMaterial3d` components instead. Inserting them will now also insert the other components required by them automatically." -)] -pub type ColorMesh2dBundle = MaterialMesh2dBundle; diff --git a/crates/bevy_sprite/src/mesh2d/material.rs b/crates/bevy_sprite/src/mesh2d/material.rs index 4eb064de206b4..be644816b7436 100644 --- a/crates/bevy_sprite/src/mesh2d/material.rs +++ b/crates/bevy_sprite/src/mesh2d/material.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - use crate::{ DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances, SetMesh2dBindGroup, SetMesh2dViewBindGroup, @@ -35,10 +33,9 @@ use bevy_render::{ SpecializedMeshPipeline, SpecializedMeshPipelineError, SpecializedMeshPipelines, }, renderer::RenderDevice, - view::{ExtractedView, InheritedVisibility, Msaa, ViewVisibility, Visibility}, + view::{ExtractedView, Msaa, ViewVisibility}, Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; -use bevy_transform::components::{GlobalTransform, Transform}; use bevy_utils::tracing::error; use core::{hash::Hash, marker::PhantomData}; use derive_more::derive::From; @@ -673,36 +670,3 @@ impl RenderAsset for PreparedMaterial2d { } } } - -/// A component bundle for entities with a [`Mesh2d`] and a [`MeshMaterial2d`]. -#[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `Mesh2d` and `MeshMaterial2d` components instead. Inserting them will now also insert the other components required by them automatically." -)] -pub struct MaterialMesh2dBundle { - pub mesh: Mesh2d, - pub material: MeshMaterial2d, - pub transform: Transform, - pub global_transform: GlobalTransform, - /// User indication of whether an entity is visible - pub visibility: Visibility, - // Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - // Indication of whether an entity is visible in any view. - pub view_visibility: ViewVisibility, -} - -impl Default for MaterialMesh2dBundle { - fn default() -> Self { - Self { - mesh: Default::default(), - material: Default::default(), - transform: Default::default(), - global_transform: Default::default(), - visibility: Default::default(), - inherited_visibility: Default::default(), - view_visibility: Default::default(), - } - } -} diff --git a/crates/bevy_sprite/src/texture_atlas_builder.rs b/crates/bevy_sprite/src/texture_atlas_builder.rs index b59c9423b90e0..b2cffe58c4758 100644 --- a/crates/bevy_sprite/src/texture_atlas_builder.rs +++ b/crates/bevy_sprite/src/texture_atlas_builder.rs @@ -155,16 +155,6 @@ impl<'a> TextureAtlasBuilder<'a> { } } - #[deprecated( - since = "0.14.0", - note = "TextureAtlasBuilder::finish() was not idiomatic. Use TextureAtlasBuilder::build() instead." - )] - pub fn finish( - &mut self, - ) -> Result<(TextureAtlasLayout, TextureAtlasSources, Image), TextureAtlasBuilderError> { - self.build() - } - /// Consumes the builder, and returns the newly created texture atlas and /// the associated atlas layout. /// diff --git a/crates/bevy_text/src/lib.rs b/crates/bevy_text/src/lib.rs index 6b85675c94e03..54b4e53e25fca 100644 --- a/crates/bevy_text/src/lib.rs +++ b/crates/bevy_text/src/lib.rs @@ -61,9 +61,6 @@ pub use text_access::*; /// /// This includes the most common types in this crate, re-exported for your convenience. pub mod prelude { - #[doc(hidden)] - #[allow(deprecated)] - pub use crate::Text2dBundle; #[doc(hidden)] pub use crate::{ Font, JustifyText, LineBreak, Text2d, Text2dReader, Text2dWriter, TextColor, TextError, diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index 03dd84d073aa0..ce9c743827a06 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -31,18 +31,6 @@ use bevy_transform::prelude::GlobalTransform; use bevy_utils::HashSet; use bevy_window::{PrimaryWindow, Window}; -/// [`Text2dBundle`] was removed in favor of required components. -/// The core component is now [`Text2d`] which can contain a single text segment. -/// Indexed access to segments can be done with the new [`Text2dReader`] and [`Text2dWriter`] system params. -/// Additional segments can be added through children with [`TextSpan`](crate::text::TextSpan). -/// Text configuration can be done with [`TextLayout`], [`TextFont`] and [`TextColor`], -/// while sprite-related configuration uses [`TextBounds`] and [`Anchor`] components. -#[deprecated( - since = "0.15.0", - note = "Text2dBundle has been migrated to required components. Follow the documentation for more information." -)] -pub struct Text2dBundle {} - /// The top-level 2D text component. /// /// Adding `Text2d` to an entity will pull in required components for setting up 2d text. diff --git a/crates/bevy_transform/src/bundles.rs b/crates/bevy_transform/src/bundles.rs deleted file mode 100644 index 16a36441a4396..0000000000000 --- a/crates/bevy_transform/src/bundles.rs +++ /dev/null @@ -1,66 +0,0 @@ -#![expect(deprecated)] -use bevy_ecs::bundle::Bundle; - -use crate::prelude::{GlobalTransform, Transform}; - -/// A [`Bundle`] of the [`Transform`] and [`GlobalTransform`] -/// [`Component`](bevy_ecs::component::Component)s, which describe the position of an entity. -/// -/// * To place or move an entity, you should set its [`Transform`]. -/// * To get the global transform of an entity, you should get its [`GlobalTransform`]. -/// * For transform hierarchies to work correctly, you must have both a [`Transform`] and a [`GlobalTransform`]. -/// * ~You may use the [`TransformBundle`] to guarantee this.~ -/// [`TransformBundle`] is now deprecated. -/// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted. -/// -/// ## [`Transform`] and [`GlobalTransform`] -/// -/// [`Transform`] is the position of an entity relative to its parent position, or the reference -/// frame if it doesn't have a parent. -/// -/// [`GlobalTransform`] is the position of an entity relative to the reference frame. -/// -/// [`GlobalTransform`] is updated from [`Transform`] by systems in the system set -/// [`TransformPropagate`](crate::TransformSystem::TransformPropagate). -/// -/// This system runs during [`PostUpdate`](bevy_app::PostUpdate). If you -/// update the [`Transform`] of an entity in this schedule or after, you will notice a 1 frame lag -/// before the [`GlobalTransform`] is updated. -#[derive(Clone, Copy, Debug, Default, Bundle)] -#[deprecated( - since = "0.15.0", - note = "Use the `Transform` component instead. Inserting `Transform` will now also insert a `GlobalTransform` automatically." -)] -pub struct TransformBundle { - /// The transform of the entity. - pub local: Transform, - /// The global transform of the entity. - pub global: GlobalTransform, -} - -impl TransformBundle { - /// An identity [`TransformBundle`] with no translation, rotation, and a scale of 1 on all axes. - pub const IDENTITY: Self = TransformBundle { - local: Transform::IDENTITY, - global: GlobalTransform::IDENTITY, - }; - - /// Creates a new [`TransformBundle`] from a [`Transform`]. - /// - /// This initializes [`GlobalTransform`] as identity, to be updated later by the - /// [`bevy_app::PostUpdate`] schedule. - #[inline] - pub const fn from_transform(transform: Transform) -> Self { - TransformBundle { - local: transform, - ..Self::IDENTITY - } - } -} - -impl From for TransformBundle { - #[inline] - fn from(transform: Transform) -> Self { - Self::from_transform(transform) - } -} diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index 9a9961c60483a..5fe08fe66c400 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -18,8 +18,6 @@ use { /// /// * To get the global transform of an entity, you should get its [`GlobalTransform`]. /// * For transform hierarchies to work correctly, you must have both a [`Transform`] and a [`GlobalTransform`]. -/// * ~You may use the [`TransformBundle`](crate::bundles::TransformBundle) to guarantee this.~ -/// [`TransformBundle`](crate::bundles::TransformBundle) is now deprecated. /// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted. /// /// ## [`Transform`] and [`GlobalTransform`] diff --git a/crates/bevy_transform/src/components/transform.rs b/crates/bevy_transform/src/components/transform.rs index 9522d3de37d37..e266ab3648d72 100644 --- a/crates/bevy_transform/src/components/transform.rs +++ b/crates/bevy_transform/src/components/transform.rs @@ -13,8 +13,6 @@ use { /// * To place or move an entity, you should set its [`Transform`]. /// * To get the global transform of an entity, you should get its [`GlobalTransform`]. /// * To be displayed, an entity must have both a [`Transform`] and a [`GlobalTransform`]. -/// * ~You may use the [`TransformBundle`](crate::bundles::TransformBundle) to guarantee this.~ -/// [`TransformBundle`](crate::bundles::TransformBundle) is now deprecated. /// [`GlobalTransform`] is automatically inserted whenever [`Transform`] is inserted. /// /// ## [`Transform`] and [`GlobalTransform`] diff --git a/crates/bevy_transform/src/lib.rs b/crates/bevy_transform/src/lib.rs index 8aed69e08b4ce..309d3649c1458 100644 --- a/crates/bevy_transform/src/lib.rs +++ b/crates/bevy_transform/src/lib.rs @@ -10,10 +10,6 @@ pub mod commands; /// The basic components of the transform crate pub mod components; -/// Transform related bundles -#[cfg(feature = "bevy-support")] -pub mod bundles; - /// Transform related traits pub mod traits; @@ -33,7 +29,6 @@ pub mod systems; /// /// This includes the most common types in this crate, re-exported for your convenience. #[doc(hidden)] -#[expect(deprecated)] pub mod prelude { #[doc(hidden)] pub use crate::components::*; @@ -41,7 +36,6 @@ pub mod prelude { #[cfg(feature = "bevy-support")] #[doc(hidden)] pub use crate::{ - bundles::TransformBundle, commands::BuildChildrenTransformExt, helper::TransformHelper, plugins::{TransformPlugin, TransformSystem}, diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index 9b8945f7b96ee..8dfda7ef9dfda 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -12,7 +12,6 @@ //! This UI is laid out with the Flexbox and CSS Grid layout models (see ) pub mod measurement; -pub mod node_bundles; pub mod ui_material; pub mod update; pub mod widget; @@ -46,16 +45,12 @@ use widget::{ImageNode, ImageNodeSize}; /// /// This includes the most common types in this crate, re-exported for your convenience. pub mod prelude { - #[allow(deprecated)] - #[doc(hidden)] - pub use crate::widget::TextBundle; #[doc(hidden)] pub use crate::widget::{Text, TextUiReader, TextUiWriter}; #[doc(hidden)] pub use { crate::{ geometry::*, - node_bundles::*, ui_material::*, ui_node::*, widget::{Button, ImageNode, Label}, diff --git a/crates/bevy_ui/src/node_bundles.rs b/crates/bevy_ui/src/node_bundles.rs deleted file mode 100644 index 4d318c78c46fa..0000000000000 --- a/crates/bevy_ui/src/node_bundles.rs +++ /dev/null @@ -1,227 +0,0 @@ -//! This module contains basic node bundles used to build UIs -#![expect(deprecated)] - -use crate::{ - widget::{Button, ImageNodeSize}, - BackgroundColor, BorderColor, BorderRadius, ComputedNode, ContentSize, FocusPolicy, ImageNode, - Interaction, MaterialNode, Node, ScrollPosition, UiMaterial, ZIndex, -}; -use bevy_ecs::bundle::Bundle; -use bevy_render::view::{InheritedVisibility, ViewVisibility, Visibility}; -use bevy_transform::prelude::{GlobalTransform, Transform}; - -/// The basic UI node. -/// -/// Contains the [`Node`] component and other components required to make a container. -/// -/// See [`node_bundles`](crate::node_bundles) for more specialized bundles like [`ImageBundle`]. -#[derive(Bundle, Clone, Debug, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `Node` component instead. Inserting `Node` will also insert the other components required automatically." -)] -pub struct NodeBundle { - /// Controls the layout (size and position) of the node and its children - /// This also affect how the node is drawn/painted. - pub node: Node, - /// Describes the logical size of the node - pub computed_node: ComputedNode, - /// The background color, which serves as a "fill" for this node - pub background_color: BackgroundColor, - /// The color of the Node's border - pub border_color: BorderColor, - /// The border radius of the node - pub border_radius: BorderRadius, - /// Whether this node should block interaction with lower nodes - pub focus_policy: FocusPolicy, - /// The scroll position of the node, - pub scroll_position: ScrollPosition, - /// The transform of the node - /// - /// This component is automatically managed by the UI layout system. - /// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component. - pub transform: Transform, - /// The global transform of the node - /// - /// This component is automatically updated by the [`TransformPropagate`](`bevy_transform::TransformSystem::TransformPropagate`) systems. - /// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component. - pub global_transform: GlobalTransform, - /// Describes the visibility properties of the node - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Indicates the depth at which the node should appear in the UI - pub z_index: ZIndex, -} - -/// A UI node that is an image -#[derive(Bundle, Debug, Default)] -#[deprecated( - since = "0.15.0", - note = "Use the `ImageNode` component instead. Inserting `ImageNode` will also insert the other components required automatically." -)] -pub struct ImageBundle { - /// Describes the logical size of the node - pub computed_node: ComputedNode, - /// Controls the layout (size and position) of the node and its children - /// This also affects how the node is drawn/painted. - pub node: Node, - /// The calculated size based on the given image - pub calculated_size: ContentSize, - /// The image of the node. - /// - /// To tint the image, change the `color` field of this component. - pub image: ImageNode, - /// The color of the background that will fill the containing node. - pub background_color: BackgroundColor, - /// The border radius of the node - pub border_radius: BorderRadius, - /// The size of the image in pixels - /// - /// This component is set automatically - pub image_size: ImageNodeSize, - /// Whether this node should block interaction with lower nodes - pub focus_policy: FocusPolicy, - /// The transform of the node - /// - /// This component is automatically managed by the UI layout system. - /// To alter the position of the `ImageBundle`, use the properties of the [`Node`] component. - pub transform: Transform, - /// The global transform of the node - /// - /// This component is automatically updated by the [`TransformPropagate`](`bevy_transform::TransformSystem::TransformPropagate`) systems. - pub global_transform: GlobalTransform, - /// Describes the visibility properties of the node - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Indicates the depth at which the node should appear in the UI - pub z_index: ZIndex, -} - -/// A UI node that is a button -#[derive(Bundle, Clone, Debug)] -#[deprecated( - since = "0.15.0", - note = "Use the `Button` component instead. Inserting `Button` will also insert the other components required automatically." -)] -pub struct ButtonBundle { - /// Describes the logical size of the node - pub computed_node: ComputedNode, - /// Marker component that signals this node is a button - pub button: Button, - /// Controls the layout (size and position) of the node and its children - /// Also affect how the node is drawn/painted. - pub node: Node, - /// Describes whether and how the button has been interacted with by the input - pub interaction: Interaction, - /// Whether this node should block interaction with lower nodes - pub focus_policy: FocusPolicy, - /// The color of the Node's border - pub border_color: BorderColor, - /// The border radius of the node - pub border_radius: BorderRadius, - /// The image of the node - pub image: ImageNode, - /// The background color that will fill the containing node - pub background_color: BackgroundColor, - /// The transform of the node - /// - /// This component is automatically managed by the UI layout system. - /// To alter the position of the `ButtonBundle`, use the properties of the [`Node`] component. - pub transform: Transform, - /// The global transform of the node - /// - /// This component is automatically updated by the [`TransformPropagate`](`bevy_transform::TransformSystem::TransformPropagate`) systems. - pub global_transform: GlobalTransform, - /// Describes the visibility properties of the node - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Indicates the depth at which the node should appear in the UI - pub z_index: ZIndex, -} - -impl Default for ButtonBundle { - fn default() -> Self { - Self { - node: Default::default(), - computed_node: Default::default(), - button: Default::default(), - interaction: Default::default(), - focus_policy: FocusPolicy::Block, - border_color: Default::default(), - border_radius: Default::default(), - image: Default::default(), - background_color: Default::default(), - transform: Default::default(), - global_transform: Default::default(), - visibility: Default::default(), - inherited_visibility: Default::default(), - view_visibility: Default::default(), - z_index: Default::default(), - } - } -} - -/// A UI node that is rendered using a [`UiMaterial`] -/// -/// Adding a `BackgroundColor` component to an entity with this bundle will ignore the custom -/// material and use the background color instead. -#[derive(Bundle, Clone, Debug)] -#[deprecated( - since = "0.15.0", - note = "Use the `MaterialNode` component instead. Inserting `MaterialNode` will also insert the other components required automatically." -)] -pub struct MaterialNodeBundle { - /// Describes the logical size of the node - pub computed_node: ComputedNode, - /// Controls the layout (size and position) of the node and its children - /// Also affects how the node is drawn/painted. - pub node: Node, - /// The [`UiMaterial`] used to render the node. - pub material: MaterialNode, - /// Whether this node should block interaction with lower nodes - pub focus_policy: FocusPolicy, - /// The transform of the node - /// - /// This field is automatically managed by the UI layout system. - /// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component. - pub transform: Transform, - /// The global transform of the node - /// - /// This field is automatically managed by the UI layout system. - /// To alter the position of the `NodeBundle`, use the properties of the [`Node`] component. - pub global_transform: GlobalTransform, - /// Describes the visibility properties of the node - pub visibility: Visibility, - /// Inherited visibility of an entity. - pub inherited_visibility: InheritedVisibility, - /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering - pub view_visibility: ViewVisibility, - /// Indicates the depth at which the node should appear in the UI - pub z_index: ZIndex, -} - -impl Default for MaterialNodeBundle { - fn default() -> Self { - Self { - node: Default::default(), - computed_node: Default::default(), - material: Default::default(), - focus_policy: Default::default(), - transform: Default::default(), - global_transform: Default::default(), - visibility: Default::default(), - inherited_visibility: Default::default(), - view_visibility: Default::default(), - z_index: Default::default(), - } - } -} diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index 1007a4cc785a2..4ac8ab971e835 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -48,18 +48,6 @@ impl Default for TextNodeFlags { } } -/// [`TextBundle`] was removed in favor of required components. -/// The core component is now [`Text`] which can contain a single text segment. -/// Indexed access to segments can be done with the new [`TextUiReader`] and [`TextUiWriter`] system params. -/// Additional segments can be added through children with [`TextSpan`](bevy_text::TextSpan). -/// Text configuration can be done with [`TextLayout`], [`TextFont`] and [`TextColor`], -/// while node-related configuration uses [`TextNodeFlags`] component. -#[deprecated( - since = "0.15.0", - note = "TextBundle has been migrated to required components. Follow the documentation for more information." -)] -pub struct TextBundle {} - /// The top-level UI text component. /// /// Adding [`Text`] to an entity will pull in required components for setting up a UI text node. diff --git a/crates/bevy_utils/src/lib.rs b/crates/bevy_utils/src/lib.rs index 1865f62cf999a..4970d7d144789 100644 --- a/crates/bevy_utils/src/lib.rs +++ b/crates/bevy_utils/src/lib.rs @@ -115,18 +115,6 @@ impl BuildHasher for FixedState { /// but it will not be stable between multiple executions of the program. pub type HashMap = hashbrown::HashMap>; -/// A stable hash map implementing aHash, a high speed keyed hashing algorithm -/// intended for use in in-memory hashmaps. -/// -/// Unlike [`HashMap`] the iteration order stability extends between executions -/// using the same Bevy version on the same device. -/// -/// aHash is designed for performance and is NOT cryptographically secure. -#[deprecated( - note = "Will be required to use the hash library of your choice. Alias for: hashbrown::HashMap" -)] -pub type StableHashMap = hashbrown::HashMap; - /// A [`HashSet`][hashbrown::HashSet] implementing aHash, a high /// speed keyed hashing algorithm intended for use in in-memory hashmaps. /// @@ -137,18 +125,6 @@ pub type StableHashMap = hashbrown::HashMap; /// but it will not be stable between multiple executions of the program. pub type HashSet = hashbrown::HashSet>; -/// A stable hash set implementing aHash, a high speed keyed hashing algorithm -/// intended for use in in-memory hashmaps. -/// -/// Unlike [`HashMap`] the iteration order stability extends between executions -/// using the same Bevy version on the same device. -/// -/// aHash is designed for performance and is NOT cryptographically secure. -#[deprecated( - note = "Will be required to use the hash library of your choice. Alias for: hashbrown::HashSet" -)] -pub type StableHashSet = hashbrown::HashSet; - /// A pre-hashed value of a specific type. Pre-hashing enables memoization of hashes that are expensive to compute. /// /// It also enables faster [`PartialEq`] comparisons by short circuiting on hash equality. diff --git a/errors/B0004.md b/errors/B0004.md index 9344d47b633ad..190898ff17970 100644 --- a/errors/B0004.md +++ b/errors/B0004.md @@ -34,7 +34,7 @@ fn setup_cube( // cube parent.spawn(( Mesh3d(meshes.add(Cuboid::default())), - MeshMaterial3d(materials.add(Color::rgb(0.8, 0.7, 0.6))), + MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))), Transform::from_xyz(0.0, 0.5, 0.0), )); }); @@ -77,7 +77,7 @@ fn setup_cube( // cube parent.spawn(( Mesh3d(meshes.add(Cuboid::default())), - MeshMaterial3d(materials.add(Color::rgb(0.8, 0.7, 0.6))), + MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))), Transform::from_xyz(0.0, 0.5, 0.0), )); }); diff --git a/examples/ecs/dynamic.rs b/examples/ecs/dynamic.rs index 7cec3a47fdd89..19405a2b10a09 100644 --- a/examples/ecs/dynamic.rs +++ b/examples/ecs/dynamic.rs @@ -148,9 +148,7 @@ fn main() { let mut builder = QueryBuilder::::new(&mut world); parse_query(rest, &mut builder, &component_names); let mut query = builder.build(); - query.iter_mut(&mut world).for_each(|filtered_entity| { - #[allow(deprecated)] let terms = filtered_entity .access() .component_reads_and_writes() From bd09393010af8839e6c433cb2630b3985f7d2f17 Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Wed, 1 Jan 2025 20:11:26 -0500 Subject: [PATCH 2/6] remove deprecated in 0.15 items --- crates/bevy_audio/src/audio.rs | 2 - .../src/core_2d/camera_2d.rs | 8 +--- .../bevy_core_pipeline/src/motion_blur/mod.rs | 1 - crates/bevy_core_pipeline/src/taa/mod.rs | 2 +- .../bevy_ecs/src/observer/entity_observer.rs | 2 +- crates/bevy_ecs/src/system/commands/mod.rs | 32 -------------- crates/bevy_ecs/src/world/mod.rs | 43 ------------------- crates/bevy_pbr/src/meshlet/mod.rs | 15 ++----- crates/bevy_pbr/src/ssao/mod.rs | 2 +- crates/bevy_pbr/src/ssr/mod.rs | 1 - crates/bevy_pbr/src/volumetric_fog/mod.rs | 1 - crates/bevy_sprite/src/lib.rs | 1 - crates/bevy_sprite/src/mesh2d/material.rs | 1 - crates/bevy_ui/src/lib.rs | 3 -- 14 files changed, 8 insertions(+), 106 deletions(-) diff --git a/crates/bevy_audio/src/audio.rs b/crates/bevy_audio/src/audio.rs index 809c5e07e8ef5..1d0149381bd57 100644 --- a/crates/bevy_audio/src/audio.rs +++ b/crates/bevy_audio/src/audio.rs @@ -1,5 +1,3 @@ -#![expect(deprecated)] - use crate::{AudioSource, Decodable, Volume}; use bevy_asset::{Asset, Handle}; use bevy_ecs::prelude::*; diff --git a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs index fc05d3529fbf4..f7ff95811430f 100644 --- a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs +++ b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs @@ -8,9 +8,7 @@ use bevy_render::{ camera::{ Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph, OrthographicProjection, Projection, - }, - extract_component::ExtractComponent, - primitives::Frustum, + }, extract_component::ExtractComponent, primitives::Frustum, sync_world::SyncToRenderWorld, view::{Msaa, VisibleEntities} }; use bevy_transform::prelude::{GlobalTransform, Transform}; @@ -29,10 +27,6 @@ use bevy_transform::prelude::{GlobalTransform, Transform}; pub struct Camera2d; #[derive(Bundle, Clone)] -#[deprecated( - since = "0.15.0", - note = "Use the `Camera2d` component instead. Inserting it will now also insert the other components required by it automatically." -)] pub struct Camera2dBundle { pub camera: Camera, pub camera_render_graph: CameraRenderGraph, diff --git a/crates/bevy_core_pipeline/src/motion_blur/mod.rs b/crates/bevy_core_pipeline/src/motion_blur/mod.rs index d1f5efea86c3a..e4839b25b44c9 100644 --- a/crates/bevy_core_pipeline/src/motion_blur/mod.rs +++ b/crates/bevy_core_pipeline/src/motion_blur/mod.rs @@ -9,7 +9,6 @@ use crate::{ use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Handle}; use bevy_ecs::{ - bundle::Bundle, component::{require, Component}, query::With, reflect::ReflectComponent, diff --git a/crates/bevy_core_pipeline/src/taa/mod.rs b/crates/bevy_core_pipeline/src/taa/mod.rs index 9eb8ab10dbc96..7698a15623033 100644 --- a/crates/bevy_core_pipeline/src/taa/mod.rs +++ b/crates/bevy_core_pipeline/src/taa/mod.rs @@ -8,7 +8,7 @@ use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, Handle}; use bevy_diagnostic::FrameCount; use bevy_ecs::{ - prelude::{require, Bundle, Component, Entity, ReflectComponent}, + prelude::{require, Component, Entity, ReflectComponent}, query::{QueryItem, With}, schedule::IntoSystemConfigs, system::{Commands, Query, Res, ResMut, Resource}, diff --git a/crates/bevy_ecs/src/observer/entity_observer.rs b/crates/bevy_ecs/src/observer/entity_observer.rs index ee94cfa62a73e..e86f6814a8ff6 100644 --- a/crates/bevy_ecs/src/observer/entity_observer.rs +++ b/crates/bevy_ecs/src/observer/entity_observer.rs @@ -50,7 +50,7 @@ impl Component for ObservedBy { /// Trait that holds functions for configuring interaction with observers during entity cloning. pub trait CloneEntityWithObserversExt { - /// Sets the option to automatically add cloned entities to the obsevers targeting source entity. + /// Sets the option to automatically add cloned entities to the observers targeting source entity. fn add_observers(&mut self, add_observers: bool) -> &mut Self; } diff --git a/crates/bevy_ecs/src/system/commands/mod.rs b/crates/bevy_ecs/src/system/commands/mod.rs index c5148a57bc07b..519641b1e30c6 100644 --- a/crates/bevy_ecs/src/system/commands/mod.rs +++ b/crates/bevy_ecs/src/system/commands/mod.rs @@ -315,38 +315,6 @@ impl<'w, 's> Commands<'w, 's> { } } - /// Pushes a [`Command`] to the queue for creating a new [`Entity`] if the given one does not exists, - /// and returns its corresponding [`EntityCommands`]. - /// - /// This method silently fails by returning [`EntityCommands`] - /// even if the given `Entity` cannot be spawned. - /// - /// See [`World::get_or_spawn`] for more details. - /// - /// # Note - /// - /// Spawning a specific `entity` value is rarely the right choice. Most apps should favor - /// [`Commands::spawn`]. This method should generally only be used for sharing entities across - /// apps, and only when they have a scheme worked out to share an ID space (which doesn't happen - /// by default). - #[deprecated(since = "0.15.0", note = "use Commands::spawn instead")] - #[track_caller] - pub fn get_or_spawn(&mut self, entity: Entity) -> EntityCommands { - #[cfg(feature = "track_location")] - let caller = Location::caller(); - self.queue(move |world: &mut World| { - world.get_or_spawn_with_caller( - entity, - #[cfg(feature = "track_location")] - caller, - ); - }); - EntityCommands { - entity, - commands: self.reborrow(), - } - } - /// Pushes a [`Command`] to the queue for creating a new entity with the given [`Bundle`]'s components, /// and returns its corresponding [`EntityCommands`]. /// diff --git a/crates/bevy_ecs/src/world/mod.rs b/crates/bevy_ecs/src/world/mod.rs index 59eafeff93560..ac3b06cd02d8e 100644 --- a/crates/bevy_ecs/src/world/mod.rs +++ b/crates/bevy_ecs/src/world/mod.rs @@ -877,49 +877,6 @@ impl World { .filter_map(|id| self.components().get_info(id)) } - /// Returns an [`EntityWorldMut`] for the given `entity` (if it exists) or spawns one if it doesn't exist. - /// This will return [`None`] if the `entity` exists with a different generation. - /// - /// # Note - /// Spawning a specific `entity` value is rarely the right choice. Most apps should favor [`World::spawn`]. - /// This method should generally only be used for sharing entities across apps, and only when they have a - /// scheme worked out to share an ID space (which doesn't happen by default). - #[inline] - #[deprecated(since = "0.15.0", note = "use `World::spawn` instead")] - pub fn get_or_spawn(&mut self, entity: Entity) -> Option { - self.get_or_spawn_with_caller( - entity, - #[cfg(feature = "track_location")] - Location::caller(), - ) - } - - #[inline] - pub(crate) fn get_or_spawn_with_caller( - &mut self, - entity: Entity, - #[cfg(feature = "track_location")] caller: &'static Location, - ) -> Option { - self.flush(); - match self.entities.alloc_at_without_replacement(entity) { - AllocAtWithoutReplacement::Exists(location) => { - // SAFETY: `entity` exists and `location` is that entity's location - Some(unsafe { EntityWorldMut::new(self, entity, location) }) - } - AllocAtWithoutReplacement::DidNotExist => { - // SAFETY: entity was just allocated - Some(unsafe { - self.spawn_at_empty_internal( - entity, - #[cfg(feature = "track_location")] - caller, - ) - }) - } - AllocAtWithoutReplacement::ExistsWithWrongGeneration => None, - } - } - /// Returns [`EntityRef`]s that expose read-only operations for the given /// `entities`, returning [`Err`] if any of the given entities do not exist. /// Instead of immediately unwrapping the value returned from this function, diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index 7dcb700387052..0f5df5b83bbe2 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -57,7 +57,7 @@ use self::{ }, visibility_buffer_raster_node::MeshletVisibilityBufferRasterPassNode, }; -use crate::{graph::NodePbr, Material, MeshMaterial3d, PreviousGlobalTransform}; +use crate::graph::NodePbr; use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, AssetApp, AssetId, Handle}; use bevy_core_pipeline::{ @@ -66,7 +66,6 @@ use bevy_core_pipeline::{ }; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - bundle::Bundle, component::{require, Component}, entity::Entity, query::Has, @@ -76,15 +75,9 @@ use bevy_ecs::{ }; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ - render_graph::{RenderGraphApp, ViewNodeRunner}, - render_resource::Shader, - renderer::RenderDevice, - settings::WgpuFeatures, - view::{ - self, prepare_view_targets, InheritedVisibility, Msaa, ViewVisibility, Visibility, - VisibilityClass, - }, - ExtractSchedule, Render, RenderApp, RenderSet, + render_graph::{RenderGraphApp, ViewNodeRunner}, render_resource::Shader, renderer::RenderDevice, settings::WgpuFeatures, view::{ + self, prepare_view_targets, Msaa, + }, ExtractSchedule, Render, RenderApp, RenderSet }; use bevy_transform::components::Transform; use bevy_utils::tracing::error; diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 6b1a0598e3d5d..5784c41b2a0db 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -7,7 +7,7 @@ use bevy_core_pipeline::{ prepass::{DepthPrepass, NormalPrepass, ViewPrepassTextures}, }; use bevy_ecs::{ - prelude::{require, Bundle, Component, Entity}, + prelude::{require, Component, Entity}, query::{Has, QueryItem, With}, reflect::ReflectComponent, schedule::IntoSystemConfigs, diff --git a/crates/bevy_pbr/src/ssr/mod.rs b/crates/bevy_pbr/src/ssr/mod.rs index 569affd21d4f0..996c120041948 100644 --- a/crates/bevy_pbr/src/ssr/mod.rs +++ b/crates/bevy_pbr/src/ssr/mod.rs @@ -12,7 +12,6 @@ use bevy_core_pipeline::{ }; use bevy_derive::{Deref, DerefMut}; use bevy_ecs::{ - bundle::Bundle, component::{require, Component}, entity::Entity, query::{Has, QueryItem, With}, diff --git a/crates/bevy_pbr/src/volumetric_fog/mod.rs b/crates/bevy_pbr/src/volumetric_fog/mod.rs index 8b4f239c52e73..4b90d63afccb7 100644 --- a/crates/bevy_pbr/src/volumetric_fog/mod.rs +++ b/crates/bevy_pbr/src/volumetric_fog/mod.rs @@ -37,7 +37,6 @@ use bevy_core_pipeline::core_3d::{ prepare_core_3d_depth_textures, }; use bevy_ecs::{ - bundle::Bundle, component::{require, Component}, reflect::ReflectComponent, schedule::IntoSystemConfigs as _, diff --git a/crates/bevy_sprite/src/lib.rs b/crates/bevy_sprite/src/lib.rs index daf2d8b71e2d3..543ca5c3dbc3a 100644 --- a/crates/bevy_sprite/src/lib.rs +++ b/crates/bevy_sprite/src/lib.rs @@ -33,7 +33,6 @@ pub mod prelude { }; } -pub use bundle::*; pub use dynamic_texture_atlas_builder::*; pub use mesh2d::*; #[cfg(feature = "bevy_sprite_picking_backend")] diff --git a/crates/bevy_sprite/src/mesh2d/material.rs b/crates/bevy_sprite/src/mesh2d/material.rs index 70ec5f64abd4d..a53b45cc26d21 100644 --- a/crates/bevy_sprite/src/mesh2d/material.rs +++ b/crates/bevy_sprite/src/mesh2d/material.rs @@ -36,7 +36,6 @@ use bevy_render::{ Extract, ExtractSchedule, Render, RenderApp, RenderSet, }; use bevy_render::{render_resource::BindingResources, sync_world::MainEntityHashMap}; -use bevy_transform::components::{GlobalTransform, Transform}; use bevy_utils::tracing::error; use core::{hash::Hash, marker::PhantomData}; use derive_more::derive::From; diff --git a/crates/bevy_ui/src/lib.rs b/crates/bevy_ui/src/lib.rs index bd508876a5379..d60e7f4febd60 100644 --- a/crates/bevy_ui/src/lib.rs +++ b/crates/bevy_ui/src/lib.rs @@ -48,9 +48,6 @@ pub mod prelude { #[doc(hidden)] #[cfg(feature = "bevy_ui_debug")] pub use crate::render::UiDebugOptions; - #[allow(deprecated)] - #[doc(hidden)] - pub use crate::widget::TextBundle; #[doc(hidden)] pub use crate::widget::{Text, TextUiReader, TextUiWriter}; #[doc(hidden)] From 0533cdd49201bb6f70190068df1c6f2990175056 Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Wed, 1 Jan 2025 20:17:25 -0500 Subject: [PATCH 3/6] fmt --- crates/bevy_core_pipeline/src/core_2d/camera_2d.rs | 6 +++++- crates/bevy_pbr/src/meshlet/mod.rs | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs index f7ff95811430f..783ec4b75a414 100644 --- a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs +++ b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs @@ -8,7 +8,11 @@ use bevy_render::{ camera::{ Camera, CameraMainTextureUsages, CameraProjection, CameraRenderGraph, OrthographicProjection, Projection, - }, extract_component::ExtractComponent, primitives::Frustum, sync_world::SyncToRenderWorld, view::{Msaa, VisibleEntities} + }, + extract_component::ExtractComponent, + primitives::Frustum, + sync_world::SyncToRenderWorld, + view::{Msaa, VisibleEntities}, }; use bevy_transform::prelude::{GlobalTransform, Transform}; diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index 0f5df5b83bbe2..4c8346bdfca93 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -75,9 +75,12 @@ use bevy_ecs::{ }; use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ - render_graph::{RenderGraphApp, ViewNodeRunner}, render_resource::Shader, renderer::RenderDevice, settings::WgpuFeatures, view::{ - self, prepare_view_targets, Msaa, - }, ExtractSchedule, Render, RenderApp, RenderSet + render_graph::{RenderGraphApp, ViewNodeRunner}, + render_resource::Shader, + renderer::RenderDevice, + settings::WgpuFeatures, + view::{self, prepare_view_targets, Msaa}, + ExtractSchedule, Render, RenderApp, RenderSet, }; use bevy_transform::components::Transform; use bevy_utils::tracing::error; From 444d99c6bb30ca672bb7413b5c356ec5d1c61fda Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Wed, 1 Jan 2025 20:25:21 -0500 Subject: [PATCH 4/6] add imports --- crates/bevy_pbr/src/meshlet/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index 4c8346bdfca93..5486fd72e0371 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -39,7 +39,6 @@ pub use self::asset::{ pub use self::from_mesh::{ MeshToMeshletMeshConversionError, MESHLET_DEFAULT_VERTEX_POSITION_QUANTIZATION_FACTOR, }; - use self::{ graph::NodeMeshlet, instance_manager::extract_meshlet_mesh_entities, @@ -58,6 +57,7 @@ use self::{ visibility_buffer_raster_node::MeshletVisibilityBufferRasterPassNode, }; use crate::graph::NodePbr; +use crate::PreviousGlobalTransform; use bevy_app::{App, Plugin}; use bevy_asset::{load_internal_asset, AssetApp, AssetId, Handle}; use bevy_core_pipeline::{ @@ -79,7 +79,7 @@ use bevy_render::{ render_resource::Shader, renderer::RenderDevice, settings::WgpuFeatures, - view::{self, prepare_view_targets, Msaa}, + view::{self, prepare_view_targets, Msaa, Visibility, VisibilityClass}, ExtractSchedule, Render, RenderApp, RenderSet, }; use bevy_transform::components::Transform; From f53df517857f0aee185ddaf314e95655311b8c3f Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Fri, 3 Jan 2025 15:58:20 -0500 Subject: [PATCH 5/6] rename files/modules --- .../bevy_pbr/src/{bundle.rs => components.rs} | 0 crates/bevy_pbr/src/lib.rs | 4 +- crates/bevy_scene/src/bundle.rs | 125 ----------------- crates/bevy_scene/src/lib.rs | 2 - crates/bevy_scene/src/scene_spawner.rs | 132 +++++++++++++++++- 5 files changed, 127 insertions(+), 136 deletions(-) rename crates/bevy_pbr/src/{bundle.rs => components.rs} (100%) delete mode 100644 crates/bevy_scene/src/bundle.rs diff --git a/crates/bevy_pbr/src/bundle.rs b/crates/bevy_pbr/src/components.rs similarity index 100% rename from crates/bevy_pbr/src/bundle.rs rename to crates/bevy_pbr/src/components.rs diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 57c9bb2352049..836ea0abd5d27 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -24,7 +24,7 @@ pub mod experimental { } } -mod bundle; +mod components; mod cluster; pub mod deferred; mod extended_material; @@ -47,7 +47,7 @@ use crate::material_bind_groups::FallbackBindlessResources; use bevy_color::{Color, LinearRgba}; -pub use bundle::*; +pub use components::*; pub use cluster::*; pub use extended_material::*; pub use fog::*; diff --git a/crates/bevy_scene/src/bundle.rs b/crates/bevy_scene/src/bundle.rs deleted file mode 100644 index b9a3b5a67eedb..0000000000000 --- a/crates/bevy_scene/src/bundle.rs +++ /dev/null @@ -1,125 +0,0 @@ -use crate::{DynamicSceneRoot, InstanceId, SceneRoot, SceneSpawner}; -use bevy_derive::{Deref, DerefMut}; -use bevy_ecs::{ - change_detection::ResMut, - entity::Entity, - prelude::{Changed, Component, Without}, - system::{Commands, Query}, -}; - -/// [`InstanceId`] of a spawned scene. It can be used with the [`SceneSpawner`] to -/// interact with the spawned scene. -#[derive(Component, Deref, DerefMut)] -pub struct SceneInstance(pub(crate) InstanceId); - -/// System that will spawn scenes from the [`SceneRoot`] and [`DynamicSceneRoot`] components. -pub fn scene_spawner( - mut commands: Commands, - mut scene_to_spawn: Query< - (Entity, &SceneRoot, Option<&mut SceneInstance>), - (Changed, Without), - >, - mut dynamic_scene_to_spawn: Query< - (Entity, &DynamicSceneRoot, Option<&mut SceneInstance>), - (Changed, Without), - >, - mut scene_spawner: ResMut, -) { - for (entity, scene, instance) in &mut scene_to_spawn { - let new_instance = scene_spawner.spawn_as_child(scene.0.clone(), entity); - if let Some(mut old_instance) = instance { - scene_spawner.despawn_instance(**old_instance); - *old_instance = SceneInstance(new_instance); - } else { - commands.entity(entity).insert(SceneInstance(new_instance)); - } - } - for (entity, dynamic_scene, instance) in &mut dynamic_scene_to_spawn { - let new_instance = scene_spawner.spawn_dynamic_as_child(dynamic_scene.0.clone(), entity); - if let Some(mut old_instance) = instance { - scene_spawner.despawn_instance(**old_instance); - *old_instance = SceneInstance(new_instance); - } else { - commands.entity(entity).insert(SceneInstance(new_instance)); - } - } -} - -#[cfg(test)] -mod tests { - use crate::{DynamicScene, DynamicSceneRoot, ScenePlugin, SceneSpawner}; - use bevy_app::{App, ScheduleRunnerPlugin}; - use bevy_asset::{AssetPlugin, Assets}; - use bevy_ecs::{ - component::Component, - entity::Entity, - prelude::{AppTypeRegistry, ReflectComponent, World}, - }; - use bevy_hierarchy::{Children, HierarchyPlugin}; - use bevy_reflect::Reflect; - - #[derive(Component, Reflect, Default)] - #[reflect(Component)] - struct ComponentA { - pub x: f32, - pub y: f32, - } - - #[test] - fn spawn_and_delete() { - let mut app = App::new(); - - app.add_plugins(ScheduleRunnerPlugin::default()) - .add_plugins(HierarchyPlugin) - .add_plugins(AssetPlugin::default()) - .add_plugins(ScenePlugin) - .register_type::(); - app.update(); - - let mut scene_world = World::new(); - - // create a new DynamicScene manually - let type_registry = app.world().resource::().clone(); - scene_world.insert_resource(type_registry); - scene_world.spawn(ComponentA { x: 3.0, y: 4.0 }); - let scene = DynamicScene::from_world(&scene_world); - let scene_handle = app - .world_mut() - .resource_mut::>() - .add(scene); - - // spawn the scene as a child of `entity` using `DynamicSceneRoot` - let entity = app - .world_mut() - .spawn(DynamicSceneRoot(scene_handle.clone())) - .id(); - - // run the app's schedule once, so that the scene gets spawned - app.update(); - - // make sure that the scene was added as a child of the root entity - let (scene_entity, scene_component_a) = app - .world_mut() - .query::<(Entity, &ComponentA)>() - .single(app.world()); - assert_eq!(scene_component_a.x, 3.0); - assert_eq!(scene_component_a.y, 4.0); - assert_eq!( - app.world().entity(entity).get::().unwrap().len(), - 1 - ); - - // let's try to delete the scene - let mut scene_spawner = app.world_mut().resource_mut::(); - scene_spawner.despawn(&scene_handle); - - // run the scene spawner system to despawn the scene - app.update(); - - // the scene entity does not exist anymore - assert!(app.world().get_entity(scene_entity).is_err()); - - // the root entity does not have any children anymore - assert!(app.world().entity(entity).get::().is_none()); - } -} diff --git a/crates/bevy_scene/src/lib.rs b/crates/bevy_scene/src/lib.rs index 1cf226beac603..76673219c5e7d 100644 --- a/crates/bevy_scene/src/lib.rs +++ b/crates/bevy_scene/src/lib.rs @@ -13,7 +13,6 @@ extern crate alloc; -mod bundle; mod components; mod dynamic_scene; mod dynamic_scene_builder; @@ -29,7 +28,6 @@ pub mod serde; pub use bevy_asset::ron; use bevy_ecs::schedule::IntoSystemConfigs; -pub use bundle::*; pub use components::*; pub use dynamic_scene::*; pub use dynamic_scene_builder::*; diff --git a/crates/bevy_scene/src/scene_spawner.rs b/crates/bevy_scene/src/scene_spawner.rs index 7117542d83100..7e18bdc001adc 100644 --- a/crates/bevy_scene/src/scene_spawner.rs +++ b/crates/bevy_scene/src/scene_spawner.rs @@ -13,6 +13,13 @@ use bevy_utils::{HashMap, HashSet}; use thiserror::Error; use uuid::Uuid; +use crate::{DynamicSceneRoot, SceneRoot}; +use bevy_derive::{Deref, DerefMut}; +use bevy_ecs::{ + change_detection::ResMut, + prelude::{Changed, Component, Without}, + system::{Commands, Query}, +}; /// Triggered on a scene's parent entity when [`crate::SceneInstance`] becomes ready to use. /// /// See also [`Trigger`], [`SceneSpawner::instance_is_ready`]. @@ -468,6 +475,44 @@ pub fn scene_spawner_system(world: &mut World) { }); } +/// [`InstanceId`] of a spawned scene. It can be used with the [`SceneSpawner`] to +/// interact with the spawned scene. +#[derive(Component, Deref, DerefMut)] +pub struct SceneInstance(pub(crate) InstanceId); + +/// System that will spawn scenes from the [`SceneRoot`] and [`DynamicSceneRoot`] components. +pub fn scene_spawner( + mut commands: Commands, + mut scene_to_spawn: Query< + (Entity, &SceneRoot, Option<&mut SceneInstance>), + (Changed, Without), + >, + mut dynamic_scene_to_spawn: Query< + (Entity, &DynamicSceneRoot, Option<&mut SceneInstance>), + (Changed, Without), + >, + mut scene_spawner: ResMut, +) { + for (entity, scene, instance) in &mut scene_to_spawn { + let new_instance = scene_spawner.spawn_as_child(scene.0.clone(), entity); + if let Some(mut old_instance) = instance { + scene_spawner.despawn_instance(**old_instance); + *old_instance = SceneInstance(new_instance); + } else { + commands.entity(entity).insert(SceneInstance(new_instance)); + } + } + for (entity, dynamic_scene, instance) in &mut dynamic_scene_to_spawn { + let new_instance = scene_spawner.spawn_dynamic_as_child(dynamic_scene.0.clone(), entity); + if let Some(mut old_instance) = instance { + scene_spawner.despawn_instance(**old_instance); + *old_instance = SceneInstance(new_instance); + } else { + commands.entity(entity).insert(SceneInstance(new_instance)); + } + } +} + #[cfg(test)] mod tests { use bevy_app::App; @@ -484,6 +529,79 @@ mod tests { use crate::{DynamicSceneBuilder, DynamicSceneRoot, ScenePlugin}; use super::*; + use crate::{DynamicScene, SceneSpawner}; + use bevy_app::ScheduleRunnerPlugin; + use bevy_asset::Assets; + use bevy_ecs::{ + entity::Entity, + prelude::{AppTypeRegistry, World}, + }; + use bevy_hierarchy::{Children, HierarchyPlugin}; + + #[derive(Component, Reflect, Default)] + #[reflect(Component)] + struct ComponentA { + pub x: f32, + pub y: f32, + } + + #[test] + fn spawn_and_delete() { + let mut app = App::new(); + + app.add_plugins(ScheduleRunnerPlugin::default()) + .add_plugins(HierarchyPlugin) + .add_plugins(AssetPlugin::default()) + .add_plugins(ScenePlugin) + .register_type::(); + app.update(); + + let mut scene_world = World::new(); + + // create a new DynamicScene manually + let type_registry = app.world().resource::().clone(); + scene_world.insert_resource(type_registry); + scene_world.spawn(ComponentA { x: 3.0, y: 4.0 }); + let scene = DynamicScene::from_world(&scene_world); + let scene_handle = app + .world_mut() + .resource_mut::>() + .add(scene); + + // spawn the scene as a child of `entity` using `DynamicSceneRoot` + let entity = app + .world_mut() + .spawn(DynamicSceneRoot(scene_handle.clone())) + .id(); + + // run the app's schedule once, so that the scene gets spawned + app.update(); + + // make sure that the scene was added as a child of the root entity + let (scene_entity, scene_component_a) = app + .world_mut() + .query::<(Entity, &ComponentA)>() + .single(app.world()); + assert_eq!(scene_component_a.x, 3.0); + assert_eq!(scene_component_a.y, 4.0); + assert_eq!( + app.world().entity(entity).get::().unwrap().len(), + 1 + ); + + // let's try to delete the scene + let mut scene_spawner = app.world_mut().resource_mut::(); + scene_spawner.despawn(&scene_handle); + + // run the scene spawner system to despawn the scene + app.update(); + + // the scene entity does not exist anymore + assert!(app.world().get_entity(scene_entity).is_err()); + + // the root entity does not have any children anymore + assert!(app.world().entity(entity).get::().is_none()); + } #[derive(Reflect, Component, Debug, PartialEq, Eq, Clone, Copy, Default)] #[reflect(Component)] @@ -538,7 +656,7 @@ mod tests { #[derive(Component, Reflect, Default)] #[reflect(Component)] - struct ComponentA; + struct ComponentF; #[derive(Resource, Default)] struct TriggerCount(u32); @@ -548,9 +666,9 @@ mod tests { app.add_plugins((AssetPlugin::default(), ScenePlugin)); app.init_resource::(); - app.register_type::(); - app.world_mut().spawn(ComponentA); - app.world_mut().spawn(ComponentA); + app.register_type::(); + app.world_mut().spawn(ComponentF); + app.world_mut().spawn(ComponentF); app } @@ -704,7 +822,7 @@ mod tests { fn despawn_scene() { let mut app = App::new(); app.add_plugins((AssetPlugin::default(), ScenePlugin)); - app.register_type::(); + app.register_type::(); let asset_server = app.world().resource::(); @@ -725,7 +843,7 @@ mod tests { // Spawn scene. for _ in 0..count { app.world_mut() - .spawn((ComponentA, DynamicSceneRoot(scene.clone()))); + .spawn((ComponentF, DynamicSceneRoot(scene.clone()))); } app.update(); @@ -734,7 +852,7 @@ mod tests { // Despawn scene. app.world_mut() .run_system_once( - |mut commands: Commands, query: Query>| { + |mut commands: Commands, query: Query>| { for entity in query.iter() { commands.entity(entity).despawn_recursive(); } From e627fb150d402527507d202226d1429c0bb46e7b Mon Sep 17 00:00:00 2001 From: Benjamin Brienen Date: Fri, 3 Jan 2025 16:10:01 -0500 Subject: [PATCH 6/6] fmt --- crates/bevy_pbr/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/bevy_pbr/src/lib.rs b/crates/bevy_pbr/src/lib.rs index 836ea0abd5d27..15f8795ffbac4 100644 --- a/crates/bevy_pbr/src/lib.rs +++ b/crates/bevy_pbr/src/lib.rs @@ -24,8 +24,8 @@ pub mod experimental { } } -mod components; mod cluster; +mod components; pub mod deferred; mod extended_material; mod fog; @@ -47,8 +47,8 @@ use crate::material_bind_groups::FallbackBindlessResources; use bevy_color::{Color, LinearRgba}; -pub use components::*; pub use cluster::*; +pub use components::*; pub use extended_material::*; pub use fog::*; pub use light::*;