Diving in into multiparms again. How can set the default amount value to an expression? Atm I'm linking it to the number of keys in a ramp, with python, AFTER the node is created:
So the multiparm amount is in sync with a Ramp. But only after I set the expression myself since the default of multiparm folder does not have the expression buttons like other parameters (hscript, python, literal) in the Channels tab.
So, what's the best way to sync it by default? Keep in mind I'm looking for a solution that also works for multiparms inside multiparms, so that maybe just a OnCreated won't be enough.
So the ramp parameter I'm applying this callbackscript to is called ramp_dist# but I don't know how to easily get the suffix index of the parm, hence the
probiner Well ended up using callback script which is not a pretty line (and some functions seem to fizzle without warning), but hey, works…
I feel your same pain of writing a single long inline callback. I now do the following: I create a string parm, set it to multi-line and language python. I type there my callback code. Then I simply ‘exec’ that evaluated string parm inside the callback field. Once happy I set string parm to invisible. It's a little bit longer setup, but this I way I can type and visualize easily the callback code.
Thanks that's an idea. Might streamline an issue I was finding with multiParmInstanceIndices() being unsorted and the sort() does not seem to be working on callback script…(?). So that should ease up the development of such solutions.
Or let me know if there's another way to get the parameter suffix reliably. I can't get info about the parm without the index, other wise I would do suffix = parmfullname.
Andr not sure if it can help, do you know that you can use the keyword
kwargs['script_multiparm_index']
to get the index of a multiparm instance?
The issue is that multiple levels of nester multiparm you will have several `script_multiparm_index`, that's what I'm retrieving with multiParmInstanceIndices() but I was wondering if there was a better/proper way.
From the kwargs, `script_multiparm_nesting` states how many indices or script_multiparm there are in the sufix and then one can iterate all the `script_multiparm`s, get their value and construct the parm suffix. If the group name is needed then just need to slice the parm name according to the size of the suffix.