Create custom marking menus in the Node Editor

You can customize the node marking menus. The following is an example using Python to add a custom node marking menu item to the plusMinusAverage node.

Create the plusMinusAverage node in the Node Editor, then run the following script in the Script Editor.

from maya.app.general import nodeEditorMenus
from maya import cmds

def addPMAMenuItems(ned, node):
    """
    Check for plusMinusAverage node and create necessary menu items
    """
    type = cmds.nodeType(node)
    if type == 'plusMinusAverage':
        def doSomething(*args):
            cmds.confirmDialog(title="Something", message="Ok?")
        cmds.menuItem(label="PlusMinusAverage! Do something!", c = doSomething)
        return True
    else:
        return False

# register the custom callback with nodeEditor
#
nodeEditorMenus.customInclusiveNodeItemMenuCallbacks.append(addPMAMenuItems) 

The plusMinusAverage node now includes the custom menu item "PlusMinusAverage! Do something!".

Related topics