[Merged by Bors] - bevy_reflect: Update enum derives#5473
Closed
MrGVSV wants to merge 2 commits intobevyengine:mainfrom
Closed
[Merged by Bors] - bevy_reflect: Update enum derives#5473MrGVSV wants to merge 2 commits intobevyengine:mainfrom
MrGVSV wants to merge 2 commits intobevyengine:mainfrom
Conversation
alice-i-cecile
approved these changes
Jul 28, 2022
Member
alice-i-cecile
left a comment
There was a problem hiding this comment.
Simplest 4k LoC PR I ever did approve ;) LGTM.
a85fe94 to
05ce07f
Compare
cart
approved these changes
Aug 2, 2022
Member
|
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
Contributor
|
Pull request successfully merged into main. Build succeeded: |
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
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Enumand 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
Debugrepresentation), but serialization is probably the most prominent.Footnotes
All enums except
HandleIdas neitherUuidnorAssetPathIdimplement the reflection traits ↩ ↩2