pymel.core.windows.menuSet

menuSet(*args, **kwargs)

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.

Flags:
Long name (short name) Argument Types Properties
addMenu (am) unicode ../../../_images/create.gif
 
Appends a menu onto the end of the current menu set.
allMenuSets (ams) bool ../../../_images/query.gif
 
Returns an array of the all the menu set object names in use. Query returns string array.
currentMenuSet (cms) unicode ../../../_images/create.gif ../../../_images/query.gif
 
The currently active menu set under which all operations affect (append, insert, remove, etc.). Query returns string.
exists (ex) unicode ../../../_images/query.gif
 
Returns whether the specified menu set exists. This query flag supports string arguments. ie. menuSet -q -exists animationMenuSet;
hotBoxVisible (hbv) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Whether this menu set should be displayed in the hotbox as well as in the main menubar.
insertMenu (im) unicode, int ../../../_images/create.gif
 
Inserts a menu into a specified index in the current menu set.
label (l) unicode ../../../_images/create.gif ../../../_images/query.gif
 
The label of the current menu set. Query returns string.
menuArray (ma) string[...] ../../../_images/create.gif ../../../_images/query.gif
 
An array of menu names (strings) in the current menu set. Query returns string array.
moveMenu (mm) unicode, int ../../../_images/create.gif
 
Moves a specified menu from the current menu set to a new position.
moveMenuSet (mms) unicode, int ../../../_images/create.gif
 
Moves a specified menu set to another index.
numberOfMenuSets (nms) bool ../../../_images/query.gif
 
Number of menuSets in total. Query returns int.
numberOfMenus (nm) bool ../../../_images/query.gif
 
The mumber of menus in the current menu set. Query returns int.
permanent (p) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Whether this menu set can be removed. Flag can have multiple arguments, passed either as a tuple or a list.
removeMenu (rm) unicode ../../../_images/create.gif
 
Removes a specified menu from the current menu set.
removeMenuSet (rms) unicode ../../../_images/create.gif
 
Removes the specified menu set object from the list of all menu sets.

Derived from mel command maya.cmds.menuSet

Example:

import pymel.core as pm

# creating a new menu set;
pm.menuSet( 'newMenuSetObjName', label='newMenuSet Label' )
# Result: u'newMenuSetObjName' #

# 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 = pm.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)
pm.menuSet( currentMenuSet=animMS )
# Result: u'animationMenuSet' #
pm.menuSet( removeMenu=animMenus[0] )
# Result: u'animationMenuSet' #
# : (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 = pm.menuSet(polyMS, query=True, menuArray=True)
pm.menuSet( modelMS, removeMenu=polyMenus[0], insertMenu=(polyMenus[1], 0) )

# .. where the following commands still affect the animation menu set
animMenus = pm.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)
pm.menuSet( moveMenu=(deformMenu, 0) )

Previous topic

pymel.core.windows.menuItem

Next topic

pymel.core.windows.menuSetPref

Core

Core Modules

Other Modules

This Page