GPencil: Move polygon to back only if something was drawn

If the user enable polygon draw and press ESC before drawing something,
the last stroke must not be moved back.
This commit is contained in:
Antonio Vazquez 2016-08-08 11:21:44 +02:00
parent 5c815a6d78
commit 31c34acff0
1 changed files with 9 additions and 3 deletions

View File

@ -2367,7 +2367,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* printf("\t\tGP - end of paint op + end of stroke\n"); */
/* if drawing polygon and enable on back, must move stroke */
if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
gpencil_move_polygon_stroke_to_back(C);
if (p->flags & GP_PAINTFLAG_STROKEADDED) {
gpencil_move_polygon_stroke_to_back(C);
}
}
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
@ -2427,7 +2429,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
/* printf("\t\tGP - end of stroke + op\n"); */
/* if drawing polygon and enable on back, must move stroke */
if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
gpencil_move_polygon_stroke_to_back(C);
if (p->flags & GP_PAINTFLAG_STROKEADDED) {
gpencil_move_polygon_stroke_to_back(C);
}
}
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;
@ -2511,7 +2515,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
*/
/* if drawing polygon and enable on back, must move stroke */
if ((p->scene->toolsettings->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) && (p->paintmode == GP_PAINTMODE_DRAW_POLY)) {
gpencil_move_polygon_stroke_to_back(C);
if (p->flags & GP_PAINTFLAG_STROKEADDED) {
gpencil_move_polygon_stroke_to_back(C);
}
}
p->status = GP_STATUS_DONE;
estate = OPERATOR_FINISHED;