Tuesday, April 21, 2009

An Interesting Dilemma

So I've run into an interesting scripting error that I thought I'd share with everyone, even though this is something that everyone has probably all figured out.

Currently in class we're working on scripts to automate a biped setup - so we have spine, legs, IKFK arm, and fingers. All of my scripts work very smoothly together, and the entire setup so far is going well. I got an interesting error, however, when I got to the fingers.

The way that I'm setting up the fingers is by using expressions on each driven group that are connected to the hand controller to move the fingers - curl, spread, etc, instead of setting driven keys. So I setup my script to run on the hands when given the knuckle bone of each finger as arguments, sourced the script without any errors, and ran it.

Error on line .2;

At first I though I had entered my arguments in wrong, so I did it again, and reran the script. Same error. Then I noticed the script actually was running through my loop once and then failing. Hmmm.

That's when I remembered the expressions - apparently, when you declare them as a string, if the script errors, it will error on the line of the expression itself. I felt like an idiot after this one, but on the bright side, now I know.

I wish that Maya had a different way of dealing with this sort of thing.

1 comment:

  1. Yeah. There are all kinds of fun quirks about MEL.

    You have to keep in mind that MEL is based on shell script, which is essentially unix's equivalent of windows batch files. And though shell script is somewhat more powerful than batch files, it's still a very quirky and weak language. And MEL inherits that.