this is your rig on sugarcubes

quick tip #1

It’s been a while since I’ve done anything in MEL. I try to avoid MEL when I can; after two years of doing the majority of my Maya tools and scripts in Python (with the last year being pure Python), switching gears to work in MEL and losing the object-oriented nature of Python (along with its wonderful string and array manipulation tools) makes me feel like I’ve got a hand tied behind my back.

Still, MEL’s importance will continue for some time and there will be times when it’s necessary to hack out a bit MEL code. I wanted to make a quick tip note about something I’m embarrassed to say I didn’t know until a few days ago that might help you with your MEL scripts.

I use the whatIs command often to track down the source of built-in scripted functionality. Calling it on a function that exists in default MEL scripts will tell you in which script that function lives and where to find it; afterwards, you can break it apart and use the pertinent parts in your own script.

However, what I did not know is that whatIs can also tell you about in-memory variables. Here’s an example:

If you run the code you’ll see that it returns a string with the type of the variable you checked. Quite handy, since you can use it to check types of default global variables. But even handier is what happens when you use it on a variable that has not yet been created:

whatIs "$someWonderfulVariable";

This will return the string “Unknown”. If you, not unlike my recent self, are trying to determine in your or someone else’s code whether a required variable has been created, this is the way to check.

In other news, my new job begins on Tuesday. I’m extremely excited and I’ll post more about it once I’ve gotten situated there.

Also, if you’re Canadian, elections are happening on Monday! An interesting notion is the thought of voting for a non-Reform party candidate in your riding whose projections are highest instead of voting for the party or a leader you’re usually inclined to do, with an eye towards unseating the current Reform government and getting Harper out of there. Two websites on this very thing: