bevy/crates/bevy_reflect/src
Trashtalk217 e5f5ce5e97
Migrate Quat reflection strategy from "value" to "struct" (#10068)
Adopted from #8954, co-authored by @pyrotechnick 

# Objective

The Bevy ecosystem currently reflects `Quat` via "value" rather than the
more appropriate "struct" strategy. This behaviour is inconsistent to
that of similar types, i.e. `Vec3`. Additionally, employing the "value"
strategy causes instances of `Quat` to be serialised as a sequence `[x,
y, z, w]` rather than structures of shape `{ x, y, z, w }`.

The [comments surrounding the applicable
code](bec299fa6e/crates/bevy_reflect/src/impls/glam.rs (L254))
give context and historical reasons for this discrepancy:

```
// Quat fields are read-only (as of now), and reflection is currently missing
// mechanisms for read-only fields. I doubt those mechanisms would be added,
// so for now quaternions will remain as values. They are represented identically
// to Vec4 and DVec4, so you may use those instead and convert between.
```

This limitation has [since been lifted by the upstream
crate](374625163e),
glam.

## Solution

Migrating the reflect strategy of Quat from "value" to "struct" via
replacing `impl_reflect_value` with `impl_reflect_struct` resolves the
issue.

## Changelog

Migrated `Quat` reflection strategy to "struct" from "value"
Migration Guide

Changed Quat serialization/deserialization from sequences `[x, y, z, w]`
to structures `{ x, y, z, w }`.

---------

Co-authored-by: pyrotechnick <13998+pyrotechnick@users.noreply.github.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2023-10-09 22:01:42 +00:00
..
enums reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
impls Migrate Quat reflection strategy from "value" to "struct" (#10068) 2023-10-09 22:01:42 +00:00
path Fix some nightly warnings (#9672) 2023-09-02 18:35:06 +00:00
serde reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
array.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
fields.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
from_reflect.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
lib.rs Migrate Quat reflection strategy from "value" to "struct" (#10068) 2023-10-09 22:01:42 +00:00
list.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
map.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
reflect.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
std_traits.rs fix nightly clippy warnings (#6395) 2022-10-28 21:03:01 +00:00
struct_trait.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
tuple_struct.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
tuple.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
type_info.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
type_path.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
type_registry.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00
type_uuid_impl.rs implement TypeUuid for primitives and fix multiple-parameter generics having the same TypeUuid (#6633) 2023-02-16 17:09:44 +00:00
type_uuid.rs implement TypeUuid for primitives and fix multiple-parameter generics having the same TypeUuid (#6633) 2023-02-16 17:09:44 +00:00
utility.rs reflect: TypePath part 2 (#8768) 2023-10-09 19:33:03 +00:00