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

Add point-of-view entity and component to the dataframe view's UI #7331

Merged
merged 13 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 12 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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5449,6 +5449,7 @@ version = "0.19.0-alpha.1+dev"
dependencies = [
"egui",
"egui_extras",
"itertools 0.13.0",
"re_chunk_store",
"re_data_ui",
"re_entity_db",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ table TimeRangeQuery (
/// Name of the timeline this applies to.
timeline: rerun.datatypes.Utf8 (order: 100);

/// Point-of-view entity.
pov_entity: rerun.datatypes.EntityPath (order: 200);

/// Point-of-view component.
pov_component: rerun.datatypes.Utf8 (order: 300);
abey79 marked this conversation as resolved.
Show resolved Hide resolved

/// Beginning of the time range.
start: rerun.datatypes.TimeInt (order: 200);
start: rerun.datatypes.TimeInt (order: 400);

/// End of the time range (inclusive).
end: rerun.datatypes.TimeInt (order: 300);
end: rerun.datatypes.TimeInt (order: 500);
}
223 changes: 220 additions & 3 deletions crates/store/re_types/src/blueprint/datatypes/time_range_query.rs

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

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ impl Default for TimeRangeQuery {
fn default() -> Self {
Self {
timeline: Utf8::from("log_time"),
pov_entity: Default::default(),
pov_component: Default::default(),
start: TimeInt::MIN,
end: TimeInt::MAX,
}
Expand Down
39 changes: 39 additions & 0 deletions crates/store/re_types_core/src/reflection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,37 @@ pub struct Reflection {
pub archetypes: ArchetypeReflectionMap,
}

impl Reflection {
/// Find an [`ArchetypeReflection`] based on its short name.
///
/// Useful when the only information available is the short name, e.g. when inferring archetype
/// names from an indicator component.
//TODO( #6889): tagged component will contain a fully qualified archetype name, so this function
// will be unnecessary.
pub fn archetype_reflection_from_short_name(
&self,
short_name: &str,
) -> Option<&ArchetypeReflection> {
// note: this mirrors `ArchetypeName::short_name`'s implementation
self.archetypes
.get(&ArchetypeName::from(short_name))
.or_else(|| {
self.archetypes.get(&ArchetypeName::from(format!(
"rerun.archetypes.{short_name}"
)))
})
.or_else(|| {
self.archetypes.get(&ArchetypeName::from(format!(
"rerun.blueprint.archetypes.{short_name}"
)))
})
.or_else(|| {
self.archetypes
.get(&ArchetypeName::from(format!("rerun.{short_name}")))
})
}
}

/// Runtime reflection about components.
pub type ComponentReflectionMap = nohash_hasher::IntMap<ComponentName, ComponentReflection>;

Expand Down Expand Up @@ -50,6 +81,14 @@ pub struct ArchetypeReflection {
pub fields: Vec<ArchetypeFieldReflection>,
}

impl ArchetypeReflection {
/// Iterate over this archetype's required fields.
#[inline]
pub fn required_fields(&self) -> impl Iterator<Item = &ArchetypeFieldReflection> {
self.fields.iter().filter(|field| field.is_required)
}
}

/// Additional information about an archetype's field.
#[derive(Clone, Debug)]
pub struct ArchetypeFieldReflection {
Expand Down
1 change: 1 addition & 0 deletions crates/viewer/re_space_view_dataframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ re_viewport_blueprint.workspace = true

egui_extras.workspace = true
egui.workspace = true
itertools.workspace = true
2 changes: 1 addition & 1 deletion crates/viewer/re_space_view_dataframe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! A Space View that shows the data contained in entities in a table.

mod latest_at_table;
mod query_kind_ui;
mod query_kind;
mod space_view_class;
mod table_ui;
mod time_range_table;
Expand Down
Loading
Loading