Skip to content

Implement clone for most bundles. #12993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/bevy_audio/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,15 @@ where
pub settings: PlaybackSettings,
}

impl<T: Asset + Decodable> Clone for AudioSourceBundle<T> {
fn clone(&self) -> Self {
Self {
source: self.source.clone(),
settings: self.settings,
}
}
}

impl<T: Decodable + Asset> Default for AudioSourceBundle<T> {
fn default() -> Self {
Self {
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/core_2d/camera_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use bevy_transform::prelude::{GlobalTransform, Transform};
#[reflect(Component)]
pub struct Camera2d;

#[derive(Bundle)]
#[derive(Bundle, Clone)]
pub struct Camera2dBundle {
pub camera: Camera,
pub camera_render_graph: CameraRenderGraph,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/core_3d/camera_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ pub enum ScreenSpaceTransmissionQuality {
Ultra,
}

#[derive(Bundle)]
#[derive(Bundle, Clone)]
pub struct Camera3dBundle {
pub camera: Camera,
pub camera_render_graph: CameraRenderGraph,
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_core_pipeline/src/prepass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ pub const NORMAL_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgb10a2Unorm;
pub const MOTION_VECTOR_PREPASS_FORMAT: TextureFormat = TextureFormat::Rg16Float;

/// If added to a [`crate::prelude::Camera3d`] then depth values will be copied to a separate texture available to the main pass.
#[derive(Component, Default, Reflect)]
#[derive(Component, Default, Reflect, Clone)]
pub struct DepthPrepass;

/// If added to a [`crate::prelude::Camera3d`] then vertex world normals will be copied to a separate texture available to the main pass.
/// Normals will have normal map textures already applied.
#[derive(Component, Default, Reflect)]
#[derive(Component, Default, Reflect, Clone)]
pub struct NormalPrepass;

/// If added to a [`crate::prelude::Camera3d`] then screen space motion vectors will be copied to a separate texture available to the main pass.
#[derive(Component, Default, Reflect)]
#[derive(Component, Default, Reflect, Clone)]
pub struct MotionVectorPrepass;

/// If added to a [`crate::prelude::Camera3d`] then deferred materials will be rendered to the deferred gbuffer texture and will be available to subsequent passes.
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_core_pipeline/src/taa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Plugin for TemporalAntiAliasPlugin {
}

/// Bundle to apply temporal anti-aliasing.
#[derive(Bundle, Default)]
#[derive(Bundle, Default, Clone)]
pub struct TemporalAntiAliasBundle {
pub settings: TemporalAntiAliasSettings,
pub jitter: TemporalJitter,
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_pbr/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub struct CascadesVisibleEntities {
}

/// A component bundle for [`PointLight`] entities.
#[derive(Debug, Bundle, Default)]
#[derive(Debug, Bundle, Default, Clone)]
pub struct PointLightBundle {
pub point_light: PointLight,
pub cubemap_visible_entities: CubemapVisibleEntities,
Expand All @@ -95,7 +95,7 @@ pub struct PointLightBundle {
}

/// A component bundle for spot light entities
#[derive(Debug, Bundle, Default)]
#[derive(Debug, Bundle, Default, Clone)]
pub struct SpotLightBundle {
pub spot_light: SpotLight,
pub visible_entities: VisibleEntities,
Expand All @@ -111,7 +111,7 @@ pub struct SpotLightBundle {
}

/// A component bundle for [`DirectionalLight`] entities.
#[derive(Debug, Bundle, Default)]
#[derive(Debug, Bundle, Default, Clone)]
pub struct DirectionalLightBundle {
pub directional_light: DirectionalLight,
pub frusta: CascadesFrusta,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/light_probe/environment_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub struct EnvironmentMapIds {
/// 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)]
#[derive(Bundle, Clone)]
pub struct ReflectionProbeBundle {
/// Contains a transform that specifies the position of this reflection probe in space.
pub spatial: SpatialBundle,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin {
}

/// Bundle to apply screen space ambient occlusion.
#[derive(Bundle, Default)]
#[derive(Bundle, Default, Clone)]
pub struct ScreenSpaceAmbientOcclusionBundle {
pub settings: ScreenSpaceAmbientOcclusionSettings,
pub depth_prepass: DepthPrepass,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_render/src/primitives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl CubemapFrusta {
}
}

#[derive(Component, Debug, Default, Reflect)]
#[derive(Component, Debug, Default, Reflect, Clone)]
#[reflect(Component, Default)]
pub struct CascadesFrusta {
#[reflect(ignore)]
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_scene/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct SceneInstance(pub(crate) InstanceId);
///
/// 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)]
#[derive(Default, Bundle, Clone)]
pub struct SceneBundle {
/// Handle to the scene to spawn.
pub scene: Handle<Scene>,
Expand All @@ -46,7 +46,7 @@ pub struct SceneBundle {
///
/// 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)]
#[derive(Default, Bundle, Clone)]
pub struct DynamicSceneBundle {
/// Handle to the scene to spawn.
pub scene: Handle<DynamicScene>,
Expand Down