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

Synopsis

menuEditor( [string] , [annotation=string], [backgroundColor=[float, float, float]], [cellHeight=int], [cellWidth=int], [cellWidthHeight=[int, int]], [checkBoxPresent=[boolean, string, int]], [checkBoxState=[boolean, string, int]], [childArray=boolean], [command=[string, string, int]], [defineTemplate=string], [delete=[string, int]], [docTag=string], [dragCallback=script], [dropCallback=script], [enable=boolean], [enableBackground=boolean], [enableKeyboardFocus=boolean], [exists=boolean], [fullPathName=boolean], [height=int], [highlightColor=[float, float, float]], [iconMenuCallback=string], [image=[string, string, int]], [isObscured=boolean], [label=[string, string, int]], [manage=boolean], [menuItemTypes=boolean], [noBackground=boolean], [numberOfChildren=boolean], [numberOfPopupMenus=boolean], [optionBoxCommand=[string, string, int]], [optionBoxPresent=[boolean, string, int]], [parent=string], [popupMenuArray=boolean], [preventOverride=boolean], [radioButtonPresent=[boolean, string, int]], [radioButtonState=[boolean, string, int]], [separator=[string, int]], [statusBarMessage=string], [style=string], [subMenuAt=[string, int]], [subMenuEditorWindow=string], [subMenuEditorsOpen=boolean], [subMenuOf=[string, string, int]], [topLevelMenu=string], [useTemplate=string], [visible=boolean], [visibleChangeCommand=script], [width=int])

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

menuEditor is undoable, queryable, and editable.

A menuEditor displays the contents of a popup menu and allows the menu's items to be edited. Menu items are represented by labelled icons which can be dragged around within the editor to change the menu's layout. Various objects can be dragged and dropped into the menuEditor to create new menu items: toolButtons from the shelf or toolbox, shelfButtons from the shelf, iconTextButtons with attached commands, and scripts from the command window.

When editing a Marking Menu, the radial menu items correspond to 8 icons arranged in a circle within the menuEditor. Overflow items in the Marking Menu (or linear items in a normal menu) are displayed in a column below the radial items.

To edit a submenu of a popup menu, a new menuEditor instance must be created (typically within its own window) and attached to its parent menuEditor.

Some flags require the position of a menu item to be passed in as an argument. For these, positions are specified with a (string,int) pair, where the string corresponds to a radial position (possibily "None") and the int corresponds to a linear position (possibly equal to 0 for none). Radial positions are specified by one of ("N",0), ("NE",0), ("E",0), ("SE",0), ("S",0), ("SW",0), ("W",0) or ("NW",0). Overflow, or linear positions, are specified with ("None",i), where i is a 1-based index giving the position of the item within the overflow column.

Note: This command is not meant to be called explicitly. It was created to support the Marking Menu editor. It is recommended that you use that editor to modify marking menus.

Return value

stringFull path name to the editor.

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

Flags

annotation, backgroundColor, cellHeight, cellWidth, cellWidthHeight, checkBoxPresent, checkBoxState, childArray, command, defineTemplate, delete, docTag, dragCallback, dropCallback, enable, enableBackground, enableKeyboardFocus, exists, fullPathName, height, highlightColor, iconMenuCallback, image, isObscured, label, manage, menuItemTypes, noBackground, numberOfChildren, numberOfPopupMenus, optionBoxCommand, optionBoxPresent, parent, popupMenuArray, preventOverride, radioButtonPresent, radioButtonState, separator, statusBarMessage, style, subMenuAt, subMenuEditorWindow, subMenuEditorsOpen, subMenuOf, topLevelMenu, useTemplate, visible, visibleChangeCommand, width
Long name (short name) Argument types Properties
annotation(ann) string createqueryedit
Annotate the control with an extra string value.
backgroundColor(bgc) [float, float, float] createqueryedit
The background color of the control. The arguments correspond to the red, green, and blue color components. Each component ranges in value from 0.0 to 1.0.
When setting backgroundColor, the background is automatically enabled, unless enableBackground is also specified with a false value.
cellHeight(ch) int queryedit
The height of the icons in the menuEditor.
cellWidth(cw) int queryedit
The width of the icons in the menuEditor.
cellWidthHeight(cwh) [int, int] edit
The width and height of the icons in the menuEditor.
checkBoxPresent(cbp) [boolean, string, int] queryedit
This controls whether a menu item has a check box or not. The arguments are a flag indicating presence, followed by the position of the menu item. This flag is ignored if the menu item is a submenu item. If queried, an array of booleans is returned containing all the flags. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
checkBoxState(cbs) [boolean, string, int] queryedit
The state of the check box associated with a menu item. The arguments are a flag indicating state, followed by the position of the menu item. This flag is ignored if the menu item does not have a check box. If queried, an array of booleans is returned containing all the flags. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
childArray(ca) boolean query
Returns a string array of the names of the layout's immediate children.
command(c) [string, string, int] queryedit
The command or script executed by a menu item. The arguments are the command string or script name, followed by the position of the menu item. This flag is ignored if the menu item is a submenu item or a separator item. If queried, an array of strings is returned containing all the commands. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
defineTemplate(dt) string create
Puts the command in a mode where any other flags and arguments are parsed and added to the command template specified in the argument. They will be used as default arguments in any subsequent invocations of the command when templateName is set as the current template.
delete(d) [string, int] edit
Deletes the menu item at the given position, removing it from the menu. If the menu item has a submenu, and a sub-menuEditor is open and attached to it, then the sub-menuEditor's window and all its child menuEditor windows will be closed recursively.
docTag(dtg) string createqueryedit
Add a documentation flag to the control. The documentation flag has a directory structure. (e.g., -dt render/multiLister/createNode/material)
dragCallback(dgc) script createedit
Adds a callback that is called when the middle mouse button is pressed. The MEL version of the callback is of the form:

global proc string[] callbackName(string $dragControl, int $x, int $y, int $mods)

The proc returns a string array that is transferred to the drop site. By convention the first string in the array describes the user settable message type. Controls that are application defined drag sources may ignore the callback. $mods allows testing for the key modifiers CTRL and SHIFT. Possible values are 0 == No modifiers, 1 == SHIFT, 2 == CTRL, 3 == CTRL + SHIFT.

In Python, it is similar, but there are two ways to specify the callback. The recommended way is to pass a Python function object as the argument. In that case, the Python callback should have the form:

def callbackName( dragControl, x, y, modifiers ):

The values of these arguments are the same as those for the MEL version above.

The other way to specify the callback in Python is to specify a string to be executed. In that case, the string will have the values substituted into it via the standard Python format operator. The format values are passed in a dictionary with the keys "dragControl", "x", "y", "modifiers". The "dragControl" value is a string and the other values are integers (eg the callback string could be "print '%(dragControl)s %(x)d %(y)d %(modifiers)d'")

dropCallback(dpc) script createedit
Adds a callback that is called when a drag and drop operation is released above the drop site. The MEL version of the callback is of the form:

global proc callbackName(string $dragControl, string $dropControl, string $msgs[], int $x, int $y, int $type)

The proc receives a string array that is transferred from the drag source. The first string in the msgs array describes the user defined message type. Controls that are application defined drop sites may ignore the callback. $type can have values of 1 == Move, 2 == Copy, 3 == Link.

In Python, it is similar, but there are two ways to specify the callback. The recommended way is to pass a Python function object as the argument. In that case, the Python callback should have the form:

def pythonDropTest( dragControl, dropControl, messages, x, y, dragType ):

The values of these arguments are the same as those for the MEL version above.

The other way to specify the callback in Python is to specify a string to be executed. In that case, the string will have the values substituted into it via the standard Python format operator. The format values are passed in a dictionary with the keys "dragControl", "dropControl", "messages", "x", "y", "type". The "dragControl" value is a string and the other values are integers (eg the callback string could be "print '%(dragControl)s %(dropControl)s %(messages)r %(x)d %(y)d %(type)d'")

enable(en) boolean createqueryedit
The enable state of the control. By default, this flag is set to true and the control is enabled. Specify false and the control will appear dimmed or greyed-out indicating it is disabled.
enableBackground(ebg) boolean createqueryedit
Enables the background color of the control.
enableKeyboardFocus(ekf) boolean createqueryedit
If enabled, the user can navigate to the control with the tab key and select values with the keyboard or mouse. This flag would typically be used to turn off focus support from controls that get it by default, like Edit and List controls. If disabled, text in text fields can still be selected with the mouse but cannot be copied (except on Linux when "Middle Click Paste" is enabled).
exists(ex) boolean create
Returns whether the specified object exists or not. Other flags are ignored.
fullPathName(fpn) boolean query
Return the full path name of the widget, which includes all the parents.
height(h) int createqueryedit
The height of the control. The control will attempt to be this size if it is not overruled by parent layout conditions.
highlightColor(hlc) [float, float, float] createqueryedit
The highlight color of the control. The arguments correspond to the red, green, and blue color components. Each component ranges in value from 0.0 to 1.0.
iconMenuCallback(imc) string create
This is the name of a MEL callback procedure that is called to create the popup menus attached to icons in the menuEditor. The callback is called once for each newly created icon, and once each time an icon is moved within the menuEditor. Popup menus created by the callback should contain commands for editing the menu item associated with the icon. Operations accessible through the menu should include deletion of the item, editing of the item's label/command/image/checkbox/optionbox, creation of a submenu, and popping up a sub-menuEditor.

The arguments to the callback must match this form:

callbackProc(string $menuEditorName, string $parentIconName, string $menuTitle, string $radialPosition, int $overflowRow);

The popup menu's parent should be $parentIconName.

Note that when a sub-menuEditor is created, this flag need not be re-specified as it adopts a default value equal to the value of its parent menuEditor's -imc/iconMenuCallback flag.

image(i) [string, string, int] queryedit
The filename of the icon associated with a menu item. This icon is displayed by the menuEditor to represent the menu item. The arguments are the icon filename, followed by the position of the menu item. If queried, an array of strings is returned containing all the icon filenames. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
isObscured(io) boolean query
Return whether the control can actually be seen by the user. The control will be obscured if its state is invisible, if it is blocked (entirely or partially) by some other control, if it or a parent layout is unmanaged, or if the control's window is invisible or iconified.
label(l) [string, string, int] queryedit
The label of a menu item. The arguments are the label text, followed by the position of the menu item. If queried, an array of strings is returned containing all the labels. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
manage(m) boolean createqueryedit
Manage state of the control. An unmanaged control is not visible, nor does it take up any screen real estate. All controls are created managed by default.
menuItemTypes(mit) boolean query
This is a query only flag. Returns an array of strings indicating the type of contents in each cell of the menuEditor. Cells can be "vacant", or may contain a regular menu "item", or a "separator", or a "submenu" item. In each case, the corresponding string is returned. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
noBackground(nbg) boolean createedit
Clear/reset the control's background. Passing true means the background should not be drawn at all, false means the background should be drawn. The state of this flag is inherited by children of this control.
numberOfChildren(nch) boolean query
Returns in an int the number of immediate children of the layout.
numberOfPopupMenus(npm) boolean query
Return the number of popup menus attached to this control.
optionBoxCommand(obc) [string, string, int] queryedit
The command or script executed by a menu item's associated option box item. The arguments are the command string or script name, followed by the position of the menu item. This flag is ignored if the menu item does not have an associated option box item. If queried, an array of strings is returned containing all the commands. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
optionBoxPresent(obp) [boolean, string, int] queryedit
This controls whether a menu item has an associated option box item or not. The arguments are a flag indicating presence, followed by the position of the menu item. This flag is ignored if the menu item is a submenu item. If queried, an array of booleans is returned containing all the flags. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
parent(p) string createquery
The parent layout for this control.
popupMenuArray(pma) boolean query
Return the names of all the popup menus attached to this control.
preventOverride(po) boolean createqueryedit
If true, this flag prevents overriding the control's attribute via the control's right mouse button menu.
radioButtonPresent(rbp) [boolean, string, int] queryedit
This controls whether a menu item has a radio button or not. The arguments are a flag indicating presence, followed by the position of the menu item. This flag is ignored if the menu item is a submenu item. If queried, an array of booleans is returned containing all the flags. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
radioButtonState(rbs) [boolean, string, int] queryedit
The state of the radio button associated with a menu item. The arguments are a flag indicating state, followed by the position of the menu item. This flag is ignored if the menu item does not have a radio button. If queried, an array of booleans is returned containing all the flags. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
separator(sp) [string, int] queryedit
In edit mode this adds a separator to the menuEditor at the specified position. The parameters are the radialPosition and the overflowRow. If queried, an array of booleans is returned indicating if the item is a separator item. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
statusBarMessage(sbm) string createedit
Extra string to display in the status bar when the mouse is over the control.
style(st) string queryedit
This is the style of icons within the menuEditor. Valid styles are "iconOnly", "textOnly", "iconAndTextHorizontal" and "iconAndTextVertical".
subMenuAt(sma) [string, int] edit
Creates a submenu item at the given position. A submenu item created within the radial portion of a menu will overwrite whatever item (if any) is currently at the given position. A submenu item created within the overflow (linear) portion of a menu will be inserted before the item currently at the given position.
subMenuEditorWindow(sew) string create
The name of the window which contains a sub-menuEditor. Only use when creatitg a sub-menuEditor. This window will automatically be closed if a parent menuEditor is closed or if a parent menu item is deleted.
subMenuEditorsOpen(seo) boolean query
This is a query only flag. Returns an array of booleans, each of which indicates if a sub-menuEditor is open and attached to the menu item in a particular cell. One boolean is returned for each cell in the menuEditor, even if the cell is vacant or contains a non-submenu item (false will be returned in both these cases). Only when a cell contains a submenu item can true possibily be returned. The first 8 entries of the array correspond to radial items (in order, "N", "NE", ... "NW"), and all later entries correspond to overflow (or linear) menu items.
subMenuOf(smo) [string, string, int] create
Attaches a sub-menuEditor to its parent menuEditor. Only use when creatitg a sub-menuEditor. The arguments are the name of the parent menuEditor, followed by the position of a submenu item within the parent. A submenu item must already exist within the parent at the given position. A submenu item cannot have multiple sub-menuEditors attached to it.
topLevelMenu(tlm) string queryedit
The popup menu to attach to the editor. All editing operations performed in the editor (i.e. inserting/deleting/moving an item) will be immediately reflected in this menu. This flag is ignored if the editor is a sub-menuEditor. The editor will update gracefully if the value of the flag is changed from its initial value.
useTemplate(ut) string create
Forces the command to use a command template other than the current one.
visible(vis) boolean createqueryedit
The visible state of the control. A control is created visible by default. Note that a control's actual appearance is also dependent on the visible state of its parent layout(s).
visibleChangeCommand(vcc) script createqueryedit
Command that gets executed when visible state of the control changes.
width(w) int createqueryedit
The width of the control. The control will attempt to be this size if it is not overruled by parent layout conditions.

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

# No example is provided as <b>menuEditor</b> is not intended to be called
# independently. It is recommended that you use the Marking Menu editor
# to customize marking menus.