From 67b40f829e29ce7006de30ebcc75cf8ef82da269 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 30 Mar 2021 19:43:45 +0200 Subject: [PATCH] Fix T87058: GPencil Cutter delete all strokes if they are selected and the layer is locked The problem was produced because the strokes were selected, but the loop to clear this flag before applying cutter was using unlocked layers only, and the protected layer flag was not reset. Now, the flag is reset for all layers, locked and unlocked. --- source/blender/editors/gpencil/gpencil_edit.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 4bbd475dd2c..99c9bfa3a56 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -4979,17 +4979,27 @@ static int gpencil_cutter_lasso_select(bContext *C, /* init space conversion stuff */ gpencil_point_conversion_init(C, &gsc); - /* deselect all strokes first */ - CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { - int i; - for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { - pt->flag &= ~GP_SPOINT_SELECT; - } + /* Deselect all strokes. */ + LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe; + for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { + if (gps->flag & GP_STROKE_SELECT) { + int i; + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { + pt->flag &= ~GP_SPOINT_SELECT; + } - gps->flag &= ~GP_STROKE_SELECT; - BKE_gpencil_stroke_select_index_reset(gps); + gps->flag &= ~GP_STROKE_SELECT; + BKE_gpencil_stroke_select_index_reset(gps); + } + } + /* if not multiedit, exit loop. */ + if (!is_multiedit) { + break; + } + } } - CTX_DATA_END; /* Select points */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {