Clarify ImGui activation in Editor viewport (#1765)

* Clarify ImGui activation in Editor viewport

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* All working following changes from comments in PR

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* One more change

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* fixes from comments in PR.

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fixed git merge error

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Added header to ImGuiBus.h

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Fix for Jenkins error

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>

* Minor typo fix

Signed-off-by: John Jones-Steele <jjjoness@amazon.com>
This commit is contained in:
jjjoness
2021-07-09 18:03:20 +01:00
committed by GitHub
parent 76cef6e91f
commit 1b530195fc
17 changed files with 201 additions and 18 deletions
+13
View File
@@ -41,6 +41,7 @@ AZ_POP_DISABLE_WARNING
// AzToolsFramework
#include <AzToolsFramework/Application/Ticker.h>
#include <AzToolsFramework/API/EditorWindowRequestBus.h>
#include <AzToolsFramework/API/EditorAnimationSystemRequestBus.h>
#include <AzToolsFramework/SourceControl/QtSourceControlNotificationHandler.h>
#include <AzToolsFramework/PythonTerminal/ScriptTermDialog.h>
@@ -93,6 +94,8 @@ AZ_POP_DISABLE_WARNING
#include "AssetEditor/AssetEditorWindow.h"
#include "ActionManager.h"
#include <ImGuiBus.h>
using namespace AZ;
using namespace AzQtComponents;
using namespace AzToolsFramework;
@@ -489,6 +492,16 @@ void MainWindow::Initialize()
ActionOverrideRequestBus::Event(
GetEntityContextId(), &ActionOverrideRequests::SetupActionOverrideHandler, this);
if (auto imGuiManager = AZ::Interface<ImGui::IImGuiManager>::Get())
{
auto handleImGuiStateChangeFn = [](bool enabled)
{
EditorWindowUIRequestBus::Broadcast(&EditorWindowUIRequests::SetEditorUiEnabled, enabled);
};
m_handleImGuiStateChangeHandler = ImGui::IImGuiManager::ImGuiSetEnabledEvent::Handler(handleImGuiStateChangeFn);
imGuiManager->ConnectImGuiSetEnabledChangedHandler(m_handleImGuiStateChangeHandler);
}
AzToolsFramework::EditorEventsBus::Broadcast(&AzToolsFramework::EditorEvents::NotifyMainWindowInitialized, this);
}