@@ -264,6 +264,16 @@ def pickedIds(self, rpc_params: RpcParams) -> dict[str, list[str] | int | None]:
264264 params = schemas .PickedIDS .from_dict (rpc_params )
265265 renderer = self .getView ("-1" ).GetRenderers ().GetFirstRenderer ()
266266
267+ pipelines_to_restore = [
268+ pipeline
269+ for pipeline_id in params .ids
270+ if (pipeline := self .get_vtk_pipeline (pipeline_id )).pick_mapper is not None
271+ ]
272+ for pipeline in pipelines_to_restore :
273+ pick_mapper = pipeline .pick_mapper
274+ if pick_mapper is not None :
275+ pipeline .actor .SetMapper (pick_mapper )
276+
267277 actors = []
268278 picker = vtkCellPicker (tolerance = 0.005 )
269279 picker .Pick (params .x , params .y , 0 , renderer )
@@ -278,6 +288,8 @@ def pickedIds(self, rpc_params: RpcParams) -> dict[str, list[str] | int | None]:
278288
279289 for actor in actors :
280290 actor .SetPickable (True )
291+ for pipeline in pipelines_to_restore :
292+ pipeline .actor .SetMapper (pipeline .mapper )
281293
282294 array_ids = [
283295 id for id in params .ids if self .get_vtk_pipeline (id ).actor in actors
@@ -351,7 +363,22 @@ def setHighlight(
351363 )
352364 params = schemas .Highlight .from_dict (rpc_params )
353365 picker = vtkCellPicker (tolerance = 0.005 )
354- picker .Pick (params .x , params .y , 0 , self .get_renderer ())
366+
367+ pipelines_to_restore = [
368+ pipeline
369+ for pipeline_id in params .ids
370+ if (pipeline := self .get_vtk_pipeline (pipeline_id )).pick_mapper is not None
371+ ]
372+ for pipeline in pipelines_to_restore :
373+ pick_mapper = pipeline .pick_mapper
374+ if pick_mapper is not None :
375+ pipeline .actor .SetMapper (pick_mapper )
376+ try :
377+ picker .Pick (params .x , params .y , 0 , self .get_renderer ())
378+ finally :
379+ for pipeline in pipelines_to_restore :
380+ pipeline .actor .SetMapper (pipeline .mapper )
381+
355382 self .clear_highlights (params .ids )
356383 actor = picker .GetActor ()
357384 pipeline_id = next (
@@ -377,6 +404,11 @@ def setHighlight(
377404 if 0 <= flat_index < len (pipeline .blockDataSets )
378405 else None
379406 )
407+ if dataset :
408+ attr = pipeline .mapper .GetCompositeDataDisplayAttributes ()
409+ if attr and not attr .GetBlockVisibility (dataset ):
410+ self .render (- 1 )
411+ return {}
380412 geode_id = (
381413 pipeline .blockGeodeIds [flat_index ]
382414 if 0 <= flat_index < len (pipeline .blockGeodeIds )
0 commit comments