CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 01-23-2008, 03:00 PM   #1
rendermaniac
.
Simon Bunker
Shader Writer / TD
Australia
 
Join Date: Jan 2003
Posts: 1,040
setting array attributes elements

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
__________________
http://www.rendermania.com/
 
Old 01-23-2008, 04:05 PM   #2
Robert Bateman
Lord of the posts
 
Robert Bateman's Avatar
Robert Bateman
Software Engineer
United Kingdom
 
Join Date: Aug 2004
Posts: 1,160
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....
 
Old 01-23-2008, 04:25 PM   #3
rendermaniac
.
Simon Bunker
Shader Writer / TD
Australia
 
Join Date: Jan 2003
Posts: 1,040
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
__________________
http://www.rendermania.com/
 
Old 01-23-2008, 05:42 PM   #4
Robert Bateman
Lord of the posts
 
Robert Bateman's Avatar
Robert Bateman
Software Engineer
United Kingdom
 
Join Date: Aug 2004
Posts: 1,160
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?
 
Old 01-23-2008, 05:42 PM   #5
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 07:55 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.