mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
Reflect TextLayout and ComputedTextBlock (#16296)
# Objective - Fix panic when saving/loading scenes with text nodes due to missing Reflect implementations.
This commit is contained in:
parent
56a002b693
commit
5cbc2a9018
2 changed files with 7 additions and 2 deletions
|
@ -116,6 +116,8 @@ impl Plugin for TextPlugin {
|
|||
.register_type::<TextColor>()
|
||||
.register_type::<TextSpan>()
|
||||
.register_type::<TextBounds>()
|
||||
.register_type::<TextLayout>()
|
||||
.register_type::<ComputedTextBlock>()
|
||||
.init_asset_loader::<FontLoader>()
|
||||
.init_resource::<FontAtlasSets>()
|
||||
.init_resource::<TextPipeline>()
|
||||
|
|
|
@ -28,7 +28,8 @@ impl Default for CosmicBuffer {
|
|||
/// A sub-entity of a [`ComputedTextBlock`].
|
||||
///
|
||||
/// Returned by [`ComputedTextBlock::entities`].
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Debug, Copy, Clone, Reflect)]
|
||||
#[reflect(Debug)]
|
||||
pub struct TextEntity {
|
||||
/// The entity.
|
||||
pub entity: Entity,
|
||||
|
@ -41,7 +42,8 @@ pub struct TextEntity {
|
|||
/// See [`TextLayout`].
|
||||
///
|
||||
/// Automatically updated by 2d and UI text systems.
|
||||
#[derive(Component, Debug, Clone)]
|
||||
#[derive(Component, Debug, Clone, Reflect)]
|
||||
#[reflect(Component, Debug, Default)]
|
||||
pub struct ComputedTextBlock {
|
||||
/// Buffer for managing text layout and creating [`TextLayoutInfo`].
|
||||
///
|
||||
|
@ -49,6 +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)]
|
||||
pub(crate) buffer: CosmicBuffer,
|
||||
/// Entities for all text spans in the block, including the root-level text.
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue