likage
2018-10-10 23:23:39 UTC
Hello, I need some help with Mel in which I am trying to attach a sub-menu
onto a shelf button.
If the shelf button is toggled by left-mouse click (also the default), a
menu will be shown.
And if it is toggled with a right-mouse click, a different menu will be
shown.
This is my code:
shelfButton
-enableCommandRepeat 1
-enable 1
-noDefaultPopup
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-align "center"
-label "Set Rig Options"
-labelOffset 0
-font "tinyBoldLabelFont"
-image "myTestIcon.png"
-backgroundColor 0.25 0.25 0.25
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-sourceType "python"
-command "import moduleA; menuA=moduleA.dropdown_from_selection();
moduleA.showMenu(menuA)";
// When right-mouse click is toggled.
popupMenu -b 3;
// I need to give the label a name, otherwise Maya will
auto-provide a name such as 'menuitem1993' etc.
menuItem -l "MenuB Label" -sourceType "python" -command "import
moduleB; menuB= moduleB.dropdown_from_selection();
moduleB.show_menu(menuB)";
FYI - both menus - menuA and menuB are created/ generated using QMenu.
However, in the case of right-mouse click, it has to go through the label,
before the actual menu is shown. Is there anyway, in which I can bypass
this label, or if there is a better way in which I can handle both left and
right mouse click?
onto a shelf button.
If the shelf button is toggled by left-mouse click (also the default), a
menu will be shown.
And if it is toggled with a right-mouse click, a different menu will be
shown.
This is my code:
shelfButton
-enableCommandRepeat 1
-enable 1
-noDefaultPopup
-width 34
-height 34
-manage 1
-visible 1
-preventOverride 0
-align "center"
-label "Set Rig Options"
-labelOffset 0
-font "tinyBoldLabelFont"
-image "myTestIcon.png"
-backgroundColor 0.25 0.25 0.25
-style "iconOnly"
-marginWidth 1
-marginHeight 1
-sourceType "python"
-command "import moduleA; menuA=moduleA.dropdown_from_selection();
moduleA.showMenu(menuA)";
// When right-mouse click is toggled.
popupMenu -b 3;
// I need to give the label a name, otherwise Maya will
auto-provide a name such as 'menuitem1993' etc.
menuItem -l "MenuB Label" -sourceType "python" -command "import
moduleB; menuB= moduleB.dropdown_from_selection();
moduleB.show_menu(menuB)";
FYI - both menus - menuA and menuB are created/ generated using QMenu.
However, in the case of right-mouse click, it has to go through the label,
before the actual menu is shown. Is there anyway, in which I can bypass
this label, or if there is a better way in which I can handle both left and
right mouse click?
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/27a4524c-3b9a-4c58-8d7c-1d34718e2375%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/27a4524c-3b9a-4c58-8d7c-1d34718e2375%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.