Jump to content

Getting keyboard Input in HDK


Recommended Posts

Hi all,

 

I've been struggling with getting keyboard input during cooking custom node, especially SOP node. It's needed because my custom node is a little bit expensive to cook, and I sometimes want to stop cooking right now when it takes a big time to finish.

 

Simply, I've started with c++ library like 'getch()' or something else. But, I realize that it's useless. It seems that Houdini hooks all mouse & keyboard event, so I can't catch any events in my codes.

 

I'm trying to know how to get some input events from Houdini, but I can't.

 

I'll be really happy when you teach me how to deal with it.

 

Thanks for reading and have a nice day.

Link to comment
Share on other sites

It works!!

 

Thanks a lot, Ratman. I've seen UT_Interrupt.h before, but i didn't realize it works because I missed something at that time.

 

At least, you can know when ESC key is pushed. To know it, you should get interrupt from Houdini at first.

 

    UT_Interrupt *boss;
    boss = UTgetInterrupt();
 
 
And, you may let Houdini know your operation is starting by below :
 
    boss->opStart("your operation name", 0, 0, &interruptId)
 
 
Then, you can know when ESC key is pushed by below :
 
    boss->opInterrupt()
 
It returns true when ESC key is pushed. And you should let Houdini know when your process is ended :
 
    boss->opEnd(interruptId);

 

 
 
That's all I know. It's enough to solve my problem, so I don't try to get more for this topic. It might be wrong, so please update when you find something wrong in this text.
 
Thanks again, Ratman
Edited by rolldice
Link to comment
Share on other sites

Guest mantragora

Those are basics. Read "Houdini Operators" part of HDK documentation.

http://www.sidefx.com/docs/hdk13.0/_h_d_k__op_basics__overview__cooking.html

UT_AutoInterrupt progress("Performing Operation");

for (int i = 0; i < gdp->getPrimitiveRange().getEntries() * 10000 ; i++)
{
   if (progress.wasInterrupted()) break;
   cout << i << endl;
}
Edited by mantragora
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.

Guest
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...