bevy/crates
Gino Valente bd008589f3 bevy_reflect: Update enum derives (#5473)
> In draft until #4761 is merged. See the relevant commits [here](a85fe94a18).

---

# 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:📷:projection::ScalingMode",
  "value": FixedHorizontal(720),
},

// NEW FORMAT
{
  "type": "bevy_render:📷: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
2022-08-02 22:40:29 +00:00
..
bevy_animation Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_app Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_asset Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_audio Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_core Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_core_pipeline bevy_reflect: Update enum derives (#5473) 2022-08-02 22:40:29 +00:00
bevy_derive Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_diagnostic Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_dylib Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_dynamic_plugin Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_ecs Add FromWorld bound to T in Local<T> (#5481) 2022-08-01 16:50:11 +00:00
bevy_ecs_compile_fail_tests Replace many_for_each_mut with iter_many_mut. (#5402) 2022-07-30 01:38:13 +00:00
bevy_encase_derive Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_gilrs Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_gltf Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_hierarchy Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_input Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_internal Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_log Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_macro_utils Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_math Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_mikktspace Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_pbr add default direction to DirectionalLight docs (#5188) 2022-08-02 18:13:21 +00:00
bevy_ptr Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_reflect bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00
bevy_render bevy_reflect: Update enum derives (#5473) 2022-08-02 22:40:29 +00:00
bevy_scene Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_sprite Fix View by adding missing fields present in ViewUniform (#5512) 2022-07-31 19:10:53 +00:00
bevy_tasks Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_text bevy_reflect: Update enum derives (#5473) 2022-08-02 22:40:29 +00:00
bevy_time Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_transform Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_ui bevy_reflect: Update enum derives (#5473) 2022-08-02 22:40:29 +00:00
bevy_utils Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00
bevy_window bevy_reflect: Reflect enums (#4761) 2022-08-02 22:14:41 +00:00
bevy_winit Release 0.8.0 (#5490) 2022-07-30 14:07:30 +00:00