Grease Pencil: Fix hardcoded DKEY for continous drawing
This commit is contained in:
parent
bddb4de47c
commit
c2d285f0ff
Notes:
blender-bot
2023-02-14 10:37:50 +01:00
Referenced by issue #51889, Broken UI after creating new file in 2.79 test and daily builds
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue