Linghaoli Posted February 25, 2014 Share Posted February 25, 2014 Hi guys: To get a point attribute's info, normally it's going to be like the following: gdp->findAttribute(GA_ATTRIB_POINT, attr_name); Is there an similar method to do something like: gdp->findAllAttribute(GA_ATTRIB_POINT); ? If not, what's the best way to list all the available point attributes on a point in hdk? thanks a lot! (I tried going through the old posts roughly, but seems there is no answer for this yet. Apologize in advance if I missed it ) -ling Quote Link to comment Share on other sites More sharing options...
edward Posted February 26, 2014 Share Posted February 26, 2014 Untested code for (GA_AttributeDict::iterator it = gdp->getAttribDict(GA_ATTRIB_POINT).begin(GA_SCOPE_PUBLIC); !it.atEnd(); ++it) { const GA_Attribute *attrib = it->attrib(); std::cerr << attrib->getName() << "\n"; } Quote Link to comment Share on other sites More sharing options...
edward Posted February 26, 2014 Share Posted February 26, 2014 PS. http://www.sidefx.com/docs/hdk13.0/hdk_geometry_attributes.html#traverseAttribute Quote Link to comment Share on other sites More sharing options...
Linghaoli Posted February 26, 2014 Author Share Posted February 26, 2014 (edited) thanks for the reply edward. it kinda worked: for (GA_AttributeDict::iterator it = gdp->getAttributeDict(GA_ATTRIB_POINT).begin(GA_SCOPE_PUBLIC); !it.atEnd(); ++it) { const GA_Attribute *attrib = it.attrib(); cout << "Point attr: " <<attrib->getName() << endl; } but it seems not getting all the point attributes? In my test case, there are a few points scattered from a cube, and then I added a custom attrib named 'id', which is the same as $PT. So ideally it should print out "P" AND "id", however, it only prints out "P" with the above code.. any idea would be really appreciated. I am in hdk 12 if this makes any difference. thanks -ling Edited February 26, 2014 by Linghaoli Quote Link to comment Share on other sites More sharing options...
edward Posted February 28, 2014 Share Posted February 28, 2014 If it prints out P, then it should definitely print out id, are you sure that you're running it on the node that actually has id added? Quote Link to comment Share on other sites More sharing options...
Linghaoli Posted March 1, 2014 Author Share Posted March 1, 2014 (edited) found the issue, I forgot to duplicate the input.. duplicateSource(0, context); after that all good. thanks again edward! Edited March 1, 2014 by Linghaoli 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.