Documentation: HotKeys


MARUI HotKeys are a way to place the functions as convenient buttons in VR space.
They work similarly to the Shelf, but can be freely programmed and their position and contents can be saved.

HotKeys can be programmed either with Python or MEL script,
or more conveniently with the HotKey Editor.

The HotKey Editor

The HotKey editor is a simple graphical dialog to create, edit, save and delete MARUI HotKeys.
If can be opened from the Maya shelf, by clicking the HotKeys icon in the MARUI shelf tab:
Icon Hotkeys

Hotkey Menu

The HotKeys List

In the top part of the HotKey Editor (1) is a list of all the HotKeys you have created.
Upon first opening the HotKey editor, this list will most likely be empty.

Creating HotKeys

You can create new floating HotKey windows, by entering a name into the text box (2) and clicking “create”.
The name is the unique identification for the HotKey window, so you can use every name only once.
As soon as you have created a HotKey window, it will appear in VR in front of you.
Upon creation, it will be an empty floating window.
See the section Adding Elements on how to add elements to your HotKey window.

Re-centering HotKey windows

If you have lost sight of your HotKey window in VR, you can use the Center button to bring it back into your field of view.
Select the name of the HotKeys from the list and click Center. It should then appear in front of you again.

Deleting HotKeys

You can delete existing by selecting them from the list and clicking the Delete button.
Note that this will also delete all the elements in the selected HotKey window.

The Elements List

Below the HotKey Windows list is the list of elements (3) for the currently selected HotKey window.
When you select a different HotKey window from the HotKeys window list (1), this list will be automatically updated to show the elements of that HotKey window.
Upon creating a new HotKey window (or instance), this list will be empty.

Adding Elements

To add new elements (items) to the currently selected HotKey window, fill in the text fields (4) and press the Create New button.

Title / Tooltip

This is the name of the element. This will appear in the Elements List (3), so choose a name by which you can remember the function of the HotKey.
This will also be displayed in VR as a tooltip when you hover with your cursor over the respective element in the HotKey window.

Command / Script

This is the MEL or Python command that will be issued when you click the HotKey element in VR.
It can be a Maya command (eg. move -relative 1 2 3) or your own script.
Use the radio buttons below to specify whether the script is in MEL script of Python script.


Here you can specify an icon image for the HotKey element.
This can be either your own image file on your hard drive (supported image formats are PNG, JPEG, BMP, and TIF),
or a Maya icon (eg activeSelectedAnimLayer.png).
For a list of available Maya icon files, see Maya’s “Shelf Editor” or execute the Maya script command resourceManager -nf “*”.
If you do not specify an icon, the first letter of the title / tooltip will be used.

Updating Elements

You can update elements by selecting them from the Elements List (3), changing the values in the text fields (4) and pressing Update Selected.
You can also change the order of elements in the HotKeys window by pressing the Move Up and Move Down buttons on the right side of the Elements List (3).

Deleting Elements

You can delete elements from the currently selected HotKey window by selecting the element in the Elements List (3) and pressing the Delete Selected button.

Saving and Loading HotKeys, and the HotKeys save-file

At the bottom of the HotKey Editor (5) are two buttons: Save and Load.
Save will save your current HotKeys to your computer hard drive, so they will be available the next time you start MARUI.
The location of the HotKey save file will be in your Maya preferences folder.
By default, this will be
C:\Users\<your name>\Documents\maya\<maya version>\prefs\MARUI_HotKeys.mel
for example, for a user named “Max” and Maya version 2018, this folder would be:
This is a simple MEL script file, so you can edit it with a text editor to include your own scripts.
See the section below on how to read and write scripts for HotKeys.

MARUI will load your saved HotKeys automatically upon starting.

Scripting HotKeys

If you want to automate your HotKeys, you can perform all the operations that the HotKey editor allows manually via Python or MEL script.
The command to create, edit, save and delete HotKeys is the MARUI_HotKeys command.
The following example illustrates how to use scripting to create, edit, and delete HotKeys.

// Create a new HotKey window instance named "my HotKeys
MARUI_HotKeys -create "my HotKeys";
// Add elements to the HotKey window instance
MARUI_HotKeys -addElement  -title "my MEL Command" -command "myMELcommand()" "my HotKeys";
MARUI_HotKeys -addElement  -title "my Python Command" -command "myPythonCommand()" -python 1 "my HotKeys";
MARUI_HotKeys -addElement  -title "command with icon" -command "anotherCommand" -icon "D:/my IconsI/icon1.png" "my HotKeys";
// Update the second element (whose zero-based index is 1) in the list
MARUI_HotKeys -setElement 1 -icon "activeSelectedAnimLayer.png" "my HotKeys";
// Delete the third element (whose zero-based index is 2) in the list
MARUI_HotKeys -deleteElement 2 "my HotKeys";
// Get the position, rotation, and scale or the HotKeys window instance
float $translation[] = `MARUI_HotKeys -q -tt "my HotKeys";
float $rotation[] = `MARUI_HotKeys -q -tr "my HotKeys";
float $scale = `MARUI_HotKeys -q -ts "my HotKeys";