Skip to content

Commit e36d876

Browse files
ChristopherBiscardimate-h
authored andcommitted
impl Clone for bevy_light Shader markers (bevyengine#23671)
# Objective Enable the use of `NotShadowReceiver` in `bsn!` by implementing `Clone` (`Default` is already implemented). ```rust error[E0277]: the trait bound `NotShadowReceiver: Clone` is not satisfied --> src/spawn_circle.rs:375:27 | 375 | world.spawn_scene(bsn! { | ___________________________^ 376 | | #SpawnCircle 377 | | SpawnCircle 378 | | SpawnEventToTrigger({self.event}) ... | 394 | | )] 395 | | }); | |_________^ the trait `Clone` is not implemented for `NotShadowReceiver` | ``` I also noticed `TransmittedShadowReceiver` would have the same issue, so added `Clone` there as well. --- An alternative would be to implement `FromTemplate` instead of `Default` and `Clone`. I'm not sure which solution is preferred in general, but these are Marker components so don't require any additional values.
1 parent 31b0078 commit e36d876

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

crates/bevy_light/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ pub struct NotShadowCaster;
259259
/// **Note:** If you're using diffuse transmission, setting [`NotShadowReceiver`] will
260260
/// cause both “regular” shadows as well as diffusely transmitted shadows to be disabled,
261261
/// even when [`TransmittedShadowReceiver`] is being used.
262-
#[derive(Debug, Component, Reflect, Default)]
262+
#[derive(Debug, Component, Reflect, Default, Clone)]
263263
#[reflect(Component, Default, Debug)]
264264
pub struct NotShadowReceiver;
265265
/// Add this component to make a [`Mesh3d`] using a PBR material with `StandardMaterial::diffuse_transmission > 0.0`
@@ -269,7 +269,7 @@ pub struct NotShadowReceiver;
269269
/// (and potentially even baking a thickness texture!) to match the geometry of the mesh, in order to avoid self-shadow artifacts.
270270
///
271271
/// **Note:** Using [`NotShadowReceiver`] overrides this component.
272-
#[derive(Debug, Component, Reflect, Default)]
272+
#[derive(Debug, Component, Reflect, Default, Clone)]
273273
#[reflect(Component, Default, Debug)]
274274
pub struct TransmittedShadowReceiver;
275275

0 commit comments

Comments
 (0)