-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
reflect: treat proxy types correctly when serializing #12024
Conversation
Not a proper review, but Is this the expected output? // with `serialize`
"bevy_core::name::Name": "joe",
// without
"bevy_core::name::Name": (
hash: 1651241057899607384,
name: "joe",
), If so, does this comment on hash: u64, // Won't be serialized (see: `bevy_core::serde` module) Or do we need a followup issue to address |
yeah i chose not to do anything to the feature flags to make this fix as simple as possible - i don't think it's trivial (and it's probably not uncontroversial) to remove all the feature flags for serialisation throughout bevy. |
Co-authored-by: Gino Valente <[email protected]>
@soqb can you run |
# Objective - Fixes bevyengine#12001. - Note this PR doesn't change any feature flags, however flaky the issue revealed they are. ## Solution - Use `FromReflect` to convert proxy types to concrete ones in `ReflectSerialize::get_serializable`. - Use `get_represented_type_info() -> type_id()` to get the correct type id to interact with the registry in `bevy_reflect::serde::ser::get_serializable`. --- ## Changelog - Registering `ReflectSerialize` now imposes additional `FromReflect` and `TypePath` bounds. ## Migration Guide - If `ReflectSerialize` is registered on a type, but `TypePath` or `FromReflect` implementations are omitted (perhaps by `#[reflect(type_path = false)` or `#[reflect(from_reflect = false)]`), the traits must now be implemented. --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Gino Valente <[email protected]>
# Objective - Fixes bevyengine#12001. - Note this PR doesn't change any feature flags, however flaky the issue revealed they are. ## Solution - Use `FromReflect` to convert proxy types to concrete ones in `ReflectSerialize::get_serializable`. - Use `get_represented_type_info() -> type_id()` to get the correct type id to interact with the registry in `bevy_reflect::serde::ser::get_serializable`. --- ## Changelog - Registering `ReflectSerialize` now imposes additional `FromReflect` and `TypePath` bounds. ## Migration Guide - If `ReflectSerialize` is registered on a type, but `TypePath` or `FromReflect` implementations are omitted (perhaps by `#[reflect(type_path = false)` or `#[reflect(from_reflect = false)]`), the traits must now be implemented. --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Gino Valente <[email protected]>
# Objective - Fixes #12001. - Note this PR doesn't change any feature flags, however flaky the issue revealed they are. ## Solution - Use `FromReflect` to convert proxy types to concrete ones in `ReflectSerialize::get_serializable`. - Use `get_represented_type_info() -> type_id()` to get the correct type id to interact with the registry in `bevy_reflect::serde::ser::get_serializable`. --- ## Changelog - Registering `ReflectSerialize` now imposes additional `FromReflect` and `TypePath` bounds. ## Migration Guide - If `ReflectSerialize` is registered on a type, but `TypePath` or `FromReflect` implementations are omitted (perhaps by `#[reflect(type_path = false)` or `#[reflect(from_reflect = false)]`), the traits must now be implemented. --------- Co-authored-by: Alice Cecile <[email protected]> Co-authored-by: Gino Valente <[email protected]>
Objective
Name
component may not be working correctly #12001.Solution
FromReflect
to convert proxy types to concrete ones inReflectSerialize::get_serializable
.get_represented_type_info() -> type_id()
to get the correct type id to interact with the registry inbevy_reflect::serde::ser::get_serializable
.Changelog
ReflectSerialize
now imposes additionalFromReflect
andTypePath
bounds.Migration Guide
ReflectSerialize
is registered on a type, butTypePath
orFromReflect
implementations are omitted (perhaps by#[reflect(type_path = false)
or#[reflect(from_reflect = false)]
), the traits must now be implemented.