Fix getting stuck in game mode with some UI Assets (#2207)

- LyShine assets with "consume all input" could accidentally eat the escape event that exited game mode
- The main window has a shortcut for exiting game mode, but this wasn't being triggered in this context, so we go ahead and catch the Escape key event ASAP in EditorViewportWidget to ensure the game mode exit fires

Signed-off-by: nvsickle <nvsickle@amazon.com>
monroegm-disable-blank-issue-2
Nicholas Van Sickle 4 years ago committed by GitHub
parent b740329c1e
commit d086e45d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -403,6 +403,19 @@ bool EditorViewportWidget::event(QEvent* event)
m_keyDown.clear();
break;
case QEvent::ShortcutOverride:
{
// Ensure we exit game mode on escape, even if something else would eat our escape key event.
if (static_cast<QKeyEvent*>(event)->key() == Qt::Key_Escape && GetIEditor()->IsInGameMode())
{
GetIEditor()->SetInGameMode(false);
event->accept();
return true;
}
break;
}
case QEvent::Shortcut:
// a shortcut should immediately clear us, otherwise the release event never gets sent
m_keyDown.clear();

Loading…
Cancel
Save