PDA

View Full Version : Face Camera MEL Script.


Mundug
08-30-2005, 08:44 PM
I am in need of a MEL script that allows me to select a bunch of planes.
and then changes the rotate.Y attribute of the individual planes to persp.rotateY

I was trying this to sove my problem:

string $selected[] = `ls -sl`;
for ($i in $selected)
{
aimConstraint -skip x -skip z "persp" $i;
}

However the aimconstraint does not quite do the same as matching up Y rotations and I am a real newbie at MEL scripting, still green behind the ears and all.

Any help is greatly appreciated

harmless
08-31-2005, 01:56 AM
Expressions are the way to go...


string $selAry[] = `ls -sl`;
for ($sel in $selAry)
{
string $exp = ("\"" + $sel + ".rotateY = persp.rotateY;\"");
expression -s $exp;
}

Cheers

Mundug
08-31-2005, 02:01 AM
thanks, but it doesn't seem to do the trick, though:

string $selAry[] = `ls -sl`;
for ($sel in $selAry)
{
string $exp = ("\"" + $sel + ".rotateY = persp.rotateY;\"");
expression -s $exp;
};
// Error: string $exp = ("\"" + $sel + ".rotateY = persp.rotateY;\"");
//
// Error: Illegal operation "+" on data of type string[]. //

harmless
08-31-2005, 02:07 AM
You have previously cast $sel as a string array.
My script uses it as a string only.
Maya sees this as a global variable. Restart maya to flush the global variables and the script will work or call it $curSel or some other variable you haven't cast yet ;)

Mundug
08-31-2005, 02:09 AM
Aha, let me give that a try, told you I was green behind my ears.

Mundug
08-31-2005, 02:11 AM
Yeehaaw! That totally did it.
I am most grateful.

CGTalk Moderation
08-31-2005, 02:11 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.