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 egui master #6448

Merged
merged 21 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
429 changes: 245 additions & 184 deletions Cargo.lock

Large diffs are not rendered by default.

29 changes: 13 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,11 @@ eframe = { version = "0.27.2", default-features = false, features = [
] }
egui = { version = "0.27.2", features = [
"callstack",
"extra_debug_asserts",
"log",
"puffin",
"rayon",
] }
egui_commonmark = { version = "0.15", default-features = false }
egui_commonmark = { version = "0.16", default-features = false }
egui_extras = { version = "0.27.2", features = ["http", "image", "puffin"] }
egui_plot = "0.27.2"
egui_tiles = "0.8.0"
Expand Down Expand Up @@ -145,13 +144,13 @@ glam = "0.22" # glam update blocked by macaw
glob = "0.3"
gltf = "1.1"
half = "2.3.1"
image = { version = "0.24", default-features = false }
image = { version = "0.25", default-features = false }
indent = "0.1"
indexmap = "2.1" # Version chosen to align with other dependencies
indicatif = "0.17.7" # Progress bar
infer = "0.15" # infer MIME type by checking the magic number signaturefer MIME type by checking the magic number signature
insta = "1.23"
itertools = "0.12" # updating itertools is blocked on the next egui_tiles update
itertools = "0.13"
js-sys = "0.3"
libc = "0.2"
linked-hash-map = { version = "0.5", default-features = false }
Expand Down Expand Up @@ -239,7 +238,7 @@ wasm-bindgen-cli-support = "0.2.89"
wasm-bindgen-futures = "0.4.33"
web-sys = "0.3"
web-time = "0.2.0"
webbrowser = "0.8"
webbrowser = "1.0"
winit = { version = "0.29.9", default-features = false }
# TODO(andreas): Try to get rid of `fragile-send-sync-non-atomic-wasm`. This requires re_renderer being aware of single-thread restriction on resources.
# See also https://gpuweb.github.io/gpuweb/explainer/#multithreading-transfer (unsolved part of the Spec as of writing!)
Expand All @@ -260,8 +259,6 @@ wgpu = { version = "0.19.4", default-features = false, features = [
wgpu-core = "0.19.4"
xshell = "0.2"
zip = { version = "0.6", default-features = false }
zune-core = "0.4"
zune-jpeg = "0.4"


[profile.dev]
Expand Down Expand Up @@ -455,13 +452,13 @@ missing_errors_doc = "allow"
# As a last resport, patch with a commit to our own repository.
# ALWAYS document what PR the commit hash is part of, or when it was merged into the upstream trunk.

# ecolor = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
# eframe = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
# egui = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
# egui_extras = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
# egui_plot = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
# egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
# emath = { git = "https://github.com/emilk/egui.git", rev = "8a10f81ca01b2ba4e0bd6e08d02fdd2063f1ddcc" } # egui master 2024-03-26
ecolor = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28
eframe = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28
egui = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28
egui_extras = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28
egui_plot = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28
egui-wgpu = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28
emath = { git = "https://github.com/emilk/egui.git", rev = "54429e0549e829c64b8de1b66f846fdf1a7ee37c" } # egui master 2024-05-28

# Useful while developing:
# ecolor = { path = "../../egui/crates/ecolor" }
Expand All @@ -472,6 +469,6 @@ missing_errors_doc = "allow"
# egui-wgpu = { path = "../../egui/crates/egui-wgpu" }
# emath = { path = "../../egui/crates/emath" }

# egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "5245a28df8a3a5befd0c55085de4f7044a6d831e" } # main 2024-02-27, which works with egui master
egui_tiles = { git = "https://github.com/rerun-io/egui_tiles", rev = "7a9ef17dd873efc2c803a0a91a64246ab1a2fa83" } # main 2024-05-28, which works with egui master

# egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "3d83a92f995a1d18ab1172d0b129d496e0eedaae" } # Update to egui 0.25 https://github.com/lampsitter/egui_commonmark/pull/27
egui_commonmark = { git = "https://github.com/rerun-io/egui_commonmark", rev = "1c08d5ea58d60c6a61487b5eecefdfdb35c47036" } # https://github.com/lampsitter/egui_commonmark/pull/51
2 changes: 1 addition & 1 deletion crates/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ pub fn component_path_button_to(
let response = response.on_hover_ui(|ui| {
// TODO(egui#4471): better tooltip size management
ui.set_max_width(250.0);
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);

// wrap lone item
list_item::list_item_scope(ui, "component_path_tooltip", |ui| {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_data_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ pub fn label_for_ui_layout(
let mut label = egui::Label::new(text);

match ui_layout {
UiLayout::List => label = label.truncate(true),
UiLayout::List => label = label.truncate(),
UiLayout::Tooltip | UiLayout::SelectionPanelLimitHeight | UiLayout::SelectionPanelFull => {
label = label.wrap(true);
label = label.wrap();
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/re_edit_ui/src/corner2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn edit_corner2d(
egui::ComboBox::from_id_source("corner2d")
.selected_text(format!("{corner}"))
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

ui.selectable_value(
Expand Down
8 changes: 2 additions & 6 deletions crates/re_edit_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ fn edit_scatter_ui(
egui::ComboBox::from_id_source("scatter")
.selected_text(scattered_text)
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.selectable_value(&mut edit_scatter, false, "Line");
ui.selectable_value(&mut edit_scatter, true, "Scattered");
});
Expand Down Expand Up @@ -277,11 +277,7 @@ fn edit_marker_shape_ui(
// workaround to force `ui.max_rect()` to reflect the content size
ui.set_width(item_width);

let background_x_range = ui
.spacing()
.menu_margin
.expand_rect(ui.max_rect())
.x_range();
let background_x_range = (ui.max_rect() + ui.spacing().menu_margin).x_range();

let list_ui = |ui: &mut egui::Ui| {
for marker in MarkerShape::ALL {
Expand Down
2 changes: 0 additions & 2 deletions crates/re_log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ pub mod external {

/// Never log anything less serious than a `ERROR` from these crates.
const CRATES_AT_ERROR_LEVEL: &[&str] = &[
// Waiting for https://github.com/etemesi254/zune-image/issues/131 to be released
"zune_jpeg",
// silence rustls in release mode: https://github.com/rerun-io/rerun/issues/3104
#[cfg(not(debug_assertions))]
"rustls",
Expand Down
4 changes: 2 additions & 2 deletions crates/re_selection_panel/src/override_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ pub fn add_new_override(
let menu = ui
.menu_button("Add", |ui| {
opened = true;
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);

// Present the option to add new components for each component that doesn't
// already have an active override.
Expand Down Expand Up @@ -410,7 +410,7 @@ pub fn add_new_visualizer(
ui.add_enabled_ui(enabled, |ui| {
let menu = ui
.menu_button("Add", |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
opened = true;

if visualizer_options.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_selection_panel/src/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,7 @@ fn container_top_level_properties(
egui::ComboBox::from_id_source("container_grid_columns")
.selected_text(columns_to_string(&new_columns))
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

ui.selectable_value(&mut new_columns, None, columns_to_string(&None));
Expand Down Expand Up @@ -1043,7 +1043,7 @@ fn container_kind_selection_ui(
let selected_text = format!("{in_out_kind:?}");

re_ui::drop_down_menu(ui, "container_kind", min_width, selected_text, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);

static_assertions::const_assert_eq!(ContainerKind::ALL.len(), 4);
for (kind, icon) in [
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_bar_chart/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl SpaceViewClass for BarChartSpaceView {
egui::ComboBox::from_id_source("legend_corner")
.selected_text(corner.to_string())
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

ui.selectable_value(
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_dataframe/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl SpaceViewClass for DataframeSpaceView {
egui::ScrollArea::both()
.auto_shrink([false, false])
.show(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);

egui::Frame {
inner_margin: egui::Margin::same(5.0),
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_spatial/src/space_view_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ fn visual_bounds_ui(ctx: &ViewerContext<'_>, space_view_id: SpaceViewId, ui: &mu
.grid_left_hand_label(ui, "Visible bounds")
.on_hover_text(tooltip);
ui.vertical(|ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);

if let Some(bounds2d) = bounds2d_opt {
let rect = egui::Rect::from(*bounds2d);
Expand Down
6 changes: 3 additions & 3 deletions crates/re_space_view_spatial/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl SpatialSpaceViewState {
.grid_left_hand_label(ui, "Bounding box")
.on_hover_text("The bounding box encompassing all Entities in the view right now");
ui.vertical(|ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
let BoundingBox { min, max } = self.bounding_boxes.current;
ui.label(format!("x [{} - {}]", format_f32(min.x), format_f32(max.x),));
ui.label(format!("y [{} - {}]", format_f32(min.y), format_f32(max.y),));
Expand Down Expand Up @@ -211,7 +211,7 @@ fn size_ui(
egui::ComboBox::from_id_source("auto_size_mode")
.selected_text(mode)
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

ui.selectable_value(&mut mode, AutoSizeUnit::Auto, AutoSizeUnit::Auto)
Expand Down Expand Up @@ -392,7 +392,7 @@ pub fn screenshot_context_menu(
if _ctx.app_options.experimental_space_view_screenshots {
let mut take_screenshot = None;
_response.context_menu(|ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
if ui.button("Save screenshot to disk").clicked() {
take_screenshot = Some(ScreenshotMode::SaveAndCopyToClipboard);
ui.close_menu();
Expand Down
4 changes: 2 additions & 2 deletions crates/re_space_view_tensor/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ impl TextureSettings {
egui::ComboBox::from_id_source("texture_scaling")
.selected_text(scaling.to_string())
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

let mut selectable_value =
Expand All @@ -501,7 +501,7 @@ impl TextureSettings {
egui::ComboBox::from_id_source("texture_filter")
.selected_text(tf_to_string(options.magnification))
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

let mut selectable_value = |ui: &mut egui::Ui, e| {
Expand Down
6 changes: 5 additions & 1 deletion crates/re_space_view_text_document/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ impl SpaceViewClass for TextDocumentSpaceView {
text = text.monospace();
}

ui.add(Label::new(text).wrap(state.word_wrap));
ui.add(Label::new(text).wrap_mode(if state.word_wrap {
egui::TextWrapMode::Wrap
} else {
egui::TextWrapMode::Extend
}));
} else {
// TODO(jleibs): better handling for multiple results
ui.label(format!(
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_time_series/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl SpaceViewClass for TimeSeriesSpaceView {
egui::ComboBox::from_id_source("aggregation_mode")
.selected_text(agg_mode.to_string())
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

for variant in TimeSeriesAggregator::variants() {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl TimePanel {
let size = egui::vec2(self.prev_col_width, 28.0);
ui.allocate_ui_with_layout(size, egui::Layout::top_down(egui::Align::LEFT), |ui| {
ui.set_min_size(size);
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.add_space(4.0); // hack to vertically center the text
if self.source == TimePanelSource::Blueprint {
ui.strong("Blueprint Streams");
Expand Down
2 changes: 1 addition & 1 deletion crates/re_time_panel/src/time_control_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl TimeControlUi {
egui::ComboBox::from_id_source("timeline")
.selected_text(time_control.timeline().name().as_str())
.show_ui(ui, |ui| {
ui.style_mut().wrap = Some(false);
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.set_min_width(64.0);

for timeline in times_per_timeline.timelines() {
Expand Down
8 changes: 4 additions & 4 deletions crates/re_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ egui_plot = ["dep:egui_plot"]
glam = ["dep:glam"]

## Integration with the [`image`](https://crates.io/crates/image/) crate, plus JPEG support.
image = ["dep:ecolor", "dep:image", "dep:zune-core", "dep:zune-jpeg"]
image = ["dep:ecolor", "dep:image"]

## Enable (de)serialization using serde.
serde = ["dep:serde"]
Expand Down Expand Up @@ -81,11 +81,11 @@ uuid = { workspace = true, features = ["serde", "v4", "js"] }
ecolor = { workspace = true, optional = true }
egui_plot = { workspace = true, optional = true }
glam = { workspace = true, optional = true }
image = { workspace = true, optional = true, default-features = false }
image = { workspace = true, optional = true, default-features = false, features = [
"jpeg",
] }
mint = { workspace = true, optional = true }
serde = { workspace = true, optional = true, features = ["derive", "rc"] }
zune-core = { workspace = true, optional = true }
zune-jpeg = { workspace = true, optional = true }


[dev-dependencies]
Expand Down
14 changes: 6 additions & 8 deletions crates/re_types/src/datatypes/tensor_data_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,19 +647,17 @@ impl TensorData {
pub fn from_jpeg_bytes(jpeg_bytes: Vec<u8>) -> Result<Self, TensorImageLoadError> {
re_tracing::profile_function!();

use zune_jpeg::JpegDecoder;

let mut decoder = JpegDecoder::new(&jpeg_bytes);
decoder.decode_headers()?;
let (w, h) = decoder
.dimensions()
.expect("can't fail after a successful decode_headers");
// Parse JPEG header:
use image::ImageDecoder as _;
let jpeg = image::codecs::jpeg::JpegDecoder::new(std::io::Cursor::new(&jpeg_bytes))?;
let (w, h) = jpeg.dimensions();
let depth = jpeg.color_type().channel_count();

Ok(Self {
shape: vec![
TensorDimension::height(h as _),
TensorDimension::width(w as _),
TensorDimension::depth(3),
TensorDimension::depth(depth as _),
],
buffer: TensorBuffer::Jpeg(jpeg_bytes.into()),
})
Expand Down
Loading
Loading