rolldice Posted April 28, 2014 Share Posted April 28, 2014 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. Quote Link to comment Share on other sites More sharing options...
Ratman Posted April 28, 2014 Share Posted April 28, 2014 I think what you're looking for is the UT_Interrupt.h. http://www.sidefx.com/docs/hdk13.0/_u_t___interrupt_8h.html There's a few examples in the docs, but it is a way to check if you are interrupting inside cookMySop(). Quote Link to comment Share on other sites More sharing options...
rolldice Posted April 29, 2014 Author Share Posted April 29, 2014 (edited) 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 April 29, 2014 by rolldice Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted April 29, 2014 Share Posted April 29, 2014 (edited) 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 April 29, 2014 by mantragora Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.