How can I add menu on menubar with Maya API?

How can I add menu on menubar with Maya API?

Anonymous
Not applicable
837 Views
1 Reply
Message 1 of 2

How can I add menu on menubar with Maya API?

Anonymous
Not applicable
Adding Menu is works like below


import maya.OpenMayaMPx as OpenMayaMPx
mplugin = OpenMayaMPx.MFnPlugin()
mplugin.addMenuItem("polyCube", "MayaWindow|mainEditMenu", "polyCube", "")


But, I can't add menu on menubar.

import maya.OpenMayaMPx as OpenMayaMPx
mplugin = OpenMayaMPx.MFnPlugin()
mplugin.addMenuItem("polyCube", "MayaWindow", "polyCube", "")

// Error: line 1: menu: Object 'MayaWindow' not found. //
# Error: RuntimeError: file c:\buildforge\Maya_2013_Win64\build\wrk\optim\runTime\Python\Lib\site-packages\maya\OpenMayaMPx.py line 146: (kFailure): Unexpected Internal Failure #


Is there any way to add menu on menubar?
0 Likes
838 Views
1 Reply
Reply (1)
Message 2 of 2

TrebC
Community Visitor
Community Visitor

Old question, but I had same issue and found the answer:

 

This API is not available via C++ unfortunately, so you must use: MGlobal::executeCommand(...)

0 Likes