I'm trying to write some Python to explore HAPI in depth (for example be sure of which parmType is any node)
I have written some Python code into a Python Script node directly in Houdini and using an inprocess session to connect.
I'm retrieving a specfic node from a path and listing the infos by using hapi.getParameters on the node in question.
I have defined a multiparmList in the node. When I add multiparm instances it is not reflected in the listing.
Same thing if I edit the parameter interface. I can only get the new parameters if I restart Houdini altogether.
example :
Session : <hapi.Session: type=sessionType.Inprocess, id=0>
Session is already Initialized
Node to query : /obj/test/
NodeId : 2
()
NodeName : test
Type : nodeType.Obj
TotalCookCount : 6
Valid : True
Number of params: 40
>>=================
Multiparmlist ===
MultiParmList : <hapi.ParmInfo: id=37, type=parmType.Multiparmlist>
Number of multiparm childs : 2
=== Child ===
float1 : <hapi.ParmInfo: id=38, type=parmType.FloatStart>
TemplateName : float#
=== Child ===
Int1_ : <hapi.ParmInfo: id=39, type=parmType.IntStart>
TemplateName : Int#_
Here is a reduced version of the script I am currently using :
import hapi session = hapi.createInProcessSession() try: hapi.isInitialized(session) print("Session is already Initialized") except: print("Session not Initialized, initializing") cook_options = hapi.CookOptions() hapi.initialize(session, cook_options, use_cooking_thread = False) def stringFromSH(nameSH): str_len = hapi.getStringBufLength(session, nameSH) name = hapi.getString(session, nameSH, str_len) return name nodeToQuery = hou.chsop("/obj/HAPI_Explorer/inputNode") node = hapi.getNodeFromPath(session, -1, nodeToQuery) nodeInfos = hapi.getNodeInfo(session, node) parmInfos = hapi.getParameters(session, node, 0, nodeInfos.parmCount) for p in parmInfos: print(stringFromSH(p.nameSH) + " : " + str(p))