Made the remaining types from bevy_ui to reflect the Default trait if… (#11199)
# Objective - Fixes https://github.com/bevyengine/bevy/issues/11197 ## Solution - Made the remaining types from bevy_ui that do not reflect the Default trait to do it if possible.
This commit is contained in:
parent
41c362051c
commit
3f535d54eb
@ -9,7 +9,7 @@ use bevy_ecs::{
|
|||||||
};
|
};
|
||||||
use bevy_input::{mouse::MouseButton, touch::Touches, ButtonInput};
|
use bevy_input::{mouse::MouseButton, touch::Touches, ButtonInput};
|
||||||
use bevy_math::{Rect, Vec2};
|
use bevy_math::{Rect, Vec2};
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::{std_traits::ReflectDefault, Reflect};
|
||||||
use bevy_render::{camera::NormalizedRenderTarget, prelude::Camera, view::ViewVisibility};
|
use bevy_render::{camera::NormalizedRenderTarget, prelude::Camera, view::ViewVisibility};
|
||||||
use bevy_transform::components::GlobalTransform;
|
use bevy_transform::components::GlobalTransform;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
|||||||
/// Note that you can also control the visibility of a node using the [`Display`](crate::ui_node::Display) property,
|
/// Note that you can also control the visibility of a node using the [`Display`](crate::ui_node::Display) property,
|
||||||
/// which fully collapses it during layout calculations.
|
/// which fully collapses it during layout calculations.
|
||||||
#[derive(Component, Copy, Clone, Eq, PartialEq, Debug, Reflect)]
|
#[derive(Component, Copy, Clone, Eq, PartialEq, Debug, Reflect)]
|
||||||
#[reflect(Component, PartialEq)]
|
#[reflect(Component, Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -67,7 +67,7 @@ impl Default for Interaction {
|
|||||||
///
|
///
|
||||||
/// It can be used alongside interaction to get the position of the press.
|
/// It can be used alongside interaction to get the position of the press.
|
||||||
#[derive(Component, Copy, Clone, Default, PartialEq, Debug, Reflect)]
|
#[derive(Component, Copy, Clone, Default, PartialEq, Debug, Reflect)]
|
||||||
#[reflect(Component, PartialEq)]
|
#[reflect(Component, Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -92,7 +92,7 @@ impl RelativeCursorPosition {
|
|||||||
|
|
||||||
/// Describes whether the node should block interactions with lower nodes
|
/// Describes whether the node should block interactions with lower nodes
|
||||||
#[derive(Component, Copy, Clone, Eq, PartialEq, Debug, Reflect)]
|
#[derive(Component, Copy, Clone, Eq, PartialEq, Debug, Reflect)]
|
||||||
#[reflect(Component, PartialEq)]
|
#[reflect(Component, Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
use bevy_math::Vec2;
|
use bevy_math::Vec2;
|
||||||
|
use bevy_reflect::std_traits::ReflectDefault;
|
||||||
use bevy_reflect::Reflect;
|
use bevy_reflect::Reflect;
|
||||||
use std::ops::Neg;
|
use std::ops::Neg;
|
||||||
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
use std::ops::{Div, DivAssign, Mul, MulAssign};
|
||||||
@ -11,8 +12,9 @@ use bevy_reflect::{ReflectDeserialize, ReflectSerialize};
|
|||||||
///
|
///
|
||||||
/// This enum allows specifying values for various [`Style`](crate::Style) properties in different units,
|
/// This enum allows specifying values for various [`Style`](crate::Style) properties in different units,
|
||||||
/// such as logical pixels, percentages, or automatically determined values.
|
/// such as logical pixels, percentages, or automatically determined values.
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Reflect)]
|
#[derive(Copy, Clone, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -245,8 +247,9 @@ impl Val {
|
|||||||
/// bottom: Val::Px(40.0),
|
/// bottom: Val::Px(40.0),
|
||||||
/// };
|
/// };
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
|
|||||||
@ -469,7 +469,7 @@ impl Default for Style {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/align-items>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/align-items>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -512,7 +512,7 @@ impl Default for AlignItems {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -549,7 +549,7 @@ impl Default for JustifyItems {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/align-self>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/align-self>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -592,7 +592,7 @@ impl Default for AlignSelf {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -629,7 +629,7 @@ impl Default for JustifySelf {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/align-content>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/align-content>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -676,7 +676,7 @@ impl Default for AlignContent {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -721,7 +721,7 @@ impl Default for JustifyContent {
|
|||||||
///
|
///
|
||||||
/// For example, English is written LTR (left-to-right) while Arabic is written RTL (right-to-left).
|
/// For example, English is written LTR (left-to-right) while Arabic is written RTL (right-to-left).
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -750,7 +750,7 @@ impl Default for Direction {
|
|||||||
///
|
///
|
||||||
/// Part of the [`Style`] component.
|
/// Part of the [`Style`] component.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -780,7 +780,7 @@ impl Default for Display {
|
|||||||
|
|
||||||
/// Defines how flexbox items are ordered within a flexbox
|
/// Defines how flexbox items are ordered within a flexbox
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -809,7 +809,7 @@ impl Default for FlexDirection {
|
|||||||
|
|
||||||
/// Whether to show or hide overflowing items
|
/// Whether to show or hide overflowing items
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -874,7 +874,7 @@ impl Default for Overflow {
|
|||||||
|
|
||||||
/// Whether to show or hide overflowing items
|
/// Whether to show or hide overflowing items
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -904,7 +904,7 @@ impl Default for OverflowAxis {
|
|||||||
|
|
||||||
/// The strategy used to position this node
|
/// The strategy used to position this node
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -929,7 +929,7 @@ impl Default for PositionType {
|
|||||||
|
|
||||||
/// Defines if flexbox items appear on a single line or on multiple lines
|
/// Defines if flexbox items appear on a single line or on multiple lines
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -963,7 +963,7 @@ impl Default for FlexWrap {
|
|||||||
///
|
///
|
||||||
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow>
|
/// <https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow>
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -1042,7 +1042,7 @@ pub enum MaxTrackSizingFunction {
|
|||||||
/// A [`GridTrack`] is a Row or Column of a CSS Grid. This struct specifies what size the track should be.
|
/// 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.
|
/// See below for the different "track sizing functions" you can specify.
|
||||||
#[derive(Copy, Clone, PartialEq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -1375,7 +1375,7 @@ impl From<RepeatedGridTrack> for Vec<RepeatedGridTrack> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
#[derive(Copy, Clone, PartialEq, Eq, Debug, Reflect)]
|
||||||
#[reflect(PartialEq)]
|
#[reflect(Default, PartialEq)]
|
||||||
#[cfg_attr(
|
#[cfg_attr(
|
||||||
feature = "serialize",
|
feature = "serialize",
|
||||||
derive(serde::Serialize, serde::Deserialize),
|
derive(serde::Serialize, serde::Deserialize),
|
||||||
@ -1768,7 +1768,7 @@ impl From<Handle<Image>> for UiImage {
|
|||||||
|
|
||||||
/// The calculated clip of the node
|
/// The calculated clip of the node
|
||||||
#[derive(Component, Default, Copy, Clone, Debug, Reflect)]
|
#[derive(Component, Default, Copy, Clone, Debug, Reflect)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component, Default)]
|
||||||
pub struct CalculatedClip {
|
pub struct CalculatedClip {
|
||||||
/// The rect of the clip
|
/// The rect of the clip
|
||||||
pub clip: Rect,
|
pub clip: Rect,
|
||||||
@ -1788,7 +1788,7 @@ pub struct CalculatedClip {
|
|||||||
///
|
///
|
||||||
/// Nodes without this component will be treated as if they had a value of `ZIndex::Local(0)`.
|
/// Nodes without this component will be treated as if they had a value of `ZIndex::Local(0)`.
|
||||||
#[derive(Component, Copy, Clone, Debug, Reflect)]
|
#[derive(Component, Copy, Clone, Debug, Reflect)]
|
||||||
#[reflect(Component)]
|
#[reflect(Component, Default)]
|
||||||
pub enum ZIndex {
|
pub enum ZIndex {
|
||||||
/// Indicates the order in which this node should be rendered relative to its siblings.
|
/// Indicates the order in which this node should be rendered relative to its siblings.
|
||||||
Local(i32),
|
Local(i32),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user