-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Change ReflectMapEntities to operate on components before insertion #15422
Conversation
ac52703
to
8a4c02d
Compare
8a4c02d
to
9922071
Compare
I've rebased this on #15425 since it's gaining traction and I like its approach way better than what I had here previously. |
51198ef
to
55767d1
Compare
Welp, this has now been un-rebased on #15425 after realizing the approach there wouldn't work for |
@alice-i-cecile This is ready for review once more! |
148b667
to
fe173a1
Compare
e16c114
to
5315590
Compare
This makes EntityMapper object-safe and obviates the need for the `Dyn` variant.
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.
Looks good!
Left a small suggestion.
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
…evyengine#15422) Previous PR bevyengine#14549 was closed in error and couldn't be reopened since I had updated the branch :crying_cat_face: # Objective Fixes bevyengine#14465 ## Solution `ReflectMapEntities` now works similarly to `MapEntities` in that it works on the reflected value itself rather than the component in the world after insertion. This makes it so that observers see the remapped entities on insertion rather than the entity IDs from the scene. `ReflectMapEntities` now works for both components and resources, so we only need the one. ## Testing * New unit test for `Observer`s + `DynamicScene`s * New unit test for `Observer`s + `Scene`s * Open to suggestions for other tests! --- ## Migration Guide - Consumers of `ReflectMapEntities` will need to call `map_entities` on values prior to inserting them into the world. - Implementors of `MapEntities` will need to remove the `mappings` method, which is no longer needed for `ReflectMapEntities` and has been removed from the trait. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com> Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
Previous PR #14549 was closed in error and couldn't be reopened since I had updated the branch 😿
Objective
Fixes #14465
Solution
ReflectMapEntities
now works similarly toMapEntities
in that it works on the reflected value itself rather than the component in the world after insertion. This makes it so that observers see the remapped entities on insertion rather than the entity IDs from the scene.ReflectMapEntities
now works for both components and resources, so we only need the one.Testing
Observer
s +DynamicScene
sObserver
s +Scene
sMigration Guide
ReflectMapEntities
will need to callmap_entities
on values prior to inserting them into the world.MapEntities
will need to remove themappings
method, which is no longer needed forReflectMapEntities
and has been removed from the trait.