# How to set the default value for a proxy property?

**URL:** https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788
**Category:** Development
**Created:** [March 24, 2021, 9:51pm UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788 "2021-03-24T21:51:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![HollowSun0](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hollowsun0/32/431_2.png) [@HollowSun0](https://discourse.paraview.org/u/HollowSun0)
#### Post date: [March 24, 2021, 9:51pm UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788/1 "2021-03-24T21:51:09Z")

</div>

Dear all,

I’m having trouble adding a proxy property to an existing source proxy.

On Paraview 5.7, after loading an already existing state file containing a source proxy instance, selecting the instance shows an empty proxy property rather than a given proxy from the proxy\_list.

I do not find commits related to this behavior in recent commits so I believe it should still be the same on 5.9. Perhaps I did something wrong or is it simply by design?

Thank you!  
Have a good day,  
Patrick Laurin

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [March 31, 2021, 10:00am UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788/2 "2021-03-31T10:00:07Z")

</div>

Can you elaborate? Preserving values for proxy properties when loaded from state files is critical to any functional loading of state files so I don’t think that’s the issue here. Something else is going on.

---

<div class="post-metadata">

### Author: ![HollowSun0](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hollowsun0/32/431_2.png) [@HollowSun0](https://discourse.paraview.org/u/HollowSun0)
#### Post date: [March 31, 2021, 1:44pm UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788/3 "2021-03-31T13:44:06Z")

</div>

Hi Utkarsh!

I’ve just realized I could’ve been clearer on this. My issue is about adding a proxy property to a filter already used in our state files. If I update the XML definition of the filter, compile and load the state file, the property shows as empty. I do confirm that saving a state file with a value selected preserves the said value.

Although it is possible to make a v2 version of the filter, maybe there is some kind of mechanism I can use such as using [vtkSMStateVersionController](https://kitware.github.io/paraview-docs/nightly/cxx/classvtkSMStateVersionController.html)

Thank you,  
Patrick Laurin

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 1, 2021, 11:44am UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788/4 "2021-04-01T11:44:12Z")

</div>

Assuming you’re doing this in a ParaView plugin and not a custom application, there;s no easy way. Maybe creating an auto-load plugin that monitors `pqApplicationCore::aboutToLoadState` and then modify the XML state to take into account your change is a way to go.

---

<div class="post-metadata">

### Author: ![HollowSun0](https://discourse.paraview.org/user_avatar/discourse.paraview.org/hollowsun0/32/431_2.png) [@HollowSun0](https://discourse.paraview.org/u/HollowSun0)
#### Post date: [April 1, 2021, 7:22pm UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788/5 "2021-04-01T19:22:52Z")

</div>

Hi Utkarsh,

It is a custom application with our own modules attached to it. The filter in question would be found inside one of the modules. Let’s say I add the following proxy property to the filter (Example taken [here](https://github.com/Kitware/ParaView/blob/a528cdfc6be51f2d55bdaf59bfa5448d7438ab19/VTKExtensions/Points/Resources/points.xml#L980)):

```auto
<ProxyProperty name="Kernel" command="SetKernel">
  <ProxyListDomain name="proxy_list">
    <Proxy group="point_interpolation_kernels" name="VoronoiKernel" />
    <Proxy group="point_interpolation_kernels" name="EllipsoidalGaussianKernel" />
    <Proxy group="point_interpolation_kernels" name="GaussianKernel" />
    <Proxy group="point_interpolation_kernels" name="LinearKernel" />
    <Proxy group="point_interpolation_kernels" name="ProbabilisticVoronoiKernel" />
    <Proxy group="point_interpolation_kernels" name="ShepardKernel" />
    <Proxy group="point_interpolation_kernels" name="VoronoiKernel" />
  </ProxyListDomain>
</ProxyProperty>

```

There is no mechanism pushing GaussianKernel as the default value? If I instantiate the filter, I know the first element of the list (VoronoiKernel) is chosen.

If I load a state file with the filter previously saved without the proxy property, I’d have to add a mechanism in `pqApplicationCore::aboutToLoadState` to add the correct proxy to the XML state?

Wouldn’t it be better to edit `vtkSMProxyListDomain` for support of something similar in the style of `default_values="GaussianKernel"`?

Thank you,  
Patrick Laurin

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [April 1, 2021, 11:39pm UTC](https://discourse.paraview.org/t/how-to-set-the-default-value-for-a-proxy-property/6788/6 "2021-04-01T23:39:57Z")

</div>

> [@HollowSun0](#):
>
> Wouldn’t it be better to edit `vtkSMProxyListDomain` for support of something similar in the style of `default_values="GaussianKernel"`?

Yes, makes sense. Feel free to push an MR or report an issue.
