Getattr / Stringarray

Hello,

If you look the getAttr command help, it says that it cannot retrieve string arrays.
It seems to me very odd (and annoying) that you can set them with setAttr, but not get them.

There is a plug on this site called getTypedAttr which enables to get the string arrays, but there is no source.

Is there an other way to pass some string arrays between MEL and the API ? I want to keep a list of objects in a node, and be able to select them in a TextScrollList.

Thanks.

you can you just need to specify the type flag! But only for multi attribs wich is different from an array.

Arrays are a bit different form multi attribs so dont get confused here.

addAttr -ln array -dt stringArray nurbsSphere1;
setAttr nurbsSphere1.array -type stringArray 3 "a" "b" "c";
getAttr nurbsSphere1.array
// Result:a b c//

Well, first of all, I thank you, because it does work.

But you seem saying you're using a multi attribute, despite you're using the stringArray type. And the doc says you can't use getAttr with stringArrays, but your code does work.
Si I'm a little bit confused. :slight_smile:

Also, the number of elements of the "array" needs to be variable. I want to stock in my node a list of object names, and add/remove the names (elements of the array) with MEL.

Are there potential troubles ?