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

[Merged by Bors] - RemoveChildren command #1925

Closed
wants to merge 1 commit into from

Conversation

jihiggins
Copy link
Contributor

No description provided.

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-UI Graphical user interfaces, styles, layouts, and widgets core labels Apr 14, 2021
@alice-i-cecile
Copy link
Member

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.

Copy link
Member

@alice-i-cecile alice-i-cecile left a 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.

@cart cart added this to the Bevy 0.6 milestone Jul 1, 2021
@cart cart added the S-Pre-Relicense This PR was made before Bevy added the Apache license. Cannot be merged or used for other work label Jul 23, 2021
@mockersf mockersf removed the S-Pre-Relicense This PR was made before Bevy added the Apache license. Cannot be merged or used for other work label Jul 24, 2021

fn remove_children(&mut self, children: &[Entity]) -> &mut Self {
let parent = self.id();
// SAFE: This doesn't change the parent's location
Copy link
Contributor

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.

Copy link
Contributor Author

@jihiggins jihiggins Oct 9, 2021

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

Copy link
Contributor

@payload payload left a 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.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Oct 9, 2021
@cart
Copy link
Member

cart commented Dec 22, 2021

Just resolved conflicts. Seems useful and the impl is safe.

@cart
Copy link
Member

cart commented Dec 22, 2021

bors r+

bors bot pushed a commit that referenced this pull request Dec 22, 2021
@bors
Copy link
Contributor

bors bot commented Dec 22, 2021

Build failed:

@mockersf
Copy link
Member

CI failed due to a nightly random ICE, restarting

@mockersf
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Dec 23, 2021
@bors bors bot changed the title RemoveChildren command [Merged by Bors] - RemoveChildren command Dec 23, 2021
@bors bors bot closed this Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants