diff options
author | Antonioya <blendergit@gmail.com> | 2019-03-12 21:36:12 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-03-12 21:36:24 +0300 |
commit | 649001e43905c1cc6e466592fb988a5f4388d5fb (patch) | |
tree | 88af09b7d317a6da215267fc8dcaf59bd4712a02 /source/blender/editors/gpencil/annotate_paint.c | |
parent | cae89a6889e0fc03130a56b6bf84e257eaff0fec (diff) |
Fix T62506: Erasing blank annotation layer activates Move operator
If you try to erase empty annotations, the operator is canceled.
The message is necessary to avoid the keymap is captured by the next keymap in the stack.
Diffstat (limited to 'source/blender/editors/gpencil/annotate_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 13 |
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? */ |