Jump to content
Sign in to follow this  
resonanz

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

Share this post


Link to post
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.  

Share this post


Link to post
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.

 

 

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×