Skip to content

Commit

Permalink
Renames and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
jleibs committed Jan 18, 2024
1 parent ea96bb2 commit f188ae1
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 22 deletions.
4 changes: 2 additions & 2 deletions crates/re_space_view/src/data_query_blueprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use re_log_types::{
};
use re_types_core::archetypes::Clear;
use re_viewer_context::{
blueprint_timepoint, DataQueryId, DataQueryResult, DataResult, DataResultHandle,
blueprint_timepoint_for_writes, DataQueryId, DataQueryResult, DataResult, DataResultHandle,
DataResultNode, DataResultTree, IndicatorMatchingEntities, PerVisualizer, PropertyOverrides,
SpaceViewClassIdentifier, SpaceViewId, StoreContext, SystemCommand, SystemCommandSender as _,
ViewSystemIdentifier, ViewerContext, VisualizableEntities,
Expand Down Expand Up @@ -130,7 +130,7 @@ impl DataQueryBlueprint {
}

fn save_expressions(&self, ctx: &ViewerContext<'_>, entity_path_filter: &EntityPathFilter) {
let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();

let expressions_component = QueryExpressions::from(entity_path_filter);

Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1185,7 +1185,7 @@ impl eframe::App for App {

let app_blueprint = AppBlueprint::new(
store_context.as_ref(),
&self.state.blueprint_query(),
&self.state.blueprint_query_for_viewer(),
egui_ctx,
);

Expand Down
9 changes: 7 additions & 2 deletions crates/re_viewer/src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl AppState {
) {
re_tracing::profile_function!();

let blueprint_query = self.blueprint_query();
let blueprint_query = self.blueprint_query_for_viewer();

let Self {
app_options,
Expand Down Expand Up @@ -417,7 +417,12 @@ impl AppState {
.retain(|store_id, _| store_hub.contains_recording(store_id));
}

pub fn blueprint_query(&self) -> LatestAtQuery {
/// Returns the blueprint query that should be used for generating the current
/// layout of the viewer.
///
/// If `inspect_blueprint_timeline` is enabled, we use the time selection from the
/// blueprint `time_ctrl`. Otherwise, we use a latest query from the blueprint timeline.
pub fn blueprint_query_for_viewer(&self) -> LatestAtQuery {
if self.app_options.inspect_blueprint_timeline {
self.blueprint_cfg.time_ctrl.read().current_query().clone()
} else {
Expand Down
4 changes: 2 additions & 2 deletions crates/re_viewer/src/ui/selection_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use re_ui::list_item::ListItem;
use re_ui::ReUi;
use re_ui::SyntaxHighlighting as _;
use re_viewer_context::{
blueprint_timepoint, gpu_bridge::colormap_dropdown_button_ui, HoverHighlight, Item,
blueprint_timepoint_for_writes, gpu_bridge::colormap_dropdown_button_ui, HoverHighlight, Item,
SpaceViewClass, SpaceViewClassIdentifier, SpaceViewId, SystemCommand, SystemCommandSender as _,
UiVerbosity, ViewerContext,
};
Expand Down Expand Up @@ -781,7 +781,7 @@ fn blueprint_ui(
if let Some(new_entity_path_filter) =
entity_path_filter_ui(ui, &query.entity_path_filter)
{
let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();
let expressions_component =
QueryExpressions::from(&new_entity_path_filter);

Expand Down
7 changes: 4 additions & 3 deletions crates/re_viewer_context/src/blueprint_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ pub fn blueprint_timeline() -> Timeline {
Timeline::new_temporal("blueprint")
}

/// The timepoint to use when writing an update to the blueprint.
#[inline]
pub fn blueprint_timepoint() -> TimePoint {
pub fn blueprint_timepoint_for_writes() -> TimePoint {
TimePoint::from([(blueprint_timeline(), Time::now().into())])
}

Expand All @@ -19,7 +20,7 @@ impl ViewerContext<'_> {
C: re_types::Component + Clone + 'a,
std::borrow::Cow<'a, C>: std::convert::From<C>,
{
let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();

match DataRow::from_cells1_sized(
RowId::new(),
Expand All @@ -46,7 +47,7 @@ impl ViewerContext<'_> {
where
C: re_types::Component + 'a,
{
let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();

let datatype = C::arrow_datatype();

Expand Down
2 changes: 1 addition & 1 deletion crates/re_viewer_context/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub use annotations::{
AnnotationMap, Annotations, ResolvedAnnotationInfo, ResolvedAnnotationInfos,
};
pub use app_options::AppOptions;
pub use blueprint_helpers::{blueprint_timeline, blueprint_timepoint};
pub use blueprint_helpers::{blueprint_timeline, blueprint_timepoint_for_writes};
pub use blueprint_id::{BlueprintId, BlueprintIdRegistry, ContainerId, DataQueryId, SpaceViewId};
pub use caches::{Cache, Caches};
pub use command_sender::{
Expand Down
6 changes: 3 additions & 3 deletions crates/re_viewer_context/src/space_view/view_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use re_types::Loggable;
use smallvec::SmallVec;

use crate::{
blueprint_timepoint, SpaceViewHighlights, SpaceViewId, SystemCommand, SystemCommandSender as _,
ViewSystemIdentifier, ViewerContext,
blueprint_timepoint_for_writes, SpaceViewHighlights, SpaceViewId, SystemCommand,
SystemCommandSender as _, ViewSystemIdentifier, ViewerContext,
};

#[derive(Clone, Debug, PartialEq)]
Expand Down Expand Up @@ -119,7 +119,7 @@ impl DataResult {
return;
};

let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();

let row =
DataRow::from_cells1_sized(RowId::new(), override_path.clone(), timepoint, 1, cell)
Expand Down
6 changes: 3 additions & 3 deletions crates/re_viewport/src/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use re_log_types::{DataRow, EntityPath, RowId};
use re_query::query_archetype;
use re_types_core::{archetypes::Clear, ArrowBuffer};
use re_viewer_context::{
blueprint_timepoint, BlueprintId, BlueprintIdRegistry, ContainerId, SpaceViewId, SystemCommand,
SystemCommandSender as _, ViewerContext,
blueprint_timepoint_for_writes, BlueprintId, BlueprintIdRegistry, ContainerId, SpaceViewId,
SystemCommand, SystemCommandSender as _, ViewerContext,
};

use crate::blueprint::components::GridColumns;
Expand Down Expand Up @@ -181,7 +181,7 @@ impl ContainerBlueprint {
/// Otherwise, incremental calls to `set_` functions will write just the necessary component
/// update directly to the store.
pub fn save_to_blueprint_store(&self, ctx: &ViewerContext<'_>) {
let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();

let Self {
id,
Expand Down
10 changes: 5 additions & 5 deletions crates/re_viewport/src/space_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use re_space_view_time_series::TimeSeriesSpaceView;
use re_types::blueprint::components::{EntitiesDeterminedByUser, Name, SpaceViewOrigin, Visible};
use re_types_core::archetypes::Clear;
use re_viewer_context::{
blueprint_timepoint, DataQueryId, DataResult, DynSpaceViewClass, PerSystemDataResults,
PerSystemEntities, PropertyOverrides, SpaceViewClass, SpaceViewClassIdentifier,
SpaceViewHighlights, SpaceViewId, SpaceViewState, StoreContext, SystemCommand,
SystemCommandSender as _, SystemExecutionOutput, ViewQuery, ViewerContext,
blueprint_timepoint_for_writes, DataQueryId, DataResult, DynSpaceViewClass,
PerSystemDataResults, PerSystemEntities, PropertyOverrides, SpaceViewClass,
SpaceViewClassIdentifier, SpaceViewHighlights, SpaceViewId, SpaceViewState, StoreContext,
SystemCommand, SystemCommandSender as _, SystemExecutionOutput, ViewQuery, ViewerContext,
};

use crate::system_execution::create_and_run_space_view_systems;
Expand Down Expand Up @@ -211,7 +211,7 @@ impl SpaceViewBlueprint {
/// Otherwise, incremental calls to `set_` functions will write just the necessary component
/// update directly to the store.
pub fn save_to_blueprint_store(&self, ctx: &ViewerContext<'_>) {
let timepoint = blueprint_timepoint();
let timepoint = blueprint_timepoint_for_writes();

let Self {
id,
Expand Down

0 comments on commit f188ae1

Please sign in to comment.