[Bf-blender-cvs] [649001e4390] master: Fix T62506: Erasing blank annotation layer activates Move operator

Antonioya noreply at git.blender.org
Tue Mar 12 19:36:28 CET 2019


Commit: 649001e43905c1cc6e466592fb988a5f4388d5fb
Author: Antonioya
Date:   Tue Mar 12 19:36:12 2019 +0100
Branches: master
https://developer.blender.org/rB649001e43905c1cc6e466592fb988a5f4388d5fb

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.

===================================================================

M	source/blender/editors/gpencil/annotate_paint.c

===================================================================

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? */



More information about the Bf-blender-cvs mailing list