Jump to content

how to get and set the attribute value of a certain point?


Recommended Posts

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,

Link to comment
Share on other sites

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 by Vormav
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...