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.
This commit is contained in:
Antonio Vazquez 2021-03-30 19:43:45 +02:00
parent 6ddd280b21
commit 67b40f829e
Notes: blender-bot 2023-02-14 07:25:46 +01:00
Referenced by issue #87058, GPencil: Stroke Cutter delete all strokes if they are selected and the layer is locked
1 changed files with 19 additions and 9 deletions

View File

@ -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) {