Jump to content
Sign in to follow this  
walterbehrnes

How To press a button through python

Recommended Posts

Hi, I am stumped on this.

I have an OTL that I created with a button on it. The buttons parameter name is called "doIt".

How would I press this button in python? I saw in Houdini Object Model under hou.Parm the pressButton

option but I am not sure how to pass the parameter that I want to press to this command.

Any ideas?

Share this post


Link to post
Share on other sites

All you need is a hou.Parm object

mynode = hou.node(mynodepath)

mynode.parm('dolt').pressButton()

Or you can do

hou.parm('mynodepath/dolt').pressButton()

Share this post


Link to post
Share on other sites

Ah! that makes sense.

I was reversing where I was putting the call to doIt... :blink:

Thanks!

Walt

All you need is a hou.Parm object

mynode = hou.node(mynodepath)

mynode.parm('dolt').pressButton()

Or you can do

hou.parm('mynodepath/dolt').pressButton()

Share this post


Link to post
Share on other sites

Ah... Now I have another issue. I am selecting a group of object nodes, and one by one the script is pressing the same button on each node.

Is there a way for me to check the current node to see if it has cooked and the python

script attached to doIt has completed its task?

I have been searching the Hou module and have only found cook. From the looks of it,this seems to just

cook the node. Does it wait for houdini to finish cooking before the script continues?

Ah! that makes sense.

I was reversing where I was putting the call to doIt... :blink:

Thanks!

Walt

Share this post


Link to post
Share on other sites

Okay, found a way to do this.

I created a hidden parm that my buttonPush script sets.

the hidden parm gets set to 1, I then push the button (doIt) which runs

a secondary script. at the end of the secondary script I set my hidden parm back to 0.

After the buttonPush command I enter an while loop that continually checks the state of the

hidden parm, when the parm gets set back to zero the script continues this allows for me

to cook multiple items and run a secondary script and not have the button push script

Execute automatically.

heh heh... hope that made sense. :lol:

Walt

Ah... Now I have another issue. I am selecting a group of object nodes, and one by one the script is pressing the same button on each node.

Is there a way for me to check the current node to see if it has cooked and the python

script attached to doIt has completed its task?

I have been searching the Hou module and have only found cook. From the looks of it,this seems to just

cook the node. Does it wait for houdini to finish cooking before the script continues?

Share this post


Link to post
Share on other sites

dusty memory.... how do you press a button in hscript?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×