Hey all,
I am having problems creating attributes in HDK. The attribute I create shows up on the first frame(which is when i create it) and then disappears in the rest of the frames. Please check the cookmySop function. I am pretty sure I am doing something stupid.
Currently what I want is to take my geometry and create a spring force . So for the first step I am trying to setup my velocity, position and force attributes. So I copy my sourceGeometry into my gdp and try to manipulate the points there as per the examples.
Please help me out as I am completely lost as to why this is happening.
here is a snippet.
mySource = inputGeo(0,context);
duplicateSource(0,context);
//gdp->copy(mySource,GEO_COPY_ONCE);
flags().timeDep = 1;
CH_Manager *chman = OPgetDirector()->getChannelManager();
fpreal frame = chman->getSample(context.getTime());
fpreal reset = STARTFRAME();
//frame = frame/30.0;
if (frame<=reset || !mySource) {
my_lastCookTime = reset;
//initSystem();
myPos = GA_RWHandleV3(gdp->findAttribute(GA_ATTRIB_POINT, “P”));
GA_RWHandleV3 attrib = gdp->findAttribute(GA_ATTRIB_POINT,“v”);
if ( gdp->getPointMap().indexSize() > 0 || !mySource) {
myVelocity = GA_RWHandleV3(gdp->addFloatTuple(GA_ATTRIB_POINT,“v”,3));
//myVelocity = GA_RWHandleV3(gdp,GA_ATTRIB_POINT, “v”);
if(myVelocity.isValid()){
myVelocity.getAttribute()->setTypeInfo(GA_TYPE_VECTOR);
myVelocity->setTupleSize(3);
UT_Vector3 V;
for (GA_Iterator it(gdp->getPointRange()); !it.atEnd(); ++it) {
GA_Offset offset = *it;
UT_Vector3 V = UT_Vector3(0,0,0);
myVelocity.set(offset,UT_Vector3(0,0,0));
cout << “velocity2: ” << myVelocity->getTupleSize() <<endl;
}
}
}
}
else
{
frame += 0.05;//tollerance
//notifyGroupParmListeners(0,-1,mySource,NULL);
while (my_lastCookTime < frame)
{
cout << “velocity3: ” << myVelocity->getTupleSize() <<endl;
timeStep(chman->getSample(my_lastCookTime));
my_lastCookTime += 1;
}
}
Issues with creating HDK attributes
2788 7 2- som
- Member
- 40 posts
- Joined: Oct. 2012
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
- som
- Member
- 40 posts
- Joined: Oct. 2012
- Offline
- som
- Member
- 40 posts
- Joined: Oct. 2012
- Offline
- som
- Member
- 40 posts
- Joined: Oct. 2012
- Offline
- awong
- Member
- 818 posts
- Joined: Sept. 2013
- Offline
- som
- Member
- 40 posts
- Joined: Oct. 2012
- Offline
- jlait
- Staff
- 6129 posts
- Joined: July 2005
- Online
-
- Quick Links