MEL Scripts #1

I write in MEL sometimes to prevent small mistakes that can easily be overlooked like setting projects and frame rates, or automate some tediously repetitive process that could've been done by a trained monkey. I could've sworn I have written more scripts but these three are the basic scripts I use most frequently.

Simplify Texture File Path - You know when you move an entire project to another drive or rename the project and it fucks up all your textures because the file path stayed the same? I think the latest Maya fixes it up automatically as long as you set the right project but sometimes accidents do happen. This script can delete everything before "sourceimages" in all your texture file paths in one go.

Auto Set Project - When opening a scene file, a dialog will pop up if the file is not of the current project, and offers to set it to the correct project for you. It also informs you if your scene file is not in a project.

Frame Rate Check (PAL/NTSC/Film) - Pops up a warning if your frame rate is not right. I have fucked up before because I forgot to do that one little thing at the beginning. I use PAL because that's the standard of where I am. I added scripts for NTSC or Film in case some of you like to use those instead. If you get annoyed that the warning pops up every time you launch Maya (because of the default 24 fps), just go to File -> New Scene option box and set it to what you are always used to (PAL in my case).

For the Auto Set Project and Frame Rate Check, I often set it up so it runs automatically every time I open a scene file (I had used this power for evil by pranking my co-workers with it) This requires a little bit of installation:

1. Download and place the files to in: 

C:\Users\<your username>\Documents\maya\scripts

2. Open

C:\Users\<your username>\Documents\maya\scripts\userSetup.mel

in Notepad or Wordpad (Create one if it does not exist)

3. Copy and paste in the following code

source "CT_AutoSetProject.mel"; source "CT_FrameRateWarningPAL.mel";

scriptJob -e "SceneOpened" "CT_AutoSetProject; CT_FrameRateWarningPAL;";

4. Restart Maya

Hope these work for you. Let me know if something didn't quite work or if you have suggestions for scripts that you'd like me to write. Drop me a question any time. Obviously from the title, this is my first post for sharing scripts. I will post more scripts if I should happen to write more in the future.