Empty shelves after restarting Maya 2017

Download script

I decided to make a script to solve the issue. Get it here: https://github.com/mortenblaa/maya/blob/master/scripts/utilities/fix_empty_shelves/fix_empty_shelves.py

On GitHub, right-click on the “Raw” button and choose “Save link as…”

Save the script in Maya’s scripts folder, and execute this in a Python tab in the Script Editor

from fix_empty_shelves import *

The issue

Empty shelves or disappearing shelf buttons is an issue that occasionally shows up in Maya. Googling showed that it’s a common problem, and I’ve seen suggestions to erase all your preferences, which solves it.

I wanted figure out what was going on and if I could possibly avoid deleting all my preferences every time. The culprit seemed to be somewhere in the userPrefs.mel file, and opening the file showed me that the same shelf was being created a vast number of times. In my case it was the “RenderMan” shelf that was attempted to be created multiple times. I had noticed the following warning in the Script Editor while starting Maya.

// Warning: file: /Applications/Autodesk/maya2016/Maya.app/Contents/scripts/startup/shelf.mel line 219: The shelf "RenderMan" already exists.

With this in mind I searched through the userPrefs.mel file and I decided to delete all entries that looked like duplicates. Keep note of the number, like “shelfName18”, since you also want to delete “shelfAlign18”, “shelfFile18”, “shelfLoad18” and potentially “shelfVersion18”.

 -sv "shelfAlign1" "left"
 -sv "shelfAlign10" "left"
 -sv "shelfAlign14" "left";
 -sv "shelfFile1" "shelf_CurvesSurfaces"
 -sv "shelfFile17" "shelf_RenderMan"
 -sv "shelfFile18" "shelf_RenderMan";
 -iv "shelfLoad1" 1
 -iv "shelfLoad17" 1
 -iv "shelfLoad18" 1;
 -sv "shelfName18" "RenderMan"
 -sv "shelfName19" "RenderMan"
 -sv "shelfName2" "Polygons";
 -sv "shelfVersion4" "2016"
 -sv "shelfVersion5" "2010"
 -sv "shelfVersion6" "2010";
 -iv "selectedShelf" 11;

The default location for the userPrefs.mel file is in the following locations:

  • Windows C:\Users\YourUsername\My Documents\maya\2016-x64\prefs\
  • macOS ~/Library/Preferences/Autodesk/maya/2016/prefs/

When deleting these entries watch out that you keep the optionVar -args; intact, meaning that you should not leave an empty command like this


but also end the command with a semicolon ; so that it doesn’t look like this (notice the missing semicolon on the 4th line):

    -sv "shelfVersion4" "2016"
    -sv "shelfVersion5" "2010"
    -sv "shelfVersion6" "2010" 
    -iv "selectedShelf" 11;
Write a comment