From 7fc6db32ce76cf62d6ed5fe90fd9a6132ab94e41 Mon Sep 17 00:00:00 2001 From: Raffaele Ragni Date: Mon, 19 Jun 2023 18:18:17 +0200 Subject: [PATCH] Add FromReflect where Reflect is used (#8776) # Objective Discovered that PointLight did not implement FromReflect. Adding FromReflect where Reflect is used. I overreached and applied this rule everywhere there was a Reflect without a FromReflect, except from where the compiler wouldn't allow me. Based from question: https://github.com/bevyengine/bevy/discussions/8774 ## Solution - Adding FromReflect where Reflect was already derived ## Notes First PR I do in this ecosystem, so not sure if this is the usual approach, that is, to touch many files at once. --------- Co-authored-by: Alice Cecile --- crates/bevy_asset/src/handle.rs | 5 +- crates/bevy_asset/src/path.rs | 30 ++++++++++-- crates/bevy_core/src/name.rs | 4 +- .../bevy_core_pipeline/src/bloom/settings.rs | 5 +- crates/bevy_core_pipeline/src/clear_color.rs | 12 +++-- .../src/core_2d/camera_2d.rs | 6 +-- .../src/core_3d/camera_3d.rs | 15 +++--- crates/bevy_core_pipeline/src/prepass/mod.rs | 11 +++-- .../bevy_core_pipeline/src/tonemapping/mod.rs | 6 +-- crates/bevy_gltf/src/lib.rs | 6 +-- .../bevy_hierarchy/src/components/children.rs | 6 +-- .../bevy_hierarchy/src/components/parent.rs | 6 +-- crates/bevy_input/src/gamepad.rs | 31 ++++++------ crates/bevy_input/src/input.rs | 6 +-- crates/bevy_input/src/keyboard.rs | 8 ++-- crates/bevy_input/src/lib.rs | 4 +- crates/bevy_input/src/mouse.rs | 12 ++--- crates/bevy_input/src/touch.rs | 8 ++-- crates/bevy_pbr/src/alpha.rs | 4 +- crates/bevy_pbr/src/bundle.rs | 10 ++-- crates/bevy_pbr/src/fog.rs | 9 ++-- crates/bevy_pbr/src/light.rs | 47 ++++++++++--------- crates/bevy_pbr/src/pbr_material.rs | 6 ++- crates/bevy_pbr/src/wireframe.rs | 10 ++-- crates/bevy_render/src/camera/camera.rs | 3 +- crates/bevy_render/src/camera/projection.rs | 6 +-- crates/bevy_render/src/mesh/mesh/skinning.rs | 6 +-- crates/bevy_render/src/primitives/mod.rs | 14 +++--- crates/bevy_render/src/view/visibility/mod.rs | 4 +- crates/bevy_sprite/src/mesh2d/mesh.rs | 6 +-- crates/bevy_text/src/text2d.rs | 6 +-- .../src/components/global_transform.rs | 4 +- .../src/components/transform.rs | 2 +- crates/bevy_ui/src/measurement.rs | 6 +-- crates/bevy_ui/src/ui_node.rs | 8 ++-- crates/bevy_ui/src/widget/text.rs | 6 +-- crates/bevy_window/src/cursor.rs | 4 +- crates/bevy_window/src/event.rs | 34 +++++++------- crates/bevy_window/src/window.rs | 34 +++++++------- 39 files changed, 225 insertions(+), 185 deletions(-) diff --git a/crates/bevy_asset/src/handle.rs b/crates/bevy_asset/src/handle.rs index 4921e97e44..e5ae0bd023 100644 --- a/crates/bevy_asset/src/handle.rs +++ b/crates/bevy_asset/src/handle.rs @@ -11,7 +11,8 @@ use crate::{ }; use bevy_ecs::{component::Component, reflect::ReflectComponent}; use bevy_reflect::{ - std_traits::ReflectDefault, FromReflect, Reflect, ReflectDeserialize, ReflectSerialize, + std_traits::ReflectDefault, FromReflect, Reflect, ReflectDeserialize, ReflectFromReflect, + ReflectSerialize, }; use bevy_utils::Uuid; use crossbeam_channel::{Receiver, Sender}; @@ -103,7 +104,7 @@ impl HandleId { /// collisions no longer being detected for that entity. /// #[derive(Component, Reflect, FromReflect)] -#[reflect(Component, Default)] +#[reflect(Component, Default, FromReflect)] pub struct Handle where T: Asset, diff --git a/crates/bevy_asset/src/path.rs b/crates/bevy_asset/src/path.rs index f1756dcb6c..43f248384f 100644 --- a/crates/bevy_asset/src/path.rs +++ b/crates/bevy_asset/src/path.rs @@ -69,16 +69,38 @@ impl<'a> AssetPath<'a> { /// An unique identifier to an asset path. #[derive( - Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Reflect, + Debug, + Clone, + Copy, + Eq, + PartialEq, + Hash, + Ord, + PartialOrd, + Serialize, + Deserialize, + Reflect, + FromReflect, )] -#[reflect_value(PartialEq, Hash, Serialize, Deserialize)] +#[reflect_value(PartialEq, Hash, Serialize, Deserialize, FromReflect)] pub struct AssetPathId(SourcePathId, LabelId); /// An unique identifier to the source path of an asset. #[derive( - Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, Reflect, + Debug, + Clone, + Copy, + Eq, + PartialEq, + Hash, + Ord, + PartialOrd, + Serialize, + Deserialize, + Reflect, + FromReflect, )] -#[reflect_value(PartialEq, Hash, Serialize, Deserialize)] +#[reflect_value(PartialEq, Hash, Serialize, Deserialize, FromReflect)] pub struct SourcePathId(u64); /// An unique identifier to a sub-asset label. diff --git a/crates/bevy_core/src/name.rs b/crates/bevy_core/src/name.rs index bf60647f0f..59e507055f 100644 --- a/crates/bevy_core/src/name.rs +++ b/crates/bevy_core/src/name.rs @@ -1,8 +1,8 @@ use bevy_ecs::{ component::Component, entity::Entity, query::WorldQuery, reflect::ReflectComponent, }; -use bevy_reflect::Reflect; use bevy_reflect::{std_traits::ReflectDefault, FromReflect}; +use bevy_reflect::{Reflect, ReflectFromReflect}; use bevy_utils::AHasher; use std::{ borrow::Cow, @@ -18,7 +18,7 @@ use std::{ /// as multiple entities can have the same name. [`bevy_ecs::entity::Entity`] should be /// used instead as the default unique identifier. #[derive(Reflect, FromReflect, Component, Clone)] -#[reflect(Component, Default, Debug)] +#[reflect(Component, Default, Debug, FromReflect)] pub struct Name { hash: u64, // TODO: Shouldn't be serialized name: Cow<'static, str>, diff --git a/crates/bevy_core_pipeline/src/bloom/settings.rs b/crates/bevy_core_pipeline/src/bloom/settings.rs index 553fa75c6c..43422869a6 100644 --- a/crates/bevy_core_pipeline/src/bloom/settings.rs +++ b/crates/bevy_core_pipeline/src/bloom/settings.rs @@ -1,7 +1,7 @@ use super::downsampling_pipeline::BloomUniforms; use bevy_ecs::{prelude::Component, query::QueryItem, reflect::ReflectComponent}; use bevy_math::{UVec4, Vec4}; -use bevy_reflect::{std_traits::ReflectDefault, Reflect}; +use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect}; use bevy_render::{extract_component::ExtractComponent, prelude::Camera}; /// Applies a bloom effect to an HDR-enabled 2d or 3d camera. @@ -160,7 +160,8 @@ impl Default for BloomSettings { /// * Changing these settings creates a physically inaccurate image /// * Changing these settings makes it easy to make the final result look worse /// * Non-default prefilter settings should be used in conjuction with [`BloomCompositeMode::Additive`] -#[derive(Default, Clone, Reflect)] +#[derive(Default, Clone, Reflect, FromReflect)] +#[reflect(FromReflect)] pub struct BloomPrefilterSettings { /// Baseline of the quadratic threshold curve (default: 0.0). /// diff --git a/crates/bevy_core_pipeline/src/clear_color.rs b/crates/bevy_core_pipeline/src/clear_color.rs index 50861e1beb..d031507335 100644 --- a/crates/bevy_core_pipeline/src/clear_color.rs +++ b/crates/bevy_core_pipeline/src/clear_color.rs @@ -1,11 +1,13 @@ use bevy_derive::{Deref, DerefMut}; use bevy_ecs::prelude::*; -use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize}; +use bevy_reflect::{ + FromReflect, Reflect, ReflectDeserialize, ReflectFromReflect, ReflectSerialize, +}; use bevy_render::{color::Color, extract_resource::ExtractResource}; use serde::{Deserialize, Serialize}; -#[derive(Reflect, Serialize, Deserialize, Clone, Debug, Default)] -#[reflect(Serialize, Deserialize)] +#[derive(Reflect, FromReflect, Serialize, Deserialize, Clone, Debug, Default)] +#[reflect(Serialize, Deserialize, FromReflect)] pub enum ClearColorConfig { #[default] Default, @@ -17,8 +19,8 @@ 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)] +#[derive(Resource, Clone, Debug, Deref, DerefMut, ExtractResource, Reflect, FromReflect)] +#[reflect(Resource, FromReflect)] pub struct ClearColor(pub Color); impl Default for ClearColor { 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 36765180a1..f79e3ffaf9 100644 --- a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs +++ b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs @@ -3,7 +3,7 @@ use crate::{ tonemapping::{DebandDither, Tonemapping}, }; use bevy_ecs::prelude::*; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_render::{ camera::{Camera, CameraProjection, CameraRenderGraph, OrthographicProjection}, extract_component::ExtractComponent, @@ -12,9 +12,9 @@ use bevy_render::{ }; use bevy_transform::prelude::{GlobalTransform, Transform}; -#[derive(Component, Default, Reflect, Clone, ExtractComponent)] +#[derive(Component, Default, Reflect, FromReflect, Clone, ExtractComponent)] #[extract_component_filter(With)] -#[reflect(Component)] +#[reflect(Component, FromReflect)] pub struct Camera2d { pub clear_color: ClearColorConfig, } 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 f8f01286cc..d28ee5bc63 100644 --- a/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs +++ b/crates/bevy_core_pipeline/src/core_3d/camera_3d.rs @@ -3,7 +3,9 @@ use crate::{ tonemapping::{DebandDither, Tonemapping}, }; use bevy_ecs::prelude::*; -use bevy_reflect::{Reflect, ReflectDeserialize, ReflectSerialize}; +use bevy_reflect::{ + FromReflect, Reflect, ReflectDeserialize, ReflectFromReflect, ReflectSerialize, +}; use bevy_render::{ camera::{Camera, CameraRenderGraph, Projection}, extract_component::ExtractComponent, @@ -15,9 +17,9 @@ use bevy_transform::prelude::{GlobalTransform, Transform}; use serde::{Deserialize, Serialize}; /// Configuration for the "main 3d render graph". -#[derive(Component, Reflect, Clone, ExtractComponent)] +#[derive(Component, Reflect, FromReflect, Clone, ExtractComponent)] #[extract_component_filter(With)] -#[reflect(Component)] +#[reflect(Component, FromReflect)] pub struct Camera3d { /// The clear color operation to perform for the main 3d pass. pub clear_color: ClearColorConfig, @@ -37,7 +39,8 @@ impl Default for Camera3d { } } -#[derive(Clone, Copy, Reflect)] +#[derive(Clone, Copy, Reflect, FromReflect)] +#[reflect(FromReflect)] pub struct Camera3dDepthTextureUsage(u32); impl From for Camera3dDepthTextureUsage { @@ -52,8 +55,8 @@ impl From for TextureUsages { } /// The depth clear operation to perform for the main 3d pass. -#[derive(Reflect, Serialize, Deserialize, Clone, Debug)] -#[reflect(Serialize, Deserialize)] +#[derive(Reflect, FromReflect, Serialize, Deserialize, Clone, Debug)] +#[reflect(Serialize, Deserialize, FromReflect)] 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. diff --git a/crates/bevy_core_pipeline/src/prepass/mod.rs b/crates/bevy_core_pipeline/src/prepass/mod.rs index 93bcebe031..4aa098eae3 100644 --- a/crates/bevy_core_pipeline/src/prepass/mod.rs +++ b/crates/bevy_core_pipeline/src/prepass/mod.rs @@ -30,7 +30,7 @@ pub mod node; use std::cmp::Reverse; use bevy_ecs::prelude::*; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_render::{ render_phase::{CachedRenderPipelinePhaseItem, DrawFunctionId, PhaseItem}, render_resource::{CachedRenderPipelineId, Extent3d, TextureFormat}, @@ -43,16 +43,19 @@ pub const NORMAL_PREPASS_FORMAT: TextureFormat = TextureFormat::Rgb10a2Unorm; pub const MOTION_VECTOR_PREPASS_FORMAT: TextureFormat = TextureFormat::Rg16Float; /// If added to a [`crate::prelude::Camera3d`] then depth values will be copied to a separate texture available to the main pass. -#[derive(Component, Default, Reflect)] +#[derive(Component, Default, Reflect, FromReflect)] +#[reflect(FromReflect)] pub struct DepthPrepass; /// If added to a [`crate::prelude::Camera3d`] then vertex world normals will be copied to a separate texture available to the main pass. /// Normals will have normal map textures already applied. -#[derive(Component, Default, Reflect)] +#[derive(Component, Default, Reflect, FromReflect)] +#[reflect(FromReflect)] pub struct NormalPrepass; /// If added to a [`crate::prelude::Camera3d`] then screen space motion vectors will be copied to a separate texture available to the main pass. -#[derive(Component, Default, Reflect)] +#[derive(Component, Default, Reflect, FromReflect)] +#[reflect(FromReflect)] pub struct MotionVectorPrepass; /// Textures that are written to by the prepass. diff --git a/crates/bevy_core_pipeline/src/tonemapping/mod.rs b/crates/bevy_core_pipeline/src/tonemapping/mod.rs index 66f484e864..4fc33fda37 100644 --- a/crates/bevy_core_pipeline/src/tonemapping/mod.rs +++ b/crates/bevy_core_pipeline/src/tonemapping/mod.rs @@ -2,7 +2,7 @@ use crate::fullscreen_vertex_shader::fullscreen_shader_vertex_state; use bevy_app::prelude::*; use bevy_asset::{load_internal_asset, Assets, Handle, HandleUntyped}; use bevy_ecs::prelude::*; -use bevy_reflect::{FromReflect, Reflect, TypeUuid}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect, TypeUuid}; use bevy_render::camera::Camera; use bevy_render::extract_component::{ExtractComponent, ExtractComponentPlugin}; use bevy_render::extract_resource::{ExtractResource, ExtractResourcePlugin}; @@ -127,7 +127,7 @@ pub struct TonemappingPipeline { FromReflect, )] #[extract_component_filter(With)] -#[reflect(Component)] +#[reflect(Component, FromReflect)] pub enum Tonemapping { /// Bypass tonemapping. None, @@ -314,7 +314,7 @@ pub fn queue_view_tonemapping_pipelines( FromReflect, )] #[extract_component_filter(With)] -#[reflect(Component)] +#[reflect(Component, FromReflect)] pub enum DebandDither { #[default] Disabled, diff --git a/crates/bevy_gltf/src/lib.rs b/crates/bevy_gltf/src/lib.rs index 7277a90626..74ca945506 100644 --- a/crates/bevy_gltf/src/lib.rs +++ b/crates/bevy_gltf/src/lib.rs @@ -12,7 +12,7 @@ use bevy_app::prelude::*; use bevy_asset::{AddAsset, Handle}; use bevy_ecs::{prelude::Component, reflect::ReflectComponent}; use bevy_pbr::StandardMaterial; -use bevy_reflect::{Reflect, TypePath, TypeUuid}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect, TypePath, TypeUuid}; use bevy_render::{ mesh::{Mesh, MeshVertexAttribute}, renderer::RenderDevice, @@ -106,8 +106,8 @@ pub struct GltfPrimitive { pub material_extras: Option, } -#[derive(Clone, Debug, Reflect, Default, Component)] -#[reflect(Component)] +#[derive(Clone, Debug, Reflect, FromReflect, Default, Component)] +#[reflect(Component, FromReflect)] pub struct GltfExtras { pub value: String, } diff --git a/crates/bevy_hierarchy/src/components/children.rs b/crates/bevy_hierarchy/src/components/children.rs index 02d9e0e388..816b8e518c 100644 --- a/crates/bevy_hierarchy/src/components/children.rs +++ b/crates/bevy_hierarchy/src/components/children.rs @@ -5,7 +5,7 @@ use bevy_ecs::{ reflect::{ReflectComponent, ReflectMapEntities}, world::World, }; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use core::slice; use smallvec::SmallVec; use std::ops::Deref; @@ -16,8 +16,8 @@ use std::ops::Deref; /// /// [`HierarchyQueryExt`]: crate::query_extension::HierarchyQueryExt /// [`Query`]: bevy_ecs::system::Query -#[derive(Component, Debug, Reflect)] -#[reflect(Component, MapEntities)] +#[derive(Component, Debug, Reflect, FromReflect)] +#[reflect(Component, MapEntities, FromReflect)] pub struct Children(pub(crate) SmallVec<[Entity; 8]>); impl MapEntities for Children { diff --git a/crates/bevy_hierarchy/src/components/parent.rs b/crates/bevy_hierarchy/src/components/parent.rs index 7bccf33ed6..5c44789dbc 100644 --- a/crates/bevy_hierarchy/src/components/parent.rs +++ b/crates/bevy_hierarchy/src/components/parent.rs @@ -4,7 +4,7 @@ use bevy_ecs::{ reflect::{ReflectComponent, ReflectMapEntities}, world::{FromWorld, World}, }; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use std::ops::Deref; /// Holds a reference to the parent entity of this entity. @@ -14,8 +14,8 @@ use std::ops::Deref; /// /// [`HierarchyQueryExt`]: crate::query_extension::HierarchyQueryExt /// [`Query`]: bevy_ecs::system::Query -#[derive(Component, Debug, Eq, PartialEq, Reflect)] -#[reflect(Component, MapEntities, PartialEq)] +#[derive(Component, Debug, Eq, PartialEq, Reflect, FromReflect)] +#[reflect(Component, MapEntities, PartialEq, FromReflect)] pub struct Parent(pub(crate) Entity); impl Parent { diff --git a/crates/bevy_input/src/gamepad.rs b/crates/bevy_input/src/gamepad.rs index 00801d4e28..153ef8d807 100644 --- a/crates/bevy_input/src/gamepad.rs +++ b/crates/bevy_input/src/gamepad.rs @@ -4,6 +4,7 @@ use bevy_ecs::{ change_detection::DetectChangesMut, system::{Res, ResMut, Resource}, }; +use bevy_reflect::ReflectFromReflect; use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect}; use bevy_utils::Duration; use bevy_utils::{tracing::info, HashMap}; @@ -73,7 +74,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// /// The `ID` of a gamepad is fixed until the gamepad disconnects or the app is restarted. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -93,7 +94,7 @@ impl Gamepad { /// Metadata associated with a [`Gamepad`]. #[derive(Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -154,7 +155,7 @@ impl Gamepads { /// which in turn is used to create the [`Input`] or /// [`Axis`] `bevy` resources. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -219,7 +220,7 @@ pub enum GamepadButtonType { /// /// The gamepad button resources are updated inside of the [`gamepad_button_event_system`]. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -261,7 +262,7 @@ impl GamepadButton { /// [`GamepadAxisChangedEvent`]. It is also used in the [`GamepadAxis`] /// which in turn is used to create the [`Axis`] `bevy` resource. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -297,7 +298,7 @@ pub enum GamepadAxisType { /// /// The gamepad axes resources are updated inside of the [`gamepad_axis_event_system`]. #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -342,7 +343,7 @@ impl GamepadAxis { /// should register as a [`GamepadEvent`]. Events that don't meet the change thresholds defined in [`GamepadSettings`] /// will not register. To modify these settings, mutate the corresponding resource. #[derive(Resource, Default, Debug, Reflect, FromReflect)] -#[reflect(Debug, Default)] +#[reflect(Debug, Default, FromReflect)] pub struct GamepadSettings { /// The default button settings. pub default_button_settings: ButtonSettings, @@ -425,7 +426,7 @@ impl GamepadSettings { /// /// Allowed values: `0.0 <= ``release_threshold`` <= ``press_threshold`` <= 1.0` #[derive(Debug, Clone, Reflect, FromReflect)] -#[reflect(Debug, Default)] +#[reflect(Debug, Default, FromReflect)] pub struct ButtonSettings { press_threshold: f32, release_threshold: f32, @@ -585,7 +586,7 @@ impl ButtonSettings { /// /// The valid range is `[-1.0, 1.0]`. #[derive(Debug, Clone, Reflect, FromReflect, PartialEq)] -#[reflect(Debug, Default)] +#[reflect(Debug, Default, FromReflect)] pub struct AxisSettings { /// Values that are higher than `livezone_upperbound` will be rounded up to 1.0. livezone_upperbound: f32, @@ -917,7 +918,7 @@ impl AxisSettings { /// /// The current value of a button is received through the [`GamepadButtonChangedEvent`]. #[derive(Debug, Clone, Reflect, FromReflect)] -#[reflect(Debug, Default)] +#[reflect(Debug, Default, FromReflect)] pub struct ButtonAxisSettings { /// The high value at which to apply rounding. pub high: f32, @@ -1026,7 +1027,7 @@ pub fn gamepad_connection_system( } #[derive(Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1040,7 +1041,7 @@ pub enum GamepadConnection { /// A Gamepad connection event. Created when a connection to a gamepad /// is established and when a gamepad is disconnected. #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1071,7 +1072,7 @@ impl GamepadConnectionEvent { } #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1096,7 +1097,7 @@ impl GamepadAxisChangedEvent { /// Gamepad event for when the "value" (amount of pressure) on the button /// changes by an amount larger than the threshold defined in [`GamepadSettings`]. #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -1159,7 +1160,7 @@ pub fn gamepad_button_event_system( /// [`GamepadButtonChangedEvent`] and [`GamepadAxisChangedEvent`] when /// the in-frame relative ordering of events is important. #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_input/src/input.rs b/crates/bevy_input/src/input.rs index 3758840fec..a395a3d8db 100644 --- a/crates/bevy_input/src/input.rs +++ b/crates/bevy_input/src/input.rs @@ -1,5 +1,5 @@ use bevy_ecs::system::Resource; -use bevy_reflect::{std_traits::ReflectDefault, Reflect}; +use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect}; use bevy_utils::HashSet; use std::hash::Hash; @@ -41,8 +41,8 @@ use bevy_ecs::schedule::State; /// ///[`ResMut`]: bevy_ecs::system::ResMut ///[`DetectChangesMut::bypass_change_detection`]: bevy_ecs::change_detection::DetectChangesMut::bypass_change_detection -#[derive(Debug, Clone, Resource, Reflect)] -#[reflect(Default)] +#[derive(Debug, Clone, Resource, Reflect, FromReflect)] +#[reflect(Default, FromReflect)] pub struct Input { /// A collection of every button that is currently being pressed. pressed: HashSet, diff --git a/crates/bevy_input/src/keyboard.rs b/crates/bevy_input/src/keyboard.rs index c5c7688a26..dd32ba8d82 100644 --- a/crates/bevy_input/src/keyboard.rs +++ b/crates/bevy_input/src/keyboard.rs @@ -5,7 +5,7 @@ use bevy_ecs::{ event::{Event, EventReader}, system::ResMut, }; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; @@ -20,7 +20,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// The event is consumed inside of the [`keyboard_input_system`](crate::keyboard::keyboard_input_system) /// to update the [`Input`](crate::Input) resource. #[derive(Event, Debug, Clone, Copy, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -79,7 +79,7 @@ pub fn keyboard_input_system( /// /// The resource is updated inside of the [`keyboard_input_system`](crate::keyboard::keyboard_input_system). #[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -452,7 +452,7 @@ pub enum KeyCode { /// /// The resource is updated inside of the [`keyboard_input_system`](crate::keyboard::keyboard_input_system). #[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_input/src/lib.rs b/crates/bevy_input/src/lib.rs index 9abd064cb9..4f343ece0d 100644 --- a/crates/bevy_input/src/lib.rs +++ b/crates/bevy_input/src/lib.rs @@ -28,7 +28,7 @@ pub mod prelude { use bevy_app::prelude::*; use bevy_ecs::prelude::*; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use keyboard::{keyboard_input_system, KeyCode, KeyboardInput, ScanCode}; use mouse::{ mouse_button_input_system, MouseButton, MouseButtonInput, MouseMotion, MouseScrollUnit, @@ -141,7 +141,7 @@ impl Plugin for InputPlugin { /// The current "press" state of an element #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_input/src/mouse.rs b/crates/bevy_input/src/mouse.rs index 8ffb50fb95..53dbff777f 100644 --- a/crates/bevy_input/src/mouse.rs +++ b/crates/bevy_input/src/mouse.rs @@ -6,7 +6,7 @@ use bevy_ecs::{ system::ResMut, }; use bevy_math::Vec2; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; @@ -20,7 +20,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; /// The event is read inside of the [`mouse_button_input_system`](crate::mouse::mouse_button_input_system) /// to update the [`Input`](crate::Input) resource. #[derive(Event, Debug, Clone, Copy, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -46,7 +46,7 @@ pub struct MouseButtonInput { /// /// The resource is updated inside of the [`mouse_button_input_system`](crate::mouse::mouse_button_input_system). #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -73,7 +73,7 @@ pub enum MouseButton { /// /// [`DeviceEvent::MouseMotion`]: https://docs.rs/winit/latest/winit/event/enum.DeviceEvent.html#variant.MouseMotion #[derive(Event, Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -91,7 +91,7 @@ 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, Clone, Copy, Eq, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -114,7 +114,7 @@ pub enum MouseScrollUnit { /// /// This event is the translated version of the `WindowEvent::MouseWheel` from the `winit` crate. #[derive(Event, Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_input/src/touch.rs b/crates/bevy_input/src/touch.rs index e06a3a2e48..a17853b88f 100644 --- a/crates/bevy_input/src/touch.rs +++ b/crates/bevy_input/src/touch.rs @@ -1,7 +1,7 @@ use bevy_ecs::event::{Event, EventReader}; use bevy_ecs::system::{ResMut, Resource}; use bevy_math::Vec2; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_utils::HashMap; #[cfg(feature = "serialize")] @@ -31,7 +31,7 @@ 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, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -53,7 +53,7 @@ pub struct TouchInput { /// A force description of a [`Touch`](crate::touch::Touch) input. #[derive(Debug, Clone, Copy, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -99,7 +99,7 @@ pub enum ForceTouch { /// or that a finger has moved. There is also a canceled phase that indicates that /// the system canceled the tracking of the finger. #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy, Reflect, FromReflect)] -#[reflect(Debug, Hash, PartialEq)] +#[reflect(Debug, Hash, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_pbr/src/alpha.rs b/crates/bevy_pbr/src/alpha.rs index 378d12044d..34d10b91fe 100644 --- a/crates/bevy_pbr/src/alpha.rs +++ b/crates/bevy_pbr/src/alpha.rs @@ -1,10 +1,10 @@ use bevy_reflect::std_traits::ReflectDefault; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; // 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, FromReflect)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, FromReflect)] pub enum AlphaMode { /// Base color alpha values are overridden to be fully opaque (1.0). #[default] diff --git a/crates/bevy_pbr/src/bundle.rs b/crates/bevy_pbr/src/bundle.rs index 0590dba4ab..704e349877 100644 --- a/crates/bevy_pbr/src/bundle.rs +++ b/crates/bevy_pbr/src/bundle.rs @@ -4,7 +4,7 @@ use crate::{ }; use bevy_asset::Handle; use bevy_ecs::{bundle::Bundle, component::Component, prelude::Entity, reflect::ReflectComponent}; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_render::{ mesh::Mesh, primitives::{CascadesFrusta, CubemapFrusta, Frustum}, @@ -42,8 +42,8 @@ impl Default for MaterialMeshBundle { } } -#[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[derive(Component, Clone, Debug, Default, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct CubemapVisibleEntities { #[reflect(ignore)] data: [VisibleEntities; 6], @@ -67,8 +67,8 @@ impl CubemapVisibleEntities { } } -#[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[derive(Component, Clone, Debug, Default, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct CascadesVisibleEntities { /// Map of view entity to the visible entities for each cascade frustum. #[reflect(ignore)] diff --git a/crates/bevy_pbr/src/fog.rs b/crates/bevy_pbr/src/fog.rs index c5ad092f54..0c2f054214 100644 --- a/crates/bevy_pbr/src/fog.rs +++ b/crates/bevy_pbr/src/fog.rs @@ -1,7 +1,7 @@ use crate::ReflectComponent; use bevy_ecs::{prelude::*, query::QueryItem}; use bevy_math::Vec3; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_render::{color::Color, extract_component::ExtractComponent, prelude::Camera}; /// Configures the “classic” computer graphics [distance fog](https://en.wikipedia.org/wiki/Distance_fog) effect, @@ -47,8 +47,8 @@ use bevy_render::{color::Color, extract_component::ExtractComponent, prelude::Ca /// /// Once enabled for a specific camera, the fog effect can also be disabled for individual /// [`StandardMaterial`](crate::StandardMaterial) instances via the `fog_enabled` flag. -#[derive(Debug, Clone, Component, Reflect)] -#[reflect(Component)] +#[derive(Debug, Clone, Component, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct FogSettings { /// The color of the fog effect. /// @@ -94,7 +94,8 @@ pub struct FogSettings { /// - [`FogFalloff::from_visibility_colors()`] /// - [`FogFalloff::from_visibility_contrast_color()`] /// - [`FogFalloff::from_visibility_contrast_colors()`] -#[derive(Debug, Clone, Reflect)] +#[derive(Debug, Clone, Reflect, FromReflect)] +#[reflect(FromReflect)] pub enum FogFalloff { /// A linear fog falloff that grows in intensity between `start` and `end` distances. /// diff --git a/crates/bevy_pbr/src/light.rs b/crates/bevy_pbr/src/light.rs index fd2782a6d0..54c337e1ff 100644 --- a/crates/bevy_pbr/src/light.rs +++ b/crates/bevy_pbr/src/light.rs @@ -40,8 +40,8 @@ use crate::{ /// | 4000 | 300 | | 75-100 | 40.5 | /// /// Source: [Wikipedia](https://en.wikipedia.org/wiki/Lumen_(unit)#Lighting) -#[derive(Component, Debug, Clone, Copy, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Clone, Copy, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct PointLight { pub color: Color, pub intensity: f32, @@ -75,8 +75,8 @@ impl PointLight { pub const DEFAULT_SHADOW_NORMAL_BIAS: f32 = 0.6; } -#[derive(Resource, Clone, Debug, Reflect)] -#[reflect(Resource)] +#[derive(Resource, Clone, Debug, Reflect, FromReflect)] +#[reflect(Resource, FromReflect)] pub struct PointLightShadowMap { pub size: usize, } @@ -91,8 +91,8 @@ impl Default for PointLightShadowMap { /// Behaves like a point light in a perfectly absorbent housing that /// shines light only in a given direction. The direction is taken from /// the transform, and can be specified with [`Transform::looking_at`](bevy_transform::components::Transform::looking_at). -#[derive(Component, Debug, Clone, Copy, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Clone, Copy, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct SpotLight { pub color: Color, pub intensity: f32, @@ -187,8 +187,8 @@ impl Default for SpotLight { /// App::new() /// .insert_resource(DirectionalLightShadowMap { size: 2048 }); /// ``` -#[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Clone, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct DirectionalLight { pub color: Color, /// Illuminance in lux @@ -218,8 +218,8 @@ impl DirectionalLight { } /// Controls the resolution of [`DirectionalLight`] shadow maps. -#[derive(Resource, Clone, Debug, Reflect)] -#[reflect(Resource)] +#[derive(Resource, Clone, Debug, Reflect, FromReflect)] +#[reflect(Resource, FromReflect)] pub struct DirectionalLightShadowMap { pub size: usize, } @@ -243,8 +243,8 @@ impl Default for DirectionalLightShadowMap { /// ..default() /// }.into(); /// ``` -#[derive(Component, Clone, Debug, Reflect)] -#[reflect(Component)] +#[derive(Component, Clone, Debug, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct CascadeShadowConfig { /// The (positive) distance to the far boundary of each cascade. pub bounds: Vec, @@ -380,14 +380,15 @@ impl From for CascadeShadowConfig { } } -#[derive(Component, Clone, Debug, Default, Reflect)] -#[reflect(Component)] +#[derive(Component, Clone, Debug, Default, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct Cascades { /// Map from a view to the configuration of each of its [`Cascade`]s. pub(crate) cascades: HashMap>, } #[derive(Clone, Debug, Default, Reflect, FromReflect)] +#[reflect(FromReflect)] pub struct Cascade { /// The transform of the light, i.e. the view to world matrix. pub(crate) view_transform: Mat4, @@ -580,8 +581,8 @@ fn calculate_cascade( } /// An ambient light, which lights the entire scene equally. -#[derive(Resource, Clone, Debug, ExtractResource, Reflect)] -#[reflect(Resource)] +#[derive(Resource, Clone, Debug, ExtractResource, Reflect, FromReflect)] +#[reflect(Resource, FromReflect)] pub struct AmbientLight { pub color: Color, /// A direct scale factor multiplied with `color` before being passed to the shader. @@ -598,12 +599,12 @@ impl Default for AmbientLight { } /// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) not cast shadows. -#[derive(Component, Reflect, Default)] -#[reflect(Component, Default)] +#[derive(Component, Reflect, FromReflect, Default)] +#[reflect(Component, Default, FromReflect)] pub struct NotShadowCaster; /// Add this component to make a [`Mesh`](bevy_render::mesh::Mesh) not receive shadows. -#[derive(Component, Reflect, Default)] -#[reflect(Component, Default)] +#[derive(Component, Reflect, FromReflect, Default)] +#[reflect(Component, Default, FromReflect)] pub struct NotShadowReceiver; #[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)] @@ -640,7 +641,7 @@ pub enum ClusterFarZMode { /// Configure the depth-slicing strategy for clustered forward rendering #[derive(Debug, Copy, Clone, Reflect, FromReflect)] -#[reflect(Default)] +#[reflect(Default, FromReflect)] pub struct ClusterZConfig { /// Far `Z` plane of the first depth slice pub first_slice_depth: f32, @@ -658,8 +659,8 @@ impl Default for ClusterZConfig { } /// Configuration of the clustering strategy for clustered forward rendering -#[derive(Debug, Copy, Clone, Component, Reflect)] -#[reflect(Component)] +#[derive(Debug, Copy, Clone, Component, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub enum ClusterConfig { /// Disable light cluster calculations for this view None, diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index 1eadd479af..e5b8cb6c01 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -4,7 +4,9 @@ use crate::{ }; use bevy_asset::Handle; use bevy_math::Vec4; -use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, TypeUuid}; +use bevy_reflect::{ + std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect, TypeUuid, +}; use bevy_render::{ color::Color, mesh::MeshVertexBufferLayout, render_asset::RenderAssets, render_resource::*, texture::Image, @@ -19,7 +21,7 @@ use bevy_render::{ #[uuid = "7494888b-c082-457b-aacf-517228cc0c22"] #[bind_group_data(StandardMaterialKey)] #[uniform(0, StandardMaterialUniform)] -#[reflect(Default, Debug)] +#[reflect(Default, Debug, FromReflect)] pub struct StandardMaterial { /// The color of the surface of the material before lighting. /// diff --git a/crates/bevy_pbr/src/wireframe.rs b/crates/bevy_pbr/src/wireframe.rs index dfdac19b9c..d31590c78e 100644 --- a/crates/bevy_pbr/src/wireframe.rs +++ b/crates/bevy_pbr/src/wireframe.rs @@ -5,7 +5,7 @@ use bevy_asset::{load_internal_asset, Handle, HandleUntyped}; use bevy_core_pipeline::core_3d::Opaque3d; use bevy_ecs::{prelude::*, reflect::ReflectComponent}; use bevy_reflect::std_traits::ReflectDefault; -use bevy_reflect::{Reflect, TypeUuid}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect, TypeUuid}; use bevy_render::extract_component::{ExtractComponent, ExtractComponentPlugin}; use bevy_render::Render; use bevy_render::{ @@ -59,12 +59,12 @@ impl Plugin for WireframePlugin { } /// Controls whether an entity should rendered in wireframe-mode if the [`WireframePlugin`] is enabled -#[derive(Component, Debug, Clone, Default, ExtractComponent, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Clone, Default, ExtractComponent, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct Wireframe; -#[derive(Resource, Debug, Clone, Default, ExtractResource, Reflect)] -#[reflect(Resource)] +#[derive(Resource, Debug, Clone, Default, ExtractResource, Reflect, FromReflect)] +#[reflect(Resource, FromReflect)] pub struct WireframeConfig { /// Whether to show wireframes for all meshes. If `false`, only meshes with a [Wireframe] component will be rendered. pub global: bool, diff --git a/crates/bevy_render/src/camera/camera.rs b/crates/bevy_render/src/camera/camera.rs index 06ebf4ac93..b5a047566d 100644 --- a/crates/bevy_render/src/camera/camera.rs +++ b/crates/bevy_render/src/camera/camera.rs @@ -377,7 +377,8 @@ impl CameraRenderGraph { /// The "target" that a [`Camera`] will render to. For example, this could be a [`Window`](bevy_window::Window) /// swapchain or an [`Image`]. -#[derive(Debug, Clone, Reflect)] +#[derive(Debug, Clone, Reflect, FromReflect)] +#[reflect(FromReflect)] pub enum RenderTarget { /// Window to which the camera's view is rendered. Window(WindowRef), diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index ad3731be45..e134df9b42 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -5,7 +5,7 @@ use bevy_ecs::{prelude::*, reflect::ReflectComponent}; use bevy_math::{Mat4, Rect, Vec2}; use bevy_reflect::{ std_traits::ReflectDefault, FromReflect, GetTypeRegistration, Reflect, ReflectDeserialize, - ReflectSerialize, + ReflectFromReflect, ReflectSerialize, }; use serde::{Deserialize, Serialize}; @@ -62,8 +62,8 @@ pub trait CameraProjection { } /// A configurable [`CameraProjection`] that can select its projection type at runtime. -#[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Clone, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub enum Projection { Perspective(PerspectiveProjection), Orthographic(OrthographicProjection), diff --git a/crates/bevy_render/src/mesh/mesh/skinning.rs b/crates/bevy_render/src/mesh/mesh/skinning.rs index 20df623c5a..f91cb45f8e 100644 --- a/crates/bevy_render/src/mesh/mesh/skinning.rs +++ b/crates/bevy_render/src/mesh/mesh/skinning.rs @@ -6,11 +6,11 @@ use bevy_ecs::{ reflect::ReflectMapEntities, }; use bevy_math::Mat4; -use bevy_reflect::{Reflect, TypePath, TypeUuid}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect, TypePath, TypeUuid}; use std::ops::Deref; -#[derive(Component, Debug, Default, Clone, Reflect)] -#[reflect(Component, MapEntities)] +#[derive(Component, Debug, Default, Clone, Reflect, FromReflect)] +#[reflect(Component, MapEntities, FromReflect)] pub struct SkinnedMesh { pub inverse_bindposes: Handle, pub joints: Vec, diff --git a/crates/bevy_render/src/primitives/mod.rs b/crates/bevy_render/src/primitives/mod.rs index 5beee4936d..75fdd88d6d 100644 --- a/crates/bevy_render/src/primitives/mod.rs +++ b/crates/bevy_render/src/primitives/mod.rs @@ -1,6 +1,6 @@ use bevy_ecs::{component::Component, prelude::Entity, reflect::ReflectComponent}; use bevy_math::{Mat4, Vec3, Vec3A, Vec4, Vec4Swizzles}; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_utils::HashMap; /// An axis-aligned bounding box. @@ -126,8 +126,8 @@ impl HalfSpace { /// A frustum made up of the 6 defining half spaces. /// Half spaces are ordered left, right, top, bottom, near, far. /// The normal vectors of the half spaces point towards the interior of the frustum. -#[derive(Component, Clone, Copy, Debug, Default, Reflect)] -#[reflect(Component)] +#[derive(Component, Clone, Copy, Debug, Default, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct Frustum { #[reflect(ignore)] pub half_spaces: [HalfSpace; 6], @@ -223,8 +223,8 @@ impl Frustum { } } -#[derive(Component, Debug, Default, Reflect)] -#[reflect(Component)] +#[derive(Component, Debug, Default, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct CubemapFrusta { #[reflect(ignore)] pub frusta: [Frustum; 6], @@ -239,8 +239,8 @@ impl CubemapFrusta { } } -#[derive(Component, Debug, Default, Reflect)] -#[reflect(Component)] +#[derive(Component, Debug, Default, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct CascadesFrusta { #[reflect(ignore)] pub frusta: HashMap>, diff --git a/crates/bevy_render/src/view/visibility/mod.rs b/crates/bevy_render/src/view/visibility/mod.rs index 4ea61f2fcd..4c72a5abb5 100644 --- a/crates/bevy_render/src/view/visibility/mod.rs +++ b/crates/bevy_render/src/view/visibility/mod.rs @@ -171,8 +171,8 @@ pub struct NoFrustumCulling; /// /// Currently this component is ignored by the sprite renderer, so sprite rendering /// is not optimized per view. -#[derive(Clone, Component, Default, Debug, Reflect)] -#[reflect(Component)] +#[derive(Clone, Component, Default, Debug, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct VisibleEntities { #[reflect(ignore)] pub entities: Vec, diff --git a/crates/bevy_sprite/src/mesh2d/mesh.rs b/crates/bevy_sprite/src/mesh2d/mesh.rs index 6e1ab779cc..7161141525 100644 --- a/crates/bevy_sprite/src/mesh2d/mesh.rs +++ b/crates/bevy_sprite/src/mesh2d/mesh.rs @@ -7,7 +7,7 @@ use bevy_ecs::{ system::{lifetimeless::*, SystemParamItem, SystemState}, }; use bevy_math::{Mat4, Vec2}; -use bevy_reflect::{Reflect, TypeUuid}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect, TypeUuid}; use bevy_render::{ extract_component::{ComponentUniforms, DynamicUniformIndex, UniformComponentPlugin}, globals::{GlobalsBuffer, GlobalsUniform}, @@ -29,8 +29,8 @@ use bevy_transform::components::GlobalTransform; /// Component for rendering with meshes in the 2d pipeline, usually with a [2d material](crate::Material2d) such as [`ColorMaterial`](crate::ColorMaterial). /// /// It wraps a [`Handle`] to differentiate from the 3d pipelines which use the handles directly as components -#[derive(Default, Clone, Component, Debug, Reflect)] -#[reflect(Component)] +#[derive(Default, Clone, Component, Debug, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct Mesh2dHandle(pub Handle); impl From> for Mesh2dHandle { diff --git a/crates/bevy_text/src/text2d.rs b/crates/bevy_text/src/text2d.rs index a17a1c6709..0cee62291d 100644 --- a/crates/bevy_text/src/text2d.rs +++ b/crates/bevy_text/src/text2d.rs @@ -10,7 +10,7 @@ use bevy_ecs::{ system::{Local, Query, Res, ResMut}, }; use bevy_math::{Vec2, Vec3}; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use bevy_render::{ prelude::Color, texture::Image, @@ -34,8 +34,8 @@ use crate::{ /// Note: only characters that are completely out of the bounds will be truncated, so this is not a /// 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)] +#[derive(Component, Copy, Clone, Debug, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct Text2dBounds { pub size: Vec2, } diff --git a/crates/bevy_transform/src/components/global_transform.rs b/crates/bevy_transform/src/components/global_transform.rs index a4379419b3..c9aa20cec5 100644 --- a/crates/bevy_transform/src/components/global_transform.rs +++ b/crates/bevy_transform/src/components/global_transform.rs @@ -3,7 +3,7 @@ use std::ops::Mul; use super::Transform; use bevy_ecs::{component::Component, reflect::ReflectComponent}; use bevy_math::{Affine3A, Mat4, Quat, Vec3, Vec3A}; -use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect}; +use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect}; /// Describe the position of an entity relative to the reference frame. /// @@ -35,7 +35,7 @@ use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect}; /// [`transform`]: https://github.com/bevyengine/bevy/blob/latest/examples/transforms/transform.rs #[derive(Component, Debug, PartialEq, Clone, Copy, Reflect, FromReflect)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[reflect(Component, Default, PartialEq)] +#[reflect(Component, Default, PartialEq, FromReflect)] pub struct GlobalTransform(Affine3A); macro_rules! impl_local_axis { diff --git a/crates/bevy_transform/src/components/transform.rs b/crates/bevy_transform/src/components/transform.rs index dd0eeba45f..d7161c5427 100644 --- a/crates/bevy_transform/src/components/transform.rs +++ b/crates/bevy_transform/src/components/transform.rs @@ -37,7 +37,7 @@ use std::ops::Mul; /// [`Transform`]: super::Transform #[derive(Component, Debug, PartialEq, Clone, Copy, Reflect, FromReflect)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] -#[reflect(Component, Default, PartialEq)] +#[reflect(Component, Default, PartialEq, FromReflect)] pub struct Transform { /// Position of the entity. In 2d, the last value of the `Vec3` is used for z-ordering. /// diff --git a/crates/bevy_ui/src/measurement.rs b/crates/bevy_ui/src/measurement.rs index cdb89e7152..8c5959f27e 100644 --- a/crates/bevy_ui/src/measurement.rs +++ b/crates/bevy_ui/src/measurement.rs @@ -1,7 +1,7 @@ use bevy_ecs::prelude::Component; use bevy_ecs::reflect::ReflectComponent; use bevy_math::Vec2; -use bevy_reflect::Reflect; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; use std::fmt::Formatter; pub use taffy::style::AvailableSpace; @@ -45,8 +45,8 @@ impl Measure for FixedMeasure { /// A node with a `ContentSize` component is a node where its size /// is based on its content. -#[derive(Component, Reflect)] -#[reflect(Component)] +#[derive(Component, Reflect, FromReflect)] +#[reflect(Component, FromReflect)] pub struct ContentSize { /// The `Measure` used to compute the intrinsic size #[reflect(ignore)] diff --git a/crates/bevy_ui/src/ui_node.rs b/crates/bevy_ui/src/ui_node.rs index f6c9fb55a0..e71782bb9c 100644 --- a/crates/bevy_ui/src/ui_node.rs +++ b/crates/bevy_ui/src/ui_node.rs @@ -15,8 +15,8 @@ use std::ops::{Div, DivAssign, Mul, MulAssign}; use thiserror::Error; /// Describes the size of a UI node -#[derive(Component, Debug, Copy, Clone, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Copy, Clone, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct Node { /// The size of the node as width and height in logical pixels /// automatically calculated by [`super::layout::ui_layout_system`] @@ -1585,8 +1585,8 @@ impl Default for BorderColor { } /// The 2D texture displayed for this UI node -#[derive(Component, Clone, Debug, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Clone, Debug, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct UiImage { /// Handle to the texture pub texture: Handle, diff --git a/crates/bevy_ui/src/widget/text.rs b/crates/bevy_ui/src/widget/text.rs index c56ae98bc5..25ada49e9a 100644 --- a/crates/bevy_ui/src/widget/text.rs +++ b/crates/bevy_ui/src/widget/text.rs @@ -8,7 +8,7 @@ use bevy_ecs::{ world::{Mut, Ref}, }; use bevy_math::Vec2; -use bevy_reflect::{std_traits::ReflectDefault, Reflect}; +use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect}; use bevy_render::texture::Image; use bevy_sprite::TextureAtlas; use bevy_text::{ @@ -21,8 +21,8 @@ use taffy::style::AvailableSpace; /// Text system flags /// /// Used internally by [`measure_text_system`] and [`text_system`] to schedule text for processing. -#[derive(Component, Debug, Clone, Reflect)] -#[reflect(Component, Default)] +#[derive(Component, Debug, Clone, Reflect, FromReflect)] +#[reflect(Component, Default, FromReflect)] pub struct TextFlags { /// If set a new measure function for the text node will be created needs_new_measure_func: bool, diff --git a/crates/bevy_window/src/cursor.rs b/crates/bevy_window/src/cursor.rs index 17e4dce56b..2bc4f34f70 100644 --- a/crates/bevy_window/src/cursor.rs +++ b/crates/bevy_window/src/cursor.rs @@ -1,4 +1,4 @@ -use bevy_reflect::{prelude::ReflectDefault, FromReflect, Reflect}; +use bevy_reflect::{prelude::ReflectDefault, FromReflect, Reflect, ReflectFromReflect}; #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; @@ -14,7 +14,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Default)] +#[reflect(Debug, PartialEq, Default, FromReflect)] pub enum CursorIcon { /// The platform-dependent default cursor. #[default] diff --git a/crates/bevy_window/src/event.rs b/crates/bevy_window/src/event.rs index 94f8be6b60..ee47f34151 100644 --- a/crates/bevy_window/src/event.rs +++ b/crates/bevy_window/src/event.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use bevy_ecs::entity::Entity; use bevy_ecs::event::Event; use bevy_math::{IVec2, Vec2}; -use bevy_reflect::{FromReflect, Reflect}; +use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; @@ -12,7 +12,7 @@ use crate::WindowTheme; /// A window event that is sent whenever a window's logical size has changed. #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -30,7 +30,7 @@ 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, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -42,7 +42,7 @@ pub struct RequestRedraw; /// /// To create a new window, spawn an entity with a [`crate::Window`] on it. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -64,7 +64,7 @@ pub struct WindowCreated { /// [`WindowPlugin`]: crate::WindowPlugin /// [`Window`]: crate::Window #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -78,7 +78,7 @@ 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, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -101,7 +101,7 @@ pub struct WindowClosed { /// [`WindowEvent::CursorMoved`]: https://docs.rs/winit/latest/winit/event/enum.WindowEvent.html#variant.CursorMoved /// [`MouseMotion`]: bevy_input::mouse::MouseMotion #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -116,7 +116,7 @@ pub struct CursorMoved { /// An event that is sent whenever the user's cursor enters a window. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -129,7 +129,7 @@ pub struct CursorEntered { /// An event that is sent whenever the user's cursor leaves a window. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -142,7 +142,7 @@ pub struct CursorLeft { /// An event that is sent whenever a window receives a character from the OS or underlying system. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -161,7 +161,7 @@ pub struct ReceivedCharacter { /// /// 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, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -203,7 +203,7 @@ pub enum Ime { /// An event that indicates a window has received or lost focus. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -218,7 +218,7 @@ pub struct WindowFocused { /// An event that indicates a window's scale factor has changed. #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -233,7 +233,7 @@ pub struct WindowScaleFactorChanged { /// An event that indicates a window's OS-reported scale factor has changed. #[derive(Event, Debug, Clone, PartialEq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -248,7 +248,7 @@ pub struct WindowBackendScaleFactorChanged { /// Events related to files being dragged and dropped on a window. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -280,7 +280,7 @@ pub enum FileDragAndDrop { /// An event that is sent when a window is repositioned in physical pixels. #[derive(Event, Debug, Clone, PartialEq, Eq, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), @@ -298,7 +298,7 @@ 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, Reflect, FromReflect)] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] #[cfg_attr( feature = "serialize", derive(serde::Serialize, serde::Deserialize), diff --git a/crates/bevy_window/src/window.rs b/crates/bevy_window/src/window.rs index b027a4f096..40f661b38c 100644 --- a/crates/bevy_window/src/window.rs +++ b/crates/bevy_window/src/window.rs @@ -3,7 +3,7 @@ use bevy_ecs::{ prelude::{Component, ReflectComponent}, }; use bevy_math::{DVec2, IVec2, Vec2}; -use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect}; +use bevy_reflect::{std_traits::ReflectDefault, FromReflect, Reflect, ReflectFromReflect}; #[cfg(feature = "serialize")] use bevy_reflect::{ReflectDeserialize, ReflectSerialize}; @@ -15,8 +15,10 @@ use crate::CursorIcon; /// Marker component for the window considered the primary window. /// /// Currently this is assumed to only exist on 1 entity at a time. -#[derive(Default, Debug, Component, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Reflect)] -#[reflect(Component)] +#[derive( + Default, Debug, Component, PartialEq, Eq, PartialOrd, Ord, Copy, Clone, Reflect, FromReflect, +)] +#[reflect(Component, FromReflect)] pub struct PrimaryWindow; /// Reference to a window, whether it be a direct link to a specific entity or @@ -91,7 +93,7 @@ impl NormalizedWindowRef { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Component, Default)] +#[reflect(Component, Default, FromReflect)] pub struct Window { /// The cursor of this window. pub cursor: Cursor, @@ -307,7 +309,7 @@ impl Window { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Default)] +#[reflect(Debug, PartialEq, Default, FromReflect)] pub struct WindowResizeConstraints { /// The minimum width the window can have. pub min_width: f32, @@ -374,7 +376,7 @@ impl WindowResizeConstraints { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, Default)] +#[reflect(Debug, Default, FromReflect)] pub struct Cursor { /// Get the current [`CursorIcon`] while inside the window. pub icon: CursorIcon, @@ -426,7 +428,7 @@ impl Default for Cursor { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] pub enum WindowPosition { /// Position will be set by the window manager #[default] @@ -477,7 +479,7 @@ impl WindowPosition { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Default)] +#[reflect(Debug, PartialEq, Default, FromReflect)] pub struct WindowResolution { physical_width: u32, physical_height: u32, @@ -641,7 +643,7 @@ impl From for WindowResolution { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Default)] +#[reflect(Debug, PartialEq, Default, FromReflect)] pub enum CursorGrabMode { /// The cursor can freely leave the window. #[default] @@ -659,7 +661,7 @@ pub enum CursorGrabMode { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Default)] +#[reflect(Debug, PartialEq, Default, FromReflect)] pub struct InternalWindowState { /// If this is true then next frame we will ask to minimize the window. minimize_request: Option, @@ -688,7 +690,7 @@ impl InternalWindowState { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] pub enum MonitorSelection { /// Uses current monitor of the window. /// @@ -726,7 +728,7 @@ pub enum MonitorSelection { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Hash)] +#[reflect(Debug, PartialEq, Hash, FromReflect)] #[doc(alias = "vsync")] pub enum PresentMode { /// Chooses FifoRelaxed -> Fifo based on availability. @@ -766,7 +768,7 @@ pub enum PresentMode { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq, Hash)] +#[reflect(Debug, PartialEq, Hash, FromReflect)] pub enum CompositeAlphaMode { /// Chooses either [`Opaque`](CompositeAlphaMode::Opaque) or [`Inherit`](CompositeAlphaMode::Inherit) /// automatically, depending on the `alpha_mode` that the current surface can support. @@ -801,7 +803,7 @@ pub enum CompositeAlphaMode { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] pub enum WindowMode { /// Creates a window that uses the given size. #[default] @@ -829,7 +831,7 @@ pub enum WindowMode { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] pub enum WindowLevel { /// The window will always be below normal windows. /// @@ -849,7 +851,7 @@ pub enum WindowLevel { derive(serde::Serialize, serde::Deserialize), reflect(Serialize, Deserialize) )] -#[reflect(Debug, PartialEq)] +#[reflect(Debug, PartialEq, FromReflect)] pub enum WindowTheme { /// Use the light variant. Light,