# What is the correct workflow to develop custom interactive widget in ParaView

**URL:** https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189
**Category:** Development
**Created:** [March 16, 2022, 2:44am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189 "2022-03-16T02:44:53Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [March 16, 2022, 2:44am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/1 "2022-03-16T02:44:53Z")

</div>

Dear ParaView community,

I am still learning ParaView and I recently start to implement a custom 3D interactive widget. This is the workflow that I summarized (please correct me if I am wrong)

1. Implement vtkMyCustomWidgetRepresentation.h/.cxx and vtkMyCustomWidgetWidget.h/.cxx
2. Add the representation XML to Remoting/Views/Resources/3dwidgets\_remotingviews.xml so the server can register it.
3. Implement pqMyCustomWidgetProperty.h/.cxx
4. Add

```auto
else if (type == "InteractiveMyCustomWidget")
{
  return new pqMyCustomWidgetProperty(proxy, group, parentWidget);
}

```

in Qt/ApplicationComponents/pqStandardPropertyWidgetInterface.cxx  
5. Now my question is where should I put PropertyGroup panel\_widget=“InteractiveMyCustomWidget”?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 16, 2022, 12:50pm UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/2 "2022-03-16T12:50:48Z")

</div>

Yes but no. This is the process to add a interactive widget to ParaView.

I suppose that in your case you want to add that in your paraview based application, then you want to add that in a paraview plugin, not in ParaView directly.

---

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [March 17, 2022, 5:15am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/3 "2022-03-17T05:15:40Z")

</div>

Then what is the correct way to add an interactive widget in plugin?  
Is the plugin structured in the following way?

```auto
-- CMakeLists.txt
-- paraview.plugin
-- MyWidget
    -- CMakeLists.txt
    -- vtk.module
    -- MyCustomWidget.xml
    -- vtkMyCustomWidgetRepresentation.h
    -- vtkMyCustomWidgetRepresentation.cxx
    -- vtkMyCustomWidget.h
    -- vtkMyCustomWidget.cxx
    -- vtkMyCustomWidgetProperty.h
    -- vtkMyCustomWidgetProperty.cxx

```

But if I don’t change the source code `pqStandardPropertyWidgetInterface.cxx`, how does it know what property to return?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 17, 2022, 8:05am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/4 "2022-03-17T08:05:09Z")

</div>

It is a bit more complex than that. You should take a look at `Examples/Plugins/PropertyWidgets` in paraview sources.

> But if I don’t change the source code `pqStandardPropertyWidgetInterface.cxx`, how does it know what property to return?

This is supported for plugin to declare their own widgets and uses them.

---

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [March 17, 2022, 5:58pm UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/5 "2022-03-17T17:58:55Z")

</div>

`Examples/Plugins/PropertyWidgets` only replaces an existing property with a new property in a vtkShrinkFilter.  
When a vtkShrinkFilter is created in ParaView, a pipelinesource will be created. Based on the panel\_widget, it knows what property to display in UI. But how does it know what widget to display in the 3D scene? Where am I supposed to implement this logic?

How do I understand relationship between filter - widget - representation - property?

---

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [March 17, 2022, 6:22pm UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/6 "2022-03-17T18:22:48Z")

</div>

If I create a filter inherited from `vtkPlaneCutter`, I will automatically have a widget (a slice plane with its normal) when this filter is created. where is it in the source code and how it is associated with `vtkPlaneCutter`?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 22, 2022, 10:02am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/7 "2022-03-22T10:02:30Z")

</div>

> [@Cam](#):
>
> But how does it know what widget to display in the 3D scene? Where am I supposed to implement this logic?

The same as in ParaView, with XML files.

> where is it in the source code and how it is associated with `vtkPlaneCutter`?

XMLs

> `Examples/Plugins/PropertyWidgets` only replaces an existing property with a new property in a vtkShrinkFilter.

Indeed, but better than nothing. We should add a plugin showing how to create an interactive vtk widget.

---

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [March 23, 2022, 3:43am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/8 "2022-03-23T03:43:46Z")

</div>

Yes, please! I really need to learn how to create an interactive vtk widget in ParaView.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 23, 2022, 8:31am UTC](https://discourse.paraview.org/t/what-is-the-correct-workflow-to-develop-custom-interactive-widget-in-paraview/9189/9 "2022-03-23T08:31:45Z")

</div>

I’ve opened an issue for it but one would need to contribute in order to move it forward.  
[https://gitlab.kitware.com/paraview/paraview/-/issues/21324](https://gitlab.kitware.com/paraview/paraview/-/issues/21324)
