Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/gpencil/annotate_paint.c')
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 1bc860d4785..70fa000c929 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -84,7 +84,8 @@ typedef enum eGPencil_PaintStatus {
GP_STATUS_IDLING = 0, /* stroke isn't in progress yet */
GP_STATUS_PAINTING, /* a stroke is in progress */
GP_STATUS_ERROR, /* something wasn't correctly set up */
- GP_STATUS_DONE /* painting done */
+ GP_STATUS_DONE, /* painting done */
+ GP_STATUS_CAPTURE /* capture event, but cancel */
} eGPencil_PaintStatus;
/* Return flags for adding points to stroke buffer */
@@ -1329,7 +1330,7 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps
}
if (has_layer_to_erase == false) {
- p->status = GP_STATUS_ERROR;
+ p->status = GP_STATUS_CAPTURE;
//if (G.debug & G_DEBUG)
printf("Error: Eraser will not be affecting anything (gpencil_paint_init)\n");
return;
@@ -2014,6 +2015,14 @@ static int gpencil_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event
else
p = op->customdata;
+ /* if empty erase capture and finish */
+ if (p->status == GP_STATUS_CAPTURE) {
+ gpencil_draw_exit(C, op);
+
+ BKE_report(op->reports, RPT_ERROR, "Nothing to erase");
+ return OPERATOR_FINISHED;
+ }
+
/* TODO: set any additional settings that we can take from the events?
* TODO? if tablet is erasing, force eraser to be on? */