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

Update to latest egui + use new Image api #3311

Merged
merged 10 commits into from
Sep 13, 2023
Merged

Update to latest egui + use new Image api #3311

merged 10 commits into from
Sep 13, 2023

Conversation

jprochazk
Copy link
Member

@jprochazk jprochazk commented Sep 13, 2023

What

Checklist

@jprochazk jprochazk added 🚜 refactor Change the code, not the functionality ui concerns graphical user interface 📺 re_viewer affects re_viewer itself labels Sep 13, 2023
@jprochazk
Copy link
Member Author

jprochazk commented Sep 13, 2023

@jprochazk jprochazk marked this pull request as ready for review September 13, 2023 14:40
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Juts some cleanup

@@ -10,6 +12,10 @@ impl Icon {
pub const fn new(id: &'static str, png_bytes: &'static [u8]) -> Self {
Self { id, png_bytes }
}

pub fn as_image(&self) -> Image<'static> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be an impl From<&Icon> for Image<'static>

crates/re_ui/src/lib.rs Show resolved Hide resolved
crates/re_viewer/src/ui/rerun_menu.rs Outdated Show resolved Hide resolved
crates/re_viewer/src/ui/welcome_screen/example_page.rs Outdated Show resolved Hide resolved
Comment on lines +558 to +560
if let Ok(TexturePoll::Ready { texture }) = icon_image.load(ui) {
icon_image.paint_at(ui, self.icon_rect, &texture);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do this pattern a lot now. We should make sure something like this works instead:

Suggested change
if let Ok(TexturePoll::Ready { texture }) = icon_image.load(ui) {
icon_image.paint_at(ui, self.icon_rect, &texture);
}
icon_image.paint_at(ui, self.icon_rect);

I feel like everytime we as users see a naked TexturePoll, that's a failure in the egui interface

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(we can save this for later)

@emilk emilk merged commit ffac4c7 into main Sep 13, 2023
@emilk emilk deleted the jan/update-egui-0 branch September 13, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📺 re_viewer affects re_viewer itself 🚜 refactor Change the code, not the functionality ui concerns graphical user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants