PDA

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


nelsonteixeira
05-08-2003, 08: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;

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

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



should work

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

-james

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

dwalden74
05-08-2003, 09: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;

:beer:
David

CGTalk Moderation
01-15-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.