getAttr for an array of ints

Hi all.

I have a custom with an attribute that is an array of ints.

When I try to get the information using MEL all of the elements come back as 0.

The following mel commands indicate the following:
getattr -type $node.pv returns TdataCompound
getAttr -size $node.pv returns 42 (which is correct)

However, when I do this:

float $pv[] = getAttr $node.pv

The size of $pv is 42, but all of the elements are 0.

I am trying to access individual elements as follows:
$pv[$i] where $i is an index.

Also interesting, the attribute is defined as an array of ints but if I declare $pv as an int array I get an error saying it has to be a float array.

Thanks for the help.
Todd

Ok, I just found the following information:

"Reading array attributes. A well-known limitation - you cannot query an array (e.g. '-dt "stringArray"') from MEL."

So, does anyone know the work around? I have a custom node with an attribute that is an array of ints...is there some other way to declare the attribute so that I can get at the information?

Thanks
Todd

not true you can querry array attributes via mel just not all types of array atributes. I dont thik thats ever been totaly true.

but you must use the [:]

for example

getAttr "pCubeShape1.pnts[:]";

would querry the all the local tweaks of the polygon (added with vrts would yeald the local cordinate!)

Thank you for the help.

Unfortunately, that didn't seem to change my results.

I wonder if my problem is not on the MEL side, but how I am setting the attribute on the API side.

I am using the following code to set the attribute when compute() is called:

MArrayDataBuilder outputBuilder(m\_PartialVerts, theVerts.length());
for(unsigned int i=0; i<theVerts.length(); ++i)
{
	     outputBuilder.addElement(theVerts);
}
MArrayDataHandle outputHandle = data.outputArrayValue(m\_PartialVerts);
outputHandle.set(outputBuilder);
data.setClean(plug);

Does that seem correct to people?

Thanks again.
Todd

Ok,

It turns out I was not handling an array attribute properly in my custom node. If anyone else is having difficulty with this I found the correct way to do it in the API section here:

http://www.highend3d.com/boards/showflat.p...;o=0&fpart=

Thanks
Todd