LoadGPPreset works nicely for loading custom named user presets, but I can’t find a way to identify which preset was last loaded. GetActivePreset only works for the built in presets. Ideally we could have a function which would return the name of the currently loaded user preset.
Keep in mind that LoadGPPreset
is an experimental function, so I wouldn’t expect too much additional support for it yet, if ever.
Ignoring for a moment that LoadGPPreset is in fact experimental, what is the actual use case for such a function?
Suppose you use LoadGPPreset to load a GP User preset into a plugin.
Then you edit the plugin directly, tweaking parameters, or perhaps even load a plugin-specific preset through the plugin’s own preset management system or you just change a parameter via a widget in a rackspace.
What value would a function that returns the name of the currently loaded (GP) user now return? The state of the plugin at this point no longer resembles the state that was loaded via LoadGPPreset.
I would expect it to match how it works for built in presets. If you select a built in preset, then make changes, GetActivePreset returns the latest loaded preset index, so for a custom preset it should return whatever you loaded most recently.
I can see in the UI that it has a checkmark next to the last loaded built in preset but none for user so I imagine this would be somewhat complicated to implement. I can get most of the way there using a scriptlet and storing the last loaded preset in a variable though. Just thought I’d note it felt a bit strange that the function has a disparity between how it works for user vs built in.
Which function? LoadGPPreset? That function knows nothing about a plugin’s built-in presets. It is only used when you save the state of a plugin as a GP User Preset.
GetActivePreset does not know anything about GP User Presets - it is only for presets supported internally by a plugin via the standard API.