How to make a Toggle Script for switching MoveTool settings?


Hi everyone,

First time posting here, please forgive any mistakes.

I’m trying to create a MEL script that allows me to cycle between Move Falloff modes when using Transformation Tools in the Graph Editor (cycling between Constant, Linear and Exponential).


Unfortunately I don’t know how to script, and have trouble following the Maya MEL documents.
All I have so far is this script someone on Twitter posted, but I have no idea how to get it to work (here’s the original Twitter post:


string $runCommandCmd = (“runTimeCommand -category “User” -c (“moveKeyCtx -e -moveFunction \“linear\” \“moveKeyContext\””) graphKeysFalloffDown;” );

string $nameCommandCmd = (“nameCommand -ann “graphKeysFalloffDown” -c “graphKeysFalloffDown” graphKeysFalloffDown;”);

string $runCommandUpCmd2 = (“runTimeCommand -category “User” -c (“moveKeyCtx -e -moveFunction \“constant\” \“moveKeyContext\””) graphKeysFalloffUp;” );

string $nameCommandUpCmd2 = (“nameCommand -ann “graphKeysFalloffUp” -c “graphKeysFalloffUp” graphKeysFalloffUp;”);

hotkey -keyShortcut “!” -name (“graphKeyFalloffDownName”);
hotkey -keyShortcut “!” -releaseName (“graphKeyFalloffUp”);
savePrefs -hk;


I also found out that running these two lines separately can change the tool. Doesn’t work for exponential strangely:
moveKeyCtx -e -moveFunction “constant” moveKeyContext;

moveKeyCtx -e -moveFunction “linear” moveKeyContext;

Any help much appreciated!!


Maybe something like this.

string $falloffMove = `moveKeyCtx -q -moveFunction moveKeyContext`;

if ($falloffMove == "constant") {
    moveKeyCtx -e -moveFunction "linear" moveKeyContext;
if ($falloffMove == "linear") {
    moveKeyCtx -e -moveFunction "power" moveKeyContext;
if ($falloffMove == "power") {
    moveKeyCtx -e -moveFunction "constant" moveKeyContext;


Amazing, it’s exactly what I was looking for! Was totally unaware of falloffMove. Thank you!