diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2021-03-30 20:43:45 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2021-03-30 20:43:45 +0300 |
commit | 67b40f829e29ce7006de30ebcc75cf8ef82da269 (patch) | |
tree | 37e645d102e75faff52eac329c6cba244a493860 /source/blender | |
parent | 6ddd280b21025cdce981f64cabae35348804b95c (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 28 |
1 files 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) { |