From 31c34acff0b91444100095d9c2980273a4abd437 Mon Sep 17 00:00:00 2001 From: Antonioya Date: Mon, 8 Aug 2016 11:21:44 +0200 Subject: 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. --- source/blender/editors/gpencil/gpencil_paint.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source') diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 4e521b5909c..3afdd5772fc 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -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; -- cgit v1.2.3