I am developing a custom widget using widget/representation design pattern inside a ParaView plugin.
I have representation, widget, and xml which exposes them to the server. But I still got
[paraview ] vtkSIProxy.cxx:422 ERR| vtkSIProxy (000002868960E060): Failed to create 'vtkMyAnnotationRepresentation'. This typically means that ParaView does not know about the request class to create an instance of if. Ensure that it has been correctly wrapped using the client-server wrappers and the wrapping has been initialized. Note class names are case-sensitive. Check for typos. Aborting for debugging purposes.
First, I have my XML file.
MyWidget.xml
<ServerManagerConfiguration>
<ProxyGroup name="representations">
<NewWidgetRepresentationProxy class="vtk3DWidgetRepresentation"
name="MyAnnotationWidgetRepresentation">
<IntVectorProperty command="SetEnabled"
default_values="0"
name="Enabled"
number_of_elements="1">
<BooleanDomain name="bool" />
<Documentation>Enable/Disable widget interaction.</Documentation>
</IntVectorProperty>
<SubProxy>
<Proxy name="Prop"
proxygroup="3d_widget_representations"
proxyname="MyAnnotationRepresentation"></Proxy>
<ExposedProperties>
<Property name="PlaceWidget" />
<Property name="Visibility" />
<Property name="HandlePositions" />
<Property name="HandlePositionsInfo" />
<Property name="Closed" />
<Property name="LineColor" />
<Property name="CurrentHandleIndex" />
<Property name="CurrentHandleIndexInfo" />
</ExposedProperties>
</SubProxy>
<SubProxy>
<Proxy name="Widget"
proxygroup="3d_widgets"
proxyname="MyAnnotationWidget"></Proxy>
</SubProxy>
<!-- End of PolyLineWidgetRepresentation -->
</NewWidgetRepresentationProxy>
</ProxyGroup>
<!-- Define representation for the widget -->
<ProxyGroup name="3d_widget_representations">
<Proxy class="vtkMyAnnotationRepresentation"
name="MyAnnotationRepresentation">
<Documentation>Representation for poly line source.</Documentation>
</Proxy>
</ProxyGroup>
<!-- Define 3D widget -->
<ProxyGroup name="3d_widgets">
<Proxy base_proxygroup="3d_widgets"
base_proxyname="WidgetBase"
class="vtkMyAnnotationWidget"
name="MyAnnotationWidget"></Proxy>
</ProxyGroup>
this is where I use MyAnnotationWidget
<ProxyGroup name="sources">
<SourceProxy name="MyDummySource"
class="vtkDummySource">
<DoubleVectorProperty command="SetPoint"
default_values="0 0 0 1 0 0"
name="Points"
number_of_elements="6"
number_of_elements_per_command="3"
repeat_command="1"
set_number_command="SetNumberOfPoints"
use_index="1">
</DoubleVectorProperty>
<IntVectorProperty command="SetClosed"
default_values="0"
name="Closed"
number_of_elements="1">
<BooleanDomain name="bool" />
</IntVectorProperty>
<PropertyGroup label="Annotation widget" panel_widget="my_annotation_widget">
<Property function="HandlePositions" name="Points" />
<Property function="Closed" name="Closed" />
</PropertyGroup>
</SourceProxy>
</ProxyGroup>
</ServerManagerConfiguration>
Next I have vtkMyAnnotationWidget.h/cxx
and vtkMyAnnotationRepresentation.h/cxx
(in this example, they are the same as vtkPolyLineWidget and vtkPolyLineRepresentation)
Then, I have pqMyAnnotationWidget.h/cxx
which are the same as pqSplinePropertyWidget except that in the constrcutor widget_smname
is set to MyAnnotationRepresetation.
CMakeLists.txt of vtk module
paraview_add_server_manager_xmls (
XMLS MyWidget.xml)
Set(classes
vtkMyAnnotationRepresentation
vtkMyAnnotationWidget
)
vtk_module_add_module(VTK::MyPlugins
CLASSES ${classes}
)
CMakeLists.txt of plugin
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
list(APPEND CMAKE_AUTOUIC_SEARCH_PATHS
"${CMAKE_CURRENT_SOURCE_DIR}/Qt/UI")
set(ui_files)
set(qrc_files)
set(sources)
set(interfaces)
# add ui files
list(APPEND ui_files
Qt/UI/pqMyAnnotationWidget.ui
)
# add widget interface
list(APPEND sources
Qt/pqMyAnnotationWidget.cxx
Qt/pqMyAnnotationWidget.h
)
paraview_plugin_add_property_widget(
KIND GROUP_WIDGET
TYPE "my_annotation_widget"
CLASS_NAME pqMyAnnotationWidget
INTERFACES property_interfaces
SOURCES property_sources)
list(APPEND interfaces
${property_interfaces})
list(APPEND sources
${property_sources})
paraview_add_plugin(MyPVPlugin
REQUIRED_ON_CLIENT
REQUIRED_ON_SERVER
VERSION "1.0"
UI_FILES ${ui_files}
UI_INTERFACES ${interfaces}
UI_RESOURCES ${qrc_files}
SOURCES ${sources}
MODULES VTK::MyPlugins
MODULE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/vtk.module"
XML_DOCUMENTATION OFF)
I managed to get this far by reading the source code portion regarding how widget and representation is created. But I am not sure why the server is still not aware of vtkMyAnnotationRepresentation. What am I missing here?
Thanks,
Cam