My next few posts involve modifying a Maya start-up script. I realise that not everyone is comfortable doing this, so I wrote this post as a primer to show you how to make alterations safely and without the risk of breaking the original scripts.
That's not to say that there isn't a risk involved in adapting Maya's default scripts; this is not something Autodesk encourages or supports.
But if you really have to modify a Maya start-up script, this is how I would go about it.
It's really simple.
1) We take an existing script from one of the maya2009/scripts directories:
Windows: C:/Program Files/Autodesk/Maya2009/scripts/
Mac OSX: /Applications/Autodesk/maya2009/Maya.exe (Show Package Contents) Contents/scripts/
2) We save it in our user profile scripts directory, as a MEL file.
Windows: C:/Documents and Settings/usr/My Documents/maya/2009/scripts/
Mac OSX: /users/usr/Library/Preferences/Autodesk/maya/2009/scripts/
3) The duplicate script can be edited without the risk of damaging the original. Copying the file before you modify it is crucial if you have an auto-save function in your text-editor.
So how does this work? Maya sources its own scripts before any that it finds in the user's own scripts directory. Put simply, we leave the original script alone, and get Maya to re-source a modified version of the same script that we have placed in our user Scripts directory.
There are several advantages to this:
- you never overwrite the original scripts - doing so can result in Maya loading with errors, or worse...
- if you have to re-install Maya, or a Service Pack, scripts in your user profile aren't affected.
- you can fall back on the default Maya scripts anytime, by moving or renaming your scripts directory.
Voila. I shall add links here to posts where I alter Maya's start-up scripts: