Skip to content

Commit

Permalink
Update to latest egui + use new Image api (#3311)
Browse files Browse the repository at this point in the history
<!--
Open the PR up as a draft until you feel it is ready for a proper
review.

Do not make PR:s from your own `main` branch, as that makes it difficult
for reviewers to add their own fixes.

Add any improvements to the branch as new commits to make it easier for
reviewers to follow the progress. All commits will be squashed to a
single commit once the PR is merged into `main`.

Make sure you mention any issues that this PR closes in the description,
as well as any other related issues.

To get an auto-generated PR description you can put "copilot:summary" or
"copilot:walkthrough" anywhere.
-->

### What

- Update `egui` to point to latest commit on
emilk/egui#3328
- Remove `StaticImageCache`, as its a part of `egui` now
- Update icons to use `egui::Image`

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/3311) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3311)
- [Docs
preview](https://rerun.io/preview/5fd7b59260f843d1f2fab710b8f719b368a3f039/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/5fd7b59260f843d1f2fab710b8f719b368a3f039/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)

---------

Co-authored-by: Emil Ernerfeldt <[email protected]>
  • Loading branch information
jprochazk and emilk authored Sep 13, 2023
1 parent 640f1b5 commit ffac4c7
Show file tree
Hide file tree
Showing 16 changed files with 235 additions and 245 deletions.
46 changes: 36 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 15 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,22 @@ crossbeam = "0.8"
ecolor = "0.22.0"
eframe = { version = "0.22.0", default-features = false, features = [
"default_fonts",
"puffin",
"wayland",
"x11",
] }
egui = { version = "0.22.0", features = ["extra_debug_asserts", "log"] }
egui = { version = "0.22.0", features = [
"extra_debug_asserts",
"log",
"puffin",
] }
egui_extras = { version = "0.22.0", features = [
"log",
"image",
"http",
"puffin",
] }
egui_plot = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
egui_plot = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
egui_tiles = { version = "0.2" }
egui-wgpu = "0.22.0"
ehttp = { version = "0.3" }
Expand Down Expand Up @@ -165,14 +170,14 @@ debug = true
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

# Temporary patch until next egui release
ecolor = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
eframe = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
egui-winit = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
egui = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
emath = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
epaint = { git = "https://github.com/emilk/egui", rev = "2338a854f932658ad0548aa4f00874b3427970c1" }
ecolor = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
eframe = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
egui-wgpu = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
egui-winit = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
egui = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
egui_extras = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
emath = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }
epaint = { git = "https://github.com/emilk/egui", rev = "67a3fcae383044def7450b311ddc1f79e36eaae0" }

# Temporary patch until next egui_tiles release
egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "c66d6cba7ddb5b236be614d1816be4561260274e" }
2 changes: 1 addition & 1 deletion crates/re_ui/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ impl UICommand {
response
}

pub fn menu_button(self, egui_ctx: &egui::Context) -> egui::Button {
pub fn menu_button(self, egui_ctx: &egui::Context) -> egui::Button<'static> {
let mut button = egui::Button::new(self.text());
if let Some(shortcut) = self.kb_shortcut() {
button = button.shortcut_text(egui_ctx.format_shortcut(&shortcut));
Expand Down
2 changes: 2 additions & 0 deletions crates/re_ui/src/design_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ fn apply_design_tokens(ctx: &egui::Context) -> DesignTokens {
// don't color hyperlinks #2733
egui_style.visuals.hyperlink_color = default;

egui_style.image_loading_spinners = false;

ctx.set_style(egui_style);

DesignTokens {
Expand Down
6 changes: 6 additions & 0 deletions crates/re_ui/src/icons.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use egui::{Image, ImageSource};

#[derive(Clone, Copy, Debug)]
pub struct Icon {
/// Human readable unique id
Expand All @@ -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> {
Image::new(ImageSource::Bytes(self.id.into(), self.png_bytes.into()))
}
}

pub const RERUN_MENU: Icon =
Expand Down
Loading

0 comments on commit ffac4c7

Please sign in to comment.