Making a blocking task that waits for input from a human

   2905   3   0
User Avatar
Member
8 posts
Joined: Dec. 2014
Offline
Is it possible to make a task that opens up something to ask a user “have you done X? : yes/no” and then does not complete the task until the user responds?
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Cheap and cheerful you can use the hscript “message” command anywhere you evaluate a parameter or houdini hscript (HDA scripts like onupdate script, shelf button, etc):

In a texptort type:
help message
to see help usage on the command
Then try:
message -b "Press Me"
will pop up a dialog that will pause EVERYTHING until you hit that button.

If Python and you want also cheap and cheerful, you can use hou.ui.displayMessage()

In a Houdini Python Shell type:
hou.ui.displayMessage("My Dialog", buttons=("OK",))


Beyond that you are writing your own Python +QT interrupt.
There's at least one school like the old school!
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Note that both those functions return data so you can use this to make further decisions.
There's at least one school like the old school!
User Avatar
Member
8 posts
Joined: Dec. 2014
Offline
Thanks Jeff! I put the hou.ui.displayMessage inside a python script top and that gives exactly what I want.
  • Quick Links