diff --git a/crates/bevy_a11y/src/lib.rs b/crates/bevy_a11y/src/lib.rs index ccc7edf536..910ec3ca35 100644 --- a/crates/bevy_a11y/src/lib.rs +++ b/crates/bevy_a11y/src/lib.rs @@ -54,7 +54,11 @@ pub struct ActionRequest(pub accesskit::ActionRequest); /// Useful if a third-party plugin needs to conditionally integrate with /// `AccessKit` #[derive(Resource, Default, Clone, Debug, Deref, DerefMut)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default, Resource))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Default, Clone, Resource) +)] pub struct AccessibilityRequested(Arc); impl AccessibilityRequested { @@ -78,7 +82,11 @@ impl AccessibilityRequested { /// will generate conflicting updates. #[derive(Resource, Clone, Debug, Deref, DerefMut)] #[cfg_attr(feature = "serialize", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Resource))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Resource, Clone, Default) +)] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), reflect(Serialize, Deserialize) @@ -127,7 +135,7 @@ impl From for AccessibilityNode { #[cfg_attr(feature = "bevy_reflect", derive(Reflect))] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), - reflect(Serialize, Deserialize) + reflect(Serialize, Deserialize, Clone) )] pub enum AccessibilitySystem { /// Update the accessibility tree diff --git a/crates/bevy_animation/src/gltf_curves.rs b/crates/bevy_animation/src/gltf_curves.rs index d5b2cbb6b9..f69ce7385c 100644 --- a/crates/bevy_animation/src/gltf_curves.rs +++ b/crates/bevy_animation/src/gltf_curves.rs @@ -111,6 +111,7 @@ impl CubicKeyframeCurve { /// A keyframe-defined curve that uses cubic spline interpolation, special-cased for quaternions /// since it uses `Vec4` internally. #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub struct CubicRotationCurve { // Note: The sample width here should be 3. core: ChunkedUnevenCore, @@ -374,6 +375,7 @@ impl WideCubicKeyframeCurve { /// /// [`MorphWeights`]: bevy_render::prelude::MorphWeights #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub enum WeightsCurve { /// A curve which takes a constant value over its domain. Notably, this is how animations with /// only a single keyframe are interpreted. diff --git a/crates/bevy_animation/src/graph.rs b/crates/bevy_animation/src/graph.rs index 146bd8da3e..15fd96c63b 100644 --- a/crates/bevy_animation/src/graph.rs +++ b/crates/bevy_animation/src/graph.rs @@ -108,7 +108,7 @@ use crate::{AnimationClip, AnimationTargetId}; /// /// [RFC 51]: https://github.com/bevyengine/rfcs/blob/main/rfcs/51-animation-composition.md #[derive(Asset, Reflect, Clone, Debug, Serialize)] -#[reflect(Serialize, Debug)] +#[reflect(Serialize, Debug, Clone)] #[serde(into = "SerializedAnimationGraph")] pub struct AnimationGraph { /// The `petgraph` data structure that defines the animation graph. @@ -131,7 +131,7 @@ pub struct AnimationGraph { /// A [`Handle`] to the [`AnimationGraph`] to be used by the [`AnimationPlayer`](crate::AnimationPlayer) on the same entity. #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct AnimationGraphHandle(pub Handle); impl From for AssetId { @@ -164,6 +164,7 @@ pub type AnimationNodeIndex = NodeIndex; /// of the graph, contain animation clips to play. Blend and add nodes describe /// how to combine their children to produce a final animation. #[derive(Clone, Reflect, Debug)] +#[reflect(Clone)] pub struct AnimationGraphNode { /// Animation node data specific to the type of node (clip, blend, or add). /// @@ -205,6 +206,7 @@ pub struct AnimationGraphNode { /// In the case of clip nodes, this contains the actual animation clip /// associated with the node. #[derive(Clone, Default, Reflect, Debug)] +#[reflect(Clone)] pub enum AnimationNodeType { /// A *clip node*, which plays an animation clip. /// diff --git a/crates/bevy_animation/src/lib.rs b/crates/bevy_animation/src/lib.rs index 8663ea3f3f..b3ecc085c6 100644 --- a/crates/bevy_animation/src/lib.rs +++ b/crates/bevy_animation/src/lib.rs @@ -96,23 +96,26 @@ impl VariableCurve { /// Because animation clips refer to targets by UUID, they can target any /// [`AnimationTarget`] with that ID. #[derive(Asset, Reflect, Clone, Debug, Default)] +#[reflect(Clone, Default)] pub struct AnimationClip { // This field is ignored by reflection because AnimationCurves can contain things that are not reflect-able - #[reflect(ignore)] + #[reflect(ignore, clone)] curves: AnimationCurves, events: AnimationEvents, duration: f32, } #[derive(Reflect, Debug, Clone)] +#[reflect(Clone)] struct TimedAnimationEvent { time: f32, event: AnimationEvent, } #[derive(Reflect, Debug, Clone)] +#[reflect(Clone)] struct AnimationEvent { - #[reflect(ignore)] + #[reflect(ignore, clone)] trigger: AnimationEventFn, } @@ -124,6 +127,7 @@ impl AnimationEvent { #[derive(Reflect, Clone)] #[reflect(opaque)] +#[reflect(Clone, Default, Debug)] struct AnimationEventFn(Arc); impl Default for AnimationEventFn { @@ -139,6 +143,7 @@ impl Debug for AnimationEventFn { } #[derive(Reflect, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] +#[reflect(Clone)] enum AnimationEventTarget { Root, Node(AnimationTargetId), @@ -172,6 +177,7 @@ pub type AnimationCurves = HashMap, NoOpHa /// /// [UUID]: https://en.wikipedia.org/wiki/Universally_unique_identifier #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Reflect, Debug, Serialize, Deserialize)] +#[reflect(Clone)] pub struct AnimationTargetId(pub Uuid); impl Hash for AnimationTargetId { @@ -203,7 +209,7 @@ impl Hash for AnimationTargetId { /// time. However, you can change [`AnimationTarget`]'s `player` property at /// runtime to change which player is responsible for animating the entity. #[derive(Clone, Copy, Component, Reflect)] -#[reflect(Component)] +#[reflect(Component, Clone)] pub struct AnimationTarget { /// The ID of this animation target. /// @@ -425,6 +431,7 @@ impl AnimationClip { /// Repetition behavior of an animation. #[derive(Reflect, Debug, PartialEq, Eq, Copy, Clone, Default)] +#[reflect(Clone, Default)] pub enum RepeatAnimation { /// The animation will finish after running once. #[default] @@ -462,6 +469,7 @@ pub enum AnimationEvaluationError { /// /// A stopped animation is considered no longer active. #[derive(Debug, Clone, Copy, Reflect)] +#[reflect(Clone, Default)] pub struct ActiveAnimation { /// The factor by which the weight from the [`AnimationGraph`] is multiplied. weight: f32, @@ -674,7 +682,7 @@ impl ActiveAnimation { /// Automatically added to any root animations of a scene when it is /// spawned. #[derive(Component, Default, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct AnimationPlayer { active_animations: HashMap, blend_weights: HashMap, diff --git a/crates/bevy_animation/src/transition.rs b/crates/bevy_animation/src/transition.rs index c94378208b..b287c1f2a9 100644 --- a/crates/bevy_animation/src/transition.rs +++ b/crates/bevy_animation/src/transition.rs @@ -29,7 +29,7 @@ use crate::{graph::AnimationNodeIndex, ActiveAnimation, AnimationPlayer}; /// component to get confused about which animation is the "main" animation, and /// transitions will usually be incorrect as a result. #[derive(Component, Default, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct AnimationTransitions { main_animation: Option, transitions: Vec, @@ -52,6 +52,7 @@ impl Clone for AnimationTransitions { /// An animation that is being faded out as part of a transition #[derive(Debug, Clone, Copy, Reflect)] +#[reflect(Clone)] pub struct AnimationTransition { /// The current weight. Starts at 1.0 and goes to 0.0 during the fade-out. current_weight: f32, diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index 8c49fab226..afed919568 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -129,7 +129,7 @@ impl core::fmt::Debug for StrongHandle { /// /// [`Handle::Strong`], via [`StrongHandle`] also provides access to useful [`Asset`] metadata, such as the [`AssetPath`] (if it exists). #[derive(Reflect)] -#[reflect(Default, Debug, Hash, PartialEq)] +#[reflect(Default, Debug, Hash, PartialEq, Clone)] pub enum Handle { /// A "strong" reference to a live (or loading) [`Asset`]. If a [`Handle`] is [`Handle::Strong`], the [`Asset`] will be kept /// alive until the [`Handle`] is dropped. Strong handles also provide access to additional asset metadata. diff --git a/crates/bevy_asset/src/id.rs b/crates/bevy_asset/src/id.rs index 4caf546163..0f146eda65 100644 --- a/crates/bevy_asset/src/id.rs +++ b/crates/bevy_asset/src/id.rs @@ -1,5 +1,5 @@ use crate::{Asset, AssetIndex}; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use serde::{Deserialize, Serialize}; use uuid::Uuid; @@ -19,6 +19,7 @@ use thiserror::Error; /// /// For an "untyped" / "generic-less" id, see [`UntypedAssetId`]. #[derive(Reflect, Serialize, Deserialize, From)] +#[reflect(Clone, Default, Debug, PartialEq, Hash)] pub enum AssetId { /// A small / efficient runtime identifier that can be used to efficiently look up an asset stored in [`Assets`]. This is /// the "default" identifier used for assets. The alternative(s) (ex: [`AssetId::Uuid`]) will only be used if assets are @@ -29,7 +30,7 @@ pub enum AssetId { /// The unstable, opaque index of the asset. index: AssetIndex, /// A marker to store the type information of the asset. - #[reflect(ignore)] + #[reflect(ignore, clone)] marker: PhantomData A>, }, /// A stable-across-runs / const asset identifier. This will only be used if an asset is explicitly registered in [`Assets`] diff --git a/crates/bevy_asset/src/path.rs b/crates/bevy_asset/src/path.rs index f21bb96db9..457f2479e4 100644 --- a/crates/bevy_asset/src/path.rs +++ b/crates/bevy_asset/src/path.rs @@ -53,7 +53,7 @@ use thiserror::Error; /// This also means that you should use [`AssetPath::parse`] in cases where `&str` is the explicit type. #[derive(Eq, PartialEq, Hash, Clone, Default, Reflect)] #[reflect(opaque)] -#[reflect(Debug, PartialEq, Hash, Serialize, Deserialize)] +#[reflect(Debug, PartialEq, Hash, Clone, Serialize, Deserialize)] pub struct AssetPath<'a> { source: AssetSourceId<'a>, path: CowArc<'a, Path>, diff --git a/crates/bevy_asset/src/render_asset.rs b/crates/bevy_asset/src/render_asset.rs index 5dac114c7f..583ee45457 100644 --- a/crates/bevy_asset/src/render_asset.rs +++ b/crates/bevy_asset/src/render_asset.rs @@ -27,7 +27,7 @@ bitflags::bitflags! { #[repr(transparent)] #[derive(Serialize, Deserialize, Hash, Clone, Copy, PartialEq, Eq, Debug, Reflect)] #[reflect(opaque)] - #[reflect(Serialize, Deserialize, Hash, PartialEq, Debug)] + #[reflect(Serialize, Deserialize, Hash, Clone, PartialEq, Debug)] pub struct RenderAssetUsages: u8 { /// The bit flag for the main world. const MAIN_WORLD = 1 << 0; diff --git a/crates/bevy_audio/src/audio.rs b/crates/bevy_audio/src/audio.rs index 93a0a7505a..349cf6b6a4 100644 --- a/crates/bevy_audio/src/audio.rs +++ b/crates/bevy_audio/src/audio.rs @@ -6,6 +6,7 @@ use bevy_reflect::prelude::*; /// The way Bevy manages the sound playback. #[derive(Debug, Clone, Copy, Reflect)] +#[reflect(Clone)] pub enum PlaybackMode { /// Play the sound once. Do nothing when it ends. /// @@ -29,7 +30,7 @@ pub enum PlaybackMode { /// [`AudioSink`][crate::AudioSink] or [`SpatialAudioSink`][crate::SpatialAudioSink] /// components. Changes to this component will *not* be applied to already-playing audio. #[derive(Component, Clone, Copy, Debug, Reflect)] -#[reflect(Default, Component, Debug)] +#[reflect(Clone, Default, Component, Debug)] pub struct PlaybackSettings { /// The desired playback behavior. pub mode: PlaybackMode, @@ -142,7 +143,7 @@ impl PlaybackSettings { /// This must be accompanied by `Transform` and `GlobalTransform`. /// Only one entity with a `SpatialListener` should be present at any given time. #[derive(Component, Clone, Debug, Reflect)] -#[reflect(Default, Component, Debug)] +#[reflect(Clone, Default, Component, Debug)] pub struct SpatialListener { /// Left ear position relative to the `GlobalTransform`. pub left_ear_offset: Vec3, @@ -174,6 +175,7 @@ impl SpatialListener { /// /// Default is `Vec3::ONE`. #[derive(Clone, Copy, Debug, Reflect)] +#[reflect(Clone, Default)] pub struct SpatialScale(pub Vec3); impl SpatialScale { @@ -202,7 +204,7 @@ impl Default for SpatialScale { /// /// Default is `Vec3::ONE`. #[derive(Resource, Default, Clone, Copy, Reflect)] -#[reflect(Resource, Default)] +#[reflect(Resource, Default, Clone)] pub struct DefaultSpatialScale(pub SpatialScale); /// A component for playing a sound. @@ -218,7 +220,7 @@ pub struct DefaultSpatialScale(pub SpatialScale); /// Playback can be configured using the [`PlaybackSettings`] component. Note that changes to the /// `PlaybackSettings` component will *not* affect already-playing audio. #[derive(Component, Reflect)] -#[reflect(Component)] +#[reflect(Component, Clone)] #[require(PlaybackSettings)] pub struct AudioPlayer(pub Handle) where diff --git a/crates/bevy_audio/src/volume.rs b/crates/bevy_audio/src/volume.rs index 0fb43f15ef..b1378ae485 100644 --- a/crates/bevy_audio/src/volume.rs +++ b/crates/bevy_audio/src/volume.rs @@ -6,7 +6,7 @@ use bevy_reflect::prelude::*; /// /// Note: Changing [`GlobalVolume`] does not affect already playing audio. #[derive(Resource, Debug, Default, Clone, Copy, Reflect)] -#[reflect(Resource, Debug, Default)] +#[reflect(Resource, Debug, Default, Clone)] pub struct GlobalVolume { /// The global volume of all audio. pub volume: Volume, @@ -32,7 +32,7 @@ impl GlobalVolume { /// /// To create a new [`Volume`] from decibels, use [`Volume::Decibels`]. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Clone, Debug, PartialEq)] pub enum Volume { /// Create a new [`Volume`] from the given volume in linear scale. /// diff --git a/crates/bevy_color/src/color.rs b/crates/bevy_color/src/color.rs index 47c3fc599a..832394449b 100644 --- a/crates/bevy_color/src/color.rs +++ b/crates/bevy_color/src/color.rs @@ -42,7 +42,11 @@ use derive_more::derive::From; /// To avoid the cost of repeated conversion, and ensure consistent results where that is desired, /// first convert this [`Color`] into your desired color space. #[derive(Debug, Clone, Copy, PartialEq, From)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/hsla.rs b/crates/bevy_color/src/hsla.rs index 048add290b..b29fce72ac 100644 --- a/crates/bevy_color/src/hsla.rs +++ b/crates/bevy_color/src/hsla.rs @@ -13,7 +13,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/hsva.rs b/crates/bevy_color/src/hsva.rs index 6068ecd070..9e94eb24f6 100644 --- a/crates/bevy_color/src/hsva.rs +++ b/crates/bevy_color/src/hsva.rs @@ -13,7 +13,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/hwba.rs b/crates/bevy_color/src/hwba.rs index 459b5d82dc..36d328658d 100644 --- a/crates/bevy_color/src/hwba.rs +++ b/crates/bevy_color/src/hwba.rs @@ -16,7 +16,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/laba.rs b/crates/bevy_color/src/laba.rs index 39ac37f8ff..010b3df249 100644 --- a/crates/bevy_color/src/laba.rs +++ b/crates/bevy_color/src/laba.rs @@ -12,7 +12,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/lcha.rs b/crates/bevy_color/src/lcha.rs index f1437d3496..e5f5ecab32 100644 --- a/crates/bevy_color/src/lcha.rs +++ b/crates/bevy_color/src/lcha.rs @@ -12,7 +12,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/linear_rgba.rs b/crates/bevy_color/src/linear_rgba.rs index d1781bfc41..d00d765aac 100644 --- a/crates/bevy_color/src/linear_rgba.rs +++ b/crates/bevy_color/src/linear_rgba.rs @@ -13,7 +13,11 @@ use bytemuck::{Pod, Zeroable}; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq, Pod, Zeroable)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/oklaba.rs b/crates/bevy_color/src/oklaba.rs index 1281109d02..0203ca6a69 100644 --- a/crates/bevy_color/src/oklaba.rs +++ b/crates/bevy_color/src/oklaba.rs @@ -12,7 +12,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/oklcha.rs b/crates/bevy_color/src/oklcha.rs index 70c150ed0f..91ffe422c7 100644 --- a/crates/bevy_color/src/oklcha.rs +++ b/crates/bevy_color/src/oklcha.rs @@ -12,7 +12,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/srgba.rs b/crates/bevy_color/src/srgba.rs index 49e40792b7..ead2adf039 100644 --- a/crates/bevy_color/src/srgba.rs +++ b/crates/bevy_color/src/srgba.rs @@ -15,7 +15,11 @@ use thiserror::Error; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_color/src/xyza.rs b/crates/bevy_color/src/xyza.rs index a9fb422bef..c48a868416 100644 --- a/crates/bevy_color/src/xyza.rs +++ b/crates/bevy_color/src/xyza.rs @@ -12,7 +12,11 @@ use bevy_reflect::prelude::*; #[doc = include_str!("../docs/diagrams/model_graph.svg")] /// #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(PartialEq, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Default) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_core_pipeline/src/auto_exposure/compensation_curve.rs b/crates/bevy_core_pipeline/src/auto_exposure/compensation_curve.rs index 7a89de331c..e2ffe1a6c4 100644 --- a/crates/bevy_core_pipeline/src/auto_exposure/compensation_curve.rs +++ b/crates/bevy_core_pipeline/src/auto_exposure/compensation_curve.rs @@ -18,7 +18,7 @@ const LUT_SIZE: usize = 256; /// This curve is used to map the average log luminance of a scene to an /// exposure compensation value, to allow for fine control over the final exposure. #[derive(Asset, Reflect, Debug, Clone)] -#[reflect(Default)] +#[reflect(Default, Clone)] pub struct AutoExposureCompensationCurve { /// The minimum log luminance value in the curve. (the x-axis) min_log_lum: f32, diff --git a/crates/bevy_core_pipeline/src/auto_exposure/settings.rs b/crates/bevy_core_pipeline/src/auto_exposure/settings.rs index b5039030ac..cf6fdd4e24 100644 --- a/crates/bevy_core_pipeline/src/auto_exposure/settings.rs +++ b/crates/bevy_core_pipeline/src/auto_exposure/settings.rs @@ -24,7 +24,7 @@ use bevy_utils::default; /// /// **Auto Exposure requires compute shaders and is not compatible with WebGL2.** #[derive(Component, Clone, Reflect, ExtractComponent)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct AutoExposure { /// The range of exposure values for the histogram. /// diff --git a/crates/bevy_core_pipeline/src/bloom/settings.rs b/crates/bevy_core_pipeline/src/bloom/settings.rs index 2e22875a35..f6ee8dbd1e 100644 --- a/crates/bevy_core_pipeline/src/bloom/settings.rs +++ b/crates/bevy_core_pipeline/src/bloom/settings.rs @@ -25,7 +25,7 @@ use bevy_render::{extract_component::ExtractComponent, prelude::Camera}; /// See for a visualization of the parametric curve /// used in Bevy as well as a visualization of the curve's respective scattering profile. #[derive(Component, Reflect, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct Bloom { /// Controls the baseline of how much the image is scattered (default: 0.15). /// @@ -193,6 +193,7 @@ impl Default for Bloom { /// * Changing these settings makes it easy to make the final result look worse /// * Non-default prefilter settings should be used in conjunction with [`BloomCompositeMode::Additive`] #[derive(Default, Clone, Reflect)] +#[reflect(Clone, Default)] pub struct BloomPrefilter { /// Baseline of the quadratic threshold curve (default: 0.0). /// @@ -209,6 +210,7 @@ pub struct BloomPrefilter { } #[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash, Copy)] +#[reflect(Clone, Hash, PartialEq)] pub enum BloomCompositeMode { EnergyConserving, Additive, 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 5861084694..ab8f38cb6e 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs @@ -36,7 +36,7 @@ pub use node::CasNode; /// /// To use this, add the [`ContrastAdaptiveSharpening`] component to a 2D or 3D camera. #[derive(Component, Reflect, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct ContrastAdaptiveSharpening { /// Enable or disable sharpening. pub enabled: bool, @@ -65,7 +65,7 @@ impl Default for ContrastAdaptiveSharpening { } #[derive(Component, Default, Reflect, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct DenoiseCas(bool); /// The uniform struct extracted from [`ContrastAdaptiveSharpening`] attached to a [`Camera`]. 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 9780ddd31f..67e5e7f1d8 100644 --- a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs +++ b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs @@ -14,7 +14,7 @@ use bevy_transform::prelude::{GlobalTransform, Transform}; /// A 2D camera component. Enables the 2D render graph for a [`Camera`]. #[derive(Component, Default, Reflect, Clone, ExtractComponent)] #[extract_component_filter(With)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[require( Camera, DebandDither, 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 418d3b8d48..337b157a0d 100644 --- a/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs +++ b/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs @@ -18,7 +18,7 @@ use serde::{Deserialize, Serialize}; /// This means "forward" is -Z. #[derive(Component, Reflect, Clone, ExtractComponent)] #[extract_component_filter(With)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[require( Camera, DebandDither(|| DebandDither::Enabled), @@ -72,7 +72,7 @@ impl Default for Camera3d { } #[derive(Clone, Copy, Reflect, Serialize, Deserialize)] -#[reflect(Serialize, Deserialize)] +#[reflect(Serialize, Deserialize, Clone)] pub struct Camera3dDepthTextureUsage(pub u32); impl From for Camera3dDepthTextureUsage { @@ -88,7 +88,7 @@ impl From for TextureUsages { /// The depth clear operation to perform for the main 3d pass. #[derive(Reflect, Serialize, Deserialize, Clone, Debug)] -#[reflect(Serialize, Deserialize)] +#[reflect(Serialize, Deserialize, Clone, Default)] pub enum Camera3dDepthLoadOp { /// Clear with a specified value. /// Note that 0.0 is the far plane due to bevy's use of reverse-z projections. @@ -119,7 +119,7 @@ impl From for LoadOp { /// /// **Note:** You can get better-looking results at any quality level by enabling TAA. See: [`TemporalAntiAliasPlugin`](crate::experimental::taa::TemporalAntiAliasPlugin). #[derive(Resource, Default, Clone, Copy, Reflect, PartialEq, PartialOrd, Debug)] -#[reflect(Resource, Default, Debug, PartialEq)] +#[reflect(Resource, Default, Clone, Debug, PartialEq)] pub enum ScreenSpaceTransmissionQuality { /// Best performance at the cost of quality. Suitable for lower end GPUs. (e.g. Mobile) /// diff --git a/crates/bevy_core_pipeline/src/dof/mod.rs b/crates/bevy_core_pipeline/src/dof/mod.rs index 813f88fd1c..87a10313f1 100644 --- a/crates/bevy_core_pipeline/src/dof/mod.rs +++ b/crates/bevy_core_pipeline/src/dof/mod.rs @@ -79,7 +79,7 @@ pub struct DepthOfFieldPlugin; /// /// [depth of field]: https://en.wikipedia.org/wiki/Depth_of_field #[derive(Component, Clone, Copy, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Clone, Default)] pub struct DepthOfField { /// The appearance of the effect. pub mode: DepthOfFieldMode, @@ -123,7 +123,7 @@ pub struct DepthOfField { /// Controls the appearance of the effect. #[derive(Clone, Copy, Default, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, Clone, PartialEq)] pub enum DepthOfFieldMode { /// A more accurate simulation, in which circles of confusion generate /// "spots" of light. diff --git a/crates/bevy_core_pipeline/src/fxaa/mod.rs b/crates/bevy_core_pipeline/src/fxaa/mod.rs index b8904bb1f9..b69df0bf7b 100644 --- a/crates/bevy_core_pipeline/src/fxaa/mod.rs +++ b/crates/bevy_core_pipeline/src/fxaa/mod.rs @@ -27,7 +27,7 @@ mod node; pub use node::FxaaNode; #[derive(Debug, Reflect, Eq, PartialEq, Hash, Clone, Copy)] -#[reflect(PartialEq, Hash)] +#[reflect(PartialEq, Hash, Clone)] pub enum Sensitivity { Low, Medium, @@ -51,7 +51,7 @@ impl Sensitivity { /// A component for enabling Fast Approximate Anti-Aliasing (FXAA) /// for a [`bevy_render::camera::Camera`]. #[derive(Reflect, Component, Clone, ExtractComponent)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[extract_component_filter(With)] #[doc(alias = "FastApproximateAntiAliasing")] pub struct Fxaa { diff --git a/crates/bevy_core_pipeline/src/motion_blur/mod.rs b/crates/bevy_core_pipeline/src/motion_blur/mod.rs index 195e506beb..313e001bc3 100644 --- a/crates/bevy_core_pipeline/src/motion_blur/mod.rs +++ b/crates/bevy_core_pipeline/src/motion_blur/mod.rs @@ -54,7 +54,7 @@ pub mod pipeline; /// # } /// ```` #[derive(Reflect, Component, Clone, ExtractComponent, ShaderType)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[extract_component_filter(With)] #[require(DepthPrepass, MotionVectorPrepass)] pub struct MotionBlur { diff --git a/crates/bevy_core_pipeline/src/oit/mod.rs b/crates/bevy_core_pipeline/src/oit/mod.rs index 982be9aa31..f4337065cf 100644 --- a/crates/bevy_core_pipeline/src/oit/mod.rs +++ b/crates/bevy_core_pipeline/src/oit/mod.rs @@ -6,7 +6,7 @@ use bevy_ecs::{component::*, prelude::*}; use bevy_math::UVec2; use bevy_platform_support::collections::HashSet; use bevy_platform_support::time::Instant; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ camera::{Camera, ExtractedCamera}, extract_component::{ExtractComponent, ExtractComponentPlugin}, @@ -44,6 +44,7 @@ pub const OIT_DRAW_SHADER_HANDLE: Handle = // This should probably be done by adding an enum to this component. // We use the same struct to pass on the settings to the drawing shader. #[derive(Clone, Copy, ExtractComponent, Reflect, ShaderType)] +#[reflect(Clone, Default)] pub struct OrderIndependentTransparencySettings { /// Controls how many layers will be used to compute the blending. /// The more layers you use the more memory it will use but it will also give better results. diff --git a/crates/bevy_core_pipeline/src/post_process/mod.rs b/crates/bevy_core_pipeline/src/post_process/mod.rs index 08bcc8fb4a..2ac03c08c8 100644 --- a/crates/bevy_core_pipeline/src/post_process/mod.rs +++ b/crates/bevy_core_pipeline/src/post_process/mod.rs @@ -98,7 +98,7 @@ pub struct PostProcessingPlugin; /// /// [Gjøl & Svendsen 2016]: https://github.com/playdeadgames/publications/blob/master/INSIDE/rendering_inside_gdc2016.pdf #[derive(Reflect, Component, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct ChromaticAberration { /// The lookup texture that determines the color gradient. /// diff --git a/crates/bevy_core_pipeline/src/prepass/mod.rs b/crates/bevy_core_pipeline/src/prepass/mod.rs index 1e663a79a4..deea2a5fa8 100644 --- a/crates/bevy_core_pipeline/src/prepass/mod.rs +++ b/crates/bevy_core_pipeline/src/prepass/mod.rs @@ -54,18 +54,18 @@ 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, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, 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, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, 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, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, 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. diff --git a/crates/bevy_core_pipeline/src/skybox/mod.rs b/crates/bevy_core_pipeline/src/skybox/mod.rs index d6c5fdb17e..7e2dba466c 100644 --- a/crates/bevy_core_pipeline/src/skybox/mod.rs +++ b/crates/bevy_core_pipeline/src/skybox/mod.rs @@ -90,7 +90,7 @@ impl Plugin for SkyboxPlugin { /// /// See also . #[derive(Component, Clone, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct Skybox { pub image: Handle, /// Scale factor applied to the skybox image. diff --git a/crates/bevy_core_pipeline/src/smaa/mod.rs b/crates/bevy_core_pipeline/src/smaa/mod.rs index 9e262e1e89..7dd371606c 100644 --- a/crates/bevy_core_pipeline/src/smaa/mod.rs +++ b/crates/bevy_core_pipeline/src/smaa/mod.rs @@ -95,7 +95,7 @@ pub struct SmaaPlugin; /// A component for enabling Subpixel Morphological Anti-Aliasing (SMAA) /// for a [`bevy_render::camera::Camera`]. #[derive(Clone, Copy, Default, Component, Reflect, ExtractComponent)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[doc(alias = "SubpixelMorphologicalAntiAliasing")] pub struct Smaa { /// A predefined set of SMAA parameters: i.e. a quality level. @@ -110,7 +110,7 @@ pub struct Smaa { /// /// The default value is *high*. #[derive(Clone, Copy, Reflect, Default, PartialEq, Eq, Hash)] -#[reflect(Default)] +#[reflect(Default, Clone, PartialEq, Hash)] pub enum SmaaPreset { /// Four search steps; no diagonal or corner detection. Low, diff --git a/crates/bevy_core_pipeline/src/taa/mod.rs b/crates/bevy_core_pipeline/src/taa/mod.rs index 1a0ac576d4..9d69f1704a 100644 --- a/crates/bevy_core_pipeline/src/taa/mod.rs +++ b/crates/bevy_core_pipeline/src/taa/mod.rs @@ -131,7 +131,7 @@ impl Plugin for TemporalAntiAliasPlugin { /// /// If no [`MipBias`] component is attached to the camera, TAA will add a `MipBias(-1.0)` component. #[derive(Component, Reflect, Clone)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[require(TemporalJitter, DepthPrepass, MotionVectorPrepass)] #[doc(alias = "Taa")] pub struct TemporalAntiAliasing { diff --git a/crates/bevy_ecs/src/change_detection.rs b/crates/bevy_ecs/src/change_detection.rs index a0e00fdc15..c4abfdc77a 100644 --- a/crates/bevy_ecs/src/change_detection.rs +++ b/crates/bevy_ecs/src/change_detection.rs @@ -1197,7 +1197,7 @@ impl<'w, T> From> for MutUntyped<'w> { #[cfg_attr(feature = "bevy_reflect", derive(Reflect))] #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct MaybeLocation> { - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] marker: PhantomData, #[cfg(feature = "track_location")] value: T, diff --git a/crates/bevy_ecs/src/component.rs b/crates/bevy_ecs/src/component.rs index fdbe4c7a57..ed090e0705 100644 --- a/crates/bevy_ecs/src/component.rs +++ b/crates/bevy_ecs/src/component.rs @@ -950,7 +950,7 @@ impl ComponentInfo { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] pub struct ComponentId(usize); @@ -2416,7 +2416,7 @@ impl Components { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] pub struct Tick { tick: u32, @@ -2513,7 +2513,7 @@ impl<'a> TickCells<'a> { /// Records when a component or resource was added and when it was last mutably dereferenced (or added). #[derive(Copy, Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct ComponentTicks { /// Tick recording the time this component or resource was added. pub added: Tick, diff --git a/crates/bevy_ecs/src/entity/hash.rs b/crates/bevy_ecs/src/entity/hash.rs index bf957328ef..35e01cebcd 100644 --- a/crates/bevy_ecs/src/entity/hash.rs +++ b/crates/bevy_ecs/src/entity/hash.rs @@ -1,11 +1,11 @@ use core::hash::{BuildHasher, Hasher}; #[cfg(feature = "bevy_reflect")] -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// A [`BuildHasher`] that results in a [`EntityHasher`]. #[derive(Debug, Default, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default, Clone))] pub struct EntityHash; impl BuildHasher for EntityHash { diff --git a/crates/bevy_ecs/src/entity/mod.rs b/crates/bevy_ecs/src/entity/mod.rs index fe6623e2cd..79c5f8c9e7 100644 --- a/crates/bevy_ecs/src/entity/mod.rs +++ b/crates/bevy_ecs/src/entity/mod.rs @@ -166,7 +166,7 @@ type IdCursor = isize; #[derive(Clone, Copy)] #[cfg_attr(feature = "bevy_reflect", derive(Reflect))] #[cfg_attr(feature = "bevy_reflect", reflect(opaque))] -#[cfg_attr(feature = "bevy_reflect", reflect(Hash, PartialEq, Debug))] +#[cfg_attr(feature = "bevy_reflect", reflect(Hash, PartialEq, Debug, Clone))] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), reflect(Serialize, Deserialize) diff --git a/crates/bevy_ecs/src/entity_disabling.rs b/crates/bevy_ecs/src/entity_disabling.rs index a7da08af57..5d62011174 100644 --- a/crates/bevy_ecs/src/entity_disabling.rs +++ b/crates/bevy_ecs/src/entity_disabling.rs @@ -76,7 +76,10 @@ use bevy_ecs_macros::{Component, Resource}; use smallvec::SmallVec; #[cfg(feature = "bevy_reflect")] -use {crate::reflect::ReflectComponent, bevy_reflect::Reflect}; +use { + crate::reflect::ReflectComponent, bevy_reflect::std_traits::ReflectDefault, + bevy_reflect::Reflect, +}; /// A marker component for disabled entities. /// @@ -97,7 +100,7 @@ use {crate::reflect::ReflectComponent, bevy_reflect::Reflect}; feature = "bevy_reflect", derive(Reflect), reflect(Component), - reflect(Debug) + reflect(Debug, Clone, Default) )] // This component is registered as a disabling component during World::bootstrap pub struct Disabled; diff --git a/crates/bevy_ecs/src/event/base.rs b/crates/bevy_ecs/src/event/base.rs index 5105c786ac..90fccbf97a 100644 --- a/crates/bevy_ecs/src/event/base.rs +++ b/crates/bevy_ecs/src/event/base.rs @@ -110,14 +110,18 @@ struct EventWrapperComponent(PhantomData); /// sent to the point it was processed. `EventId`s increase monotonically by send order. /// /// [`World`]: crate::world::World -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, Debug, PartialEq, Hash) +)] pub struct EventId { /// Uniquely identifies the event associated with this ID. // This value corresponds to the order in which each event was added to the world. pub id: usize, /// The source code location that triggered this event. pub caller: MaybeLocation, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(super) _marker: PhantomData, } diff --git a/crates/bevy_ecs/src/event/collections.rs b/crates/bevy_ecs/src/event/collections.rs index cebba5a55e..66447b7de4 100644 --- a/crates/bevy_ecs/src/event/collections.rs +++ b/crates/bevy_ecs/src/event/collections.rs @@ -320,7 +320,7 @@ impl Extend for Events { } #[derive(Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default))] pub(crate) struct EventSequence { pub(crate) events: Vec>, pub(crate) start_event_count: usize, diff --git a/crates/bevy_ecs/src/hierarchy.rs b/crates/bevy_ecs/src/hierarchy.rs index 3b1a75992b..9c191bee9e 100644 --- a/crates/bevy_ecs/src/hierarchy.rs +++ b/crates/bevy_ecs/src/hierarchy.rs @@ -17,6 +17,8 @@ use crate::{ world::{DeferredWorld, EntityWorldMut, FromWorld, World}, }; use alloc::{format, string::String, vec::Vec}; +#[cfg(feature = "bevy_reflect")] +use bevy_reflect::std_traits::ReflectDefault; use core::ops::Deref; use core::slice; use disqualified::ShortName; @@ -90,7 +92,7 @@ use log::warn; #[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))] #[cfg_attr( feature = "bevy_reflect", - reflect(Component, PartialEq, Debug, FromWorld) + reflect(Component, PartialEq, Debug, FromWorld, Clone) )] #[relationship(relationship_target = Children)] #[doc(alias = "IsChild", alias = "Parent")] @@ -133,7 +135,7 @@ impl FromWorld for ChildOf { #[derive(Component, Default, Debug, PartialEq, Eq)] #[relationship_target(relationship = ChildOf, linked_spawn)] #[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))] -#[cfg_attr(feature = "bevy_reflect", reflect(Component, FromWorld))] +#[cfg_attr(feature = "bevy_reflect", reflect(Component, FromWorld, Default))] #[doc(alias = "IsParent")] pub struct Children(Vec); diff --git a/crates/bevy_ecs/src/identifier/mod.rs b/crates/bevy_ecs/src/identifier/mod.rs index 964f03ed3a..c08ea7b4aa 100644 --- a/crates/bevy_ecs/src/identifier/mod.rs +++ b/crates/bevy_ecs/src/identifier/mod.rs @@ -21,7 +21,7 @@ pub(crate) mod masks; #[derive(Debug, Clone, Copy)] #[cfg_attr(feature = "bevy_reflect", derive(Reflect))] #[cfg_attr(feature = "bevy_reflect", reflect(opaque))] -#[cfg_attr(feature = "bevy_reflect", reflect(Debug, Hash, PartialEq))] +#[cfg_attr(feature = "bevy_reflect", reflect(Debug, Hash, PartialEq, Clone))] // Alignment repr necessary to allow LLVM to better output // optimized codegen for `to_bits`, `PartialEq` and `Ord`. #[repr(C, align(8))] diff --git a/crates/bevy_ecs/src/name.rs b/crates/bevy_ecs/src/name.rs index 9c38b28481..ca94b4be80 100644 --- a/crates/bevy_ecs/src/name.rs +++ b/crates/bevy_ecs/src/name.rs @@ -41,7 +41,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Component, Default, Debug) + reflect(Component, Default, Debug, Clone, Hash, PartialEq) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_ecs/src/removal_detection.rs b/crates/bevy_ecs/src/removal_detection.rs index a1480a1923..64cc63a7ce 100644 --- a/crates/bevy_ecs/src/removal_detection.rs +++ b/crates/bevy_ecs/src/removal_detection.rs @@ -26,7 +26,7 @@ use core::{ /// Internally, `RemovedComponents` uses these as an `Events`. #[derive(Event, Debug, Clone, Into)] #[cfg_attr(feature = "bevy_reflect", derive(Reflect))] -#[cfg_attr(feature = "bevy_reflect", reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", reflect(Debug, Clone))] pub struct RemovedComponentEntity(Entity); /// Wrapper around a [`EventCursor`] so that we diff --git a/crates/bevy_ecs/src/system/system_registry.rs b/crates/bevy_ecs/src/system/system_registry.rs index d23ca80691..11d74beca5 100644 --- a/crates/bevy_ecs/src/system/system_registry.rs +++ b/crates/bevy_ecs/src/system/system_registry.rs @@ -9,7 +9,7 @@ use crate::{ use alloc::boxed::Box; use bevy_ecs_macros::{Component, Resource}; #[cfg(feature = "bevy_reflect")] -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use core::marker::PhantomData; use thiserror::Error; @@ -33,7 +33,7 @@ impl RegisteredSystem { /// Marker [`Component`](bevy_ecs::component::Component) for identifying [`SystemId`] [`Entity`]s. #[derive(Component, Default)] #[cfg_attr(feature = "bevy_reflect", derive(Reflect))] -#[cfg_attr(feature = "bevy_reflect", reflect(Component))] +#[cfg_attr(feature = "bevy_reflect", reflect(Component, Default))] pub struct SystemIdMarker; /// A system that has been removed from the registry. diff --git a/crates/bevy_gizmos/src/aabb.rs b/crates/bevy_gizmos/src/aabb.rs index 4b84e7ace7..16dc7ed773 100644 --- a/crates/bevy_gizmos/src/aabb.rs +++ b/crates/bevy_gizmos/src/aabb.rs @@ -45,6 +45,7 @@ impl Plugin for AabbGizmoPlugin { } /// The [`GizmoConfigGroup`] used for debug visualizations of [`Aabb`] components on entities #[derive(Clone, Default, Reflect, GizmoConfigGroup)] +#[reflect(Clone, Default)] pub struct AabbGizmoConfigGroup { /// Draws all bounding boxes in the scene when set to `true`. /// diff --git a/crates/bevy_gizmos/src/config.rs b/crates/bevy_gizmos/src/config.rs index da8916077c..de52246ef7 100644 --- a/crates/bevy_gizmos/src/config.rs +++ b/crates/bevy_gizmos/src/config.rs @@ -17,6 +17,7 @@ use core::{ /// An enum configuring how line joints will be drawn. #[derive(Debug, Default, Copy, Clone, Reflect, PartialEq, Eq, Hash)] +#[reflect(Default, PartialEq, Hash, Clone)] pub enum GizmoLineJoint { /// Does not draw any line joints. #[default] @@ -34,6 +35,7 @@ pub enum GizmoLineJoint { /// An enum used to configure the style of gizmo lines, similar to CSS line-style #[derive(Copy, Clone, Debug, Default, PartialEq, Reflect)] +#[reflect(Default, PartialEq, Hash, Clone)] #[non_exhaustive] pub enum GizmoLineStyle { /// A solid line without any decorators @@ -80,11 +82,13 @@ pub trait GizmoConfigGroup: Reflect + TypePath + Default {} /// The default gizmo config group. #[derive(Default, Reflect, GizmoConfigGroup)] +#[reflect(Default)] pub struct DefaultGizmoConfigGroup; /// Used when the gizmo config group needs to be type-erased. /// Also used for retained gizmos, which can't have a gizmo config group. #[derive(Default, Reflect, GizmoConfigGroup, Debug, Clone)] +#[reflect(Default, Clone)] pub struct ErasedGizmoConfigGroup; /// A [`Resource`] storing [`GizmoConfig`] and [`GizmoConfigGroup`] structs @@ -164,6 +168,7 @@ impl GizmoConfigStore { /// A struct that stores configuration for gizmos. #[derive(Clone, Reflect, Debug)] +#[reflect(Clone, Default)] pub struct GizmoConfig { /// Set to `false` to stop drawing gizmos. /// @@ -205,6 +210,7 @@ impl Default for GizmoConfig { /// A struct that stores configuration for gizmos. #[derive(Clone, Reflect, Debug)] +#[reflect(Clone, Default)] pub struct GizmoLineConfig { /// Line width specified in pixels. /// diff --git a/crates/bevy_gizmos/src/gizmos.rs b/crates/bevy_gizmos/src/gizmos.rs index 2d8c523e07..e094cb4592 100644 --- a/crates/bevy_gizmos/src/gizmos.rs +++ b/crates/bevy_gizmos/src/gizmos.rs @@ -15,7 +15,7 @@ use bevy_ecs::{ world::{unsafe_world_cell::UnsafeWorldCell, World}, }; use bevy_math::{Isometry2d, Isometry3d, Vec2, Vec3}; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_transform::TransformPoint; use bevy_utils::default; @@ -274,6 +274,7 @@ where /// Buffer for gizmo vertex data. #[derive(Debug, Clone, Reflect)] +#[reflect(Default)] pub struct GizmoBuffer where Config: GizmoConfigGroup, @@ -284,7 +285,7 @@ where pub(crate) list_colors: Vec, pub(crate) strip_positions: Vec, pub(crate) strip_colors: Vec, - #[reflect(ignore)] + #[reflect(ignore, clone)] pub(crate) marker: PhantomData<(Config, Clear)>, } diff --git a/crates/bevy_gizmos/src/light.rs b/crates/bevy_gizmos/src/light.rs index 9114282549..7f7dadacc2 100644 --- a/crates/bevy_gizmos/src/light.rs +++ b/crates/bevy_gizmos/src/light.rs @@ -133,6 +133,7 @@ impl Plugin for LightGizmoPlugin { /// Configures how a color is attributed to a light gizmo. #[derive(Debug, Clone, Copy, Default, Reflect)] +#[reflect(Clone, Default)] pub enum LightGizmoColor { /// User-specified color. Manual(Color), @@ -147,6 +148,7 @@ pub enum LightGizmoColor { /// The [`GizmoConfigGroup`] used to configure the visualization of lights. #[derive(Clone, Reflect, GizmoConfigGroup)] +#[reflect(Clone, Default)] pub struct LightGizmoConfigGroup { /// Draw a gizmo for all lights if true. /// diff --git a/crates/bevy_gizmos/src/retained.rs b/crates/bevy_gizmos/src/retained.rs index cf3785179a..f6b2209418 100644 --- a/crates/bevy_gizmos/src/retained.rs +++ b/crates/bevy_gizmos/src/retained.rs @@ -4,7 +4,7 @@ use core::ops::{Deref, DerefMut}; use bevy_asset::Handle; use bevy_ecs::{component::Component, reflect::ReflectComponent}; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_transform::components::Transform; #[cfg(feature = "bevy_render")] @@ -73,7 +73,7 @@ impl DerefMut for GizmoAsset { /// /// [`Gizmos`]: crate::gizmos::Gizmos #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[reflect(Component, Clone, Default)] #[require(Transform)] pub struct Gizmo { /// The handle to the gizmo to draw. diff --git a/crates/bevy_gltf/src/assets.rs b/crates/bevy_gltf/src/assets.rs index e8a7788168..de2ee44bf7 100644 --- a/crates/bevy_gltf/src/assets.rs +++ b/crates/bevy_gltf/src/assets.rs @@ -263,7 +263,7 @@ impl GltfSkin { /// /// See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras). #[derive(Clone, Debug, Reflect, Default, Component)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Clone, Default, Debug)] pub struct GltfExtras { /// Content of the extra data. pub value: String, @@ -281,7 +281,7 @@ impl From<&serde_json::value::RawValue> for GltfExtras { /// /// See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras). #[derive(Clone, Debug, Reflect, Default, Component)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Clone, Default, Debug)] pub struct GltfSceneExtras { /// Content of the extra data. pub value: String, @@ -291,7 +291,7 @@ pub struct GltfSceneExtras { /// /// See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras). #[derive(Clone, Debug, Reflect, Default, Component)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Clone, Default, Debug)] pub struct GltfMeshExtras { /// Content of the extra data. pub value: String, @@ -301,7 +301,7 @@ pub struct GltfMeshExtras { /// /// See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-extras). #[derive(Clone, Debug, Reflect, Default, Component)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Clone, Default, Debug)] pub struct GltfMaterialExtras { /// Content of the extra data. pub value: String, @@ -311,5 +311,5 @@ pub struct GltfMaterialExtras { /// /// See [the relevant glTF specification section](https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material). #[derive(Clone, Debug, Reflect, Default, Component)] -#[reflect(Component)] +#[reflect(Component, Clone)] pub struct GltfMaterialName(pub String); diff --git a/crates/bevy_image/src/image.rs b/crates/bevy_image/src/image.rs index af98ec1622..da2609028f 100644 --- a/crates/bevy_image/src/image.rs +++ b/crates/bevy_image/src/image.rs @@ -336,7 +336,7 @@ impl ImageFormat { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(opaque, Default, Debug) + reflect(opaque, Default, Debug, Clone) )] pub struct Image { /// Raw pixel data. diff --git a/crates/bevy_image/src/texture_atlas.rs b/crates/bevy_image/src/texture_atlas.rs index 1e9873d048..feaa8fc96c 100644 --- a/crates/bevy_image/src/texture_atlas.rs +++ b/crates/bevy_image/src/texture_atlas.rs @@ -87,7 +87,11 @@ impl TextureAtlasSources { /// /// [`TextureAtlasBuilder`]: crate::TextureAtlasBuilder #[derive(Asset, PartialEq, Eq, Debug, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -200,7 +204,7 @@ impl TextureAtlasLayout { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Default, Debug, PartialEq, Hash) + reflect(Default, Debug, PartialEq, Hash, Clone) )] pub struct TextureAtlas { /// Texture atlas layout handle diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index 9e505339ea..3a3e2c7cb7 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -33,7 +33,11 @@ use thiserror::Error; /// /// This event is produced by `bevy_input`. #[derive(Event, Debug, Clone, PartialEq, From)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -56,7 +60,11 @@ pub enum GamepadEvent { /// /// This event type is used by `bevy_input` to feed its components. #[derive(Event, Debug, Clone, PartialEq, From)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -73,7 +81,11 @@ pub enum RawGamepadEvent { /// [`GamepadButton`] changed event unfiltered by [`GamepadSettings`]. #[derive(Event, Debug, Copy, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -101,7 +113,11 @@ impl RawGamepadButtonChangedEvent { /// [`GamepadAxis`] changed event unfiltered by [`GamepadSettings`]. #[derive(Event, Debug, Copy, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -130,7 +146,11 @@ impl RawGamepadAxisChangedEvent { /// A Gamepad connection event. Created when a connection to a gamepad /// is established and when a gamepad is disconnected. #[derive(Event, Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -165,7 +185,11 @@ impl GamepadConnectionEvent { /// [`GamepadButton`] event triggered by a digital state change. #[derive(Event, Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -193,7 +217,11 @@ impl GamepadButtonStateChangedEvent { /// [`GamepadButton`] event triggered by an analog state change. #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -225,7 +253,11 @@ impl GamepadButtonChangedEvent { /// [`GamepadAxis`] event triggered by an analog state change. #[derive(Event, Debug, Clone, Copy, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), reflect(Serialize, Deserialize) @@ -334,7 +366,11 @@ pub enum ButtonSettingsError { /// } /// ``` #[derive(Component, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Component))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Component, Default) +)] #[require(GamepadSettings)] pub struct Gamepad { /// The USB vendor ID as assigned by the USB-IF, if available. @@ -534,7 +570,7 @@ impl Default for Gamepad { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -623,7 +659,11 @@ impl GamepadButton { /// This is used to determine which axis has changed its value when receiving a /// gamepad axis event. It is also used in the [`Gamepad`] component. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Hash, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -665,7 +705,11 @@ impl GamepadAxis { /// Encapsulation over [`GamepadAxis`] and [`GamepadButton`]. // This is done so Gamepad can share a single Axis and simplifies the API by having only one get/get_unclamped method #[derive(Debug, Copy, Clone, Eq, Hash, PartialEq, From)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Hash, PartialEq, Clone) +)] pub enum GamepadInput { /// A [`GamepadAxis`]. Axis(GamepadAxis), @@ -690,7 +734,7 @@ pub enum GamepadInput { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Component) + reflect(Debug, Default, Component, Clone) )] pub struct GamepadSettings { /// The default button settings. @@ -771,7 +815,11 @@ impl GamepadSettings { /// /// Allowed values: `0.0 <= ``release_threshold`` <= ``press_threshold`` <= 1.0` #[derive(Debug, PartialEq, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Default, Clone) +)] pub struct ButtonSettings { press_threshold: f32, release_threshold: f32, @@ -931,7 +979,11 @@ impl ButtonSettings { /// /// The valid range is `[-1.0, 1.0]`. #[derive(Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Default, Clone) +)] pub struct AxisSettings { /// Values that are higher than `livezone_upperbound` will be rounded up to 1.0. livezone_upperbound: f32, @@ -1355,7 +1407,11 @@ impl ScaledAxisPosition { /// /// The valid range is from 0.0 to 1.0, inclusive. #[derive(Debug, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Default, Clone) +)] pub struct ButtonAxisSettings { /// The high value at which to apply rounding. pub high: f32, @@ -1493,7 +1549,11 @@ pub fn gamepad_connection_system( // /// The connection status of a gamepad. #[derive(Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1623,7 +1683,11 @@ pub fn gamepad_event_processing_system( /// The intensity at which a gamepad's force-feedback motors may rumble. #[derive(Clone, Copy, Debug, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] pub struct GamepadRumbleIntensity { /// The rumble intensity of the strong gamepad motor. /// @@ -1711,7 +1775,7 @@ impl GamepadRumbleIntensity { #[doc(alias = "vibration")] #[doc(alias = "vibrate")] #[derive(Event, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Clone))] pub enum GamepadRumbleRequest { /// Add a rumble to the given gamepad. /// diff --git a/crates/bevy_input/src/gestures.rs b/crates/bevy_input/src/gestures.rs index 4f540fb139..5cd14d4634 100644 --- a/crates/bevy_input/src/gestures.rs +++ b/crates/bevy_input/src/gestures.rs @@ -18,7 +18,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// - Only available on **`macOS`** and **`iOS`**. /// - On **`iOS`**, must be enabled first #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -36,7 +40,11 @@ pub struct PinchGesture(pub f32); /// - Only available on **`macOS`** and **`iOS`**. /// - On **`iOS`**, must be enabled first #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -51,7 +59,11 @@ pub struct RotationGesture(pub f32); /// - Only available on **`macOS`** and **`iOS`**. /// - On **`iOS`**, must be enabled first #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -65,7 +77,11 @@ pub struct DoubleTapGesture; /// /// - On **`iOS`**, must be enabled first #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_input/src/keyboard.rs b/crates/bevy_input/src/keyboard.rs index 0525847062..ea5452fb53 100644 --- a/crates/bevy_input/src/keyboard.rs +++ b/crates/bevy_input/src/keyboard.rs @@ -98,7 +98,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Hash) + reflect(Debug, PartialEq, Hash, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -140,7 +140,7 @@ pub struct KeyboardInput { /// OS specific key combination that leads to Bevy window losing focus and not receiving any /// input events #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Clone, PartialEq))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -190,7 +190,11 @@ pub fn keyboard_input_system( /// - Correctly match key press and release events. /// - On non-web platforms, support assigning keybinds to virtually any key through a UI. #[derive(Debug, Clone, Ord, PartialOrd, Copy, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Clone, PartialEq, Hash) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -231,7 +235,7 @@ pub enum NativeKeyCode { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -727,7 +731,7 @@ pub enum KeyCode { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -760,7 +764,7 @@ pub enum NativeKey { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index 2da2c89cce..e1119c3d35 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -164,7 +164,7 @@ impl Plugin for InputPlugin { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( diff --git a/crates/bevy_input/src/mouse.rs b/crates/bevy_input/src/mouse.rs index 977b6e0aea..3a377d9329 100644 --- a/crates/bevy_input/src/mouse.rs +++ b/crates/bevy_input/src/mouse.rs @@ -27,7 +27,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// The event is read inside of the [`mouse_button_input_system`] /// to update the [`ButtonInput`] resource. #[derive(Event, Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -56,7 +60,7 @@ pub struct MouseButtonInput { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -88,7 +92,11 @@ pub enum MouseButton { /// /// [`DeviceEvent::MouseMotion`]: https://docs.rs/winit/latest/winit/event/enum.DeviceEvent.html#variant.MouseMotion #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -106,7 +114,11 @@ pub struct MouseMotion { /// The value of the event can either be interpreted as the amount of lines or the amount of pixels /// to scroll. #[derive(Debug, Hash, Clone, Copy, Eq, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -129,7 +141,11 @@ pub enum MouseScrollUnit { /// /// This event is the translated version of the `WindowEvent::MouseWheel` from the `winit` crate. #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -174,7 +190,7 @@ pub fn mouse_button_input_system( #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Resource, PartialEq) + reflect(Debug, Default, Resource, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -195,7 +211,7 @@ pub struct AccumulatedMouseMotion { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Resource, PartialEq) + reflect(Debug, Default, Resource, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( diff --git a/crates/bevy_input/src/touch.rs b/crates/bevy_input/src/touch.rs index e1784c13fd..3339e02f2e 100644 --- a/crates/bevy_input/src/touch.rs +++ b/crates/bevy_input/src/touch.rs @@ -38,7 +38,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// This event is the translated version of the `WindowEvent::Touch` from the `winit` crate. /// It is available to the end user and can be used for game logic. #[derive(Event, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -62,7 +66,11 @@ pub struct TouchInput { /// A force description of a [`Touch`] input. #[derive(Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -111,7 +119,7 @@ pub enum ForceTouch { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Hash, PartialEq) + reflect(Debug, Hash, PartialEq, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( diff --git a/crates/bevy_input_focus/src/autofocus.rs b/crates/bevy_input_focus/src/autofocus.rs index dc3b0919d2..72024418d2 100644 --- a/crates/bevy_input_focus/src/autofocus.rs +++ b/crates/bevy_input_focus/src/autofocus.rs @@ -18,7 +18,7 @@ use bevy_reflect::{prelude::*, Reflect}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Component) + reflect(Debug, Default, Component, Clone) )] #[component(on_add = on_auto_focus_added)] pub struct AutoFocus; diff --git a/crates/bevy_input_focus/src/directional_navigation.rs b/crates/bevy_input_focus/src/directional_navigation.rs index d42b7653f6..f02e523eb3 100644 --- a/crates/bevy_input_focus/src/directional_navigation.rs +++ b/crates/bevy_input_focus/src/directional_navigation.rs @@ -48,7 +48,7 @@ impl Plugin for DirectionalNavigationPlugin { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Default, Debug, PartialEq) + reflect(Default, Debug, PartialEq, Clone) )] pub struct NavNeighbors { /// The array of neighbors, one for each [`CompassOctant`]. @@ -94,7 +94,7 @@ impl NavNeighbors { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Resource, Debug, Default, PartialEq) + reflect(Resource, Debug, Default, PartialEq, Clone) )] pub struct DirectionalNavigationMap { /// A directed graph of focusable entities. diff --git a/crates/bevy_input_focus/src/lib.rs b/crates/bevy_input_focus/src/lib.rs index 573ce56d89..2697efc0c8 100644 --- a/crates/bevy_input_focus/src/lib.rs +++ b/crates/bevy_input_focus/src/lib.rs @@ -80,7 +80,7 @@ use bevy_reflect::{prelude::*, Reflect}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Resource) + reflect(Debug, Default, Resource, Clone) )] pub struct InputFocus(pub Option); @@ -123,7 +123,11 @@ impl InputFocus { /// /// By default, this resource is set to `false`. #[derive(Clone, Debug, Resource, Default)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Resource))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Resource, Clone) +)] pub struct InputFocusVisible(pub bool); /// A bubble-able user input event that starts at the currently focused entity. @@ -134,7 +138,7 @@ pub struct InputFocusVisible(pub bool); /// To set up your own bubbling input event, add the [`dispatch_focused_input::`](dispatch_focused_input) system to your app, /// in the [`InputFocusSet::Dispatch`] system set during [`PreUpdate`]. #[derive(Clone, Debug, Component)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component, Clone))] pub struct FocusedInput { /// The underlying input event. pub input: E, diff --git a/crates/bevy_input_focus/src/tab_navigation.rs b/crates/bevy_input_focus/src/tab_navigation.rs index d8ce83c8d7..2d44f7c330 100644 --- a/crates/bevy_input_focus/src/tab_navigation.rs +++ b/crates/bevy_input_focus/src/tab_navigation.rs @@ -58,7 +58,7 @@ use { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Component, PartialEq) + reflect(Debug, Default, Component, PartialEq, Clone) )] pub struct TabIndex(pub i32); @@ -67,7 +67,7 @@ pub struct TabIndex(pub i32); #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, Default, Component) + reflect(Debug, Default, Component, Clone) )] pub struct TabGroup { /// The order of the tab group relative to other tab groups. diff --git a/crates/bevy_math/src/aspect_ratio.rs b/crates/bevy_math/src/aspect_ratio.rs index 0289957164..7b7ae6d3ba 100644 --- a/crates/bevy_math/src/aspect_ratio.rs +++ b/crates/bevy_math/src/aspect_ratio.rs @@ -9,7 +9,11 @@ use bevy_reflect::Reflect; /// An `AspectRatio` is the ratio of width to height. #[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Into)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] pub struct AspectRatio(f32); impl AspectRatio { diff --git a/crates/bevy_math/src/bounding/bounded2d/mod.rs b/crates/bevy_math/src/bounding/bounded2d/mod.rs index 4fb2e2e327..bea18f5808 100644 --- a/crates/bevy_math/src/bounding/bounded2d/mod.rs +++ b/crates/bevy_math/src/bounding/bounded2d/mod.rs @@ -37,7 +37,11 @@ pub trait Bounded2d { /// A 2D axis-aligned bounding box, or bounding rectangle #[doc(alias = "BoundingRectangle")] #[derive(Clone, Copy, Debug, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(Serialize), derive(Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -460,7 +464,11 @@ use crate::primitives::Circle; /// A bounding circle #[derive(Clone, Copy, Debug, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(Serialize), derive(Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/bounding/bounded3d/mod.rs b/crates/bevy_math/src/bounding/bounded3d/mod.rs index a04fdb3b5b..5a95b7711f 100644 --- a/crates/bevy_math/src/bounding/bounded3d/mod.rs +++ b/crates/bevy_math/src/bounding/bounded3d/mod.rs @@ -42,7 +42,11 @@ pub trait Bounded3d { /// A 3D axis-aligned bounding box #[derive(Clone, Copy, Debug, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(Serialize), derive(Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -467,7 +471,11 @@ use crate::primitives::Sphere; /// A bounding sphere #[derive(Clone, Copy, Debug, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(Serialize), derive(Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/bounding/raycast2d.rs b/crates/bevy_math/src/bounding/raycast2d.rs index 3b46bcfba6..e1def01936 100644 --- a/crates/bevy_math/src/bounding/raycast2d.rs +++ b/crates/bevy_math/src/bounding/raycast2d.rs @@ -9,7 +9,7 @@ use bevy_reflect::Reflect; /// A raycast intersection test for 2D bounding volumes #[derive(Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct RayCast2d { /// The ray for the test pub ray: Ray2d, @@ -109,7 +109,7 @@ impl IntersectsVolume for RayCast2d { /// An intersection test that casts an [`Aabb2d`] along a ray. #[derive(Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct AabbCast2d { /// The ray along which to cast the bounding volume pub ray: RayCast2d, @@ -147,7 +147,7 @@ impl IntersectsVolume for AabbCast2d { /// An intersection test that casts a [`BoundingCircle`] along a ray. #[derive(Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct BoundingCircleCast { /// The ray along which to cast the bounding volume pub ray: RayCast2d, diff --git a/crates/bevy_math/src/bounding/raycast3d.rs b/crates/bevy_math/src/bounding/raycast3d.rs index bfd5d17a0d..9086837f60 100644 --- a/crates/bevy_math/src/bounding/raycast3d.rs +++ b/crates/bevy_math/src/bounding/raycast3d.rs @@ -9,7 +9,7 @@ use bevy_reflect::Reflect; /// A raycast intersection test for 3D bounding volumes #[derive(Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct RayCast3d { /// The origin of the ray. pub origin: Vec3A, @@ -106,7 +106,7 @@ impl IntersectsVolume for RayCast3d { /// An intersection test that casts an [`Aabb3d`] along a ray. #[derive(Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct AabbCast3d { /// The ray along which to cast the bounding volume pub ray: RayCast3d, @@ -151,7 +151,7 @@ impl IntersectsVolume for AabbCast3d { /// An intersection test that casts a [`BoundingSphere`] along a ray. #[derive(Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct BoundingSphereCast { /// The ray along which to cast the bounding volume pub ray: RayCast3d, diff --git a/crates/bevy_math/src/compass.rs b/crates/bevy_math/src/compass.rs index 72dd817146..ea3d74c939 100644 --- a/crates/bevy_math/src/compass.rs +++ b/crates/bevy_math/src/compass.rs @@ -20,7 +20,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// ``` #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Hash, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Deserialize, Serialize) @@ -89,7 +93,11 @@ impl CompassQuadrant { /// ``` #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Hash, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Deserialize, Serialize) diff --git a/crates/bevy_math/src/cubic_splines/mod.rs b/crates/bevy_math/src/cubic_splines/mod.rs index 29e0f643c1..6f60de774a 100644 --- a/crates/bevy_math/src/cubic_splines/mod.rs +++ b/crates/bevy_math/src/cubic_splines/mod.rs @@ -51,7 +51,7 @@ use {alloc::vec, alloc::vec::Vec, core::iter::once, itertools::Itertools}; /// ``` #[derive(Clone, Debug)] #[cfg(feature = "alloc")] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct CubicBezier { /// The control points of the Bezier curve. pub control_points: Vec<[P; 4]>, @@ -141,7 +141,7 @@ pub struct CubicBezierError; /// [`to_curve_cyclic`]: CyclicCubicGenerator::to_curve_cyclic #[derive(Clone, Debug)] #[cfg(feature = "alloc")] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct CubicHermite { /// The control points of the Hermite curve. pub control_points: Vec<(P, P)>, @@ -270,7 +270,7 @@ impl CyclicCubicGenerator

for CubicHermite

{ /// [`to_curve_cyclic`]: CyclicCubicGenerator::to_curve_cyclic #[derive(Clone, Debug)] #[cfg(feature = "alloc")] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct CubicCardinalSpline { /// Tension pub tension: f32, @@ -432,7 +432,7 @@ impl CyclicCubicGenerator

for CubicCardinalSpline

{ /// [`to_curve_cyclic`]: CyclicCubicGenerator::to_curve_cyclic #[derive(Clone, Debug)] #[cfg(feature = "alloc")] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct CubicBSpline { /// The control points of the spline pub control_points: Vec

, @@ -609,7 +609,7 @@ pub enum CubicNurbsError { /// ``` #[derive(Clone, Debug)] #[cfg(feature = "alloc")] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct CubicNurbs { /// The control points of the NURBS pub control_points: Vec

, @@ -841,7 +841,7 @@ impl RationalGenerator

for CubicNurbs

{ /// [`to_curve_cyclic`]: CyclicCubicGenerator::to_curve_cyclic #[derive(Clone, Debug)] #[cfg(feature = "alloc")] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct LinearSpline { /// The control points of the linear spline. pub points: Vec

, @@ -952,7 +952,11 @@ pub trait CyclicCubicGenerator { /// [`Curve`]: crate::curve::Curve #[derive(Copy, Clone, Debug, Default, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Default, Clone) +)] pub struct CubicSegment { /// Polynomial coefficients for the segment. pub coeff: [P; 4], @@ -1173,7 +1177,7 @@ impl CubicSegment { #[derive(Clone, Debug, PartialEq)] #[cfg(feature = "alloc")] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct CubicCurve { /// The segments comprising the curve. This must always be nonempty. segments: Vec>, @@ -1330,7 +1334,11 @@ pub trait RationalGenerator { /// [`Curve`]: crate::curve::Curve #[derive(Copy, Clone, Debug, Default, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Default, Clone) +)] pub struct RationalSegment { /// The coefficients matrix of the cubic curve. pub coeff: [P; 4], @@ -1469,7 +1477,7 @@ impl RationalSegment

{ #[derive(Clone, Debug, PartialEq)] #[cfg(feature = "alloc")] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] pub struct RationalCurve { /// The segments comprising the curve. This must always be nonempty. segments: Vec>, diff --git a/crates/bevy_math/src/curve/adaptors.rs b/crates/bevy_math/src/curve/adaptors.rs index afc34837d3..055002c9bb 100644 --- a/crates/bevy_math/src/curve/adaptors.rs +++ b/crates/bevy_math/src/curve/adaptors.rs @@ -91,7 +91,7 @@ pub struct FunctionCurve { pub(crate) domain: Interval, #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] pub(crate) f: F, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -192,7 +192,7 @@ pub struct MapCurve { pub(crate) preimage: C, #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] pub(crate) f: F, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData<(fn() -> S, fn(S) -> T)>, } @@ -289,7 +289,7 @@ pub struct ReparamCurve { pub(crate) base: C, #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] pub(crate) f: F, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -383,7 +383,7 @@ pub struct LinearReparamCurve { pub(crate) base: C, /// Invariants: This interval must always be bounded. pub(crate) new_domain: Interval, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -416,7 +416,7 @@ where pub struct CurveReparamCurve { pub(crate) base: C, pub(crate) reparam_curve: D, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -448,7 +448,7 @@ where )] pub struct GraphCurve { pub(crate) base: C, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -480,7 +480,7 @@ pub struct ZipCurve { pub(crate) domain: Interval, pub(crate) first: C, pub(crate) second: D, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData (S, T)>, } @@ -520,7 +520,7 @@ where pub struct ChainCurve { pub(crate) first: C, pub(crate) second: D, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -569,7 +569,7 @@ where )] pub struct ReverseCurve { pub(crate) curve: C, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -611,7 +611,7 @@ where pub struct RepeatCurve { pub(crate) domain: Interval, pub(crate) curve: C, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -669,7 +669,7 @@ where )] pub struct ForeverCurve { pub(crate) curve: C, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -723,7 +723,7 @@ where )] pub struct PingPongCurve { pub(crate) curve: C, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } @@ -780,7 +780,7 @@ pub struct ContinuationCurve { pub(crate) second: D, // cache the offset in the curve directly to prevent triple sampling for every sample we make pub(crate) offset: T, - #[cfg_attr(feature = "bevy_reflect", reflect(ignore))] + #[cfg_attr(feature = "bevy_reflect", reflect(ignore, clone))] pub(crate) _phantom: PhantomData T>, } diff --git a/crates/bevy_math/src/curve/easing.rs b/crates/bevy_math/src/curve/easing.rs index 18f42d3f13..c0b452e001 100644 --- a/crates/bevy_math/src/curve/easing.rs +++ b/crates/bevy_math/src/curve/easing.rs @@ -8,6 +8,9 @@ use crate::{ Dir2, Dir3, Dir3A, Isometry2d, Isometry3d, Quat, Rot2, VectorSpace, }; +#[cfg(feature = "bevy_reflect")] +use bevy_reflect::std_traits::ReflectDefault; + use variadics_please::all_tuples_enumerated; // TODO: Think about merging `Ease` with `StableInterpolate` @@ -275,7 +278,11 @@ where /// [CSS step function specification]: https://developer.mozilla.org/en-US/docs/Web/CSS/easing-function/steps#description #[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))] +#[cfg_attr( + feature = "bevy_reflect", + derive(bevy_reflect::Reflect), + reflect(Clone, Default, PartialEq) +)] pub enum JumpAt { /// Indicates that the first step happens when the animation begins. /// @@ -356,7 +363,11 @@ impl JumpAt { #[non_exhaustive] #[derive(Debug, Copy, Clone, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(bevy_reflect::Reflect))] +#[cfg_attr( + feature = "bevy_reflect", + derive(bevy_reflect::Reflect), + reflect(Clone, PartialEq) +)] // Note: Graphs are auto-generated via `tools/build-easefunction-graphs`. pub enum EaseFunction { /// `f(t) = t` diff --git a/crates/bevy_math/src/curve/interval.rs b/crates/bevy_math/src/curve/interval.rs index 007e523c95..03ffc0c486 100644 --- a/crates/bevy_math/src/curve/interval.rs +++ b/crates/bevy_math/src/curve/interval.rs @@ -18,7 +18,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// will always have some nonempty interior. #[derive(Debug, Clone, Copy, PartialEq, PartialOrd)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) diff --git a/crates/bevy_math/src/direction.rs b/crates/bevy_math/src/direction.rs index f9b98021d3..45138f20e2 100644 --- a/crates/bevy_math/src/direction.rs +++ b/crates/bevy_math/src/direction.rs @@ -82,7 +82,11 @@ fn assert_is_normalized(message: &str, length_squared: f32) { /// A normalized vector pointing in a direction in 2D space #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -356,7 +360,11 @@ impl approx::UlpsEq for Dir2 { /// A normalized vector pointing in a direction in 3D space #[derive(Clone, Copy, Debug, PartialEq, Into)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -617,7 +625,11 @@ impl approx::UlpsEq for Dir3 { /// This may or may not be faster than [`Dir3`]: make sure to benchmark! #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) diff --git a/crates/bevy_math/src/float_ord.rs b/crates/bevy_math/src/float_ord.rs index 2369b0f6dc..e69c6b35e0 100644 --- a/crates/bevy_math/src/float_ord.rs +++ b/crates/bevy_math/src/float_ord.rs @@ -20,7 +20,7 @@ use bevy_reflect::Reflect; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Hash) + reflect(Debug, PartialEq, Hash, Clone) )] pub struct FloatOrd(pub f32); diff --git a/crates/bevy_math/src/isometry.rs b/crates/bevy_math/src/isometry.rs index 1d88736d3b..a221615b0a 100644 --- a/crates/bevy_math/src/isometry.rs +++ b/crates/bevy_math/src/isometry.rs @@ -88,7 +88,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -366,7 +366,7 @@ impl UlpsEq for Isometry2d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/primitives/dim2.rs b/crates/bevy_math/src/primitives/dim2.rs index 5ca224929a..613345bcd8 100644 --- a/crates/bevy_math/src/primitives/dim2.rs +++ b/crates/bevy_math/src/primitives/dim2.rs @@ -25,7 +25,7 @@ use alloc::{boxed::Box, vec::Vec}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -112,7 +112,7 @@ impl Measured2d for Circle { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -279,7 +279,7 @@ impl Arc2d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -422,7 +422,7 @@ impl CircularSector { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -776,7 +776,7 @@ mod arc_tests { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -926,7 +926,7 @@ impl Measured2d for Ellipse { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1025,7 +1025,7 @@ impl Measured2d for Annulus { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1161,7 +1161,7 @@ impl Measured2d for Rhombus { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1199,7 +1199,11 @@ impl Plane2d { /// For a finite line: [`Segment2d`] #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -1214,7 +1218,11 @@ impl Primitive2d for Line2d {} /// A line segment defined by two endpoints in 2D space. #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -1489,7 +1497,11 @@ impl From<(Vec2, Vec2)> for Segment2d { /// For a version without generics: [`BoxedPolyline2d`] #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -1558,7 +1570,7 @@ impl BoxedPolyline2d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1729,7 +1741,7 @@ impl Measured2d for Triangle2d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1819,7 +1831,11 @@ impl Measured2d for Rectangle { /// For a version without generics: [`BoxedPolygon`] #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -1869,7 +1885,11 @@ impl From> for Polygon { /// A convex polygon with `N` vertices. #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -1988,7 +2008,7 @@ impl BoxedPolygon { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -2134,7 +2154,7 @@ impl Measured2d for RegularPolygon { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/primitives/dim3.rs b/crates/bevy_math/src/primitives/dim3.rs index e39e3be729..a36db0ade5 100644 --- a/crates/bevy_math/src/primitives/dim3.rs +++ b/crates/bevy_math/src/primitives/dim3.rs @@ -21,7 +21,7 @@ use alloc::{boxed::Box, vec::Vec}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -93,7 +93,7 @@ impl Measured3d for Sphere { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -165,7 +165,7 @@ impl Plane3d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -338,7 +338,11 @@ impl InfinitePlane3d { /// For a finite line: [`Segment3d`] #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -352,7 +356,11 @@ impl Primitive3d for Line3d {} /// A line segment defined by two endpoints in 3D space. #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -563,7 +571,11 @@ impl From<(Vec3, Vec3)> for Segment3d { /// For a version without generics: [`BoxedPolyline3d`] #[derive(Clone, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Serialize, Deserialize) @@ -633,7 +645,7 @@ impl BoxedPolyline3d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -725,7 +737,7 @@ impl Measured3d for Cuboid { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -803,7 +815,7 @@ impl Measured3d for Cylinder { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -873,7 +885,7 @@ impl Measured3d for Capsule3d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -955,7 +967,7 @@ impl Measured3d for Cone { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1007,7 +1019,7 @@ pub enum TorusKind { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1118,7 +1130,7 @@ impl Measured3d for Torus { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1311,7 +1323,7 @@ impl Measured2d for Triangle3d { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/ray.rs b/crates/bevy_math/src/ray.rs index 273ed61fa4..5fe9c3740a 100644 --- a/crates/bevy_math/src/ray.rs +++ b/crates/bevy_math/src/ray.rs @@ -12,7 +12,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// An infinite half-line starting at `origin` and going in `direction` in 2D space. #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Deserialize, Serialize) @@ -54,7 +58,11 @@ impl Ray2d { /// An infinite half-line starting at `origin` and going in `direction` in 3D space. #[derive(Clone, Copy, Debug, PartialEq)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), reflect(Deserialize, Serialize) diff --git a/crates/bevy_math/src/rects/irect.rs b/crates/bevy_math/src/rects/irect.rs index 73e830f085..74da994b36 100644 --- a/crates/bevy_math/src/rects/irect.rs +++ b/crates/bevy_math/src/rects/irect.rs @@ -19,7 +19,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Hash, Default) + reflect(Debug, PartialEq, Hash, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/rects/rect.rs b/crates/bevy_math/src/rects/rect.rs index 901a569a71..92b7059945 100644 --- a/crates/bevy_math/src/rects/rect.rs +++ b/crates/bevy_math/src/rects/rect.rs @@ -19,7 +19,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/rects/urect.rs b/crates/bevy_math/src/rects/urect.rs index 5412750465..9d19c5ae7c 100644 --- a/crates/bevy_math/src/rects/urect.rs +++ b/crates/bevy_math/src/rects/urect.rs @@ -19,7 +19,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Hash, Default) + reflect(Debug, PartialEq, Hash, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_math/src/rotation2d.rs b/crates/bevy_math/src/rotation2d.rs index 3f5d3031cf..1320f6363a 100644 --- a/crates/bevy_math/src/rotation2d.rs +++ b/crates/bevy_math/src/rotation2d.rs @@ -42,7 +42,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_mesh/src/index.rs b/crates/bevy_mesh/src/index.rs index d9593543a8..d2497e2c50 100644 --- a/crates/bevy_mesh/src/index.rs +++ b/crates/bevy_mesh/src/index.rs @@ -70,6 +70,7 @@ pub enum MeshTrianglesError { /// /// It describes the order in which the vertex attributes should be joined into faces. #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub enum Indices { U16(Vec), U32(Vec), diff --git a/crates/bevy_mesh/src/mesh.rs b/crates/bevy_mesh/src/mesh.rs index eec67d6664..e4868dbf69 100644 --- a/crates/bevy_mesh/src/mesh.rs +++ b/crates/bevy_mesh/src/mesh.rs @@ -105,14 +105,15 @@ pub const VERTEX_ATTRIBUTE_BUFFER_ID: u64 = 10; /// which means that Bevy would *only* render the "front" of each triangle, which /// is the side of the triangle from where the vertices appear in a *counter-clockwise* order. #[derive(Asset, Debug, Clone, Reflect)] +#[reflect(Clone)] pub struct Mesh { - #[reflect(ignore)] + #[reflect(ignore, clone)] primitive_topology: PrimitiveTopology, /// `std::collections::BTreeMap` with all defined vertex attributes (Positions, Normals, ...) /// for this mesh. Attribute ids to attribute values. /// Uses a [`BTreeMap`] because, unlike `HashMap`, it has a defined iteration order, /// which allows easy stable `VertexBuffers` (i.e. same buffer order) - #[reflect(ignore)] + #[reflect(ignore, clone)] attributes: BTreeMap, indices: Option, morph_targets: Option>, diff --git a/crates/bevy_mesh/src/morph.rs b/crates/bevy_mesh/src/morph.rs index b2a46305aa..a8ff3be037 100644 --- a/crates/bevy_mesh/src/morph.rs +++ b/crates/bevy_mesh/src/morph.rs @@ -111,7 +111,7 @@ impl MorphTargetImage { /// /// [morph targets]: https://en.wikipedia.org/wiki/Morph_target_animation #[derive(Reflect, Default, Debug, Clone, Component)] -#[reflect(Debug, Component, Default)] +#[reflect(Debug, Component, Default, Clone)] pub struct MorphWeights { weights: Vec, /// The first mesh primitive assigned to these weights @@ -156,7 +156,7 @@ impl MorphWeights { /// /// [morph targets]: https://en.wikipedia.org/wiki/Morph_target_animation #[derive(Reflect, Default, Debug, Clone, Component)] -#[reflect(Debug, Component, Default)] +#[reflect(Debug, Component, Default, Clone)] pub struct MeshMorphWeights { weights: Vec, } diff --git a/crates/bevy_mesh/src/primitives/dim2.rs b/crates/bevy_mesh/src/primitives/dim2.rs index 16440e9b00..61eaaf8ef8 100644 --- a/crates/bevy_mesh/src/primitives/dim2.rs +++ b/crates/bevy_mesh/src/primitives/dim2.rs @@ -17,7 +17,7 @@ use wgpu_types::PrimitiveTopology; /// A builder used for creating a [`Mesh`] with a [`Circle`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct CircleMeshBuilder { /// The [`Circle`] shape. pub circle: Circle, @@ -101,7 +101,7 @@ impl From for Mesh { /// scaled to fit the bounding box of the shape, which would be good for packed textures only including the /// portion of the circle that is needed to display. #[derive(Copy, Clone, Debug, PartialEq, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] #[non_exhaustive] pub enum CircularMeshUvMode { /// Treats the shape as a mask over a circle of equal size and radius, @@ -123,7 +123,7 @@ impl Default for CircularMeshUvMode { /// The resulting mesh will have a UV-map such that the center of the circle is /// at the center of the texture. #[derive(Clone, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct CircularSectorMeshBuilder { /// The sector shape. pub sector: CircularSector, @@ -261,7 +261,7 @@ impl From for Mesh { /// The resulting mesh will have a UV-map such that the center of the circle is /// at the center of the texture. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct CircularSegmentMeshBuilder { /// The segment shape. pub segment: CircularSegment, @@ -408,7 +408,7 @@ impl From for Mesh { /// You must verify that the `vertices` are not concave when constructing this type. You can /// guarantee this by creating a [`ConvexPolygon`] first, then calling [`ConvexPolygon::mesh()`]. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Debug)] +#[reflect(Debug, Clone)] pub struct ConvexPolygonMeshBuilder { pub vertices: [Vec2; N], } @@ -459,7 +459,7 @@ impl From> for Mesh { /// A builder used for creating a [`Mesh`] with a [`RegularPolygon`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct RegularPolygonMeshBuilder { circumradius: f32, sides: u32, @@ -533,7 +533,7 @@ impl From for Mesh { /// A builder used for creating a [`Mesh`] with an [`Ellipse`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct EllipseMeshBuilder { /// The [`Ellipse`] shape. pub ellipse: Ellipse, @@ -638,7 +638,7 @@ impl From for Mesh { /// A builder for creating a [`Mesh`] with an [`Annulus`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct AnnulusMeshBuilder { /// The [`Annulus`] shape. pub annulus: Annulus, @@ -771,7 +771,7 @@ impl From for Mesh { /// A builder for creating a [`Mesh`] with an [`Rhombus`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct RhombusMeshBuilder { half_diagonals: Vec2, } @@ -857,7 +857,7 @@ impl From for Mesh { /// A builder used for creating a [`Mesh`] with a [`Triangle2d`] shape. #[derive(Clone, Copy, Debug, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct Triangle2dMeshBuilder { triangle: Triangle2d, } @@ -934,7 +934,7 @@ impl From for Mesh { /// A builder used for creating a [`Mesh`] with a [`Rectangle`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct RectangleMeshBuilder { half_size: Vec2, } @@ -1014,7 +1014,7 @@ impl From for Mesh { /// A builder used for creating a [`Mesh`] with a [`Capsule2d`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct Capsule2dMeshBuilder { /// The [`Capsule2d`] shape. pub capsule: Capsule2d, diff --git a/crates/bevy_mesh/src/primitives/dim3/capsule.rs b/crates/bevy_mesh/src/primitives/dim3/capsule.rs index 81c7f77306..f46ebce0d1 100644 --- a/crates/bevy_mesh/src/primitives/dim3/capsule.rs +++ b/crates/bevy_mesh/src/primitives/dim3/capsule.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// Manner in which UV coordinates are distributed vertically. #[derive(Clone, Copy, Debug, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub enum CapsuleUvProfile { /// UV space is distributed by how much of the capsule consists of the hemispheres. #[default] @@ -19,7 +19,7 @@ pub enum CapsuleUvProfile { /// A builder used for creating a [`Mesh`] with a [`Capsule3d`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct Capsule3dMeshBuilder { /// The [`Capsule3d`] shape. pub capsule: Capsule3d, diff --git a/crates/bevy_mesh/src/primitives/dim3/cone.rs b/crates/bevy_mesh/src/primitives/dim3/cone.rs index fde4425370..d06a57f832 100644 --- a/crates/bevy_mesh/src/primitives/dim3/cone.rs +++ b/crates/bevy_mesh/src/primitives/dim3/cone.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// Anchoring options for [`ConeMeshBuilder`] #[derive(Debug, Copy, Clone, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub enum ConeAnchor { #[default] /// Midpoint between the tip of the cone and the center of its base. @@ -18,7 +18,7 @@ pub enum ConeAnchor { /// A builder used for creating a [`Mesh`] with a [`Cone`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct ConeMeshBuilder { /// The [`Cone`] shape. pub cone: Cone, diff --git a/crates/bevy_mesh/src/primitives/dim3/conical_frustum.rs b/crates/bevy_mesh/src/primitives/dim3/conical_frustum.rs index a90e9f972d..8c69378c01 100644 --- a/crates/bevy_mesh/src/primitives/dim3/conical_frustum.rs +++ b/crates/bevy_mesh/src/primitives/dim3/conical_frustum.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// A builder used for creating a [`Mesh`] with a [`ConicalFrustum`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct ConicalFrustumMeshBuilder { /// The [`ConicalFrustum`] shape. pub frustum: ConicalFrustum, diff --git a/crates/bevy_mesh/src/primitives/dim3/cuboid.rs b/crates/bevy_mesh/src/primitives/dim3/cuboid.rs index 30689ab131..40a7cd45d4 100644 --- a/crates/bevy_mesh/src/primitives/dim3/cuboid.rs +++ b/crates/bevy_mesh/src/primitives/dim3/cuboid.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// A builder used for creating a [`Mesh`] with a [`Cuboid`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct CuboidMeshBuilder { half_size: Vec3, } diff --git a/crates/bevy_mesh/src/primitives/dim3/cylinder.rs b/crates/bevy_mesh/src/primitives/dim3/cylinder.rs index 3c06caea84..7b1b45974e 100644 --- a/crates/bevy_mesh/src/primitives/dim3/cylinder.rs +++ b/crates/bevy_mesh/src/primitives/dim3/cylinder.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// Anchoring options for [`CylinderMeshBuilder`] #[derive(Debug, Copy, Clone, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub enum CylinderAnchor { #[default] /// Midpoint between the top and bottom caps of the cylinder @@ -18,7 +18,7 @@ pub enum CylinderAnchor { /// A builder used for creating a [`Mesh`] with a [`Cylinder`] shape. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct CylinderMeshBuilder { /// The [`Cylinder`] shape. pub cylinder: Cylinder, diff --git a/crates/bevy_mesh/src/primitives/dim3/plane.rs b/crates/bevy_mesh/src/primitives/dim3/plane.rs index 9a2621a163..fd892469be 100644 --- a/crates/bevy_mesh/src/primitives/dim3/plane.rs +++ b/crates/bevy_mesh/src/primitives/dim3/plane.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// A builder used for creating a [`Mesh`] with a [`Plane3d`] shape. #[derive(Clone, Copy, Debug, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct PlaneMeshBuilder { /// The [`Plane3d`] shape. pub plane: Plane3d, diff --git a/crates/bevy_mesh/src/primitives/dim3/sphere.rs b/crates/bevy_mesh/src/primitives/dim3/sphere.rs index 686887b13e..6ae8eec5ed 100644 --- a/crates/bevy_mesh/src/primitives/dim3/sphere.rs +++ b/crates/bevy_mesh/src/primitives/dim3/sphere.rs @@ -21,7 +21,7 @@ pub enum IcosphereError { /// A type of sphere mesh. #[derive(Clone, Copy, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub enum SphereKind { /// An icosphere, a spherical mesh that consists of similar sized triangles. Ico { @@ -49,7 +49,7 @@ impl Default for SphereKind { /// A builder used for creating a [`Mesh`] with an [`Sphere`] shape. #[derive(Clone, Copy, Debug, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct SphereMeshBuilder { /// The [`Sphere`] shape. pub sphere: Sphere, diff --git a/crates/bevy_mesh/src/primitives/dim3/tetrahedron.rs b/crates/bevy_mesh/src/primitives/dim3/tetrahedron.rs index dcb88a758e..529805d9a6 100644 --- a/crates/bevy_mesh/src/primitives/dim3/tetrahedron.rs +++ b/crates/bevy_mesh/src/primitives/dim3/tetrahedron.rs @@ -6,7 +6,7 @@ use bevy_reflect::prelude::*; /// A builder used for creating a [`Mesh`] with a [`Tetrahedron`] shape. #[derive(Clone, Copy, Debug, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct TetrahedronMeshBuilder { tetrahedron: Tetrahedron, } diff --git a/crates/bevy_mesh/src/primitives/dim3/torus.rs b/crates/bevy_mesh/src/primitives/dim3/torus.rs index 6d9c802e6c..6f370c1341 100644 --- a/crates/bevy_mesh/src/primitives/dim3/torus.rs +++ b/crates/bevy_mesh/src/primitives/dim3/torus.rs @@ -6,7 +6,7 @@ use core::ops::RangeInclusive; /// A builder used for creating a [`Mesh`] with a [`Torus`] shape. #[derive(Clone, Debug, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct TorusMeshBuilder { /// The [`Torus`] shape. pub torus: Torus, diff --git a/crates/bevy_mesh/src/primitives/dim3/triangle3d.rs b/crates/bevy_mesh/src/primitives/dim3/triangle3d.rs index f605dbeaf1..e35f272ab9 100644 --- a/crates/bevy_mesh/src/primitives/dim3/triangle3d.rs +++ b/crates/bevy_mesh/src/primitives/dim3/triangle3d.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; /// A builder used for creating a [`Mesh`] with a [`Triangle3d`] shape. #[derive(Clone, Copy, Debug, Default, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct Triangle3dMeshBuilder { triangle: Triangle3d, } diff --git a/crates/bevy_mesh/src/skinning.rs b/crates/bevy_mesh/src/skinning.rs index a35ac36224..53b93f9ff2 100644 --- a/crates/bevy_mesh/src/skinning.rs +++ b/crates/bevy_mesh/src/skinning.rs @@ -5,7 +5,7 @@ use bevy_reflect::prelude::*; use core::ops::Deref; #[derive(Component, Debug, Default, Clone, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct SkinnedMesh { pub inverse_bindposes: Handle, #[entities] diff --git a/crates/bevy_pbr/src/atmosphere/mod.rs b/crates/bevy_pbr/src/atmosphere/mod.rs index 273bba947b..e445a5adc8 100644 --- a/crates/bevy_pbr/src/atmosphere/mod.rs +++ b/crates/bevy_pbr/src/atmosphere/mod.rs @@ -42,7 +42,7 @@ use bevy_ecs::{ system::{lifetimeless::Read, Query}, }; use bevy_math::{UVec2, UVec3, Vec3}; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use bevy_render::{ extract_component::UniformComponentPlugin, render_resource::{DownlevelFlags, ShaderType, SpecializedRenderPipelines}, @@ -254,6 +254,7 @@ impl Plugin for AtmospherePlugin { /// high altitude. #[derive(Clone, Component, Reflect, ShaderType)] #[require(AtmosphereSettings)] +#[reflect(Clone, Default)] pub struct Atmosphere { /// Radius of the planet /// @@ -392,6 +393,7 @@ impl ExtractComponent for Atmosphere { /// scattered towards the camera at each point (RGB channels), alongside the average /// transmittance to that point (A channel). #[derive(Clone, Component, Reflect, ShaderType)] +#[reflect(Clone, Default)] pub struct AtmosphereSettings { /// The size of the transmittance LUT pub transmittance_lut_size: UVec2, diff --git a/crates/bevy_pbr/src/cluster/mod.rs b/crates/bevy_pbr/src/cluster/mod.rs index d8a1466320..5657cd29d3 100644 --- a/crates/bevy_pbr/src/cluster/mod.rs +++ b/crates/bevy_pbr/src/cluster/mod.rs @@ -66,6 +66,7 @@ const CLUSTER_COUNT_MASK: u32 = (1 << CLUSTER_COUNT_SIZE) - 1; /// Configure the far z-plane mode used for the furthest depth slice for clustered forward /// rendering #[derive(Debug, Copy, Clone, Reflect)] +#[reflect(Clone)] pub enum ClusterFarZMode { /// Calculate the required maximum z-depth based on currently visible /// clusterable objects. Makes better use of available clusters, speeding @@ -78,7 +79,7 @@ pub enum ClusterFarZMode { /// Configure the depth-slicing strategy for clustered forward rendering #[derive(Debug, Copy, Clone, Reflect)] -#[reflect(Default)] +#[reflect(Default, Clone)] pub struct ClusterZConfig { /// Far `Z` plane of the first depth slice pub first_slice_depth: f32, @@ -88,7 +89,7 @@ pub struct ClusterZConfig { /// Configuration of the clustering strategy for clustered forward rendering #[derive(Debug, Copy, Clone, Component, Reflect)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub enum ClusterConfig { /// Disable cluster calculations for this view None, diff --git a/crates/bevy_pbr/src/components.rs b/crates/bevy_pbr/src/components.rs index d5418910eb..d70da7cd95 100644 --- a/crates/bevy_pbr/src/components.rs +++ b/crates/bevy_pbr/src/components.rs @@ -9,23 +9,23 @@ use bevy_render::sync_world::MainEntity; /// This component contains all mesh entities visible from the current light view. /// The collection is updated automatically by [`crate::SimulationLightSystems`]. #[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub struct VisibleMeshEntities { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub entities: Vec, } #[derive(Component, Clone, Debug, Default, Reflect, Deref, DerefMut)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub struct RenderVisibleMeshEntities { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub entities: Vec<(Entity, MainEntity)>, } #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub struct CubemapVisibleEntities { - #[reflect(ignore)] + #[reflect(ignore, clone)] data: [VisibleMeshEntities; 6], } @@ -48,9 +48,9 @@ impl CubemapVisibleEntities { } #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub struct RenderCubemapVisibleEntities { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub(crate) data: [RenderVisibleMeshEntities; 6], } @@ -73,17 +73,17 @@ impl RenderCubemapVisibleEntities { } #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[reflect(Component, Default, Clone)] pub struct CascadesVisibleEntities { /// Map of view entity to the visible entities for each cascade frustum. - #[reflect(ignore)] + #[reflect(ignore, clone)] pub entities: EntityHashMap>, } #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[reflect(Component, Default, Clone)] pub struct RenderCascadesVisibleEntities { /// Map of view entity to the visible entities for each cascade frustum. - #[reflect(ignore)] + #[reflect(ignore, clone)] pub entities: EntityHashMap>, } diff --git a/crates/bevy_pbr/src/decal/clustered.rs b/crates/bevy_pbr/src/decal/clustered.rs index 0114943b10..67de430fe4 100644 --- a/crates/bevy_pbr/src/decal/clustered.rs +++ b/crates/bevy_pbr/src/decal/clustered.rs @@ -80,7 +80,7 @@ pub struct ClusteredDecalPlugin; /// used on WebGL 2, WebGPU, macOS, or iOS. Bevy's clustered decals can be used /// with forward or deferred rendering and don't require a prepass. #[derive(Component, Debug, Clone, Reflect, ExtractComponent)] -#[reflect(Component, Debug)] +#[reflect(Component, Debug, Clone)] #[require(Transform, Visibility, VisibilityClass)] #[component(on_add = view::add_visibility_class::)] pub struct ClusteredDecal { diff --git a/crates/bevy_pbr/src/extended_material.rs b/crates/bevy_pbr/src/extended_material.rs index 6869043903..b79f3c3d2c 100644 --- a/crates/bevy_pbr/src/extended_material.rs +++ b/crates/bevy_pbr/src/extended_material.rs @@ -128,6 +128,7 @@ pub trait MaterialExtension: Asset + AsBindGroup + Clone + Sized { /// the `extended_material` example). #[derive(Asset, Clone, Debug, Reflect)] #[reflect(type_path = false)] +#[reflect(Clone)] pub struct ExtendedMaterial { pub base: B, pub extension: E, diff --git a/crates/bevy_pbr/src/fog.rs b/crates/bevy_pbr/src/fog.rs index 6d2b6bdfdf..21a89ccc70 100644 --- a/crates/bevy_pbr/src/fog.rs +++ b/crates/bevy_pbr/src/fog.rs @@ -47,7 +47,7 @@ use bevy_render::{extract_component::ExtractComponent, prelude::Camera}; /// [`StandardMaterial`](crate::StandardMaterial) instances via the `fog_enabled` flag. #[derive(Debug, Clone, Component, Reflect, ExtractComponent)] #[extract_component_filter(With)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct DistanceFog { /// The color of the fog effect. /// @@ -94,6 +94,7 @@ pub struct DistanceFog { /// - [`FogFalloff::from_visibility_contrast_color()`] /// - [`FogFalloff::from_visibility_contrast_colors()`] #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub enum FogFalloff { /// A linear fog falloff that grows in intensity between `start` and `end` distances. /// diff --git a/crates/bevy_pbr/src/light/ambient_light.rs b/crates/bevy_pbr/src/light/ambient_light.rs index f09bab51f6..db255722b3 100644 --- a/crates/bevy_pbr/src/light/ambient_light.rs +++ b/crates/bevy_pbr/src/light/ambient_light.rs @@ -18,7 +18,7 @@ use super::*; /// } /// ``` #[derive(Resource, Component, Clone, Debug, ExtractResource, ExtractComponent, Reflect)] -#[reflect(Resource, Component, Debug, Default)] +#[reflect(Resource, Component, Debug, Default, Clone)] #[require(Camera)] pub struct AmbientLight { pub color: Color, diff --git a/crates/bevy_pbr/src/light/directional_light.rs b/crates/bevy_pbr/src/light/directional_light.rs index 1eb17ea9ab..b04a17bf0b 100644 --- a/crates/bevy_pbr/src/light/directional_light.rs +++ b/crates/bevy_pbr/src/light/directional_light.rs @@ -50,7 +50,7 @@ use super::*; /// .insert_resource(DirectionalLightShadowMap { size: 2048 }); /// ``` #[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require( Cascades, CascadesFrusta, diff --git a/crates/bevy_pbr/src/light/mod.rs b/crates/bevy_pbr/src/light/mod.rs index 1c9dc61374..3f57464e21 100644 --- a/crates/bevy_pbr/src/light/mod.rs +++ b/crates/bevy_pbr/src/light/mod.rs @@ -92,7 +92,7 @@ pub mod light_consts { } #[derive(Resource, Clone, Debug, Reflect)] -#[reflect(Resource, Debug, Default)] +#[reflect(Resource, Debug, Default, Clone)] pub struct PointLightShadowMap { pub size: usize, } @@ -109,7 +109,7 @@ pub type WithLight = Or<(With, With, With, @@ -276,13 +276,14 @@ impl From for CascadeShadowConfig { } #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub struct Cascades { /// Map from a view to the configuration of each of its [`Cascade`]s. pub(crate) cascades: EntityHashMap>, } #[derive(Clone, Debug, Default, Reflect)] +#[reflect(Clone, Default)] pub struct Cascade { /// The transform of the light, i.e. the view to world matrix. pub(crate) world_from_cascade: Mat4, @@ -472,7 +473,7 @@ pub struct TransmittedShadowReceiver; /// The different modes use different approaches to /// [Percentage Closer Filtering](https://developer.nvidia.com/gpugems/gpugems/part-ii-lighting-and-shadows/chapter-11-shadow-map-antialiasing). #[derive(Debug, Component, ExtractComponent, Reflect, Clone, Copy, PartialEq, Eq, Default)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub enum ShadowFilteringMethod { /// Hardware 2x2. /// diff --git a/crates/bevy_pbr/src/light/point_light.rs b/crates/bevy_pbr/src/light/point_light.rs index 800c7b9bd0..4f4795fb55 100644 --- a/crates/bevy_pbr/src/light/point_light.rs +++ b/crates/bevy_pbr/src/light/point_light.rs @@ -20,7 +20,7 @@ use super::*; /// /// Source: [Wikipedia](https://en.wikipedia.org/wiki/Lumen_(unit)#Lighting) #[derive(Component, Debug, Clone, Copy, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require( CubemapFrusta, CubemapVisibleEntities, diff --git a/crates/bevy_pbr/src/light/spot_light.rs b/crates/bevy_pbr/src/light/spot_light.rs index 08160a8cfa..a7cfe1b817 100644 --- a/crates/bevy_pbr/src/light/spot_light.rs +++ b/crates/bevy_pbr/src/light/spot_light.rs @@ -8,7 +8,7 @@ use super::*; /// shines light only in a given direction. The direction is taken from /// the transform, and can be specified with [`Transform::looking_at`](Transform::looking_at). #[derive(Component, Debug, Clone, Copy, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require(Frustum, VisibleMeshEntities, Transform, Visibility, VisibilityClass)] #[component(on_add = view::add_visibility_class::)] pub struct SpotLight { diff --git a/crates/bevy_pbr/src/light_probe/environment_map.rs b/crates/bevy_pbr/src/light_probe/environment_map.rs index 8069f2acac..52ccaef432 100644 --- a/crates/bevy_pbr/src/light_probe/environment_map.rs +++ b/crates/bevy_pbr/src/light_probe/environment_map.rs @@ -81,7 +81,7 @@ pub const ENVIRONMENT_MAP_SHADER_HANDLE: Handle = /// /// See [`crate::environment_map`] for detailed information. #[derive(Clone, Component, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct EnvironmentMapLight { /// The blurry image that represents diffuse radiance surrounding a region. pub diffuse_map: Handle, diff --git a/crates/bevy_pbr/src/light_probe/irradiance_volume.rs b/crates/bevy_pbr/src/light_probe/irradiance_volume.rs index c7722eb3db..05dd51c379 100644 --- a/crates/bevy_pbr/src/light_probe/irradiance_volume.rs +++ b/crates/bevy_pbr/src/light_probe/irradiance_volume.rs @@ -168,7 +168,7 @@ pub(crate) const IRRADIANCE_VOLUMES_ARE_USABLE: bool = cfg!(not(target_arch = "w /// /// See [`crate::irradiance_volume`] for detailed information. #[derive(Clone, Reflect, Component, Debug)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct IrradianceVolume { /// The 3D texture that represents the ambient cubes, encoded in the format /// described in [`crate::irradiance_volume`]. diff --git a/crates/bevy_pbr/src/light_probe/mod.rs b/crates/bevy_pbr/src/light_probe/mod.rs index 9b7eefba34..2779209da1 100644 --- a/crates/bevy_pbr/src/light_probe/mod.rs +++ b/crates/bevy_pbr/src/light_probe/mod.rs @@ -106,7 +106,7 @@ pub struct LightProbePlugin; /// specific technique but rather to a class of techniques. Developers familiar /// with other engines should be aware of this terminology difference. #[derive(Component, Debug, Clone, Copy, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require(Transform, Visibility)] pub struct LightProbe; diff --git a/crates/bevy_pbr/src/lightmap/mod.rs b/crates/bevy_pbr/src/lightmap/mod.rs index 80df8c73ae..741085fd9f 100644 --- a/crates/bevy_pbr/src/lightmap/mod.rs +++ b/crates/bevy_pbr/src/lightmap/mod.rs @@ -88,7 +88,7 @@ pub struct LightmapPlugin; /// has a second UV layer ([`ATTRIBUTE_UV_1`](bevy_render::mesh::Mesh::ATTRIBUTE_UV_1)), /// then the lightmap will render using those UVs. #[derive(Component, Clone, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct Lightmap { /// The lightmap texture. pub image: Handle, diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 372b6547e8..1ac3930a0a 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -1114,7 +1114,7 @@ pub fn queue_material_meshes( /// Default render method used for opaque materials. #[derive(Default, Resource, Clone, Debug, ExtractResource, Reflect)] -#[reflect(Resource, Default, Debug)] +#[reflect(Resource, Default, Debug, Clone)] pub struct DefaultOpaqueRendererMethod(OpaqueRendererMethod); impl DefaultOpaqueRendererMethod { @@ -1154,6 +1154,7 @@ impl DefaultOpaqueRendererMethod { /// /// If a material indicates `OpaqueRendererMethod::Auto`, `DefaultOpaqueRendererMethod` will be used. #[derive(Default, Clone, Copy, Debug, PartialEq, Reflect)] +#[reflect(Default, Clone, PartialEq)] pub enum OpaqueRendererMethod { #[default] Forward, diff --git a/crates/bevy_pbr/src/material_bind_groups.rs b/crates/bevy_pbr/src/material_bind_groups.rs index 28ed7c5213..442050d9b2 100644 --- a/crates/bevy_pbr/src/material_bind_groups.rs +++ b/crates/bevy_pbr/src/material_bind_groups.rs @@ -259,6 +259,7 @@ enum BindingResourceArray<'a> { /// The location of a material (either bindless or non-bindless) within the /// slabs. #[derive(Clone, Copy, Debug, Default, Reflect)] +#[reflect(Clone, Default)] pub struct MaterialBindingId { /// The index of the bind group (slab) where the GPU data is located. pub group: MaterialBindGroupIndex, @@ -273,7 +274,7 @@ pub struct MaterialBindingId { /// In bindless mode, each bind group contains multiple materials. In /// non-bindless mode, each bind group contains only one material. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Reflect, Deref, DerefMut)] -#[reflect(Default)] +#[reflect(Default, Clone, PartialEq, Hash)] pub struct MaterialBindGroupIndex(pub u32); impl From for MaterialBindGroupIndex { @@ -289,7 +290,7 @@ impl From for MaterialBindGroupIndex { /// bind group, since multiple materials are packed into a single slab. In /// non-bindless mode, this slot is always 0. #[derive(Clone, Copy, Debug, Default, PartialEq, Reflect, Deref, DerefMut)] -#[reflect(Default)] +#[reflect(Default, Clone, PartialEq)] pub struct MaterialBindGroupSlot(pub u32); /// The CPU/GPU synchronization state of a buffer that we maintain. diff --git a/crates/bevy_pbr/src/mesh_material.rs b/crates/bevy_pbr/src/mesh_material.rs index d782dde883..027f2073ec 100644 --- a/crates/bevy_pbr/src/mesh_material.rs +++ b/crates/bevy_pbr/src/mesh_material.rs @@ -37,7 +37,7 @@ use derive_more::derive::From; /// } /// ``` #[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, From)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone, PartialEq)] pub struct MeshMaterial3d(pub Handle); impl Default for MeshMaterial3d { diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index ef5c443598..2e483b210c 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -290,7 +290,7 @@ impl Plugin for MeshletPlugin { /// The meshlet mesh equivalent of [`bevy_render::mesh::Mesh3d`]. #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone, PartialEq)] #[require(Transform, PreviousGlobalTransform, Visibility, VisibilityClass)] #[component(on_add = view::add_visibility_class::)] pub struct MeshletMesh3d(pub Handle); diff --git a/crates/bevy_pbr/src/parallax.rs b/crates/bevy_pbr/src/parallax.rs index e458f88146..0a847b7c25 100644 --- a/crates/bevy_pbr/src/parallax.rs +++ b/crates/bevy_pbr/src/parallax.rs @@ -1,4 +1,4 @@ -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// The [parallax mapping] method to use to compute depth based on the /// material's [`depth_map`]. @@ -12,6 +12,7 @@ use bevy_reflect::Reflect; /// [`depth_map`]: crate::StandardMaterial::depth_map /// [parallax mapping]: https://en.wikipedia.org/wiki/Parallax_mapping #[derive(Debug, Copy, Clone, PartialEq, Eq, Default, Reflect)] +#[reflect(Default, Clone, PartialEq)] pub enum ParallaxMappingMethod { /// A simple linear interpolation, using a single texture sample. /// diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 3fe4e90c15..4989c2536b 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -17,7 +17,7 @@ use crate::{deferred::DEFAULT_PBR_DEFERRED_LIGHTING_PASS_ID, *}; /// [`bevy_render::mesh::Mesh::ATTRIBUTE_UV_1`]. /// The default is [`UvChannel::Uv0`]. #[derive(Reflect, Default, Debug, Clone, PartialEq, Eq)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone, PartialEq)] pub enum UvChannel { #[default] Uv0, @@ -33,7 +33,7 @@ pub enum UvChannel { #[bind_group_data(StandardMaterialKey)] #[data(0, StandardMaterialUniform, binding_array(10))] #[bindless] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct StandardMaterial { /// The color of the surface of the material before lighting. /// @@ -631,7 +631,7 @@ pub struct StandardMaterial { /// /// [`Mesh`]: bevy_render::mesh::Mesh // TODO: include this in reflection somehow (maybe via remote types like serde https://serde.rs/remote-derive.html) - #[reflect(ignore)] + #[reflect(ignore, clone)] pub cull_mode: Option, /// Whether to apply only the base color to this material. diff --git a/crates/bevy_pbr/src/ssao/mod.rs b/crates/bevy_pbr/src/ssao/mod.rs index 704809e5e9..7a2a1fc264 100644 --- a/crates/bevy_pbr/src/ssao/mod.rs +++ b/crates/bevy_pbr/src/ssao/mod.rs @@ -151,7 +151,7 @@ impl Plugin for ScreenSpaceAmbientOcclusionPlugin { /// /// SSAO is not supported on `WebGL2`, and is not currently supported on `WebGPU`. #[derive(Component, ExtractComponent, Reflect, PartialEq, Clone, Debug)] -#[reflect(Component, Debug, Default, PartialEq)] +#[reflect(Component, Debug, Default, PartialEq, Clone)] #[require(DepthPrepass, NormalPrepass)] #[doc(alias = "Ssao")] pub struct ScreenSpaceAmbientOcclusion { @@ -174,6 +174,7 @@ impl Default for ScreenSpaceAmbientOcclusion { } #[derive(Reflect, PartialEq, Eq, Hash, Clone, Copy, Default, Debug)] +#[reflect(PartialEq, Hash, Clone, Default)] pub enum ScreenSpaceAmbientOcclusionQualityLevel { Low, Medium, diff --git a/crates/bevy_pbr/src/ssr/mod.rs b/crates/bevy_pbr/src/ssr/mod.rs index 9cbac7ddd5..1ee73da8f0 100644 --- a/crates/bevy_pbr/src/ssr/mod.rs +++ b/crates/bevy_pbr/src/ssr/mod.rs @@ -81,7 +81,7 @@ pub struct ScreenSpaceReflectionsPlugin; /// bug whereby Naga doesn't generate correct GLSL when sampling depth buffers, /// which is required for screen-space raymarching. #[derive(Clone, Copy, Component, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] #[require(DepthPrepass, DeferredPrepass)] #[doc(alias = "Ssr")] pub struct ScreenSpaceReflections { diff --git a/crates/bevy_pbr/src/volumetric_fog/mod.rs b/crates/bevy_pbr/src/volumetric_fog/mod.rs index bdacd4641c..b9f1d60945 100644 --- a/crates/bevy_pbr/src/volumetric_fog/mod.rs +++ b/crates/bevy_pbr/src/volumetric_fog/mod.rs @@ -71,14 +71,14 @@ pub struct VolumetricFogPlugin; /// /// This allows the light to generate light shafts/god rays. #[derive(Clone, Copy, Component, Default, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct VolumetricLight; /// When placed on a [`bevy_core_pipeline::core_3d::Camera3d`], enables /// volumetric fog and volumetric lighting, also known as light shafts or god /// rays. #[derive(Clone, Copy, Component, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct VolumetricFog { /// Color of the ambient light. /// @@ -116,7 +116,7 @@ pub struct VolumetricFog { } #[derive(Clone, Component, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require(Transform, Visibility)] pub struct FogVolume { /// The color of the fog. diff --git a/crates/bevy_pbr/src/wireframe.rs b/crates/bevy_pbr/src/wireframe.rs index a8baae9b50..88082c2880 100644 --- a/crates/bevy_pbr/src/wireframe.rs +++ b/crates/bevy_pbr/src/wireframe.rs @@ -60,7 +60,7 @@ impl Plugin for WireframePlugin { /// /// This requires the [`WireframePlugin`] to be enabled. #[derive(Component, Debug, Clone, Default, Reflect, Eq, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct Wireframe; /// Sets the color of the [`Wireframe`] of the entity it is attached to. @@ -73,7 +73,7 @@ pub struct Wireframe; // This could blow up in size if people use random colored wireframes for each mesh. // It will also be important to remove unused materials from the cache. #[derive(Component, Debug, Clone, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct WireframeColor { pub color: Color, } @@ -83,11 +83,11 @@ pub struct WireframeColor { /// /// This requires the [`WireframePlugin`] to be enabled. #[derive(Component, Debug, Clone, Default, Reflect, Eq, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct NoWireframe; #[derive(Resource, Debug, Clone, Default, ExtractResource, Reflect)] -#[reflect(Resource, Debug, Default)] +#[reflect(Resource, Debug, Default, Clone)] pub struct WireframeConfig { /// Whether to show wireframes for all meshes. /// Can be overridden for individual meshes by adding a [`Wireframe`] or [`NoWireframe`] component. @@ -222,6 +222,7 @@ fn get_wireframe_material( } #[derive(Default, AsBindGroup, Debug, Clone, Asset, Reflect)] +#[reflect(Default, Clone)] pub struct WireframeMaterial { #[uniform(0)] pub color: LinearRgba, diff --git a/crates/bevy_picking/src/backend.rs b/crates/bevy_picking/src/backend.rs index 5c18d57211..6c0db34e72 100644 --- a/crates/bevy_picking/src/backend.rs +++ b/crates/bevy_picking/src/backend.rs @@ -56,7 +56,7 @@ pub mod prelude { /// ambiguities with picking backends. Take care to ensure such systems are explicitly ordered /// against [`PickSet::Backend`](crate::PickSet::Backend), or better, avoid reading `PointerHits` in `PreUpdate`. #[derive(Event, Debug, Clone, Reflect)] -#[reflect(Debug)] +#[reflect(Debug, Clone)] pub struct PointerHits { /// The pointer associated with this hit test. pub pointer: prelude::PointerId, @@ -96,6 +96,7 @@ impl PointerHits { /// Holds data from a successful pointer hit test. See [`HitData::depth`] for important details. #[derive(Clone, Debug, PartialEq, Reflect)] +#[reflect(Clone, PartialEq)] pub struct HitData { /// The camera entity used to detect this hit. Useful when you need to find the ray that was /// casted for this hit when using a raycasting backend. @@ -139,6 +140,7 @@ pub mod ray { /// Identifies a ray constructed from some (pointer, camera) combination. A pointer can be over /// multiple cameras, which is why a single pointer may have multiple rays. #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Reflect)] + #[reflect(Clone, PartialEq, Hash)] pub struct RayId { /// The camera whose projection was used to calculate the ray. pub camera: Entity, diff --git a/crates/bevy_picking/src/events.rs b/crates/bevy_picking/src/events.rs index 7d4e14895d..16240700af 100644 --- a/crates/bevy_picking/src/events.rs +++ b/crates/bevy_picking/src/events.rs @@ -60,7 +60,7 @@ use crate::{ /// The documentation for the [`pointer_events`] explains the events this module exposes and /// the order in which they fire. #[derive(Clone, PartialEq, Debug, Reflect, Component)] -#[reflect(Component, Debug)] +#[reflect(Component, Debug, Clone)] pub struct Pointer { /// The original target of this picking event, before bubbling pub target: Entity, @@ -146,6 +146,7 @@ impl Pointer { /// Fires when a pointer is canceled, and its current interaction state is dropped. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Cancel { /// Information about the picking intersection. pub hit: HitData, @@ -153,6 +154,7 @@ pub struct Cancel { /// Fires when a the pointer crosses into the bounds of the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Over { /// Information about the picking intersection. pub hit: HitData, @@ -160,6 +162,7 @@ pub struct Over { /// Fires when a the pointer crosses out of the bounds of the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Out { /// Information about the latest prior picking intersection. pub hit: HitData, @@ -167,6 +170,7 @@ pub struct Out { /// Fires when a pointer button is pressed over the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Pressed { /// Pointer button pressed to trigger this event. pub button: PointerButton, @@ -176,6 +180,7 @@ pub struct Pressed { /// Fires when a pointer button is released over the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Released { /// Pointer button lifted to trigger this event. pub button: PointerButton, @@ -186,6 +191,7 @@ pub struct Released { /// Fires when a pointer sends a pointer pressed event followed by a pointer released event, with the same /// `target` entity for both events. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Click { /// Pointer button pressed and lifted to trigger this event. pub button: PointerButton, @@ -197,6 +203,7 @@ pub struct Click { /// Fires while a pointer is moving over the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Move { /// Information about the picking intersection. pub hit: HitData, @@ -206,6 +213,7 @@ pub struct Move { /// Fires when the `target` entity receives a pointer pressed event followed by a pointer move event. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragStart { /// Pointer button pressed and moved to trigger this event. pub button: PointerButton, @@ -215,6 +223,7 @@ pub struct DragStart { /// Fires while the `target` entity is being dragged. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Drag { /// Pointer button pressed and moved to trigger this event. pub button: PointerButton, @@ -226,6 +235,7 @@ pub struct Drag { /// Fires when a pointer is dragging the `target` entity and a pointer released event is received. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragEnd { /// Pointer button pressed, moved, and released to trigger this event. pub button: PointerButton, @@ -235,6 +245,7 @@ pub struct DragEnd { /// Fires when a pointer dragging the `dragged` entity enters the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragEnter { /// Pointer button pressed to enter drag. pub button: PointerButton, @@ -246,6 +257,7 @@ pub struct DragEnter { /// Fires while the `dragged` entity is being dragged over the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragOver { /// Pointer button pressed while dragging over. pub button: PointerButton, @@ -257,6 +269,7 @@ pub struct DragOver { /// Fires when a pointer dragging the `dragged` entity leaves the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragLeave { /// Pointer button pressed while leaving drag. pub button: PointerButton, @@ -268,6 +281,7 @@ pub struct DragLeave { /// Fires when a pointer drops the `dropped` entity onto the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragDrop { /// Pointer button released to drop. pub button: PointerButton, @@ -279,6 +293,7 @@ pub struct DragDrop { /// Dragging state. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct DragEntry { /// The position of the pointer at drag start. pub start_pos: Vec2, @@ -288,6 +303,7 @@ pub struct DragEntry { /// Fires while a pointer is scrolling over the `target` entity. #[derive(Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq)] pub struct Scroll { /// The mouse scroll unit. pub unit: MouseScrollUnit, diff --git a/crates/bevy_picking/src/hover.rs b/crates/bevy_picking/src/hover.rs index d989ddfa65..5e5e715890 100644 --- a/crates/bevy_picking/src/hover.rs +++ b/crates/bevy_picking/src/hover.rs @@ -189,7 +189,7 @@ fn build_hover_map( /// the entity will be considered pressed. If that entity is instead being hovered by both pointers, /// it will be considered hovered. #[derive(Component, Copy, Clone, Default, Eq, PartialEq, Debug, Reflect)] -#[reflect(Component, Default, PartialEq, Debug)] +#[reflect(Component, Default, PartialEq, Debug, Clone)] pub enum PickingInteraction { /// The entity is being pressed down by a pointer. Pressed = 2, diff --git a/crates/bevy_picking/src/input.rs b/crates/bevy_picking/src/input.rs index 19c0cf24c2..ce87df95b4 100644 --- a/crates/bevy_picking/src/input.rs +++ b/crates/bevy_picking/src/input.rs @@ -48,7 +48,7 @@ pub mod prelude { /// This plugin contains several settings, and is added to the world as a resource after initialization. /// You can configure pointer input settings at runtime by accessing the resource. #[derive(Copy, Clone, Resource, Debug, Reflect)] -#[reflect(Resource, Default)] +#[reflect(Resource, Default, Clone)] pub struct PointerInputPlugin { /// Should touch inputs be updated? pub is_touch_enabled: bool, diff --git a/crates/bevy_picking/src/lib.rs b/crates/bevy_picking/src/lib.rs index 2fb61142d1..17e8c994b1 100644 --- a/crates/bevy_picking/src/lib.rs +++ b/crates/bevy_picking/src/lib.rs @@ -195,7 +195,7 @@ pub mod prelude { /// /// See the documentation on the fields for more details. #[derive(Component, Debug, Clone, Reflect, PartialEq, Eq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct Pickable { /// Should this entity block entities below it from being picked? /// @@ -300,7 +300,7 @@ impl PluginGroup for DefaultPickingPlugins { /// This plugin contains several settings, and is added to the world as a resource after initialization. You /// can configure picking settings at runtime through the resource. #[derive(Copy, Clone, Debug, Resource, Reflect)] -#[reflect(Resource, Default, Debug)] +#[reflect(Resource, Default, Debug, Clone)] pub struct PickingPlugin { /// Enables and disables all picking features. pub is_enabled: bool, diff --git a/crates/bevy_picking/src/mesh_picking/mod.rs b/crates/bevy_picking/src/mesh_picking/mod.rs index 6007168ee8..3e6241e28c 100644 --- a/crates/bevy_picking/src/mesh_picking/mod.rs +++ b/crates/bevy_picking/src/mesh_picking/mod.rs @@ -57,7 +57,7 @@ impl Default for MeshPickingSettings { /// An optional component that marks cameras and target entities that should be used in the [`MeshPickingPlugin`]. /// Only needed if [`MeshPickingSettings::require_markers`] is set to `true`, and ignored otherwise. #[derive(Debug, Clone, Default, Component, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct RayCastPickable; /// Adds the mesh picking backend to your app. diff --git a/crates/bevy_picking/src/mesh_picking/ray_cast/intersections.rs b/crates/bevy_picking/src/mesh_picking/ray_cast/intersections.rs index 317310f48c..7b15fe7121 100644 --- a/crates/bevy_picking/src/mesh_picking/ray_cast/intersections.rs +++ b/crates/bevy_picking/src/mesh_picking/ray_cast/intersections.rs @@ -6,6 +6,7 @@ use super::Backfaces; /// Hit data for an intersection between a ray and a mesh. #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub struct RayMeshHit { /// The point of intersection in world space. pub point: Vec3, diff --git a/crates/bevy_picking/src/mesh_picking/ray_cast/mod.rs b/crates/bevy_picking/src/mesh_picking/ray_cast/mod.rs index ef6f187416..2eec8c86b7 100644 --- a/crates/bevy_picking/src/mesh_picking/ray_cast/mod.rs +++ b/crates/bevy_picking/src/mesh_picking/ray_cast/mod.rs @@ -22,6 +22,7 @@ use tracing::*; /// How a ray cast should handle [`Visibility`]. #[derive(Clone, Copy, Reflect)] +#[reflect(Clone)] pub enum RayCastVisibility { /// Completely ignore visibility checks. Hidden items can still be ray casted against. Any, @@ -89,7 +90,7 @@ impl<'a> Default for MeshRayCastSettings<'a> { /// /// By default, backfaces are culled. #[derive(Copy, Clone, Default, Reflect)] -#[reflect(Default)] +#[reflect(Default, Clone)] pub enum Backfaces { /// Cull backfaces. #[default] @@ -100,14 +101,14 @@ pub enum Backfaces { /// Disables backface culling for [ray casts](MeshRayCast) on this entity. #[derive(Component, Copy, Clone, Default, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct RayCastBackfaces; /// A simplified mesh component that can be used for [ray casting](super::MeshRayCast). /// /// Consider using this component for complex meshes that don't need perfectly accurate ray casting. #[derive(Component, Clone, Debug, Deref, DerefMut, Reflect)] -#[reflect(Component, Debug)] +#[reflect(Component, Debug, Clone)] pub struct SimplifiedMesh(pub Handle); type MeshFilter = Or<(With, With, With)>; diff --git a/crates/bevy_picking/src/pointer.rs b/crates/bevy_picking/src/pointer.rs index 1b14a19525..c061065d74 100644 --- a/crates/bevy_picking/src/pointer.rs +++ b/crates/bevy_picking/src/pointer.rs @@ -28,7 +28,7 @@ use crate::backend::HitData; /// stable ID that persists regardless of the Entity they are associated with. #[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, Component, Reflect)] #[require(PointerLocation, PointerPress, PointerInteraction)] -#[reflect(Component, Default, Debug, Hash, PartialEq)] +#[reflect(Component, Default, Debug, Hash, PartialEq, Clone)] pub enum PointerId { /// The mouse pointer. #[default] @@ -37,7 +37,7 @@ pub enum PointerId { Touch(u64), /// A custom, uniquely identified pointer. Useful for mocking inputs or implementing a software /// controlled cursor. - #[reflect(ignore)] + #[reflect(ignore, clone)] Custom(Uuid), } @@ -67,7 +67,7 @@ impl PointerId { /// Holds a list of entities this pointer is currently interacting with, sorted from nearest to /// farthest. #[derive(Debug, Default, Clone, Component, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct PointerInteraction { pub(crate) sorted_entities: Vec<(Entity, HitData)>, } @@ -110,7 +110,7 @@ pub fn update_pointer_map(pointers: Query<(Entity, &PointerId)>, mut map: ResMut /// Tracks the state of the pointer's buttons in response to [`PointerInput`] events. #[derive(Debug, Default, Clone, Component, Reflect, PartialEq, Eq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct PointerPress { primary: bool, secondary: bool, @@ -145,6 +145,7 @@ impl PointerPress { /// The stage of the pointer button press event #[derive(Debug, Clone, Copy, PartialEq, Eq, Reflect)] +#[reflect(Clone, PartialEq)] pub enum PressDirection { /// The pointer button was just pressed Pressed, @@ -154,6 +155,7 @@ pub enum PressDirection { /// The button that was just pressed or released #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Reflect)] +#[reflect(Clone, PartialEq)] pub enum PointerButton { /// The primary pointer button Primary, @@ -172,11 +174,11 @@ impl PointerButton { /// Component that tracks a pointer's current [`Location`]. #[derive(Debug, Default, Clone, Component, Reflect, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct PointerLocation { /// The [`Location`] of the pointer. Note that a location is both the target, and the position /// on the target. - #[reflect(ignore)] + #[reflect(ignore, clone)] pub location: Option, } @@ -204,7 +206,7 @@ impl PointerLocation { /// render target. It is up to picking backends to associate a Pointer's `Location` with a /// specific `Camera`, if any. #[derive(Debug, Clone, Component, Reflect, PartialEq)] -#[reflect(Component, Debug, PartialEq)] +#[reflect(Component, Debug, PartialEq, Clone)] pub struct Location { /// The [`NormalizedRenderTarget`] associated with the pointer, usually a window. pub target: NormalizedRenderTarget, @@ -242,6 +244,7 @@ impl Location { /// Event sent to drive a pointer. #[derive(Debug, Clone, Copy, Reflect)] +#[reflect(Clone)] pub enum PointerAction { /// Causes the pointer to press a button. Press(PointerButton), @@ -267,6 +270,7 @@ pub enum PointerAction { /// An input event effecting a pointer. #[derive(Event, Debug, Clone, Reflect)] +#[reflect(Clone)] pub struct PointerInput { /// The id of the pointer. pub pointer_id: PointerId, diff --git a/crates/bevy_render/src/alpha.rs b/crates/bevy_render/src/alpha.rs index 12e1377eab..dd74881119 100644 --- a/crates/bevy_render/src/alpha.rs +++ b/crates/bevy_render/src/alpha.rs @@ -3,7 +3,7 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect}; // TODO: add discussion about performance. /// Sets how a material's base color alpha channel is used for transparency. #[derive(Debug, Default, Reflect, Copy, Clone, PartialEq)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub enum AlphaMode { /// Base color alpha values are overridden to be fully opaque (1.0). #[default] diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 01c649d54f..d38cb3fbca 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -54,7 +54,7 @@ use wgpu::{BlendState, TextureFormat, TextureUsages}; /// You can overlay multiple cameras in a single window using viewports to create effects like /// split screen, minimaps, and character viewers. #[derive(Reflect, Debug, Clone)] -#[reflect(Default)] +#[reflect(Default, Clone)] pub struct Viewport { /// The physical position to render this viewport to within the [`RenderTarget`] of this [`Camera`]. /// (0,0) corresponds to the top-left corner @@ -141,6 +141,7 @@ impl Viewport { /// example have the following values: /// `full_size` = 32x18, `size` = 16x9, `offset` = 16,9 #[derive(Debug, Clone, Copy, Reflect, PartialEq)] +#[reflect(Clone, PartialEq, Default)] pub struct SubCameraView { /// Size of the entire camera view pub full_size: UVec2, @@ -187,7 +188,7 @@ pub struct ComputedCameraValues { /// #[derive(Component, Clone, Copy, Reflect)] #[reflect(opaque)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct Exposure { /// pub ev100: f32, @@ -331,7 +332,7 @@ pub enum ViewportConversionError { /// [`Camera2d`]: https://docs.rs/bevy/latest/bevy/core_pipeline/core_2d/struct.Camera2d.html /// [`Camera3d`]: https://docs.rs/bevy/latest/bevy/core_pipeline/core_3d/struct.Camera3d.html #[derive(Component, Debug, Reflect, Clone)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[component(on_add = warn_on_no_render_graph)] #[require( Frustum, @@ -351,7 +352,7 @@ pub struct Camera { /// camera will not be rendered. pub is_active: bool, /// Computed values for this camera, such as the projection matrix and the render target size. - #[reflect(ignore)] + #[reflect(ignore, clone)] pub computed: ComputedCameraValues, /// The "target" that this camera will render to. pub target: RenderTarget, @@ -360,7 +361,7 @@ pub struct Camera { pub hdr: bool, // todo: reflect this when #6042 lands /// The [`CameraOutputMode`] for this camera. - #[reflect(ignore)] + #[reflect(ignore, clone)] pub output_mode: CameraOutputMode, /// If this is enabled, a previous camera exists that shares this camera's render target, and this camera has MSAA enabled, then the previous camera's /// outputs will be written to the intermediate multi-sampled render target textures for this camera. This enables cameras with MSAA enabled to @@ -749,7 +750,7 @@ impl Default for CameraOutputMode { /// Configures the [`RenderGraph`](crate::render_graph::RenderGraph) name assigned to be run for a given [`Camera`] entity. #[derive(Component, Debug, Deref, DerefMut, Reflect, Clone)] #[reflect(opaque)] -#[reflect(Component, Debug)] +#[reflect(Component, Debug, Clone)] pub struct CameraRenderGraph(InternedRenderSubGraph); impl CameraRenderGraph { @@ -769,6 +770,7 @@ impl CameraRenderGraph { /// The "target" that a [`Camera`] will render to. For example, this could be a [`Window`] /// swapchain or an [`Image`]. #[derive(Debug, Clone, Reflect, From)] +#[reflect(Clone)] pub enum RenderTarget { /// Window to which the camera's view is rendered. Window(WindowRef), @@ -781,6 +783,7 @@ pub enum RenderTarget { /// A render target that renders to an [`Image`]. #[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash, PartialOrd, Ord)] +#[reflect(Clone, PartialEq, Hash)] pub struct ImageRenderTarget { /// The image to render to. pub handle: Handle, @@ -814,6 +817,7 @@ impl Default for RenderTarget { /// /// Once we have this we shouldn't need to resolve it down anymore. #[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash, PartialOrd, Ord, From)] +#[reflect(Clone, PartialEq, Hash)] pub enum NormalizedRenderTarget { /// Window to which the camera's view is rendered. Window(NormalizedWindowRef), @@ -1058,7 +1062,7 @@ pub fn camera_system( /// This component lets you control the [`TextureUsages`] field of the main texture generated for the camera #[derive(Component, ExtractComponent, Clone, Copy, Reflect)] #[reflect(opaque)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct CameraMainTextureUsages(pub TextureUsages); impl Default for CameraMainTextureUsages { fn default() -> Self { @@ -1309,7 +1313,7 @@ pub fn sort_cameras( /// /// [`OrthographicProjection`]: crate::camera::OrthographicProjection #[derive(Component, Clone, Default, Reflect)] -#[reflect(Default, Component)] +#[reflect(Default, Component, Clone)] pub struct TemporalJitter { /// Offset is in range [-0.5, 0.5]. pub offset: Vec2, diff --git a/crates/bevy_render/src/camera/clear_color.rs b/crates/bevy_render/src/camera/clear_color.rs index 49dbdea76b..157bcf8998 100644 --- a/crates/bevy_render/src/camera/clear_color.rs +++ b/crates/bevy_render/src/camera/clear_color.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; /// For a camera, specifies the color used to clear the viewport before rendering. #[derive(Reflect, Serialize, Deserialize, Copy, Clone, Debug, Default, From)] -#[reflect(Serialize, Deserialize, Default)] +#[reflect(Serialize, Deserialize, Default, Clone)] pub enum ClearColorConfig { /// The clear color is taken from the world's [`ClearColor`] resource. #[default] @@ -26,7 +26,7 @@ pub enum ClearColorConfig { /// This color appears as the "background" color for simple apps, /// when there are portions of the screen with nothing rendered. #[derive(Resource, Clone, Debug, Deref, DerefMut, ExtractResource, Reflect)] -#[reflect(Resource, Default, Debug)] +#[reflect(Resource, Default, Debug, Clone)] pub struct ClearColor(pub Color); /// Match the dark gray bevy website code block color by default. diff --git a/crates/bevy_render/src/camera/manual_texture_view.rs b/crates/bevy_render/src/camera/manual_texture_view.rs index a9c302eaf4..7f76b8e886 100644 --- a/crates/bevy_render/src/camera/manual_texture_view.rs +++ b/crates/bevy_render/src/camera/manual_texture_view.rs @@ -8,7 +8,7 @@ use wgpu::TextureFormat; /// A unique id that corresponds to a specific [`ManualTextureView`] in the [`ManualTextureViews`] collection. #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Component, Reflect)] -#[reflect(Component, Default, Debug, PartialEq, Hash)] +#[reflect(Component, Default, Debug, PartialEq, Hash, Clone)] pub struct ManualTextureViewHandle(pub u32); /// A manually managed [`TextureView`] for use as a [`crate::camera::RenderTarget`]. diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 2b75dab047..e3f95cb036 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -129,7 +129,7 @@ mod sealed { /// /// The contained dynamic object can be downcast into a static type using [`CustomProjection::get`]. #[derive(Component, Debug, Reflect, Deref, DerefMut)] -#[reflect(Default)] +#[reflect(Default, Clone)] pub struct CustomProjection { #[reflect(ignore)] #[deref] @@ -221,7 +221,7 @@ impl CustomProjection { /// /// [`Camera`]: crate::camera::Camera #[derive(Component, Debug, Clone, Reflect, From)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub enum Projection { Perspective(PerspectiveProjection), Orthographic(OrthographicProjection), @@ -298,7 +298,7 @@ impl Default for Projection { /// A 3D camera projection in which distant objects appear smaller than close objects. #[derive(Debug, Clone, Reflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct PerspectiveProjection { /// The vertical field of view (FOV) in radians. /// @@ -433,7 +433,7 @@ impl Default for PerspectiveProjection { /// }); /// ``` #[derive(Default, Debug, Clone, Copy, Reflect, Serialize, Deserialize)] -#[reflect(Serialize, Deserialize)] +#[reflect(Serialize, Deserialize, Default, Clone)] pub enum ScalingMode { /// Match the viewport size. /// @@ -490,7 +490,7 @@ pub enum ScalingMode { /// }); /// ``` #[derive(Debug, Clone, Reflect)] -#[reflect(Debug, FromWorld)] +#[reflect(Debug, FromWorld, Clone)] pub struct OrthographicProjection { /// The distance of the near clipping plane in world units. /// diff --git a/crates/bevy_render/src/experimental/occlusion_culling/mod.rs b/crates/bevy_render/src/experimental/occlusion_culling/mod.rs index 6bdfb4a102..a3b067e19f 100644 --- a/crates/bevy_render/src/experimental/occlusion_culling/mod.rs +++ b/crates/bevy_render/src/experimental/occlusion_culling/mod.rs @@ -86,7 +86,7 @@ impl Plugin for OcclusionCullingPlugin { /// [*two-phase occlusion culling*]: /// https://medium.com/@mil_kru/two-pass-occlusion-culling-4100edcad501 #[derive(Component, ExtractComponent, Clone, Copy, Default, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct OcclusionCulling; /// A render-world component that contains resources necessary to perform diff --git a/crates/bevy_render/src/globals.rs b/crates/bevy_render/src/globals.rs index b21b37ab8d..c05d96c4c9 100644 --- a/crates/bevy_render/src/globals.rs +++ b/crates/bevy_render/src/globals.rs @@ -46,7 +46,7 @@ fn extract_time(mut commands: Commands, time: Extract>) { /// Contains global values useful when writing shaders. /// Currently only contains values related to time. #[derive(Default, Clone, Resource, ExtractResource, Reflect, ShaderType)] -#[reflect(Resource, Default)] +#[reflect(Resource, Default, Clone)] pub struct GlobalsUniform { /// The time since startup in seconds. /// Wraps to 0 after 1 hour. diff --git a/crates/bevy_render/src/mesh/components.rs b/crates/bevy_render/src/mesh/components.rs index f55897ce6d..772ff1f9e5 100644 --- a/crates/bevy_render/src/mesh/components.rs +++ b/crates/bevy_render/src/mesh/components.rs @@ -41,7 +41,7 @@ use derive_more::derive::From; /// } /// ``` #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone, PartialEq)] #[require(Transform, Visibility, VisibilityClass)] #[component(on_add = view::add_visibility_class::)] pub struct Mesh2d(pub Handle); @@ -97,7 +97,7 @@ impl AsAssetId for Mesh2d { /// } /// ``` #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone, PartialEq)] #[require(Transform, Visibility, VisibilityClass)] #[component(on_add = view::add_visibility_class::)] pub struct Mesh3d(pub Handle); @@ -153,5 +153,5 @@ pub fn mark_3d_meshes_as_changed_if_their_assets_changed( /// A component that stores an arbitrary index used to identify the mesh instance when rendering. #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone, PartialEq)] pub struct MeshTag(pub u32); diff --git a/crates/bevy_render/src/primitives/mod.rs b/crates/bevy_render/src/primitives/mod.rs index 10cbe4bd98..ef67997ecf 100644 --- a/crates/bevy_render/src/primitives/mod.rs +++ b/crates/bevy_render/src/primitives/mod.rs @@ -29,7 +29,7 @@ use bevy_reflect::prelude::*; /// [`CalculateBounds`]: crate::view::visibility::VisibilitySystems::CalculateBounds /// [`Mesh3d`]: crate::mesh::Mesh #[derive(Component, Clone, Copy, Debug, Default, Reflect, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct Aabb { pub center: Vec3A, pub half_extents: Vec3A, @@ -224,9 +224,9 @@ impl HalfSpace { /// [`CameraProjection`]: crate::camera::CameraProjection /// [`GlobalTransform`]: bevy_transform::components::GlobalTransform #[derive(Component, Clone, Copy, Debug, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct Frustum { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub half_spaces: [HalfSpace; 6], } @@ -327,9 +327,9 @@ impl Frustum { } #[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct CubemapFrusta { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub frusta: [Frustum; 6], } @@ -343,9 +343,9 @@ impl CubemapFrusta { } #[derive(Component, Debug, Default, Reflect, Clone)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct CascadesFrusta { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub frusta: EntityHashMap>, } diff --git a/crates/bevy_render/src/storage.rs b/crates/bevy_render/src/storage.rs index 7434f3999f..0046b4e6ac 100644 --- a/crates/bevy_render/src/storage.rs +++ b/crates/bevy_render/src/storage.rs @@ -27,7 +27,7 @@ impl Plugin for StoragePlugin { /// A storage buffer that is prepared as a [`RenderAsset`] and uploaded to the GPU. #[derive(Asset, Reflect, Debug, Clone)] #[reflect(opaque)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub struct ShaderStorageBuffer { /// Optional data used to initialize the buffer. pub data: Option>, diff --git a/crates/bevy_render/src/sync_world.rs b/crates/bevy_render/src/sync_world.rs index 83fabd40fd..4f21e22bf9 100644 --- a/crates/bevy_render/src/sync_world.rs +++ b/crates/bevy_render/src/sync_world.rs @@ -12,7 +12,7 @@ use bevy_ecs::{ world::{Mut, OnAdd, OnRemove, World}, }; use bevy_platform_support::collections::{HashMap, HashSet}; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// A plugin that synchronizes entities with [`SyncToRenderWorld`] between the main world and the render world. /// @@ -119,7 +119,7 @@ impl Plugin for SyncWorldPlugin { /// [`ExtractComponentPlugin`]: crate::extract_component::ExtractComponentPlugin /// [`SyncComponentPlugin`]: crate::sync_component::SyncComponentPlugin #[derive(Component, Copy, Clone, Debug, Default, Reflect)] -#[reflect[Component]] +#[reflect[Component, Default, Clone]] #[component(storage = "SparseSet")] pub struct SyncToRenderWorld; @@ -185,7 +185,7 @@ pub type MainEntityHashSet = HashSet; /// Marker component that indicates that its entity needs to be despawned at the end of the frame. #[derive(Component, Copy, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[reflect(Component, Default, Clone)] pub struct TemporaryRenderEntity; /// A record enum to what entities with [`SyncToRenderWorld`] have been added or removed. diff --git a/crates/bevy_render/src/view/mod.rs b/crates/bevy_render/src/view/mod.rs index 11864cc10e..dab77cb6d2 100644 --- a/crates/bevy_render/src/view/mod.rs +++ b/crates/bevy_render/src/view/mod.rs @@ -317,7 +317,7 @@ impl ExtractedView { /// `post_saturation` value in [`ColorGradingGlobal`], which is applied after /// tonemapping. #[derive(Component, Reflect, Debug, Default, Clone)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct ColorGrading { /// Filmic color grading values applied to the image as a whole (as opposed /// to individual sections, like shadows and highlights). @@ -346,7 +346,7 @@ pub struct ColorGrading { /// Filmic color grading values applied to the image as a whole (as opposed to /// individual sections, like shadows and highlights). #[derive(Clone, Debug, Reflect)] -#[reflect(Default)] +#[reflect(Default, Clone)] pub struct ColorGradingGlobal { /// Exposure value (EV) offset, measured in stops. pub exposure: f32, @@ -412,6 +412,7 @@ pub struct ColorGradingUniform { /// A section of color grading values that can be selectively applied to /// shadows, midtones, and highlights. #[derive(Reflect, Debug, Copy, Clone, PartialEq)] +#[reflect(Clone, PartialEq)] pub struct ColorGradingSection { /// Values below 1.0 desaturate, with a value of 0.0 resulting in a grayscale image /// with luminance defined by ITU-R BT.709. diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index a2155f7af7..d72c52abf7 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -34,7 +34,7 @@ use crate::{ /// This is done by the `visibility_propagate_system` which uses the entity hierarchy and /// `Visibility` to set the values of each entity's [`InheritedVisibility`] component. #[derive(Component, Clone, Copy, Reflect, Debug, PartialEq, Eq, Default)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[require(InheritedVisibility, ViewVisibility)] pub enum Visibility { /// An entity with `Visibility::Inherited` will inherit the Visibility of its [`ChildOf`] target. @@ -109,7 +109,7 @@ impl PartialEq<&Visibility> for Visibility { /// /// [`VisibilityPropagate`]: VisibilitySystems::VisibilityPropagate #[derive(Component, Deref, Debug, Default, Clone, Copy, Reflect, PartialEq, Eq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[component(on_insert = validate_parent_has_component::)] pub struct InheritedVisibility(bool); @@ -152,7 +152,7 @@ impl InheritedVisibility { // Note: This can't be a `ComponentId` because the visibility classes are copied // into the render world, and component IDs are per-world. #[derive(Clone, Component, Default, Reflect, Deref, DerefMut)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct VisibilityClass(pub SmallVec<[TypeId; 1]>); /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering. @@ -166,7 +166,7 @@ pub struct VisibilityClass(pub SmallVec<[TypeId; 1]>); /// [`VisibilityPropagate`]: VisibilitySystems::VisibilityPropagate /// [`CheckVisibility`]: VisibilitySystems::CheckVisibility #[derive(Component, Deref, Debug, Default, Clone, Copy, Reflect, PartialEq, Eq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct ViewVisibility(bool); impl ViewVisibility { @@ -219,9 +219,9 @@ pub struct NoFrustumCulling; /// This component is intended to be attached to the same entity as the [`Camera`] and /// the [`Frustum`] defining the view. #[derive(Clone, Component, Default, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct VisibleEntities { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub entities: TypeIdMap>, } @@ -269,9 +269,9 @@ impl VisibleEntities { /// /// This component is extracted from [`VisibleEntities`]. #[derive(Clone, Component, Default, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct RenderVisibleEntities { - #[reflect(ignore)] + #[reflect(ignore, clone)] pub entities: TypeIdMap>, } diff --git a/crates/bevy_render/src/view/visibility/range.rs b/crates/bevy_render/src/view/visibility/range.rs index a4485821c9..5a6728337b 100644 --- a/crates/bevy_render/src/view/visibility/range.rs +++ b/crates/bevy_render/src/view/visibility/range.rs @@ -114,7 +114,7 @@ impl Plugin for VisibilityRangePlugin { /// `start_margin` of the next lower LOD; this is important for the crossfade /// effect to function properly. #[derive(Component, Clone, PartialEq, Default, Reflect)] -#[reflect(Component, PartialEq, Hash)] +#[reflect(Component, PartialEq, Hash, Clone)] pub struct VisibilityRange { /// The range of distances, in world units, between which this entity will /// smoothly fade into view as the camera zooms out. diff --git a/crates/bevy_render/src/view/visibility/render_layers.rs b/crates/bevy_render/src/view/visibility/render_layers.rs index 1932abdf71..a5a58453e8 100644 --- a/crates/bevy_render/src/view/visibility/render_layers.rs +++ b/crates/bevy_render/src/view/visibility/render_layers.rs @@ -20,7 +20,7 @@ pub type Layer = usize; /// /// Entities without this component belong to layer `0`. #[derive(Component, Clone, Reflect, PartialEq, Eq, PartialOrd, Ord)] -#[reflect(Component, Default, PartialEq, Debug)] +#[reflect(Component, Default, PartialEq, Debug, Clone)] pub struct RenderLayers(SmallVec<[u64; INLINE_BLOCKS]>); /// The number of memory blocks stored inline diff --git a/crates/bevy_scene/src/components.rs b/crates/bevy_scene/src/components.rs index 355628c6c7..d4d42c3a1c 100644 --- a/crates/bevy_scene/src/components.rs +++ b/crates/bevy_scene/src/components.rs @@ -13,7 +13,7 @@ use crate::{DynamicScene, Scene}; /// Adding this component will spawn the scene as a child of that entity. /// Once it's spawned, the entity will have a [`SceneInstance`](crate::SceneInstance) component. #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[require(Transform)] #[cfg_attr(feature = "bevy_render", require(Visibility))] pub struct SceneRoot(pub Handle); @@ -21,7 +21,7 @@ pub struct SceneRoot(pub Handle); /// Adding this component will spawn the scene as a child of that entity. /// Once it's spawned, the entity will have a [`SceneInstance`](crate::SceneInstance) component. #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect, PartialEq, Eq, From)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[require(Transform)] #[cfg_attr(feature = "bevy_render", require(Visibility))] pub struct DynamicSceneRoot(pub Handle); diff --git a/crates/bevy_scene/src/scene_spawner.rs b/crates/bevy_scene/src/scene_spawner.rs index 5983ceb258..4acfac93a9 100644 --- a/crates/bevy_scene/src/scene_spawner.rs +++ b/crates/bevy_scene/src/scene_spawner.rs @@ -26,7 +26,7 @@ use bevy_ecs::{ /// /// [`Trigger`]: bevy_ecs::observer::Trigger #[derive(Clone, Copy, Debug, Eq, PartialEq, Event, Reflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, Clone)] pub struct SceneInstanceReady { /// Instance which has been spawned. pub instance_id: InstanceId, @@ -41,7 +41,7 @@ pub struct InstanceInfo { /// Unique id identifying a scene instance. #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Reflect)] -#[reflect(Debug, PartialEq, Hash)] +#[reflect(Debug, PartialEq, Hash, Clone)] pub struct InstanceId(Uuid); impl InstanceId { diff --git a/crates/bevy_sprite/src/mesh2d/color_material.rs b/crates/bevy_sprite/src/mesh2d/color_material.rs index 025e27cd13..83b6930776 100644 --- a/crates/bevy_sprite/src/mesh2d/color_material.rs +++ b/crates/bevy_sprite/src/mesh2d/color_material.rs @@ -40,7 +40,7 @@ impl Plugin for ColorMaterialPlugin { /// A [2d material](Material2d) that renders [2d meshes](crate::Mesh2d) with a texture tinted by a uniform color #[derive(Asset, AsBindGroup, Reflect, Debug, Clone)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] #[uniform(0, ColorMaterialUniform)] pub struct ColorMaterial { pub color: Color, diff --git a/crates/bevy_sprite/src/mesh2d/material.rs b/crates/bevy_sprite/src/mesh2d/material.rs index 3944c44591..9192dce4e1 100644 --- a/crates/bevy_sprite/src/mesh2d/material.rs +++ b/crates/bevy_sprite/src/mesh2d/material.rs @@ -187,7 +187,7 @@ pub trait Material2d: AsBindGroup + Asset + Clone + Sized { /// /// [`MeshMaterial2d`]: crate::MeshMaterial2d #[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, From)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct MeshMaterial2d(pub Handle); impl Default for MeshMaterial2d { @@ -230,7 +230,7 @@ impl AsAssetId for MeshMaterial2d { /// This is very similar to [`AlphaMode`](bevy_render::alpha::AlphaMode) but this only applies to 2d meshes. /// We use a separate type because 2d doesn't support all the transparency modes that 3d does. #[derive(Debug, Default, Reflect, Copy, Clone, PartialEq)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, Clone)] pub enum AlphaMode2d { /// Base color alpha values are overridden to be fully opaque (1.0). #[default] diff --git a/crates/bevy_sprite/src/mesh2d/wireframe2d.rs b/crates/bevy_sprite/src/mesh2d/wireframe2d.rs index f4b2602bc0..439dd9a643 100644 --- a/crates/bevy_sprite/src/mesh2d/wireframe2d.rs +++ b/crates/bevy_sprite/src/mesh2d/wireframe2d.rs @@ -60,7 +60,7 @@ impl Plugin for Wireframe2dPlugin { /// /// This requires the [`Wireframe2dPlugin`] to be enabled. #[derive(Component, Debug, Clone, Default, Reflect, Eq, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct Wireframe2d; /// Sets the color of the [`Wireframe2d`] of the entity it is attached to. @@ -70,7 +70,7 @@ pub struct Wireframe2d; /// /// This overrides the [`Wireframe2dConfig::default_color`]. #[derive(Component, Debug, Clone, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct Wireframe2dColor { pub color: Color, } @@ -80,11 +80,11 @@ pub struct Wireframe2dColor { /// /// This requires the [`Wireframe2dPlugin`] to be enabled. #[derive(Component, Debug, Clone, Default, Reflect, Eq, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct NoWireframe2d; #[derive(Resource, Debug, Clone, Default, ExtractResource, Reflect)] -#[reflect(Resource, Debug, Default)] +#[reflect(Resource, Debug, Default, Clone)] pub struct Wireframe2dConfig { /// Whether to show wireframes for all 2D meshes. /// Can be overridden for individual meshes by adding a [`Wireframe2d`] or [`NoWireframe2d`] component. @@ -220,6 +220,7 @@ fn apply_global_wireframe_material( } #[derive(Default, AsBindGroup, Debug, Clone, Asset, Reflect)] +#[reflect(Clone, Default)] pub struct Wireframe2dMaterial { #[uniform(0)] pub color: LinearRgba, diff --git a/crates/bevy_sprite/src/picking_backend.rs b/crates/bevy_sprite/src/picking_backend.rs index 83e8f0eaae..ecf8ee04f8 100644 --- a/crates/bevy_sprite/src/picking_backend.rs +++ b/crates/bevy_sprite/src/picking_backend.rs @@ -22,12 +22,12 @@ use bevy_window::PrimaryWindow; /// A component that marks cameras that should be used in the [`SpritePickingPlugin`]. #[derive(Debug, Clone, Default, Component, Reflect)] -#[reflect(Debug, Default, Component)] +#[reflect(Debug, Default, Component, Clone)] pub struct SpritePickingCamera; /// How should the [`SpritePickingPlugin`] handle picking and how should it handle transparent pixels #[derive(Debug, Clone, Copy, Reflect)] -#[reflect(Debug)] +#[reflect(Debug, Clone)] pub enum SpritePickingMode { /// Even if a sprite is picked on a transparent pixel, it should still count within the backend. /// Only consider the rect of a given sprite. diff --git a/crates/bevy_sprite/src/sprite.rs b/crates/bevy_sprite/src/sprite.rs index 82d5f155a8..17b24f975c 100644 --- a/crates/bevy_sprite/src/sprite.rs +++ b/crates/bevy_sprite/src/sprite.rs @@ -15,7 +15,7 @@ use crate::TextureSlicer; /// Describes a sprite to be rendered to a 2D camera #[derive(Component, Debug, Default, Clone, Reflect)] #[require(Transform, Visibility, SyncToRenderWorld, VisibilityClass)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[component(on_add = view::add_visibility_class::)] pub struct Sprite { /// The image used to render the sprite @@ -154,7 +154,7 @@ impl From> for Sprite { /// Controls how the image is altered when scaled. #[derive(Default, Debug, Clone, Reflect, PartialEq)] -#[reflect(Debug)] +#[reflect(Debug, Default, Clone)] pub enum SpriteImageMode { /// The sprite will take on the size of the image by default, and will be stretched or shrunk if [`Sprite::custom_size`] is set. #[default] @@ -202,7 +202,7 @@ impl SpriteImageMode { /// /// Can be used in [`SpriteImageMode::Scale`]. #[derive(Debug, Clone, Copy, PartialEq, Default, Reflect)] -#[reflect(Debug)] +#[reflect(Debug, Default, Clone)] pub enum ScalingMode { /// Scale the texture uniformly (maintain the texture's aspect ratio) /// so that both dimensions (width and height) of the texture will be equal @@ -243,7 +243,7 @@ pub enum ScalingMode { /// How a sprite is positioned relative to its [`Transform`]. /// It defaults to `Anchor::Center`. #[derive(Component, Debug, Clone, Copy, PartialEq, Default, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[doc(alias = "pivot")] pub enum Anchor { #[default] diff --git a/crates/bevy_sprite/src/texture_slice/border_rect.rs b/crates/bevy_sprite/src/texture_slice/border_rect.rs index adc90a626a..00e4fcb8b1 100644 --- a/crates/bevy_sprite/src/texture_slice/border_rect.rs +++ b/crates/bevy_sprite/src/texture_slice/border_rect.rs @@ -1,10 +1,11 @@ -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// Defines the extents of the border of a rectangle. /// /// This struct is used to represent thickness or offsets from the edges /// of a rectangle (left, right, top, and bottom), with values increasing inwards. #[derive(Default, Copy, Clone, PartialEq, Debug, Reflect)] +#[reflect(Clone, PartialEq, Default)] pub struct BorderRect { /// Extent of the border along the left edge pub left: f32, diff --git a/crates/bevy_sprite/src/texture_slice/slicer.rs b/crates/bevy_sprite/src/texture_slice/slicer.rs index 7250533550..3f8ea1c0b4 100644 --- a/crates/bevy_sprite/src/texture_slice/slicer.rs +++ b/crates/bevy_sprite/src/texture_slice/slicer.rs @@ -1,6 +1,6 @@ use super::{BorderRect, TextureSlice}; use bevy_math::{vec2, Rect, Vec2}; -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// Slices a texture using the **9-slicing** technique. This allows to reuse an image at various sizes /// without needing to prepare multiple assets. The associated texture will be split into nine portions, @@ -11,6 +11,7 @@ use bevy_reflect::Reflect; /// /// See [9-sliced](https://en.wikipedia.org/wiki/9-slice_scaling) textures. #[derive(Debug, Clone, Reflect, PartialEq)] +#[reflect(Clone, PartialEq)] pub struct TextureSlicer { /// Inset values in pixels that define the four slicing lines dividing the texture into nine sections. pub border: BorderRect, @@ -24,6 +25,7 @@ pub struct TextureSlicer { /// Defines how a texture slice scales when resized #[derive(Debug, Copy, Clone, Default, Reflect, PartialEq)] +#[reflect(Clone, PartialEq, Default)] pub enum SliceScaleMode { /// The slice will be stretched to fit the area #[default] diff --git a/crates/bevy_state/src/state_scoped.rs b/crates/bevy_state/src/state_scoped.rs index 00cff42c03..b58017d6e3 100644 --- a/crates/bevy_state/src/state_scoped.rs +++ b/crates/bevy_state/src/state_scoped.rs @@ -54,7 +54,7 @@ use crate::state::{StateTransitionEvent, States}; /// app.add_systems(OnEnter(GameState::InGame), spawn_player); /// ``` #[derive(Component, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component, Clone))] pub struct StateScoped(pub S); impl Default for StateScoped diff --git a/crates/bevy_text/src/bounds.rs b/crates/bevy_text/src/bounds.rs index 98d42e3a34..db2ceb0b28 100644 --- a/crates/bevy_text/src/bounds.rs +++ b/crates/bevy_text/src/bounds.rs @@ -11,7 +11,7 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// reliable limit if it is necessary to contain the text strictly in the bounds. Currently this /// component is mainly useful for text wrapping only. #[derive(Component, Copy, Clone, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct TextBounds { /// The maximum width of text in logical pixels. /// If `None`, the width is unbounded. diff --git a/crates/bevy_text/src/glyph.rs b/crates/bevy_text/src/glyph.rs index 752b7e6e0c..c761bc0033 100644 --- a/crates/bevy_text/src/glyph.rs +++ b/crates/bevy_text/src/glyph.rs @@ -11,6 +11,7 @@ use bevy_reflect::Reflect; /// /// Used in [`TextPipeline::queue_text`](crate::TextPipeline::queue_text) and [`crate::TextLayoutInfo`] for rendering glyphs. #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub struct PositionedGlyph { /// The position of the glyph in the text block's bounding box. pub position: Vec2, @@ -35,6 +36,7 @@ pub struct PositionedGlyph { /// /// Used in [`PositionedGlyph`] and [`FontAtlasSet`](crate::FontAtlasSet). #[derive(Debug, Clone, Reflect)] +#[reflect(Clone)] pub struct GlyphAtlasInfo { /// A handle to the [`Image`] data for the texture atlas this glyph was placed in. /// @@ -53,6 +55,7 @@ pub struct GlyphAtlasInfo { /// /// Used in [`GlyphAtlasInfo`] and [`FontAtlas`](crate::FontAtlas). #[derive(Debug, Clone, Copy, Reflect)] +#[reflect(Clone)] pub struct GlyphAtlasLocation { /// The index of the glyph in the atlas pub glyph_index: usize, diff --git a/crates/bevy_text/src/pipeline.rs b/crates/bevy_text/src/pipeline.rs index 4ce2e1bd96..de6ed5b244 100644 --- a/crates/bevy_text/src/pipeline.rs +++ b/crates/bevy_text/src/pipeline.rs @@ -414,7 +414,7 @@ impl TextPipeline { /// Contains scaled glyphs and their size. Generated via [`TextPipeline::queue_text`] when an entity has /// [`TextLayout`] and [`ComputedTextBlock`] components. #[derive(Component, Clone, Default, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct TextLayoutInfo { /// Scaled and positioned glyphs in screenspace pub glyphs: Vec, diff --git a/crates/bevy_text/src/text.rs b/crates/bevy_text/src/text.rs index bcc2d20bdb..be3e992996 100644 --- a/crates/bevy_text/src/text.rs +++ b/crates/bevy_text/src/text.rs @@ -29,7 +29,7 @@ impl Default for CosmicBuffer { /// /// Returned by [`ComputedTextBlock::entities`]. #[derive(Debug, Copy, Clone, Reflect)] -#[reflect(Debug)] +#[reflect(Debug, Clone)] pub struct TextEntity { /// The entity. pub entity: Entity, @@ -43,7 +43,7 @@ pub struct TextEntity { /// /// Automatically updated by 2d and UI text systems. #[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Debug, Default)] +#[reflect(Component, Debug, Default, Clone)] pub struct ComputedTextBlock { /// Buffer for managing text layout and creating [`TextLayoutInfo`]. /// @@ -51,7 +51,7 @@ pub struct ComputedTextBlock { /// `TextLayoutInfo`. If you want to control the buffer contents manually or use the `cosmic-text` /// editor, then you need to not use `TextLayout` and instead manually implement the conversion to /// `TextLayoutInfo`. - #[reflect(ignore)] + #[reflect(ignore, clone)] pub(crate) buffer: CosmicBuffer, /// Entities for all text spans in the block, including the root-level text. /// @@ -116,7 +116,7 @@ impl Default for ComputedTextBlock { /// /// See [`Text2d`](crate::Text2d) for the core component of 2d text, and `Text` in `bevy_ui` for UI text. #[derive(Component, Debug, Copy, Clone, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require(ComputedTextBlock, TextLayoutInfo)] pub struct TextLayout { /// The text's internal alignment. @@ -208,7 +208,7 @@ impl TextLayout { /// )); /// ``` #[derive(Component, Debug, Default, Clone, Deref, DerefMut, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require(TextFont, TextColor)] pub struct TextSpan(pub String); @@ -250,7 +250,7 @@ impl From for TextSpan { /// _Has no affect on a single line text entity_, unless used together with a /// [`TextBounds`](super::bounds::TextBounds) component with an explicit `width` value. #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash, Reflect, Serialize, Deserialize)] -#[reflect(Serialize, Deserialize)] +#[reflect(Serialize, Deserialize, Clone, PartialEq, Hash)] pub enum JustifyText { /// Leftmost character is immediately to the right of the render position. /// Bounds start from the render position and advance rightwards. @@ -282,7 +282,7 @@ impl From for cosmic_text::Align { /// `TextFont` determines the style of a text span within a [`ComputedTextBlock`], specifically /// the font face, the font size, and the color. #[derive(Component, Clone, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct TextFont { /// The specific font face to use, as a `Handle` to a [`Font`] asset. /// @@ -360,7 +360,7 @@ impl Default for TextFont { /// /// Default is 1.2x the font size #[derive(Debug, Clone, Copy, Reflect)] -#[reflect(Debug)] +#[reflect(Debug, Clone)] pub enum LineHeight { /// Set line height to a specific number of pixels Px(f32), @@ -385,7 +385,7 @@ impl Default for LineHeight { /// The color of the text for this section. #[derive(Component, Copy, Clone, Debug, Deref, DerefMut, Reflect, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct TextColor(pub Color); impl Default for TextColor { @@ -409,7 +409,7 @@ impl TextColor { /// Determines how lines will be broken when preventing text from running out of bounds. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Reflect, Serialize, Deserialize)] -#[reflect(Serialize, Deserialize)] +#[reflect(Serialize, Deserialize, Clone, PartialEq, Hash, Default)] pub enum LineBreak { /// Uses the [Unicode Line Breaking Algorithm](https://www.unicode.org/reports/tr14/). /// Lines will be broken up at the nearest suitable word boundary, usually a space. @@ -432,7 +432,7 @@ pub enum LineBreak { /// /// **Note:** Subpixel antialiasing is not currently supported. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Reflect, Serialize, Deserialize)] -#[reflect(Serialize, Deserialize)] +#[reflect(Serialize, Deserialize, Clone, PartialEq, Hash, Default)] #[doc(alias = "antialiasing")] #[doc(alias = "pixelated")] pub enum FontSmoothing { diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index 85c09684b4..baf5700a3c 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -81,7 +81,7 @@ use bevy_window::{PrimaryWindow, Window}; /// }); /// ``` #[derive(Component, Clone, Debug, Default, Deref, DerefMut, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require( TextLayout, TextFont, diff --git a/crates/bevy_time/src/fixed.rs b/crates/bevy_time/src/fixed.rs index 942e171487..dc8f89fd6a 100644 --- a/crates/bevy_time/src/fixed.rs +++ b/crates/bevy_time/src/fixed.rs @@ -65,7 +65,7 @@ use crate::{time::Time, virt::Virtual}; /// frame. Any [`overstep()`](Time::overstep) present in the accumulator will be /// processed according to the new [`timestep()`](Time::timestep) value. #[derive(Debug, Copy, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Clone))] pub struct Fixed { timestep: Duration, overstep: Duration, diff --git a/crates/bevy_time/src/real.rs b/crates/bevy_time/src/real.rs index 862822b2cb..8470099788 100644 --- a/crates/bevy_time/src/real.rs +++ b/crates/bevy_time/src/real.rs @@ -1,6 +1,6 @@ use bevy_platform_support::time::Instant; #[cfg(feature = "bevy_reflect")] -use bevy_reflect::Reflect; +use bevy_reflect::{std_traits::ReflectDefault, Reflect}; use core::time::Duration; use crate::time::Time; @@ -41,7 +41,7 @@ use crate::time::Time; /// [`Time#impl-Time`] is only a *mock* of wall clock time. /// #[derive(Debug, Copy, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Clone, Default))] pub struct Real { startup: Instant, first_update: Option, diff --git a/crates/bevy_time/src/stopwatch.rs b/crates/bevy_time/src/stopwatch.rs index f90503ee24..56c72e90df 100644 --- a/crates/bevy_time/src/stopwatch.rs +++ b/crates/bevy_time/src/stopwatch.rs @@ -26,7 +26,11 @@ use core::time::Duration; /// ``` #[derive(Clone, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Default, Clone, PartialEq) +)] pub struct Stopwatch { elapsed: Duration, is_paused: bool, diff --git a/crates/bevy_time/src/timer.rs b/crates/bevy_time/src/timer.rs index 5958975c96..71ef6b0db9 100644 --- a/crates/bevy_time/src/timer.rs +++ b/crates/bevy_time/src/timer.rs @@ -14,7 +14,11 @@ use core::time::Duration; /// Note that in order to advance the timer [`tick`](Timer::tick) **MUST** be called. #[derive(Clone, Debug, Default, PartialEq, Eq)] #[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Default, Clone, PartialEq) +)] pub struct Timer { stopwatch: Stopwatch, duration: Duration, @@ -437,7 +441,11 @@ impl Timer { /// Specifies [`Timer`] behavior. #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default)] #[cfg_attr(feature = "serialize", derive(serde::Deserialize, serde::Serialize))] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Default, Clone, PartialEq, Hash) +)] pub enum TimerMode { /// Run once and stop. #[default] diff --git a/crates/bevy_time/src/virt.rs b/crates/bevy_time/src/virt.rs index 9deb7b34e3..146c754891 100644 --- a/crates/bevy_time/src/virt.rs +++ b/crates/bevy_time/src/virt.rs @@ -70,7 +70,7 @@ use crate::{real::Real, time::Time}; /// also dictate how big of an FPS drop you can accept without losing time and /// falling behind real time. #[derive(Debug, Copy, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Clone))] pub struct Virtual { max_delta: Duration, paused: bool, diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index 557c1dd6f6..f606071fe1 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -53,7 +53,7 @@ use { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Component, Default, PartialEq, Debug) + reflect(Component, Default, PartialEq, Debug, Clone) )] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), diff --git a/crates/bevy_transform/src/components/transform.rs b/crates/bevy_transform/src/components/transform.rs index f37c981663..d60c47ca38 100644 --- a/crates/bevy_transform/src/components/transform.rs +++ b/crates/bevy_transform/src/components/transform.rs @@ -71,7 +71,7 @@ fn assert_is_normalized(message: &str, length_squared: f32) { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Component, Default, PartialEq, Debug) + reflect(Component, Default, PartialEq, Debug, Clone) )] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), @@ -658,7 +658,7 @@ impl Mul for Transform { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Component, Default, PartialEq, Debug) + reflect(Component, Default, PartialEq, Debug, Clone) )] #[cfg_attr( all(feature = "bevy_reflect", feature = "serialize"), diff --git a/crates/bevy_ui/src/experimental/ghost_hierarchy.rs b/crates/bevy_ui/src/experimental/ghost_hierarchy.rs index 172884b326..3ca5bf2861 100644 --- a/crates/bevy_ui/src/experimental/ghost_hierarchy.rs +++ b/crates/bevy_ui/src/experimental/ghost_hierarchy.rs @@ -20,7 +20,7 @@ use smallvec::SmallVec; #[cfg(feature = "ghost_nodes")] #[derive(Component, Debug, Copy, Clone, Reflect)] #[cfg_attr(feature = "ghost_nodes", derive(Default))] -#[reflect(Component, Debug)] +#[reflect(Component, Debug, Clone)] #[require(Visibility, Transform, ComputedNodeTarget)] pub struct GhostNode; diff --git a/crates/bevy_ui/src/focus.rs b/crates/bevy_ui/src/focus.rs index 4093b81d55..92c262d93c 100644 --- a/crates/bevy_ui/src/focus.rs +++ b/crates/bevy_ui/src/focus.rs @@ -40,7 +40,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// - [`Button`](crate::widget::Button) which requires this component /// - [`RelativeCursorPosition`] to obtain the position of the cursor relative to current node #[derive(Component, Copy, Clone, Eq, PartialEq, Debug, Reflect)] -#[reflect(Component, Default, PartialEq, Debug)] +#[reflect(Component, Default, PartialEq, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -74,7 +74,7 @@ impl Default for Interaction { /// /// The component is updated when it is in the same entity with [`Node`](crate::Node). #[derive(Component, Copy, Clone, Default, PartialEq, Debug, Reflect)] -#[reflect(Component, Default, PartialEq, Debug)] +#[reflect(Component, Default, PartialEq, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -98,7 +98,7 @@ impl RelativeCursorPosition { /// Describes whether the node should block interactions with lower nodes #[derive(Component, Copy, Clone, Eq, PartialEq, Debug, Reflect)] -#[reflect(Component, Default, PartialEq, Debug)] +#[reflect(Component, Default, PartialEq, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_ui/src/geometry.rs b/crates/bevy_ui/src/geometry.rs index 79ead6ab78..8dcfee4302 100644 --- a/crates/bevy_ui/src/geometry.rs +++ b/crates/bevy_ui/src/geometry.rs @@ -21,7 +21,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// /// Additionally, `auto` will be parsed as [`Val::Auto`]. #[derive(Copy, Clone, Debug, Reflect)] -#[reflect(Default, PartialEq, Debug)] +#[reflect(Default, PartialEq, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -317,7 +317,7 @@ impl Val { /// }; /// ``` #[derive(Copy, Clone, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq, Debug)] +#[reflect(Default, PartialEq, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index 4969dc46e0..2486296bac 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -26,7 +26,7 @@ use tracing::warn; /// scrollable content in-view. You can directly modify `ComputedNode` after layout to set the /// handle size without any delays. #[derive(Component, Debug, Copy, Clone, PartialEq, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct ComputedNode { /// The order of the node in the UI layout. /// Nodes with a higher stack index are drawn on top of and receive interactions before nodes with lower stack indices. @@ -259,7 +259,7 @@ impl Default for ComputedNode { /// `ScrollPosition` may be updated by the layout system when a layout change makes a previously valid `ScrollPosition` invalid. /// Changing this does nothing on a `Node` without setting at least one `OverflowAxis` to `OverflowAxis::Scroll`. #[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, Clone)] pub struct ScrollPosition { /// How far across the node is scrolled, in logical pixels. (0 = not scrolled / scrolled to right) pub offset_x: f32, @@ -334,7 +334,7 @@ impl From for ScrollPosition { VisibilityClass, ZIndex )] -#[reflect(Component, Default, PartialEq, Debug)] +#[reflect(Component, Default, PartialEq, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -678,7 +678,7 @@ impl Default for Node { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -721,7 +721,7 @@ impl Default for AlignItems { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -758,7 +758,7 @@ impl Default for JustifyItems { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -801,7 +801,7 @@ impl Default for AlignSelf { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -838,7 +838,7 @@ impl Default for JustifySelf { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -885,7 +885,7 @@ impl Default for AlignContent { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -930,7 +930,7 @@ impl Default for JustifyContent { /// /// Part of the [`Node`] component. #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -964,7 +964,7 @@ impl Default for Display { /// /// See: #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -987,7 +987,7 @@ impl Default for BoxSizing { /// Defines how flexbox items are ordered within a flexbox #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1016,7 +1016,7 @@ impl Default for FlexDirection { /// Whether to show or hide overflowing items #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1128,7 +1128,7 @@ impl Default for Overflow { /// Whether to show or hide overflowing items #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1162,7 +1162,7 @@ impl Default for OverflowAxis { /// The bounds of the visible area when a UI node is clipped. #[derive(Default, Copy, Clone, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1216,7 +1216,7 @@ impl OverflowClipMargin { /// Used to determine the bounds of the visible area when a UI node is clipped. #[derive(Default, Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1234,7 +1234,7 @@ pub enum OverflowClipBox { /// The strategy used to position this node #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1259,7 +1259,7 @@ impl Default for PositionType { /// Defines if flexbox items appear on a single line or on multiple lines #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1293,7 +1293,7 @@ impl Default for FlexWrap { /// /// #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1321,7 +1321,7 @@ impl Default for GridAutoFlow { } #[derive(Default, Copy, Clone, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1350,7 +1350,7 @@ pub enum MinTrackSizingFunction { } #[derive(Default, Copy, Clone, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1390,7 +1390,7 @@ pub enum MaxTrackSizingFunction { /// A [`GridTrack`] is a Row or Column of a CSS Grid. This struct specifies what size the track should be. /// See below for the different "track sizing functions" you can specify. #[derive(Copy, Clone, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1549,7 +1549,7 @@ impl Default for GridTrack { } #[derive(Copy, Clone, PartialEq, Debug, Reflect, From)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1604,7 +1604,7 @@ impl From for GridTrackRepetition { /// then all tracks (in and outside of the repetition) must be fixed size (px or percent). Integer repetitions are just shorthand for writing out /// N tracks longhand and are not subject to the same limitations. #[derive(Clone, PartialEq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1801,7 +1801,7 @@ impl From for Vec { } #[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)] -#[reflect(Default, PartialEq)] +#[reflect(Default, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2003,7 +2003,7 @@ pub enum GridPlacementError { /// /// This serves as the "fill" color. #[derive(Component, Copy, Clone, Debug, PartialEq, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2030,7 +2030,7 @@ impl> From for BackgroundColor { /// The border color of the UI node. #[derive(Component, Copy, Clone, Debug, PartialEq, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2056,7 +2056,7 @@ impl Default for BorderColor { } #[derive(Component, Copy, Clone, Default, Debug, PartialEq, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2138,7 +2138,7 @@ impl Outline { /// The calculated clip of the node #[derive(Component, Default, Copy, Clone, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct CalculatedClip { /// The rect of the clip pub clip: Rect, @@ -2157,7 +2157,7 @@ pub struct CalculatedClip { /// Use [`GlobalZIndex`] if you need to order separate UI hierarchies or nodes that are /// not siblings in a given UI hierarchy. #[derive(Component, Copy, Clone, Debug, Default, PartialEq, Eq, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct ZIndex(pub i32); /// `GlobalZIndex` allows a [`Node`] entity anywhere in the UI hierarchy to escape the implicit draw ordering of the UI's layout tree and @@ -2167,7 +2167,7 @@ pub struct ZIndex(pub i32); /// /// If two Nodes have the same `GlobalZIndex`, the node with the greater [`ZIndex`] will be drawn on top. #[derive(Component, Copy, Clone, Debug, Default, PartialEq, Eq, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] pub struct GlobalZIndex(pub i32); /// Used to add rounded corners to a UI node. You can set a UI node to have uniformly @@ -2208,7 +2208,7 @@ pub struct GlobalZIndex(pub i32); /// /// #[derive(Component, Copy, Clone, Debug, PartialEq, Reflect)] -#[reflect(Component, PartialEq, Default, Debug)] +#[reflect(Component, PartialEq, Default, Debug, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2489,6 +2489,7 @@ impl BorderRadius { /// /// The values are in physical pixels. #[derive(Copy, Clone, Debug, Default, PartialEq, Reflect)] +#[reflect(Clone, PartialEq, Default)] pub struct ResolvedBorderRadius { pub top_left: f32, pub top_right: f32, @@ -2506,7 +2507,7 @@ impl ResolvedBorderRadius { } #[derive(Component, Clone, Debug, Default, PartialEq, Reflect, Deref, DerefMut)] -#[reflect(Component, PartialEq, Default)] +#[reflect(Component, PartialEq, Default, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2543,7 +2544,7 @@ impl From for BoxShadow { } #[derive(Copy, Clone, Debug, PartialEq, Reflect)] -#[reflect(PartialEq, Default)] +#[reflect(PartialEq, Default, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2578,7 +2579,7 @@ impl Default for ShadowStyle { } #[derive(Component, Copy, Clone, Debug, PartialEq, Reflect)] -#[reflect(Component, Debug, PartialEq, Default)] +#[reflect(Component, Debug, PartialEq, Default, Clone)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -2642,7 +2643,7 @@ mod tests { /// which is either a single camera with the [`IsDefaultUiCamera`] marker component or the highest /// order camera targeting the primary window. #[derive(Component, Clone, Debug, Reflect, Eq, PartialEq)] -#[reflect(Component, Debug, PartialEq)] +#[reflect(Component, Debug, PartialEq, Clone)] pub struct UiTargetCamera(pub Entity); impl UiTargetCamera { @@ -2736,7 +2737,7 @@ impl<'w, 's> DefaultUiCamera<'w, 's> { /// } /// ``` #[derive(Component, Clone, Copy, Default, Debug, Reflect, Eq, PartialEq)] -#[reflect(Component)] +#[reflect(Component, Default, PartialEq, Clone)] pub enum UiAntiAlias { /// UI will render with anti-aliasing #[default] @@ -2762,7 +2763,7 @@ pub enum UiAntiAlias { /// } /// ``` #[derive(Component, Clone, Copy, Debug, Reflect, Eq, PartialEq)] -#[reflect(Component)] +#[reflect(Component, Default, PartialEq, Clone)] pub struct BoxShadowSamples(pub u32); impl Default for BoxShadowSamples { @@ -2773,7 +2774,7 @@ impl Default for BoxShadowSamples { /// Derived information about the camera target for this UI node. #[derive(Component, Clone, Copy, Debug, Reflect, PartialEq)] -#[reflect(Component, Default)] +#[reflect(Component, Default, PartialEq, Clone)] pub struct ComputedNodeTarget { pub(crate) camera: Entity, pub(crate) scale_factor: f32, @@ -2810,7 +2811,7 @@ impl ComputedNodeTarget { /// Adds a shadow behind text #[derive(Component, Copy, Clone, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct TextShadow { /// Shadow displacement in logical pixels /// With a value of zero the shadow will be hidden directly behind the text diff --git a/crates/bevy_ui/src/widget/button.rs b/crates/bevy_ui/src/widget/button.rs index a4e5afc6fa..e793c968b5 100644 --- a/crates/bevy_ui/src/widget/button.rs +++ b/crates/bevy_ui/src/widget/button.rs @@ -4,6 +4,6 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// Marker struct for buttons #[derive(Component, Debug, Default, Clone, Copy, PartialEq, Eq, Reflect)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[require(Node, FocusPolicy(|| FocusPolicy::Block), Interaction)] pub struct Button; diff --git a/crates/bevy_ui/src/widget/image.rs b/crates/bevy_ui/src/widget/image.rs index 9c6abbbf82..c65c4df354 100644 --- a/crates/bevy_ui/src/widget/image.rs +++ b/crates/bevy_ui/src/widget/image.rs @@ -11,7 +11,7 @@ use taffy::{MaybeMath, MaybeResolve}; /// A UI Node that renders an image. #[derive(Component, Clone, Debug, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] #[require(Node, ImageNodeSize, ContentSize)] pub struct ImageNode { /// The tint color used to draw the image. @@ -139,6 +139,7 @@ impl From> for ImageNode { /// Controls how the image is altered to fit within the layout and how the layout algorithm determines the space in the layout for the image #[derive(Default, Debug, Clone, Reflect)] +#[reflect(Clone, Default)] pub enum NodeImageMode { /// The image will be sized automatically by taking the size of the source image and applying any layout constraints. #[default] @@ -174,7 +175,7 @@ impl NodeImageMode { /// /// This component is updated automatically by [`update_image_content_size_system`] #[derive(Component, Debug, Copy, Clone, Default, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct ImageNodeSize { /// The size of the image's texture /// diff --git a/crates/bevy_ui/src/widget/label.rs b/crates/bevy_ui/src/widget/label.rs index f464fea527..19e9f3f214 100644 --- a/crates/bevy_ui/src/widget/label.rs +++ b/crates/bevy_ui/src/widget/label.rs @@ -3,5 +3,5 @@ use bevy_reflect::{std_traits::ReflectDefault, Reflect}; /// Marker struct for labels #[derive(Component, Debug, Default, Clone, Copy, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct Label; diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index 0be96febab..0153fa954c 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -29,7 +29,7 @@ use tracing::error; /// /// Used internally by [`measure_text_system`] and [`text_system`] to schedule text for processing. #[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, Clone)] pub struct TextNodeFlags { /// If set then a new measure function for the text node will be created. needs_measure_fn: bool, @@ -94,7 +94,7 @@ impl Default for TextNodeFlags { /// }); /// ``` #[derive(Component, Debug, Default, Clone, Deref, DerefMut, Reflect, PartialEq)] -#[reflect(Component, Default, Debug, PartialEq)] +#[reflect(Component, Default, Debug, PartialEq, Clone)] #[require(Node, TextLayout, TextFont, TextColor, TextNodeFlags, ContentSize)] pub struct Text(pub String); diff --git a/crates/bevy_window/src/event.rs b/crates/bevy_window/src/event.rs index ace66efb6c..026b85dc32 100644 --- a/crates/bevy_window/src/event.rs +++ b/crates/bevy_window/src/event.rs @@ -24,7 +24,11 @@ use crate::WindowTheme; /// A window event that is sent whenever a window's logical size has changed. #[derive(Event, Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -42,7 +46,11 @@ pub struct WindowResized { /// An event that indicates all of the application's windows should be redrawn, /// even if their control flow is set to `Wait` and there have been no window events. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -54,7 +62,11 @@ pub struct RequestRedraw; /// /// To create a new window, spawn an entity with a [`crate::Window`] on it. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -76,7 +88,11 @@ pub struct WindowCreated { /// [`WindowPlugin`]: crate::WindowPlugin /// [`Window`]: crate::Window #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -90,7 +106,11 @@ pub struct WindowCloseRequested { /// An event that is sent whenever a window is closed. This will be sent when /// the window entity loses its [`Window`](crate::window::Window) component or is despawned. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -107,7 +127,11 @@ pub struct WindowClosed { /// An event that is sent whenever a window is closing. This will be sent when /// after a [`WindowCloseRequested`] event is received and the window is in the process of closing. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -123,7 +147,11 @@ pub struct WindowClosing { /// Note that if your application only has a single window, this event may be your last chance to /// persist state before the application terminates. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -149,7 +177,11 @@ pub struct WindowDestroyed { /// /// [`WindowEvent::CursorMoved`]: https://docs.rs/winit/latest/winit/event/enum.WindowEvent.html#variant.CursorMoved #[derive(Event, Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -170,7 +202,11 @@ pub struct CursorMoved { /// An event that is sent whenever the user's cursor enters a window. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -183,7 +219,11 @@ pub struct CursorEntered { /// An event that is sent whenever the user's cursor leaves a window. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -200,7 +240,11 @@ pub struct CursorLeft { /// /// It is only sent if IME was enabled on the window with [`Window::ime_enabled`](crate::window::Window::ime_enabled). #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -241,7 +285,11 @@ pub enum Ime { /// An event that indicates a window has received or lost focus. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -264,7 +312,11 @@ pub struct WindowFocused { /// /// [`WindowEvent::Occluded`]: https://docs.rs/winit/latest/winit/event/enum.WindowEvent.html#variant.Occluded #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -279,7 +331,11 @@ pub struct WindowOccluded { /// An event that indicates a window's scale factor has changed. #[derive(Event, Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -294,7 +350,11 @@ pub struct WindowScaleFactorChanged { /// An event that indicates a window's OS-reported scale factor has changed. #[derive(Event, Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -309,7 +369,11 @@ pub struct WindowBackendScaleFactorChanged { /// Events related to files being dragged and dropped on a window. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -341,7 +405,11 @@ pub enum FileDragAndDrop { /// An event that is sent when a window is repositioned in physical pixels. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -359,7 +427,11 @@ pub struct WindowMoved { /// This event is only sent when the window is relying on the system theme to control its appearance. /// i.e. It is only sent when [`Window::window_theme`](crate::window::Window::window_theme) is `None` and the system theme changes. #[derive(Event, Debug, Clone, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -374,7 +446,11 @@ pub struct WindowThemeChanged { /// Application lifetime events #[derive(Event, Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -413,7 +489,11 @@ impl AppLifecycle { /// operating system. Otherwise, the event types are individually /// readable with `EventReader` (e.g. `EventReader`). #[derive(Event, Debug, Clone, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_window/src/monitor.rs b/crates/bevy_window/src/monitor.rs index b5ebf73975..e788db6363 100644 --- a/crates/bevy_window/src/monitor.rs +++ b/crates/bevy_window/src/monitor.rs @@ -19,7 +19,11 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// This component is synchronized with `winit` through `bevy_winit`, but is effectively /// read-only as `winit` does not support changing monitor properties. #[derive(Component, Debug, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component, Debug))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Component, Debug, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -44,7 +48,11 @@ pub struct Monitor { /// A marker component for the primary monitor #[derive(Component, Debug, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Component, Debug))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Component, Debug, Clone) +)] pub struct PrimaryMonitor; impl Monitor { @@ -56,7 +64,7 @@ impl Monitor { /// Represents a video mode that a monitor supports #[derive(Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug))] +#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Clone))] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), diff --git a/crates/bevy_window/src/system_cursor.rs b/crates/bevy_window/src/system_cursor.rs index 8db274ae9a..8390e561b0 100644 --- a/crates/bevy_window/src/system_cursor.rs +++ b/crates/bevy_window/src/system_cursor.rs @@ -87,7 +87,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Hash, Default, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index 9ef026fe74..0414eb5098 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -30,7 +30,7 @@ use crate::VideoMode; #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Component, Debug, Default, PartialEq) + reflect(Component, Debug, Default, PartialEq, Clone) )] pub struct PrimaryWindow; @@ -38,7 +38,11 @@ pub struct PrimaryWindow; /// a more vague defaulting choice. #[repr(C)] #[derive(Default, Copy, Clone, Debug)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Default, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -93,7 +97,11 @@ impl VisitEntitiesMut for WindowRef { /// For most purposes you probably want to use the unnormalized version [`WindowRef`]. #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Hash, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -142,7 +150,7 @@ impl EntityBorrow for NormalizedWindowRef { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Component, Default, Debug) + reflect(Component, Default, Debug, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -631,7 +639,7 @@ impl Window { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -699,7 +707,11 @@ impl WindowResizeConstraints { /// Cursor data for a [`Window`]. #[derive(Debug, Clone)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, Default))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, Default, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -747,7 +759,11 @@ impl Default for CursorOptions { /// Defines where a [`Window`] should be placed on the screen. #[derive(Default, Debug, Clone, Copy, PartialEq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -839,7 +855,7 @@ impl WindowPosition { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -1038,7 +1054,7 @@ impl From for WindowResolution { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -1060,7 +1076,7 @@ pub enum CursorGrabMode { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -1106,7 +1122,11 @@ impl InternalWindowState { /// /// Used when centering a [`Window`] on a monitor. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1135,7 +1155,7 @@ pub enum MonitorSelection { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, Clone)] pub enum VideoModeSelection { /// Uses the video mode that the monitor is already in. Current, @@ -1168,7 +1188,7 @@ pub enum VideoModeSelection { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Hash) + reflect(Debug, PartialEq, Hash, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -1249,7 +1269,7 @@ pub enum PresentMode { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Hash) + reflect(Debug, PartialEq, Hash, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( @@ -1285,7 +1305,11 @@ pub enum CompositeAlphaMode { /// Defines the way a [`Window`] is displayed. #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1329,7 +1353,11 @@ pub enum WindowMode { /// /// - **iOS / Android / Web / Wayland:** Unsupported. #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1349,7 +1377,11 @@ pub enum WindowLevel { /// The [`Window`] theme variant to use. #[derive(Debug, Clone, Copy, PartialEq, Eq)] -#[cfg_attr(feature = "bevy_reflect", derive(Reflect), reflect(Debug, PartialEq))] +#[cfg_attr( + feature = "bevy_reflect", + derive(Reflect), + reflect(Debug, PartialEq, Clone) +)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( all(feature = "serialize", feature = "bevy_reflect"), @@ -1374,7 +1406,7 @@ pub enum WindowTheme { #[cfg_attr( feature = "bevy_reflect", derive(Reflect), - reflect(Debug, PartialEq, Default) + reflect(Debug, PartialEq, Default, Clone) )] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr( diff --git a/crates/bevy_winit/src/cursor.rs b/crates/bevy_winit/src/cursor.rs index 6e601f2429..de07581141 100644 --- a/crates/bevy_winit/src/cursor.rs +++ b/crates/bevy_winit/src/cursor.rs @@ -55,7 +55,7 @@ impl Plugin for CursorPlugin { /// Insert into a window entity to set the cursor for that window. #[derive(Component, Debug, Clone, Reflect, PartialEq, Eq)] -#[reflect(Component, Debug, Default, PartialEq)] +#[reflect(Component, Debug, Default, PartialEq, Clone)] pub enum CursorIcon { #[cfg(feature = "custom_cursor")] /// Custom cursor image. diff --git a/crates/bevy_winit/src/custom_cursor.rs b/crates/bevy_winit/src/custom_cursor.rs index f6c90da6e2..dd8236e30e 100644 --- a/crates/bevy_winit/src/custom_cursor.rs +++ b/crates/bevy_winit/src/custom_cursor.rs @@ -9,7 +9,7 @@ use crate::{cursor::CursorIcon, state::CustomCursorCache}; /// A custom cursor created from an image. #[derive(Debug, Clone, Default, Reflect, PartialEq, Eq, Hash)] -#[reflect(Debug, Default, Hash, PartialEq)] +#[reflect(Debug, Default, Hash, PartialEq, Clone)] pub struct CustomCursorImage { /// Handle to the image to use as the cursor. The image must be in 8 bit int /// or 32 bit float rgba. PNG images work well for this. @@ -45,7 +45,7 @@ pub struct CustomCursorImage { #[cfg(all(target_family = "wasm", target_os = "unknown"))] /// A custom cursor created from a URL. #[derive(Debug, Clone, Default, Reflect, PartialEq, Eq, Hash)] -#[reflect(Debug, Default, Hash, PartialEq)] +#[reflect(Debug, Default, Hash, PartialEq, Clone)] pub struct CustomCursorUrl { /// Web URL to an image to use as the cursor. PNGs are preferred. Cursor /// creation can fail if the image is invalid or not reachable. @@ -57,6 +57,7 @@ pub struct CustomCursorUrl { /// Custom cursor image data. #[derive(Debug, Clone, Reflect, PartialEq, Eq, Hash)] +#[reflect(Clone, PartialEq, Hash)] pub enum CustomCursor { /// Use an image as the cursor. Image(CustomCursorImage), diff --git a/crates/bevy_winit/src/lib.rs b/crates/bevy_winit/src/lib.rs index 7cac158b95..db74825f0f 100644 --- a/crates/bevy_winit/src/lib.rs +++ b/crates/bevy_winit/src/lib.rs @@ -149,7 +149,7 @@ impl Plugin for WinitPlugin { /// The default event that can be used to wake the window loop /// Wakes up the loop if in wait state #[derive(Debug, Default, Clone, Copy, Event, Reflect)] -#[reflect(Debug, Default)] +#[reflect(Debug, Default, Clone)] pub struct WakeUp; /// The original window event as produced by Winit. This is meant as an escape diff --git a/examples/reflection/reflection_types.rs b/examples/reflection/reflection_types.rs index 2b492f5d45..427034056f 100644 --- a/examples/reflection/reflection_types.rs +++ b/examples/reflection/reflection_types.rs @@ -39,14 +39,14 @@ enum D { C { value: f32 }, } -/// Reflect has "built in" support for some common traits like `PartialEq`, `Hash`, and `Serialize`. +/// Reflect has "built in" support for some common traits like `PartialEq`, `Hash`, and `Clone`. /// /// These are exposed via methods like `PartialReflect::reflect_hash()`, -/// `PartialReflect::reflect_partial_eq()`, and `PartialReflect::serializable()`. +/// `PartialReflect::reflect_partial_eq()`, and `PartialReflect::reflect_clone()`. /// You can force these implementations to use the actual trait /// implementations (instead of their defaults) like this: -#[derive(Reflect, Hash, Serialize, PartialEq, Eq)] -#[reflect(Hash, Serialize, PartialEq)] +#[derive(Reflect, Hash, PartialEq, Clone)] +#[reflect(Hash, PartialEq, Clone)] pub struct E { x: usize, } @@ -54,11 +54,11 @@ pub struct E { /// By default, deriving with Reflect assumes the type is either a "struct" or an "enum". /// /// You can tell reflect to treat your type instead as an "opaque type" by using the `#[reflect(opaque)]`. -/// It is generally a good idea to implement (and reflect) the `PartialEq`, `Serialize`, and `Deserialize` +/// It is generally a good idea to implement (and reflect) the `PartialEq` and `Clone` (optionally also `Serialize` and `Deserialize`) /// traits on opaque types to ensure that these values behave as expected when nested in other reflected types. #[derive(Reflect, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] #[reflect(opaque)] -#[reflect(PartialEq, Serialize, Deserialize)] +#[reflect(PartialEq, Clone, Serialize, Deserialize)] enum F { X, Y,