Page MenuHome

Using "E" Key Modifier Hotkey for "gpencil.draw" only draws for a second
Closed, ResolvedPublic

Description

System Information
Operating system: Windows-10-10.0.19041-SP0 64 Bits
Graphics card: GeForce RTX 3090/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.72

Blender Version
Broken: version: 2.93.0 Alpha, branch: master, commit date: 2021-03-18 21:29, hash: rB36deb8a48ef2
Also broken in 2.92 and 2.90

Short description of error
Setting the hotkey for "gpencil.draw" to "E Left Mouse," with "E" as a modifier results in the stroke/eraser to only draw for a second and then stop drawing. Using any other letter modifier like "R Left Mouse" or "P Left Mouse" etc. works as intended. Tried deleting all "E" hotkeys and "Left Mouse" hotkeys to see if there was hotkey interference, but the problem persists.

Exact steps for others to reproduce the error
New file "2D Animation"
Draw some strokes
Open Preferences, go to keymap Grease Pencil Stroke Paint (Draw brush)
Set Grease Pencil Draw key modifier to "E"
Set mode to "Eraser"
Hold "E", try erasing
Switch key modifier to any other letter key like "R"
Try erasing, should work as intended

Event Timeline

This most likely happens because E will actually cancel the drawing operator.

/* Exit painting mode (and/or end current stroke).
 *
 */
if (ELEM(event->type, EVT_RETKEY, EVT_PADENTER, EVT_ESCKEY, EVT_SPACEKEY, EVT_EKEY)) { //<--- EVT_EKEY causes this issue

  p->status = GP_STATUS_DONE;
  estate = OPERATOR_FINISHED;
}

@Antonio Vazquez (antoniov) Do you know why the E key is in there?

Falk David (filedescriptor) changed the task status from Needs Triage to Confirmed.Mar 29 2021, 10:25 AM

Can confirm on the latest master.

@Antonio Vazquez (antoniov) Do you know why the E key is in there?

IIRC E key was used in the first Grease Pencil version to cancel actions, It seems legacy from that version that we forgot to remove, but @Antonio Vazquez (antoniov) sure know better

@Matias Mendiola (mendio) Thanks for the info! I guess if this was from the legacy grease pencil code it could be safe to remove. Waiting for @Antonio Vazquez (antoniov) to confirm and then I can submit a patch.

Just tested removing the EVT_EKEY from the keys that exit the operator and that fixes the issue. So just to confirm that this is the problem.