Skip to content

Commit bdae196

Browse files
authored
Fix freestanding store helpers coming back from the dead (#2378)
Not sure what happened there
1 parent 591e7dc commit bdae196

File tree

5 files changed

+64
-130
lines changed

5 files changed

+64
-130
lines changed

crates/re_data_store/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@ pub mod entity_properties;
1010
pub mod entity_tree;
1111
mod instance_path;
1212
pub mod store_db;
13-
mod util;
1413

1514
pub use entity_properties::*;
1615
pub use entity_tree::*;
1716
pub use instance_path::*;
1817
pub use store_db::StoreDb;
19-
pub use util::*;
2018

2119
#[cfg(feature = "serde")]
2220
pub use editable_auto_value::EditableAutoValue;

crates/re_data_store/src/store_db.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,16 @@ impl StoreDb {
211211
self.store_info().map(|ri| &ri.application_id)
212212
}
213213

214+
#[inline]
215+
pub fn store_mut(&mut self) -> &mut re_arrow_store::DataStore {
216+
&mut self.entity_db.data_store
217+
}
218+
219+
#[inline]
220+
pub fn store(&self) -> &re_arrow_store::DataStore {
221+
&self.entity_db.data_store
222+
}
223+
214224
pub fn store_kind(&self) -> StoreKind {
215225
self.store_id.kind
216226
}

crates/re_data_store/src/util.rs

Lines changed: 0 additions & 87 deletions
This file was deleted.

crates/re_viewer/src/ui/blueprint_load.rs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
22

33
use ahash::HashMap;
44

5-
use re_data_store::{query_timeless_single, EntityPath};
5+
use re_data_store::EntityPath;
66
use re_viewer_context::SpaceViewId;
77
use re_viewport::{
88
blueprint_components::{
@@ -64,52 +64,52 @@ impl Blueprint {
6464
}
6565

6666
fn load_panel_state(path: &EntityPath, blueprint_db: &re_data_store::StoreDb) -> Option<bool> {
67-
query_timeless_single::<PanelState>(&blueprint_db.entity_db.data_store, path)
67+
blueprint_db
68+
.store()
69+
.query_timeless_component::<PanelState>(path)
6870
.map(|p| p.expanded)
6971
}
7072

7173
fn load_space_view(
7274
path: &EntityPath,
7375
blueprint_db: &re_data_store::StoreDb,
7476
) -> Option<SpaceViewBlueprint> {
75-
query_timeless_single::<SpaceViewComponent>(&blueprint_db.entity_db.data_store, path)
77+
blueprint_db
78+
.store()
79+
.query_timeless_component::<SpaceViewComponent>(path)
7680
.map(|c| c.space_view)
7781
}
7882

7983
fn load_viewport(
8084
blueprint_db: &re_data_store::StoreDb,
8185
space_views: HashMap<SpaceViewId, SpaceViewBlueprint>,
8286
) -> Viewport {
83-
let auto_space_views = query_timeless_single::<AutoSpaceViews>(
84-
&blueprint_db.entity_db.data_store,
85-
&VIEWPORT_PATH.into(),
86-
)
87-
.unwrap_or_else(|| {
88-
// Only enable auto-space-views if this is the app-default blueprint
89-
AutoSpaceViews(
90-
blueprint_db
91-
.store_info()
92-
.map_or(false, |ri| ri.is_app_default_blueprint()),
93-
)
94-
});
95-
96-
let space_view_visibility = query_timeless_single::<SpaceViewVisibility>(
97-
&blueprint_db.entity_db.data_store,
98-
&VIEWPORT_PATH.into(),
99-
)
100-
.unwrap_or_default();
101-
102-
let space_view_maximized = query_timeless_single::<SpaceViewMaximized>(
103-
&blueprint_db.entity_db.data_store,
104-
&VIEWPORT_PATH.into(),
105-
)
106-
.unwrap_or_default();
107-
108-
let viewport_layout: ViewportLayout = query_timeless_single::<ViewportLayout>(
109-
&blueprint_db.entity_db.data_store,
110-
&VIEWPORT_PATH.into(),
111-
)
112-
.unwrap_or_default();
87+
let auto_space_views = blueprint_db
88+
.store()
89+
.query_timeless_component::<AutoSpaceViews>(&VIEWPORT_PATH.into())
90+
.unwrap_or_else(|| {
91+
// Only enable auto-space-views if this is the app-default blueprint
92+
AutoSpaceViews(
93+
blueprint_db
94+
.store_info()
95+
.map_or(false, |ri| ri.is_app_default_blueprint()),
96+
)
97+
});
98+
99+
let space_view_visibility = blueprint_db
100+
.store()
101+
.query_timeless_component::<SpaceViewVisibility>(&VIEWPORT_PATH.into())
102+
.unwrap_or_default();
103+
104+
let space_view_maximized = blueprint_db
105+
.store()
106+
.query_timeless_component::<SpaceViewMaximized>(&VIEWPORT_PATH.into())
107+
.unwrap_or_default();
108+
109+
let viewport_layout: ViewportLayout = blueprint_db
110+
.store()
111+
.query_timeless_component::<ViewportLayout>(&VIEWPORT_PATH.into())
112+
.unwrap_or_default();
113113

114114
let unknown_space_views: HashMap<_, _> = space_views
115115
.iter()

crates/re_viewer/src/ui/blueprint_sync.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use arrow2_convert::field::ArrowField;
2-
use re_data_store::store_one_component;
32
use re_log_types::{Component, DataCell, DataRow, EntityPath, RowId, TimePoint};
43
use re_viewer_context::SpaceViewId;
54
use re_viewport::{
@@ -71,7 +70,9 @@ pub fn sync_panel_expanded(
7170

7271
let component = PanelState { expanded };
7372

74-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
73+
blueprint_db
74+
.store_mut()
75+
.insert_component(&entity_path, &timepoint, component);
7576
}
7677
}
7778

@@ -94,7 +95,9 @@ pub fn sync_space_view(
9495
space_view: space_view.clone(),
9596
};
9697

97-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
98+
blueprint_db
99+
.store_mut()
100+
.insert_component(&entity_path, &timepoint, component);
98101
}
99102
}
100103

@@ -134,17 +137,23 @@ pub fn sync_viewport(
134137

135138
if viewport.auto_space_views != snapshot.auto_space_views {
136139
let component = AutoSpaceViews(viewport.auto_space_views);
137-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
140+
blueprint_db
141+
.store_mut()
142+
.insert_component(&entity_path, &timepoint, component);
138143
}
139144

140145
if viewport.visible != snapshot.visible {
141146
let component = SpaceViewVisibility(viewport.visible.clone());
142-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
147+
blueprint_db
148+
.store_mut()
149+
.insert_component(&entity_path, &timepoint, component);
143150
}
144151

145152
if viewport.maximized != snapshot.maximized {
146153
let component = SpaceViewMaximized(viewport.maximized);
147-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
154+
blueprint_db
155+
.store_mut()
156+
.insert_component(&entity_path, &timepoint, component);
148157
}
149158

150159
// Note: we can't just check `viewport.trees != snapshot.trees` because the
@@ -165,13 +174,17 @@ pub fn sync_viewport(
165174
has_been_user_edited: viewport.has_been_user_edited,
166175
};
167176

168-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
177+
blueprint_db
178+
.store_mut()
179+
.insert_component(&entity_path, &timepoint, component);
169180

170181
// TODO(jleibs): Sort out this causality mess
171182
// If we are saving a new layout, we also need to save the visibility-set because
172183
// it gets mutated on load but isn't guaranteed to be mutated on layout-change
173184
// which means it won't get saved.
174185
let component = SpaceViewVisibility(viewport.visible.clone());
175-
store_one_component(blueprint_db, &entity_path, &timepoint, component);
186+
blueprint_db
187+
.store_mut()
188+
.insert_component(&entity_path, &timepoint, component);
176189
}
177190
}

0 commit comments

Comments
 (0)