UTgetInterrupt in HDK12

   2707   4   1
User Avatar
Member
27 posts
Joined: Nov. 2008
Offline
hi,

i have a quick question about UTInterrupt in HDK12.

i have a code that used to work fine in HDK11 using UTInterrupt… the code is the same as SOP_Star.C which is

UT_Interrupt *boss;
if (error() < UT_ERROR_ABORT)
{
boss = UTgetInterrupt();
if (boss->opStart(“Building Star”))
{
do something
if (boss->opInterrupt())
break;
}
boss->opEnd();
}

except it doesn't seem to work… before if i did this, the status message came up on the bottom and I could quit out of the operation using escape key…

that doesn't seem to happen anymore in HDK12…

i read the HDK12 guide and it says that
int UT_Interrupt:pStart
These methods are now thread safe. Only the main thread will start the interrupt server.

do i have to do something different to work as multi-threaded?

not sure what i'm doing wrong and any help would be great…

thanks, :-)
User Avatar
Member
7723 posts
Joined: July 2005
Offline
The only change that I've heard of is that there seems to be a longer cook delay (seconds?) before an opStart() message will appear on the status bar. If the operation in between opStart()/opEnd() finishes really quickly, then no message will appear in the status bar.

The style of using UT_Interrupt in those samples is really old. I recommend using the new style used by the SOP_Flatten.C sample.

eg.

UT_AutoInterrupt progress(“My Operation Name”);
for (GA_Iterator pt(gdp->getPointRange()); !pt.atEnd(); ++pt)
{
// Check if user requested abort
if (progress.wasInterrupted())
break;
// … DO STUFF WITH pt …
}

User Avatar
Member
27 posts
Joined: Nov. 2008
Offline
thank you very much for the response… flatten SOP interrupt seems to work much better then star SOP… :-)

one more question, looks like with my SOP,


std::cout << “start” << std::endl;
UT_AutoInterrupt progress(“Running…”);

GA_Offset pOffset;
GA_FOR_ALL_PTOFF(gdp, pOffset)
{
if (progress.wasInterrupted())
break;
// do something
}
unlockInputs();

resetLocalVarRefs();
std::cout << “end” << std::endl;
return error();


i don't see the interrupt message because the whole thing executes really fast… and yet houdini seems to hang after it calculates the node…

i added print message “start” and “end” and the SOP node prints “start” and “end” almost immediately which tells me that it had finished executing the node… and yet after it prints “end”, houdini hangs for a while (becomes unresponsive), as if it's calculating the node before it response again…

any idea what houdini might be doing after it runs return error() statement?

thanks, :-)
User Avatar
Member
7723 posts
Joined: July 2005
Offline
There are several things that run after the cooking, such as the viewport updating. This can take a long time if you have lots of geometry. I'd bring up a Performance Monitor pane and see what's causing your slowdown.
User Avatar
Member
27 posts
Joined: Nov. 2008
Offline
ah, thank you very much… it's helping me a lot to debug… :-)
  • Quick Links