From aa66fd30ec15a6fb85100aec688729fc422cbb11 Mon Sep 17 00:00:00 2001 From: ayuan9957 <107920784+ayuan9957@users.noreply.github.com> Date: Wed, 17 Jun 2026 16:26:51 +0800 Subject: [PATCH] fix(editor): guard global shortcuts during ui input --- .../Private/MetaCoreBuiltinEditorModule.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/MetaCoreEditor/Private/MetaCoreBuiltinEditorModule.cpp b/Source/MetaCoreEditor/Private/MetaCoreBuiltinEditorModule.cpp index fbc44e3..3155305 100644 --- a/Source/MetaCoreEditor/Private/MetaCoreBuiltinEditorModule.cpp +++ b/Source/MetaCoreEditor/Private/MetaCoreBuiltinEditorModule.cpp @@ -742,12 +742,20 @@ void MetaCoreReimportProjectAsset(MetaCoreEditorContext& editorContext, const Me } } -void MetaCoreHandleGlobalEditorShortcuts(MetaCoreEditorContext& editorContext) { +[[nodiscard]] bool MetaCoreCanHandleGlobalEditorShortcuts() { const ImGuiIO& io = ImGui::GetIO(); - if (io.WantTextInput) { + return !io.WantTextInput && + !io.WantCaptureKeyboard && + !ImGui::IsAnyItemActive() && + !ImGui::IsPopupOpen(nullptr, ImGuiPopupFlags_AnyPopup); +} + +void MetaCoreHandleGlobalEditorShortcuts(MetaCoreEditorContext& editorContext) { + if (!MetaCoreCanHandleGlobalEditorShortcuts()) { return; } + const ImGuiIO& io = ImGui::GetIO(); const bool ctrlDown = io.KeyCtrl; const bool shiftDown = io.KeyShift;