Super new to Houdini Python scripting and I've come across a bit of a roadblock.
I'm trying to build an asset to find named textures in a folder to automatically build materials with one click.
What I've got so far works great. I have a button parameter on the HDA which runs the code in the PythonModule, with the following callback script:
kwargs['node'].hdaModule().onButtonPress(kwargs['node'], kwargs['parm'])
I've managed to read in the parameter values using hou.pwd().evalParm(). However, it seems as if the changes to the parameters are only read in when I'm applying the changes from the Type Properties panel. I can't seem to be able to assign parameter values to existing variables with a button press. This is what I'd ideally like to accomplish:
regex_albedo = "Albedo" regex_bump = "Bump" def onButtonPress(me, parm): extractInfo() updateSettings() def updateSettings() regex_albedo = hou.pwd().evalParm("regex_albedo") def extractInfo(): [REGEX MATCHING CODE]
I want the user to be able to click on the Create Material button on my HDA and for the script to parse the current parameter values, THEN execute the code to actually do regex matching and everything else that's supposed to happen. Ideally, if the parameters are empty, the script should fallback to default ‘hardcoded’ values.
Can someone enlighten me?
Thanks a bunch!!