Hello all,
I managed to use a QuadricLODActor with a composite mapper but then encountered crashes for example, when zooming out.
It appears that vtkQuadricLODActor::Render will decide whether or not to rebuild LOD. If this is the case then it will call mapper::GetInput.
The issue is that the composite mapper will return NULL here. And the code will crash a bit later when PolyData::GetBounds will be called on NULL.
Is it wrong trying to use a composite mapper with such actor?
Should the actor be patched to call mapper::GetInputDataObject(0, 0) if composite?
I am currently using a more simple vtkLODActor but would like to hear your suggestions.
Thank you
Here is a minimal crashy Python script (tested on VTK8.2.1 and VTK9):
import vtk
composite = vtk.vtkMultiBlockDataSet()
for i in (1, 2):
sphere = vtk.vtkSphereSource()
sphere.SetCenter(i, 0., 0.)
sphere.SetRadius(0.5)
sphere.Update()
composite.SetBlock(i, sphere.GetOutput())
mapper = vtk.vtkCompositePolyDataMapper2()
mapper.SetInputDataObject(composite)
# XXX THE CRASH TRIGGER
crash = True
if crash:
actor = vtk.vtkQuadricLODActor()
else:
actor = vtk.vtkLODActor()
actor.SetMapper(mapper)
renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
window = vtk.vtkRenderWindow()
window.AddRenderer(renderer)
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(window)
window.Render()
interactor.Start()