First of all, thank you to all the ParaView developers for making this fantastic product! Our team has been using ParaView for serious visualisation tasks in production.
In our use case, we are writing ParaView Python Script to automate the everyday visualisation and analysis works.
In some complex tasks, we need to implement custom filters - for example, calculating momentum on the specified surfaces, annotating the images with the upper/lower bound of the specified data, etc.
Originally, we used ProgrammableFilters to implement such filters. But it becomes quickly tedious to maintain Python scripts that contain ProgrammableFilters, as they accept Python code as a string. The problems are that we cannot apply IDE features directly to those input and we cannot reuse them from other programs.
Fortunately, we found a very nice mechanism for it - vtkPythonAlgorithmBase approach. This works quite nicely, as we can implement custom filters as a real Python script, and we can load it as a custom plugin from ParaView the GUI App.
But here is the question: is there any ways to load vtkPythonAlgorighmBase-based filters WITHOUT resorting to paraview.simple.LoadPlugin?
More specifically, I have the following questions:
Is there any way to use plugins defined in the same file as the ParaView Python Script being executed? In other words, is there any way to use locally-defined vtkPythonAlgorithmBase filters?
Is it possible to use Python import statement to load external vtkPythonAlgorithmBase filters? Currently, we need to use a dirty hack something like:
Is there any way to use plugins defined in the same file as the ParaView Python Script being executed?
Is it possible to use Python import statement to load external vtkPythonAlgorithmBase filters?
I’m afraid there is nothing more than the hack you are using, that being said I think this is a usecase that woul make sense to support more cleanly>
Thank you for pointing it out! It seems a good tentative workaround for the time being. Concerning the security, it might be still good to have a mechanism to load locally-defined filters and/or specified filters by import, as it gives finer-grained control. Is there any possibility that such a feature gets implemented anytime soon?
PV_PLUGIN_CONFIG_FILE let you point a json file allowing for a finer grain.
That being said, I do thing improving the LoadPlugin method to be able to find plugin easily, eg in the local dir, would be a great addition, but that would require funding or contribution.
Got it. I think the workarounds you pointed out works fine for the time being, but when we really need more improvements, we will consider that direction Thank you for your kind replies and suggestions!