-
-
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
Query Joins #11535
Query Joins #11535
Conversation
This counts as fixing #1658. We can make more detailed issues for more complex and specific needs as they arise. |
Co-authored-by: Alice Cecile <[email protected]>
world: &World, | ||
other: &QueryState<OtherD, OtherF>, | ||
) -> QueryState<NewD, NewF> { | ||
let mut component_access = FilteredAccess::default(); |
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.
Not necessary in this PR, but pre-allocating here might be a good idea.
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.
yeah, I think there should be a way for this method and transmutes to reuse an existing query state.
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.
wrote up an issue for this here #12271
|
||
QueryState { | ||
world_id: self.world_id, | ||
archetype_generation: self.archetype_generation, |
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.
We may need to validate that our archetype generation here is identical to that of both the World and the other query.
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.
Added a warning for when the queries don't have matching id's. I didn't make it a panic as there shouldn't be any safety issues with it and there are probably some niche cases that it would still be valid to do this with mismatching.
I didn't do this for the world. First because it's not available here, but also it's not really valid to call update_archetypes on a QueryState generated from joins
or transmutes
.
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.
Looks good to me! Not the biggest fan of hiding QueryState construction, but this is definitely cheaper than calling QueryState::new
with the intersection.
f21bc09
to
2c0c481
Compare
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.
I'm happy with this. I'd like to see more user-facing docs about how to use this (probably an example), but I'll punt that to a new issue.
Objective
Query::transmute_lens
Solution
Changelog