Autoloading VTKPythonAlgorithmBase plugins with CMake

Hello there,

I have a couple plugins that I developed using the VTKPythonAlgorithmBase class.
I would like them to be built along with my main project so that they would be loaded automatically after a fresh install. So manually loading the .py files and clicking auto-load is not an option.
I cannot find any example of implementation and my attempts have failed.

Let’s consider the PythonAlgorithmExamples.py file that is included in paraview
( ParaView/Examples/Plugins/PythonAlgorithm/ PythonAlgorithmExamples.py )

I wrote both a CMakeLists.txt and a plugin.cmake for it, and so far, I am able to see that plugin in the plugin list. It is shown as being loaded, and the “Auto Load” line has the checkmark but I can’t instantiate the plugin in paraview.

I expect to be able to create a “Python-based Superquadric Source Example” like when I load the file manually but I can’t.

My CMakeLists.txt

INCLUDE_DIRECTORIES(
${VTK_INCLUDE_DIRS}
)

ADD_PARAVIEW_PLUGIN(PyAlg “1.0”
PYTHON_MODULES PythonAlgorithmExamples.py
)

My plugin.cmake

pv_plugin(PyAlg
DESCRIPTION “PyAlg”
DEFAULT_ENABLED
AUTOLOAD
)

Any clues?
Thank you very much

1 Like