Created
October 12, 2013 23:37
-
-
Save dgovil/6956180 to your computer and use it in GitHub Desktop.
Order Maya Shelves.
The pref keyword is set to xxx but you can set it to whatever and it'll keep any shelves that start with it in the front
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as mc | |
import maya.mel as mm | |
gshelf = mm.eval("$temp = $gShelfTopLevel") | |
shelves = mc.tabLayout(gshelf,q=1,childArray=1) | |
sTotal = len(shelves) | |
pref = 'xxx' | |
sShelf = sorted([s for s in shelves if s.startswith(pref)]) + sorted([s for s in shelves if not s.startswith(pref)]) | |
for i,shelf in enumerate(sShelf): | |
i += 1 | |
sIndex = mc.tabLayout(gshelf,q=1,childArray=1).index(shelf)+1 | |
mc.tabLayout(gshelf,e=1,moveTab=(sIndex,i)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment