Maya - Shelf sort order

Hey there,

I dynamically create a shelf everytime our user opens a scene.
I’d like this new shelf to be the first in the list of shelves (all the way to the left).
The problem is that the shelf seems to be created next to the currently active shelf in maya UI.

Do you now a mel or cmds command to control this behaviour?

Thanks

So this is an old post, but saw it as I was googling and thought I could answer anyway.

I’m not sure if there’s a way to get the shelf tab index directly from the tab name, but this should work:
Bear in mind, the tab label may not be what the actual shelf is named since Maya make a nice name of “MotionGraphics” to “Motion Graphics” in the UI. Just make sure to type in the name as the shelf is called. For convenience I always use underscore in my names for this purpose.

shelf = 'MotionGraphics'
# set this int to where you want to move the tab to. It starts at 1
moveTo = 1
# select the tab by label
mc.tabLayout(gShelfTopLevel, e=True, st=shelf)
# get the index of the selected tab
currentTabInt = mc.tabLayout(gShelfTopLevel, q=True, sti=True)
# Move the tab to its new position
mc.tabLayout(gShelfTopLevel, e=True, mt=(currentTabInt, moveTo))
# set focus back to the tab
mc.tabLayout(gShelfTopLevel, e=True, sti=moveTo)
1 Like