Small animation tweaks:

- Fixed problem where just trying to replace existing keyframes would
result in the intepolation set on that keyframe to get lost. This was
mostly an issue if trying to re-block some animation in the middle of
a shot, with the rest of the keys set to Bezier, but the first
keyframe in this new segment needing to be Constant so that we don't
get sloppy automatic interpolation in the way

- Hooked up Media-Play/Stop/Next/Prev controls to animation playback
and keyframe jumping functionality in default keymap in addition the
existing controls. I'm also considering whether to migrate Next/Prev
Keyframe key mappings off the Ctrl-PageUp/Down keys for a more
ergonomic option (i.e. shift <, shift >)
This commit is contained in:
Joshua Leung
2011-02-27 01:53:05 +00:00
parent 039940e1e9
commit 1cbdc6c4d4
3 changed files with 18 additions and 5 deletions

View File

@@ -323,7 +323,7 @@ void smooth_fcurve (FCurve *fcu)
}
/* calculate the new smoothed F-Curve's with weighted averages:
* - this is done with two passes
* - this is done with two passes to avoid progressive corruption errors
* - uses 5 points for each operation (which stores in the relevant handles)
* - previous: w/a ratio = 3:5:2:1:1
* - next: w/a ratio = 1:1:2:5:3

View File

@@ -295,6 +295,7 @@ int insert_bezt_fcurve (FCurve *fcu, BezTriple *bezt, short flag)
int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
{
BezTriple beztr= {{{0}}};
int oldTot = fcu->totvert;
int a;
/* set all three points, for nicer start position
@@ -330,10 +331,16 @@ int insert_vert_fcurve (FCurve *fcu, float x, float y, short flag)
if ((fcu->totvert > 2) && (flag & INSERTKEY_REPLACE)==0) {
BezTriple *bezt= (fcu->bezt + a);
/* set interpolation from previous (if available) */
// FIXME: this doesn't work if user tweaked the interpolation specifically, and they were just overwriting some existing key in the process...
if (a > 0) bezt->ipo= (bezt-1)->ipo;
else if (a < fcu->totvert-1) bezt->ipo= (bezt+1)->ipo;
/* set interpolation from previous (if available), but only if we didn't just replace some keyframe
* - replacement is indicated by no-change in number of verts
* - when replacing, the user may have specified some interpolation that should be kept
*/
if (fcu->totvert > oldTot) {
if (a > 0)
bezt->ipo= (bezt-1)->ipo;
else if (a < fcu->totvert-1)
bezt->ipo= (bezt+1)->ipo;
}
/* don't recalculate handles if fast is set
* - this is a hack to make importers faster

View File

@@ -3221,11 +3221,17 @@ void ED_keymap_screen(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEUPKEY, KM_PRESS, KM_CTRL, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0)->ptr, "next", 0);
WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIALAST, KM_PRESS, 0, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", MEDIAFIRST, KM_PRESS, 0, 0)->ptr, "next", 0);
/* play (forward and backwards) */
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT, 0);
RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", AKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0)->ptr, "reverse", 1);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", ESCKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_play", MEDIAPLAY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_animation_cancel", MEDIASTOP, KM_PRESS, 0, 0);
/* Alternative keys for animation and sequencer playing */
#if 0 // XXX: disabled for restoring later... bad implementation
keymap= WM_keymap_find(keyconf, "Frames", 0, 0);