1
- use std:: collections:: BTreeMap ;
2
-
3
1
use egui:: NumExt ;
4
2
use nohash_hasher:: IntMap ;
5
3
6
4
use re_log_types:: EntityPathHash ;
7
5
use re_renderer:: OutlineMaskPreference ;
8
6
use re_viewer_context:: {
9
- ApplicationSelectionState , HoverHighlight , Item , SelectionHighlight , SpaceViewEntityHighlight ,
10
- SpaceViewHighlights , SpaceViewId , SpaceViewOutlineMasks ,
7
+ HoverHighlight , Item , SelectionHighlight , SpaceViewEntityHighlight , SpaceViewHighlights ,
8
+ SpaceViewId , SpaceViewOutlineMasks ,
11
9
} ;
12
10
13
- use crate :: SpaceViewBlueprint ;
14
-
15
11
pub fn highlights_for_space_view (
16
- selection_state : & ApplicationSelectionState ,
12
+ ctx : & re_viewer_context :: ViewerContext < ' _ > ,
17
13
space_view_id : SpaceViewId ,
18
- _space_views : & BTreeMap < SpaceViewId , SpaceViewBlueprint > ,
19
14
) -> SpaceViewHighlights {
20
15
re_tracing:: profile_function!( ) ;
21
16
@@ -36,36 +31,36 @@ pub fn highlights_for_space_view(
36
31
OutlineMaskPreference :: some ( hover_mask_index, 0 )
37
32
} ;
38
33
39
- for current_selection in selection_state. current ( ) . iter_items ( ) {
34
+ for current_selection in ctx . selection_state ( ) . current ( ) . iter_items ( ) {
40
35
match current_selection {
41
36
Item :: ComponentPath ( _) | Item :: SpaceView ( _) | Item :: Container ( _) => { }
42
37
43
- Item :: DataBlueprintGroup ( _space_view_id , _query_id , _entity_path ) => {
44
- // TODO(#4377): Fix DataBlueprintGroup
45
- /*
38
+ Item :: DataBlueprintGroup ( group_space_view_id , query_id , group_entity_path ) => {
39
+ // Unlike for selected objects/data we are more picky for data blueprints with our hover highlights
40
+ // since they are truly local to a space view.
46
41
if * group_space_view_id == space_view_id {
47
- if let Some(space_view) = space_views.get(group_space_view_id) {
48
- // Everything in the same group should receive the same selection outline.
49
- // (Due to the way outline masks work in re_renderer, we can't leave the hover channel empty)
50
- let selection_mask = next_selection_mask();
51
-
52
- space_view.contents.visit_group_entities_recursively(
53
- *group_handle,
54
- &mut |entity_path: &EntityPath| {
42
+ // Everything in the same group should receive the same selection outline.
43
+ // (Due to the way outline masks work in re_renderer, we can't leave the hover channel empty)
44
+ let selection_mask = next_selection_mask ( ) ;
45
+
46
+ let query_result = ctx. lookup_query_result ( * query_id) . clone ( ) ;
47
+
48
+ query_result
49
+ . tree
50
+ . visit_group ( group_entity_path, & mut |handle| {
51
+ if let Some ( result) = query_result. tree . lookup_result ( handle) {
55
52
highlighted_entity_paths
56
- .entry(entity_path.hash())
53
+ . entry ( result . entity_path . hash ( ) )
57
54
. or_default ( )
58
55
. overall
59
56
. selection = SelectionHighlight :: SiblingSelection ;
60
57
let outline_mask_ids =
61
- outlines_masks.entry(entity_path.hash()).or_default();
58
+ outlines_masks. entry ( result . entity_path . hash ( ) ) . or_default ( ) ;
62
59
outline_mask_ids. overall =
63
60
selection_mask. with_fallback_to ( outline_mask_ids. overall ) ;
64
- },
65
- );
66
- }
61
+ }
62
+ } ) ;
67
63
}
68
- */
69
64
}
70
65
71
66
Item :: InstancePath ( selected_space_view_context, selected_instance) => {
@@ -113,35 +108,34 @@ pub fn highlights_for_space_view(
113
108
} ;
114
109
}
115
110
116
- for current_hover in selection_state. hovered ( ) . iter_items ( ) {
111
+ for current_hover in ctx . selection_state ( ) . hovered ( ) . iter_items ( ) {
117
112
match current_hover {
118
113
Item :: ComponentPath ( _) | Item :: SpaceView ( _) | Item :: Container ( _) => { }
119
114
120
- Item :: DataBlueprintGroup ( _space_view_id, _query_id, _entity_path) => {
121
- // TODO(#4377): Fix DataBlueprintGroup
122
- /*
115
+ Item :: DataBlueprintGroup ( group_space_view_id, query_id, group_entity_path) => {
123
116
// Unlike for selected objects/data we are more picky for data blueprints with our hover highlights
124
117
// since they are truly local to a space view.
125
118
if * group_space_view_id == space_view_id {
126
- if let Some(space_view) = space_views.get(group_space_view_id) {
127
- // Everything in the same group should receive the same selection outline.
128
- let hover_mask = next_hover_mask();
119
+ // Everything in the same group should receive the same hover outline.
120
+ let hover_mask = next_hover_mask ( ) ;
121
+
122
+ let query_result = ctx. lookup_query_result ( * query_id) . clone ( ) ;
129
123
130
- space_view.contents.visit_group_entities_recursively(
131
- *group_handle,
132
- &mut |entity_path: &EntityPath| {
124
+ query_result
125
+ . tree
126
+ . visit_group ( group_entity_path, & mut |handle| {
127
+ if let Some ( result) = query_result. tree . lookup_result ( handle) {
133
128
highlighted_entity_paths
134
- .entry(entity_path.hash())
129
+ . entry ( result . entity_path . hash ( ) )
135
130
. or_default ( )
136
131
. overall
137
132
. hover = HoverHighlight :: Hovered ;
138
- let mask = outlines_masks.entry(entity_path.hash()).or_default();
133
+ let mask =
134
+ outlines_masks. entry ( result. entity_path . hash ( ) ) . or_default ( ) ;
139
135
mask. overall = hover_mask. with_fallback_to ( mask. overall ) ;
140
- },
141
- );
142
- }
136
+ }
137
+ } ) ;
143
138
}
144
- */
145
139
}
146
140
147
141
Item :: InstancePath ( _, selected_instance) => {
0 commit comments