PDA

View Full Version : setting array attributes elements


rendermaniac
01-23-2008, 03:00 PM
Does anyone know if it is possible to set just one element of an array attribute on an object at a time? setAttr seems to only let you set the entire array at once which is very annoying.

thanks

Simon

Robert Bateman
01-23-2008, 04:05 PM
That depends on whether the attribute is a multi or an array type. (i.e. kDouble + setArray v.s. kDoubleArray). If the attr is a multi, then the [] brackets can be used to do it. If however it's an array type, then you have to set the whole array in one go....

rendermaniac
01-23-2008, 04:25 PM
It's an array type, not a multi. Unfortunately that's what I suspected - guess I'll just have to do it the hard way!

Simon

Robert Bateman
01-23-2008, 05:42 PM
Just remembered a few things. Joojaa on highend3d was moaning about the inability of setAttr to set individual elements, but iirc there are the MFnDoubleArrayData function sets that do allow you to access the elements individually. I think he basicaly wrote an MPxCommand called setElemAttr or similar to set these from script. Might be worth a go maybe?

CGTalk Moderation
01-23-2008, 05:42 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.