mapper shallowcopy causes error
A mapper that has an input connection, but not a fully instantiated pipeline will cause an error on shallow-copy
import vtk
producer = vtk.vtkArrayCalculator()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(producer.GetOutputPort())
clone = vtk.vtkPolyDataMapper()
clone.ShallowCopy(mapper)
( 0.430s) [main thread ] vtkExecutive.cxx:741 ERR| vtkCompositeDataPipeline (0x1f0c930): Algorithm vtkArrayCalculator(0x1f07b80) returned failure for request: vtkInformation (0x1f0cdd0)
Debug: Off
Modified Time: 165
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA_OBJECT
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0
Without the input connection, the shallow copy executes without error.
The cause is that the copying of the lookup table will trigger vtkMapper::CreateDefaultLookupTable on the copied mapper. This will invoke an update of the pipeline because it uses GetInput to get the input data structure.
The part of CreateDefaultLookupTable that uses the input is actually only relevant for non-data-arrays. I propose to fix this by making that part a separate (protected or private) function that gets called when the mapper is actually going to do color mapping, e.g. in MapScalars and HasTranslucentPolygonalGeometry.