1 # Plugin Howto {#PluginHowto}
5 ParaView comes with plethora of functionality bundled in: several readers,
6 multitude of filters, different types of views, etc. However, it is not
7 uncommon for developers to want to add new functionality to ParaView to, for
8 example, add support to their new file format or incorporate a new filter into
9 ParaView. ParaView makes it possible to add new functionality by using an
10 extensive plugin mechanism.
12 Plugins can be used to extend ParaView in several ways:
14 * Add new readers, writers, filters
15 * Add custom GUI components such as toolbar buttons to perform common tasks
16 * Add new views in for display data
18 Examples for different types of plugins are provided with the ParaView source
19 under `Examples/Plugins/`.
21 This document has major sections:
23 * First section covers how to use existing plugins in ParaView.
24 * Second section contains information for developers about writing new
31 Plugins are distributed as shared libraries (`*.so` on Unix and macOS, and
32 `*.dll` on Windows). For a plugin to be loadable in ParaView, it must be built
33 with the same version of ParaView as it is expected to be deployed on. Plugins
34 can be classified into two broad categories:
36 * *Server-side plugins*: These are plugins that extend the algorithmic
37 capabilities for ParaView. For example, new filters, readers or writers.
38 Since ParaView processes data on the server-side, these plugins need to be
40 * *Client-side plugins*: These are plugins that extend the ParaView GUI
41 including property panels for new filters, toolbars or views. These plugins
42 need to be loaded on the client.
44 Oftentimes a plugin has both server-side as well as client-side components to
45 it. For example, a plugin that adds a new filter and a property panel that goes
46 with that filter. Such plugins need to be loaded both on the server as well as
49 Generally, users don't have to worry whether a plugin is a server-side or
50 client-side plugin. Simply load the plugin on the server as well as the client.
51 ParaView will include relevant components from plugin on each of the processes.
55 There are four ways for loading plugins:
57 * *Using the GUI* (`Plugin Manager`)
58 - Plugins can be loaded into ParaView using the `Plugin Manager` accessible
59 from the `Tools | Manage Plugins/Extensions` menu. The `Plugin Manager`
60 has two sections for loading client plugins and server plugins (shown
61 only when connected to a server). To load a plugin on the client and
62 server side, simply browse to the plugin shared library. If the plugin is
63 loaded successfully, it will appear in the list of loaded plugins. The
64 `Plugin Manager` also lists the paths it searched to load plugins
66 - The `Plugin Manager` remembers all loaded plugins across ParaView
67 instances, so once a plugin is loaded once, it will appear in the future
69 - You can set up ParaView to automatically load the plugin at startup (for
70 client plugins) or on connecting to the server (for server plugins) by
71 checking the "Auto Load" checkbox on a loaded plugin.
72 - Plugin configuration file can also be added interactively in the UI by clicking on the
73 "Add plugin configuration file". This will add plugins to the list and potentially
74 load them if they are flagged as auto load plugins. Once a plugin have been added
75 this way, it is then saved in the settings. See below for the specification.
77 
78 
80 * *Using environment variable* (Auto-loading plugins)
81 - In order to have ParaView automatically load a set of plugins on startup,
82 one can use the `PV_PLUGIN_PATH` environment variable. `PV_PLUGIN_PATH`
83 may be used to list a set of directories (separated by colon (`:`) for
84 Unix platforms or semi-colon (`;`) on Windows) which ParaView will search
85 on startup to load plugins. This environment variable needs to be set on
86 both the client and server sides to load their respective plugins. Note
87 that plugins in PV_PLUGIN_PATH are always auto-loaded irrespective of the
88 status of the `Auto Load` checkbox in the `Plugin Manager`. Paths in this
89 list may also be of the structure created by the ParaView plugin macros
90 (e.g., `MyPlugin/MyPlugin.so`).
91 - Finer control can be used using the `PV_PLUGIN_CONFIG_FILE` environment
92 variable. `PV_PLUGIN_CONFIG_FILE` can be used to list a set of XML plugin
93 configuration files (separated by colon (`:`) on Unix platforms or
94 semi-colon (`;`) on Windows). ParaView will read these files on startup
95 to load specified plugins. The XML plugin configuration file format looks
96 like this (see below for the complete specification):
101 <Plugin name="MyPlugin" filename="/absolute/path/to/libMyPlugin.so"/>
102 <!-- Note that relative paths are calculated from the directory of this XML file. -->
103 <Plugin name="MyPluginRel" filename="relative/path/to/libMyPlugin.so"/>
107 Plugins listed this way will always be loaded, irrespective of the status
108 of the `Auto Load` checkbox in the `Plugin Manager`.
109 * *Using the ParaView internal plugin configuration file `.plugins`*
110 (Make plugins available and possibly Auto-load plugins)
111 - Plugins that are listed in the `.plugins` file on the client and server
112 will automatically be listed in the `Plugin Manager`, and may optionally
113 be auto loaded. ParaView creates its own `.plugins` file listing plugins
114 known during its build and uses it as the default. An example `.plugins`
115 file, auto loading H5PartReader, looks like this (see below for the complete specification):
118 <?xml version="1.0"?>
120 <Plugin name="Moments" auto_load="0"/>
121 <Plugin name="PrismPlugin" auto_load="0"/>
122 <Plugin name="PointSprite_Plugin" auto_load="0"/>
123 <Plugin name="pvblot" auto_load="0"/>
124 <Plugin name="H5PartReader" auto_load="1"/>
128 * *Default search paths*
129 - Recognized locations are:
130 * A `plugins` subdirectory under the `paraview-X.Y` directory in the
131 library path (usually `lib` on Unix platforms and `bin` on Windows).
133 ## Delayed load plugins
135 When loading a plugin configuration file (see above), it is possible to specify certain parameters
136 that will affect how the plugin will be loaded, eg: `auto_load="1"` will load the plugin as soon as the
137 plugin configuration file is loaded.
139 It is also possible to delay the loading of plugin until they are actually needed, by first
140 only loading the XML part of a plugin and loading the actual plugin shared library file only
141 when the proxy provided by the XML is created.
143 This means that any part of the plugin that is visible to users but not described as XML, such as Qt additions,
144 will not be visible until a proxy is created.
146 This also means that the XML of the plugin must be available alongside the actual plugin and this is where the specific
147 syntax of the plugin configuration file comes into play.
149 A plugin configuration file for a delayed load plugin would look like this:
152 <?xml version="1.0"?>
154 <Plugin name="ElevationFilter" auto_load="0" delayed_load="1">
155 <XML filename="ElevationFilter/MyElevationFilter.xml"/>
160 The `XML` `filename` argument is a relative or absolute path to a XML file.
162 Such file can be automatically generated during the compilation of a ParaView plugin.
164 It would look like this in the `CMakeLists.txt` of a plugin:
167 paraview_plugin_build(
168 RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}"
169 LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}"
170 LIBRARY_SUBDIRECTORY "${PARAVIEW_PLUGIN_SUBDIR}"
171 PLUGINS_FILE_NAME "elev.plugins.xml"
172 DELAYED_LOAD ElevationFilter
176 The XML files are also required to be listed as `SERVER_MANAGER_XMLS` in the `paraview_plugin_add` call,
177 XML files added using `paraview_add_server_manager_xmls` are not supported.
179 ## Plugin configuration file XML Schema
181 Here is the exhaustive plugin configuration file XML schema
186 <?xml version="1.0"?>
188 <Plugin name="PluginName" filename="relative/or/absolute/path/to/plugin.ext" auto_load="bool" delayed_load="bool">
189 <XML filename="relative/or/absolute/path/to/file.xml"/>
190 <XML filename="relative/or/absolute/path/to/file2.xml"/>
195 * The `<Plugins>` tag is the root element of the document, which contains zero-to-many `<Plugin>` tags.
196 * Each `<Plugin>` tag represents a plugin to add with the following configuration:
197 * The `name` attribute (required) uniquely identifies the plugin, it is also used to find the plugin filename in directories relative to the plugin configuration file if the `filename` attribute is not provided.
198 * The `filename` attribute (optional) is a relative or absolute path to the plugin file to be loaded.
199 * The `auto_load` attribute (optional) is a boolean that control if the plugin should be loaded as soon as the plugin is added.
200 * The `delayed_load` attribute (optional) is a boolean that control if the plugin should be *actually* loaded only when needed (see above).
201 * Each `<Plugin>` tag contains zero-to-many `<XML>` tags.
202 * Each `<XML>` tag represents a XML file associated with the plugin, only used in context of `delayed_load="1"`
203 * The `filename` attribute (required) is a relative or absolute path to a the XML file to be loaded in the context of the delayed load mechanism
207 If plugin loading fails, the `PV_PLUGIN_DEBUG` environment variable may be set
208 for either the client or server processes. ParaView will then print verbose
209 information about each step and causes for failure, as show below.
212 ***************************************************
213 Attempting to load /home/utkarsh/Kitware/ParaView3/ParaView3Bin/bin/libSurfaceLIC.so
214 Loaded shared library successfully. Now trying to validate that it's a ParaView plugin.
215 Updating Shared Library Paths: /home/utkarsh/Kitware/ParaView3/ParaView3Bin/bin
216 Plugin instance located successfully. Now loading components from the plugin instance based on the interfaces it implements.
217 ----------------------------------------------------------------
224 ServerManager Plugin : Yes
230 This section covers writing and compiling different types of Plugins. To create
231 a plugin, one must have their own build of ParaView. Binaries downloaded from
232 www.paraview.org do not include necessary header files or import libraries
233 (where applicable) for compiling plugins.
235 The `CMakeLists.txt` file used in all following examples start off with the
239 # ParaView requires CMake 3.8 in order to be used.
240 cmake_minimum_required(VERSION 3.8)
241 project(myplugin C CXX)
243 find_package(ParaView REQUIRED)
246 Where CMake will ask for the `ParaView_DIR` which you point to the ParaView
247 build or install tree you would to build your with.
249 Note that the `C` and `CXX` languages are required in general because ParaView
250 may need to find other packages which are written with only C in mind (MPI is
251 the usual culprit here) and need to know about the C compiler that is
254 ## Exposing an Existing Filter
256 Sometimes, the filter that one wants to add to ParaView is already available in
257 VTK, it's just not exposed through the ParaView GUI. This is the easiest type
258 of plugin to create. There are two options:
260 1. setup the plugin using only an XML file; and
261 2. actually compile the plugin into a shared library.
263 The first option is the easiest, but the second option will prepare you for
264 creating a custom filter in the future as the process is nearly identical.
266 ## Adding a New Filter
268 It is also possible to add new filters to ParaView. The filter has to be a
269 VTK-based algorithm, written as following the standard procedures for writing
270 VTK algorithms. Generally for such cases where we are adding a new VTK class to
271 ParaView (be it a filter, reader or a writer), we need to do the following
274 * Write a *Server Manager Configuration XML* which describes the `Proxy`
275 interface for the filter. Basically, this defines the interface for the
276 client to create and modify instances of the new class on the server side.
277 Please refer to the [ParaView Guide][] for details about writing these
279 * Write a configuration XML for the GUI to make ParaView GUI aware of this
280 new class, if applicable. For filters, this is optional, since ParaView
281 automatically recognizes filters added through plugins and lists them in
282 the *Alphabetical* sub-menu. One may use the GUI configuration XML to add
283 the new filter to a specific category in the *Filters* menu, or add a new
284 category. For readers and writers, this is required since ParaView GUI
285 needs to know what extensions your reader/writer supports etc.
289 Plugins may access resources relative to themselves by using the
290 `paraview_plugin_add_location` interface to get the location of the plugin at
291 runtime. Note that this only works when built as a shared plugin. For static
292 plugins, the path will come in as a `nullptr`. If a plugin with resources
293 intends to support resources, it is recommended to use a `.qrc` file to embed
294 the resources into the plugin.
296 For installation of resources, the `_paraview_build_plugin_directory` variable
297 contains the location of the plugin under the build and install prefixes. Build
298 resources may be placed under
299 `"${CMAKE_BINARY_DIR}/${_paraview_build_plugin_directory}"` and installed with
300 `DESTINATION "${_paraview_build_plugin_directory}"`. The plugin itself belongs
301 to the `${_paraview_build_PLUGINS_COMPONENT}` component, so resources should
302 generally use a component with a related name.
308 If you have not built ParaView from source, using an XML plugin is your only
311 First, a server manager XML for the filter is required. The GUI XML to add the
312 filter to any specific category is optional.
314 For example, let's say we simply want to expose the `vtkCellDerivatives` filter
315 in VTK. Then first, we'll write the server manager configuration XML (call it
316 `CellDerivatives.xml`), similar to what we would have done for adding a new
320 <ServerManagerConfiguration>
321 <ProxyGroup name="filters">
322 <SourceProxy name="MyCellDerivatives" class="vtkCellDerivatives" label="My Cell Derivatives">
324 long_help="Create point attribute array by projecting points onto an elevation vector."
325 short_help="Create a point array representing elevation.">
329 command="SetInputConnection">
330 <ProxyGroupDomain name="groups">
331 <Group name="sources"/>
332 <Group name="filters"/>
334 <DataTypeDomain name="input_type">
335 <DataType value="vtkDataSet"/>
340 </ServerManagerConfiguration>
343 At this point, we can stop and use the plugin in ParaView by loading the XML
344 file directly into the plugin manager.
346 Please note that if you are writing the XML for a filter that takes just one
347 input, you *must* set the `name` attribute for the `InputProperty` XML element
348 to `Input`. If you do not, then the filter will not be displayed properly in
349 ParaView's pipeline browser.
351 ### Compiling into a Shared Library
353 If you have built ParaView from source, it is possible to compile the plugin
354 into into a shared library. To do this, we can use the following top-level:
358 # Standard CMake boilerplate. ParaView's `find_package` requires at least 3.8.
359 cmake_minimum_required(VERSION 3.8)
360 project(sharedlibrary)
362 # These five lines are required in order to set up installation directories
363 # (which also control build directory locations) and enable shared builds
364 # (CMake's default is for a static build).
365 include(GNUInstallDirs)
366 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}")
367 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
368 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}")
369 set(BUILD_SHARED_LIBS ON)
371 # Find ParaView. This will bring in ParaView's CMake API and imported targets.
372 find_package(ParaView REQUIRED)
374 # Scan the plugin file in order to set up internal data structures for building
376 paraview_plugin_scan(
377 # The `paraview.plugin` file describing the plugin.
378 PLUGIN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Plugin/paraview.plugin"
379 # A result variable for the (enabled) plugins found during the scan.
380 PROVIDES_PLUGINS plugins
381 # Enable plugins during this scan by default.
382 ENABLE_BY_DEFAULT ON)
384 # Build the plugins discovered during the scan.
385 paraview_plugin_build(
389 The mentioned `paraview.plugin` file describes the plugin to the build system:
395 Expose the vtkCellDerivatives class to ParaView.
397 # This module provides the `vtkCellDerivatives` filter.
401 In the `Plugin` directory (beside the `paraview.plugin` file), the plugin is
402 given the information it needs to build:
405 paraview_add_plugin(CellDerivatives
407 SERVER_MANAGER_XML CellDerivatives.xml)
410 Then using CMake, one can build a plugin for this new filter. We can now load
411 the plugin through the plugin manager by selecting the created `.so` or `.dll`
414 ### Qt resource plugins
416 Similarly compiled Qt resources (`*.bqrc`) can be loaded at runtime. A `.bqrc`
417 file is a binary file containing resources which can include icons, the GUI
418 configuration XML for adding categories, etc. A `.bqrc` can be made from a
419 `.qrc` by running the `rcc` utility provided by Qt:
422 rcc -binary -o myfile.bqrc myfile.qrc
425 ### Adding a New Filter
427 For this example, refer to `Examples/Plugins/ElevationFilter` in the ParaView
428 source. Let's say we have written a new `vtkMyElevationFilter`
429 (`vtkMyElevationFilter.{h,cxx}`), which extends the functionality of the
430 `vtkElevationFilter` and we want to package that as a plugin for ParaView. For
431 starters, we simply want to use this filter in ParaView (e.g., not doing
432 anything fancy with *Filters* menu categories). As described, we need to write
433 the server manager configuration XML (`MyElevationFilter.xml`). Once that's
434 done, we write a `CMakeLists.txt` file to package this into a plugin.
436 This `CMakeLists.txt` needs to include the following lines:
439 cmake_minimum_required(VERSION 3.8)
442 include(GNUInstallDirs)
443 set(BUILD_SHARED_LIBS ON)
445 find_package(ParaView REQUIRED)
447 paraview_plugin_scan(
448 PLUGIN_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Plugin/paraview.plugin"
449 PROVIDES_PLUGINS plugins
450 ENABLE_BY_DEFAULT ON)
452 paraview_plugin_build(
456 The referenced `paraview.plugin` file contains:
462 An example paraview plugin containing server manager XML and the server
463 manager classes to build. This plugin can be loaded on the server side.
469 And the `CMakeLists.txt` file beside it contains:
472 paraview_add_plugin(ElevationFilter
474 MODULES ElevationFilters
475 MODULE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/ElevationFilters/vtk.module")
478 Because we are building our own custom filter, it needs to be a VTK module in
479 order to support having its information available to the XML code. First, the
480 module is declared in a `vtk.module` file:
491 And then the module is built with its associated server manager XML file
492 attached to the module. Note that the module name cannot be the same as the
493 plugin name due to the way the library targets are managed internally.
497 vtkMyElevationFilter)
499 # Find external packages here using `find_package`.
501 vtk_module_add_module(ElevationFilters
504 # Link to external packages here using `vtk_module_link(ElevationFilters)`.
506 paraview_add_server_manager_xmls(
507 XMLS MyElevationFilter.xml)
510 Then using CMake, one can build a plugin for this new filter. Once this plugin
511 is loaded the filter will appear under the *Alphabetical* list in the *Filters*
512 menu. Note that there will be two libraries in the resulting directory. Be sure
513 to load the `ElevationFilter` one which is the plugin, not the
514 `ElevationFilters` module library.
516 ### Filters with Multiple Input Ports
518 If a filter requires multiple input ports, there are two options:
520 1. Create helper functions in the VTK filter such as `SetYourInputName` which
521 deal with addressing the VTK pipeline in the C++ code; and
522 2. Address/access the input connection by number in the XML. The `port_index`
523 property specifies which input connection the particular input will be
524 connected to. The `SetInputConnection` function is the command that will
525 actually be called with this `port_index` to setup the pipeline.
527 An example XML file for a filter with multiple inputs is below. The filter
528 takes three `vtkPolyData` objects as input.
531 <ServerManagerConfiguration>
532 <ProxyGroup name="filters">
533 <SourceProxy name="LandmarkTransformFilter" class="vtkLandmarkTransformFilter" label="LandmarkTransformFilter">
535 long_help="Align two point sets using vtkLandmarkTransform to compute the best transformation between the two point sets."
536 short_help="vtkLandmarkTransformFilter.">
540 name="SourceLandmarks"
542 command="SetInputConnection">
543 <ProxyGroupDomain name="groups">
544 <Group name="sources"/>
545 <Group name="filters"/>
547 <DataTypeDomain name="input_type">
548 <DataType value="vtkPolyData"/>
551 Set the source data set. This data set that will move towards the target data set.
556 name="TargetLandmarks"
558 command="SetInputConnection">
559 <ProxyGroupDomain name="groups">
560 <Group name="sources"/>
561 <Group name="filters"/>
563 <DataTypeDomain name="input_type">
564 <DataType value="vtkPolyData"/>
567 Set the target data set. This data set will stay stationary.
574 command="SetInputConnection">
575 <ProxyGroupDomain name="groups">
576 <Group name="sources"/>
577 <Group name="filters"/>
579 <DataTypeDomain name="input_type">
580 <DataType value="vtkPolyData"/>
583 Set the source data set landmark points.
588 <!-- see below for what options to put here -->
593 </ServerManagerConfiguration>
596 To set the inputs in ParaView, simply select one of the inputs in the *Pipeline
597 Browser* and then select the filter from the *Filters* menu. This will open a
598 dialog box which will allow you to specify which object to connect to each
601 ### Adding *Categories* to the *Filters* Menu
603 Now suppose we want to add a new category to the *Filters* menu, called
604 *Extensions* and then show this filter in that menu. In that case we need to
605 add a hint to the XML file that tells ParaView what category to display this
606 filter in. In this case, the `Hints` element of the XML file can contain:
610 <ShowInMenu category="Extensions" />
614 If the name of the category is same as an already existing category such as
615 *Data Analysis*, then the filter gets added to the existing category.
619 You can see that some filters in the *Filters* menu (e.g., *Clip*) have icons
620 associated with them. It's possible for the plugin to add icons for filters it
621 adds as well. For that you need to write a Qt resource file (say
622 `MyElevation.qrc`) as follows:
626 <qresource prefix="/MyIcons" >
627 <file>MyElevationIcon.png</file>
632 To use the icon for a filter in the pipeline add the following hint to the
637 <ShowInMenu icon=":/MyIcons/MyElevationIcon.png" />
641 Finally, the plugin's `CMakeLists.txt` file much change to include our
642 `MyElevation.qrc` file as follows:
645 paraview_add_plugin(ElevationFilter
647 MODULES ElevationFilters
648 MODULE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/ElevationFilters/vtk.module"
649 UI_RESOURCES MyElevation.qrc)
652 ### Adding GUI Parameters
654 Simply add these in the server manager XML to expose parameters of the filter
655 to the ParaView user.
659 This property appears as a button containing the text described by the value of the "name" attribute, here: "My Button".
660 When a user click on the button, a call to the command, `MyButtonClicked` is performed directly on VTK class associated with the proxy.
665 command="MyButtonClicked">
669 #### Integer Property
671 This property appears as a text box.
675 name="bStartByMatchingCentroids"
676 command="SetbStartByMatchingCentroids"
677 number_of_elements="1"
682 #### Boolean Property
684 This property appears as a check box control. A boolean property uses the
685 `IntVectorProperty` with an extra line (`BooleanDomain`) indicating this should
686 be a check box rather than a text field.
690 name="bStartByMatchingCentroids"
691 command="SetbStartByMatchingCentroids"
692 number_of_elements="1"
694 <BooleanDomain name="bool"/>
700 This property appears as a text box.
703 <StringVectorProperty
704 name="YourStringVariable"
705 command="SetYourStringVariable"
706 number_of_elements="1"
708 </StringVectorProperty>
713 This property appears as a text box.
716 <DoubleVectorProperty
717 name="YourDoubleVariable"
718 command="SetYourDoubleVariable"
719 number_of_elements="1"
721 </DoubleVectorProperty>
724 #### Multi-Value Double Property
726 This property appears as a text box.
729 <DoubleVectorProperty
730 name="YourDoubleVectorVariable"
731 command="SetYourDoubleVectorVariable"
732 number_of_elements="3"
733 default_values="1.0 0.0 0.0">
734 </DoubleVectorProperty>
737 #### Double Property Slider
739 This creates a slider that ranges from `0.0` to `1.0`.
742 <DoubleVectorProperty
743 name="PercentToRemove"
744 command="SetPercentToRemove"
745 number_of_elements="1"
746 default_values="0.1">
747 <DoubleRangeDomain name="range" min="0.0" max="1.0" />
748 </DoubleVectorProperty>
753 This creates a drop down list with 3 choices. The values associated with the
754 choices may be specified.
759 command="SetTransformMode"
760 number_of_elements="1"
762 <EnumerationDomain name="enum">
763 <Entry value="6" text="RigidBody"/>
764 <Entry value="7" text="Similarity"/>
765 <Entry value="12" text="Affine"/>
768 This property indicates which transform mode will be used.
773 #### Drop Down List with Values from Input Arrays
775 This creates a list that lets you choose among the input arrays of the input of
776 a `ProgrammableFilter`:
779 <StringVectorProperty
780 name="SelectInputScalars"
782 command="SetInputArrayToProcess"
783 number_of_elements="5"
784 element_types="0 0 0 0 2"
788 attribute_type="Scalars"
789 input_domain_name="inputs_array">
791 <Property name="Input" function="Input" />
792 </RequiredProperties>
794 </StringVectorProperty>
797 This will look like the following image:
799 
801 #### Drop Down List with Values from Input File
803 If you need to populate a list with values from a file and be able to
804 select/deselect list entries (e.g., to pick which variables are loaded from the
805 file), use a XML similar to this:
808 <StringVectorProperty information_only="1"
809 name="CellArrayInfo">
810 <ArraySelectionInformationHelper attribute_name="Cell" />
811 </StringVectorProperty>
812 <StringVectorProperty
813 command="SetCellArrayStatus"
815 information_property="CellArrayInfo"
817 name="CellArrayStatus"
818 number_of_elements="0"
819 number_of_elements_per_command="2"
821 <ArraySelectionDomain name="array_list">
823 <Property function="ArrayList"
824 name="CellArrayInfo" />
825 </RequiredProperties>
826 </ArraySelectionDomain>
828 This property lists which cell-centered arrays to read.
830 </StringVectorProperty>
833 You can see an example in use in ParaView's [core readers][] XML.
835 You may also do it in the following manner:
838 <StringVectorProperty
839 command="SetCellArrayStatus"
841 information_property="CellArrayInfo"
843 name="CellArrayStatus"
844 number_of_elements="0"
845 number_of_elements_per_command="2"
847 <ArrayListDomain name="array_list"
848 attribute_type="Scalars"
849 input_domain_name="inputs_array">
851 <Property name="Input" function="Input" />
852 </RequiredProperties>
854 </StringVectorProperty>
857 In which case the result will look like this:
859 
861 <!-- TODO: port this section
862 #### Tutorials for creating filters ====
864 Go to this page for the main article for the tutorials: [[Python Filters Tutorials]]
869 Adding a new reader through a plugin is similar to adding a filter. The only
870 difference is that we do not need to specify what category the reader should be
871 added to in the GUI. For the latest version of ParaView we do not need to
872 specify anything special for the GUI as all of the details of the reader are
873 available in the XML proxy definition of the reader. For ParaView version 4.0.1
874 and earlier we need the XML to define what file extensions this reader can
875 handle. This XML (`MyReaderGUI.xml`) looks like this:
879 <Reader name="MyPNGReader" extensions="png"
880 file_description="My PNG Files">
885 An example `MyPNGReader.xml` is shown below. In almost all cases you must have
886 a `SetFileName` function property. You are free to have other properties as
887 well, as with a standard (non-reader) filter. Also, the `Hints` section is needed
888 in order to associate the file extension with the reader on the client. The
889 `ReaderFactory` hint is what the client uses to identify readers from sources.
891 Optionally, you can provide an information property `RegistrationName` to specify the reader
892 pipeline name to use. `RegistrationName` is a feature available for any proxy, not just readers.
895 <ServerManagerConfiguration>
896 <ProxyGroup name="sources">
897 <SourceProxy name="MyPNGReader" class="vtkMyPNGReader" label="PNGReader">
899 long_help="Read a PNG file."
900 short_help="Read a PNG file.">
902 <StringVectorProperty
905 command="SetFileName"
906 number_of_elements="1">
907 <FileListDomain name="files"/>
909 This property specifies the file name for the PNG reader.
911 </StringVectorProperty>
913 <StringVectorProperty
914 name="RegistrationName"
915 number_of_elements="1"
916 default_values="MyCustomName"
917 command="GetRegistrationName"
918 panel_visibility="never"
919 information_only="1">
921 This property specify the pipeline name for the reader, using the return value of `command`.
922 If `command` attributes is not specified, it uses `default_values`.
924 </StringVectorProperty>
927 <ReaderFactory extensions="png"
928 file_description="PNG File Format" />
932 </ServerManagerConfiguration>
935 The CMake code for a reader plugin uses the same structure as the filter
936 example. The only likely difference is that the plugin should also pass
937 `REQUIRED_ON_SERVER` to `paraview_add_plugin` since the server side needs the
938 reader available for its use.
940 If you want your reader to work correctly with a file series, please refer to [[Animating legacy VTK file series#Making custom readers work with file series|file series animation]] for details.
942 Once you generate the project using CMake and compile the project, in ParaView
943 go to *Tools > Manage Plugins/Extensions*. Under *Local Plugins*, click *Load
944 New* and browse for the shared library file you just created. You should now
945 see your new file type in the *Files of type* list in the *Open file* dialog.
949 Similar to a reader plugin, for a writer plugin we need to tell ParaView what
950 extensions this writer supports. For the current version of ParaView this is
951 done in the `Hints` section of the server manager XML definition as follows:
955 <WriterFactory extensions="tif"
956 file_description="My Tiff Files" />
960 #### Adding Customizations for Properties Panel
962 <!-- TODO link to external page -->
964 [[ParaView/Properties Panel|Properties Panel]] is the primary panel in ParaView
965 used to change the parameters for visualization modules and displays. Plugins
966 can provide new types of [`pqPropertyWidget`][pqPropertyWidget] subclasses that
967 can be used to control properties/property groups on this Properties panel.
969 To register a new `pqPropertyWidget` subclass to be associated with a
970 particular widget type for a property (`vtkSMProperty`), use the following
971 CMake code in your plugin:
974 paraview_plugin_add_property_widget
976 TYPE my_property_widget_type
978 INTERFACES interfaces
981 paraview_add_plugin(propwidget
983 UI_INTERFACES ${interfaces}
987 The `KIND` argument must be one of `WIDGET`, `GROUP_WIDGET`, or
988 `WIDGET_DECORATOR`. For a `vtkSMProperty`, `WIDGET` is required.
990 The `CLASS_NAME` argument must refer to a `pqPropertyWidget` subclass with a
991 constructor with the following signature:
994 ClassName(vtkSMProxy *smproxy, vtkSMProperty *smproperty, QWidget *parentObject)
997 The `TYPE` argument specifies the string that will be used in the server
998 manager XML as the value for the `panel_widget` attribute to request creation
999 of this widget for a `vtkSMProperty` subclass.
1001 To register a new `pqPropertyWidget` subclass to be associated with a
1002 particular widget type for a property group (`vtkSMPropertyGroup`), use
1003 `GROUP_WIDGET` for the `KIND` argument. The referenced `CLASS_NAME` must
1004 subclass `pqPropertyWidget` and have a constructor with the signature:
1007 ClassName(vtkSMProxy *smproxy, vtkSMPropertyGroup *smgroup, QWidget *parentObject);
1010 As before, the `TYPE` specifies the string that will be used in the server
1011 manager XML as the value for the `panel_widget` attribute on a `PropertyGroup`
1012 element to request creation of this widget for that group.
1014 Another mechanism for adding customizations for *Properties* panel is to
1015 provide [`pqPropertyWidgetDecorator`][pqPropertyWidgetDecorator] subclasses to
1016 add custom control logic for widgets on the panel.
1018 Decorators use the `WIDGET_DECORATOR` argument to `KIND`.
1020 The `CLASS_NAME` must point to a `pqPropertyWidgetDecorator` subclass and the
1021 `TYPE` is the string name used to request the creation of the decorator in the
1022 server manager XML as described [[ParaView/Properties Panel|here]].
1024 An example for customizing the Properties panel can be found in the ParaView
1025 source under `Examples/Plugins/PropertyWidgets`.
1027 #### Adding Documentation for Plugins
1029 Developers can provide documentation for plugins that is shown in ParaView's
1030 *Help* window. There are two mechanisms for adding documentation from plugins.
1032 * Any server manager XML files added directly to the `paraview_add_plugin`
1033 function or those attached to modules passed to its `MODULES` argument
1034 using `paraview_add_server_manager_xmls` are automatically parsed to
1035 process `Documentation` elements. HTML pages summarizing the proxy and
1036 properties are automatically generated. This ensures that when the user
1037 clicks "?" for a filter or source added via the plugin, the help window
1038 shows appropriate help pages.
1039 * Using the `DOCUMENTATION_DIR` argument to `paraview_add_plugin` to specify
1040 a directory containing HTML pages and images that gets added a the
1041 documentation for the plugin (in addition to the documentation generated
1042 using the `SERVER_MANAGER_XML` files. For example:
1045 paraview_add_plugin(SurfaceLIC
1047 DOCUMENTATION_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
1050 This results in adding documentation to the *ParaView Online Help* when the
1051 plugin is loaded, as shown below.
1053 
1055 It is also possible to customize further the documentation with 3 additional
1058 * `DOCUMENTATION_ADD_PATTERNS`: If specified, add patterns to search for the
1059 documentation files within `DOCUMENTATION_DIR` other than the default ones
1060 (i.e. `*.html`, `*.css`, `*.png`, `*.js` and `*.jpg`). This can be used to
1061 add new file extension (ex: `*.txt`) or even subdirectories (ex:
1062 `subDir/*.*`). Subdirectory hierarchy is kept so if you store all of your
1063 images in a `img/` sub directory and if your html file is at the root level
1064 of your documentation directory, then you should reference them using
1065 `<img src="img/my_image.png"/>` in the html file.
1066 * `DOCUMENTATION_TOC`: If specified, the function will use the given string to
1067 describe the table of content for the documentation. A TOC is divided into
1068 sections. Every section points to a specific file (`ref` keyword) that is
1069 accessed when selected in the UI. A section that contains other
1070 sections can be folded into the UI. An example of such a string is:
1074 <section title="Top level section title" ref="page1.html">
1075 <section title="Page Title 1" ref="page1.html"/>
1076 <section title="Sub section Title" ref="page2.html">
1077 <section title="Page Title 2" ref="page2.html"/>
1078 <section title="Page Title 3" ref="page3.html"/>
1084 * `DOCUMENTATION_DEPENDENCIES`: Targets that are needed to be built before
1085 actually building the documentation. This can be useful when the plugin
1086 developer relies on a third party documentation generator like Doxygen for
1089 #### Adding a Toolbar
1091 Filters, reader, and writers are by far the most common ways for extending
1092 ParaView. However, ParaView plugin functionality goes far beyond that. The
1093 following sections cover some of these advanced plugins that can be written.
1095 Applications use toolbars to provide easy access to commonly used
1096 functionality. It is possible to have plugins that add new toolbars to
1097 ParaView. The plugin developer implements his own C++ code to handle the
1098 callback for each button on the toolbar. Hence one can do virtually any
1099 operation using the toolbar plugin with some understanding of the ParaView
1100 Server Manager framework and the ParaView GUI components.
1102 Please refer to `Examples/Plugins/SourceToolbar` for this section. There we are
1103 adding a toolbar with two buttons to create a sphere and a cylinder source. For
1104 adding a toolbar, one needs to implement a subclass for
1105 [`QActionGroup`][QActionGroup] which adds the [`QAction`][QAction]s for each of
1106 the toolbar button and then implements the handler for the callback when the
1107 user clicks any of the buttons. In the example `SourceToobarActions.{h,cxx}` is
1108 the `QActionGroup` subclass that adds the two tool buttons.
1110 To build the plugin, the `CMakeLists.txt` file is:
1113 # This is a macro for adding QActionGroup subclasses automatically as toolbars.
1114 paraview_plugin_add_action_group(
1115 CLASS_NAME SourceToolbarActions
1116 GROUP_NAME "ToolBar/SourceToolbar"
1117 INTERFACES interfaces
1120 # Now create a plugin for the toolbar. Here we pass the `interfaces` and
1121 # `sources` returned by the above call.
1122 paraview_add_plugin(SourceToolbar
1124 UI_INTERFACES ${interfaces}
1126 SourceToolbarActions.cxx)
1129 For the `GROUP_NAME`, we are using `ToolBar/SourceToolbar`; here `ToolBar` is a
1130 keyword which implies that the action group is a toolbar (and shows up under
1131 *View > Toolbars* menu) with the name `SourceToolbar`. When the plugin is
1132 loaded, this toolbar will show up with two buttons.
1136 Adding a menu to the menu bar of the main window is almost identical to adding
1137 a toolbar. The only difference is that you use the keyword `MenuBar` in lieu
1138 of `ToolBar` in the `GROUP_NAME` of the action group. So if you change the
1139 `paraview_plugin_add_action_group` command above to the following, the plugin
1140 will add a menu titled `MyActions` to the menu bar.
1143 paraview_plugin_add_action_group(
1144 CLASS_NAME SourceToolbarActions
1145 GROUP_NAME "MenuBar/MyActions"
1146 INTERFACES interfaces
1150 If you give the name of an existing menu, then the commands will be added to
1151 that menu rather than create a new one. So, for example, if the `GROUP_NAME`
1152 is `MenuBar/File`, the commands will be added to the bottom of the *File* menu.
1154 #### Adding a Context Menu
1156 Context menus are popup menus created when a user right-clicks inside a view
1157 (typically a render-view, but possible with any view). You can register a plugin
1158 that will create a context menu with items specific to the object underneath the
1159 cursor at the time the user right-clicks. The first instance of
1160 `pqContextMenuInterface` that returns a non-null menu is used; returning a
1161 null menu indicates the object(s) selected when the user right clicks are not
1162 relevant to your interface. For this reason, your subclass should avoid creating
1163 menus unrelated to a specific application or object type.
1165 To add a `pqContextMenuInterface` subclass to ParaView, simply pass your class
1166 name to the `UI_INTERFACES` argument of `paraview_add_plugin()` and the source,
1167 as usual, to the `SOURCES` argument:
1170 paraview_add_plugin(FancyMenu
1172 UI_INTERFACES FancyMenu
1173 SOURCES FancyMenu.h FancyMenu.cxx
1178 See the `Examples/Plugins/ContextMenu` directory for a simple example.
1180 #### Autostart Plugins
1182 This refers to a plugin which needs to be notified when ParaView starts up or
1183 the plugin is loaded which ever happens later and then notified when ParaView
1184 quits. Example is in `Examples/Plugins/Autostart` in the ParaView source. For
1185 such a plugin, we need to provide a `QObject` subclass
1186 (`pqMyApplicationStarter`) with methods that need to be called on startup and
1190 class pqMyApplicationStarter : public QObject
1194 // Callback for startup.
1195 // This cannot take any arguments
1198 // Callback for shutdown.
1199 // This cannot take any arguments
1204 The `CMakeLists.txt` looks as follows:
1207 # Macro for auto-start plugins. We specify the class name and the methods to
1208 # call on startup and shutdown on an instance of that class. It returns the
1209 # interface and sources created in the variables passed to the `INTERFACES` and
1210 # `SOURCES` arguments, respectively.
1211 paraview_plugin_add_auto_start(
1212 CLASS_NAME pqMyApplicationStarter # the class name for our class
1213 STARTUP onStartup # specify the method to call on startup
1214 SHUTDOWN onShutdown # specify the method to call on shutdown
1215 INTERFACES interfaces
1218 # Create a plugin for this starter
1219 paraview_add_plugin(Autostart
1221 UI_INTERFACES ${interfaces}
1222 SOURCES pqMyApplicationStarter.cxx ${interfaces})
1225 #### Getting the Location of a Dynamically-Loaded Plugin
1227 Some dynamically-loaded plugins include data or text files in the same
1228 directory as the plugin binary object (DLL or shared object). To locate
1229 these files at runtime, plugins can register a callback that is notified
1230 with the file system location of the plugin when it is loaded. To do this,
1231 we need to provide a `QObject` subclass (`pqMyLocationPlugin`) with a
1232 method to store the plugin location.
1235 class pqMyPluginLocation : public QObject
1239 // Callback when plugin is loaded.
1240 void StoreLocation(const char* location);
1244 The `CMakeLists.txt` looks as follows:
1247 # Macro for adding the location callback. We specify the class name and the
1248 # method to call with the filesystem location as `CLASS_NAME` and `STORE`
1249 # arguments. It returns the interface and sources created in the variables
1250 # passed to the `INTERFACES` and `SOURCES` arguments.
1251 paraview_plugin_add_location(
1252 CLASS_NAME pqMyPluginLocation # the class name for our class
1253 STORE StoreLocation # the method to call when the plugin is loaded
1254 INTERFACES interfaces
1258 #### Adding new Representations for 3D View using Plugins
1260 ParaView's 3D view the most commonly used view for showing polygonal or
1261 volumetric data. By default, ParaView provides representation-types for showing
1262 the dataset as surface, wireframe, points etc. It’s possible to add
1263 representations using plugins that extends this set of available
1264 representation types.
1266 Before we start looking at how to write such a plugin, we need to gain some
1267 understanding of the 3D view and its representations. The 3D view uses 3 basic
1268 representation proxies for rendering all types of data:
1270 * (representations, `UnstructuredGridRepresentation`) – for
1271 `vtkUnstructuredGrid` or a composite dataset consisting of
1272 `vtkUnstructuredGrid`.
1273 * (representations, `UniformGridRepresentation`) – for `vtkImageData` or a
1274 composite dataset consisting of `vtkImageData`
1275 * (representations, `GeometryRepresentation`) – for all other data types.
1277 Each of these representation proxies are basically composite representation
1278 proxies that use other representation proxies to do the actual rendering, e.g.,
1279 `GeometryRepresentation` uses `SurfaceRepresentation` for rendering the data as
1280 wireframe, points, surface, and surface-with-edges and `OutlineRepresentation`
1281 for rendering an outline for the data. Subsequently, the 3 composite
1282 representation proxies provide a property named `Representation` which allows
1283 the user to pick the representation type he wants to see the data as. The
1284 composite representation proxy has logic to enable one of its internal
1285 representations based on the type chosen by the user.
1287 These 3 composite representation types are fixed and cannot be changed by
1288 plugins. What plugins can do is add more internal representations to any of
1289 these 3 composite representations to support new representations types that the
1290 user can choose using the representation type combo box on the display tab or
1293 
1295 ##### Using a New Mapper
1297 In this example, we see how to integrate a special polydata mapper written in
1298 VTK into ParaView. Let’s say the mapper is called `vtkMySpecialPolyDataMapper`
1299 which is simply a subclass of `vtkPainterPolyDataMapper`. In practice,
1300 `vtkMySpecialPolyDataMapper` can internally use different painters to do
1301 perform special rendering tasks.
1303 To integrate this mapper into ParaView, first we need to create a
1304 `vtkSMRepresentationProxy` subclass for that uses this mapper. In this example,
1305 since the mapper is a simple replacement for the standard
1306 `vtkPainterPolyDataMapper`, we can define our representation proxy as a
1307 specialization of the `SurfaceRepresentation` as follows:
1310 <ServerManagerConfiguration>
1311 <ProxyGroup name="representations">
1312 <RepresentationProxy
1313 name="MySpecialRepresentation"
1314 class="vtkMySpecialRepresentation"
1315 processes="client|renderserver|dataserver"
1316 base_proxygroup="representations"
1317 base_proxyname="SurfaceRepresentation">
1319 This is the new representation type we are adding. This is identical to
1320 the SurfaceRepresentation except that we are overriding the mapper with
1323 </RepresentationProxy>
1325 </ServerManagerConfiguration>
1328 `vtkMySpecialRepresentation` is a subclass of
1329 `vtkGeometryRepresentationWithFaces` where in the constructor we simply
1330 override the mappers as follows:
1333 vtkMySpecialRepresentation::vtkMySpecialRepresentation()
1335 // Replace the mappers created by the superclass.
1336 this->Mapper->Delete();
1337 this->LODMapper->Delete();
1339 this->Mapper = vtkMySpecialPolyDataMapper::New();
1340 this->LODMapper = vtkMySpecialPolyDataMapper::New();
1342 // Since we replaced the mappers, we need to call SetupDefaults() to ensure
1343 // the pipelines are setup correctly.
1344 this->SetupDefaults();
1348 Next we need to register this new type with the any (or all) of the 3 standard
1349 composite representations so that it will become available to the user to
1350 choose in the representation type combo box. To decide which of the 3 composite
1351 representations we want to add our representation to, think of the input data
1352 types our representation supports. If it can support any type of data set, then
1353 we can add our representation all the 3 representations (as is the case with
1354 this example). However if we are adding a representation for volume rendering
1355 of `vtkUnstructuredGrid` then we will add it only to the
1356 `UnstructuredGridRepresentation`. This is done by using the `Extension` XML
1357 tag. It simply means that we are extending the original XML for the proxy
1358 definition with the specified additions. Now to make this representation
1359 available as a type to the user, we use the `RepresentationType` element , with
1360 `text` used as the text shown for the type in the combo-box, `subproxy`
1361 specifies the name of representation subproxy to activate when the user chooses
1362 the specified type. Optionally one can also specify the `subtype` attribute,
1363 which if present is the value set on a property named `Representation` for the
1364 subproxy when the type is chosen. This allows for the subproxy to provide more
1365 than one representation type.
1368 <ServerManagerConfiguration>
1369 <ProxyGroup name="representations">
1370 <Extension name="GeometryRepresentation">
1372 Extends standard GeometryRepresentation by adding
1373 MySpecialRepresentation as a new type of representation.
1376 <!-- this adds to what is already defined in PVRepresentationBase -->
1378 subproxy="MySpecialRepresentation"
1379 text="Special Mapper"
1383 <Proxy name="MySpecialRepresentation"
1384 proxygroup="representations"
1385 proxyname="MySpecialRepresentation">
1387 <ShareProperties subproxy="SurfaceRepresentation">
1388 <Exception name="Input" />
1389 <Exception name="Visibility" />
1390 <Exception name="Representation" />
1395 </ServerManagerConfiguration>
1398 The `CMakeLists.txt` file is not much different from what it would be like for
1399 adding a simple filter or a reader where the representation class is placed
1400 into the contained module.
1402 Source code for this example is available under
1403 `Examples/Plugins/Representation` in the ParaView source directory.
1407 The ParaView git repository contains many examples in the `Examples/Plugins`
1410 ## Adding plugins to ParaView source
1412 There are several plugins that are included in ParaView source itself and are
1413 built as part of ParaView's build process. To add such a plugin to the ParaView
1414 build there are two options, adding it to the `ParaView/Plugins` directory is
1415 currently the only supported mechanism.
1417 <!-- TODO: Restore the external plugin building process to support custom plugins in static builds.
1419 1. Place the source for the plugin in a directory under `ParaView/Plugins`.
1420 2. Add the source directory to the CMake variable
1421 `EXTRA_EXTERNAL_PLUGIN_DIRS` when building ParaView.
1423 Both approaches result in identical behavior.
1426 In general users should simply build their plugins separately, outside the
1427 ParaView source. However, when building ParaView statically, adding the plugin
1428 to be built as part of ParaView ensures that the static executables load the
1429 plugin, otherwise there is no mechanism for loading a plugin in statically
1432 In your plugin source directory, ParaView searches for a file name
1433 `paraview.plugin` which provides ParaView with information about the plugin.
1434 This file should contain the following contents:
1437 # Comments are allowed.
1441 A description of the plugin. This text is attached to the CMake option to
1444 # List of VTK modules required by the code contained in the plugin. This
1445 # allows ParaView to build the full set of requested modules if the plugin is
1450 If now the plugin is enabled (by the user or by default) by turning ON the
1451 `PARAVIEW_PLUGIN_ENABLE_PluginName` CMake option, then CMake will look for a
1452 `CMakeLists.txt` file next to the `paraview.plugin`. This file contains the
1453 calls to build the plugin including the `paraview_add_plugin` call, and
1454 building of any other libraries that the plugin needs.
1456 A good place to start would be look at examples under `ParaView/Plugins`
1459 ## Plugins in Static Applications
1461 It is possible to import plugins into a ParaView-based application at compile
1462 time. When building ParaView-based applications statically, this is the only
1463 option to bring in components from plugins. When built statically (i.e., with
1464 `BUILD_SHARED_LIBS` set to false), ParaView will automatically link and load
1465 plugins that were enabled via CMake by inserting the necessary
1466 `PV_PLUGIN_IMPORT_INIT` and `PV_PLUGIN_IMPORT` macros.
1468 The code below shows how the `PV_PLUGIN` macros would be used to statically load
1469 plugins in custom applications:
1472 #define PARAVIEW_BUILDING_PLUGIN
1473 #include "vtkPVPlugin.h"
1475 // Adds required forward declarations.
1476 PV_PLUGIN_IMPORT_INIT(MyFilterPlugin)
1477 PV_PLUGIN_IMPORT_INIT(MyReaderPlugin)
1479 class MyMainWindow : public QMainWindow
1484 MyMainWindow::MyMainWindow(...)
1486 // ... after initialization ...
1488 // Calls relevant callbacks to load the plugins and update the
1489 // GUI/Server-Manager
1490 PV_PLUGIN_IMPORT(MyFilterPlugin);
1491 PV_PLUGIN_IMPORT(MyReaderPlugin);
1497 ### *Tools > Manage Plugins* is not visible!
1499 Plugins can only be loaded dynamically when ParaView is built with shared
1500 libraries. You must recompile ParaView with `BUILD_SHARED_LIBS=ON`.
1502 ### Compile error `invalid conversion from 'vtkYourFiltersSuperClass*' to 'vtkYourFilter*'`
1504 Any VTK object that needs to be treated as a filter or source has to be a
1505 `vtkAlgorithm` subclass. The particular superclass a filter is derived from has
1506 to be given not only in the standard C++ way:
1509 class VTKMODULE_EXPORT vtkMyElevationFilter : public vtkElevationFilter
1512 but additionally declared with help of the `vtkTypeMacro`. For the example
1516 class VTKMODULE_EXPORT vtkMyElevationFilter : public vtkElevationFilter
1519 vtkTypeMacro(vtkMyElevationFilter, vtkElevationFilter);
1523 Otherwise, compiling the filter will fail with a variety of error messages
1524 (depending on superclass) like
1527 vtkMyElevationFilter.cxx:19: error: no 'void vtkMyElevationFilter::CollectRevisions(std::ostream&)'
1528 member function declared in class 'vtkMyElevationFilter'
1533 vtkMyElevationFilterClientServer.cxx:97: error: invalid conversion from ‘vtkPolyDataAlgorithm*’ to
1537 ### Mysterious Segmentation Faults in Plugins that use Custom VTK Classes
1539 This primarily concerns plugins that make calls to your own custom `vtkMy` (or
1540 whatever you called it) library of VTK extensions.
1544 * The plugin will load, but causes a segfault when you try to use it.
1545 * If you use a debugger you may notice that in some cases when your code
1546 calls `vtkClassA.MethodB`, what actually gets called is
1547 `vtkClassC.MethodD`, where `MethodB` is a virtual member function. This is
1548 occurs because of different vtable entries in the Paraview-internal
1549 versions of the VTK libraries.
1551 The solution is to make sure that your `vtkMy` library is compiled against
1552 ParaView's internal VTK libraries. Even if you compiled VTK and ParaView using
1553 the same VTK sources, you *must not* link against the external VTK libraries.
1554 (The linker won't complain, because it will find all the symbols it needs, but
1555 this leads to unexpected behaviour.)
1557 To be explicit, when compiling your `vtkMy` library, you must set the CMake
1558 variable `VTK_DIR` to point to the `VTK` subdirectory in the directory in which
1559 you built ParaView. (On my system, CMake automatically finds VTK at
1560 `/usr/lib/vtk-5.2`, and I must change `VTK_DIR` to
1561 `~/source/ParaView3/build/VTK`.)
1563 ### "Is not a valid Qt plugin" in Windows
1565 Make sure that all the DLLs that your plugin depends on are on the `PATH`. If
1566 in doubt, try placing your plugin and all its dependent DLLs in the `bin`
1567 directory of your build and load it from there.
1569 ### The system cannot find the path specified. `error MSB6006: "cmd.exe" exited with code 3.`
1571 You may get an error like this when trying to build your plugin with
1575 1> CS Wrapping - generating vtkMyElevationFilterClientServer.cxx
1576 1> The system cannot find the path specified.
1577 1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(151,5): error MSB6006: "cmd.exe" exited with code 3.
1578 1>Done executing task "CustomBuild" -- FAILED.
1581 This is caused for a mismatch between the configuration you used when building
1582 ParaView (e.g. Debug, Release, etc.) and the configuration currently chosen for
1583 building your plugin. So ensure those match.
1585 The problem is caused because inside the Linker properties there are references
1586 to the `*.lib` files, including the name of the directory that matches the
1587 configuration type, which may look something like
1588 `C:\Users\MyUser\ParaView-v4.2.0-build\lib\Release\vtkPVAnimation-pv4.2.lib`.
1590 ### Changing ParaView_DIR after the first configuration do not work as expected
1592 The plugin infrastructure and package finding logic do not support that as
1593 clearing the cache is not something we can reliably do as a config.cmake file.
1595 Just remove the build directory content and configure from scratch.
1597 [ParaView Guide]: http://www.kitware.com/products/books/paraview.html
1598 [core readers]: https://gitlab.kitware.com/paraview/paraview/-/blob/87babdbeab6abe20aac6f8b2692788abc6bb20ac/ParaViewCore/ServerManager/SMApplication/Resources/readers.xml#L158-179
1599 [pqPropertyWidget]: https://www.paraview.org/paraview-docs/nightly/cxx/classpqPropertyWidget.html
1600 [pqPropertyWidgetDecorator]: https://www.paraview.org/paraview-docs/nightly/cxx/classpqPropertyWidgetDecorator.html
1601 [QActionGroup]: https://doc.qt.io/qt-5/qactiongroup.html
1602 [QAction]: https://doc.qt.io/qt-5/qaction.html