diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-02-27 04:53:05 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-02-27 04:53:05 +0300 |
commit | 1cbdc6c4d48b5f5f1b3a4e0edf3ddbdf00413db7 (patch) | |
tree | f3458f1cadeb6739e5ea1b3ca3198dbb97cf4ac7 | |
parent | 039940e1e9c110fb5fcc9211fa7056d28a827b6c (diff) |
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 >)
-rw-r--r-- | source/blender/editors/animation/keyframes_general.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 15 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 6 |
3 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index aea8c2407b4..c1b98349d5a 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -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 diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index adc580c253d..50ceee3597d 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -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 diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 75f28b6541f..1dbc3e9a7b0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -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); |