Friday, January 21, 2011


well clearly the last motivational "get this blog on track" post didn't work so hopefully this one will. I have enough content for atleast a few posts. just need to get to it.

Today i'll share my first script that I did without it being an assignment.

First and foremost lets be clear everyone has their own way to work/animate. Their own comfort level with certain buttons and functions. I only offer this as an alternative and look into how i work.

Now about the tool. Everyone I talked to always said it would be a bit useless to have this tool because they are already accustomed to their methods which are quick, but I think if you get used to my script, it can speed up your anim workflow.

The set up:

you have x amount of keys on an fcurve all at different values and you want to select one or a chunk of them and re-align them to a certain value in the graph editor.

The meathods:

Snap value - problem is it only snaps to whole numbers rendering it useless.

MMB key attribute - this seems to be the preferred by animators, but because i have not really explored the mmb, i haven't grown dependent on it and therefore tried to quicken my workflow my own way. I see this technique as involving too many steps and moving your cursor around the screen-estate too much. To use this method you click on the keyframe in the timeline for the value you want to snap to, then you mmb to the designated key you want to snap(this prevents the grapheditor from updating itself), lastly you can ctrl+wer keying each channel (untidy and unecessary) or you go to the channel box, select the attribute and key it. Now i'm not 100% sure but i THINK you can only do this method for 1 key at a time.

PreviousKeyframeValue Tool - My little uncomplicated tool. Where once you set it as a hotkey (plugging the script into the hotkey editor) all of the MMB meathod is simplified to a button press. Also this script allows you to do more than one key at a time. The only thing to keep in mind is that the value you are snapping to will always be the earliest keyframe on the timeline you selected, which makes sense because more often then not your are snapping keys next to eachother to create flat tangents etc.

The code

// PreviousKeyframeValue
// Ver. 0.1
// To use: select two or more
// keys in the graph editor
// on a single curve. Snap!

proc prevKeyValue()
string $animCurves[] = `keyframe -q -name`;
float $selectTimes[] = `keyframe -q -sl -timeChange`;
float $selectValues[] = `keyframe -q -sl -valueChange`;
float $allTimes[] = `keyframe -q -timeChange $animCurves[0]`;
float $allValues[] = `keyframe -q -valueChange $animCurves[0]`;

// sets selected keyframe values to the first keyframe value
// in the selection and flattens their tangents.

for ( $i = 0; $i < `size $allTimes`; $i++ ) { for ( $a = 0; $a < `size $selectTimes`; $a++ ) { if ( ( $allTimes[$i] == $selectTimes[$a] )) { keyframe -e -index $i -valueChange $selectValues[0] $animCurves[0]; keyTangent -itt flat -ott flat -t $selectTimes[$a] $animCurves[0]; } } } }; prevKeyValue();

okay. that should be it. feel free to give it a try. if you have any suggestions or comments feel free to let me know. this is the first version and I do intend to keep adding to it and making similar tools to anim workflow.


9 useful web apps
digital painting video

No comments: