Search the Community
Showing results for tags 'simulation sop'.
-
Hi, I got a question about doing simulation in sop.(Because I don't have a master license). Accoding to the thread http://forums.odforce.net/topic/4310-hdk-sop-sim-cook-problem/?hl=timedep.I rewrite the code. OP_ERROR SOP_TEST::cookMySop(OP_Context &context) { long frame; int initframe; UT_Interrupt *boss; myGroup=0; fpreal now = context.getTime(); frame = context.getFrame(); GA_Offset ptoff; fpreal mx = MaxDis(now); if (lockInputs(context) >= UT_ERROR_ABORT) return error(); OP_Node::flags().timeDep = 1; ///////// initframe = 1; 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"); GA_FOR_ALL_GROUP_PTOFF(gdp, myGroup, ptoff) { if (boss->opInterrupt()) break; UT_Vector3 pos=gdp->getPos3(ptoff); pos[1]+=mx; gdp->setPos3(ptoff,pos); } boss->opEnd(); } } unlockInputs(); myCurrPoint = -1; return error(); } This all works fine when I play though the frames sequentially. If I jump forward in the time bar 20 frames, right now it only cooks the 20th frame and doesn't automatically cook all the frames in between(like the particle sop does)(like the particle sop does). It seemed like it only do a cook when the frame changes. What I got to do is to cook all the frame between the 20 frames.I got some ideas from HDK documents cook_time = myLastCookTime; for ( ; cook_time <= now ; cook_time += frame_inc) { context.setTime(cook_time); ......... } But I dont know how to get the "myLastCooktime". Does Anyone got a Idea? And another strange thing is when I change the Parameter((MaxDis), it will also do the cook which I dont want. Thanks