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

Sugar for filtering queries by entity #2010

Closed
alice-i-cecile opened this issue Apr 25, 2021 · 2 comments
Closed

Sugar for filtering queries by entity #2010

alice-i-cecile opened this issue Apr 25, 2021 · 2 comments
Labels
A-ECS Entities, components, systems, and events C-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use

Comments

@alice-i-cecile
Copy link
Member

alice-i-cecile commented Apr 25, 2021

What problem does this solve or what need does it fill?

When working with queries, a reasonably common pattern is to dynamically determine some list of entities on which work should be done, then check if the entities in the query match.

This is boilerplate heavy, and forces you to fetch Entity in your query.

What solution would you like?

Write convenience wrappers for query that filter by Vec in both an allow-list and block-list fashion.

What alternative(s) have you considered?

Accept an iterator of Entities instead.

Frame this functionality as get_multiple.

Only include this as a special set of methods on relation filters alone.

Write out the logic manually each time.

Create examples showing how to use existing method chaining to do this very nicely in vanilla Rust.

Additional context

Similar in character to #1658. This idea was inspired by the notion of "source filtering" of relations in bevyengine/rfcs#18.

Assuming relations are accepted, we should consider a relation filter API similar to that originally proposed in the RFC.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled A-ECS Entities, components, systems, and events C-Usability A targeted quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled labels Apr 25, 2021
@tigregalis
Copy link
Contributor

Have you got sample code for the status quo?

@alice-i-cecile alice-i-cecile added D-Trivial Nice and easy! A great choice to get started with Bevy and removed D-Trivial Nice and easy! A great choice to get started with Bevy labels Dec 12, 2021
@alice-i-cecile
Copy link
Member Author

Closing as duplicate of #2042.

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-Feature A new feature, making something new possible C-Usability A targeted quality-of-life change that makes Bevy easier to use
Projects
None yet
Development

No branches or pull requests

2 participants