What is the best way to implement plugin options?

rhinocommon

#1

I am implementing a plugin that need some customization and I would like to add a couple of options for the user. I would like to understand if there are some best practices or I should just go on and implement my own panel.

Thanks a lot.
Alberto


(Giulio Piacentino) #2

Hi @Alberto

If you just want to add a couple of options, the best practice would be to add a command option within a command. Either a single GetOption or add options to a GetObject or other custom Getter. If you need to visualize something, a panel can later call into these commands.

Does it help?


#3

Hi,
thanks for the answer, I did not explained myself properly. I mean that I need to store settings for the plugin, not options for a command. Is there a standard way to do this?

Thanks!


(Dale Fugier) #4

Hi Alberto,

The common way for plug-ins to save and restore plug-in specific settings is the use the PersistentSettings class. One of these class members is available from your plug-in object.

For example:

protected override LoadReturnCode OnLoad(ref string errorMessage)
{
  bool enabled = this.Settings.GetBool("Enabled", false);
  // etc...

Does this help?

– Dale


#5

Thanks Dale, this helps a lot!
Alberto