Guest mantragora Posted August 12, 2012 Share Posted August 12, 2012 (edited) This topic is a continuation of my previous one. I want to iterate over each group, take its name, modify it and create new group with this new name. I'm using this code: // process groups for (GA_GroupTable::iterator<GA_ElementGroup> it = gdp->primitiveGroups().beginTraverse(); !it.atEnd(); ++it) { if(progress.wasInterrupted()) break; string name = it.name(); vector<string> splited = SplitString(name, '_'); RemoveEmptyStrings(splited); // create new name stringstream text; text << splited[0] << "_" << splited[1] << "_" << splited[3]; string newName = (string)(text.str()); cout << newName << endl; } plus three custom methods for string manipulation to make it happen. Now if I run this code with 8 groups, it will print 8 new names. But, if I add this line gdp->newPrimitiveGroup(newName.c_str()); or gdp->createElementGroup(GA_ATTRIB_PRIMITIVE, newName.c_str()); on the end of the loop and run this code with the same 8 groups, only two new names/groups are printed/created. So I assume that I'm making some mistake here. Help ! Edited August 12, 2012 by mantragora Quote Link to comment Share on other sites More sharing options...
Guest mantragora Posted August 12, 2012 Share Posted August 12, 2012 (edited) Actually, since I'm adding groups in the same loop, the count of groups changes and gives wrong output. I have to check it but probably that's the problem. Edited August 12, 2012 by mantragora Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.