-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
constrain WorldQuery::init_state argument to ComponentInitializer #13442
Merged
alice-i-cecile
merged 1 commit into
bevyengine:main
from
Victoronz:constrain_init_state
May 30, 2024
Merged
constrain WorldQuery::init_state argument to ComponentInitializer #13442
alice-i-cecile
merged 1 commit into
bevyengine:main
from
Victoronz:constrain_init_state
May 30, 2024
Conversation
This file contains 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
Victoronz
force-pushed
the
constrain_init_state
branch
from
May 20, 2024 18:19
0297458
to
6e848a5
Compare
alice-i-cecile
added
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
X-Contentious
There are nontrivial implications that should be thought through
S-Needs-Review
Needs reviewer attention (from anyone!) to move forward
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
labels
May 21, 2024
alice-i-cecile
approved these changes
May 22, 2024
alice-i-cecile
added
the
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
label
May 22, 2024
Victoronz
force-pushed
the
constrain_init_state
branch
from
May 22, 2024 15:40
6e848a5
to
130df8e
Compare
jdm
approved these changes
May 30, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution makes sense to me!
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
May 30, 2024
hymm
added a commit
to hymm/bevy
that referenced
this pull request
Jun 11, 2024
…izer (bevyengine#13442)" This reverts commit 5cfb063.
hymm
added a commit
to hymm/bevy
that referenced
this pull request
Jun 11, 2024
…izer (bevyengine#13442)" This reverts commit 5cfb063.
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 11, 2024
#13804) …izer (#13442)" This reverts commit 5cfb063. - This PR broke bevy-trait-query, which needs to be able to write a resource in init_state. See #13798 for more details. - Note this doesn't fix everything as transmutes for bevy-trait-query will still be broken,. But the current usage in that crate is UB, so we need to find another solution.
mockersf
pushed a commit
that referenced
this pull request
Jun 11, 2024
#13804) …izer (#13442)" This reverts commit 5cfb063. - This PR broke bevy-trait-query, which needs to be able to write a resource in init_state. See #13798 for more details. - Note this doesn't fix everything as transmutes for bevy-trait-query will still be broken,. But the current usage in that crate is UB, so we need to find another solution.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-ECS
Entities, components, systems, and events
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
D-Straightforward
Simple bug fixes and API improvements, docs, test and examples
M-Needs-Migration-Guide
A breaking change to Bevy's public API that needs to be noted in a migration guide
S-Ready-For-Final-Review
This PR has been approved by the community. It's ready for a maintainer to consider merging it
X-Contentious
There are nontrivial implications that should be thought through
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
In #13343,
WorldQuery::get_state
was constrained from&World
as the argument to&Components
, butWorldQuery::init_state
hasn't yet been changed from&mut World
to match.Fixes #13358
Solution
Create a wrapper around
&mut Components
and&mut Storages
that can be obtained from&mut World
with acomponent_initializer
method.This new
ComponentInitializer
re-exposes the API on&mut Components
minus the&mut Storages
parameter where it was present. For the&Components
API, it simply derefs to itscomponents
field.Changelog
Added
The
World::component_initializer
method.The
ComponentInitializer
struct that re-exposesComponents
API.Changed
WorldQuery::init_state
now takes&mut ComponentInitializer
instead of&mut World
.Migration Guide
Instead of passing
&mut World
toWorldQuery::init_state
directly, pass in a mutable reference to the struct returned fromWorld::component_initializer
.