Commit: c2d285f0ffc03a02ad6c48e30bb90063da19a976
Author: Dalai Felinto
Date:   Fri Jun 23 10:32:03 2017 +0200
Branches: master
https://developer.blender.org/rBc2d285f0ffc03a02ad6c48e30bb90063da19a976

Grease Pencil: Fix hardcoded DKEY for continous drawing

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c 
b/source/blender/editors/gpencil/gpencil_paint.c
index 5eacbf6f807..eb49060b629 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -162,6 +162,8 @@ typedef struct tGPsdata {
        bGPDbrush *brush; /* current drawing brush */
        short straight[2];   /* 1: line horizontal, 2: line vertical, other: 
not defined, second element position */
        int lock_axis;       /* lock drawing to one axis */
+
+       short keymodifier;   /* key used for invoking the operator */
 } tGPsdata;
 
 /* ------ */
@@ -1940,7 +1942,7 @@ static void gpencil_draw_cancel(bContext *C, wmOperator 
*op)
 /* ------------------------------- */
 
 
-static int gpencil_draw_init(bContext *C, wmOperator *op)
+static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event)
 {
        tGPsdata *p;
        eGPencil_PaintModes paintmode = RNA_enum_get(op->ptr, "mode");
@@ -1959,6 +1961,13 @@ static int gpencil_draw_init(bContext *C, wmOperator *op)
                gpencil_draw_exit(C, op);
                return 0;
        }
+
+       if (event != NULL) {
+               p->keymodifier = event->keymodifier;
+       }
+       else {
+               p->keymodifier = -1;
+       }
        
        /* everything is now setup ok */
        return 1;
@@ -2200,7 +2209,7 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op)
        /* printf("GPencil - Starting Re-Drawing\n"); */
        
        /* try to initialize context data needed while drawing */
-       if (!gpencil_draw_init(C, op)) {
+       if (!gpencil_draw_init(C, op, NULL)) {
                if (op->customdata) MEM_freeN(op->customdata);
                /* printf("\tGP - no valid data\n"); */
                return OPERATOR_CANCELLED;
@@ -2275,7 +2284,7 @@ static int gpencil_draw_invoke(bContext *C, wmOperator 
*op, const wmEvent *event
                printf("GPencil - Starting Drawing\n");
        
        /* try to initialize context data needed while drawing */
-       if (!gpencil_draw_init(C, op)) {
+       if (!gpencil_draw_init(C, op, event)) {
                if (op->customdata)
                        MEM_freeN(op->customdata);
                if (G.debug & G_DEBUG)
@@ -2438,7 +2447,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator 
*op, const wmEvent *event)
                         *   is essential for ensuring that they can quickly 
return to that view
                         */
                }
-               else if ((ELEM(event->type, DKEY)) && (event->val == 
KM_RELEASE)) {
+               else if ((ELEM(event->type, p->keymodifier)) && (event->val == 
KM_RELEASE)) {
                        /* enable continuous if release D key in mid drawing */
                        p->scene->toolsettings->gpencil_flags |= 
GP_TOOL_FLAG_PAINTSESSIONS_ON;
                }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to