Versioning for custom properties


Custom properties don’t have built-in support for versioning. After you create an instance of a property, the Define callback is never called again. So if you update your custom property with new parameters, you won’t see those new parameters in existing instances of the property.

If you want to support versioning, you can build it into the OnInit callback.

Add a Version parameter to the custom property. Then in the OnInit, you can compare this Version parameter against the current version of the custom property. If the property was created by an older version of the plugin, then you can update the property by adding parameters or by calling EditParameterDefinition to modify an existing parameter. But you cannot cannot remove parameters (instead, hide them).

If you have custom properties that don’t a Version parameter, then the most you can do is check for the existence of the Version parameter. If it is not there, then you know the property is older and needs to be updated.

Finally, you need to rebuild the PPG layout whenever OnInit is called. The typical way to do this is to get rid of the DefineLayout function and implement your own “RebuildLayout” function.

Here’s an example plugin that shows how to update an existing instance of a property:
Continue reading