Showing posts with label Animation. Show all posts
Showing posts with label Animation. Show all posts

Monday, December 24, 2012

Pan Zoom Script [Animation]

Wouldn't it be nice if we could just zoom in and pan around in our shot cam without disturbing the camera?

One solution you might know about is Maya's Pan Zoom function:





In which case, you also know that this function sucks hard. Right. But we can build off this!


My script has two parts - in the first part, you will set a button to pan your camera view like you were holding down the spacebar in Photoshop or Flash. You need to set two different hotkey scripts to the same button, one for when the button is first pressed and one for when it's released.














The code for when it's pressed:

    global string $currentTool;
    $currentTool = `currentCtx`;
    PanZoomTool;

And when it's released:

    setToolTo $currentTool;

With this, you can hold down your hotkey and drag the mouse to around your camera view. When released, Maya automatically back to whatever tool you were using before you toggled the script.

We also want to be able to easily zoom in and out.

To zoom in, put this code on a hotkey (I used F1):

    panZoom -zoomRatio 0.9;

To zoom out, use this (I used F2):

    panZoom -zoomRatio 1.1;

To engage and disengage this function completely, all you have to do is toggle the Pan Zoom magnifying glass you see in the first image of this post.

Thursday, December 20, 2012

Copy Key Script [Animation]

This simple script I made copies your current key and pastes it onto the next key on the timeline. It replicates the 'middle mouse + drag + S' process we all hate. 



I'd recommend assigning it to an easily reached hotkey (I use 'Y').

Here's the code:

timeSliderCopyKey; //copies key
currentTime `findKeyframe -ts`; //finds next frame
timeSliderPasteKey false; //pastes onto frame

I use this script constantly when I animate. Many workflows, especially ones that involve keeping your shot in spline for most of the process, involve extensive use of copying and pasting keys to 'bookend' your pose as if it were in stepped tangents. To me, this process is too laborious to allow for the experimentation you want be doing during blocking. But with this script on a hotkey, this workflow is fast and adaptable - especially when combined with your 'select all' hotkey. And if that's not a workflow that appeals to you, this script will  probably stillprove worthy of your keyboard real estate.


If you want the code to copy a key to the previous key, here's that too:

timeSliderCopyKey;
PreviousKey;
timeSliderPasteKey false