PDA

View Full Version : MEL for hotkey with MM


ftaswin
08-17-2006, 12:47 AM
Hi,

Does anyone knows how can I make a hotkey behave 2 ways like those on W, E and R?

It behaves as a Move/Rotate/Scale tool when you press but also a marking menu if you hold down? I tried to open the buildRotate.mel and I could not understand it.:sad:

Little help please? Thanks in advance.


Ft

cpan
08-17-2006, 01:49 PM
hi again Ferry :D

this type or marking menus work like this:

when the user presses the key, maya executes the main command
then it builds the marking menu (after it deletes it first), it parents
it to the viewport and finaly it assigns it to a mouse button (so when
the user presses that mouse button, it shows up the marking menu too).

and when the user releases the key, it deletes the marking menu
using the "MarkingMenuPopDown;" general command.




now take a look again into the buildRotateMM.mel to see exactly what
i said above:


//with this code it first deletes the previous MM (if there is one)
if (`popupMenu -exists tempMM`)
{
deleteUI tempMM;
}

//now it invokes the main command (here it enters the rotate tool)
RotateTool;


// now it builds the tempMM marking menu again to fill it with menuItems later
popupMenu -markingMenu true
-button 1
-parent viewPanes
tempMM;

// it gets the rotate tool mode (global, local, blabla) to check the right radio menuItems later
int $mode = `manipRotateContext -q -mode Rotate`;


// and now build the main menuItems
menuItem
-label "Local"
-command "manipRotateContext -e -mode 0 Rotate;"
-checkBox ($mode == 0 ? 1 : 0)
-radialPosition "N"
-annotation "Set rotate to local"
;
.
.
.



also as an example, to build your own command-MM from within maya's UI:
*open the Hotkey Editor
*under the User section on the left create a new command (myMMPress) with the fallowing code:

if (`popupMenu -exists tempMM`)
deleteUI tempMM;


// add here the main command ->
print ("Command Invoked! Press the left mouse button to see the MM too :)");


popupMenu
-markingMenu true
-button 1
-parent viewPanes
tempMM;


// add here your own menu items
menuItem
-label "Ding!"
-command "print \"Ding!\""
-radialPosition "W"
-annotation "Marking menu West"
;
menuItem
-label "Dong!"
-command "print \"Dong!\""
-radialPosition "E"
-annotation "Marking menu EAST"
;

setParent -menu ..;

* now assing this new command a press hotkey (such as ";" + Press )
* now make a new command (myMMRelease) with the "MarkingMenuPopDown;" code
* and assign it to the same key as before but as Release (aka ";" + Release)

now press ";" or hold ";" & press LMB to invoke the command or show the MM


tell me if there's smth unclear :)

ftaswin
08-17-2006, 11:54 PM
:buttrock::applause::bowdown:

I'm speechless....

Come on brain... work with me this time and I'll get you a beer :banghead:

Thanks Calin...


Ft

CGTalk Moderation
08-17-2006, 11:54 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.