RESOLVED: CustomPars not keeping values when destroyed and recreated (same name) - TD099.2019.19160

Hi !

I’m currently working on a system where customPars are created dynamically. Some of the names of the operator’s customPars are changing when I update them and some stay the same, but they are all recreated.

In the docs (Custom Parameters - Derivative under " Deleting Custom Parameters"), it says " Tip : If you destroy a parameter and re-create it in the same script, the parameter will to hang onto its current values/expressions." The problem is that my customPars values aren’t kept even if the destroy/append action are executed in the same script (and the customPar’s name stays the same).

My customPars are toggles, but I tried this with a int and the same result occurred.

Ex. code affecting a slider that has a toggle named “Day” (toggled on) :
op(‘slider0’).par.Day.destroy()
op(‘slider0’).customPages[0].appendInt(“Day”)

After the script executed, the toggle value is off.

I wondered if I understood the docs correctly, but if so, I think it might be a bug.

Thank you for your help on this !

You can store the values before destroying and then reapply. Also, you might check out the TDFunctions wiki… getParInfo, applyParInfo functions will duplicate the old data exactly, include parameter modes, expressions, etc.

Thanks for your response. For sure, storing the values would be my option if what I found in the wiki isn’t working finally. But the matter is that this functionality (Tip : If you destroy a parameter and re-create it in the same script, the parameter will to hang onto its current values/expressions) would be great in my case and reduce the number of functions necessary to achieve my goal.

Reviewing the code, that Tip: is incorrect and has been removed.

The only place where custom parameters values are preserved, is when re-creating them in Script Operators (CHOP, SOP, TOP), and pulsing the ‘Setup Parameters’ button.

Sorry for the confusion and frustration,

Rob.

Thank you for your response !

Marc

@rob FYI that this (Tip:) still appears on a wiki page of the same name but different case (parameters vs. Parameters):
https://docs.derivative.ca/Custom_parameters

That rogue page has been deleted, sorry, don’t know how that happened. :grimacing:

1 Like