From ad00c1210acdfd49ffb3cf1eb4c22ccea054d855 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 May 2012 11:52:44 +0000 Subject: [PATCH] rename macros for mask point selection - were a bit confusing. --- source/blender/blenkernel/BKE_mask.h | 18 +++++++++--------- source/blender/blenkernel/intern/curve.c | 3 +-- source/blender/blenkernel/intern/mask.c | 8 ++++---- source/blender/editors/mask/mask_draw.c | 6 +++--- source/blender/editors/mask/mask_ops.c | 16 ++++++++-------- .../blender/editors/mask/mask_relationships.c | 4 ++-- source/blender/editors/mask/mask_select.c | 8 ++++---- .../editors/transform/transform_conversions.c | 10 +++++----- 8 files changed, 36 insertions(+), 37 deletions(-) diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index d02e6f1966b..e21a2aa54e8 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -135,16 +135,16 @@ void BKE_mask_object_shape_changed_remove(struct MaskObject *maskobj, int index, /* rasterization */ void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer); -#define MASKPOINT_ISSEL(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT) -#define MASKPOINT_SEL(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f2 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0 -#define MASKPOINT_DESEL(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f2 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0 -#define MASKPOINT_INVSEL(p) { (p)->bezt.f1 ^= SELECT; (p)->bezt.f2 ^= SELECT; (p)->bezt.f3 ^= SELECT; } (void)0 +#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT) +#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT) +#define MASKPOINT_ISSEL_HANDLE_ONLY(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) ) +#define MASKPOINT_ISSEL_HANDLE(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) ) -#define MASKPOINT_CV_ISSEL(p) ( (p)->bezt.f2 & SELECT) +#define MASKPOINT_SEL_ALL(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f2 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0 +#define MASKPOINT_DESEL_ALL(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f2 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0 +#define MASKPOINT_INVSEL_ALL(p) { (p)->bezt.f1 ^= SELECT; (p)->bezt.f2 ^= SELECT; (p)->bezt.f3 ^= SELECT; } (void)0 -#define MASKPOINT_HANDLE_ONLY_ISSEL(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) && (((p)->bezt.f2 & SELECT) == 0) ) -#define MASKPOINT_HANDLE_ISSEL(p) ( (((p)->bezt.f1 | (p)->bezt.f2) & SELECT) ) -#define MASKPOINT_HANDLE_SEL(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0 -#define MASKPOINT_HANDLE_DESEL(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0 +#define MASKPOINT_SEL_HANDLE(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0 +#define MASKPOINT_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0 #endif diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index ce62b9c10dc..84ac51f68ae 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3200,8 +3200,7 @@ float (*BKE_curve_vertexCos_get(Curve * UNUSED(cu), ListBase * lb, int *numVerts else { BPoint *bp = nu->bp; - for (i = 0; i < nu->pntsu * nu->pntsv; i++, bp++) { - copy_v3_v3(co, bp->vec); co += 3; + for (i = 0; i < nu->pntsu * nu->pntsv; i++, bp++) { copy_v3_v3(co, bp->vec); co += 3; } } } diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 1e2d65c4dd7..3421f5ad9e5 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -655,10 +655,10 @@ void BKE_mask_point_select_set(MaskSplinePoint *point, int select) int i; if (select) { - MASKPOINT_SEL(point); + MASKPOINT_SEL_ALL(point); } else { - MASKPOINT_DESEL(point); + MASKPOINT_DESEL_ALL(point); } for (i = 0; i < point->tot_uw; i++) { @@ -674,10 +674,10 @@ void BKE_mask_point_select_set(MaskSplinePoint *point, int select) void BKE_mask_point_select_set_handle(MaskSplinePoint *point, int select) { if (select) { - MASKPOINT_HANDLE_SEL(point); + MASKPOINT_SEL_HANDLE(point); } else { - MASKPOINT_HANDLE_DESEL(point); + MASKPOINT_DESEL_HANDLE(point); } } diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index ae64294fd3e..0cf2cb77177 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -124,7 +124,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline) int sel = FALSE; if (j == 0) { - sel = MASKPOINT_ISSEL(point); + sel = MASKPOINT_ISSEL_ANY(point); } else { sel = point->uw[j - 1].flag & SELECT; @@ -174,7 +174,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline) } /* draw CV point */ - if (MASKPOINT_CV_ISSEL(point)) { + if (MASKPOINT_ISSEL_KNOT(point)) { if (point == maskobj->act_point) glColor3f(1.0f, 1.0f, 1.0f); else @@ -189,7 +189,7 @@ static void draw_spline_points(MaskObject *maskobj, MaskSpline *spline) /* draw handle points */ if (has_handle) { - if (MASKPOINT_HANDLE_ISSEL(point)) { + if (MASKPOINT_ISSEL_HANDLE(point)) { if (point == maskobj->act_point) glColor3f(1.0f, 1.0f, 1.0f); else diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 5e547d9dec4..c5371e7760a 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -660,7 +660,7 @@ static int slide_point_invoke(bContext *C, wmOperator *op, wmEvent *event) ED_mask_select_flush_all(mask); } } - else if (!MASKPOINT_ISSEL(slidedata->point)) { + else if (!MASKPOINT_ISSEL_ANY(slidedata->point)) { ED_mask_select_toggle_all(mask, SEL_DESELECT); BKE_mask_point_select_set(slidedata->point, TRUE); @@ -963,7 +963,7 @@ static void setup_vertex_point(bContext *C, Mask *mask, MaskSpline *spline, Mask BKE_mask_parent_init(&new_point->parent); /* select new point */ - MASKPOINT_SEL(new_point); + MASKPOINT_SEL_ALL(new_point); ED_mask_select_flush_all(mask); } @@ -1040,7 +1040,7 @@ static void finSelectedSplinePoint(MaskObject *maskobj, MaskSpline **spline, Mas for (i = 0; i < cur_spline->tot_point; i++) { MaskSplinePoint *cur_point = &cur_spline->points[i]; - if (MASKPOINT_ISSEL(cur_point)) { + if (MASKPOINT_ISSEL_ANY(cur_point)) { if (*spline != NULL && *spline != cur_spline) { *spline = NULL; *point = NULL; @@ -1088,7 +1088,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, const float co[2]) point_index = (point - spline->points); - MASKPOINT_DESEL(point); + MASKPOINT_DESEL_ALL(point); if ((spline->flag & MASK_SPLINE_CYCLIC) || (point_index > 0 && point_index != spline->tot_point - 1)) @@ -1222,7 +1222,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op) RNA_float_get_array(op->ptr, "location", co); - if (maskobj && maskobj->act_point && MASKPOINT_ISSEL(maskobj->act_point)) { + if (maskobj && maskobj->act_point && MASKPOINT_ISSEL_ANY(maskobj->act_point)) { /* cheap trick - double click for cyclic */ MaskSpline *spline = maskobj->act_spline; @@ -1469,7 +1469,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (!MASKPOINT_ISSEL(point)) + if (!MASKPOINT_ISSEL_ANY(point)) count++; } @@ -1495,7 +1495,7 @@ static int delete_exec(bContext *C, wmOperator *UNUSED(op)) for (i = 0, j = 0; i < tot_point_orig; i++) { MaskSplinePoint *point = &spline->points[i]; - if (!MASKPOINT_ISSEL(point)) { + if (!MASKPOINT_ISSEL_ANY(point)) { if (point == maskobj->act_point) maskobj->act_point = &new_points[j]; @@ -1571,7 +1571,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (MASKPOINT_ISSEL(point)) { + if (MASKPOINT_ISSEL_ANY(point)) { BezTriple *bezt = &point->bezt; bezt->h1 = bezt->h2 = handle_type; diff --git a/source/blender/editors/mask/mask_relationships.c b/source/blender/editors/mask/mask_relationships.c index 2d2c527d961..65c3980e3ea 100644 --- a/source/blender/editors/mask/mask_relationships.c +++ b/source/blender/editors/mask/mask_relationships.c @@ -74,7 +74,7 @@ static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op)) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (MASKPOINT_ISSEL(point)) { + if (MASKPOINT_ISSEL_ANY(point)) { point->parent.flag &= ~MASK_PARENT_ACTIVE; } } @@ -144,7 +144,7 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (MASKPOINT_ISSEL(point)) { + if (MASKPOINT_ISSEL_ANY(point)) { point->parent.id_type = ID_MC; point->parent.id = &clip->id; strcpy(point->parent.parent, tracking->name); diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 679f25aafea..4f0b33294d3 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -64,7 +64,7 @@ int ED_mask_spline_select_check(MaskSplinePoint *points, int tot_point) for (i = 0; i < tot_point; i++) { MaskSplinePoint *point = &points[i]; - if (MASKPOINT_ISSEL(point)) + if (MASKPOINT_ISSEL_ANY(point)) return TRUE; } @@ -159,7 +159,7 @@ void ED_mask_select_flush_all(Mask *mask) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *cur_point = &spline->points[i]; - if (MASKPOINT_ISSEL(cur_point)) { + if (MASKPOINT_ISSEL_ANY(cur_point)) { spline->flag |= SELECT; } else { @@ -248,7 +248,7 @@ static int select_exec(bContext *C, wmOperator *op) maskobj->act_spline = spline; maskobj->act_point = point; - if (!MASKPOINT_HANDLE_ISSEL(point)) { + if (!MASKPOINT_ISSEL_HANDLE(point)) { BKE_mask_point_select_set_handle(point, TRUE); } else if (toggle) { @@ -270,7 +270,7 @@ static int select_exec(bContext *C, wmOperator *op) maskobj->act_spline = spline; maskobj->act_point = point; - if (!MASKPOINT_ISSEL(point)) { + if (!MASKPOINT_ISSEL_ANY(point)) { BKE_mask_point_select_set(point, TRUE); } else if (toggle) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index f563a7a089d..89228423bf5 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5890,7 +5890,7 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point, { BezTriple *bezt = &point->bezt; float aspx, aspy; - short is_sel_point = MASKPOINT_ISSEL(point); + short is_sel_point = MASKPOINT_ISSEL_ANY(point); tdm->point = point; copy_m3_m3(tdm->vec, bezt->vec); @@ -5994,8 +5994,8 @@ static void createTransMaskingData(bContext *C, TransInfo *t) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (MASKPOINT_ISSEL(point)) { - if (MASKPOINT_CV_ISSEL(point)) + if (MASKPOINT_ISSEL_ANY(point)) { + if (MASKPOINT_ISSEL_KNOT(point)) countsel += 3; else countsel += 1; @@ -6033,10 +6033,10 @@ static void createTransMaskingData(bContext *C, TransInfo *t) for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; - if (propmode || MASKPOINT_ISSEL(point)) { + if (propmode || MASKPOINT_ISSEL_ANY(point)) { MaskPointToTransData(sc, point, td, td2d, tdm, propmode); - if (propmode || MASKPOINT_CV_ISSEL(point)) { + if (propmode || MASKPOINT_ISSEL_KNOT(point)) { td += 3; td2d += 3; tdm += 3;