My biggest problem with MEL Script is that once I’ve written a function and released it I can’t add any new variables to it. This is an issue when you’re writing rig tools that are used across multiple studios and projects, and then an animator asks for a new addition to the rig.
So late last year I had this idea. What if every function I wrote had an extra input variable, a string that could contain any optional flag, which I can use to add extra options to a procedure without breaking existing uses of it? Inside the function I could specify all my default values, that get replaced if it finds a different value in the string.
I decided that I’m not likely to ever use tilde (~) so I’m using it to identify flags. (Maya’s own functions use the minus symbol, but it’s also used for negative numeric values, so I wanted something I’d never use)
// Create Cube Function has two input strings: name, and optional flags ;
createCube( “testCube” , “~visible 0 ~scale 2” ) ;