Jump to content

python scripting giving me a headache

Recommended Posts

I got the code basically working in VEX up to a point, but I am not sure where to go with Python code to accomplish the same goal.  I am currently just trying to access the parameter interface so I can use the values in calculations, and for whatever reason it isn't working.  I have been searching online and the only thing I keep seeing is that I should use 

node = kwargs['node']

in place of 

node = hou.pwd()

and whenever I try it, I get: NameError: name 'kwargs' is not defined.  When I try to use hou.pwd() to access them with a .parm("foo").eval() I get a noneType error and still cannot get to it.  I am trying to use a multi-parm and this is really getting tedious for accessing it and I really feel like it is not this hard and I am just missing something.  I am attaching the hda file I am working on as well as an implementation example to try to show what I am trying to get to.  As I said, I got everything in the VEX version to work the way I want, other than the multi-parm which is extremely important to the final outcome of the project.  I haven't done much with Python inside of Houdini yet, but I am rather familiar with the language otherwise, so this is really my only hurdle, but it seems to be a big one for me.



Link to comment
Share on other sites

I'm not entirely sure what you are going to achieve, but generally speaking multi-parm access is performed by name#index where index is parm number.
So in case of your hda, I can iterate over parms and evaluate it with snippet:

nparms = node.parm("g0").eval()

for x in range(1, nparms+1):
    print node.parm("divs%i" % x).eval()
    print node.parm("span%i" % x).eval()
    print node.parm("ramp%i" % x).eval().lookup(0.5)

hope this helps,


Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...