Skip to content
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

bevy_scene: Use FromReflect on extracted resources #15753

Conversation

MrGVSV
Copy link
Member

@MrGVSV MrGVSV commented Oct 8, 2024

Objective

Fixes #15726

The extraction logic for components makes use of FromReflect to try and ensure we have a concrete type for serialization. However, we did not do the same for resources.

The reason we're seeing this for the glam types is that #15174 also made a change to rely on the glam type's Serialize and Deserialize impls, which I don't think should have been merged (I'll put up a PR addressing this specifically soon).

Solution

Use FromReflect on extracted resources.

Testing

You can test locally by running:

cargo test --package bevy_scene

@MrGVSV MrGVSV added C-Bug An unexpected or incorrect behavior A-Scenes Serialized ECS data stored on the disk D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 8, 2024
@MrGVSV MrGVSV added this to the 0.15 milestone Oct 8, 2024
Copy link
Member

@alice-i-cecile alice-i-cecile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the regression test :)

@MrGVSV MrGVSV force-pushed the mrgvsv/scene/fix-from-reflect-inconsistency branch from d07ea38 to 4952560 Compare October 9, 2024 00:03
@MrGVSV MrGVSV changed the title bevy_scene: Use FromReflect on extract resources bevy_scene: Use FromReflect on extracted resources Oct 9, 2024
Copy link
Contributor

@mrchantey mrchantey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well explained and adds regression test, looks good!

@alice-i-cecile alice-i-cecile added this pull request to the merge queue Oct 9, 2024
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 9, 2024
Merged via the queue into bevyengine:main with commit 05b0f28 Oct 9, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Scenes Serialized ECS data stored on the disk C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Cannot deserialize Vec3 in Resources
3 participants