From 173b6b792cf95fb9eb20ec760b28469d46b0ff52 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Sat, 20 Feb 2021 10:16:51 +0100 Subject: Cleanup: Split grease pencil selection index functions This makes the code more readable. --- source/blender/editors/gpencil/gpencil_select.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'source/blender/editors/gpencil/gpencil_select.c') diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index fd5c5bb5346..e01c1ec54d7 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -174,7 +174,7 @@ static void deselect_all_selected(bContext *C) /* deselect stroke itself too */ gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } /* deselect curve and curve points */ @@ -211,12 +211,12 @@ static void select_all_curve_points(bGPdata *gpd, bGPDstroke *gps, bGPDcurve *gp if (deselect == false) { gpc->flag |= GP_CURVE_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); } else { gpc->flag &= ~GP_CURVE_SELECT; gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } } @@ -570,7 +570,7 @@ static bool gpencil_select_same_layer(bContext *C) } gpc->flag |= GP_CURVE_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); changed = true; } @@ -587,7 +587,7 @@ static bool gpencil_select_same_layer(bContext *C) } gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); changed = true; } @@ -632,7 +632,7 @@ static bool gpencil_select_same_material(bContext *C) } gpc->flag |= GP_CURVE_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); changed = true; } @@ -651,7 +651,7 @@ static bool gpencil_select_same_material(bContext *C) } gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); changed = true; } @@ -768,7 +768,7 @@ static int gpencil_select_first_exec(bContext *C, wmOperator *op) BEZT_SEL_ALL(&gpc->curve_points[0].bezt); gpc->flag |= GP_CURVE_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); if ((extend == false) && (gps->totpoints > 1)) { for (int i = 1; i < gpc->tot_curve_points; i++) { @@ -783,7 +783,7 @@ static int gpencil_select_first_exec(bContext *C, wmOperator *op) else { gps->points->flag |= GP_SPOINT_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); /* deselect rest? */ if ((extend == false) && (gps->totpoints > 1)) { @@ -878,7 +878,7 @@ static int gpencil_select_last_exec(bContext *C, wmOperator *op) BEZT_SEL_ALL(&gpc->curve_points[gpc->tot_curve_points - 1].bezt); gpc->flag |= GP_CURVE_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); if ((extend == false) && (gps->totpoints > 1)) { for (int i = 0; i < gpc->tot_curve_points - 1; i++) { bGPDcurve_point *gpc_pt = &gpc->curve_points[i]; @@ -892,7 +892,7 @@ static int gpencil_select_last_exec(bContext *C, wmOperator *op) else { gps->points[gps->totpoints - 1].flag |= GP_SPOINT_SELECT; gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); /* deselect rest? */ if ((extend == false) && (gps->totpoints > 1)) { @@ -1289,12 +1289,12 @@ static bool gpencil_stroke_do_circle_sel(bGPdata *gpd, if (select) { pt_active->flag |= GP_SPOINT_SELECT; gps_active->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps_active, false); + BKE_gpencil_stroke_select_index_set(gpd, gps_active); } else { pt_active->flag &= ~GP_SPOINT_SELECT; gps_active->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps_active, true); + BKE_gpencil_stroke_select_index_reset(gps_active); } changed = true; /* if stroke mode, don't check more points */ @@ -1832,7 +1832,7 @@ static bool gpencil_generic_stroke_select(bContext *C, } gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } CTX_DATA_END; @@ -2358,11 +2358,11 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) /* stroke too... */ if (deselect == false) { hit_stroke->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, hit_stroke, false); + BKE_gpencil_stroke_select_index_set(gpd, hit_stroke); } else { hit_stroke->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, hit_stroke, true); + BKE_gpencil_stroke_select_index_reset(hit_stroke); } } } @@ -2374,13 +2374,13 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) BEZT_SEL_IDX(&hit_curve_point->bezt, hit_curve_handle); hit_curve->flag |= GP_CURVE_SELECT; hit_stroke->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, hit_stroke, false); + BKE_gpencil_stroke_select_index_set(gpd, hit_stroke); } else { /* we're adding selection, so selection must be true */ hit_point->flag |= GP_SPOINT_SELECT; hit_stroke->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, hit_stroke, false); + BKE_gpencil_stroke_select_index_set(gpd, hit_stroke); /* expand selection to segment */ int selectmode; @@ -2602,7 +2602,7 @@ static int gpencil_select_vertex_color_exec(bContext *C, wmOperator *op) if (gps_selected) { gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); /* Extend stroke selection. */ if (selectmode == GP_SELECTMODE_STROKE) { -- cgit v1.2.3