Reflect derived traits on all components and resources: bevy_text (#15229)

Solves https://github.com/bevyengine/bevy/issues/15187 for bevy_text
This commit is contained in:
Blazepaws 2024-09-15 19:21:02 +02:00 committed by GitHub
parent b38cc9e7b0
commit 1c2e1fc15a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -1,5 +1,6 @@
use bevy_ecs::{component::Component, reflect::ReflectComponent}; use bevy_ecs::{component::Component, reflect::ReflectComponent};
use bevy_math::Vec2; use bevy_math::Vec2;
use bevy_reflect::std_traits::ReflectDefault;
use bevy_reflect::Reflect; use bevy_reflect::Reflect;
/// The maximum width and height of text. The text will wrap according to the specified size. /// The maximum width and height of text. The text will wrap according to the specified size.
@ -10,7 +11,7 @@ use bevy_reflect::Reflect;
/// reliable limit if it is necessary to contain the text strictly in the bounds. Currently this /// reliable limit if it is necessary to contain the text strictly in the bounds. Currently this
/// component is mainly useful for text wrapping only. /// component is mainly useful for text wrapping only.
#[derive(Component, Copy, Clone, Debug, Reflect)] #[derive(Component, Copy, Clone, Debug, Reflect)]
#[reflect(Component)] #[reflect(Component, Default, Debug)]
pub struct TextBounds { pub struct TextBounds {
/// The maximum width of text in logical pixels. /// The maximum width of text in logical pixels.
/// If `None`, the width is unbounded. /// If `None`, the width is unbounded.

View file

@ -312,7 +312,7 @@ impl TextPipeline {
/// ///
/// Contains scaled glyphs and their size. Generated via [`TextPipeline::queue_text`]. /// Contains scaled glyphs and their size. Generated via [`TextPipeline::queue_text`].
#[derive(Component, Clone, Default, Debug, Reflect)] #[derive(Component, Clone, Default, Debug, Reflect)]
#[reflect(Component, Default)] #[reflect(Component, Default, Debug)]
pub struct TextLayoutInfo { pub struct TextLayoutInfo {
/// Scaled and positioned glyphs in screenspace /// Scaled and positioned glyphs in screenspace
pub glyphs: Vec<PositionedGlyph>, pub glyphs: Vec<PositionedGlyph>,

View file

@ -27,7 +27,7 @@ impl Default for CosmicBuffer {
/// ///
/// It contains all of the text value and styling information. /// It contains all of the text value and styling information.
#[derive(Component, Debug, Clone, Default, Reflect)] #[derive(Component, Debug, Clone, Default, Reflect)]
#[reflect(Component, Default)] #[reflect(Component, Default, Debug)]
pub struct Text { pub struct Text {
/// The text's sections /// The text's sections
pub sections: Vec<TextSection>, pub sections: Vec<TextSection>,