HDK SOP "sim" cook problem

   4285   3   1
User Avatar
Member
543 posts
Joined: July 2005
Offline
Greetings,

I have this annoying problem when building a SOP (with the HDK) that does a sort of “simulation” thingy, more specifically, it reads the incoming geometry at an “init” frame and then performs some sort of processing on the data for each subsequent frames.

The problem is that for some reason, the geometry doesn't update in the viewport unless I append another SOP to the output of my “sim” SOP.

The data in the spreadsheet is being updated correctly but for some reason not in the viewport; this must be something super simple that I'm missing.

Here's a boiled down cookMySop() function that reads the incoming geometry at some frame then simple adds 0.1 to the point's Y axis.



OP_ERROR SOP_DEBUG::cookMySop(OP_Context &context)
{
float now;
long frame;
int initframe;
GEO_Point *pt;
UT_Interrupt *boss;

now = context.myTime;
frame = context.getFrame();

if (lockInputs(context) >= UT_ERROR_ABORT)
return error();

OP_Node::flags().timeDep = 1;

initframe = INITFRAME();

if (error() < UT_ERROR_ABORT)
{
if(frame == initframe)
{
boss = UTgetInterrupt();
boss->opStart(“Initializing”);
gdp->clearAndDestroy();
duplicateSource(0, context);
boss->opEnd();
}

else
{
boss = UTgetInterrupt();
boss->opStart(“Setting new grid positions”);

FOR_ALL_GPOINTS(gdp, pt)
{
if (boss->opInterrupt())
break;

pt->getPos() += 0.1;
}
boss->opEnd();
}
}

unlockInputs();
myCurrPoint = -1;
return error();
}




I can upload the code and a hip file if needed.

As always, thanks in advance!!!


–Mark
========================================================
You are no age between space
User Avatar
Staff
1258 posts
Joined: July 2005
Offline
xionmark
I can upload the code and a hip file if needed.

Sure. That would help.

Cheers,
Rob V.
User Avatar
Staff
1072 posts
Joined: July 2005
Offline
You'll probably want to call gdp->notifyCache(GU_CACHE_ALL) to ensure that any caches (including display caches) are rebuilt.
User Avatar
Member
543 posts
Joined: July 2005
Offline
Ondrej
You'll probably want to call gdp->notifyCache(GU_CACHE_ALL) to ensure that any caches (including display caches) are rebuilt.
Yep, that fixed it!

Thanks!!!
:wink:


–Mark
========================================================
You are no age between space
  • Quick Links