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

Introduce container icons and update space views and UI icons #4663

Merged
merged 3 commits into from
Jan 3, 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
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 @@ -26,7 +26,7 @@ impl SpaceViewClass for DataframeSpaceView {

fn icon(&self) -> &'static re_ui::Icon {
//TODO(ab): fix that icon
&re_ui::icons::SPACE_VIEW_TEXTBOX
&re_ui::icons::SPACE_VIEW_DATAFRAME
}

fn help_text(&self, _re_ui: &re_ui::ReUi) -> egui::WidgetText {
Expand Down
2 changes: 1 addition & 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 @@ -52,7 +52,7 @@ impl SpaceViewClass for TextDocumentSpaceView {
const DISPLAY_NAME: &'static str = "Text Document";

fn icon(&self) -> &'static re_ui::Icon {
&re_ui::icons::SPACE_VIEW_TEXTBOX
&re_ui::icons::SPACE_VIEW_TEXT
}

fn help_text(&self, _re_ui: &re_ui::ReUi) -> egui::WidgetText {
Expand Down
2 changes: 1 addition & 1 deletion crates/re_space_view_text_log/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl SpaceViewClass for TextSpaceView {
const DISPLAY_NAME: &'static str = "Text Log";

fn icon(&self) -> &'static re_ui::Icon {
&re_ui::icons::SPACE_VIEW_TEXTBOX
&re_ui::icons::SPACE_VIEW_LOG
}

fn help_text(&self, _re_ui: &re_ui::ReUi) -> egui::WidgetText {
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 @@ -46,7 +46,7 @@ impl SpaceViewClass for TimeSeriesSpaceView {
const DISPLAY_NAME: &'static str = "Time Series";

fn icon(&self) -> &'static re_ui::Icon {
&re_ui::icons::SPACE_VIEW_CHART
&re_ui::icons::SPACE_VIEW_TIMESERIES
}

fn help_text(&self, re_ui: &re_ui::ReUi) -> egui::WidgetText {
Expand Down
Binary file modified crates/re_ui/data/icons/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/arrow_left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/arrow_right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/re_ui/data/icons/container_grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/re_ui/data/icons/container_horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/re_ui/data/icons/container_tabs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/re_ui/data/icons/container_vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/external_link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/follow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/invisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/loop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/maximize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/minimize.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/reset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/spaceview_2d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/spaceview_3d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed crates/re_ui/data/icons/spaceview_chart.png
Binary file not shown.
Binary file added crates/re_ui/data/icons/spaceview_dataframe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/re_ui/data/icons/spaceview_generic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified crates/re_ui/data/icons/spaceview_histogram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added crates/re_ui/data/icons/spaceview_log.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed crates/re_ui/data/icons/spaceview_raw.png
Diff not rendered.
Binary file removed crates/re_ui/data/icons/spaceview_scatterplot.png
Diff not rendered.
Binary file modified crates/re_ui/data/icons/spaceview_tensor.png
Binary file modified crates/re_ui/data/icons/spaceview_text.png
Binary file added crates/re_ui/data/icons/spaceview_timeseries.png
Binary file modified crates/re_ui/data/icons/spaceview_unknown.png
Binary file modified crates/re_ui/data/icons/visible.png
54 changes: 35 additions & 19 deletions crates/re_ui/src/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,23 @@ pub const EXTERNAL_LINK: Icon = Icon::new(
);
pub const DISCORD: Icon = Icon::new("discord", include_bytes!("../data/icons/discord.png"));

pub const SPACE_VIEW_TEXT: Icon = Icon::new(
"spaceview_text",
include_bytes!("../data/icons/spaceview_text.png"),
pub const CONTAINER_HORIZONTAL: Icon = Icon::new(
"container_horizontal",
include_bytes!("../data/icons/container_horizontal.png"),
);
// TODO(jleibs): Differentiate icon?
pub const SPACE_VIEW_TEXTBOX: Icon = Icon::new(
"spaceview_text",
include_bytes!("../data/icons/spaceview_text.png"),
pub const CONTAINER_GRID: Icon = Icon::new(
"container_grid",
include_bytes!("../data/icons/container_grid.png"),
);
pub const CONTAINER_TABS: Icon = Icon::new(
"container_tabs",
include_bytes!("../data/icons/container_tabs.png"),
);
pub const CONTAINER_VERTICAL: Icon = Icon::new(
"container_vertical",
include_bytes!("../data/icons/container_vertical.png"),
);

pub const SPACE_VIEW_2D: Icon = Icon::new(
"spaceview_2d",
include_bytes!("../data/icons/spaceview_2d.png"),
Expand All @@ -90,25 +98,33 @@ pub const SPACE_VIEW_3D: Icon = Icon::new(
"spaceview_3d",
include_bytes!("../data/icons/spaceview_3d.png"),
);
pub const SPACE_VIEW_CHART: Icon = Icon::new(
"spaceview_chart",
include_bytes!("../data/icons/spaceview_chart.png"),
pub const SPACE_VIEW_DATAFRAME: Icon = Icon::new(
"spaceview_dataframe",
include_bytes!("../data/icons/spaceview_dataframe.png"),
);
pub const SPACE_VIEW_SCATTERPLOT: Icon = Icon::new(
"spaceview_scatterplot",
include_bytes!("../data/icons/spaceview_scatterplot.png"),
pub const SPACE_VIEW_GENERIC: Icon = Icon::new(
"spaceview_unknown",
include_bytes!("../data/icons/spaceview_generic.png"),
);
pub const SPACE_VIEW_RAW: Icon = Icon::new(
"spaceview_raw",
include_bytes!("../data/icons/spaceview_raw.png"),
pub const SPACE_VIEW_HISTOGRAM: Icon = Icon::new(
"spaceview_histogram",
include_bytes!("../data/icons/spaceview_histogram.png"),
);
pub const SPACE_VIEW_LOG: Icon = Icon::new(
"spaceview_text",
include_bytes!("../data/icons/spaceview_log.png"),
);
pub const SPACE_VIEW_TENSOR: Icon = Icon::new(
"spaceview_tensor",
include_bytes!("../data/icons/spaceview_tensor.png"),
);
pub const SPACE_VIEW_HISTOGRAM: Icon = Icon::new(
"spaceview_histogram",
include_bytes!("../data/icons/spaceview_histogram.png"),
pub const SPACE_VIEW_TEXT: Icon = Icon::new(
"spaceview_text",
include_bytes!("../data/icons/spaceview_text.png"),
);
pub const SPACE_VIEW_TIMESERIES: Icon = Icon::new(
"spaceview_chart",
include_bytes!("../data/icons/spaceview_timeseries.png"),
);
pub const SPACE_VIEW_UNKNOWN: Icon = Icon::new(
"spaceview_unknown",
Expand Down
4 changes: 2 additions & 2 deletions crates/re_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ impl ReUi {
}

pub fn small_icon_size() -> egui::Vec2 {
egui::Vec2::splat(12.0)
egui::Vec2::splat(14.0)
}

pub fn setup_table_header(_header: &mut egui_extras::TableRow<'_, '_>) {}
Expand Down Expand Up @@ -379,7 +379,7 @@ impl ReUi {
}

let button_size = Vec2::splat(28.0);
let icon_size = Vec2::splat(12.0); // centered inside the button
let icon_size = ReUi::small_icon_size(); // centered inside the button
let rounding = 6.0;

let (rect, response) = ui.allocate_exact_size(button_size, egui::Sense::click());
Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fn what_is_selected_ui(
ctx.re_ui,
ui,
&format!("{:?}", container.kind()),
None,
Some(re_viewport::icon_for_container_kind(&container.kind())),
&format!("{:?} container", container.kind()),
);
}
Expand Down
4 changes: 3 additions & 1 deletion crates/re_viewer_context/src/space_view/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ pub trait SpaceViewClass: std::marker::Sized + Send + Sync {
}

/// Icon used to identify this space view class.
fn icon(&self) -> &'static re_ui::Icon;
fn icon(&self) -> &'static re_ui::Icon {
&re_ui::icons::SPACE_VIEW_GENERIC
}

/// Help text describing how to interact with this space view in the ui.
fn help_text(&self, re_ui: &re_ui::ReUi) -> egui::WidgetText;
Expand Down
10 changes: 10 additions & 0 deletions crates/re_viewport/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,13 @@ pub fn determine_visualizable_entities(
.collect(),
)
}

/// Determines the icon to use for a given container kind.
pub fn icon_for_container_kind(kind: &egui_tiles::ContainerKind) -> &'static re_ui::Icon {
match kind {
egui_tiles::ContainerKind::Tabs => &re_ui::icons::CONTAINER_TABS,
egui_tiles::ContainerKind::Horizontal => &re_ui::icons::CONTAINER_HORIZONTAL,
egui_tiles::ContainerKind::Vertical => &re_ui::icons::CONTAINER_VERTICAL,
egui_tiles::ContainerKind::Grid => &re_ui::icons::CONTAINER_GRID,
}
}
2 changes: 1 addition & 1 deletion crates/re_viewport/src/viewport_blueprint_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ impl Viewport<'_, '_> {
let default_open = true;

let response = ListItem::new(ctx.re_ui, format!("{:?}", container.kind()))
.subdued(true)
.selected(ctx.selection().contains_item(&item))
.with_icon(crate::icon_for_container_kind(&container.kind()))
.with_buttons(|re_ui, ui| {
let vis_response = visibility_button_ui(re_ui, ui, true, &mut visible);
visibility_changed = vis_response.changed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl SpaceViewClass for ColorCoordinatesSpaceView {
const DISPLAY_NAME: &'static str = "Color Coordinates";

fn icon(&self) -> &'static re_ui::Icon {
&re_ui::icons::SPACE_VIEW_SCATTERPLOT
&re_ui::icons::SPACE_VIEW_GENERIC
}

fn help_text(&self, _re_ui: &re_ui::ReUi) -> egui::WidgetText {
Expand Down
Loading