This might be a little obscure but thought I would throw this out there for anyone who searches this with Google. I know it was frustrating to find any kind of real resource on the subject so here it is. You can add a right-click pop-up menu to pretty much any UI element with Mel/Python in Maya. Here is a link to the docs about this menu:
http://download.autodesk.com/us/maya/2011help/CommandsPython/popupMenu.html
Take a look at the example. Not too informative but basically all you need is a parent to attach the menu to and set the button to be the RMB, and you are done!
Example:
import maya.cmds as cmds
win = cmds.window()
cmds.rowColumnLayout()
btn = cmds.button(l='Click Me')
popup = cmds.popupMenu(parent=btn, ctl=False, button=3)
item1 = cmds.menuItem(l='Item1', c='whatever and')
item2 = cmds.menutItem(l='Item2', c='whatever')
cmds.showWindow(win)
and there you go! That's really all there is to it.
No comments:
Post a Comment