Skip to content

Commit aade17d

Browse files
committed
Implement clone for most bundles.
1 parent a362c27 commit aade17d

File tree

10 files changed

+24
-14
lines changed

10 files changed

+24
-14
lines changed

crates/bevy_audio/src/audio.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ where
252252
pub settings: PlaybackSettings,
253253
}
254254

255+
impl<T: Asset + Decodable> Clone for AudioSourceBundle<T>
256+
{
257+
fn clone(&self) -> Self {
258+
Self {
259+
source: self.source.clone(),
260+
settings: self.settings,
261+
}
262+
}
263+
}
264+
255265
impl<T: Decodable + Asset> Default for AudioSourceBundle<T> {
256266
fn default() -> Self {
257267
Self {

crates/bevy_core_pipeline/src/core_2d/camera_2d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use bevy_transform::prelude::{GlobalTransform, Transform};
1818
#[reflect(Component)]
1919
pub struct Camera2d;
2020

21-
#[derive(Bundle)]
21+
#[derive(Bundle, Clone)]
2222
pub struct Camera2dBundle {
2323
pub camera: Camera,
2424
pub camera_render_graph: CameraRenderGraph,

crates/bevy_core_pipeline/src/core_3d/camera_3d.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ pub enum ScreenSpaceTransmissionQuality {
133133
Ultra,
134134
}
135135

136-
#[derive(Bundle)]
136+
#[derive(Bundle, Clone)]
137137
pub struct Camera3dBundle {
138138
pub camera: Camera,
139139
pub camera_render_graph: CameraRenderGraph,

crates/bevy_core_pipeline/src/prepass/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,16 @@ pub const NORMAL_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgb10a2Unorm;
4444
pub const MOTION_VECTOR_PREPASS_FORMAT: TextureFormat = TextureFormat::Rg16Float;
4545

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

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

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

5959
/// 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.

crates/bevy_core_pipeline/src/taa/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl Plugin for TemporalAntiAliasPlugin {
8585
}
8686

8787
/// Bundle to apply temporal anti-aliasing.
88-
#[derive(Bundle, Default)]
88+
#[derive(Bundle, Default, Clone)]
8989
pub struct TemporalAntiAliasBundle {
9090
pub settings: TemporalAntiAliasSettings,
9191
pub jitter: TemporalJitter,

crates/bevy_pbr/src/bundle.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub struct CascadesVisibleEntities {
7979
}
8080

8181
/// A component bundle for [`PointLight`] entities.
82-
#[derive(Debug, Bundle, Default)]
82+
#[derive(Debug, Bundle, Default, Clone)]
8383
pub struct PointLightBundle {
8484
pub point_light: PointLight,
8585
pub cubemap_visible_entities: CubemapVisibleEntities,
@@ -95,7 +95,7 @@ pub struct PointLightBundle {
9595
}
9696

9797
/// A component bundle for spot light entities
98-
#[derive(Debug, Bundle, Default)]
98+
#[derive(Debug, Bundle, Default, Clone)]
9999
pub struct SpotLightBundle {
100100
pub spot_light: SpotLight,
101101
pub visible_entities: VisibleEntities,
@@ -111,7 +111,7 @@ pub struct SpotLightBundle {
111111
}
112112

113113
/// A component bundle for [`DirectionalLight`] entities.
114-
#[derive(Debug, Bundle, Default)]
114+
#[derive(Debug, Bundle, Default, Clone)]
115115
pub struct DirectionalLightBundle {
116116
pub directional_light: DirectionalLight,
117117
pub frusta: CascadesFrusta,

crates/bevy_pbr/src/light_probe/environment_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub struct EnvironmentMapIds {
116116
/// A reflection probe is a type of environment map that specifies the light
117117
/// surrounding a region in space. For more information, see
118118
/// [`crate::environment_map`].
119-
#[derive(Bundle)]
119+
#[derive(Bundle, Clone)]
120120
pub struct ReflectionProbeBundle {
121121
/// Contains a transform that specifies the position of this reflection probe in space.
122122
pub spatial: SpatialBundle,

crates/bevy_pbr/src/ssao/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin {
127127
}
128128

129129
/// Bundle to apply screen space ambient occlusion.
130-
#[derive(Bundle, Default)]
130+
#[derive(Bundle, Default, Clone)]
131131
pub struct ScreenSpaceAmbientOcclusionBundle {
132132
pub settings: ScreenSpaceAmbientOcclusionSettings,
133133
pub depth_prepass: DepthPrepass,

crates/bevy_render/src/primitives/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl CubemapFrusta {
318318
}
319319
}
320320

321-
#[derive(Component, Debug, Default, Reflect)]
321+
#[derive(Component, Debug, Default, Reflect, Clone)]
322322
#[reflect(Component, Default)]
323323
pub struct CascadesFrusta {
324324
#[reflect(ignore)]

crates/bevy_scene/src/bundle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct SceneInstance(pub(crate) InstanceId);
2222
///
2323
/// The scene from `scene` will be spawned as a child of the entity with this component.
2424
/// Once it's spawned, the entity will have a [`SceneInstance`] component.
25-
#[derive(Default, Bundle)]
25+
#[derive(Default, Bundle, Clone)]
2626
pub struct SceneBundle {
2727
/// Handle to the scene to spawn.
2828
pub scene: Handle<Scene>,
@@ -46,7 +46,7 @@ pub struct SceneBundle {
4646
///
4747
/// The dynamic scene from `scene` will be spawn as a child of the entity with this component.
4848
/// Once it's spawned, the entity will have a [`SceneInstance`] component.
49-
#[derive(Default, Bundle)]
49+
#[derive(Default, Bundle, Clone)]
5050
pub struct DynamicSceneBundle {
5151
/// Handle to the scene to spawn.
5252
pub scene: Handle<DynamicScene>,

0 commit comments

Comments
 (0)