Skip to content

Commit

Permalink
Add runtime experimental flag for query clamping (#5014)
Browse files Browse the repository at this point in the history
We likely won't ever polish it if we cannot play with it to begin with.

Related:
- #5013
  • Loading branch information
teh-cmc committed Feb 2, 2024
1 parent 28ea856 commit 1dad7c8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ impl SeriesLineSystem {
for data_result in query.iter_visible_data_results(Self::identifier()) {
let mut points = Vec::new();

let time_range = determine_time_range(query, data_result, plot_bounds);
let time_range = determine_time_range(
query,
data_result,
plot_bounds,
ctx.app_options.experimental_plot_query_clamping,
);

{
re_tracing::profile_scope!("primary", &data_result.entity_path.to_string());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ impl SeriesPointSystem {
for data_result in query.iter_visible_data_results(Self::identifier()) {
let mut points = Vec::new();

let time_range = determine_time_range(query, data_result, plot_bounds);
let time_range = determine_time_range(
query,
data_result,
plot_bounds,
ctx.app_options.experimental_plot_query_clamping,
);

{
re_tracing::profile_scope!("primary", &data_result.entity_path.to_string());
Expand Down
3 changes: 2 additions & 1 deletion crates/re_space_view_time_series/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub fn determine_time_range(
query: &ViewQuery<'_>,
data_result: &re_viewer_context::DataResult,
plot_bounds: Option<egui_plot::PlotBounds>,
enable_query_clamping: bool,
) -> TimeRange {
let visible_history = match query.timeline.typ() {
re_log_types::TimeType::Time => data_result.accumulated_properties().visible_history.nanos,
Expand All @@ -51,7 +52,7 @@ pub fn determine_time_range(
// the plot widget handles zoom after we provide it with data for the current frame,
// this results in an extremely jarring frame delay.
// Just try it out and you'll see what I mean.
if false {
if enable_query_clamping {
if let Some(plot_bounds) = plot_bounds {
time_range.min = TimeInt::max(
time_range.min,
Expand Down
7 changes: 6 additions & 1 deletion crates/re_space_view_time_series/src/visualizer_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ impl LegacyTimeSeriesSystem {
for data_result in query.iter_visible_data_results(Self::identifier()) {
let mut points = Vec::new();

let time_range = determine_time_range(query, data_result, plot_bounds);
let time_range = determine_time_range(
query,
data_result,
plot_bounds,
ctx.app_options.experimental_plot_query_clamping,
);

{
re_tracing::profile_scope!("primary", &data_result.entity_path.to_string());
Expand Down
8 changes: 8 additions & 0 deletions crates/re_viewer/src/ui/rerun_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,14 @@ fn experimental_feature_ui(
"Primary caching: range queries",
)
.on_hover_text("Toggle primary caching for range queries.\nApplies to the 2D/3D point cloud, 2D/3D box, text log and time series space views.");

re_ui
.checkbox(
ui,
&mut app_options.experimental_plot_query_clamping,
"Plots: query clamping",
)
.on_hover_text("Toggle query clamping for the plot visualizers.");
}

#[cfg(debug_assertions)]
Expand Down
5 changes: 5 additions & 0 deletions crates/re_viewer_context/src/app_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ pub struct AppOptions {
/// Applies to the 2D/3D point cloud, 2D/3D box, text log and time series space views.
pub experimental_primary_caching_range: bool,

/// Toggle query clamping for the plot visualizers.
pub experimental_plot_query_clamping: bool,

/// Displays an overlay for debugging picking.
pub show_picking_debug_overlay: bool,

Expand Down Expand Up @@ -65,6 +68,8 @@ impl Default for AppOptions {
experimental_primary_caching_latest_at: true,
experimental_primary_caching_range: true,

experimental_plot_query_clamping: false,

show_picking_debug_overlay: false,

inspect_blueprint_timeline: false,
Expand Down

0 comments on commit 1dad7c8

Please sign in to comment.