Jump to content

How to read array


Recommended Posts

If I have a point attribute of type array, how can I get that array and store the values in a UT_FloatArray?

I tried the following but somehow it does not work.

GA_ROHandleFA distH(gdp, GA_ATTRIB_POINT, "dist");
UT_FloatArray distances;    

for(GA_Iterator it(gdp->getPointRange()); !it.atEnd(); it.advance())
{
    GA_Offset offset = it.getOffset();
    distances = distH(offset);
}

Thanks in advance!

Edited by resonanz
Link to comment
Share on other sites

Well its usually best to say why something doesn't work, so someone can have a starting point to figure out the problem.

 

From what I see though, you're assigning a float value to UT_FloatArray.  A float is not a UT_FloatArray.  Your attempting to make UT_FloatArray == float, when what you want to is store the float inside the array object.

 

distances.append(distH(offset));  should solve that problem.  

Link to comment
Share on other sites

You are right! Sorry about that!

 

The problem is that GA_ROHandleFA is a handle for an array not a float like in your example. I did check if the handle is valid and it is but as soon as I try to get the array from the attribute with distH(offset) I get the following error message:

"error C2064: term does not evaluate to a function taking 1 arguments".

The thing is that I have no idea what other argument(s) I should use instead.

 

 

 

 

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...