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

Expose query accesses #11700

Merged
merged 10 commits into from
Feb 10, 2024
Merged

Conversation

JoJoJet
Copy link
Member

@JoJoJet JoJoJet commented Feb 4, 2024

Objective

It would be useful to be able to inspect a QueryState's accesses so we can detect when the data it accesses changes without having to iterate it. However there are two things preventing this:

  • These accesses are unnecessarily encapsulated.
  • Has<T> indirectly accesses T, but does not register it.

Solution

  • Expose accesses and matches used by QueryState.
  • Add the notion of "archetypal" accesses, which are not accessed directly, but whose presence in an archetype affects a query result.

@JoJoJet JoJoJet added A-ECS Entities, components, systems, and events C-Usability A simple quality-of-life change that makes Bevy easier to use labels Feb 4, 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.

And so we inch closer to the access model laid out in bevyengine/rfcs#30 :D

I agree with this direction, and this PR is useful both as an ECS primitive and as something we can expose to users. I'd like to clean up the explanation and docs a bit further before merging.

Ideally we'd have module level documentation explaining the different kinds of access and how they relate to each other, but I won't block on that in this PR.

@hymm hymm self-requested a review February 4, 2024 22:38
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.

Solid stuff. One small set of suggestions to clarify further, but I'm happy with this now.

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
@JoJoJet
Copy link
Member Author

JoJoJet commented Feb 4, 2024

Ideally we'd have module level documentation explaining the different kinds of access and how they relate to each other, but I won't block on that in this PR.

I'll think on what I would write here, but I probably won't include anything in this PR since module-level documentation generally requires a lot more thought than method-level documentation.

@james7132 james7132 added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Feb 10, 2024
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Feb 10, 2024
Merged via the queue into bevyengine:main with commit 2e2f898 Feb 10, 2024
24 checks passed
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 simple quality-of-life change that makes Bevy easier to use S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants