-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Merged by Bors] - bevy_reflect: Update enum derives #5473
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MrGVSV
added
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
A-Reflection
Runtime information about types
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
labels
Jul 28, 2022
alice-i-cecile
approved these changes
Jul 28, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplest 4k LoC PR I ever did approve ;) LGTM.
cart
force-pushed
the
reflect-update-enum-derives
branch
from
August 2, 2022 22:37
a85fe94
to
05ce07f
Compare
cart
approved these changes
Aug 2, 2022
bors r+ |
bors bot
pushed a commit
that referenced
this pull request
Aug 2, 2022
> In draft until #4761 is merged. See the relevant commits [here](a85fe94). --- # Objective Update enums across Bevy to use the new enum reflection and get rid of `#[reflect_value(...)]` usages. ## Solution Find and replace all[^1] instances of `#[reflect_value(...)]` on enum types. --- ## Changelog - Updated all[^1] reflected enums to implement `Enum` (i.e. they are no longer `ReflectRef::Value`) ## Migration Guide Bevy-defined enums have been updated to implement `Enum` and are not considered value types (`ReflectRef::Value`) anymore. This means that their serialized representations will need to be updated. For example, given the Bevy enum: ```rust pub enum ScalingMode { None, WindowSize, Auto { min_width: f32, min_height: f32 }, FixedVertical(f32), FixedHorizontal(f32), } ``` You will need to update the serialized versions accordingly. ```js // OLD FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "value": FixedHorizontal(720), }, // NEW FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "enum": { "variant": "FixedHorizontal", "tuple": [ { "type": "f32", "value": 720, }, ], }, }, ``` This may also have other smaller implications (such as `Debug` representation), but serialization is probably the most prominent. [^1]: All enums except `HandleId` as neither `Uuid` nor `AssetPathId` implement the reflection traits
Pull request successfully merged into main. Build succeeded: |
bors
bot
changed the title
bevy_reflect: Update enum derives
[Merged by Bors] - bevy_reflect: Update enum derives
Aug 2, 2022
inodentry
pushed a commit
to IyesGames/bevy
that referenced
this pull request
Aug 8, 2022
> In draft until bevyengine#4761 is merged. See the relevant commits [here](bevyengine@a85fe94). --- # Objective Update enums across Bevy to use the new enum reflection and get rid of `#[reflect_value(...)]` usages. ## Solution Find and replace all[^1] instances of `#[reflect_value(...)]` on enum types. --- ## Changelog - Updated all[^1] reflected enums to implement `Enum` (i.e. they are no longer `ReflectRef::Value`) ## Migration Guide Bevy-defined enums have been updated to implement `Enum` and are not considered value types (`ReflectRef::Value`) anymore. This means that their serialized representations will need to be updated. For example, given the Bevy enum: ```rust pub enum ScalingMode { None, WindowSize, Auto { min_width: f32, min_height: f32 }, FixedVertical(f32), FixedHorizontal(f32), } ``` You will need to update the serialized versions accordingly. ```js // OLD FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "value": FixedHorizontal(720), }, // NEW FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "enum": { "variant": "FixedHorizontal", "tuple": [ { "type": "f32", "value": 720, }, ], }, }, ``` This may also have other smaller implications (such as `Debug` representation), but serialization is probably the most prominent. [^1]: All enums except `HandleId` as neither `Uuid` nor `AssetPathId` implement the reflection traits
inodentry
pushed a commit
to BroovyJammy/bevy
that referenced
this pull request
Aug 19, 2022
> In draft until bevyengine#4761 is merged. See the relevant commits [here](bevyengine@a85fe94). --- # Objective Update enums across Bevy to use the new enum reflection and get rid of `#[reflect_value(...)]` usages. ## Solution Find and replace all[^1] instances of `#[reflect_value(...)]` on enum types. --- ## Changelog - Updated all[^1] reflected enums to implement `Enum` (i.e. they are no longer `ReflectRef::Value`) ## Migration Guide Bevy-defined enums have been updated to implement `Enum` and are not considered value types (`ReflectRef::Value`) anymore. This means that their serialized representations will need to be updated. For example, given the Bevy enum: ```rust pub enum ScalingMode { None, WindowSize, Auto { min_width: f32, min_height: f32 }, FixedVertical(f32), FixedHorizontal(f32), } ``` You will need to update the serialized versions accordingly. ```js // OLD FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "value": FixedHorizontal(720), }, // NEW FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "enum": { "variant": "FixedHorizontal", "tuple": [ { "type": "f32", "value": 720, }, ], }, }, ``` This may also have other smaller implications (such as `Debug` representation), but serialization is probably the most prominent. [^1]: All enums except `HandleId` as neither `Uuid` nor `AssetPathId` implement the reflection traits
james7132
pushed a commit
to james7132/bevy
that referenced
this pull request
Oct 28, 2022
> In draft until bevyengine#4761 is merged. See the relevant commits [here](bevyengine@a85fe94). --- # Objective Update enums across Bevy to use the new enum reflection and get rid of `#[reflect_value(...)]` usages. ## Solution Find and replace all[^1] instances of `#[reflect_value(...)]` on enum types. --- ## Changelog - Updated all[^1] reflected enums to implement `Enum` (i.e. they are no longer `ReflectRef::Value`) ## Migration Guide Bevy-defined enums have been updated to implement `Enum` and are not considered value types (`ReflectRef::Value`) anymore. This means that their serialized representations will need to be updated. For example, given the Bevy enum: ```rust pub enum ScalingMode { None, WindowSize, Auto { min_width: f32, min_height: f32 }, FixedVertical(f32), FixedHorizontal(f32), } ``` You will need to update the serialized versions accordingly. ```js // OLD FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "value": FixedHorizontal(720), }, // NEW FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "enum": { "variant": "FixedHorizontal", "tuple": [ { "type": "f32", "value": 720, }, ], }, }, ``` This may also have other smaller implications (such as `Debug` representation), but serialization is probably the most prominent. [^1]: All enums except `HandleId` as neither `Uuid` nor `AssetPathId` implement the reflection traits
ItsDoot
pushed a commit
to ItsDoot/bevy
that referenced
this pull request
Feb 1, 2023
> In draft until bevyengine#4761 is merged. See the relevant commits [here](bevyengine@a85fe94). --- # Objective Update enums across Bevy to use the new enum reflection and get rid of `#[reflect_value(...)]` usages. ## Solution Find and replace all[^1] instances of `#[reflect_value(...)]` on enum types. --- ## Changelog - Updated all[^1] reflected enums to implement `Enum` (i.e. they are no longer `ReflectRef::Value`) ## Migration Guide Bevy-defined enums have been updated to implement `Enum` and are not considered value types (`ReflectRef::Value`) anymore. This means that their serialized representations will need to be updated. For example, given the Bevy enum: ```rust pub enum ScalingMode { None, WindowSize, Auto { min_width: f32, min_height: f32 }, FixedVertical(f32), FixedHorizontal(f32), } ``` You will need to update the serialized versions accordingly. ```js // OLD FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "value": FixedHorizontal(720), }, // NEW FORMAT { "type": "bevy_render::camera::projection::ScalingMode", "enum": { "variant": "FixedHorizontal", "tuple": [ { "type": "f32", "value": 720, }, ], }, }, ``` This may also have other smaller implications (such as `Debug` representation), but serialization is probably the most prominent. [^1]: All enums except `HandleId` as neither `Uuid` nor `AssetPathId` implement the reflection traits
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 targeted quality-of-life change that makes Bevy easier to use
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Update enums across Bevy to use the new enum reflection and get rid of
#[reflect_value(...)]
usages.Solution
Find and replace all1 instances of
#[reflect_value(...)]
on enum types.Changelog
Enum
(i.e. they are no longerReflectRef::Value
)Migration Guide
Bevy-defined enums have been updated to implement
Enum
and are not considered value types (ReflectRef::Value
) anymore. This means that their serialized representations will need to be updated. For example, given the Bevy enum:You will need to update the serialized versions accordingly.
This may also have other smaller implications (such as
Debug
representation), but serialization is probably the most prominent.Footnotes
All enums except
HandleId
as neitherUuid
norAssetPathId
implement the reflection traits ↩ ↩2