Fix annotation tool getting "stuck" with IC-Keymap
The annotation tool only exited on LMB or RMB mouse buttons, now check for all mouse buttons with special behavior with RMB.
This commit is contained in:
@@ -2538,14 +2538,13 @@ static int annotation_draw_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
estate = OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* toggle painting mode upon mouse-button movement
|
||||
* - LEFTMOUSE = standard drawing (all) / straight line drawing (all) / polyline (toolbox
|
||||
* only)
|
||||
* - RIGHTMOUSE = polyline (hotkey) / eraser (all)
|
||||
* (Disabling RIGHTMOUSE case here results in bugs like #32647)
|
||||
* also making sure we have a valid event value, to not exit too early
|
||||
*/
|
||||
if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE) && ELEM(event->val, KM_PRESS, KM_RELEASE)) {
|
||||
/* Toggle painting mode upon mouse-button movement
|
||||
* - #RIGHTMOUSE: eraser (all).
|
||||
* (Disabling #RIGHTMOUSE case here results in bugs like #32647)
|
||||
* - Others (typically LMB): standard drawing (all) / straight line drawing (all).
|
||||
* Also making sure we have a valid event value, to not exit too early. */
|
||||
|
||||
if (ISMOUSE_BUTTON(event->type) && ELEM(event->val, KM_PRESS, KM_RELEASE)) {
|
||||
/* if painting, end stroke */
|
||||
if (p->status == GP_STATUS_PAINTING) {
|
||||
int sketch = 0;
|
||||
@@ -2634,7 +2633,7 @@ static int annotation_draw_modal(bContext *C, wmOperator *op, const wmEvent *eve
|
||||
/* turn on eraser */
|
||||
p->paintmode = GP_PAINTMODE_ERASER;
|
||||
}
|
||||
else if (event->type == LEFTMOUSE) {
|
||||
else { /* Any mouse button besides right. */
|
||||
/* restore drawmode to default */
|
||||
p->paintmode = eGPencil_PaintModes(RNA_enum_get(op->ptr, "mode"));
|
||||
}
|
||||
|
||||
@@ -3776,13 +3776,13 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
estate = OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* toggle painting mode upon mouse-button movement
|
||||
* - LEFTMOUSE = standard drawing (all) / straight line drawing (all)
|
||||
* - RIGHTMOUSE = eraser (all)
|
||||
* (Disabling RIGHTMOUSE case here results in bugs like #32647)
|
||||
* also making sure we have a valid event value, to not exit too early
|
||||
*/
|
||||
if (ELEM(event->type, LEFTMOUSE, RIGHTMOUSE) && ELEM(event->val, KM_PRESS, KM_RELEASE)) {
|
||||
/* Toggle painting mode upon mouse-button movement
|
||||
* - #RIGHTMOUSE: eraser (all).
|
||||
* (Disabling #RIGHTMOUSE case here results in bugs like #32647)
|
||||
* - Others (typically LMB): standard drawing (all) / straight line drawing (all).
|
||||
* Also making sure we have a valid event value, to not exit too early. */
|
||||
|
||||
if (ISMOUSE_BUTTON(event->type) && ELEM(event->val, KM_PRESS, KM_RELEASE)) {
|
||||
/* if painting, end stroke */
|
||||
if (p->status == GP_STATUS_PAINTING) {
|
||||
p->status = GP_STATUS_DONE;
|
||||
@@ -3831,7 +3831,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
/* turn on eraser */
|
||||
p->paintmode = GP_PAINTMODE_ERASER;
|
||||
}
|
||||
else if (event->type == LEFTMOUSE) {
|
||||
else { /* Any mouse button besides the right. */
|
||||
/* restore drawmode to default */
|
||||
p->paintmode = eGPencil_PaintModes(RNA_enum_get(op->ptr, "mode"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user