From ac592b2a5455a56da973108914b06ffb08b2bcac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 22 Dec 2022 22:30:59 +0100 Subject: [PATCH] Close editor popups when opening file dialog As the popups would render above the file dialog, they should be closed before opening it. --- src/game/editor/editor.cpp | 1 + src/game/editor/editor.h | 1 + src/game/editor/popups.cpp | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index a84c4bbe7..b8205980f 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -4667,6 +4667,7 @@ void CEditor::InvokeFileDialog(int StorageType, int FileType, const char *pTitle const char *pBasePath, const char *pDefaultName, void (*pfnFunc)(const char *pFileName, int StorageType, void *pUser), void *pUser) { + UiClosePopupMenus(); m_FileDialogStorageType = StorageType; m_pFileDialogTitle = pTitle; m_pFileDialogButtonText = pButtonText; diff --git a/src/game/editor/editor.h b/src/game/editor/editor.h index 5a1a6a71d..47fc71c41 100644 --- a/src/game/editor/editor.h +++ b/src/game/editor/editor.h @@ -1096,6 +1096,7 @@ public: void UiInvokePopupMenu(void *pID, int Flags, float X, float Y, float W, float H, int (*pfnFunc)(CEditor *pEditor, CUIRect Rect, void *pContext), void *pContext = nullptr); void UiDoPopupMenu(); + void UiClosePopupMenus(); bool UiPopupExists(void *pID); bool UiPopupOpen(); diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index 4819c1caf..a935276e5 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -104,6 +104,14 @@ void CEditor::UiDoPopupMenu() } } +void CEditor::UiClosePopupMenus() +{ + m_LockMouse = false; + UI()->SetActiveItem(nullptr); + g_UiNumPopups = 0; + m_PopupEventWasActivated = false; +} + bool CEditor::UiPopupExists(void *pid) { for(int i = 0; i < g_UiNumPopups; i++)