Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / MEL / Using getAttr in an array of objects?
  RSS 2.0 ATOM  

Using getAttr in an array of objects?
Rate this thread
 
50013
 
Permlink of this thread  
avatar
  • Location: Honolulu, HI
  • Total Posts: 34
  • Joined: 07 March 2008 05:39 AM

Did something change with MEL?  I swear this used to work… these two lines:

With two objects selected:

$selected = `ls -sl`;
getAttr ($selected[1]).tx;

returns tx for both selected objects:

// Result: -10.57723 10.642541 //

Am I missing something?  I swear this used to work and I’ve been coding in MEL for a while now.



- Howard Hsu http://www.linkedin.com/in/howardab234

Now using:
Windows XP 64 Pro v2003 SP2 (yes XP64 is still around)
Core 2 Quad CPU Q6600 @ 2.4GHz
2GB RAM
NVidia GeForce 8800 GTX

Max 2008 x64
Maya 2008 64
MotionBuilder 7.5

Replies: 0
avatar
  • THNKR
  • Posted: 01 December 2010 01:47 AM

it doesn’t matter if an how you index

You can use 0

getAttr ($selected[0]).tx;
// Result: 4.506816 -8.695786 //

or 1

getAttr ($selected[1]).tx;
// Result: 4.506816 -8.695786 //

or no index

getAttr ($selected).tx;
// Result: 4.506816 -8.695786 //

You need

getAttr ($selected[1]+".tx");
// Result: 4.506816 //


Replies: 0