October 11, 2012

Creating A User Setup File

Creating a user setup file is pretty easy since it's a regular text file named "userSetup" with the "txt" extension changed to "mel". That's it!  Now you just have to edit this file as you would any text file and add lines of code to be executed as Maya starts up. You can save it in your user scripts folder.

I script in jEdit :3

Like for example, if I downloaded a mel file named doThisStuffForMe.mel and inside that file are multiple procedures and one of them is countMyBeans.  Even if I put doThisStuffForMe.mel in my user scripts folder, I can't just open Maya and call countMyBeans, Maya wouldn't know where to find that and will throw an error saying so. Source the doThisStuffForMe.mel  file first!  Simply open the  userSetup.mel in any plain text editor (like Notepad) and add a source line.

source doThisStuffForMe;

Maya assumes a mel extension
If your userSetup file isn't doing anything and you're on Windows, check here.

Note: You can source manually but you might find that to be inconvenient to do every time you open Maya and want to use your scripts.  There are endless things you can have Maya do on startup, sourcing script files is just one of them!