PDA

View Full Version : MEL-Multi-attr-value setting


AWAKE
11-24-2002, 08:48 AM
Anyone know of a way to wildcard objects and attrs to change values?


I have a list of objects each with different names (sequential) and I'm trying to change values of the attributes in each to the same value, but I'm getting an object not found error in my really pathetic mel "pasting"


I select obects --> select -r "*Constraint1";


Then I want to change the attrs, but the wildcard doesn't work right..


setAttr "*Constraint1.*_SPLW2" 0;

I'm using the wildcard because the attributes have similar names. They vary slightly.
Maybe there's another way to type it in there. Or a script that does it. The Trick is the attributes have similar names. Not exact.

olivier georges
11-24-2002, 09:08 AM
hi,
you have to retreive your selection in a string array, and use a for...in loop to change the value of the attribut. look at the doc for some examples about the different loop available in mel.

Olivier.

stunndman
11-24-2002, 05:59 PM
here's a script i'm using for setting attributes that don't show up in the attribute spread sheet editor - maybe someone knows a ready made script for this on highend3d - i haven't found one yet

replace "spotLightShape*" with your search term - edit the attribute name/value - i think it's quite obvious


proc doit() {
string $allObjects[];
string $obj;
$allObjects = `ls "spotLightShape*"`;
select $allObjects;
for ( $obj in $allObjects ) {
print ($obj + "\n");
$cmd = "setAttr " + $obj + ".energyR 1000";
eval $cmd;
}
}
doit;

CGTalk Moderation
01-13-2006, 10:00 PM
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.