void SOP_groupAsAttr::groupToAttrPrims(const UT_String& in_attr, const int& debug_in) { groupNameIndex = gdp->findStringTuple(GA_ATTRIB_PRIMITIVE, in_attr); if(groupNameIndex.isInvalid()) { groupNameIndex = gdp->addStringTuple(GA_ATTRIB_PRIMITIVE, in_attr, 1); if(groupNameIndex.isInvalid()) { addError(SOP_ATTRIBUTE_INVALID, "Unable to create primitive attribut"); } } //iterate thru all the points and for every point iterate thru all the groups GA_Primitive *prim; GA_FOR_ALL_PRIMITIVES(gdp, prim) { bool exist = false; //set our current group GA_PrimitiveGroup *curGrp; //for all the point groups GA_FOR_ALL_PRIMGROUPS(gdp, curGrp) { if(curGrp) { if(exist == false) { if(curGrp->contains(*prim)) { prim->setString(groupNameIndex, curGrp->getName()); exist = true; } else { prim->setString(groupNameIndex, "no group"); } } } } }