I would like to display a texture maps on spheres as part of a new source class, PythonSolarSystemSource
. The plugin currently creates 8 vtkSphereSource()
objects and animates them in orbit about the origin. I can manually go in to the display and add texture maps to each of these, but I would like to have that automated in the plugin. I can create an instance of vtkTextureMapToSphere()
and add a vtkSphereSource()
as an input connection like this.
self.sphere = vtkSphereSource()
self.texture = vtkTextureMapToSphere()
self.texture.AddInputConnection(self.sphere.GetOutputPort())
When I output the texture map I see a copy of the input sphere.
from vtkmodules.vtkCommonDataModel import vtkMultiBlockDataSet
output = vtkMultiBlockDataSet.GetData(outInfo, 0)
output.SetBlock(0, self.sphere.GetOutput())
output.SetBlock(1, self.texture.GetOutput())
However, I can’t figure out how to add an image to the texture map and have it display. I’ve tried using vtkJPEGReader()
and vtkTexture()
objects, but I can’t add them as input connections to the vtkTextureMapToSphere()
object.
I’ve realized in the GUI the texture map file is selected in the Display tab. Can I access the display tab from a python plugin? Any hints?