[Merged by Bors] - RemoveChildren command#1925
[Merged by Bors] - RemoveChildren command#1925jihiggins wants to merge 1 commit intobevyengine:mainfrom
Conversation
|
For posterity, this seems like a nice bit of functionality, and the code quality looks high. However, parent-child designs in Bevy are due for a rewrite in general: see #1278 for some reasons why and #1627 for one of the most promising directions. I'm not sure if this is correct to merge in the meantime as a result. |
alice-i-cecile
left a comment
There was a problem hiding this comment.
In the interim, I think this should be merged.
|
|
||
| fn remove_children(&mut self, children: &[Entity]) -> &mut Self { | ||
| let parent = self.id(); | ||
| // SAFE: This doesn't change the parent's location |
There was a problem hiding this comment.
I needed to double check when locations change, saw that location changes when a Component is removed and saw that this code removes and inserts components. Next thought was that: child locations change but parent location does not (assuming no child is at the same time the parent).
Could you explain in this comment? // SAFE: This doesn't change the parent's location, only child locations are changed.
There was a problem hiding this comment.
iirc it needs to be unsafe because of &mut self, and world_mut also references the parent. and since it doesn't change its position within the world, it should be fine? but idr it was a long time ago
payload
left a comment
There was a problem hiding this comment.
Tests are present, look okay. Reviewed unsafe usage, sound.
75690aa to
91a8c60
Compare
|
Just resolved conflicts. Seems useful and the impl is safe. |
|
bors r+ |
|
Build failed: |
|
CI failed due to a nightly random ICE, restarting |
|
bors r+ |
No description provided.