Skip to content

Commit a635246

Browse files
committed
More comments and renames
1 parent 3b2cee5 commit a635246

4 files changed

Lines changed: 12 additions & 8 deletions

File tree

crates/re_viewport/src/space_view_heuristics.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ pub fn all_possible_space_views(
6969

7070
let empty_entities_per_system = EntitiesPerSystem::default();
7171

72-
// Filter out entities that are not used in any of the part (!) systems of this class.
72+
// Find all the entities that are used by the part (!) systems for each class.
73+
// Note that entities_per_system_per_class includes both part-systems *and* context-systems
74+
// so we filter out the context systems before aggregating the entities since context systems
75+
// should not influence the heuristics.
7376
let entities_used_by_any_part_system_of_class: IntMap<_, _> = ctx
7477
.space_view_class_registry
7578
.iter_system_registries()
@@ -434,12 +437,13 @@ fn is_entity_processed_by_part_collection(
434437
false
435438
}
436439

437-
pub fn default_entities_per_system_per_class(
440+
pub fn identify_entities_per_system_per_class(
438441
ctx: &mut ViewerContext<'_>,
439442
) -> EntitiesPerSystemPerClass {
440443
re_tracing::profile_function!();
441444

442445
// TODO(andreas): Handle several primary components.
446+
// This code currently assumes the first component for each archetype is the primary.
443447
let system_collections_per_class: IntMap<
444448
SpaceViewClassName,
445449
(ViewContextCollection, ViewPartCollection),

crates/re_viewport/src/viewport.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use re_viewer_context::{
1616

1717
use crate::{
1818
space_view_entity_picker::SpaceViewEntityPicker,
19-
space_view_heuristics::{default_created_space_views, default_entities_per_system_per_class},
19+
space_view_heuristics::{default_created_space_views, identify_entities_per_system_per_class},
2020
space_view_highlights::highlights_for_space_view,
2121
viewport_blueprint::load_viewport_blueprint,
2222
SpaceInfoCollection, SpaceViewBlueprint, ViewportBlueprint,
@@ -153,7 +153,7 @@ impl<'a, 'b> Viewport<'a, 'b> {
153153
) {
154154
re_tracing::profile_function!();
155155

156-
let entities_per_system_per_class = default_entities_per_system_per_class(ctx);
156+
let entities_per_system_per_class = identify_entities_per_system_per_class(ctx);
157157

158158
for space_view in self.blueprint.space_views.values_mut() {
159159
let space_view_state = self.state.space_view_state_mut(

crates/re_viewport/src/viewport_blueprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use crate::{
1616
},
1717
space_info::SpaceInfoCollection,
1818
space_view::SpaceViewBlueprint,
19-
space_view_heuristics::{default_created_space_views, default_entities_per_system_per_class},
19+
space_view_heuristics::{default_created_space_views, identify_entities_per_system_per_class},
2020
};
2121

2222
// ----------------------------------------------------------------------------
@@ -65,7 +65,7 @@ impl<'a> ViewportBlueprint<'a> {
6565
*has_been_user_edited = Default::default();
6666
*auto_space_views = Default::default();
6767

68-
let entities_per_system_per_class = default_entities_per_system_per_class(ctx);
68+
let entities_per_system_per_class = identify_entities_per_system_per_class(ctx);
6969
for space_view in
7070
default_created_space_views(ctx, spaces_info, &entities_per_system_per_class)
7171
{

crates/re_viewport/src/viewport_blueprint_ui.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use re_space_view::DataBlueprintGroup;
55
use re_viewer_context::{DataBlueprintGroupHandle, Item, SpaceViewId, ViewerContext};
66

77
use crate::{
8-
space_view_heuristics::{all_possible_space_views, default_entities_per_system_per_class},
8+
space_view_heuristics::{all_possible_space_views, identify_entities_per_system_per_class},
99
SpaceInfoCollection, SpaceViewBlueprint, ViewportBlueprint,
1010
};
1111

@@ -369,7 +369,7 @@ impl ViewportBlueprint<'_> {
369369
ui.menu_image_button(texture_id, re_ui::ReUi::small_icon_size(), |ui| {
370370
ui.style_mut().wrap = Some(false);
371371

372-
let entities_per_system_per_class = default_entities_per_system_per_class(ctx);
372+
let entities_per_system_per_class = identify_entities_per_system_per_class(ctx);
373373
for space_view in
374374
all_possible_space_views(ctx, spaces_info, &entities_per_system_per_class)
375375
.into_iter()

0 commit comments

Comments
 (0)