How Do I change 1 attribute in common for several objects


#1

I´d 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. I´m 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;


#2

string $foo[] = ls -sl;

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

should work


#3

Here is one way.
I hope this helps you out.

-james

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


#4

You also don´t 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


#5

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.