afonsolage / bevy_ecss

Bevy crate which uses a subset of CSS to update Bevy ECS components
Apache License 2.0
98 stars 11 forks source link

Selector detection change #41

Closed afonsolage closed 11 months ago

afonsolage commented 11 months ago

Fixes #39

Changed


Overall I have to track which SelectorElement matched which Entity, so we can convert the given SelectorElement into a Query<T> and use bevy_ecs to keep track of changes. When some Entity is changed, the whole StyleSheet will be applied, since fine grain control over will be very complex and I don't think it'll worth it at the end, since applying a StyleSheet is cheap (even tho there are plenty of optimization left to do).

StyleSheetState now has another member, for each Asset<StyleSheetAsset>. The new TrackedEntities member is populated when system::select_entities in ran, that way, we don't have to traverse the entity tree twice.

TODO:

afonsolage commented 11 months ago

Most of the work is done. I just need to fix a bug where the new system which watches for changes, is reacting to changes made by the bevy_ecss itself.

afonsolage commented 11 months ago

I was able to fix the change detection, but after more tests, the Interaction component change is not being detected. I'll do more research on that.

afonsolage commented 11 months ago

Ok, everything seems to be working fine now. Let's wrap things up and prepare to merge this. I'll write a new interactive example and write docs and changelog.