USES
The Maya SnapKey command can't resolve cases where there is more than one keyframe in between two consecutive whole number frames and you'll get a warning message like this: "// Warning: line 0: Had to skip snapping on some keys since multiple keys existed between the snap multiple. Command result indicates number of skipped keys. // "
The Snap Tools UI provides tools to handle this situation,
INTERFACE
One button fix:
The Snap and Fix button will call the Maya snapKey command on the selected time range and then handle the leftover non-integer keyframes following these rules:
- if the previous whole number frame doesn't have keyframes, it moves the non-integer key to the previous whole number frame.
- if the previous whole number frame already has a keyframe, it moves the non-integer key to the next whole number frame, unless the next whole number already has a keyframe
- if both the previous whole frame and the next whole frame already have keyframes, it deletes the non-integer keyframe.
Manual fix:
If you want a different solution than the automatic "Snap and Fix" you can handle it manually using the following tools that work on the selected time range.
Update list: It populates and refreshes the "Select key:" drop down menu with all the non-integer keys found in the time range for the selected object. You will need to use this button to refresh the list if you alter the keys without using the Snap Tools UI (for example using Ctrl+Z or deleting or moving a key directly from the timeline or the graph editor)
Snap: It calls the Maya snapKey command and populates the "Select key:" drop down menu with all the non-integer keys found in the time range for the selected object.
The rest of the tools are pretty self explanatory:
Delete selected key
Move key to previous whole number
Move key to next whole number
Go to selected key
INSTALLATION
To get the Snap Tools UI, download the script file and save it in your maya/version/scripts folder:
Download snapTools.py
Then run the following code in the script editor (make sure to be in a python tab):
import snapTools
reload(snapTools)
You can save these lines in a shelf button for easy access.
If you don't want to download the file you can just copy the code below to the script editor and drag it onto your custom shelves so you can access it at any time (remember to save your shelves before quitting Maya)