diff --git a/Cargo.lock b/Cargo.lock index edb9d224712c..572e01a82c89 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1254,7 +1254,7 @@ checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" [[package]] name = "ecolor" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "bytemuck", "serde", @@ -1263,7 +1263,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "bytemuck", "directories-next", @@ -1288,7 +1288,7 @@ dependencies = [ [[package]] name = "egui" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "accesskit", "ahash 0.8.2", @@ -1311,7 +1311,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "bytemuck", "egui", @@ -1326,7 +1326,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "arboard", "egui", @@ -1351,7 +1351,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "egui", "serde", @@ -1361,7 +1361,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "bytemuck", "egui", @@ -1383,7 +1383,7 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "emath" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "bytemuck", "serde", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.19.0" -source = "git+https://github.com/emilk/egui?rev=5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef#5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" +source = "git+https://github.com/emilk/egui?rev=da0a1787019cb28c26e969bc537a191f2ed302f3#da0a1787019cb28c26e969bc537a191f2ed302f3" dependencies = [ "ab_glyph", "ahash 0.8.2", diff --git a/Cargo.toml b/Cargo.toml index f4c6054e88b2..138a68e2632d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,15 +25,16 @@ opt-level = 2 debug = true [patch.crates-io] -# 2022-12-06 - Split out ecolor crate -eframe = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } -egui = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } -egui_extras = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } -egui-wgpu = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } -emath = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } -epaint = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } -ecolor = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef" } - +# 2022-12-08 - egui style tweaks +ecolor = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +eframe = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +egui = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +egui_extras = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +egui-wgpu = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +emath = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } +epaint = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3" } + +# ecolor = { path = "../../egui/crates/ecolor" } # eframe = { path = "../../egui/crates/eframe" } # egui = { path = "../../egui/crates/egui" } # egui_extras = { path = "../../egui/crates/egui_extras" } diff --git a/crates/re_renderer/Cargo.toml b/crates/re_renderer/Cargo.toml index a50842dfba93..96bd2e604a33 100644 --- a/crates/re_renderer/Cargo.toml +++ b/crates/re_renderer/Cargo.toml @@ -21,7 +21,7 @@ anyhow = "1.0" bitflags = "1.3" bytemuck = { version = "1.12", features = ["derive"] } clean-path = "0.2" -ecolor = { git = "https://github.com/emilk/egui", rev = "5effc68ba4f6dc0f9f9792193bb6e0eeca6dccef", features = [ +ecolor = { git = "https://github.com/emilk/egui", rev = "da0a1787019cb28c26e969bc537a191f2ed302f3", features = [ "bytemuck", ] } # TODO(andreas): point to published version once out. glam = { version = "0.20", features = [ diff --git a/crates/re_tensor_ops/src/dimension_mapping.rs b/crates/re_tensor_ops/src/dimension_mapping.rs index f2c7fcc11b21..d3975f4ff6f4 100644 --- a/crates/re_tensor_ops/src/dimension_mapping.rs +++ b/crates/re_tensor_ops/src/dimension_mapping.rs @@ -1,5 +1,3 @@ -use re_log_types::Tensor; - #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] pub struct DimensionMapping { /// Which dimensions have selectors? @@ -22,15 +20,30 @@ pub struct DimensionMapping { } impl DimensionMapping { - pub fn create(tensor: &Tensor) -> DimensionMapping { + pub fn create(num_dim: usize) -> DimensionMapping { // TODO(emilk): add a heuristic here for the default DimensionMapping { width: Some(1), height: Some(0), channel: None, - selectors: (2..tensor.num_dim()).collect(), + selectors: (2..num_dim).collect(), invert_width: false, invert_height: false, } } + + /// Protect against old serialized data that is not up-to-date with the new tensor + pub fn is_valid(&self, num_dim: usize) -> bool { + fn is_valid(dim_selector: &Option, num_dim: usize) -> bool { + if let Some(dim) = dim_selector { + *dim < num_dim + } else { + true + } + } + + is_valid(&self.width, num_dim) + && is_valid(&self.height, num_dim) + && is_valid(&self.channel, num_dim) + } } diff --git a/crates/re_ui/data/design_tokens.json b/crates/re_ui/data/design_tokens.json index 35389535d3ab..1414fd920635 100644 --- a/crates/re_ui/data/design_tokens.json +++ b/crates/re_ui/data/design_tokens.json @@ -7,9 +7,9 @@ "value": "{Global.Color.Grey.100}", "type": "color" }, - "Topbar": { - "description": "Background color for the top bar of the window", - "value": "{Global.Color.Grey.0}", + "Floating": { + "description": "Background color for floating elements like menus, dropdown options, notifications etc.", + "value": "{Global.Color.Grey.175}", "type": "color" } }, @@ -21,6 +21,28 @@ }, "Hovered": { "description": "Background color for hovered UI elements", + "value": "{Global.Color.Grey.225}", + "type": "color" + }, + "Active": { + "description": "Background color for pressed UI elements", + "value": "{Global.Color.Grey.250}", + "type": "color" + }, + "Pressed": { + "description": "Background color for supressed UI elements, like a select that is currently showing a menu", + "value": "{Global.Color.Grey.250}", + "type": "color" + } + }, + "NotificationBadge": { + "Unread": { + "description": "Used for unread notification indicators", + "value": "{Global.Color.Blue.500}", + "type": "color" + }, + "Read": { + "description": "Used for read notification indicators", "value": "{Global.Color.Grey.250}", "type": "color" } @@ -28,12 +50,12 @@ "Text": { "Default": { "description": "Default text color", - "value": "{Global.Color.Grey.900}", + "value": "{Global.Color.Grey.775}", "type": "color" }, "Subdued": { "description": "Used for less important text", - "value": "{Global.Color.Grey.700}", + "value": "{Global.Color.Grey.550}", "type": "color" }, "Strong": { @@ -51,8 +73,25 @@ }, "Icon": { "Default": { - "value": "{Global.Color.Grey.400}", - "description": "Default color for icons", + "description": "Default icon color", + "value": "{Global.Color.Grey.775}", + "type": "color" + }, + "Subdued": { + "description": "Used together with subdued text", + "value": "{Global.Color.Grey.550}", + "type": "color" + }, + "Strong": { + "description": "Used together width strong text", + "value": "{Global.Color.Grey.1000}", + "type": "color" + } + }, + "Highlight": { + "Default": { + "value": "{Global.Color.Blue.350}", + "description": "Default color for highlighted items, like hovered menu items", "type": "color" } } @@ -87,428 +126,1035 @@ "Grey": { "0": { "value": "#000000", - "description": "", + "description": "0 - 0", + "type": "color" + }, + "25": { + "value": "#020303", + "description": "0.7405999850077014 - 0.025", "type": "color" }, "50": { - "value": "#0f1112", - "description": "", + "value": "#050607", + "description": "1.7116872276823336 - 0.05", + "type": "color" + }, + "75": { + "value": "#090b0c", + "description": "2.911127985087129 - 0.075", "type": "color" }, "100": { - "value": "#191c1d", - "description": "", + "value": "#0d1011", + "description": "4.335380638931743 - 0.1", + "type": "color" + }, + "125": { + "value": "#111415", + "description": "5.979517530826747 - 0.125", "type": "color" }, "150": { - "value": "#222627", - "description": "", + "value": "#141819", + "description": "7.837255342936205 - 0.15", + "type": "color" + }, + "175": { + "value": "#181c1e", + "description": "9.90099383672154 - 0.175", "type": "color" }, "200": { - "value": "#2c3032", - "description": "", + "value": "#1c2123", + "description": "12.16186271093947 - 0.2", + "type": "color" + }, + "225": { + "value": "#212628", + "description": "14.609776289998841 - 0.225", "type": "color" }, "250": { - "value": "#363b3d", - "description": "", + "value": "#262b2e", + "description": "17.233495705504463 - 0.25", + "type": "color" + }, + "275": { + "value": "#2b3134", + "description": "20.02069818761812 - 0.275", "type": "color" }, "300": { - "value": "#404649", - "description": "", + "value": "#31383b", + "description": "22.958053039032254 - 0.3", + "type": "color" + }, + "325": { + "value": "#373f42", + "description": "26.03130382315192 - 0.325", "type": "color" }, "350": { - "value": "#4b5255", - "description": "", + "value": "#3e464a", + "description": "29.22535625976699 - 0.35", + "type": "color" + }, + "375": { + "value": "#454e52", + "description": "32.524371286309126 - 0.375", "type": "color" }, "400": { - "value": "#565e61", - "description": "", + "value": "#4c565a", + "description": "35.91186271093947 - 0.4", + "type": "color" + }, + "425": { + "value": "#545e63", + "description": "39.37079885540354 - 0.425", "type": "color" }, "450": { - "value": "#616a6d", - "description": "", + "value": "#5c676c", + "description": "42.88370756099135 - 0.45", + "type": "color" + }, + "475": { + "value": "#647075", + "description": "46.43278391020581 - 0.475", "type": "color" }, "500": { - "value": "#6d767a", - "description": "", + "value": "#6c797f", + "description": "49.99999999999999 - 0.5", + "type": "color" + }, + "525": { + "value": "#748288", + "description": "53.56721608979418 - 0.525", "type": "color" }, "550": { - "value": "#788387", - "description": "", + "value": "#7d8c92", + "description": "57.11629243900867 - 0.55", + "type": "color" + }, + "575": { + "value": "#85959c", + "description": "60.62920114459644 - 0.575", "type": "color" }, "600": { - "value": "#848f94", - "description": "", + "value": "#8e9ea5", + "description": "64.08813728906053 - 0.6", + "type": "color" + }, + "625": { + "value": "#96a7af", + "description": "67.47562871369087 - 0.625", "type": "color" }, "650": { - "value": "#909ca2", - "description": "", + "value": "#9eb0b8", + "description": "70.774643740233 - 0.65", + "type": "color" + }, + "675": { + "value": "#a6b9c1", + "description": "73.96869617684807 - 0.675", "type": "color" }, "700": { - "value": "#9caaaf", - "description": "", + "value": "#aec2ca", + "description": "77.04194696096773 - 0.7", + "type": "color" + }, + "725": { + "value": "#b6cad2", + "description": "79.97930181238189 - 0.725", "type": "color" }, "750": { - "value": "#a9b7bd", - "description": "", + "value": "#c0d1d8", + "description": "82.76650429449552 - 0.75", + "type": "color" + }, + "775": { + "value": "#cad8de", + "description": "85.39022371000115 - 0.775", "type": "color" }, "800": { - "value": "#b6c4cb", - "description": "", + "value": "#d3dee3", + "description": "87.83813728906054 - 0.8", + "type": "color" + }, + "825": { + "value": "#dbe4e8", + "description": "90.09900616327847 - 0.825", "type": "color" }, "850": { - "value": "#c6d2d7", - "description": "", + "value": "#e3eaed", + "description": "92.16274465706378 - 0.85", + "type": "color" + }, + "875": { + "value": "#e9eff1", + "description": "94.02048246917325 - 0.875", "type": "color" }, "900": { - "value": "#d6dfe3", - "description": "", + "value": "#eff3f5", + "description": "95.66461936106825 - 0.9", + "type": "color" + }, + "925": { + "value": "#f4f7f8", + "description": "97.08887201491288 - 0.925", "type": "color" }, "950": { - "value": "#e7ecee", - "description": "", + "value": "#f9fafb", + "description": "98.28831277231767 - 0.95", + "type": "color" + }, + "975": { + "value": "#fcfdfd", + "description": "99.25940001499231 - 0.975", "type": "color" }, "1000": { - "value": "#f8f9fa", - "description": "", + "value": "#ffffff", + "description": "100 - 1", "type": "color" } }, "Green": { "0": { "value": "#000000", - "description": "", + "description": "0 - 0", + "type": "color" + }, + "25": { + "value": "#000401", + "description": "0.7405999850077014 - 0.025", "type": "color" }, "50": { - "value": "#00140c", - "description": "", + "value": "#000803", + "description": "1.7116872276823336 - 0.05", + "type": "color" + }, + "75": { + "value": "#000e04", + "description": "2.911127985087129 - 0.075", "type": "color" }, "100": { - "value": "#002014", - "description": "", + "value": "#001306", + "description": "4.335380638931743 - 0.1", + "type": "color" + }, + "125": { + "value": "#001809", + "description": "5.979517530826747 - 0.125", "type": "color" }, "150": { - "value": "#002c1d", - "description": "", + "value": "#001c0b", + "description": "7.837255342936205 - 0.15", + "type": "color" + }, + "175": { + "value": "#00210e", + "description": "9.90099383672154 - 0.175", "type": "color" }, "200": { - "value": "#003726", - "description": "", + "value": "#002611", + "description": "12.16186271093947 - 0.2", + "type": "color" + }, + "225": { + "value": "#002c15", + "description": "14.609776289998841 - 0.225", "type": "color" }, "250": { - "value": "#00432f", - "description": "", + "value": "#003219", + "description": "17.233495705504463 - 0.25", + "type": "color" + }, + "275": { + "value": "#00391d", + "description": "20.02069818761812 - 0.275", "type": "color" }, "300": { - "value": "#005038", - "description": "", + "value": "#004021", + "description": "22.958053039032254 - 0.3", + "type": "color" + }, + "325": { + "value": "#004826", + "description": "26.03130382315192 - 0.325", "type": "color" }, "350": { - "value": "#005d41", - "description": "", + "value": "#00502b", + "description": "29.22535625976699 - 0.35", + "type": "color" + }, + "375": { + "value": "#005930", + "description": "32.524371286309126 - 0.375", "type": "color" }, "400": { - "value": "#006a4b", - "description": "", + "value": "#006236", + "description": "35.91186271093947 - 0.4", + "type": "color" + }, + "425": { + "value": "#006b3b", + "description": "39.37079885540354 - 0.425", "type": "color" }, "450": { - "value": "#007755", - "description": "", + "value": "#007541", + "description": "42.88370756099135 - 0.45", + "type": "color" + }, + "475": { + "value": "#007f47", + "description": "46.43278391020581 - 0.475", "type": "color" }, "500": { - "value": "#00855f", - "description": "", + "value": "#00894d", + "description": "49.99999999999999 - 0.5", + "type": "color" + }, + "525": { + "value": "#009353", + "description": "53.56721608979418 - 0.525", "type": "color" }, "550": { - "value": "#00936a", - "description": "", + "value": "#009e5a", + "description": "57.11629243900867 - 0.55", + "type": "color" + }, + "575": { + "value": "#00a860", + "description": "60.62920114459644 - 0.575", "type": "color" }, "600": { - "value": "#00a174", - "description": "", + "value": "#00b266", + "description": "64.08813728906053 - 0.6", + "type": "color" + }, + "625": { + "value": "#00bc6c", + "description": "67.47562871369087 - 0.625", "type": "color" }, "650": { - "value": "#00b07f", - "description": "", + "value": "#00c772", + "description": "70.774643740233 - 0.65", + "type": "color" + }, + "675": { + "value": "#00d078", + "description": "73.96869617684807 - 0.675", "type": "color" }, "700": { - "value": "#00be8a", - "description": "", + "value": "#00da7e", + "description": "77.04194696096773 - 0.7", + "type": "color" + }, + "725": { + "value": "#00e384", + "description": "79.97930181238189 - 0.725", "type": "color" }, "750": { - "value": "#00cd95", - "description": "", + "value": "#00ec89", + "description": "82.76650429449552 - 0.75", + "type": "color" + }, + "775": { + "value": "#00f48e", + "description": "85.39022371000115 - 0.775", "type": "color" }, "800": { - "value": "#00dca1", - "description": "", + "value": "#00fc93", + "description": "87.83813728906054 - 0.8", + "type": "color" + }, + "825": { + "value": "#5cffa5", + "description": "90.09900616327847 - 0.825", "type": "color" }, "850": { - "value": "#00ecac", - "description": "", + "value": "#91ffbb", + "description": "92.16274465706378 - 0.85", + "type": "color" + }, + "875": { + "value": "#b2ffcd", + "description": "94.02048246917325 - 0.875", "type": "color" }, "900": { - "value": "#00fbb7", - "description": "", + "value": "#caffdc", + "description": "95.66461936106825 - 0.9", + "type": "color" + }, + "925": { + "value": "#ddffe8", + "description": "97.08887201491288 - 0.925", "type": "color" }, "950": { - "value": "#9bffd4", - "description": "", + "value": "#ebfff1", + "description": "98.28831277231767 - 0.95", + "type": "color" + }, + "975": { + "value": "#f7fff9", + "description": "99.25940001499231 - 0.975", "type": "color" }, "1000": { - "value": "#e7fff3", - "description": "", + "value": "#ffffff", + "description": "100 - 1", "type": "color" } }, "Red": { "0": { "value": "#000000", - "description": "", + "description": "0 - 0", + "type": "color" + }, + "25": { + "value": "#0c0001", + "description": "0.7405999850077014 - 0.025", "type": "color" }, "50": { - "value": "#260508", - "description": "", + "value": "#170003", + "description": "1.7116872276823336 - 0.05", + "type": "color" + }, + "75": { + "value": "#200005", + "description": "2.911127985087129 - 0.075", "type": "color" }, "100": { - "value": "#380a0f", - "description": "", + "value": "#290007", + "description": "4.335380638931743 - 0.1", + "type": "color" + }, + "125": { + "value": "#310009", + "description": "5.979517530826747 - 0.125", "type": "color" }, "150": { - "value": "#491016", - "description": "", + "value": "#38000c", + "description": "7.837255342936205 - 0.15", + "type": "color" + }, + "175": { + "value": "#40000f", + "description": "9.90099383672154 - 0.175", "type": "color" }, "200": { - "value": "#5b161d", - "description": "", + "value": "#480012", + "description": "12.16186271093947 - 0.2", + "type": "color" + }, + "225": { + "value": "#520016", + "description": "14.609776289998841 - 0.225", "type": "color" }, "250": { - "value": "#6d1d24", - "description": "", + "value": "#5c001a", + "description": "17.233495705504463 - 0.25", + "type": "color" + }, + "275": { + "value": "#67001e", + "description": "20.02069818761812 - 0.275", "type": "color" }, "300": { - "value": "#80232c", - "description": "", + "value": "#730022", + "description": "22.958053039032254 - 0.3", + "type": "color" + }, + "325": { + "value": "#800027", + "description": "26.03130382315192 - 0.325", "type": "color" }, "350": { - "value": "#932a34", - "description": "", + "value": "#8e002c", + "description": "29.22535625976699 - 0.35", + "type": "color" + }, + "375": { + "value": "#9c0031", + "description": "32.524371286309126 - 0.375", "type": "color" }, "400": { - "value": "#a7313c", - "description": "", + "value": "#ab0037", + "description": "35.91186271093947 - 0.4", + "type": "color" + }, + "425": { + "value": "#bb003d", + "description": "39.37079885540354 - 0.425", "type": "color" }, "450": { - "value": "#bc3845", - "description": "", + "value": "#cb0043", + "description": "42.88370756099135 - 0.45", + "type": "color" + }, + "475": { + "value": "#db0049", + "description": "46.43278391020581 - 0.475", "type": "color" }, "500": { - "value": "#d03f4d", - "description": "", + "value": "#ec004f", + "description": "49.99999999999999 - 0.5", + "type": "color" + }, + "525": { + "value": "#fd0056", + "description": "53.56721608979418 - 0.525", "type": "color" }, "550": { - "value": "#e44857", - "description": "", + "value": "#ff3865", + "description": "57.11629243900867 - 0.55", + "type": "color" + }, + "575": { + "value": "#ff5474", + "description": "60.62920114459644 - 0.575", "type": "color" }, "600": { - "value": "#e6636d", - "description": "", + "value": "#ff6981", + "description": "64.08813728906053 - 0.6", + "type": "color" + }, + "625": { + "value": "#ff7a8e", + "description": "67.47562871369087 - 0.625", "type": "color" }, "650": { - "value": "#e87981", - "description": "", + "value": "#ff8a9a", + "description": "70.774643740233 - 0.65", + "type": "color" + }, + "675": { + "value": "#ff99a6", + "description": "73.96869617684807 - 0.675", "type": "color" }, "700": { - "value": "#ea8e93", - "description": "", + "value": "#ffa6b1", + "description": "77.04194696096773 - 0.7", + "type": "color" + }, + "725": { + "value": "#ffb2bb", + "description": "79.97930181238189 - 0.725", "type": "color" }, "750": { - "value": "#eca1a5", - "description": "", + "value": "#ffbdc5", + "description": "82.76650429449552 - 0.75", + "type": "color" + }, + "775": { + "value": "#ffc8ce", + "description": "85.39022371000115 - 0.775", "type": "color" }, "800": { - "value": "#efb3b6", - "description": "", + "value": "#ffd1d6", + "description": "87.83813728906054 - 0.8", + "type": "color" + }, + "825": { + "value": "#ffdade", + "description": "90.09900616327847 - 0.825", "type": "color" }, "850": { - "value": "#f2c5c7", - "description": "", + "value": "#ffe2e5", + "description": "92.16274465706378 - 0.85", + "type": "color" + }, + "875": { + "value": "#ffe9eb", + "description": "94.02048246917325 - 0.875", "type": "color" }, "900": { - "value": "#f6d6d7", - "description": "", + "value": "#ffeff0", + "description": "95.66461936106825 - 0.9", + "type": "color" + }, + "925": { + "value": "#fff4f5", + "description": "97.08887201491288 - 0.925", "type": "color" }, "950": { - "value": "#f9e7e8", - "description": "", + "value": "#fff9f9", + "description": "98.28831277231767 - 0.95", + "type": "color" + }, + "975": { + "value": "#fffcfd", + "description": "99.25940001499231 - 0.975", "type": "color" }, "1000": { - "value": "#fdf8f8", - "description": "", + "value": "#ffffff", + "description": "100 - 1", "type": "color" } }, "Blue": { "0": { "value": "#000000", - "description": "", + "description": "0 - 0", + "type": "color" + }, + "25": { + "value": "#00020f", + "description": "0.7405999850077014 - 0.025", + "type": "color" + }, + "50": { + "value": "#00051c", + "description": "1.7116872276823336 - 0.05", + "type": "color" + }, + "75": { + "value": "#000826", + "description": "2.911127985087129 - 0.075", + "type": "color" + }, + "100": { + "value": "#000c30", + "description": "4.335380638931743 - 0.1", + "type": "color" + }, + "125": { + "value": "#001038", + "description": "5.979517530826747 - 0.125", + "type": "color" + }, + "150": { + "value": "#001441", + "description": "7.837255342936205 - 0.15", + "type": "color" + }, + "175": { + "value": "#001749", + "description": "9.90099383672154 - 0.175", + "type": "color" + }, + "200": { + "value": "#001b53", + "description": "12.16186271093947 - 0.2", + "type": "color" + }, + "225": { + "value": "#00205e", + "description": "14.609776289998841 - 0.225", + "type": "color" + }, + "250": { + "value": "#002569", + "description": "17.233495705504463 - 0.25", + "type": "color" + }, + "275": { + "value": "#002a76", + "description": "20.02069818761812 - 0.275", + "type": "color" + }, + "300": { + "value": "#003084", + "description": "22.958053039032254 - 0.3", + "type": "color" + }, + "325": { + "value": "#003692", + "description": "26.03130382315192 - 0.325", + "type": "color" + }, + "350": { + "value": "#003da1", + "description": "29.22535625976699 - 0.35", + "type": "color" + }, + "375": { + "value": "#0044b2", + "description": "32.524371286309126 - 0.375", + "type": "color" + }, + "400": { + "value": "#004bc2", + "description": "35.91186271093947 - 0.4", + "type": "color" + }, + "425": { + "value": "#0053d4", + "description": "39.37079885540354 - 0.425", + "type": "color" + }, + "450": { + "value": "#005ae6", + "description": "42.88370756099135 - 0.45", + "type": "color" + }, + "475": { + "value": "#0062f9", + "description": "46.43278391020581 - 0.475", + "type": "color" + }, + "500": { + "value": "#2a6cff", + "description": "49.99999999999999 - 0.5", + "type": "color" + }, + "525": { + "value": "#4676ff", + "description": "53.56721608979418 - 0.525", + "type": "color" + }, + "550": { + "value": "#5a81ff", + "description": "57.11629243900867 - 0.55", + "type": "color" + }, + "575": { + "value": "#6b8bff", + "description": "60.62920114459644 - 0.575", + "type": "color" + }, + "600": { + "value": "#7a95ff", + "description": "64.08813728906053 - 0.6", + "type": "color" + }, + "625": { + "value": "#899fff", + "description": "67.47562871369087 - 0.625", + "type": "color" + }, + "650": { + "value": "#96a8ff", + "description": "70.774643740233 - 0.65", + "type": "color" + }, + "675": { + "value": "#a2b2ff", + "description": "73.96869617684807 - 0.675", + "type": "color" + }, + "700": { + "value": "#adbbff", + "description": "77.04194696096773 - 0.7", + "type": "color" + }, + "725": { + "value": "#b8c3ff", + "description": "79.97930181238189 - 0.725", + "type": "color" + }, + "750": { + "value": "#c2ccff", + "description": "82.76650429449552 - 0.75", + "type": "color" + }, + "775": { + "value": "#ccd3ff", + "description": "85.39022371000115 - 0.775", + "type": "color" + }, + "800": { + "value": "#d4dbff", + "description": "87.83813728906054 - 0.8", + "type": "color" + }, + "825": { + "value": "#dce1ff", + "description": "90.09900616327847 - 0.825", + "type": "color" + }, + "850": { + "value": "#e4e7ff", + "description": "92.16274465706378 - 0.85", + "type": "color" + }, + "875": { + "value": "#eaedff", + "description": "94.02048246917325 - 0.875", + "type": "color" + }, + "900": { + "value": "#f0f2ff", + "description": "95.66461936106825 - 0.9", + "type": "color" + }, + "925": { + "value": "#f5f6ff", + "description": "97.08887201491288 - 0.925", + "type": "color" + }, + "950": { + "value": "#f9faff", + "description": "98.28831277231767 - 0.95", + "type": "color" + }, + "975": { + "value": "#fcfdff", + "description": "99.25940001499231 - 0.975", + "type": "color" + }, + "1000": { + "value": "#ffffff", + "description": "100 - 1", + "type": "color" + } + }, + "Purple": { + "0": { + "value": "#000000", + "description": "0 - 0", + "type": "color" + }, + "25": { + "value": "#060011", + "description": "0.7405999850077014 - 0.025", "type": "color" }, "50": { - "value": "#0e0f21", - "description": "", + "value": "#0e001e", + "description": "1.7116872276823336 - 0.05", + "type": "color" + }, + "75": { + "value": "#150029", + "description": "2.911127985087129 - 0.075", "type": "color" }, "100": { - "value": "#181931", - "description": "", + "value": "#1b0033", + "description": "4.335380638931743 - 0.1", + "type": "color" + }, + "125": { + "value": "#21003d", + "description": "5.979517530826747 - 0.125", "type": "color" }, "150": { - "value": "#212240", - "description": "", + "value": "#270046", + "description": "7.837255342936205 - 0.15", + "type": "color" + }, + "175": { + "value": "#2d004f", + "description": "9.90099383672154 - 0.175", "type": "color" }, "200": { - "value": "#2b2c50", - "description": "", + "value": "#330059", + "description": "12.16186271093947 - 0.2", + "type": "color" + }, + "225": { + "value": "#3a0065", + "description": "14.609776289998841 - 0.225", "type": "color" }, "250": { - "value": "#353661", - "description": "", + "value": "#420071", + "description": "17.233495705504463 - 0.25", + "type": "color" + }, + "275": { + "value": "#4b007e", + "description": "20.02069818761812 - 0.275", "type": "color" }, "300": { - "value": "#3f4172", - "description": "", + "value": "#54008d", + "description": "22.958053039032254 - 0.3", + "type": "color" + }, + "325": { + "value": "#5d009c", + "description": "26.03130382315192 - 0.325", "type": "color" }, "350": { - "value": "#494b83", - "description": "", + "value": "#6800ad", + "description": "29.22535625976699 - 0.35", + "type": "color" + }, + "375": { + "value": "#7200be", + "description": "32.524371286309126 - 0.375", "type": "color" }, "400": { - "value": "#555790", - "description": "", + "value": "#7e00d0", + "description": "35.91186271093947 - 0.4", + "type": "color" + }, + "425": { + "value": "#8a00e2", + "description": "39.37079885540354 - 0.425", "type": "color" }, "450": { - "value": "#62639b", - "description": "", + "value": "#9600f6", + "description": "42.88370756099135 - 0.45", + "type": "color" + }, + "475": { + "value": "#9e22ff", + "description": "46.43278391020581 - 0.475", "type": "color" }, "500": { - "value": "#6e70a4", - "description": "", + "value": "#a23eff", + "description": "49.99999999999999 - 0.5", + "type": "color" + }, + "525": { + "value": "#a752ff", + "description": "53.56721608979418 - 0.525", "type": "color" }, "550": { - "value": "#7b7dae", - "description": "", + "value": "#ac63ff", + "description": "57.11629243900867 - 0.55", + "type": "color" + }, + "575": { + "value": "#b273ff", + "description": "60.62920114459644 - 0.575", "type": "color" }, "600": { - "value": "#898ab6", - "description": "", + "value": "#b780ff", + "description": "64.08813728906053 - 0.6", + "type": "color" + }, + "625": { + "value": "#bd8eff", + "description": "67.47562871369087 - 0.625", "type": "color" }, "650": { - "value": "#9697bf", - "description": "", + "value": "#c39aff", + "description": "70.774643740233 - 0.65", + "type": "color" + }, + "675": { + "value": "#c9a5ff", + "description": "73.96869617684807 - 0.675", "type": "color" }, "700": { - "value": "#a4a5c7", - "description": "", + "value": "#cfb0ff", + "description": "77.04194696096773 - 0.7", + "type": "color" + }, + "725": { + "value": "#d4bbff", + "description": "79.97930181238189 - 0.725", "type": "color" }, "750": { - "value": "#b2b2d0", - "description": "", + "value": "#dac4ff", + "description": "82.76650429449552 - 0.75", + "type": "color" + }, + "775": { + "value": "#dfcdff", + "description": "85.39022371000115 - 0.775", "type": "color" }, "800": { - "value": "#c0c0d8", - "description": "", + "value": "#e4d6ff", + "description": "87.83813728906054 - 0.8", + "type": "color" + }, + "825": { + "value": "#e9ddff", + "description": "90.09900616327847 - 0.825", "type": "color" }, "850": { - "value": "#cecee1", - "description": "", + "value": "#eee4ff", + "description": "92.16274465706378 - 0.85", + "type": "color" + }, + "875": { + "value": "#f2ebff", + "description": "94.02048246917325 - 0.875", "type": "color" }, "900": { - "value": "#dcdce9", - "description": "", + "value": "#f5f0ff", + "description": "95.66461936106825 - 0.9", + "type": "color" + }, + "925": { + "value": "#f8f5ff", + "description": "97.08887201491288 - 0.925", "type": "color" }, "950": { - "value": "#eaebf2", - "description": "", + "value": "#fbf9ff", + "description": "98.28831277231767 - 0.95", + "type": "color" + }, + "975": { + "value": "#fdfcff", + "description": "99.25940001499231 - 0.975", "type": "color" }, "1000": { - "value": "#f9f9fb", - "description": "", + "value": "#ffffff", + "description": "100 - 1", "type": "color" } }, @@ -542,94 +1188,6 @@ }, "description": "", "type": "typography" - }, - "300": { - "value": { - "fontSize": "15px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "16px", - "letterSpacing": "-0.19px" - }, - "description": "", - "type": "typography" - }, - "400": { - "value": { - "fontSize": "19px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "20px", - "letterSpacing": "-0.23px" - }, - "description": "", - "type": "typography" - }, - "500": { - "value": { - "fontSize": "23px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "28px", - "letterSpacing": "-0.29px" - }, - "description": "", - "type": "typography" - }, - "600": { - "value": { - "fontSize": "29px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "32px", - "letterSpacing": "-0.37px" - }, - "description": "", - "type": "typography" - }, - "700": { - "value": { - "fontSize": "37px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "44px", - "letterSpacing": "-0.46px" - }, - "description": "", - "type": "typography" - }, - "800": { - "value": { - "fontSize": "46px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "52px", - "letterSpacing": "-0.57px" - }, - "description": "", - "type": "typography" - }, - "900": { - "value": { - "fontSize": "57px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "68px", - "letterSpacing": "-0.72px" - }, - "description": "", - "type": "typography" - }, - "1000": { - "value": { - "fontSize": "71.5px", - "fontWeight": "Medium", - "fontFamily": "Inter", - "lineHeight": "88px", - "letterSpacing": "-0.89px" - }, - "description": "", - "type": "typography" } }, "Shadow": { diff --git a/crates/re_ui/examples/re_ui_example.rs b/crates/re_ui/examples/re_ui_example.rs index 7293f8818be5..e2c7f5ef6670 100644 --- a/crates/re_ui/examples/re_ui_example.rs +++ b/crates/re_ui/examples/re_ui_example.rs @@ -15,28 +15,54 @@ fn main() { native_options, Box::new(move |cc| { let re_ui = re_ui::ReUi::load_and_apply(&cc.egui_ctx); - Box::new(ExampleApp { re_ui }) + Box::new(ExampleApp { + re_ui, + + left_panel: true, + right_panel: true, + bottom_panel: true, + }) }), ); } pub struct ExampleApp { re_ui: re_ui::ReUi, + + left_panel: bool, + right_panel: bool, + bottom_panel: bool, } impl eframe::App for ExampleApp { fn update(&mut self, egui_ctx: &egui::Context, frame: &mut eframe::Frame) { self.top_bar(egui_ctx, frame); + egui::SidePanel::left("left_panel").show_animated(egui_ctx, self.left_panel, |ui| { + ui.label("Left panel"); + }); + egui::SidePanel::right("right_panel").show_animated(egui_ctx, self.right_panel, |ui| { + ui.label("Right panel"); + selection_buttons(ui); + }); + egui::TopBottomPanel::bottom("bottom_panel").show_animated( + egui_ctx, + self.bottom_panel, + |ui| { + ui.label("Bottom panel"); + }, + ); + egui::CentralPanel::default().show(egui_ctx, |ui| { egui::warn_if_debug_build(ui); - ui.label("Hello world!"); + ui.label("Hover me for a tooltip") + .on_hover_text("This is a tooltip"); }); } } impl ExampleApp { - fn top_bar(&self, egui_ctx: &egui::Context, frame: &mut eframe::Frame) { + fn top_bar(&mut self, egui_ctx: &egui::Context, frame: &mut eframe::Frame) { let panel_frame = { egui::Frame { inner_margin: egui::style::Margin::symmetric(8.0, 2.0), @@ -68,6 +94,22 @@ impl ExampleApp { ui.set_height(top_bar_style.height); ui.add_space(top_bar_style.indent); + self.re_ui.medium_icon_toggle_button( + ui, + &re_ui::icons::LEFT_PANEL_TOGGLE, + &mut self.left_panel, + ); + self.re_ui.medium_icon_toggle_button( + ui, + &re_ui::icons::BOTTOM_PANEL_TOGGLE, + &mut self.bottom_panel, + ); + self.re_ui.medium_icon_toggle_button( + ui, + &re_ui::icons::RIGHT_PANEL_TOGGLE, + &mut self.right_panel, + ); + ui.centered_and_justified(|ui| { ui.strong("re_ui example app"); }) @@ -75,3 +117,38 @@ impl ExampleApp { }); } } + +fn selection_buttons(ui: &mut egui::Ui) { + use egui_extras::{Size, StripBuilder}; + + const BUTTON_SIZE: f32 = 20.0; + const MIN_COMBOBOX_SIZE: f32 = 100.0; + + ui.horizontal(|ui| { + StripBuilder::new(ui) + .cell_layout(egui::Layout::centered_and_justified( + egui::Direction::TopDown, // whatever + )) + .size(Size::exact(BUTTON_SIZE)) // prev + .size(Size::remainder().at_least(MIN_COMBOBOX_SIZE)) // browser + .size(Size::exact(BUTTON_SIZE)) // next + .horizontal(|mut strip| { + strip.cell(|ui| { + let _ = ui.small_button("⏴"); + }); + + strip.cell(|ui| { + egui::ComboBox::from_id_source("foo") + .width(ui.available_width()) + .selected_text("ComboBox") + .show_ui(ui, |ui| { + ui.label("contents"); + }); + }); + + strip.cell(|ui| { + let _ = ui.small_button("⏵"); + }); + }); + }); +} diff --git a/crates/re_ui/src/design_tokens.rs b/crates/re_ui/src/design_tokens.rs index ec7b5dee17c7..8a993679f3cc 100644 --- a/crates/re_ui/src/design_tokens.rs +++ b/crates/re_ui/src/design_tokens.rs @@ -56,9 +56,10 @@ fn apply_design_tokens(ctx: &egui::Context) -> DesignTokens { } } - egui_style.visuals.widgets.noninteractive.bg_fill = - get_aliased_color(&json, "{Alias.Color.Surface.Default.value}"); - // TODO(emilk): window top bars + let panel_bg_color = get_aliased_color(&json, "{Alias.Color.Surface.Default.value}"); + let floating_color = get_aliased_color(&json, "{Alias.Color.Surface.Floating.value}"); + + egui_style.visuals.widgets.noninteractive.bg_fill = panel_bg_color; egui_style.visuals.widgets.inactive.bg_fill = get_aliased_color(&json, "{Alias.Color.Action.Default.value}"); @@ -74,10 +75,28 @@ fn apply_design_tokens(ctx: &egui::Context) -> DesignTokens { egui_style.visuals.widgets.inactive.fg_stroke.color = default; // button text egui_style.visuals.widgets.active.fg_stroke.color = strong; // strong text and active button text + egui_style.visuals.popup_shadow = egui::epaint::Shadow::NONE; + egui_style.visuals.window_shadow = egui::epaint::Shadow::NONE; + + egui_style.visuals.window_fill = floating_color; + egui_style.visuals.window_stroke = egui::Stroke::NONE; + egui_style.visuals.panel_fill = panel_bg_color; + + let rounding = crate::ReUi::rounding(); + egui_style.visuals.window_rounding = rounding.into(); + egui_style.visuals.widgets.noninteractive.rounding = rounding.into(); + egui_style.visuals.widgets.inactive.rounding = rounding.into(); + egui_style.visuals.widgets.hovered.rounding = rounding.into(); + egui_style.visuals.widgets.active.rounding = rounding.into(); + egui_style.visuals.widgets.open.rounding = rounding.into(); + + egui_style.spacing.item_spacing = egui::vec2(8.0, 4.0); + egui_style.spacing.menu_margin = crate::ReUi::view_padding().into(); + ctx.set_style(egui_style); DesignTokens { - top_bar_color: get_aliased_color(&json, "{Alias.Color.Surface.Topbar.value}"), + top_bar_color: floating_color, } } diff --git a/crates/re_ui/src/lib.rs b/crates/re_ui/src/lib.rs index a2a9c4569357..abaab00bf17c 100644 --- a/crates/re_ui/src/lib.rs +++ b/crates/re_ui/src/lib.rs @@ -64,23 +64,54 @@ impl ReUi { } } + /// Add stripes to grids and tables? + pub fn striped() -> bool { + false + } + + /// Margin on the side of views + pub fn view_padding() -> f32 { + 16.0 + } + + /// Default border radius + pub fn rounding() -> f32 { + 6.0 + } + + pub fn table_line_height() -> f32 { + 14.0 + } + + pub fn table_header_height() -> f32 { + 20.0 + } + + pub fn setup_table_header(_header: &mut egui_extras::TableRow<'_, '_>) {} + + pub fn setup_table_body(body: &mut egui_extras::TableBody<'_>) { + // Make sure buttons don't visually overflow: + body.ui_mut().spacing_mut().interact_size.y = Self::table_line_height(); + } + #[allow(clippy::unused_self)] pub fn panel_frame(&self) -> egui::Frame { let style = self.egui_ctx.style(); egui::Frame { - fill: style.visuals.window_fill(), - inner_margin: egui::style::Margin::same(4.0), + fill: style.visuals.panel_fill, + inner_margin: Self::view_padding().into(), ..Default::default() } } + /// Used for the hovering controls over a Space View #[allow(clippy::unused_self)] pub fn hovering_frame(&self) -> egui::Frame { let style = self.egui_ctx.style(); egui::Frame { inner_margin: egui::style::Margin::same(2.0), outer_margin: egui::style::Margin::same(4.0), - rounding: 4.0.into(), + rounding: Self::rounding().into(), fill: style.visuals.window_fill(), stroke: style.visuals.window_stroke(), ..Default::default() diff --git a/crates/re_viewer/src/app.rs b/crates/re_viewer/src/app.rs index be6be453668b..afbc311384b8 100644 --- a/crates/re_viewer/src/app.rs +++ b/crates/re_viewer/src/app.rs @@ -490,14 +490,10 @@ impl App { self.state = Default::default(); self.state.selected_rec_id = selected_rec_id; - // Keep dark/light mode setting: - let is_dark_mode = egui_ctx.style().visuals.dark_mode; + // Keep the style: + let style = egui_ctx.style(); *egui_ctx.memory() = Default::default(); - egui_ctx.set_visuals(if is_dark_mode { - egui::Visuals::dark() - } else { - egui::Visuals::light() - }); + egui_ctx.set_style((*style).clone()); } fn log_db(&mut self) -> &mut LogDb { @@ -659,7 +655,7 @@ impl AppState { time_panel.show_panel(&mut ctx, blueprint, egui_ctx); let central_panel_frame = egui::Frame { - fill: egui_ctx.style().visuals.window_fill(), + fill: egui_ctx.style().visuals.panel_fill, inner_margin: egui::style::Margin::same(0.0), ..Default::default() }; diff --git a/crates/re_viewer/src/ui/data_ui.rs b/crates/re_viewer/src/ui/data_ui.rs index 49ec339b9098..366dd7cfa3b5 100644 --- a/crates/re_viewer/src/ui/data_ui.rs +++ b/crates/re_viewer/src/ui/data_ui.rs @@ -64,7 +64,7 @@ pub(crate) fn view_instance_generic( let mut keypoint_id = None; egui::Grid::new("object_instance") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { for (field_name, field_store) in obj_store.iter() { @@ -121,7 +121,7 @@ pub(crate) fn view_instance_generic( &data_path, ); egui::Grid::new("class_description") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { if let Some(class_description) = annotations.context.class_map.get(&class_id) { @@ -229,7 +229,7 @@ pub(crate) fn show_detailed_data_msg( let is_image = matches!(msg.data, LoggedData::Single(Data::Tensor(_))); egui::Grid::new("fields") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.monospace("data_path:"); @@ -289,7 +289,7 @@ pub(crate) fn show_begin_recording_msg(ui: &mut egui::Ui, msg: &BeginRecordingMs } = info; egui::Grid::new("fields") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.monospace("application_id:"); @@ -332,7 +332,7 @@ pub(crate) fn show_data_msg( } = msg; egui::Grid::new("fields") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.monospace("data_path:"); @@ -357,7 +357,7 @@ pub(crate) fn show_path_op_msg(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, m } = msg; egui::Grid::new("fields") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.monospace("time_point:"); @@ -547,19 +547,20 @@ fn ui_view_coordinates(ui: &mut egui::Ui, system: &ViewCoordinates) -> egui::Res ui.label(system.describe()) } -const ROW_HEIGHT: f32 = 18.0; const TABLE_SCROLL_AREA_HEIGHT: f32 = 500.0; // add scroll-bars when we get to this height fn ui_annotation_info_table<'a>( ui: &mut egui::Ui, annotation_infos: impl Iterator, ) { + let row_height = re_ui::ReUi::table_line_height(); + ui.spacing_mut().item_spacing.x = 20.0; // column spacing. use egui_extras::{Column, TableBuilder}; let table = TableBuilder::new(ui) - .striped(true) + .striped(re_ui::ReUi::striped()) .min_scrolled_height(TABLE_SCROLL_AREA_HEIGHT) .max_scroll_height(TABLE_SCROLL_AREA_HEIGHT) .cell_layout(egui::Layout::left_to_right(egui::Align::Center)) @@ -568,7 +569,8 @@ fn ui_annotation_info_table<'a>( .column(Column::auto()); // color table - .header(20.0, |mut header| { + .header(re_ui::ReUi::table_header_height(), |mut header| { + re_ui::ReUi::setup_table_header(&mut header); header.col(|ui| { ui.strong("Id"); }); @@ -580,8 +582,10 @@ fn ui_annotation_info_table<'a>( }); }) .body(|mut body| { + re_ui::ReUi::setup_table_body(&mut body); + for info in annotation_infos { - body.row(ROW_HEIGHT, |mut row| { + body.row(row_height, |mut row| { row.col(|ui| { ui.label(info.id.to_string()); }); @@ -598,7 +602,7 @@ fn ui_annotation_info_table<'a>( ui.spacing_mut().item_spacing.x = 8.0; let color = info.color.unwrap_or_else(|| auto_color(info.id)); let color = egui::Color32::from_rgb(color[0], color[1], color[2]); - color_picker::show_color(ui, color, Vec2::new(64.0, ROW_HEIGHT)); + color_picker::show_color(ui, color, Vec2::new(64.0, row_height)); if info.color.is_none() { ui.weak("(auto)").on_hover_text( "Color chosen automatically, since it was not logged.", @@ -612,6 +616,7 @@ fn ui_annotation_info_table<'a>( } fn ui_annotation_context(ui: &mut egui::Ui, context: &AnnotationContext) -> egui::Response { + let row_height = re_ui::ReUi::table_line_height(); ui.vertical(|ui| { ui_annotation_info_table( ui, @@ -651,14 +656,15 @@ fn ui_annotation_context(ui: &mut egui::Ui, context: &AnnotationContext) -> egui use egui_extras::{Column, TableBuilder}; let table = TableBuilder::new(ui) - .striped(true) + .striped(re_ui::ReUi::striped()) .min_scrolled_height(TABLE_SCROLL_AREA_HEIGHT) .max_scroll_height(TABLE_SCROLL_AREA_HEIGHT) .cell_layout(egui::Layout::left_to_right(egui::Align::Center)) .column(Column::auto().clip(true).at_least(40.0)) .column(Column::auto().clip(true).at_least(40.0)); table - .header(20.0, |mut header| { + .header(re_ui::ReUi::table_header_height(), |mut header| { + re_ui::ReUi::setup_table_header(&mut header); header.col(|ui| { ui.strong("From"); }); @@ -667,8 +673,10 @@ fn ui_annotation_context(ui: &mut egui::Ui, context: &AnnotationContext) -> egui }); }) .body(|mut body| { + re_ui::ReUi::setup_table_body(&mut body); + for (from, to) in &class.keypoint_connections { - body.row(ROW_HEIGHT, |mut row| { + body.row(row_height, |mut row| { for id in [from, to] { row.col(|ui| { ui.label( @@ -702,7 +710,7 @@ fn ui_rigid3(ui: &mut egui::Ui, rigid3: &Rigid3) -> egui::Response { ui.label("Rigid3"); ui.indent("rigid3", |ui| { egui::Grid::new("rigid3") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.label("rotation"); @@ -728,7 +736,7 @@ fn ui_pinhole(ui: &mut egui::Ui, pinhole: &Pinhole) -> egui::Response { ui.label("Pinhole"); ui.indent("pinole", |ui| { egui::Grid::new("pinole") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.label("image from view"); diff --git a/crates/re_viewer/src/ui/event_log_view.rs b/crates/re_viewer/src/ui/event_log_view.rs index 13472aa6fef7..d0c6406ced39 100644 --- a/crates/re_viewer/src/ui/event_log_view.rs +++ b/crates/re_viewer/src/ui/event_log_view.rs @@ -17,19 +17,25 @@ impl EventLogView { pub fn ui(&mut self, ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui) { crate::profile_function!(); - ui.label(format!("{} log lines", format_number(ctx.log_db.len()))); - ui.separator(); - let messages = { crate::profile_scope!("Collecting messages"); ctx.log_db.chronological_log_messages().collect_vec() }; - egui::ScrollArea::horizontal() - .auto_shrink([false; 2]) - .show(ui, |ui| { - message_table(ctx, ui, &messages); - }); + egui::Frame { + inner_margin: re_ui::ReUi::view_padding().into(), + ..egui::Frame::default() + } + .show(ui, |ui| { + ui.label(format!("{} log lines", format_number(ctx.log_db.len()))); + ui.separator(); + + egui::ScrollArea::horizontal() + .auto_shrink([false; 2]) + .show(ui, |ui| { + message_table(ctx, ui, &messages); + }); + }); } } @@ -39,7 +45,7 @@ pub(crate) fn message_table(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, mess use egui_extras::{Column, TableBuilder}; TableBuilder::new(ui) - .striped(true) + .striped(re_ui::ReUi::striped()) .max_scroll_height(f32::INFINITY) // Fill up whole height .cell_layout(egui::Layout::left_to_right(egui::Align::Center)) .resizable(true) @@ -52,7 +58,8 @@ pub(crate) fn message_table(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, mess ) .column(Column::auto().clip(true).at_least(50.0)) // path .column(Column::remainder()) // payload - .header(20.0, |mut header| { + .header(re_ui::ReUi::table_header_height(), |mut header| { + re_ui::ReUi::setup_table_header(&mut header); header.col(|ui| { ui.strong("MsgID"); }); @@ -71,7 +78,9 @@ pub(crate) fn message_table(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, mess ui.strong("Payload"); }); }) - .body(|body| { + .body(|mut body| { + re_ui::ReUi::setup_table_body(&mut body); + // for MANY messages, `heterogeneous_rows` is too slow. TODO(emilk): how many? if messages.len() < 10_000_000 { body.heterogeneous_rows( @@ -82,19 +91,20 @@ pub(crate) fn message_table(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, mess }, ); } else { - const ROW_HEIGHT: f32 = 18.0; - body.rows(ROW_HEIGHT, messages.len(), |index, mut row| { - table_row(ctx, &mut row, messages[index], ROW_HEIGHT); + let row_height = re_ui::ReUi::table_line_height(); + body.rows(row_height, messages.len(), |index, mut row| { + table_row(ctx, &mut row, messages[index], row_height); }); } }); } fn row_height(msg: &LogMsg) -> f32 { - match msg { - LogMsg::DataMsg(msg) if msg.data.data_type() == DataType::Tensor => 48.0, - _ => 18.0, - } + re_ui::ReUi::table_line_height() + * match msg { + LogMsg::DataMsg(msg) if msg.data.data_type() == DataType::Tensor => 3.0, + _ => 1.0, + } } fn table_row( diff --git a/crates/re_viewer/src/ui/memory_panel.rs b/crates/re_viewer/src/ui/memory_panel.rs index 716d835fa9ff..86de16c0ff57 100644 --- a/crates/re_viewer/src/ui/memory_panel.rs +++ b/crates/re_viewer/src/ui/memory_panel.rs @@ -103,7 +103,7 @@ impl MemoryPanel { fn gpu_stats(ui: &mut egui::Ui, gpu_resource_stats: &WgpuResourcePoolStatistics) { egui::Grid::new("gpu resource grid") .num_columns(2) - .striped(true) + .striped(re_ui::ReUi::striped()) .show(ui, |ui| { let WgpuResourcePoolStatistics { num_bind_group_layouts, diff --git a/crates/re_viewer/src/ui/selection_history_ui.rs b/crates/re_viewer/src/ui/selection_history_ui.rs index 550e9a8be463..9954ec660ea8 100644 --- a/crates/re_viewer/src/ui/selection_history_ui.rs +++ b/crates/re_viewer/src/ui/selection_history_ui.rs @@ -25,16 +25,19 @@ impl SelectionHistory { ) -> Option { use egui_extras::{Size, StripBuilder}; - const BIG_BUTTON_SIZE: f32 = 50.0; + const BUTTON_SIZE: f32 = 20.0; const MIN_COMBOBOX_SIZE: f32 = 100.0; let font_id = egui::TextStyle::Body.resolve(ui.style()); let mut res = None; StripBuilder::new(ui) - .size(Size::exact(BIG_BUTTON_SIZE)) // prev + .cell_layout(egui::Layout::centered_and_justified( + egui::Direction::TopDown, // whatever + )) + .size(Size::exact(BUTTON_SIZE)) // prev .size(Size::remainder().at_least(MIN_COMBOBOX_SIZE)) // browser - .size(Size::exact(BIG_BUTTON_SIZE)) // next + .size(Size::exact(BUTTON_SIZE)) // next .horizontal(|mut strip| { // prev let mut prev = None; @@ -45,7 +48,7 @@ impl SelectionHistory { // browser let mut picked = None; strip.cell(|ui| { - let clipped_width = ui.available_width() - 20.0; // leave some space for the icon! + let clipped_width = ui.available_width() - 32.0; // leave some space for the drop-down icon! picked = egui::ComboBox::from_id_source("history_browser") .width(ui.available_width()) .wrap(false) @@ -66,13 +69,7 @@ impl SelectionHistory { show_selection_index(ui, i); { // borrow checker workaround - let sel = selection_to_clipped_string( - ui, - blueprint, - sel, - &font_id, - clipped_width, - ); + let sel = selection_to_string(blueprint, sel); ui.selectable_value(&mut self.current, i, sel); } show_selection_kind(ui, sel); @@ -106,7 +103,7 @@ impl SelectionHistory { ui: &mut egui::Ui, blueprint: &Blueprint, ) -> Option { - const PREV_BUTTON: &str = "⏴ Prev"; + const PREV_BUTTON: &str = "⏴"; if let Some(previous) = self.previous() { let shortcut = &crate::ui::kb_shortcuts::SELECTION_PREVIOUS; let button_clicked = ui @@ -141,7 +138,7 @@ impl SelectionHistory { ui: &mut egui::Ui, blueprint: &Blueprint, ) -> Option { - const NEXT_BUTTON: &str = "Next ⏵"; + const NEXT_BUTTON: &str = "⏵"; if let Some(next) = self.next() { let shortcut = &crate::ui::kb_shortcuts::SELECTION_NEXT; let button_clicked = ui diff --git a/crates/re_viewer/src/ui/selection_panel.rs b/crates/re_viewer/src/ui/selection_panel.rs index 48bc3ce73060..31b16391f1b9 100644 --- a/crates/re_viewer/src/ui/selection_panel.rs +++ b/crates/re_viewer/src/ui/selection_panel.rs @@ -174,7 +174,7 @@ impl SelectionPanel { Selection::SpaceViewObjPath(space_view_id, obj_path) => { if let Some(space_view) = blueprint.viewport.space_view_mut(&space_view_id) { egui::Grid::new("space_view_id_obj_path") - .striped(true) + .striped(re_ui::ReUi::striped()) .show(ui, |ui| { ui.label("Space View:"); ctx.space_view_button_to(ui, &space_view.name, space_view_id); @@ -209,7 +209,7 @@ fn obj_type_name(log_db: &LogDb, obj_type_path: &ObjTypePath) -> String { fn ui_space_view(ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, space_view: &mut SpaceView) { egui::Grid::new("space_view") - .striped(true) + .striped(re_ui::ReUi::striped()) .num_columns(2) .show(ui, |ui| { ui.label("Name:"); diff --git a/crates/re_viewer/src/ui/space_view.rs b/crates/re_viewer/src/ui/space_view.rs index b59b44ec506a..77510325966d 100644 --- a/crates/re_viewer/src/ui/space_view.rs +++ b/crates/re_viewer/src/ui/space_view.rs @@ -85,46 +85,32 @@ impl SpaceView { obj_props: &self.obj_tree_properties.projected, }; - // Extra headroom required for the hovering controls at the top of the space view. - let extra_headroom = { - let frame = ctx.re_ui.hovering_frame(); - frame.total_margin().sum().y + ui.spacing().interact_size.y - }; - match self.category { ViewCategory::TwoD => { - _ = extra_headroom; // ignored - put overlay buttons on top of the view. - let mut scene = view_2d::Scene2D::default(); scene.load_objects(ctx, &query); self.view_state.ui_2d(ctx, ui, &self.space_path, scene); } ViewCategory::ThreeD => { - _ = extra_headroom; // ignored - put overlay buttons on top of the view. - let mut scene = view_3d::Scene3D::default(); scene.load_objects(ctx, &query); self.view_state .ui_3d(ctx, ui, &self.space_path, spaces_info, space_info, scene); } + ViewCategory::Tensor => { - ui.add_space(extra_headroom); + ui.add_space(16.0); // Extra headroom required for the hovering controls at the top of the space view. let mut scene = view_tensor::SceneTensor::default(); scene.load_objects(ctx, &query); self.view_state.ui_tensor(ui, &scene); } ViewCategory::Text => { - let line_height = egui::TextStyle::Body.resolve(ui.style()).size; - ui.add_space(extra_headroom - line_height - ui.spacing().item_spacing.y); // we don't need the full headroom - the logs has the number of entries at the top - let mut scene = view_text::SceneText::default(); scene.load_objects(ctx, &query, &self.view_state.state_text.filters); self.view_state.ui_text(ctx, ui, &scene); } ViewCategory::Plot => { - _ = extra_headroom; // ignored - put overlay buttons on top of the view. - let mut scene = view_plot::ScenePlot::default(); scene.load_objects(ctx, &query); self.view_state.ui_plot(ctx, ui, &scene); @@ -214,8 +200,15 @@ impl ViewState { let state_tensor = self .state_tensor .get_or_insert_with(|| view_tensor::ViewTensorState::create(tensor)); - ui.vertical(|ui| { - view_tensor::view_tensor(ui, state_tensor, tensor); + + egui::Frame { + inner_margin: re_ui::ReUi::view_padding().into(), + ..egui::Frame::default() + } + .show(ui, |ui| { + ui.vertical(|ui| { + view_tensor::view_tensor(ui, state_tensor, tensor); + }); }); } else { ui.centered_and_justified(|ui| { @@ -229,8 +222,14 @@ impl ViewState { ctx: &mut ViewerContext<'_>, ui: &mut egui::Ui, scene: &view_text::SceneText, - ) -> egui::Response { - view_text::view_text(ctx, ui, &mut self.state_text, scene) + ) { + egui::Frame { + inner_margin: re_ui::ReUi::view_padding().into(), + ..egui::Frame::default() + } + .show(ui, |ui| { + view_text::view_text(ctx, ui, &mut self.state_text, scene); + }); } fn ui_plot( diff --git a/crates/re_viewer/src/ui/time_panel.rs b/crates/re_viewer/src/ui/time_panel.rs index ff27c8cf999f..69e0fe5a5005 100644 --- a/crates/re_viewer/src/ui/time_panel.rs +++ b/crates/re_viewer/src/ui/time_panel.rs @@ -1799,17 +1799,17 @@ fn fade_sides(ui: &mut egui::Ui, time_area: Rect) { let base_rect = time_area.expand(0.5); // expand slightly to cover feathering. - let window_fill = ui.visuals().window_fill(); + let panel_fill = ui.visuals().panel_fill; let mut left_rect = base_rect; left_rect.set_right(left_rect.left() + fade_width); ui.painter() - .add(fade_mesh(left_rect, [window_fill, Color32::TRANSPARENT])); + .add(fade_mesh(left_rect, [panel_fill, Color32::TRANSPARENT])); let mut right_rect = base_rect; right_rect.set_left(right_rect.right() - fade_width); ui.painter() - .add(fade_mesh(right_rect, [Color32::TRANSPARENT, window_fill])); + .add(fade_mesh(right_rect, [Color32::TRANSPARENT, panel_fill])); } fn fade_mesh(rect: Rect, [left_color, right_color]: [Color32; 2]) -> egui::Mesh { diff --git a/crates/re_viewer/src/ui/view_2d/class_description_ui.rs b/crates/re_viewer/src/ui/view_2d/class_description_ui.rs index 4685246ac16e..c3cf6c92fbdc 100644 --- a/crates/re_viewer/src/ui/view_2d/class_description_ui.rs +++ b/crates/re_viewer/src/ui/view_2d/class_description_ui.rs @@ -45,14 +45,15 @@ pub(crate) fn view_class_description_map( use egui_extras::{Column, TableBuilder}; let table = TableBuilder::new(ui) - .striped(true) + .striped(re_ui::ReUi::striped()) .cell_layout(egui::Layout::left_to_right(egui::Align::Center)) .column(Column::auto()) // id .column(Column::auto().clip(true).at_least(40.0)) // label .column(Column::auto()); // color table - .header(20.0, |mut header| { + .header(re_ui::ReUi::table_header_height(), |mut header| { + re_ui::ReUi::setup_table_header(&mut header); header.col(|ui| { ui.heading("Id"); }); @@ -64,9 +65,11 @@ pub(crate) fn view_class_description_map( }); }) .body(|mut body| { - const ROW_HEIGHT: f32 = 18.0; + re_ui::ReUi::setup_table_body(&mut body); + + let row_height = re_ui::ReUi::table_line_height(); for (id, (label, color)) in map { - body.row(ROW_HEIGHT, |mut row| { + body.row(row_height, |mut row| { row.col(|ui| { ui.label(id.to_string()); }); diff --git a/crates/re_viewer/src/ui/view_tensor/tensor_dimension_mapper.rs b/crates/re_viewer/src/ui/view_tensor/tensor_dimension_mapper.rs index 4249fed8d4d0..88bcda98a837 100644 --- a/crates/re_viewer/src/ui/view_tensor/tensor_dimension_mapper.rs +++ b/crates/re_viewer/src/ui/view_tensor/tensor_dimension_mapper.rs @@ -159,9 +159,8 @@ fn drop_target_ui( let mut fill = style.bg_fill; let mut stroke = style.bg_stroke; if is_being_dragged && !can_accept_dragged { - // gray out: - fill = egui::ecolor::tint_color_towards(fill, ui.visuals().window_fill()); - stroke.color = egui::ecolor::tint_color_towards(stroke.color, ui.visuals().window_fill()); + fill = ui.visuals().gray_out(fill); + stroke.color = ui.visuals().gray_out(stroke.color); } ui.painter().set( @@ -179,9 +178,13 @@ fn drop_target_ui( pub fn dimension_mapping_ui( ui: &mut egui::Ui, - dimension_mapping: &mut DimensionMapping, + dim_mapping: &mut DimensionMapping, shape: &[TensorDimension], ) { + if !dim_mapping.is_valid(shape.len()) { + *dim_mapping = DimensionMapping::create(shape.len()); + } + let mut drop_source = DragDropAddress::None; let mut drop_target = DragDropAddress::None; @@ -197,13 +200,13 @@ pub fn dimension_mapping_ui( egui::Grid::new("imagegrid").num_columns(2).show(ui, |ui| { ui.horizontal(|ui| { ui.label("Width:"); - ui.toggle_value(&mut dimension_mapping.invert_width, "Flip"); + ui.toggle_value(&mut dim_mapping.invert_width, "Flip"); }); tensor_dimension_ui( ui, drag_context_id, can_accept_dragged, - dimension_mapping.width, + dim_mapping.width, DragDropAddress::Width, shape, &mut drop_source, @@ -213,13 +216,13 @@ pub fn dimension_mapping_ui( ui.horizontal(|ui| { ui.label("Height:"); - ui.toggle_value(&mut dimension_mapping.invert_height, "Flip"); + ui.toggle_value(&mut dim_mapping.invert_height, "Flip"); }); tensor_dimension_ui( ui, drag_context_id, can_accept_dragged, - dimension_mapping.height, + dim_mapping.height, DragDropAddress::Height, shape, &mut drop_source, @@ -232,7 +235,7 @@ pub fn dimension_mapping_ui( ui, drag_context_id, can_accept_dragged, - dimension_mapping.channel, + dim_mapping.channel, DragDropAddress::Channel, shape, &mut drop_source, @@ -250,8 +253,7 @@ pub fn dimension_mapping_ui( egui::Grid::new("selectiongrid") .num_columns(1) .show(ui, |ui| { - for (selector_idx, &mut dim_idx) in - dimension_mapping.selectors.iter_mut().enumerate() + for (selector_idx, &mut dim_idx) in dim_mapping.selectors.iter_mut().enumerate() { tensor_dimension_ui( ui, @@ -282,9 +284,9 @@ pub fn dimension_mapping_ui( // persist drag/drop if drop_target.is_some() && drop_source.is_some() && ui.input().pointer.any_released() { - let previous_value_source = drop_source.read_from_address(dimension_mapping); - let previous_value_target = drop_target.read_from_address(dimension_mapping); - drop_source.write_to_address(dimension_mapping, previous_value_target); - drop_target.write_to_address(dimension_mapping, previous_value_source); + let previous_value_source = drop_source.read_from_address(dim_mapping); + let previous_value_target = drop_target.read_from_address(dim_mapping); + drop_source.write_to_address(dim_mapping, previous_value_target); + drop_target.write_to_address(dim_mapping, previous_value_source); } } diff --git a/crates/re_viewer/src/ui/view_tensor/ui.rs b/crates/re_viewer/src/ui/view_tensor/ui.rs index dfb085b87a33..9c73bfd1ef05 100644 --- a/crates/re_viewer/src/ui/view_tensor/ui.rs +++ b/crates/re_viewer/src/ui/view_tensor/ui.rs @@ -44,7 +44,7 @@ impl ViewTensorState { pub fn create(tensor: &Tensor) -> ViewTensorState { Self { selector_values: Default::default(), - dimension_mapping: DimensionMapping::create(tensor), + dimension_mapping: DimensionMapping::create(tensor.num_dim()), color_mapping: ColorMapping::default(), texture_settings: TextureSettings::default(), tensor: tensor.clone(), @@ -148,7 +148,7 @@ struct ColorMapping { impl Default for ColorMapping { fn default() -> Self { Self { - turbo: false, + turbo: true, gamma: 1.0, } } @@ -169,8 +169,14 @@ impl ColorMapping { } fn color_mapping_ui(ui: &mut egui::Ui, color_mapping: &mut ColorMapping) { - ui.horizontal(|ui| { - ui.label("Color map:"); + ui.group(|ui| { + ui.strong("Color map"); + + ui.horizontal(|ui| { + ui.radio_value(&mut color_mapping.turbo, false, "Grayscale"); + ui.radio_value(&mut color_mapping.turbo, true, "Turbo"); + }); + let mut brightness = 1.0 / color_mapping.gamma; ui.add( egui::Slider::new(&mut brightness, 0.1..=10.0) @@ -178,7 +184,6 @@ fn color_mapping_ui(ui: &mut egui::Ui, color_mapping: &mut ColorMapping) { .text("Brightness"), ); color_mapping.gamma = 1.0 / brightness; - ui.checkbox(&mut color_mapping.turbo, "Turbo colormap"); }); } diff --git a/crates/re_viewer/src/ui/view_text/ui.rs b/crates/re_viewer/src/ui/view_text/ui.rs index 0f487a608f61..034b2b71270b 100644 --- a/crates/re_viewer/src/ui/view_text/ui.rs +++ b/crates/re_viewer/src/ui/view_text/ui.rs @@ -278,14 +278,13 @@ fn show_table( .collect::>(); use egui_extras::Column; - const ROW_HEIGHT: f32 = 18.0; - const HEADER_HEIGHT: f32 = 20.0; + let row_height = re_ui::ReUi::table_line_height(); let current_timeline = *ctx.rec_cfg.time_ctrl.timeline(); let current_time = ctx.rec_cfg.time_ctrl.time_int(); let mut table_builder = egui_extras::TableBuilder::new(ui) - .striped(true) + .striped(re_ui::ReUi::striped()) .resizable(true) .vscroll(true) .auto_shrink([false; 2]) // expand to take up the whole Space View @@ -316,7 +315,8 @@ fn show_table( table_builder = table_builder.column(Column::remainder().at_least(100.0)); } table_builder - .header(HEADER_HEIGHT, |mut header| { + .header(re_ui::ReUi::table_header_height(), |mut header| { + re_ui::ReUi::setup_table_header(&mut header); for timeline in &timelines { header.col(|ui| { ctx.timeline_button(ui, timeline); @@ -336,9 +336,11 @@ fn show_table( ui.strong("Body"); }); }) - .body(|body| { + .body(|mut body| { + re_ui::ReUi::setup_table_body(&mut body); + body_clip_rect = Some(body.max_rect()); - body.rows(ROW_HEIGHT, text_entries.len(), |index, mut row| { + body.rows(row_height, text_entries.len(), |index, mut row| { let text_entry = &text_entries[index]; // NOTE: `try_from_props` is where we actually fetch data from the underlying diff --git a/crates/re_viewer/src/ui/viewport.rs b/crates/re_viewer/src/ui/viewport.rs index 8f6b1153b267..b3d76d065a54 100644 --- a/crates/re_viewer/src/ui/viewport.rs +++ b/crates/re_viewer/src/ui/viewport.rs @@ -218,7 +218,14 @@ impl ViewportBlueprint { let space_path = &space_view.space_path; let collapsing_header_id = ui.make_persistent_id(space_view_id); - let default_open = true; + let mut default_open = true; + + if let Some(tree) = obj_tree.subtree(space_path) { + if tree.children.is_empty() { + default_open = false; + } + } + egui::collapsing_header::CollapsingState::load_with_default_open( ui.ctx(), collapsing_header_id, @@ -389,6 +396,7 @@ impl ViewportBlueprint { dock_style.tab_include_scrollarea = false; // dock_style.expand_tabs = true; looks good, but decreases readability dock_style.tab_text_color_unfocused = dock_style.tab_text_color_focused; // We don't treat focused tabs differently + dock_style.tab_background_color = ui.visuals().panel_fill; let mut tab_viewer = TabViewer { ctx, @@ -481,6 +489,11 @@ fn show_obj_tree_children( space_info: &SpaceInfo, tree: &ObjectTree, ) { + if tree.children.is_empty() { + ui.weak("(nothing)"); + return; + } + for (path_comp, child) in &tree.children { if space_info.objects.contains(&child.path) { show_obj_tree( @@ -682,7 +695,7 @@ impl Blueprint { self.blueprint_panel(ctx, ui, &spaces_info); let viewport_frame = egui::Frame { - fill: ui.style().visuals.window_fill(), + fill: ui.style().visuals.panel_fill, ..Default::default() }; @@ -713,7 +726,7 @@ impl Blueprint { panel.show_animated_inside(ui, self.blueprint_panel_expanded, |ui: &mut egui::Ui| { ui.horizontal(|ui| { ui.vertical_centered(|ui| { - ui.label("Blueprint"); + ui.strong("Blueprint"); }); }); diff --git a/examples/mp_pose/main.py b/examples/mp_pose/main.py index 4919f69428bf..e6e188e73456 100755 --- a/examples/mp_pose/main.py +++ b/examples/mp_pose/main.py @@ -138,6 +138,8 @@ def main() -> None: parser.add_argument("--dataset_dir", type=Path, default=DATASET_DIR, help="Directory to save example videos to.") parser.add_argument("--video_path", type=str, default="", help="Full path to video to run on. Overrides `--video`.") + rr.init("mp_pose") + args = parser.parse_args() video_path = args.video_path # type: str diff --git a/examples/tracking_hf_opencv/main.py b/examples/tracking_hf_opencv/main.py index 55b2dea87071..3412fb2fc05e 100755 --- a/examples/tracking_hf_opencv/main.py +++ b/examples/tracking_hf_opencv/main.py @@ -390,6 +390,9 @@ def main() -> None: parser.add_argument("--video_path", type=str, default="", help="Full path to video to run on. Overrides `--video`.") args = parser.parse_args() + + rerun.init("tracking_hf_opencv") + setup_looging() video_path = args.video_path # type: str