Saturday, February 18, 2012

Stop Undo-ing the scrub time slider in Maya

In one of those discussions about which animation tool is better (Maya or 3ds Max), a fellow animator commented on something I never thought about. He said that he hated the way Maya added the time slider scrubbing to the undo queue. In other words, every time you change a frame in Maya, whether by stepping to the next frame or key, an Undo action is registered. This issue was very annoying to my friend, since whenever he changed a pose, he scrubbed the time slider (several times) to see if the change worked. If i didn't worked, he had to undo all the scrubbing before undoing the actual change in the pose.

For some reason, I got use to it. That's why I never complained about it. But, this subject made me realize that it is actually an issue. Less undos means faster animation. So, I decided to ask Google what it thinks about this subject...

He pointed me to this link. It describes a way to change your hotkeys in a way that you disable the undo queue for that specific command.

The thing is, Maya is a software made up from scripts. Everything is a script. From hotkeys to tools. So, the Next/Previous hotkeys to scrub the timeline are no exception. There is a command that runs whenever you press the , or the . key. So, in changing that command, you can get rid of the undo queue-ing.

Basically, these are the commands you have to change:

Next Frame (Alt + .)
undoInfo -stateWithoutFlush off;
currentTime ( `currentTime -q` + 1 );
undoInfo -stateWithoutFlush on;

Previous frame (Alt + ,)
undoInfo -stateWithoutFlush off;
currentTime ( `currentTime -q` - 1 );
undoInfo -stateWithoutFlush on;

Next Key (.)
undoInfo -stateWithoutFlush off;
currentTime -edit `findKeyframe -timeSlider -which next`;
undoInfo -stateWithoutFlush on;

Previous Key (,)
undoInfo -stateWithoutFlush off;
currentTime -edit `findKeyframe -timeSlider  -which previous`;
undoInfo -stateWithoutFlush on;

Basically, what these commands do, is disable the undo queue before jumping to another frame/key and then enables it back. If you look closely, the middle command (starting with 'currentTime') is the same as the existing commands. The only thing we're adding is the 'undoInfo' lines at the beginning and end.

Note: You will not be able to edit the existing commands. Instead, create new ones.

So, go to your Hotkey Editor (Window\Settings/Preferences\HotKey Editor), select the "Playback Controls" category and create the new commands. Then just reassign the hotkeysto the new commands and done!

I created a little window to explain the steps.

I honestly think Autodesk should implement an option in the Undo settings to implement something like this. It would safe people some time (and lots of keystrokes!).


Kyle Kenworthy said...

awesome! this is very helpful, nice blog you got here

Ricardo Ayasta said...

Thanks Kyle!

Jais Bredsted said...

thanks a lot. Very useful

Ricardo Ayasta said...

Thanks Jais!

Kiko Buyo said...

Wohoo, this is totally a WIN

Valerie said...

This is amazing! Super helpful. Thank you!

Adham Kosht said...

Its funny to look for the solution to a problem, and see that one of the most awesome work colleagues has the answer, in the other end of the world.

Gracias querido!!


Ricardo Ayasta said...

Che! Para la proxima, antes de preguntarle a Google, me preguntas a mi ;)

Droux said...


this is perfect, thank you very much! Do you have the same solution for Alt+v (playback)? For some reason, it's doing it in my scene?!?


Ricardo Ayasta said...

Hello David,

Not sure why it's doing that. The playback shouldn't be undoable. If the problem persists, you can try the same thing with the Playback hotkey: Just add both "undoInfo" lines to the play command and it should be fine.