Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

menuSet( [object] , [addMenu=string], [allMenuSets=boolean], [currentMenuSet=string], [exists=string], [hotBoxVisible=boolean], [insertMenu=[string, uint]], [label=string], [menuArray=string[]], [moveMenu=[string, uint]], [moveMenuSet=[string, uint]], [numberOfMenuSets=boolean], [numberOfMenus=boolean], [permanent=boolean], [removeMenu=string], [removeMenuSet=string])

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

menuSet is undoable, queryable, and editable.

Create a menu set which is used to logically order menus for display in the main menu bar. Such menu sets can be edited and reordered dynamically.

Return value

stringName of resulting menu set. (If there are no menu sets left, an empty string is returned)

In query mode, return type is based on queried flag.

Flags

addMenu, allMenuSets, currentMenuSet, exists, hotBoxVisible, insertMenu, label, menuArray, moveMenu, moveMenuSet, numberOfMenuSets, numberOfMenus, permanent, removeMenu, removeMenuSet
Long name (short name) Argument types Properties
addMenu(am) string create
Appends a menu onto the end of the current menu set.
allMenuSets(ams) boolean query
Returns an array of the all the menu set object names in use. Query returns string array.
currentMenuSet(cms) string createquery
The currently active menu set under which all operations affect (append, insert, remove, etc.). Query returns string.
exists(ex) string query
Returns whether the specified menu set exists. This query flag supports string arguments. ie. menuSet -q -exists animationMenuSet;

In query mode, this flag needs a value.

hotBoxVisible(hbv) boolean createqueryedit
Whether this menu set should be displayed in the hotbox as well as in the main menubar.
insertMenu(im) [string, uint] create
Inserts a menu into a specified index in the current menu set.
label(l) string createquery
The label of the current menu set. Query returns string.
menuArray(ma) string[] createquery
An array of menu names (strings) in the current menu set. Query returns string array.
moveMenu(mm) [string, uint] create
Moves a specified menu from the current menu set to a new position.
moveMenuSet(mms) [string, uint] create
Moves a specified menu set to another index.
numberOfMenuSets(nms) boolean query
Number of menuSets in total. Query returns int.
numberOfMenus(nm) boolean query
The mumber of menus in the current menu set. Query returns int.
permanent(p) boolean createqueryedit
Whether this menu set can be removed.
removeMenu(rm) string create
Removes a specified menu from the current menu set.
removeMenuSet(rms) string create
Removes the specified menu set object from the list of all menu sets.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# creating a new menu set;
cmds.menuSet( 'newMenuSetObjName', label='newMenuSet Label' )

# using commands on a current menu set
# first find the menu set if you don't know the name of it
animMS = maya.mel.eval('findMenuSetFromLabel("Animation")')

# menu sets can be queried like normal commands
animMenus = cmds.menuSet(animMS, query=True, menuArray=True)

# but editing the set requires either setting the current menu set...
# (notice that the menu set comamnds following specify no specific menu set)
cmds.menuSet( currentMenuSet=animMS )
cmds.menuSet( removeMenu=animMenus[0] )
# : (other commands which pertain to the animation menu set)

# .. or temporarily setting the menu set to work on (does not affect current menu set)
# (notice that every command following specifies the specific set to apply operations to)
polyMS = maya.mel.eval('findMenuSetFromLabel("Polygons")')
polyMenus = cmds.menuSet(polyMS, query=True, menuArray=True)
cmds.menuSet( polyMS, removeMenu=polyMenus[0], insertMenu=(polyMenus[1], 0) )

# .. where the following commands still affect the animation menu set
animMenus = cmds.menuSet(query=True, menuArray=True)

# if you need to find a specific menu...
deformMenu = maya.mel.eval( ('findMenuFromMenuSet(\"' + animMS + '\", "Deform")') )

# moving a menu from one spot to another
# (ie. moving the Deform Menu to the front of the list)
cmds.menuSet( moveMenu=(deformMenu, 0) )