Skip to content

Commit ac9dd5b

Browse files
committed
Do not query for event unnecessarily (again)
1 parent 28dfcb1 commit ac9dd5b

File tree

1 file changed

+43
-30
lines changed
  • crates/viewer/re_time_panel/src

1 file changed

+43
-30
lines changed

crates/viewer/re_time_panel/src/lib.rs

+43-30
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,8 @@ impl TimePanel {
657657
entity_data: &EntityData,
658658
ui: &mut egui::Ui,
659659
) {
660+
re_tracing::profile_function!();
661+
660662
let entity_path = &entity_data.entity_path;
661663
let item = TimePanelItem::entity_path(entity_path.clone());
662664
let is_selected = ctx.selection().contains_item(&item.to_item());
@@ -819,6 +821,8 @@ impl TimePanel {
819821
entity_data: &EntityData,
820822
ui: &mut egui::Ui,
821823
) {
824+
re_tracing::profile_function!();
825+
822826
for child in &entity_data.children {
823827
self.show_entity(
824828
ctx,
@@ -846,13 +850,6 @@ impl TimePanel {
846850
let item = TimePanelItem::component_path(component_path.clone());
847851
let timeline = time_ctrl.timeline();
848852

849-
let component_has_data_in_current_timeline = store
850-
.entity_has_component_on_timeline(
851-
time_ctrl.timeline(),
852-
entity_path,
853-
&component_name,
854-
);
855-
856853
let response = ui
857854
.list_item()
858855
.render_offscreen(false)
@@ -957,32 +954,48 @@ impl TimePanel {
957954
);
958955

959956
let is_visible = ui.is_rect_visible(full_width_rect);
960-
if is_visible && component_has_data_in_current_timeline {
961-
// show the data in the time area:
962-
let row_rect = Rect::from_x_y_ranges(
963-
time_area_response.rect.x_range(),
964-
response_rect.y_range(),
965-
);
966957

967-
highlight_timeline_row(ui, ctx, time_area_painter, &item.to_item(), &row_rect);
958+
if is_visible {
959+
let component_has_data_in_current_timeline = store
960+
.entity_has_component_on_timeline(
961+
time_ctrl.timeline(),
962+
entity_path,
963+
&component_name,
964+
);
968965

969-
let db = match self.source {
970-
TimePanelSource::Recording => ctx.recording(),
971-
TimePanelSource::Blueprint => ctx.store_context.blueprint,
972-
};
966+
if component_has_data_in_current_timeline {
967+
// show the data in the time area:
968+
let row_rect = Rect::from_x_y_ranges(
969+
time_area_response.rect.x_range(),
970+
response_rect.y_range(),
971+
);
973972

974-
data_density_graph::data_density_graph_ui(
975-
&mut self.data_density_graph_painter,
976-
ctx,
977-
time_ctrl,
978-
db,
979-
time_area_painter,
980-
ui,
981-
&self.time_ranges_ui,
982-
row_rect,
983-
&item,
984-
true,
985-
);
973+
highlight_timeline_row(
974+
ui,
975+
ctx,
976+
time_area_painter,
977+
&item.to_item(),
978+
&row_rect,
979+
);
980+
981+
let db = match self.source {
982+
TimePanelSource::Recording => ctx.recording(),
983+
TimePanelSource::Blueprint => ctx.store_context.blueprint,
984+
};
985+
986+
data_density_graph::data_density_graph_ui(
987+
&mut self.data_density_graph_painter,
988+
ctx,
989+
time_ctrl,
990+
db,
991+
time_area_painter,
992+
ui,
993+
&self.time_ranges_ui,
994+
row_rect,
995+
&item,
996+
true,
997+
);
998+
}
986999
}
9871000
}
9881001
}

0 commit comments

Comments
 (0)