kevin lee
pajamajama
About Me
Connect
LOCATION
Not Specified
ウェブサイト
Houdini Engine
Availability
Not Specified
Recent Forum Posts
How can I create linked channels on a parm using python? 2020年1月21日20:43
Figured it out!
I initially copied everything over using parm templates, then if you access the node.Parms you can copy everything over with parm.set(otherparm), this copies the linked channels to the previously created parmTemplates.
Here's some example code where I'm switching the parent node's parameters based on the node selection from a dynamic menu
I initially copied everything over using parm templates, then if you access the node.Parms you can copy everything over with parm.set(otherparm), this copies the linked channels to the previously created parmTemplates.
Here's some example code where I'm switching the parent node's parameters based on the node selection from a dynamic menu
def OnSelected(): #get value of menu menuParameter = hou.node("./").parm('pattern'); selectedId = menuParameter.eval() selectedName = menuParameter.menuLabels()[selectedId] #set selected node display selectedNode = hou.node("./{}".format(selectedName)) selectedNode.setDisplayFlag(True) selectedNode.setRenderFlag(True) node = hou.node("./") #add folder for options parmGroup = node.parmTemplateGroup() if parmGroup.find("options") != None: parmGroup.remove(parmGroup.find("options")) parmFolder = hou.FolderParmTemplate("options", "Options") #copy parm templates from selected node and add them to options folder parmTemplates = selectedNode.parmTemplateGroup().parmTemplates() for entry in parmTemplates: parmFolder.addParmTemplate(entry) parmGroup.append(parmFolder) node.setParmTemplateGroup(parmGroup) #get actual parms (not templates) from selected node selectedParms = selectedNode.parms() newParms = node.parms() for newParm in newParms: for selectedParm in selectedParms: if newParm.name() == selectedParm.name(): #matching template, set it to get linked channels newParm.set(selectedParm)