vtkCellPicker + vtkCompositePolyDataMapper2 + vtkMultiBlockDataSet = picking invisible blocks ...


I have a complex tree of PolyDatas nested inside a MultiBlockDataSet.
MultiBlockDataSet is then showed with a vtkCompositePolyDataMapper2.

Individual PolyDatas can be shown or hidden by the mean of

Mapper->GetCompositeDataDisplayAttributes()->SetBlockVisibility(block, ...);

To pick those PolyDatas I’m using vtkCellPicker.
Strange behavior : when a PolyData is hidden (and effectively not shown in the renderer), Cell picker continue to pick it.

I’ve quickly dug inside vtkCellPicker.cxx, and I do not see any place where the visibility check is done (code starting at line 417).

Is it a normal/known behavior ?
How can I restrain picking to visible PolyDatas ?

Thanks !

Not much help on that one …

As far as I can tell, there is a missing test in vtkCellPicker, when scene data is driven by a vtkCompositePolyDataMapper2.

Standard vtkPicker checks propCandidate->GetPickable() when performing Pick3DInternal (vtkPicker.cs line 575).
But vtkCompositePolyDataMapper2 has a method SetBlockPickability that is not used at all during picking process.

According to me (pure nooby in VTK), vtkCellPicker should check the mapper type in IntersectActorWithLine (line 376), and if inheriting from vtkCompositePolyDataMapper2, should retrieve its GetCompositeDataDisplayAttributes and check value of GetBlockPickability on the current vtkDataSet.