Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register missing types for Camera #6169

Closed
MrGVSV opened this issue Oct 5, 2022 · 3 comments
Closed

Register missing types for Camera #6169

MrGVSV opened this issue Oct 5, 2022 · 3 comments
Labels
A-Reflection Runtime information about types C-Usability A simple quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@MrGVSV
Copy link
Member

MrGVSV commented Oct 5, 2022

What problem does this solve or what need does it fill?

Camera cannot be serialized via reflection due to some missing registrations:

  • Missing registration for Option<Viewport>
  • Missing ReflectSerialize/ReflectDeserialize type data for Range<f32>

What solution would you like?

  • bevy_render's CameraPlugin should register Option<Viewport>.
  • bevy_cores CorePlugin should register the ReflectSerialize and ReflectDeserialize type data for Range<f32>

What alternative(s) have you considered?

Users could manually implement these themselves. I don't think that's a good idea, though, as this should really be handled by Bevy since it directly uses those two types.

Additional context

🔗 Discord Help Thread

@MrGVSV MrGVSV added D-Trivial Nice and easy! A great choice to get started with Bevy C-Usability A simple quality-of-life change that makes Bevy easier to use A-Reflection Runtime information about types labels Oct 5, 2022
@NoahShomette
Copy link
Contributor

I cant comment on the idea, however I implemented it if it is a good idea 🤷

@jakobhellermann
Copy link
Contributor

I registered these types in https://github.com/bevyengine/bevy/pull/6061/files, so with that just Reflect{De,}Serialize is missing on Range<f32>. Unless we change Range<f32> to be Struct reflection with start and end?

@MrGVSV
Copy link
Member Author

MrGVSV commented Oct 5, 2022

I registered these types in https://github.com/bevyengine/bevy/pull/6061/files, so with that just Reflect{De,}Serialize is missing on Range<f32>. Unless we change Range<f32> to be Struct reflection with start and end?

You’re saying to register it in bevy_reflect using impl_reflect_struct!? That's a pretty good solution I think. We could do the same for the other range types at the same time. The only weird ones out of the range types are RangeInclusive and RangeFull, which might create some discrepancies (unless we register those as Struct types as well).

@bors bors bot closed this as completed in 6ae46f6 Oct 10, 2022
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 19, 2022
…ore functionality. (bevyengine#6170)

…

# Objective

- Fixes Camera not being serializable due to missing registrations in core functionality. 
- Fixes bevyengine#6169

## Solution

- Updated Bevy_Render CameraPlugin with registrations for Option<Viewport> and then Bevy_Core CorePlugin with registrations for ReflectSerialize and ReflectDeserialize for type data Range<f32> respectively according to the solution in bevyengine#6169



Co-authored-by: Noah <noahshomette@gmail.com>
james7132 pushed a commit to james7132/bevy that referenced this issue Oct 28, 2022
…ore functionality. (bevyengine#6170)

…

# Objective

- Fixes Camera not being serializable due to missing registrations in core functionality. 
- Fixes bevyengine#6169

## Solution

- Updated Bevy_Render CameraPlugin with registrations for Option<Viewport> and then Bevy_Core CorePlugin with registrations for ReflectSerialize and ReflectDeserialize for type data Range<f32> respectively according to the solution in bevyengine#6169



Co-authored-by: Noah <noahshomette@gmail.com>
Pietrek14 pushed a commit to Pietrek14/bevy that referenced this issue Dec 17, 2022
…ore functionality. (bevyengine#6170)

…

# Objective

- Fixes Camera not being serializable due to missing registrations in core functionality. 
- Fixes bevyengine#6169

## Solution

- Updated Bevy_Render CameraPlugin with registrations for Option<Viewport> and then Bevy_Core CorePlugin with registrations for ReflectSerialize and ReflectDeserialize for type data Range<f32> respectively according to the solution in bevyengine#6169



Co-authored-by: Noah <noahshomette@gmail.com>
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
…ore functionality. (bevyengine#6170)

…

# Objective

- Fixes Camera not being serializable due to missing registrations in core functionality. 
- Fixes bevyengine#6169

## Solution

- Updated Bevy_Render CameraPlugin with registrations for Option<Viewport> and then Bevy_Core CorePlugin with registrations for ReflectSerialize and ReflectDeserialize for type data Range<f32> respectively according to the solution in bevyengine#6169



Co-authored-by: Noah <noahshomette@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Reflection Runtime information about types C-Usability A simple quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
3 participants