[Python] Control Parameters in Ramp UI

   2073   2   2
User Avatar
Member
49 posts
Joined: Feb. 2016
Offline
In the parameter UI, apart from the ramp parm, it also have other ui called ramp1pos, ramp2pos for controlling points on the ramp. When you do node.parms(), it returns all of them. Is it possible to tell if ramp1pos is part of the ramp parm?

Thanks,
Ben
User Avatar
Staff
493 posts
Joined: July 2005
Offline
Ramps are implemented as multi-parms. If the base multiparm is named “ramp”, for each point, there is a parm named “ramp<n>pos” (the horizontal position along the ramp) and “ramp<n>value” (the vertical value at that point in the ramp).

To tell if a given parameter is part of a multiparm (ie, either the pos or value of a point in a ramp), use the .isMultiParmInstance()method of Parm or ParmTuple. You can get a reference to the parent multiparm with .parentMultiParm().

If you have a reference to the parent multiparm (“ramp”) you can use the .multiParmInstances()method to get a list of ramp1pos, ramp1value, ramp2pos, ramp2value, etc. objects.

Hope this helps
Edited by mchaput - Feb. 19, 2020 16:03:24
User Avatar
Member
49 posts
Joined: Feb. 2016
Offline
That's what I need. Thanks!
  • Quick Links