[Bf-blender-cvs] [e12b1c2a27f] greasepencil-object: GP Add Primitive Ops: Remove the "avoid fast double clicks" event hack

Joshua Leung noreply at git.blender.org
Tue Jan 30 07:05:36 CET 2018


Commit: e12b1c2a27f69603556f62d906804f06cd5593b6
Author: Joshua Leung
Date:   Tue Jan 30 16:08:39 2018 +1300
Branches: greasepencil-object
https://developer.blender.org/rBe12b1c2a27f69603556f62d906804f06cd5593b6

GP Add Primitive Ops: Remove the "avoid fast double clicks" event hack

This was making the operator unnecessarily clumsy to use, especially
for anyone used to the way that drawing tools everywhere else work.

Old workflow (with the hack):
1) Click Rectangle/Circle to start the operator
2) Click (Press & Release) in the 3D view to start drawing the shape
3) Click again (Press & Release) to stop drawing
(4) Click again, realising that you forgot to release the mouse in step 2
    (provided you realised why it "wasn't working")

New workflow (more in line with standard workflows):
1) Click Rectangle/Circle to start the operator
2) Press and drag in the 3D view to start drawing the shape
3) Release to stop drawing

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

M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/editors/include/ED_gpencil.h

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

diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index a3a321fa027..6fa75e462a2 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -432,7 +432,6 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op)
 
 	tgpi->tot_edges = RNA_int_get(op->ptr, "edges");
 	tgpi->flag = IDLE;
-	tgpi->oldevent = EVENT_NONE;
 
 	tgpi->lock_axis = ts->gp_sculpt.lock_axis;
 
@@ -506,14 +505,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e
 	const bool has_numinput = hasNumInput(&tgpi->num);
 	
 	switch (event->type) {
-		case LEFTMOUSE: 
-			/* avoid fast double clicks done accidentally by user */
-			if (tgpi->oldevent == event->type) {
-				tgpi->oldevent = EVENT_NONE;
-				break;
-			}
-			tgpi->oldevent = event->type;
-
+		case LEFTMOUSE:
 			if (tgpi->flag == IDLE) {
 				tgpi->top[0] = event->mval[0];
 				tgpi->top[1] = event->mval[1];
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 58a6d7f8682..e81e7ecacbe 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -147,7 +147,6 @@ typedef struct tGPDprimitive {
 	int top[2];                       /* first box corner */
 	int bottom[2];                    /* last box corner */
 	int flag;                         /* flag to determine operations in progress */
-	short oldevent;                   /* save old event to avoid accidental mouse clicks */
 	
 	int lock_axis;                    /* lock to viewport axis */



More information about the Bf-blender-cvs mailing list