Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
11 changes: 6 additions & 5 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ Of course, this will only take us so far. In the future we plan on caching queri
Here is an overview of the crates included in the project:

<picture>
<img src="https://static.rerun.io/crates/710562417756943b47657d3260622b5effe392f7/full.png" alt="">
<source media="(max-width: 480px)" srcset="https://static.rerun.io/crates/710562417756943b47657d3260622b5effe392f7/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/crates/710562417756943b47657d3260622b5effe392f7/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/crates/710562417756943b47657d3260622b5effe392f7/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/crates/710562417756943b47657d3260622b5effe392f7/1200w.png">
<img src="https://static.rerun.io/crates/f05504784aae7fa19303e2e57bc0fab10a3cc943/full.png" alt="">
<source media="(max-width: 480px)" srcset="https://static.rerun.io/crates/f05504784aae7fa19303e2e57bc0fab10a3cc943/480w.png">
<source media="(max-width: 768px)" srcset="https://static.rerun.io/crates/f05504784aae7fa19303e2e57bc0fab10a3cc943/768w.png">
<source media="(max-width: 1024px)" srcset="https://static.rerun.io/crates/f05504784aae7fa19303e2e57bc0fab10a3cc943/1024w.png">
<source media="(max-width: 1200px)" srcset="https://static.rerun.io/crates/f05504784aae7fa19303e2e57bc0fab10a3cc943/1200w.png">
</picture>


Expand Down Expand Up @@ -163,6 +163,7 @@ Update instructions:
| re_query | Querying data in the re_data_store |
| re_types | The built-in Rerun data types, component types, and archetypes. |
| re_types_blueprint | The core traits and types that power Rerun's Blueprint sub-system. |
| re_types_registry | A runtime registry of known Rerun types (components, archetypes, …). |
| re_log_encoding | Helpers for encoding and transporting Rerun log messages |


Expand Down
9 changes: 9 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4424,6 +4424,7 @@ dependencies = [
"re_types",
"re_types_blueprint",
"re_types_core",
"re_types_registry",
"re_ui",
"re_viewer_context",
"rfd",
Expand Down Expand Up @@ -5153,6 +5154,14 @@ dependencies = [
"thiserror",
]

[[package]]
name = "re_types_registry"
version = "0.17.0-alpha.4"
dependencies = [
"nohash-hasher",
"re_types_core",
]

[[package]]
name = "re_ui"
version = "0.17.0-alpha.4"
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ re_types = { path = "crates/re_types", version = "=0.17.0-alpha.4", default-feat
re_types_blueprint = { path = "crates/re_types_blueprint", version = "=0.17.0-alpha.4", default-features = false }
re_types_builder = { path = "crates/re_types_builder", version = "=0.17.0-alpha.4", default-features = false }
re_types_core = { path = "crates/re_types_core", version = "=0.17.0-alpha.4", default-features = false }
re_types_registry = { path = "crates/re_types_registry", version = "=0.17.0-alpha.4", default-features = false }
re_ui = { path = "crates/re_ui", version = "=0.17.0-alpha.4", default-features = false }
re_viewer = { path = "crates/re_viewer", version = "=0.17.0-alpha.4", default-features = false }
re_viewer_context = { path = "crates/re_viewer_context", version = "=0.17.0-alpha.4", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/re_data_ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ re_types = { workspace = true, features = [
] }
re_types_blueprint.workspace = true
re_types_core.workspace = true
re_types_registry.workspace = true
re_ui.workspace = true
re_viewer_context.workspace = true

Expand Down
37 changes: 37 additions & 0 deletions crates/re_data_ui/src/component_name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use re_types_core::ComponentName;
use re_ui::UiExt as _;
use re_viewer_context::{UiLayout, ViewerContext};

use super::DataUi;

impl DataUi for ComponentName {
fn data_ui(
&self,
_ctx: &ViewerContext<'_>,
ui: &mut egui::Ui,
ui_layout: UiLayout,
_query: &re_data_store::LatestAtQuery,
_db: &re_entity_db::EntityDb,
) {
if ui_layout == UiLayout::List {
ui.label(self.full_name());
} else {
ui.scope(|ui| {
ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
ui.label(format!("Full name: {}", self.full_name()));

// Only show the first line of the docs:
if let Some(markdown) = re_types_registry::components::registry()
.get(self)
.and_then(|info| info.docstring_md.lines().next())
{
ui.markdown_ui(egui::Id::new(self), markdown);
}

if let Some(url) = self.doc_url() {
ui.re_hyperlink("Full documentation", url);
}
});
}
}
}
6 changes: 5 additions & 1 deletion crates/re_data_ui/src/instance_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl DataUi for InstancePath {
return;
};

let components = crate::component_list_for_ui(&components);
let components = crate::sorted_component_list_for_ui(&components);
let indicator_count = components
.iter()
.filter(|c| c.is_indicator_component())
Expand Down Expand Up @@ -147,6 +147,10 @@ impl DataUi for InstancePath {
list_item.show_flat(ui, content)
};

let response = response.on_hover_ui(|ui| {
component_name.data_ui_default(ctx, ui, UiLayout::Tooltip);
});

if interactive {
ctx.select_hovered_on_click(&response, item);
}
Expand Down
16 changes: 2 additions & 14 deletions crates/re_data_ui/src/item_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,7 @@ pub fn app_id_button_ui(
);

let response = response.on_hover_ui(|ui| {
app_id.data_ui(
ctx,
ui,
re_viewer_context::UiLayout::Tooltip,
&ctx.current_query(), // unused
ctx.recording(), // unused
);
app_id.data_ui_default(ctx, ui, re_viewer_context::UiLayout::Tooltip);
});

cursor_interact_with_selectable(ctx, response, item)
Expand All @@ -615,13 +609,7 @@ pub fn data_source_button_ui(
);

let response = response.on_hover_ui(|ui| {
data_source.data_ui(
ctx,
ui,
re_viewer_context::UiLayout::Tooltip,
&ctx.current_query(),
ctx.recording(), // unused
);
data_source.data_ui_default(ctx, ui, re_viewer_context::UiLayout::Tooltip);
});

cursor_interact_with_selectable(ctx, response, item)
Expand Down
12 changes: 9 additions & 3 deletions crates/re_data_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod app_id;
mod blueprint_data;
mod blueprint_types;
mod component;
mod component_name;
mod component_path;
mod component_ui_registry;
mod data;
Expand Down Expand Up @@ -40,13 +41,14 @@ pub use component_ui_registry::{add_to_registry, create_component_ui_registry};
pub use image_meaning::image_meaning_for_entity;

/// Sort components for display in the UI.
pub fn component_list_for_ui<'a>(
pub fn sorted_component_list_for_ui<'a>(
iter: impl IntoIterator<Item = &'a ComponentName> + 'a,
) -> Vec<ComponentName> {
let mut components: Vec<ComponentName> = iter.into_iter().copied().collect();

// Put indicator components first:
components.sort_by_key(|c| (!c.is_indicator_component(), c.full_name()));
// Put indicator components first.
// We then sort by the short name, as that is what is shown in the UI.
components.sort_by_key(|c| (!c.is_indicator_component(), c.short_name()));

components
}
Expand All @@ -62,6 +64,10 @@ pub trait DataUi {
query: &re_data_store::LatestAtQuery,
db: &re_entity_db::EntityDb,
);

fn data_ui_default(&self, ctx: &ViewerContext<'_>, ui: &mut egui::Ui, ui_layout: UiLayout) {
self.data_ui(ctx, ui, ui_layout, &ctx.current_query(), ctx.recording());
}
}

/// Similar to [`DataUi`], but for data that is related to an entity (e.g. a component).
Expand Down
23 changes: 14 additions & 9 deletions crates/re_selection_panel/src/defaults_ui.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::collections::{BTreeMap, BTreeSet};

use itertools::Itertools;

use re_data_store::LatestAtQuery;
use re_data_ui::{sorted_component_list_for_ui, DataUi as _};
use re_log_types::{DataCell, DataRow, EntityPath, RowId};
use re_types_core::ComponentName;
use re_ui::UiExt as _;
Expand Down Expand Up @@ -59,7 +58,7 @@ pub fn defaults_ui(ctx: &ViewContext<'_>, space_view: &SpaceViewBlueprint, ui: &
&space_view.defaults_path,
);

let sorted_overrides = active_defaults.iter().sorted();
let sorted_overrides = sorted_component_list_for_ui(active_defaults.iter());

let query_context = QueryContext {
viewer_ctx: ctx.viewer_ctx,
Expand All @@ -73,7 +72,7 @@ pub fn defaults_ui(ctx: &ViewContext<'_>, space_view: &SpaceViewBlueprint, ui: &
re_ui::list_item::list_item_scope(ui, "defaults", |ui| {
ui.spacing_mut().item_spacing.y = 0.0;
for component_name in sorted_overrides {
let Some(visualizer_identifier) = component_to_vis.get(component_name) else {
let Some(visualizer_identifier) = component_to_vis.get(&component_name) else {
continue;
};
let Ok(visualizer) = ctx
Expand All @@ -94,10 +93,10 @@ pub fn defaults_ui(ctx: &ViewContext<'_>, space_view: &SpaceViewBlueprint, ui: &
db.store(),
query,
&space_view.defaults_path,
[*component_name],
[component_name],
)
.components
.get(component_name)
.get(&component_name)
.cloned(); /* arc */

if let Some(component_data) = component_data {
Expand All @@ -107,7 +106,7 @@ pub fn defaults_ui(ctx: &ViewContext<'_>, space_view: &SpaceViewBlueprint, ui: &
ui,
db,
&space_view.defaults_path,
*component_name,
component_name,
&component_data,
visualizer.as_fallback_provider(),
);
Expand All @@ -122,12 +121,18 @@ pub fn defaults_ui(ctx: &ViewContext<'_>, space_view: &SpaceViewBlueprint, ui: &
.action_button(&re_ui::icons::CLOSE, || {
ctx.save_empty_blueprint_component_by_name(
&space_view.defaults_path,
*component_name,
component_name,
);
})
.value_fn(|ui, _| value_fn(ui)),
)
.on_hover_text(component_name.full_name());
.on_hover_ui(|ui| {
component_name.data_ui_default(
ctx.viewer_ctx,
ui,
re_viewer_context::UiLayout::Tooltip,
);
});
}
}
});
Expand Down
8 changes: 5 additions & 3 deletions crates/re_selection_panel/src/visualizer_ui.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use itertools::Itertools;

use re_data_ui::DataUi;
use re_data_ui::{sorted_component_list_for_ui, DataUi};
use re_entity_db::EntityDb;
use re_log_types::EntityPath;
use re_space_view::latest_at_with_blueprint_resolved_data;
Expand Down Expand Up @@ -123,7 +123,7 @@ fn visualizer_components(
);

// TODO(andreas): Should we show required components in a special way?
for &component in query_info.queried.iter() {
for component in sorted_component_list_for_ui(query_info.queried.iter()) {
if component.is_indicator_component() {
continue;
}
Expand Down Expand Up @@ -249,7 +249,9 @@ fn visualizer_components(
ui,
list_item::PropertyContent::new(component.short_name()).value_fn(value_fn),
)
.on_hover_text(component.full_name());
.on_hover_ui(|ui| {
component.data_ui_default(ctx.viewer_ctx, ui, UiLayout::Tooltip);
});
}
}

Expand Down
24 changes: 3 additions & 21 deletions crates/re_space_view_spatial/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,13 +637,7 @@ pub fn picking(
Some(query.space_view_id),
&instance_path,
);
instance_path.data_ui(
ctx,
ui,
UiLayout::Tooltip,
&ctx.current_query(),
ctx.recording(),
);
instance_path.data_ui_default(ctx, ui, UiLayout::Tooltip);
})
};
}
Expand Down Expand Up @@ -720,22 +714,10 @@ fn image_hover_ui(
instance_path.entity_path.clone(),
re_types::components::TensorData::name(),
);
component_path.data_ui(
ctx,
ui,
UiLayout::List,
&ctx.current_query(),
ctx.recording(),
);
component_path.data_ui_default(ctx, ui, UiLayout::List);
} else {
// Show it all, like we do for any other thing we hover
instance_path.data_ui(
ctx,
ui,
UiLayout::List,
&ctx.current_query(),
ctx.recording(),
);
instance_path.data_ui_default(ctx, ui, UiLayout::List);
}

if let Some([h, w, ..]) = tensor.image_height_width_channels() {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_time_panel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use egui::emath::Rangef;
use egui::{pos2, Color32, CursorIcon, NumExt, Painter, PointerButton, Rect, Shape, Ui, Vec2};

use re_context_menu::{context_menu_ui_for_item, SelectionUpdateBehavior};
use re_data_ui::item_ui::guess_instance_path_icon;
use re_data_ui::DataUi as _;
use re_data_ui::{item_ui::guess_instance_path_icon, sorted_component_list_for_ui};
use re_entity_db::{EntityTree, InstancePath, TimeHistogram};
use re_log_types::{
external::re_types_core::ComponentName, ComponentPath, EntityPath, EntityPathPart,
Expand Down Expand Up @@ -745,7 +745,7 @@ impl TimePanel {

// If this is an entity:
if !tree.entity.components.is_empty() {
for component_name in re_data_ui::component_list_for_ui(tree.entity.components.keys()) {
for component_name in sorted_component_list_for_ui(tree.entity.components.keys()) {
let data = &tree.entity.components[&component_name];

let is_static = data.is_static();
Expand Down
9 changes: 4 additions & 5 deletions crates/re_types_builder/src/codegen/cpp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,12 @@ impl CppCodeGenerator {
let mut files_to_write = GeneratedFiles::default();

// Generate folder contents:
let ordered_objects = objects
.ordered_objects(object_kind.into())
.into_iter()
let objects_of_kind = objects
.objects_of_kind(object_kind)
.filter(|obj| &obj.scope() == scope)
.collect_vec();

for &obj in &ordered_objects {
for &obj in &objects_of_kind {
if let Err(err) = generate_object_files(
objects,
&folder_path_sdk,
Expand All @@ -196,7 +195,7 @@ impl CppCodeGenerator {
for testing in [false, true] {
let hash = quote! { # };
let pragma_once = pragma_once();
let header_file_names = ordered_objects
let header_file_names = objects_of_kind
.iter()
.filter(|obj| obj.is_testing() == testing)
.map(|obj| format!("{folder_name}/{}.hpp", obj.snake_case_name()))
Expand Down
5 changes: 2 additions & 3 deletions crates/re_types_builder/src/codegen/python/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl CodeGenerator for PythonCodeGenerator {
// TODO(jleibs): Should we still be generating an equivalent to this?
/*
let archetype_names = objects
.ordered_objects(ObjectKind::Archetype.into())
.objects_of_kind(ObjectKind::Archetype)
.iter()
.map(|o| o.name.clone())
.collect_vec();
Expand Down Expand Up @@ -290,8 +290,7 @@ impl PythonCodeGenerator {
let mut test_mods = BTreeMap::<String, Vec<String>>::new();

// Generate folder contents:
let ordered_objects = objects.ordered_objects(object_kind.into());
for &obj in &ordered_objects {
for obj in objects.objects_of_kind(object_kind) {
let scope = obj.scope();

let kind_path = if let Some(scope) = scope {
Expand Down
Loading