[Sidefx-houdini-list] HDK: Few questions

Pradeep Barua pradeepbarua at live.com
Wed Apr 5 05:22:32 EDT 2017


-How does GA_Offset work?
How to remove holes from offset? The defragmentation should be done manually or it happens dynamically(I mean automatically by Houdini)?


-Drag header files?
I noticed that even without including some of the headers, I'm able to use their members. Are those headers dragged by compiler? If so, is it good practice? And in what order(and how) headers are dragged?


-Is the following right way to inherit attribs?
I've two points(source and target), and have a polyline(GU_PrimPoly) from those then created few more points(sort of resample) by adding more in-between points to GU_PrimPoly::build(). I want to inherit point attribs from source point to newly created points.

//////////////////////////////////////////////////////////////////////////////////////
//****  calculated some where else  ****///////
//std::vector<const GA_Attribute*> attribToInheritVector; // source point attribs to inherit
//std::vector<GA_Offset*> pts; // points in the GU_PrimPoly line
//////////////////////////////////////////////////////////////////////////////////////

for (int i = 0; i < attribToInheritVector.size(); i++)
{
const GA_Attribute *attribToInherit = attribToInheritVector[i];
int attribSize = attribToInherit->getTupleSize();
int attribTypeId = attribToInherit->getType().getTypeId();

// id 2: numeric(float, int, std::vector), id 3: string
if (attribTypeId == 2)
{
// read values
const GA_AIFTuple *tuple = attribToInherit->getAIFTuple();
float attribValue[4];
tuple->get(attribToInherit, n, attribValue, attribSize);

// write values
for (int j = 0; j < pts.size(); j++) // or for (auto j : pts)
{
for (int k = 0; k < attribSize; k++)
{
        // attribToInherit->getName() is current attrib name
GA_Attribute *attrib = gdp->findAttribute(GA_ATTRIB_POINT, attribToInherit->getName());
        tuple->set(attrib, *pts[j], attribValue[k], k);
}
}
}
}


Thank you!



-Pradeep Barua



More information about the Sidefx-houdini-list mailing list