[HDK] GA_FOR_ALL_PRIMGROUPS not picking up my groups

   1927   3   1
User Avatar
Member
4 posts
Joined: Oct. 2011
Offline
Hi, I'm having a small problem trying to process multiple groups. I've created some groups both with my own code and with the standard group node, but my second node is not picking them up. I'm sure the created groups are primgroups. This is my code inside of the cook method:


//Try 1
GA_PrimitiveGroup *grp;
GA_FOR_ALL_PRIMGROUPS(gdp, grp)
{
int i = 0; //Breakpoint here
}

//Try 2
GA_PrimitiveGroup *polyMeshGroup = gdp->findPrimitiveGroup(“polymesh”);

if (polyMeshGroup == NULL)
{
addError(SOP_MESSAGE, “No polymesh groups found to build structures.”);
return error();
}


Is there something else I need to process before I can access the groups inside the detail?
User Avatar
Staff
329 posts
Joined: July 2005
Offline
Is the rest of the geometry being copied from the inputs? Many SOPs follow a pattern like what is illustrated in the SOP_Flatten HDK example with a duplicateSource() call copying the input's geometry (including primitive groups) into “gdp”.
User Avatar
Member
4 posts
Joined: Oct. 2011
Offline
Thanks! That was indeed the issue. So I assume the GDP is empty when the cook starts?
User Avatar
Staff
329 posts
Joined: July 2005
Offline
WesleyE
Thanks! That was indeed the issue. So I assume the GDP is empty when the cook starts?

It will contain the result of the previous cook. It will start off empty on the first cook.
  • Quick Links