-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Improve UI update_clipping_system
comments
#8147
Conversation
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. No problems with the changes but just got a few (a lot now 😄) suggestions for extra improvements.
crates/bevy_ui/src/update.rs
Outdated
(Some(mut old_clip), Some(clip)) => { | ||
if old_clip.clip != clip { | ||
*old_clip = CalculatedClip { clip }; | ||
} | ||
} | ||
} |
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 was going to suggest to use set_if_neq
but then I checked and we never actually query for changes in CalculatedClip
so the neq gate is unnecessary:
(Some(mut old_clip), Some(clip)) => { | |
if old_clip.clip != clip { | |
*old_clip = CalculatedClip { clip }; | |
} | |
} | |
} | |
(Some(mut calculated_clip), Some(inherited_clip)) => *calculated_clip = CalculatedClip { inherited_clip }, | |
} |
#8095 that is very related needs some reviews, be grateful if you have a few minutes spare to look at it. |
Thanks for the comments! I was going to review them, but suddenly I'm getting a segfault out of nowhere. So frustrating. The good thing is that I can learn how this kind of stuff is debugged. Anyway, sure I can check #8095. Btw, I want to review more UI PRs (mostly yours and nico's), but first I want to finish reading the UI related code. I did few reviews last couple of weeks but I realized I was lacking understanding. ^_^ |
Co-Authored-By: ickshonpe <27962798+ickshonpe@users.noreply.github.com>
@ickshonpe I've applied most of the suggestions. I think I'm going to skip #8147 (comment) I prefer not to touch that part. In any case, I've asked about it in https://github.com/bevyengine/bevy/pull/8095/files#r1144342397, we can follow there. |
Objective
update_clipping_system
commentsSolution
CalculatedClip
updatingmatch
so it's reads(old, new)
vs previous(new, old)
clone
on children iteration