.comment-link {margin-left:.6em;}

melGeek

Tuesday, March 22, 2005

see what condition your condition is in...

Let's talk conditions. Specifically the if then conditional statement.

Lets say you have a joint chain - 5 nodes, named leg, knee, ankle, foot, toe. You want to automaticaly prefix either "rt" or "lf" depending on where the joint is in space. Naming coventions are vital, and it so happens that the right side of your puppet should be on the negative X axis.

So lets say this in english, then in mel...

If the legs translate X is less than zero, name it right, if not name it left. Sounds sassy right. OK mel me on up...


{
string $leg = "leg";
string $right = "rt";
string $left = "lf";
float $legPos[] = `xform -ws -q -rp $leg`;
if ($legPos[0] <= 0);
{
rename $leg ($right + "_" + $leg);
}
}


Super cool huh? Here is how to use the else part.


{
string $leg = "leg";
string $right = "rt";
string $left = "lf";
float $legPos[] = `xform -ws -q -rp $leg`;

if ($legPos[0] <= 0)
{
rename $leg ($right + "_" + $leg);
}
else
{
rename $leg ($left + "_" + $leg);
}
}


Sweet sassy molassy thats cool! Can you figure out how to prefix all the joints with a similar set up?

3 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home