diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-02-20 12:16:51 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-02-20 12:16:59 +0300 |
commit | 173b6b792cf95fb9eb20ec760b28469d46b0ff52 (patch) | |
tree | d1ae9e54c06d3972e7bba5fe2c667a35a51fbf29 /source/blender/editors | |
parent | 37e6a1995ac7eeabd5b6a56621ad5a850dae4149 (diff) |
Cleanup: Split grease pencil selection index functions
This makes the code more readable.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 16 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_merge.c | 4 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_primitive.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_select.c | 38 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 16 |
6 files changed, 40 insertions, 40 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 0597de445f4..c76c2e55d2b 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -3418,11 +3418,11 @@ static int gpencil_material_select_exec(bContext *C, wmOperator *op) if (!deselected) { gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); } else { gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { if (!deselected) { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index aec593b97ea..b03d2c6e795 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -992,7 +992,7 @@ static int gpencil_duplicate_exec(bContext *C, wmOperator *op) pt->flag &= ~GP_SPOINT_SELECT; } gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); changed = true; } @@ -1194,7 +1194,7 @@ static void gpencil_add_move_points(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gp /* if the stroke is not reused, deselect */ if (!do_stroke) { gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } } @@ -1711,7 +1711,7 @@ static int gpencil_strokes_paste_exec(bContext *C, wmOperator *op) } gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } CTX_DATA_END; @@ -2551,7 +2551,7 @@ static bool gpencil_dissolve_selected_stroke_points(bContext *C, /* deselect the stroke, since none of its selected points will still be selected */ gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { pt->flag &= ~GP_SPOINT_SELECT; } @@ -2624,7 +2624,7 @@ static int gpencil_delete_selected_points(bContext *C) if (gps->flag & GP_STROKE_SELECT) { /* deselect old stroke, since it will be used as template for the new strokes */ gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); if (is_curve_edit) { bGPDcurve *gpc = gps->editcurve; @@ -4579,7 +4579,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) else if (mode == GP_SEPARATE_STROKE) { /* deselect old stroke */ gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); /* unlink from source frame */ BLI_remlink(&gpf->strokes, gps); gps->prev = gps->next = NULL; @@ -4988,7 +4988,7 @@ static int gpencil_cutter_lasso_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; @@ -5029,7 +5029,7 @@ static int gpencil_cutter_lasso_select(bContext *C, changed = true; pt->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); float r_hita[3], r_hitb[3]; if (gps->totpoints > 1) { ED_gpencil_select_stroke_segment( diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c index 8d8734dfd1f..259b2882589 100644 --- a/source/blender/editors/gpencil/gpencil_merge.c +++ b/source/blender/editors/gpencil/gpencil_merge.c @@ -134,7 +134,7 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpo /* stroke */ bGPDstroke *gps = BKE_gpencil_stroke_new(MAX2(ob->actcol - 1, 0), totpoints, brush->size); gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); if (cyclic) { gps->flag |= GP_STROKE_CYCLIC; @@ -243,7 +243,7 @@ static void gpencil_calc_points_factor(bContext *C, } } gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } } } diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 4eec4c7d00e..12d399f32ca 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -338,7 +338,7 @@ static void gpencil_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) ED_gpencil_fill_vertex_color_set(ts, brush, gps); gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); /* the polygon must be closed, so enabled cyclic */ if (ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) { gps->flag |= GP_STROKE_CYCLIC; 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) { diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index f9242c5a1a8..5c041134a74 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1167,7 +1167,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, if (keep_original) { gps_active = BKE_gpencil_stroke_duplicate(gps, true, true); gps_active->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps_active, true); + BKE_gpencil_stroke_select_index_reset(gps_active); for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) { pt->flag &= ~GP_SPOINT_SELECT; } @@ -1692,7 +1692,7 @@ void ED_gpencil_vgroup_select(bContext *C, Object *ob) } if (gps->flag & GP_STROKE_SELECT) { - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); } } } @@ -2616,7 +2616,7 @@ void ED_gpencil_select_toggle_all(bContext *C, int action) } gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } } } @@ -2654,11 +2654,11 @@ void ED_gpencil_select_toggle_all(bContext *C, int action) /* Change status of stroke */ if (selected) { gps->flag |= GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(gpd, gps, false); + BKE_gpencil_stroke_select_index_set(gpd, gps); } else { gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_set(NULL, gps, true); + BKE_gpencil_stroke_select_index_reset(gps); } } CTX_DATA_END; @@ -2695,7 +2695,7 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action) } 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); } GP_EDITABLE_CURVES_END(gps_iter); } @@ -2737,12 +2737,12 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action) if (selected) { 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); } } GP_EDITABLE_STROKES_END(gps_iter); |