-
-
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
[Merged by Bors] - RemoveChildren command #1925
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. |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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.
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.