-
-
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
Add DefaultQueryFilters #13120
base: main
Are you sure you want to change the base?
Add DefaultQueryFilters #13120
Conversation
Two things you should probably do:
|
This seems reasonable, yet it might also be problematic for things that get added to the list in the future. It's hard to anticipiate all the uses for this before people have a chance to use it. It's hard to say if a universal bypass makes sense or if we'd be better off with some alternative approach like assigning a group to each filter, and allowing groups to be bypassed. Or perhaps bypassing default filters won't even be needed in practice. It might be better to leave it until people report running into issues, or until we start including default features and know we need a way to bypass them collectively.
This behavior feels a bit implicit, but I think creating a list of components retain shouldn't touch could make a lot of sense, it would also be a lot easier to explain and reason about for users. There might even be uses that do want to bypass retain but not be filtered out, or the other way around. But it should probably be in a separate PR. The bypass variant might also have the same issues as the point above. |
At the very least it should be the same list. It shouldn't be a different one. I still think it would be a good idea to include this now anyway even if you don't want to add bypasses yet because introducing it later will be a breaking change & using it without default filters applied will surprise users. |
I'm thinking more along the lines: Most users wouldn't manually add default filters, we'll probably want built-in abstractions on top in a future release. Meaning they'd probably be configured by plugins (something like a Tho I've never actually used retain so it's a bit hard for me to comment on how it should behave. |
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.
The code is simple and clear. I would add references to DefaultQueryFilters
from Query
for discoverability.
This feature would be quite useful for rollback in networking.
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.
Seems well thought-out, and definitely useful
I think with @SkiFire13's fix (#14615) it should be possible to fix the sparse-related problems. I have updated the PR and added a test for it and it seems to work as one would expect. I have somehow never been able to reproduce @re0312's panic, but it also completely ignored sparse filters previously, which caused unsound behavior as queries that got detected as not overlapping could alias mutable references. |
After discussion with @maniwani, we have approval from two SME-ECS: them and myself. As a follow-up, we should add a first-party |
I'm going to raise a concern I've already mentioned on discord. If we have a |
@NiseVoid I know you've been chewing on designs for this, what's the plan for this work? My current understanding is:
Is that correct? What needs to be done to this PR to get step 1 above mergeable? |
Yes, this is correct. For docs and lint reasons making it |
Sounds good. Feel free to add expect(dead_code) to get CI to pass for now :) |
@alice-i-cecile Where do you think docs for entity disabling and other similar features should live? Currently there's some docs and a doc test on Also comments on the last commit would be welcome, I simplified the design somewhat for the more locked down design, but some parts of it do feel a bit odd like the |
Can we make an |
Objective
Some usecases in the ecosystems are blocked by the inability to stop bevy internals and third party plugins from touching their entities. However the specifics of a general purpose entity disabling system are controversial and further complicated by hierarchies. We can partially unblock these usecases with an opt-in approach: default query filters.
Solution
Changelog