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>
This commit is contained in:
Nicholas Van Sickle
2021-07-21 09:52:49 -07:00
committed by GitHub
parent b740329c1e
commit d086e45d22
+13
View File
@@ -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();