Just a simple Button ;(

   5511   7   1
User Avatar
Member
58 posts
Joined: Sept. 2007
Offline
hey guy's,

i'm doing some python scripting and i'm tryng to implement a button.
i put the button in my asset in the parameter tab.

but i can't seam to find out how to check if the button is pressed or not.
i found out there is a callback script for a button and if i set the scripting language to python then i can write litle bits of script.
this is cool but sinse all the variables stay local to the parameter i can't use them.
also every hou module method that has anything to do with callback is not implemented.

anyone been able to get a simple button going ?


tamis van der laan
User Avatar
Member
696 posts
Joined: March 2006
Offline
if a button is pressed, it's parameter value should be 1, and 0 if not.
Stephen Tucker
VFXTD
User Avatar
Member
7760 posts
Joined: July 2005
Online
Er, except that the parameter will go back to 0 as soon as the button becomes “unpressed”. I think the best approach is to use callback scripts.
User Avatar
Member
58 posts
Joined: Sept. 2007
Offline
i tried this.

if hou.pwd().parm(“button”).eval() > 0:
print “Button was pressed”


but this doesn't work.

any thing related to callback is not implemented yet >_>
User Avatar
Member
696 posts
Joined: March 2006
Offline
my bad, I was confusing button with toggle
Stephen Tucker
VFXTD
User Avatar
Member
7760 posts
Joined: July 2005
Online
As I mentioned, the value goes back to 0 when the button is released so the eval() will return 0. If you callback script is called, then the button was pressed.
User Avatar
Member
58 posts
Joined: Sept. 2007
Offline
that is strange then because what i did was use the callback script sections to force the default value to 1 when pressed then in my script i set it back to 0 at the end of the script.
User Avatar
Member
268 posts
Joined: July 2005
Offline
One way to do this is to have a ‘status’ variable that will switch between 0 and 1 with each button press using a callback script. You could then quary the value in whatever setup you have.
  • Quick Links