Fix T99702: Gpencil Flip strokes did not support multiframe edit

This was a missing feature and this commit solves this.
This commit is contained in:
Antonio Vazquez 2022-07-14 16:33:21 +02:00 committed by Thomas Dinges
parent e1f1125909
commit afb82199a3
Notes: blender-bot 2023-02-14 00:20:15 +01:00
Referenced by issue #99702, Gpencil:In Edit Mode: Switch direction don't Consider Multiframe mode enabled
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
1 changed files with 30 additions and 21 deletions

View File

@ -3657,35 +3657,44 @@ static int gpencil_stroke_flip_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
bool changed = false;
/* read all selected strokes */
/* Read all selected strokes. */
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
bGPDframe *gpf = gpl->actframe;
if (gpf == NULL) {
continue;
}
bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
if (gps->flag & GP_STROKE_SELECT) {
/* skip strokes that are invalid for current view */
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
}
/* check if the color is editable */
if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) {
for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
if (gpf == NULL) {
continue;
}
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
if (gps->flag & GP_STROKE_SELECT) {
/* skip strokes that are invalid for current view */
if (ED_gpencil_stroke_can_use(C, gps) == false) {
continue;
}
/* check if the color is editable */
if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) {
continue;
}
if (is_curve_edit) {
BKE_report(op->reports, RPT_ERROR, "Not implemented!");
if (is_curve_edit) {
BKE_report(op->reports, RPT_ERROR, "Not implemented!");
}
else {
/* Flip stroke. */
BKE_gpencil_stroke_flip(gps);
changed = true;
}
}
}
else {
/* Flip stroke. */
BKE_gpencil_stroke_flip(gps);
}
changed = true;
}
/* If not multi-edit, exit loop. */
if (!is_multiedit) {
break;
}
}
}