Following the code here, one can get granular vtkPolyData to pass to k3d in python. However I am currently assigning color to k3d like so;
def rgb2hex(r,g,b):
return eval("0x{:02x}{:02x}{:02x}".format(r,g,b))
#using the actors from [referenced code][1] to get the granular actors from .OBJ
col = actor.GetProperty().GetDiffuseColor()
rgb2hex(int(col[0]*255),int(col[1]*255),int(col[2]*255))
This is ugly and inefficient. vtkPolyDataMapper should be already handling the color, so there must be a way of doing this in a more direct way. How can one use the vtkPolyDataMapper to get a list of colors to pipe to the k3d.vtk_poly_data() color argument?
mapper = actor.GetMapper()
mapper.SetInputData(vtkPolyData)
VTK does not natively provide this formatting (
0xrrggbb
) for color. You always have to deal with 3-components floats or integers.