doc Posted November 20, 2006 Share Posted November 20, 2006 Hello, I'm just starting to get my feet wet with this hdk stuff and I've come across a tiny stumbling block. I'm trying to add a point attribute of type string and I couldn't find an example of how to do this in $HFS/toolkit/samples/SOP. So I guessed int test = gdp->addPointAttrib(attrName1, sizeof(UT_String),GB_ATTRIB_STRING, 0); This compiles without a problem and when I MMB on the node houdini says the attribute exists, but when I bring up the spreadsheet the attribute doesn't appear to be listed. Any ideas? Luca Quote Link to comment Share on other sites More sharing options...
rjpieke Posted November 21, 2006 Share Posted November 21, 2006 int test = gdp->addPointAttrib(attrName1, sizeof(UT_String),GB_ATTRIB_STRING, 0);This compiles without a problem and when I MMB on the node houdini says the attribute exists, but when I bring up the spreadsheet the attribute doesn't appear to be listed. Hey Luca, try using GB_ATTRIB_INDEX instead of GB_ATTRIB_STRING ... that might completely solve the trick, and will certainly get you closer otherwise. You have to do the same thing when using the HDK to read string values (which is a real pain). For example: int texOffset = gdp->findPointAttrib( "texname", GB_ATTRIB_INDEX ); GB_Attribute *texAttr = gdp->pointAttribs().find( "texname", GB_ATTRIB_INDEX ); int *idx = static_cast< int* >( point->getAttribData( texOffset ) ); UT_String texVal = texAttr->getIndex( *idx ); Cheers! Quote Link to comment Share on other sites More sharing options...
doc Posted November 21, 2006 Author Share Posted November 21, 2006 thanks Rob, You're a peach. 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.