From bbc4a92318758ae104f796f62c7dceb1a972da44 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Jul 2015 14:31:27 +1000 Subject: Curve selection, de-duplicate & cleanup --- source/blender/editors/animation/keyframes_draw.c | 8 ++++---- source/blender/editors/animation/keyframes_edit.c | 22 +++++++++++----------- .../blender/editors/animation/keyframes_general.c | 16 ++++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) (limited to 'source/blender/editors/animation') diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index 9e38dd5507d..6f1883cff55 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -105,7 +105,7 @@ static DLRBT_Node *nalloc_ak_bezt(void *data) /* store settings based on state of BezTriple */ ak->cfra = bezt->vec[1][0]; - ak->sel = BEZSELECTED(bezt) ? SELECT : 0; + ak->sel = BEZT_ISSEL_ANY(bezt) ? SELECT : 0; ak->key_type = BEZKEYTYPE(bezt); /* set 'modified', since this is used to identify long keyframes */ @@ -121,7 +121,7 @@ static void nupdate_ak_bezt(void *node, void *data) BezTriple *bezt = (BezTriple *)data; /* set selection status and 'touched' status */ - if (BEZSELECTED(bezt)) ak->sel = SELECT; + if (BEZT_ISSEL_ANY(bezt)) ak->sel = SELECT; ak->modified += 1; /* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */ @@ -279,7 +279,7 @@ static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn) ab->end = beztn->vec[1][0]; ab->val = beztn->vec[1][1]; - ab->sel = (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0; + ab->sel = (BEZT_ISSEL_ANY(prev) || BEZT_ISSEL_ANY(beztn)) ? SELECT : 0; ab->modified = 1; return ab; @@ -340,7 +340,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, BezTriple *first_bezt */ if (IS_EQT(ab->start, prev->vec[1][0], BEZT_BINARYSEARCH_THRESH)) { /* set selection status and 'touched' status */ - if (BEZSELECTED(beztn)) ab->sel = SELECT; + if (BEZT_ISSEL_ANY(beztn)) ab->sel = SELECT; ab->modified++; /* done... no need to insert */ diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index ee1bfdff0bd..bd34f32dda8 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -455,7 +455,7 @@ static short ok_bezier_selected(KeyframeEditData *UNUSED(ked), BezTriple *bezt) /* this macro checks all beztriple handles for selection... * only one of the verts has to be selected for this to be ok... */ - if (BEZSELECTED(bezt)) + if (BEZT_ISSEL_ANY(bezt)) return KEYFRAME_OK_ALL; else return 0; @@ -1181,7 +1181,7 @@ static short select_bezier_add(KeyframeEditData *ked, BezTriple *bezt) bezt->f3 |= SELECT; } else { - BEZ_SEL(bezt); + BEZT_SEL_ALL(bezt); } return 0; @@ -1199,7 +1199,7 @@ static short select_bezier_subtract(KeyframeEditData *ked, BezTriple *bezt) bezt->f3 &= ~SELECT; } else { - BEZ_DESEL(bezt); + BEZT_DESEL_ALL(bezt); } return 0; @@ -1252,7 +1252,7 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt) int i = ked->curIndex; /* if current is selected, just make sure it stays this way */ - if (BEZSELECTED(bezt)) { + if (BEZT_ISSEL_ANY(bezt)) { map[i] = 1; return 0; } @@ -1261,7 +1261,7 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt) if (i > 0) { BezTriple *prev = bezt - 1; - if (BEZSELECTED(prev)) { + if (BEZT_ISSEL_ANY(prev)) { map[i] = 1; return 0; } @@ -1271,7 +1271,7 @@ static short selmap_build_bezier_more(KeyframeEditData *ked, BezTriple *bezt) if (i < (fcu->totvert - 1)) { BezTriple *next = bezt + 1; - if (BEZSELECTED(next)) { + if (BEZT_ISSEL_ANY(next)) { map[i] = 1; return 0; } @@ -1289,12 +1289,12 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt) /* if current is selected, check the left/right keyframes * since it might need to be deselected (but otherwise no) */ - if (BEZSELECTED(bezt)) { + if (BEZT_ISSEL_ANY(bezt)) { /* if previous is not selected, we're on the tip of an iceberg */ if (i > 0) { BezTriple *prev = bezt - 1; - if (BEZSELECTED(prev) == 0) + if (BEZT_ISSEL_ANY(prev) == 0) return 0; } else if (i == 0) { @@ -1306,7 +1306,7 @@ static short selmap_build_bezier_less(KeyframeEditData *ked, BezTriple *bezt) if (i < (fcu->totvert - 1)) { BezTriple *next = bezt + 1; - if (BEZSELECTED(next) == 0) + if (BEZT_ISSEL_ANY(next) == 0) return 0; } else if (i == (fcu->totvert - 1)) { @@ -1344,10 +1344,10 @@ short bezt_selmap_flush(KeyframeEditData *ked, BezTriple *bezt) /* select or deselect based on whether the map allows it or not */ if (on) { - BEZ_SEL(bezt); + BEZT_SEL_ALL(bezt); } else { - BEZ_DESEL(bezt); + BEZT_DESEL_ALL(bezt); } return 0; diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index b3dc0021f00..c198184db6f 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -167,11 +167,11 @@ void duplicate_fcurve_keys(FCurve *fcu) fcu->bezt = newbezt; /* Unselect the current key */ - BEZ_DESEL(&fcu->bezt[i]); + BEZT_DESEL_ALL(&fcu->bezt[i]); i++; /* Select the copied key */ - BEZ_SEL(&fcu->bezt[i]); + BEZT_SEL_ALL(&fcu->bezt[i]); } } } @@ -308,7 +308,7 @@ void smooth_fcurve(FCurve *fcu) /* first loop through - count how many verts are selected */ bezt = fcu->bezt; for (i = 0; i < fcu->totvert; i++, bezt++) { - if (BEZSELECTED(bezt)) + if (BEZT_ISSEL_ANY(bezt)) totSel++; } @@ -322,7 +322,7 @@ void smooth_fcurve(FCurve *fcu) /* populate tarray with data of selected points */ bezt = fcu->bezt; for (i = 0, x = 0; (i < fcu->totvert) && (x < totSel); i++, bezt++) { - if (BEZSELECTED(bezt)) { + if (BEZT_ISSEL_ANY(bezt)) { /* tsb simply needs pointer to vec, and index */ tsb->h1 = &bezt->vec[0][1]; tsb->h2 = &bezt->vec[1][1]; @@ -411,7 +411,7 @@ void sample_fcurve(FCurve *fcu) /* find selected keyframes... once pair has been found, add keyframes */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { /* check if selected, and which end this is */ - if (BEZSELECTED(bezt)) { + if (BEZT_ISSEL_ANY(bezt)) { if (start) { /* set end */ end = bezt; @@ -576,7 +576,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data) /* TODO: currently, we resize array every time we add a new vert - * this works ok as long as it is assumed only a few keys are copied */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { - if (BEZSELECTED(bezt)) { + if (BEZT_ISSEL_ANY(bezt)) { /* add to buffer */ newbuf = MEM_callocN(sizeof(BezTriple) * (aci->totvert + 1), "copybuf beztriple"); @@ -589,7 +589,7 @@ short copy_animedit_keys(bAnimContext *ac, ListBase *anim_data) *nbezt = *bezt; /* ensure copy buffer is selected so pasted keys are selected */ - BEZ_SEL(nbezt); + BEZT_SEL_ALL(nbezt); /* free old array and set the new */ if (aci->bezt) MEM_freeN(aci->bezt); @@ -776,7 +776,7 @@ static void paste_animedit_keys_fcurve(FCurve *fcu, tAnimCopybufItem *aci, float /* First de-select existing FCurve's keyframes */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { - BEZ_DESEL(bezt); + BEZT_DESEL_ALL(bezt); } /* mix mode with existing data */ -- cgit v1.2.3