helium Posted July 1, 2010 Share Posted July 1, 2010 Hello Everyone, I'm working on some HDK stuff and hope someone here could give me some hint. How to get and set the attribute value of a certain point(e.g. point 4)? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Vormav Posted July 1, 2010 Share Posted July 1, 2010 int fooOffset = gdp->findPointAttrib("foo", sizeof(float), GB_ATTRIB_FLOAT); if(fooOffset >= 0) *(gdp->points()(4)->castAttribData<float>(fooOffset)) = 27; 1 Quote Link to comment Share on other sites More sharing options...
helium Posted July 3, 2010 Author Share Posted July 3, 2010 Thanks Vormav! int fooOffset = gdp->findPointAttrib("foo", sizeof(float), GB_ATTRIB_FLOAT); if(fooOffset >= 0) *(gdp->points()(4)->castAttribData<float>(fooOffset)) = 27; Quote Link to comment Share on other sites More sharing options...
helium Posted July 5, 2010 Author Share Posted July 5, 2010 One more question, what if I don't know the attribute type in advance? For example, I could only use the getType() to get the type, but I don't know if it's float or int. I can't use *(gdp->points()(4)->castAttribData<myType> (fooOffset)) = 27; Could anyone here let me know how to handle the type information? Thanks, Quote Link to comment Share on other sites More sharing options...
Vormav Posted July 6, 2010 Share Posted July 6, 2010 (edited) The problem is that you're allowed to have attributes of the same name but different types, so you may want to just search for them. UT_String attrName; for(GB_Attribute* attr = gdp->pointAttribs().getHead(); attr; attr = dynamic_cast<GB_Attribute*>(attr->next())) { if(attr->getName() == attrName) { const int thisOffset = gdp->findPointAttrib(attr); switch(attr->getType) { ... }; } } Edited July 6, 2010 by Vormav 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.