Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into andreas/visual-time-r…
Browse files Browse the repository at this point in the history
…ange-property
  • Loading branch information
Wumpf committed Apr 30, 2024
2 parents 5ac0bad + 27f8a35 commit 39ddac6
Show file tree
Hide file tree
Showing 42 changed files with 597 additions and 116 deletions.
2 changes: 2 additions & 0 deletions crates/re_query/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ required-features = ["to_archetype"]
[[bin]]
name = "clamped_zip"
required-features = ["codegen"]
bench = false


[[bin]]
name = "range_zip"
required-features = ["codegen"]
bench = false


[[bench]]
Expand Down
39 changes: 32 additions & 7 deletions crates/re_query/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,27 @@ impl From<(RangeQuery, RangeResults)> for Results {
///
/// Used internally to avoid unnecessarily caching components that are already cached in other
/// places, for historical reasons.
pub fn cacheable(component_name: re_types::ComponentName) -> bool {
pub fn cacheable(component_name: re_types_core::ComponentName) -> bool {
use std::sync::OnceLock;
static NOT_CACHEABLE: OnceLock<re_types::ComponentNameSet> = OnceLock::new();

use re_types_core::Loggable as _;
let not_cacheable = NOT_CACHEABLE.get_or_init(|| {
static NOT_CACHEABLE: OnceLock<re_types_core::ComponentNameSet> = OnceLock::new();

#[cfg(feature = "to_archetype")]
let component_names = {
// Make sure to break if these names change, so people know to update the fallback path below.
#[cfg(debug_assertions)]
{
assert_eq!(
re_types::components::TensorData::name(),
"rerun.components.TensorData"
);
assert_eq!(
re_types::components::MeshProperties::name(),
"rerun.components.MeshProperties"
);
assert_eq!(re_types::components::Blob::name(), "rerun.components.Blob");
}

use re_types_core::Loggable as _;
[
// TODO(#5974): tensors might already be cached in the ad-hoc JPEG cache, we don't
// want yet another copy.
Expand All @@ -141,8 +156,18 @@ pub fn cacheable(component_name: re_types::ComponentName) -> bool {
// the ad-hoc mesh cache -- we don't want yet another copy.
re_types::components::Blob::name(),
]
.into()
});
};

// Horrible hack so we can still make this work when features are disabled.
// Not great, but this all a hack anyhow.
#[cfg(not(feature = "to_archetype"))]
let component_names = [
"rerun.components.TensorData".into(),
"rerun.components.MeshProperties".into(),
"rerun.components.Blob".into(),
];

let not_cacheable = NOT_CACHEABLE.get_or_init(|| component_names.into());

!component_name.is_indicator_component() && !not_cacheable.contains(&component_name)
}
5 changes: 3 additions & 2 deletions crates/re_space_view/src/space_view.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use itertools::{FoldWhile, Itertools};
use re_entity_db::{external::re_query::PromiseResult, EntityProperties};
use re_types::SpaceViewClassIdentifier;

use crate::SpaceViewContents;
use re_data_store::LatestAtQuery;
Expand All @@ -16,8 +17,8 @@ use re_types_core::archetypes::Clear;
use re_types_core::Archetype as _;
use re_viewer_context::{
ContentsName, DataResult, PerSystemEntities, QueryRange, RecommendedSpaceView, SpaceViewClass,
SpaceViewClassIdentifier, SpaceViewClassRegistry, SpaceViewId, SpaceViewState, StoreContext,
SystemCommand, SystemCommandSender as _, SystemExecutionOutput, ViewQuery, ViewerContext,
SpaceViewClassRegistry, SpaceViewId, SpaceViewState, StoreContext, SystemCommand,
SystemCommandSender as _, SystemExecutionOutput, ViewQuery, ViewerContext,
};

/// A view of a space.
Expand Down
5 changes: 2 additions & 3 deletions crates/re_space_view/src/space_view_contents.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ use re_types::{
archetypes as blueprint_archetypes, components as blueprint_components,
components::QueryExpression,
},
Archetype as _,
Archetype as _, SpaceViewClassIdentifier,
};
use re_types_core::{components::VisualizerOverrides, ComponentName};
use re_viewer_context::{
DataQueryResult, DataResult, DataResultHandle, DataResultNode, DataResultTree,
IndicatedEntities, OverridePath, PerVisualizer, PropertyOverrides, QueryRange,
SpaceViewClassIdentifier, SpaceViewClassRegistry, SpaceViewId, ViewerContext,
VisualizableEntities,
SpaceViewClassRegistry, SpaceViewId, ViewerContext, VisualizableEntities,
};

use crate::{
Expand Down
11 changes: 7 additions & 4 deletions crates/re_space_view_bar_chart/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ use egui::{ahash::HashMap, util::hash};
use re_entity_db::{EditableAutoValue, EntityProperties, LegendCorner};
use re_log_types::EntityPath;
use re_space_view::{controls, suggest_space_view_for_each_entity};
use re_types::datatypes::TensorBuffer;
use re_types::{datatypes::TensorBuffer, SpaceViewClassIdentifier};
use re_viewer_context::{
auto_color, IdentifiedViewSystem as _, IndicatedEntities, PerVisualizer, SpaceViewClass,
SpaceViewClassIdentifier, SpaceViewClassRegistryError, SpaceViewId, SpaceViewState,
SpaceViewSystemExecutionError, ViewQuery, ViewerContext, VisualizableEntities,
SpaceViewClassRegistryError, SpaceViewId, SpaceViewState, SpaceViewSystemExecutionError,
ViewQuery, ViewerContext, VisualizableEntities,
};

use super::visualizer_system::BarChartVisualizerSystem;

#[derive(Default)]
pub struct BarChartSpaceView;

use re_types::View;
type ViewType = re_types::blueprint::views::BarChartView;

impl SpaceViewClass for BarChartSpaceView {
fn identifier() -> SpaceViewClassIdentifier {
"BarChart".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
5 changes: 3 additions & 2 deletions crates/re_space_view_dataframe/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ use re_data_store::{DataStore, LatestAtQuery};
use re_data_ui::item_ui::instance_path_button;
use re_entity_db::{EntityProperties, InstancePath};
use re_log_types::{EntityPath, Instance, Timeline};
use re_types_core::SpaceViewClassIdentifier;
use re_viewer_context::{
SpaceViewClass, SpaceViewClassIdentifier, SpaceViewClassRegistryError, SpaceViewState,
SpaceViewSystemExecutionError, SystemExecutionOutput, UiVerbosity, ViewQuery, ViewerContext,
SpaceViewClass, SpaceViewClassRegistryError, SpaceViewState, SpaceViewSystemExecutionError,
SystemExecutionOutput, UiVerbosity, ViewQuery, ViewerContext,
};

use crate::visualizer_system::EmptySystem;
Expand Down
4 changes: 2 additions & 2 deletions crates/re_space_view_spatial/src/contexts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use std::sync::atomic::AtomicUsize;

pub use annotation_context::AnnotationSceneContext;
pub use depth_offsets::EntityDepthOffsets;
use re_types::SpaceViewClassIdentifier;
pub use transform_context::TransformContext;

// -----------------------------------------------------------------------------

use re_renderer::DepthOffset;
use re_viewer_context::{
Annotations, IdentifiedViewSystem, SpaceViewClassIdentifier, SpaceViewClassRegistryError,
ViewContextSystem,
Annotations, IdentifiedViewSystem, SpaceViewClassRegistryError, ViewContextSystem,
};

/// Context objects for a single entity in a spatial scene.
Expand Down
6 changes: 2 additions & 4 deletions crates/re_space_view_spatial/src/heuristics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ use re_log_types::EntityPath;
use re_types::{
components::{DepthMeter, TensorData},
tensor_data::TensorDataMeaning,
Archetype as _,
};
use re_viewer_context::{
IdentifiedViewSystem, PerSystemEntities, SpaceViewClassIdentifier, ViewerContext,
Archetype as _, SpaceViewClassIdentifier,
};
use re_viewer_context::{IdentifiedViewSystem, PerSystemEntities, ViewerContext};

use crate::{
query_pinhole,
Expand Down
14 changes: 8 additions & 6 deletions crates/re_space_view_spatial/src/space_view_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ use re_log_types::EntityPath;
use re_types::{
archetypes::{DepthImage, Image},
blueprint::archetypes::{Background, VisualBounds},
Archetype, ComponentName,
Archetype, ComponentName, SpaceViewClassIdentifier,
};
use re_viewer_context::{
PerSystemEntities, RecommendedSpaceView, SpaceViewClass, SpaceViewClassIdentifier,
SpaceViewClassRegistryError, SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState,
SpaceViewStateExt as _, SpaceViewSystemExecutionError, ViewQuery, ViewerContext,
VisualizableFilterContext,
PerSystemEntities, RecommendedSpaceView, SpaceViewClass, SpaceViewClassRegistryError,
SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _,
SpaceViewSystemExecutionError, ViewQuery, ViewerContext, VisualizableFilterContext,
};

use crate::{
Expand Down Expand Up @@ -44,9 +43,12 @@ impl VisualizableFilterContext for VisualizableFilterContext2D {
#[derive(Default)]
pub struct SpatialSpaceView2D;

use re_types::View;
type ViewType = re_types::blueprint::views::Spatial2DView;

impl SpaceViewClass for SpatialSpaceView2D {
fn identifier() -> SpaceViewClassIdentifier {
"2D".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
14 changes: 8 additions & 6 deletions crates/re_space_view_spatial/src/space_view_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ use nohash_hasher::IntSet;

use re_entity_db::{EntityDb, EntityProperties};
use re_log_types::EntityPath;
use re_types::{components::ViewCoordinates, Loggable};
use re_types::{components::ViewCoordinates, Loggable, SpaceViewClassIdentifier};
use re_viewer_context::{
PerSystemEntities, RecommendedSpaceView, SpaceViewClass, SpaceViewClassIdentifier,
SpaceViewClassRegistryError, SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState,
SpaceViewStateExt as _, SpaceViewSystemExecutionError, ViewQuery, ViewerContext,
VisualizableFilterContext,
PerSystemEntities, RecommendedSpaceView, SpaceViewClass, SpaceViewClassRegistryError,
SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _,
SpaceViewSystemExecutionError, ViewQuery, ViewerContext, VisualizableFilterContext,
};

use crate::{
Expand Down Expand Up @@ -38,9 +37,12 @@ impl VisualizableFilterContext for VisualizableFilterContext3D {
#[derive(Default)]
pub struct SpatialSpaceView3D;

use re_types::View;
type ViewType = re_types::blueprint::views::Spatial3DView;

impl SpaceViewClass for SpatialSpaceView3D {
fn identifier() -> SpaceViewClassIdentifier {
"3D".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
12 changes: 8 additions & 4 deletions crates/re_space_view_tensor/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ use re_renderer::Colormap;
use re_types::{
datatypes::{TensorData, TensorDimension},
tensor_data::{DecodedTensor, TensorDataMeaning},
SpaceViewClassIdentifier,
};
use re_viewer_context::{
gpu_bridge::{self, colormap_dropdown_button_ui},
IdentifiedViewSystem as _, IndicatedEntities, PerVisualizer, SpaceViewClass,
SpaceViewClassIdentifier, SpaceViewClassRegistryError, SpaceViewId, SpaceViewState,
SpaceViewStateExt as _, SpaceViewSystemExecutionError, TensorStatsCache, ViewQuery,
ViewerContext, VisualizableEntities,
SpaceViewClassRegistryError, SpaceViewId, SpaceViewState, SpaceViewStateExt as _,
SpaceViewSystemExecutionError, TensorStatsCache, ViewQuery, ViewerContext,
VisualizableEntities,
};

use crate::{tensor_dimension_mapper::dimension_mapping_ui, visualizer_system::TensorSystem};

#[derive(Default)]
pub struct TensorSpaceView;

use re_types::View;
type ViewType = re_types::blueprint::views::TensorView;

#[derive(Default)]
pub struct ViewTensorState {
/// Selects in [`Self::state_tensors`].
Expand Down Expand Up @@ -138,7 +142,7 @@ impl PerTensorState {

impl SpaceViewClass for TensorSpaceView {
fn identifier() -> SpaceViewClassIdentifier {
"Tensor".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
7 changes: 5 additions & 2 deletions crates/re_space_view_text_document/src/space_view_class.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use egui::Label;

use re_space_view::suggest_space_view_for_each_entity;
use re_types::SpaceViewClassIdentifier;
use re_viewer_context::external::re_entity_db::EntityProperties;
use re_viewer_context::SpaceViewClassIdentifier;
use re_viewer_context::{
external::re_log_types::EntityPath, SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId,
SpaceViewState, SpaceViewStateExt as _, SpaceViewSystemExecutionError, ViewQuery,
Expand Down Expand Up @@ -46,9 +46,12 @@ impl SpaceViewState for TextDocumentSpaceViewState {
#[derive(Default)]
pub struct TextDocumentSpaceView;

use re_types::View;
type ViewType = re_types::blueprint::views::TextDocumentView;

impl SpaceViewClass for TextDocumentSpaceView {
fn identifier() -> SpaceViewClassIdentifier {
"TextDocument".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
11 changes: 7 additions & 4 deletions crates/re_space_view_text_log/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ use std::collections::BTreeMap;

use re_data_ui::item_ui;
use re_log_types::{EntityPath, TimePoint, Timeline};
use re_types::components::TextLogLevel;
use re_types::{components::TextLogLevel, SpaceViewClassIdentifier};
use re_viewer_context::{
level_to_rich_text, IdentifiedViewSystem as _, RecommendedSpaceView, SpaceViewClass,
SpaceViewClassIdentifier, SpaceViewClassRegistryError, SpaceViewId, SpaceViewSpawnHeuristics,
SpaceViewState, SpaceViewStateExt, SpaceViewSystemExecutionError, ViewQuery, ViewerContext,
SpaceViewClassRegistryError, SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState,
SpaceViewStateExt, SpaceViewSystemExecutionError, ViewQuery, ViewerContext,
};

use super::visualizer_system::{Entry, TextLogSystem};
Expand Down Expand Up @@ -39,9 +39,12 @@ impl SpaceViewState for TextSpaceViewState {
#[derive(Default)]
pub struct TextSpaceView;

use re_types::View;
type ViewType = re_types::blueprint::views::TextLogView;

impl SpaceViewClass for TextSpaceView {
fn identifier() -> SpaceViewClassIdentifier {
"TextLog".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
12 changes: 8 additions & 4 deletions crates/re_space_view_time_series/src/space_view_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ use re_format::next_grid_tick_magnitude_ns;
use re_log_types::{EntityPath, TimeInt, TimeZone};
use re_space_view::{controls, query_view_property_or_default};
use re_types::{
blueprint::components::Corner2D, blueprint::datatypes::VisibleTimeRange, components::Range1D,
blueprint::{components::Corner2D, datatypes::VisibleTimeRange},
components::Range1D,
SpaceViewClassIdentifier, View,
};
use re_viewer_context::external::re_entity_db::{
EditableAutoValue, EntityProperties, TimeSeriesAggregator,
};
use re_viewer_context::{
IdentifiedViewSystem, IndicatedEntities, PerVisualizer, QueryRange, RecommendedSpaceView,
SmallVisualizerSet, SpaceViewClass, SpaceViewClassIdentifier, SpaceViewClassRegistryError,
SpaceViewId, SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _,
SmallVisualizerSet, SpaceViewClass, SpaceViewClassRegistryError, SpaceViewId,
SpaceViewSpawnHeuristics, SpaceViewState, SpaceViewStateExt as _,
SpaceViewSystemExecutionError, SystemExecutionOutput, ViewQuery, ViewSystemIdentifier,
ViewerContext, VisualizableEntities,
};
Expand Down Expand Up @@ -73,11 +75,13 @@ impl SpaceViewState for TimeSeriesSpaceViewState {
#[derive(Default)]
pub struct TimeSeriesSpaceView;

type ViewType = re_types::blueprint::views::TimeSeriesView;

const DEFAULT_LEGEND_CORNER: egui_plot::Corner = egui_plot::Corner::RightBottom;

impl SpaceViewClass for TimeSeriesSpaceView {
fn identifier() -> SpaceViewClassIdentifier {
"TimeSeries".into()
ViewType::identifier()
}

fn display_name(&self) -> &'static str {
Expand Down
3 changes: 3 additions & 0 deletions crates/re_types/src/blueprint/mod.rs

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

11 changes: 11 additions & 0 deletions crates/re_types/src/blueprint/views/.gitattributes

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

Loading

0 comments on commit 39ddac6

Please sign in to comment.