Skip to content

Conversation

@InnocentusLime
Copy link
Contributor

Objective

Fixes #8415.

Solution

I simply added the missing types to the type registry.

Changelog

Added #[reflect(Component] to bevi_ui::ui_node::ZIndex, since it impls Component and Reflect.

The following types have been added to the type registry:

  1. bevy_ui::ZIndex
  2. bevy_math::Rect
  3. bevy_text::BreakLineOn
  4. bevy_text::Text2dBounds

@MrGVSV MrGVSV added C-Usability A targeted quality-of-life change that makes Bevy easier to use A-Reflection Runtime information about types labels Apr 17, 2023
@james7132
Copy link
Member

Yet another case that might have been resolved via #5781.

Copy link
Member

@MrGVSV MrGVSV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for this!

@InnocentusLime
Copy link
Contributor Author

Yet another case that might have been resolved via #5781.

Indeed. Can't wait for that amazing feature to land one day!

@MrGVSV
Copy link
Member

MrGVSV commented Apr 17, 2023

Yet another case that might have been resolved via #5781.

Yeah, that PR is ready. Just kinda waiting on review now. Especially since it's been deemed controversial.

@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets A-Math Fundamental domain-agnostic mathematical operations S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it labels Apr 17, 2023
@InnocentusLime InnocentusLime changed the title Register some extra type to type registry Register some extra types to type registry Apr 17, 2023
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Apr 17, 2023
@nicoburns
Copy link
Contributor

Could someone explain to me what the purpose of registering types in the type registry is? I added the CSS Grid types because all the other style types seemed to be added. But I wasn't sure why as it compiled just fine without me registering the types.

Merged via the queue into bevyengine:main with commit 30ac157 Apr 17, 2023
@MrGVSV
Copy link
Member

MrGVSV commented Apr 17, 2023

Could someone explain to me what the purpose of registering types in the type registry is? I added the CSS Grid types because all the other style types seemed to be added. But I wasn't sure why as it compiled just fine without me registering the types.

@nicoburns it's pretty much for reflection and serialization. The registry holds type information which can be used at runtime to do things dynamically. But it's also (and most importantly) used to serialize and deserialize types using reflection. Additionally, it's needed in scenes in order to both deserialize and actually create/apply the contained components (using ReflectComponent).

More details can be found on the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Math Fundamental domain-agnostic mathematical operations A-Reflection Runtime information about types A-UI Graphical user interfaces, styles, layouts, and widgets C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Scene serialization doesn't work without field types being registered

5 participants