text = selectedNode[0].path() textAddParm = hou.node(text); #Use the node selected wedgePath = hou.node(textAddParm.parm('soppath').eval()); #Take the path from a parameters in a node tempGrp = textAddParm.parmTemplateGroup() #Create temporary group to append new parameters tempGrp.remove("wedge"); #Delete existing folder if it exist folder = hou.FolderParmTemplate("wedge", "Wedges Paramaters References"); #Recreate the folder tempGrp.append(folder); wedgeParm = [] #Set wedgeParm fonction to be a list for child in wedgePath.children(): #There is 3 child in the soppath directing to the subnetwork paramaterName = child.parm("name1").eval(); parameterNameEval = "@" + paramaterName; parmTemplate = hou.FloatParmTemplate(str(child), paramaterName, 1, default_expression=[parameterNameEval]); wedgeParm.append(parmTemplate); #Append each parameter to wedgeParm list
With this, I have 3 diffents parameters:
wedgeParm[0] wedgeParm[1] wedgeParm[2]
And when I try to add more than one parameters:
tempGrp.appendToFolder(folder, wedgeParm[0]); tempGrp.appendToFolder(folder, wedgeParm[1]); tempGrp.appendToFolder(folder, wedgeParm[2]); textAddParm.setParmTemplateGroup(tempGrp);
It gives me an error (but as long as I use one parameter only, it works):
File "<console>", line 1, in <module> File "hou.session", line 258, in nameTest File "C:\PROGRA~1/SIDEEF~1/HOUDIN~1.332/houdini/python3.11libs\hou.py", line 23461, in appendToFolder return _hou.ParmTemplateGroup_appendToFolder(self, *args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ hou.OperationFailed: The attempted operation failed. Invalid indices/name/parm template
So, do you have any idea why I can add one parameter to the list, but can't add the rest of it? Thanks!