Empty shelves after restarting Maya 2017

Sometimes Autodesk Maya does not seem to remember changes you make to shelves. For example, creating a new shelf and adding commands to it will result in an empty shelf when you restart Maya. Googling the issue showed that it’s a common issue, and I’ve seen suggestions to erase all your preferences, which solves the problem.

I wanted to dig deeper and find the issue, since I wanted to keep my preferences. 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:

optionVar 
 -sv "shelfAlign1" "left"
 -sv "shelfAlign10" "left"
 -sv "shelfAlign14" "left";
optionVar
 -sv "shelfFile1" "shelf_CurvesSurfaces"
 -sv "shelfFile17" "shelf_RenderMan"
 -sv "shelfFile18" "shelf_RenderMan";
optionVar
 -iv "shelfLoad1" 1
 -iv "shelfLoad17" 1
 -iv "shelfLoad18" 1;
optionVar
 -sv "shelfName18" "RenderMan"
 -sv "shelfName19" "RenderMan"
 -sv "shelfName2" "Polygons";
optionVar
 -sv "shelfVersion4" "2016"
 -sv "shelfVersion5" "2010"
 -sv "shelfVersion6" "2010";
optionVar
 -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

optionVar;

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

optionVar
 -sv "shelfVersion4" "2016"
 -sv "shelfVersion5" "2010"
 -sv "shelfVersion6" "2010"
optionVar
 -iv "selectedShelf" 11