Monday, February 26, 2007

Utilities

On my most recent project I've finally had time to start compartmentalizing my MEL procedures into handy, recyclable utility files. I've now got a whole library of simple commands I can use to parse, build and manipulate strings, search for objects, get and set values in my user interfaces, manipulate arrays, etc.

Probably one of the biggest hurdles is how to create this library of procedures without having to worry about the command names overlapping eachother, or worse, overlapping Maya's internal command names. To solve this I've gone about simulating namespaces on my procedures and variables. I first prefix everything with my name, then a word in all-caps to indicate what library it belongs to.

Examples:
Ian_UI_GetControlType()
Ian_STRING_CountWords()
Ian_ARRAY_DeleteAt()

While it does get tedious having to type out prefixes constantly, its a safe way of guarenteeing that your code stays relativly futureproof.

0 Comments:

Post a Comment

<< Home