Neronie Posted February 8, 2019 Share Posted February 8, 2019 (edited) Hey guys, 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'm using regular expressions to parse the file names and find the correct textures. I want to add exposed parameters on the HDA so that the user can change what string regex uses for matching if needed (i.e. 'albedo' vs 'diffuse'), and other settings (i.e. whether to load in certain textures or not, what level of detail to use) 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): updateSettings() extractInfo() 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!! Edited February 8, 2019 by Neronie Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.