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

Test entity labels, fixed corner cases, changed interface #1152

Merged
merged 2 commits into from
Dec 28, 2020

Conversation

payload
Copy link
Contributor

@payload payload commented Dec 26, 2020

  • add tests for entity_labels_system
  • fixed filling label_entities map
  • fixed corner cases when removing entities, Labels component
  • use Changed query filter
  • changed EntityLabels::get to return slice or empty slice instead of
    None or Some empty or non-empty slice

Changing the interface of EntityLabels::get is beneficial, since else
you would get different results in case there was an entity before that
with this missing label or not. You would either get None or Some(&[])
and need to handle both, which is actually not necessary.

@payload payload mentioned this pull request Dec 26, 2020
@mockersf
Copy link
Member

as mentioned here, you shouldn't use Changed without changing first the stage the system runs on

goods to have more tests!

* add tests for entity_labels_system
* fixed filling label_entities map
* fixed corner cases when removing entities, Labels component
* changed EntityLabels::get to return slice or empty slice instead of
  None or Some empty or non-empty slice

Changing the interface of EntityLabels::get is beneficial, since else
you would get different results in case there was an entity before that
with this missing label or not. You would either get None or Some(&[])
and need to handle both, which is actually not necessary.
@Moxinilian Moxinilian added C-Bug An unexpected or incorrect behavior A-ECS Entities, components, systems, and events labels Dec 26, 2020
@cart
Copy link
Member

cart commented Dec 27, 2020

Yup this seems good to me. We should be able to add Changed filters using this approach:

  1. Add Changed filter to query
  2. Move system to POST_UPDATE
  3. Add a copy of the system to POST_STARTUP

Without Changed filters, the current implementation is expensive in a "very hard to justify" sort of way. (which isn't a critique of this pr. this is a critique of past @cart back when he was just building things for himself)

@cart
Copy link
Member

cart commented Dec 28, 2020

Feel free to follow up with those changes (or I will if nobody else does). No harm in merging these fixes now.

@cart cart merged commit 4825051 into bevyengine:master Dec 28, 2020
@payload payload deleted the test-and-fix-entity-labels branch December 28, 2020 11:20
@payload
Copy link
Contributor Author

payload commented Dec 28, 2020

Feel free to follow up with those changes (or I will if nobody else does). No harm in merging these fixes now.

@mockersf followed up on that in #1155 🚀

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-Bug An unexpected or incorrect behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants