View Full Version : How Do I change 1 attribute in common for several objects

05 May 2003, 07:24 AM
Id like to select all polySmoothFace* nodes, and change the divisions attribute for all of them, so I could assign a hot key to swith resolutions. Im new on MEL, and need some help!

This is what I tried:

select "polySmoothFace*";
$foo = `ls -sl`; // (how can I make this a string array?)
$Size = size ($foo+1);

for ($Index = 0; $Index < $Size; $Index++)
$nelson = "polySmoothFace"+$Size + ".divisions";
setAttr $nelson 2;

05 May 2003, 08:13 AM
string $foo[] = `ls -sl`;

for ($each in $foo)
setAttr ($each+".divisions") 2;

should work

James Jacobs
05 May 2003, 08:19 AM
Here is one way.
I hope this helps you out.


string $sels[] = `ls -typ "polySmoothFace"`;
for($sel in $sels){
setAttr ($sel + ".divisions") 2;

05 May 2003, 08:25 AM
You also dont have to actually select the nodes to modify them (doing it this way for me is a bit cleaner):

string $foo[] = `ls -type polySmoothFace`;

for ($f in $foo)
setAttr ($f + ".divisions") 2;


CGTalk Moderation
01 January 2006, 03:00 AM
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.