Get List of color transfer functions

I need to obtain a list of active color transfer functions, but I can’t figure out how to.

Here is a minimum code that visualizes a variable named ‘Swirl’:

# trace generated using paraview version 5.7.0-RC2
from paraview.simple import *

renderView1 = GetActiveViewOrCreate('RenderView')

fastUniformGrid1 = FastUniformGrid()
fastUniformGrid1Display = Show(fastUniformGrid1, renderView1)
ColorBy(fastUniformGrid1Display, ('POINTS', 'Swirl', 'Magnitude'))
fastUniformGrid1Display.RescaleTransferFunctionToDataRange(True, False)
fastUniformGrid1Display.SetScalarBarVisibility(renderView1, True)
swirlLUT = GetColorTransferFunction('Swirl')
swirlPWF = GetOpacityTransferFunction('Swirl')

What I need is a function like GetColorTransferFunctions:

ListOfLUTs = GetColorTransferFunctions() # = [ GetColorTransferFunction('Swirl') ] in the above example

Or, alternatively, a function that provides the names of variables for which there is a LUT:

ListOfVariableNames = GetVariableNames( withLUT=True ) # = ['Swirl'] in the above example

This is not exposed. You can implement it using vtkSMSessionProxyManager::GetProxies

I’m not familiar with the vtkSMSessionProxyManager thing. Is it available in a python script that I would run in the shell or via pvbatch/pvpython?

@mwestphal, there is

servermanager.ProxyManager().GetProxies(groupname=?, proxyname=?)

but what are the arguments needed to obtain the names of the LUTs?

mmmh, proxyname='LookupTable' ?

servermanager.ProxyManager().GetProxies("lookup_tables", "PVLookupTable") should do the trick.

it returns an empty list

My bad, there is no direct way to do that. You can do it this way :

proxyList = []
nProxies = servermanager.ProxyManager().GetNumberOfProxies('lookup_tables')
for i in range(nProxies):
  proxyName = servermanager.ProxyManager().GetProxyName('lookup_tables', i)
  proxyList.add(servermanager.ProxyManager().GetProxy('lookup_tables', proxyName))