diff options
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_data.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index e272f46d13d..685cd54fc1b 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -1552,7 +1552,6 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op) ListBase selected = {NULL}; bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe; - bGPDstroke *gps = NULL; for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { @@ -1560,13 +1559,12 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op) continue; } /* verify if any selected stroke is in the extreme of the stack and select to move */ - for (gps = gpf->strokes.first; gps; gps = gps->next) { + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { + bool is_stroke_selected = GPENCIL_STROKE_TYPE_BEZIER(gps) ? + (bool)(gps->editcurve->flag & GP_CURVE_SELECT) : + (bool)(gps->flag & GP_STROKE_SELECT); /* only if selected */ - if (gps->flag & GP_STROKE_SELECT) { - /* skip strokes that are invalid for current view */ - if (ED_gpencil_stroke_can_use(C, gps) == false) { - continue; - } + if (is_stroke_selected) { /* check if the color is editable */ if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) { continue; @@ -1597,6 +1595,7 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op) int prev_index = target_index; /* Now do the movement of the stroke */ switch (direction) { + bGPDstroke *gps = NULL; /* Bring to Front */ case GP_STROKE_MOVE_TOP: LISTBASE_FOREACH (LinkData *, link, &selected) { @@ -1755,21 +1754,26 @@ static int gpencil_stroke_change_color_exec(bContext *C, wmOperator *op) LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { /* only if selected */ - 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; - } - - /* assign new color */ - gps->mat_nr = idx; + bool is_stroke_selected = GPENCIL_STROKE_TYPE_BEZIER(gps) ? + (bool)(gps->editcurve->flag & GP_CURVE_SELECT) : + (bool)(gps->flag & GP_STROKE_SELECT); + if (!is_stroke_selected) { + continue; + } - changed = true; + /* 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; + } + + /* assign new color */ + gps->mat_nr = idx; + + changed = true; } } /* If not multi-edit, exit loop. */ |