Go to: Synopsis. Return value. Python examples.

Synopsis

saveShelf( string string )

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

saveShelf is undoable, NOT queryable, and NOT editable.

This command saves the specified shelf (first argument) to the specified file (second argument).

Note that this command doesn't work well with controls that have mixed mel and python command callbacks. Also, because it saves the state to a mel file, it does not work with callbacks that are python callable objects.

Return value

booleanTrue if successful.

Python examples

import maya.cmds as cmds

#    Create a window with a shelf in it.
#
window = cmds.window()
tabs = cmds.tabLayout()
shelf = cmds.shelfLayout()
cmds.shelfButton( '\"Hello\\n\"")', image1='commandButton.png', command='("print' )
cmds.tabLayout( tabs, edit=True, tabLabel=(str(shelf),'Example Shelf')  )
cmds.showWindow( window )

#    At this point the example would be made more interesting if you
#    put some additional items on this shelf.

#    Now save the shelf in the temp directory.
#
tempDir = cmds.internalVar( userTmpDir=True )
cmds.saveShelf( shelf, (tempDir + 'ExampleShelf') );