Hi,
I am trying to mimic the Hda's ‘Promote Parameter’ behavior, using python.
I've been able to add hda's parameters, with default values, using:
oParmTemplate = hou.StringParmTemplate(…
oParmTemplate = hou.ButtonParmTemplate(…
oHdaDefefinition.setParmTemplateGroup(oParmTemplateGroup)
But I can't find how to add a ‘Linked channels’, in the channels section (Edit Operator Type Properties –> Parameter).
Is it possible to do so using python?
Thanks,
Jonathan
Python promote parameter
2468 2 1- jonathan.pgagne
- Member
- 33 posts
- Joined: 5月 2015
- Offline
- dabinlapau
- Member
- 1 posts
- Joined: 7月 2020
- Offline
I know this is an old post, but I had to do something similar and took the approach below:
Houdini Version: 19.0.383 (Python 3, which is now the default )
""" Suppose we want to promote the parameters tx,ty and tz from a node right inside the hda """ # node: a node right inside the hda hdaDef = node.parent().type().definition() # get HDADefinition parmTemplateGroup = hdaDef.parmTemplateGroup() targetParmTuple = node.parmTuple("t") # get parmTuple for t (which holds tx,ty,tz) targetParmTemplate = targetParmTuple.parmTemplate() parmTemplateGroup.append(targetParmTemplate) hdaDef.setParmTemplateGroup(parmTemplateGroup, rename_conflicting_parms=True) # update HDA for parm in targetParmTuple: # link node parameters to HDA parameters parm.setExpression(f'ch("../{parm.name()}")') # XXX: Might need some more tweaking on the targetParmTemplate in some cases # XXX: the HDA needs to be saved manually after the script
Houdini Version: 19.0.383 (Python 3, which is now the default )
- Andr
- Member
- 899 posts
- Joined: 2月 2016
- Offline
-
- Quick Links