Be More Productive - Creating Custom Shelves and Buttons in Maya

Maya is a very extensive program with so many different tools scattered all throughout the interface. One of the best things about Maya is that you can access these tools numerous different ways, but that is also a downfall. Going through menus and remembering where tools are located can take time and can sometimes be a hassle. There are also times when you forget which menu the tool actually lives in. This usually happens with a tool you only use on occasion. This is where a custom shelf is perfect to use. A shelf is like a gallery of shortcuts that contain the tools you put there. This allows you to quickly and easily access those tools without going through different menus. You can also add custom buttons created from MEL or Python scripts in a shelf.

How do you create a custom shelf in Maya?

Once you start Maya, you should see a gray tab with a down arrow underneath it at the top left of the application within the shelf UI module. Click the downward facing arrow and select New Shelf. 01_AddShelf A dialog box will pop-up asking you to name the shelf, make sure there are no spaces in the name. The name could have something to do with the project you are working on, the type of object you are modeling or even just your name. It is just so you can specify that custom shelf and you can quickly jump from one to the other while knowing what tools are on each shelf by the name. For this article we will call the shelf NewShelf. Click OK to create the shelf. If you look up at the self UI module, you will notice the new shelf was added.

How do you add buttons to a custom shelf in Maya?

Now that a shelf is made, it is time to add a few buttons to the shelf. Make sure that the custom shelf is selected. To add a button hold down CRTL + Shift and navigate through the menus to find the function you would like to add. Once you find that function, left click on it, while still holding down CRTL + Shift. 02_FunctionClick You should see an icon now in your custom shelf for that function.

How do you create custom buttons using MEL or Python in Maya?

You can also add custom MEL or Python as buttons on a shelf. To do this you will need to open up the script editor. Window > General Editors > Script Editor In the script editor you will need to clear the history or clear all. Edit > Clear All This gives you a clean area to work with and there will be no script present when you go to make your custom button. Find a script that you use often and paste it into the script editor. Highlight the script that you just put into the script editor, middle mouse button click on the script and drag the code onto the shelf module and release the middle mouse button. 04_ScriptEditorDrag This will create the standard MEL or Python icon in your shelf for that script. Now all that you need to do to run the script is click that icon in the shelf.

How do you make custom icons for your custom buttons?

If you have a couple of custom buttons in your shelf, you might get them mixed up. The best way to fix this is to throw together a quick icon that you can apply to the custom button so that you know what that button will do when you click it. To do this, you will first need to make an icon that relates to your custom function. For this tutorial we will use an icon that represents a camera. The icon will need to be 32 x 32 pixels at 72 DPI. Then save the icon out as a .PNG so that it will be transparent if you have no background. You will need to save the icon  Documentsmaya2013-x64prefsicons. If you are not using Maya 2013, you will need to save it in the directory related to your version of Maya. Once you have the icon saved, go back to where you created your custom shelf and click Shelf Editor... 05_ShelfEditor You should see a dialog box like this pop up. 06_ShelfEditorBox On the left side select your custom shelf name and on the right side select the custom button that you would like to apply your custom icon to. Click the file folder out to the right next to the Maya icon and navigate to the place that you saved the .PNG. Documentsmaya2013-x64prefsicons Select the icon and click OK. The icon should be updated in the shelf editor. Now click Save All Shelves. This will update any of the icons that you changed when in the shelf editor. 07_EditorIcon Using custom shelves and buttons can save you a lot of time. Always keep a backup of your scripts on another drive, but this will allow you to quickly access scripts within Maya so you do not have to go looking for those scripts. Be sure to check out the Artist's Guide to Python Scripting in Maya and the Artist's Guide to MEL Scripting in Maya for more tips and tricks on how to speed up your workflow.