Wednesday 2 November 2011

Context sensitive hotkeys

Want the same hotkey to do different things dependent on which Maya window you're in?

string $panelWithFocus = `getPanel -withFocus`;
if( $panelWithFocus == "polyTexturePlacementPanel1" ){
//we're in the UV Editor!
}
else{
//We're somewhere else
}
Great for having different marking menus under one hotkey.

UV editor marking menus

How do you get a custom Maya marking menu to pop up in the UV editor instead of the viewport? Go to the hotkey editor and change the marking menu script to say:
-parent polyTexturePlacementPanel1Window
instead of:
-parent viewPanes
This should work with any Maya UI element.