diff options
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/keyframes_edit.c | 87 |
1 files changed, 67 insertions, 20 deletions
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index f8328e9f07f..dc413e936eb 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -501,10 +501,16 @@ void ANIM_editkeyframes_refresh(bAnimContext *ac) ok |= KEYFRAME_OK_KEY; \ \ if (ked && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) { \ - if (check(0)) \ - ok |= KEYFRAME_OK_H1; \ - if (check(2)) \ - ok |= KEYFRAME_OK_H2; \ + /* Only act on visible items, so check handle visiblity state. */ \ + const bool handles_visible = ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? \ + (BEZT_ISSEL_ANY(bezt)) : \ + true); \ + if (handles_visible) { \ + if (check(0)) \ + ok |= KEYFRAME_OK_H1; \ + if (check(2)) \ + ok |= KEYFRAME_OK_H2; \ + } \ } \ } \ (void)0 @@ -1054,7 +1060,11 @@ KeyframeEditFunc ANIM_editkeyframes_mirror(short type) /* Sets the selected bezier handles to type 'auto' */ static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + /* If the key is selected, always apply to both handles. */ + if (bezt->f2 & SELECT) { + bezt->h1 = bezt->h2 = HD_AUTO; + } + else { if (bezt->f1 & SELECT) { bezt->h1 = HD_AUTO; } @@ -1064,6 +1074,7 @@ static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) ENSURE_HANDLES_MATCH(bezt); } + return 0; } @@ -1072,7 +1083,11 @@ static short set_bezier_auto(KeyframeEditData *UNUSED(ked), BezTriple *bezt) */ static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if ((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) { + /* If the key is selected, always apply to both handles. */ + if (bezt->f2 & SELECT) { + bezt->h1 = bezt->h2 = HD_AUTO_ANIM; + } + else { if (bezt->f1 & SELECT) { bezt->h1 = HD_AUTO_ANIM; } @@ -1082,18 +1097,26 @@ static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *b ENSURE_HANDLES_MATCH(bezt); } + return 0; } /* Sets the selected bezier handles to type 'vector' */ static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if (bezt->f1 & SELECT) { - bezt->h1 = HD_VECT; + /* If the key is selected, always apply to both handles. */ + if (bezt->f2 & SELECT) { + bezt->h1 = bezt->h2 = HD_VECT; } - if (bezt->f3 & SELECT) { - bezt->h2 = HD_VECT; + else { + if (bezt->f1 & SELECT) { + bezt->h1 = HD_VECT; + } + if (bezt->f3 & SELECT) { + bezt->h2 = HD_VECT; + } } + return 0; } @@ -1114,24 +1137,38 @@ static short bezier_isfree(KeyframeEditData *UNUSED(ked), BezTriple *bezt) /* Sets selected bezier handles to type 'align' */ static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if (bezt->f1 & SELECT) { - bezt->h1 = HD_ALIGN; + /* If the key is selected, always apply to both handles. */ + if (bezt->f2 & SELECT) { + bezt->h1 = bezt->h2 = HD_ALIGN; } - if (bezt->f3 & SELECT) { - bezt->h2 = HD_ALIGN; + else { + if (bezt->f1 & SELECT) { + bezt->h1 = HD_ALIGN; + } + if (bezt->f3 & SELECT) { + bezt->h2 = HD_ALIGN; + } } + return 0; } /* Sets selected bezier handles to type 'free' */ static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { - if (bezt->f1 & SELECT) { - bezt->h1 = HD_FREE; + /* If the key is selected, always apply to both handles. */ + if (bezt->f2 & SELECT) { + bezt->h1 = bezt->h2 = HD_FREE; } - if (bezt->f3 & SELECT) { - bezt->h2 = HD_FREE; + else { + if (bezt->f1 & SELECT) { + bezt->h1 = HD_FREE; + } + if (bezt->f3 & SELECT) { + bezt->h2 = HD_FREE; + } } + return 0; } @@ -1422,8 +1459,13 @@ KeyframeEditFunc ANIM_editkeyframes_easing(short mode) static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt) { + /* Only act on visible items, so check handle visiblity state. */ + const bool handles_visible = ked && ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? + (BEZT_ISSEL_ANY(bezt)) : + true); + /* if we've got info on what to select, use it, otherwise select all */ - if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) { + if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES) && handles_visible) { if (ked->curflags & KEYFRAME_OK_KEY) { bezt->f2 |= SELECT; } @@ -1443,8 +1485,13 @@ static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt) static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt) { + /* Only act on visible items, so check handle visiblity state. */ + const bool handles_visible = ked && ((ked->iterflags & KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE) ? + (BEZT_ISSEL_ANY(bezt)) : + true); + /* if we've got info on what to deselect, use it, otherwise deselect all */ - if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES)) { + if ((ked) && (ked->iterflags & KEYFRAME_ITER_INCL_HANDLES) && handles_visible) { if (ked->curflags & KEYFRAME_OK_KEY) { bezt->f2 &= ~SELECT; } |