forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bevy_ui: Add
FromReflect
derives (bevyengine#8495)
# Objective A lot of items in `bevy_ui` could be `FromReflect` but aren't. This prevents users and library authors from being able to convert from a `dyn Reflect` to one of these items. ## Solution Derive `FromReflect` where possible. Also register the `ReflectFromReflect` type data.
- Loading branch information
Showing
6 changed files
with
74 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
use bevy_ecs::prelude::Component; | ||
use bevy_ecs::reflect::ReflectComponent; | ||
use bevy_reflect::std_traits::ReflectDefault; | ||
use bevy_reflect::Reflect; | ||
use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; | ||
|
||
/// Marker struct for buttons | ||
#[derive(Component, Debug, Default, Clone, Copy, Reflect)] | ||
#[reflect(Component, Default)] | ||
#[derive(Component, Debug, Default, Clone, Copy, Reflect, FromReflect)] | ||
#[reflect(Component, FromReflect, Default)] | ||
pub struct Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
use bevy_ecs::prelude::Component; | ||
use bevy_ecs::reflect::ReflectComponent; | ||
use bevy_reflect::std_traits::ReflectDefault; | ||
use bevy_reflect::Reflect; | ||
use bevy_reflect::{FromReflect, Reflect, ReflectFromReflect}; | ||
|
||
/// Marker struct for labels | ||
#[derive(Component, Debug, Default, Clone, Copy, Reflect)] | ||
#[reflect(Component, Default)] | ||
#[derive(Component, Debug, Default, Clone, Copy, Reflect, FromReflect)] | ||
#[reflect(Component, FromReflect, Default)] | ||
pub struct Label; |