Changing default range of a parameter in python

   3009   1   1
User Avatar
Member
2 posts
Joined: Aug. 2013
Offline
Hi,

I'm trying to change the default range of a parameter in an OTL depending on the length of a list in python.

Example : if the length of that list is 4, I would like to set the default range of the integer parameter to 0-3. If that list has 12, I would like to have 0-11.

Hope that makes sense, and I wonder if that is even possible.

Cheers
FX technical director at Digital domain
http://www.imdb.com/name/nm3501284/ [imdb.com]
http://www.remipierre.fr [remipierre.fr]
User Avatar
Member
1532 posts
Joined: July 2005
Offline
If you are looking for to do this dynamically, you'll need to create your integer parameter as a spare parm via code (perhaps in the ‘on created’ section).

You'll need to get the parmTemplateGroup of your OTL, insert your spare parm into the TemplateGroup, and replace the current parmTemplateGroup with your modified version.

Try something like roughly like this:
b = parent.parmTemplateGroup()
c = hou.IntParmTemplate('variation', ‘Inspect Variation’, 1, (), 1, numberOfVariations, 1, 1,1)
b.insertAfter('sepparm', c)
parent.setParmTemplateGroup(b)

Holler if you have any more questions.

G
  • Quick Links