From 692c993bdb900e756cc382a37b945aa943cc5932 Mon Sep 17 00:00:00 2001 From: mgwynn Date: Fri, 25 Jun 2021 15:34:32 -0400 Subject: [PATCH] Incorporating review comments. Adding nativeUI setting for launchers. --- .../AzCore/AzCore/NativeUI/NativeUIRequests.h | 8 ++++---- .../AzCore/NativeUI/NativeUISystemComponent.cpp | 6 +++--- .../NativeUI/NativeUISystemComponent_Windows.cpp | 2 +- Code/LauncherUnified/Launcher.cpp | 13 +++++++++++++ Code/Sandbox/Editor/CryEdit.cpp | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h b/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h index c94ff0456c..e8cfb8d5fe 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUIRequests.h @@ -27,8 +27,8 @@ namespace AZ::NativeUI enum class Mode { - CONSOLE = 0, - UI, + DISABLED = 0, + ENABLED, }; class NativeUIRequests @@ -77,8 +77,8 @@ namespace AZ::NativeUI m_mode = mode; } - protected: - NativeUI::Mode m_mode = NativeUI::Mode::CONSOLE; + protected: + NativeUI::Mode m_mode = NativeUI::Mode::DISABLED; }; class NativeUIEBusTraits diff --git a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp index 86808cc32a..80559b1270 100644 --- a/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp +++ b/Code/Framework/AzCore/AzCore/NativeUI/NativeUISystemComponent.cpp @@ -29,7 +29,7 @@ namespace AZ::NativeUI AssertAction NativeUISystem::DisplayAssertDialog(const AZStd::string& message) const { - if (m_mode == NativeUI::Mode::CONSOLE) + if (m_mode == NativeUI::Mode::DISABLED) { return AssertAction::NONE; } @@ -56,7 +56,7 @@ namespace AZ::NativeUI AZStd::string NativeUISystem::DisplayOkDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const { - if (m_mode == NativeUI::Mode::CONSOLE) + if (m_mode == NativeUI::Mode::DISABLED) { return {}; } @@ -73,7 +73,7 @@ namespace AZ::NativeUI AZStd::string NativeUISystem::DisplayYesNoDialog(const AZStd::string& title, const AZStd::string& message, bool showCancel) const { - if (m_mode == NativeUI::Mode::CONSOLE) + if (m_mode == NativeUI::Mode::DISABLED) { return {}; } diff --git a/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp b/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp index eaf651d2dd..33ca9cdaf0 100644 --- a/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp +++ b/Code/Framework/AzCore/Platform/Windows/AzCore/NativeUI/NativeUISystemComponent_Windows.cpp @@ -247,7 +247,7 @@ namespace AZ { AZStd::string NativeUISystem::DisplayBlockingDialog(const AZStd::string& title, const AZStd::string& message, const AZStd::vector& options) const { - if (m_mode == NativeUI::Mode::CONSOLE) + if (m_mode == NativeUI::Mode::DISABLED) { return {}; } diff --git a/Code/LauncherUnified/Launcher.cpp b/Code/LauncherUnified/Launcher.cpp index c73cdd1981..6bd5dc625c 100644 --- a/Code/LauncherUnified/Launcher.cpp +++ b/Code/LauncherUnified/Launcher.cpp @@ -573,6 +573,14 @@ namespace O3DELauncher AZ_Assert(AZ::AllocatorInstance::IsReady(), "System allocator was not created or creation failed."); //Initialize the Debug trace instance to create necessary environment variables AZ::Debug::Trace::Instance().Init(); + + if (!IsDedicatedServer() && !systemInitParams.bToolMode && !systemInitParams.bTestMode) + { + if (auto nativeUI = AZ::Interface::Get(); nativeUI != nullptr) + { + nativeUI->SetMode(AZ::NativeUI::Mode::ENABLED); + } + } } if (mainInfo.m_onPostAppStart) @@ -647,6 +655,11 @@ namespace O3DELauncher ReturnCode status = ReturnCode::Success; + if (auto nativeUI = AZ::Interface::Get(); nativeUI != nullptr) + { + nativeUI->DisplayOkDialog("Test", "Test", false); + } + if (systemInitParams.pSystem) { // Process queued events before main loop. diff --git a/Code/Sandbox/Editor/CryEdit.cpp b/Code/Sandbox/Editor/CryEdit.cpp index dfccd87ff4..1c7df75a6a 100644 --- a/Code/Sandbox/Editor/CryEdit.cpp +++ b/Code/Sandbox/Editor/CryEdit.cpp @@ -4368,7 +4368,7 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[]) { if (auto nativeUI = AZ::Interface::Get(); nativeUI != nullptr) { - nativeUI->SetMode(AZ::NativeUI::Mode::UI); + nativeUI->SetMode(AZ::NativeUI::Mode::ENABLED); } } }