Skip to content

Commit cb652ab

Browse files
authored
Basic ability to show components that only differ by archetype/field name on same entity (#9877)
1 parent 9f16f45 commit cb652ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+556
-379
lines changed

crates/store/re_entity_db/src/instance_path.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,13 @@ impl FromStr for InstancePath {
100100
let DataPath {
101101
entity_path,
102102
instance,
103-
component_name,
103+
component_descriptor,
104104
} = DataPath::from_str(s)?;
105105

106-
if let Some(component_name) = component_name {
107-
return Err(PathParseError::UnexpectedComponentName(component_name));
106+
if let Some(component_descriptor) = component_descriptor {
107+
return Err(PathParseError::UnexpectedComponentDescriptor(
108+
component_descriptor,
109+
));
108110
}
109111

110112
let instance = instance.unwrap_or(Instance::ALL);
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use re_types_core::ComponentName;
1+
use re_types_core::{ComponentDescriptor, ComponentName};
22

33
use crate::path::EntityPath;
44

@@ -11,16 +11,16 @@ pub struct ComponentPath {
1111
/// `camera / "left" / points / #42`
1212
pub entity_path: EntityPath,
1313

14-
/// "color"
15-
pub component_name: ComponentName,
14+
/// e.g. `Points3D:Color#color`
15+
pub component_descriptor: ComponentDescriptor,
1616
}
1717

1818
impl ComponentPath {
1919
#[inline]
20-
pub fn new(entity_path: EntityPath, component_name: ComponentName) -> Self {
20+
pub fn new(entity_path: EntityPath, component_descriptor: ComponentDescriptor) -> Self {
2121
Self {
2222
entity_path,
23-
component_name,
23+
component_descriptor,
2424
}
2525
}
2626

@@ -30,16 +30,21 @@ impl ComponentPath {
3030
}
3131

3232
#[inline]
33-
pub fn component_name(&self) -> &ComponentName {
34-
&self.component_name
33+
pub fn component_name(&self) -> ComponentName {
34+
self.component_descriptor.component_name
35+
}
36+
37+
#[inline]
38+
pub fn component_descriptor(&self) -> &ComponentDescriptor {
39+
&self.component_descriptor
3540
}
3641
}
3742

3843
impl std::fmt::Display for ComponentPath {
3944
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4045
self.entity_path.fmt(f)?;
4146
f.write_str(":")?;
42-
self.component_name.fmt(f)?;
47+
self.component_descriptor.fmt(f)?;
4348
Ok(())
4449
}
4550
}

crates/store/re_log_types/src/path/data_path.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use re_types_core::ComponentName;
1+
use re_types_core::ComponentDescriptor;
22

33
use crate::{EntityPath, Instance};
44

55
/// A general path to some data.
66
///
77
/// This always starts with an [`EntityPath`], followed by an optional instance index,
8-
/// followed by an optional [`ComponentName`].
8+
/// followed by an optional [`ComponentDescriptor`].
99
///
1010
/// For instance:
1111
///
@@ -17,7 +17,7 @@ use crate::{EntityPath, Instance};
1717
pub struct DataPath {
1818
pub entity_path: EntityPath,
1919
pub instance: Option<Instance>,
20-
pub component_name: Option<ComponentName>,
20+
pub component_descriptor: Option<ComponentDescriptor>,
2121
}
2222

2323
impl std::fmt::Display for DataPath {
@@ -26,8 +26,8 @@ impl std::fmt::Display for DataPath {
2626
if let Some(instance) = &self.instance {
2727
write!(f, "[#{instance}]")?;
2828
}
29-
if let Some(component_name) = &self.component_name {
30-
write!(f, ":{component_name:?}")?;
29+
if let Some(component_descriptor) = &self.component_descriptor {
30+
write!(f, ":{component_descriptor:?}")?;
3131
}
3232
Ok(())
3333
}

0 commit comments

Comments
 (0)