ソースを参照

Clarify ImGui activation in Editor viewport (#1765)

* Clarify ImGui activation in Editor viewport

Signed-off-by: John Jones-Steele <[email protected]>

* All working following changes from comments in PR

Signed-off-by: John Jones-Steele <[email protected]>

* One more change

Signed-off-by: John Jones-Steele <[email protected]>

* fixes from comments in PR.

Signed-off-by: John Jones-Steele <[email protected]>

* Fixed git merge error

Signed-off-by: John Jones-Steele <[email protected]>

* Added header to ImGuiBus.h

Signed-off-by: John Jones-Steele <[email protected]>

* Fix for Jenkins error

Signed-off-by: John Jones-Steele <[email protected]>

* Minor typo fix

Signed-off-by: John Jones-Steele <[email protected]>
jjjoness 4 年 前
コミット
1b530195fc

+ 13 - 0
Code/Editor/MainWindow.cpp

@@ -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);
 }
 

+ 1 - 0
Code/Editor/MainWindow.h

@@ -249,6 +249,7 @@ private:
 
     QPointer<ToolbarCustomizationDialog> m_toolbarCustomizationDialog;
     QScopedPointer<AzToolsFramework::QtSourceControlNotificationHandler> m_sourceControlNotifHandler;
+    AZ::Event<bool>::Handler m_handleImGuiStateChangeHandler;
     AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 
     static MainWindow* m_instance;

+ 15 - 4
Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp

@@ -269,10 +269,12 @@ OutlinerWidget::OutlinerWidget(QWidget* pParent, Qt::WindowFlags flags)
     AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusConnect(
             AzToolsFramework::GetEntityContextId());
     AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusConnect();
+    AzToolsFramework::EditorWindowUIRequestBus::Handler::BusConnect();
 }
 
 OutlinerWidget::~OutlinerWidget()
 {
+    AzToolsFramework::EditorWindowUIRequestBus::Handler::BusDisconnect();
     AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
     AzToolsFramework::EditorEntityInfoNotificationBus::Handler::BusDisconnect();
     AzToolsFramework::EditorPickModeNotificationBus::Handler::BusDisconnect();
@@ -1321,16 +1323,25 @@ static void SetEntityOutlinerState(Ui::OutlinerWidgetUI* entityOutlinerUi, const
     AzQtComponents::SetWidgetInteractEnabled(entityOutlinerUi->m_searchWidget, on);
 }
 
+void OutlinerWidget::EnableUi(bool enable)
+{
+    SetEntityOutlinerState(m_gui, enable);
+    setEnabled(enable);
+}
+
+void OutlinerWidget::SetEditorUiEnabled(bool enable)
+{
+    EnableUi(enable);
+}
+
 void OutlinerWidget::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
 {
-    SetEntityOutlinerState(m_gui, false);
-    setEnabled(false);
+    EnableUi(false);
 }
 
 void OutlinerWidget::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
 {
-    setEnabled(true);
-    SetEntityOutlinerState(m_gui, true);
+    EnableUi(true);
 }
 
 void OutlinerWidget::OnSliceInstantiated(const AZ::Data::AssetId& /*sliceAssetId*/, AZ::SliceComponent::SliceInstanceAddress& sliceAddress, const AzFramework::SliceInstantiationTicket& /*ticket*/)

+ 6 - 0
Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.hxx

@@ -13,6 +13,7 @@
 
 #include <AzCore/Memory/SystemAllocator.h>
 #include <AzCore/base.h>
+#include <AzToolsFramework/API/EditorWindowRequestBus.h>
 #include <AzToolsFramework/API/ToolsApplicationAPI.h>
 #include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
 #include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
@@ -57,6 +58,7 @@ class OutlinerWidget
     , private AzToolsFramework::SliceEditorEntityOwnershipServiceNotificationBus::Handler
     , private AzToolsFramework::EditorEntityInfoNotificationBus::Handler
     , private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
+    , private AzToolsFramework::EditorWindowUIRequestBus::Handler
 {
     Q_OBJECT;
 public:
@@ -106,6 +108,9 @@ private:
     void EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
     void LeftComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes) override;
 
+    // EditorWindowUIRequestBus overrides
+    void SetEditorUiEnabled(bool enable) override;
+
     // Build a selection object from the given entities. Entities already in the Widget's selection buffers are ignored.
     template <class EntityIdCollection>
     QItemSelection BuildSelectionFromEntities(const EntityIdCollection& entityIds);
@@ -171,6 +176,7 @@ private:
     AZ::EntityId GetEntityIdFromIndex(const QModelIndex& index) const;
     QModelIndex GetIndexFromEntityId(const AZ::EntityId& entityId) const;
     void ExtractEntityIdsFromSelection(const QItemSelection& selection, AzToolsFramework::EntityIdList& entityIdList) const;
+    void EnableUi(bool enable);
 
     // AzToolsFramework::OutlinerModelNotificationBus::Handler
     // Receive notification from the outliner model that we should scroll

+ 14 - 0
Code/Editor/QtViewPaneManager.cpp

@@ -525,6 +525,7 @@ QtViewPaneManager::QtViewPaneManager(QObject* parent)
 
     // view pane manager is interested when we enter/exit ComponentMode
     m_componentModeNotifications.BusConnect(AzToolsFramework::GetEntityContextId());
+    m_windowRequest.BusConnect();
 
     m_componentModeNotifications.SetEnteredComponentModeFunc(
         [this](const AZStd::vector<AZ::Uuid>& /*componentModeTypes*/)
@@ -545,10 +546,23 @@ QtViewPaneManager::QtViewPaneManager(QObject* parent)
             AzQtComponents::SetWidgetInteractEnabled(widget, on);
         });
     });
+
+    m_windowRequest.SetEnableEditorUiFunc(
+        [this](bool enable)
+        {
+            // gray out panels when entering ImGui mode
+            SetDefaultActionsEnabled(
+                enable, m_registeredPanes,
+                [](QWidget* widget, bool on)
+                {
+                    AzQtComponents::SetWidgetInteractEnabled(widget, on);
+                });
+        });
 }
 
 QtViewPaneManager::~QtViewPaneManager()
 {
+    m_windowRequest.BusDisconnect();
     m_componentModeNotifications.BusDisconnect();
 }
 

+ 7 - 2
Code/Editor/QtViewPaneManager.h

@@ -21,6 +21,7 @@
 #include <AzQtComponents/Components/StyledDockWidget.h>
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
 #include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
+#include <AzToolsFramework/API/EditorWindowRequestBus.h>
 
 #include <QObject>
 #include <QVector>
@@ -249,8 +250,12 @@ private:
     QPointer<AzQtComponents::FancyDocking> m_advancedDockManager;
 
     using EditorComponentModeNotificationBusImpl = AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBusImpl;
-    EditorComponentModeNotificationBusImpl m_componentModeNotifications; /**< Helper for EditorComponentModeNotificationBus so 
-                                                                           *  QtViewPaneManager does not need to inherit directly from it. */
+    EditorComponentModeNotificationBusImpl m_componentModeNotifications; //!< Helper for EditorComponentModeNotificationBus so
+                                                                         //!< QtViewPaneManager does not need to inherit directly from it. */
+
+    using EditorWindowRequestBusImpl = AzToolsFramework::EditorWindowRequestBusImpl;
+    EditorWindowRequestBusImpl m_windowRequest;                         //!< Helper for EditorWindowRequestBus so
+                                                                        //!< QtViewPaneManager does not need to inherit directly from it. */
     AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
 };
 

+ 40 - 1
Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorWindowRequestBus.h

@@ -36,8 +36,47 @@ namespace AzToolsFramework
         /// Retrieve the main application window.
         virtual QWidget* GetAppMainWindow() { return nullptr; }
     };
-
     using EditorWindowRequestBus = AZ::EBus<EditorWindowRequests>;
+
+    class EditorWindowUIRequests : public AZ::EBusTraits
+    {
+    public:
+        using Bus = AZ::EBus<EditorWindowUIRequests>;
+
+        //////////////////////////////////////////////////////////////////////////
+        // EBusTraits overrides
+        static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
+        //////////////////////////////////////////////////////////////////////////
+
+        /// Enable/Disable the Editor UI.
+        virtual void SetEditorUiEnabled([[maybe_unused]] bool enable) {}
+    };
+    using EditorWindowUIRequestBus = AZ::EBus<EditorWindowUIRequests>;
+
+    using EnableUiFunction = AZStd::function<void(bool)>;
+
+    /// Helper for EditorWindowRequests to be used as a 
+    /// member instead of inheriting from EBus directly.
+    class EditorWindowRequestBusImpl
+        : public EditorWindowUIRequestBus::Handler
+    {
+    public:
+        /// Set the function to be called when entering ImGui Mode.
+        void SetEnableEditorUiFunc(const EnableUiFunction enableEditorUiFunc)
+        {
+            m_enableEditorUiFunc = AZStd::move(enableEditorUiFunc);
+        }
+
+        private:
+        // EditorWindowRequestBus
+        void SetEditorUiEnabled( [[maybe_unused]] bool enable) override
+        {
+            m_enableEditorUiFunc(enable);
+        }
+
+        EnableUiFunction m_enableEditorUiFunc; ///< Function to call when entering ImGui Mode.
+    };
+
 } // namespace AzToolsFramework
 
 #endif // AZTOOLSFRAMEWORK_EDITORWINDOWREQUESTBUS_H

+ 15 - 4
Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp

@@ -291,10 +291,12 @@ namespace AzToolsFramework
             GetEntityContextId());
         EditorEntityInfoNotificationBus::Handler::BusConnect();
         Prefab::PrefabPublicNotificationBus::Handler::BusConnect();
+        EditorWindowUIRequestBus::Handler::BusConnect();
     }
 
     EntityOutlinerWidget::~EntityOutlinerWidget()
     {
+        EditorWindowUIRequestBus::Handler::BusDisconnect();
         Prefab::PrefabPublicNotificationBus::Handler::BusDisconnect();
         ComponentModeFramework::EditorComponentModeNotificationBus::Handler::BusDisconnect();
         EditorEntityInfoNotificationBus::Handler::BusDisconnect();
@@ -1106,16 +1108,25 @@ namespace AzToolsFramework
         AzQtComponents::SetWidgetInteractEnabled(entityOutlinerUi->m_searchWidget, on);
     }
 
+    void EntityOutlinerWidget::EnableUi(bool enable)
+    {
+        SetEntityOutlinerState(m_gui, enable);
+        setEnabled(enable);
+    }
+
+    void EntityOutlinerWidget::SetEditorUiEnabled(bool enable)
+    {
+        EnableUi(enable);
+    }
+
     void EntityOutlinerWidget::EnteredComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
     {
-        SetEntityOutlinerState(m_gui, false);
-        setEnabled(false);
+        EnableUi(false);
     }
 
     void EntityOutlinerWidget::LeftComponentMode([[maybe_unused]] const AZStd::vector<AZ::Uuid>& componentModeTypes)
     {
-        setEnabled(true);
-        SetEntityOutlinerState(m_gui, true);
+        EnableUi(true);
     }
 
     void EntityOutlinerWidget::OnPrefabInstancePropagationBegin()

+ 6 - 0
Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx

@@ -11,6 +11,7 @@
 #include <AzCore/Memory/SystemAllocator.h>
 #include <AzCore/base.h>
 
+#include <AzToolsFramework/API/EditorWindowRequestBus.h>
 #include <AzToolsFramework/API/ToolsApplicationAPI.h>
 #include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
 #include <AzToolsFramework/Entity/EditorEntityInfoBus.h>
@@ -58,6 +59,7 @@ namespace AzToolsFramework
         , private EditorEntityInfoNotificationBus::Handler
         , private ComponentModeFramework::EditorComponentModeNotificationBus::Handler
         , private Prefab::PrefabPublicNotificationBus::Handler
+        , private EditorWindowUIRequestBus::Handler
     {
         Q_OBJECT;
     public:
@@ -105,6 +107,9 @@ namespace AzToolsFramework
         void OnPrefabInstancePropagationBegin() override;
         void OnPrefabInstancePropagationEnd() override;
 
+        // EditorWindowUIRequestBus overrides
+        void SetEditorUiEnabled(bool enable) override;
+
         // Build a selection object from the given entities. Entities already in the Widget's selection buffers are ignored.
         template <class EntityIdCollection>
         QItemSelection BuildSelectionFromEntities(const EntityIdCollection& entityIds);
@@ -155,6 +160,7 @@ namespace AzToolsFramework
         AZ::EntityId GetEntityIdFromIndex(const QModelIndex& index) const;
         QModelIndex GetIndexFromEntityId(const AZ::EntityId& entityId) const;
         void ExtractEntityIdsFromSelection(const QItemSelection& selection, EntityIdList& entityIdList) const;
+        void EnableUi(bool enable);
 
         // OutlinerModelNotificationBus::Handler
         // Receive notification from the outliner model that we should scroll

+ 23 - 0
Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp

@@ -376,6 +376,7 @@ namespace AzToolsFramework
         ToolsApplicationEvents::Bus::Handler::BusConnect();
         AZ::EntitySystemBus::Handler::BusConnect();
         EntityPropertyEditorRequestBus::Handler::BusConnect();
+        EditorWindowUIRequestBus::Handler::BusConnect();
         m_spacer = nullptr;
 
         m_emptyIcon = QIcon();
@@ -421,6 +422,7 @@ namespace AzToolsFramework
     {
         qApp->removeEventFilter(this);
 
+        EditorWindowUIRequestBus::Handler::BusDisconnect();
         EntityPropertyEditorRequestBus::Handler::BusDisconnect();
         ToolsApplicationEvents::Bus::Handler::BusDisconnect();
         AZ::EntitySystemBus::Handler::BusDisconnect();
@@ -4961,6 +4963,27 @@ namespace AzToolsFramework
         EnableDisableComponentActions(widget, actions, false);
     }
 
+    void EntityPropertyEditor::SetEditorUiEnabled(bool enable)
+    {
+        if (enable)
+        {
+            EnableComponentActions(this, m_entityComponentActions);
+        }
+        else
+        {
+            DisableComponentActions(this, m_entityComponentActions);
+        }
+        m_disabled = !enable;
+        SetPropertyEditorState(m_gui, enable);
+
+        for (auto componentEditor : m_componentEditors)
+        {
+            AzQtComponents::SetWidgetInteractEnabled(componentEditor, enable);
+        }
+        // record the selected state after entering/leaving component mode
+        SaveComponentEditorState();
+    }
+
     void EntityPropertyEditor::EnteredComponentMode(const AZStd::vector<AZ::Uuid>& componentModeTypes)
     {
         DisableComponentActions(this, m_entityComponentActions);

+ 5 - 0
Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx

@@ -21,6 +21,7 @@
 #include <AzCore/Asset/AssetCommon.h>
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
 #include <AzToolsFramework/Undo/UndoSystem.h>
+#include <AzToolsFramework/API/EditorWindowRequestBus.h>
 #include <AzToolsFramework/API/ToolsApplicationAPI.h>
 #include <AzToolsFramework/API/EntityPropertyEditorRequestsBus.h>
 #include <AzToolsFramework/ComponentMode/EditorComponentModeBus.h>
@@ -108,6 +109,7 @@ namespace AzToolsFramework
         , public EditorInspectorComponentNotificationBus::MultiHandler
         , private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler
         , public AZ::EntitySystemBus::Handler
+        , private EditorWindowUIRequestBus::Handler
     {
         Q_OBJECT;
     public:
@@ -208,6 +210,9 @@ namespace AzToolsFramework
         void GetSelectedEntities(EntityIdList& selectedEntityIds) override;
         void SetNewComponentId(AZ::ComponentId componentId) override;
 
+        // EditorWindowRequestBus overrides
+        void SetEditorUiEnabled(bool enable) override;
+
         bool IsEntitySelected(const AZ::EntityId& id) const;
         bool IsSingleEntitySelected(const AZ::EntityId& id) const;
 

+ 26 - 4
Gems/ImGui/Code/Include/ImGuiBus.h

@@ -8,6 +8,7 @@
 #pragma once
 
 #include <AzCore/EBus/EBus.h>
+#include <AzCore/EBus/Event.h>
 
 // Forward Declares
 struct ImVec2;
@@ -86,9 +87,19 @@ namespace ImGui
         virtual void SetImGuiRenderResolution(const ImVec2& res) = 0;
         virtual void OverrideRenderWindowSize(uint32_t width, uint32_t height) = 0;
         virtual void RestoreRenderWindowSizeToDefault() = 0;
+        virtual void ToggleThroughImGuiVisibleState() = 0;
         virtual void SetDpiScalingFactor(float dpiScalingFactor) = 0;
         virtual float GetDpiScalingFactor() const = 0;
         virtual void Render() = 0;
+
+        using ImGuiSetEnabledEvent = AZ::Event<bool>;
+        ImGuiSetEnabledEvent m_setEnabledEvent;
+
+        // interface
+        void ConnectImGuiSetEnabledChangedHandler(ImGuiSetEnabledEvent::Handler& handler)
+        {
+            handler.Connect(m_setEnabledEvent);
+        }
     };
 
     class IImGuiManagerRequests
@@ -101,19 +112,30 @@ namespace ImGui
     };
     using ImGuiManagerBus = AZ::EBus<IImGuiManager, IImGuiManagerRequests>;
 
+    class IImGuiManagerNotifications : public AZ::EBusTraits
+    {
+    public:
+        static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
+        static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
+        using Bus = AZ::EBus<IImGuiManagerNotifications>;
+
+        virtual void ImGuiSetEnabled( [[maybe_unused]] bool enabled) {}
+    };
+    using ImGuiManagerNotificationBus = AZ::EBus<IImGuiManagerNotifications>;
+
     // Bus for getting notifications from the IMGUI Entity Outliner
-    class IImGuiEntityOutlinerNotifcations : public AZ::EBusTraits
+    class IImGuiEntityOutlinerNotifications : public AZ::EBusTraits
     {
     public:
-        static const char* GetUniqueName() { return "IImGuiEntityOutlinerNotifcations"; }
+        static const char* GetUniqueName() { return "IImGuiEntityOutlinerNotifications"; }
         static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Multiple;
         static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
-        using Bus = AZ::EBus<IImGuiEntityOutlinerNotifcations>;
+        using Bus = AZ::EBus<IImGuiEntityOutlinerNotifications>;
 
         // Callback for game code to handle targetting an IMGUI entity
         virtual void OnImGuiEntityOutlinerTarget(AZ::EntityId target) { (void)target;  }
     };
-    typedef AZ::EBus<IImGuiEntityOutlinerNotifcations> ImGuiEntityOutlinerNotifcationBus;
+    typedef AZ::EBus<IImGuiEntityOutlinerNotifications> ImGuiEntityOutlinerNotificationBus;
 
     // a pair of an entity id, and a typeid, used to represent component rtti type info
     typedef AZStd::pair<AZ::EntityId, AZ::TypeId> ImGuiEntComponentId;

+ 7 - 0
Gems/ImGui/Code/Source/ImGuiManager.cpp

@@ -738,8 +738,15 @@ void ImGuiManager::ToggleThroughImGuiVisibleState(int controllerIndex)
     }
 
     m_menuBarStatusChanged = true;
+    m_setEnabledEvent.Signal(m_clientMenuBarState == DisplayState::Hidden);
 }
 
+void ImGuiManager::ToggleThroughImGuiVisibleState()
+{
+    ToggleThroughImGuiVisibleState(-1);
+}
+
+
 void ImGuiManager::RenderImGuiBuffers(const ImVec2& scaleRects)
 {
     ImGui::ImGuiContextScope contextScope(m_imguiContext);

+ 1 - 0
Gems/ImGui/Code/Source/ImGuiManager.h

@@ -60,6 +60,7 @@ namespace ImGui
         void SetDpiScalingFactor(float dpiScalingFactor) override;
         float GetDpiScalingFactor() const override;
         void Render() override;
+        void ToggleThroughImGuiVisibleState() override;
         // -- ImGuiManagerBus Interface -------------------------------------------------------------------
 
         // -- AzFramework::InputChannelEventListener and AzFramework::InputTextEventListener Interface ------------

+ 1 - 1
Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp

@@ -465,7 +465,7 @@ namespace ImGui
                                     ImGui::BeginGroup();
                                     if (ImGui::SmallButton(AZStd::string::format("-View #%03d-##%s", ++instanceCount, meshInstance.first.ToString().c_str()).c_str()))
                                     {
-                                        ImGuiEntityOutlinerNotifcationBus::Broadcast(&IImGuiEntityOutlinerNotifcations::OnImGuiEntityOutlinerTarget, meshInstance.first);
+                                        ImGuiEntityOutlinerNotificationBus::Broadcast(&IImGuiEntityOutlinerNotifications::OnImGuiEntityOutlinerTarget, meshInstance.first);
                                     }
                                     // Build the Label String.
                                     ImGui::SameLine();

+ 19 - 0
Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp

@@ -571,7 +571,26 @@ namespace ImGui
                 // End LY Common Tools menu
                 ImGui::EndMenu();
             }
+            const int labelSize{ 100 };
+            const int buttonSize{ 40 };
             ImGuiUpdateListenerBus::Broadcast(&IImGuiUpdateListener::OnImGuiMainMenuUpdate);
+            ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - labelSize);
+            float backgroundHeight = ImGui::GetTextLineHeight() + 3;
+            ImVec2 cursorPos = ImGui::GetCursorScreenPos();
+            ImGui::GetWindowDrawList()->AddRectFilled(
+                cursorPos, ImVec2(cursorPos.x + labelSize, cursorPos.y + backgroundHeight), IM_COL32(0, 115, 187, 255));
+            ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - labelSize);
+            ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 1);
+            ImGui::Text("ImGui:ON");
+            ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - buttonSize);
+            ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 255));
+            ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(255, 255, 255, 255));
+            ImGui::PushStyleColor(ImGuiCol_ButtonHovered, IM_COL32(128, 128, 128, 255));
+            if (ImGui::SmallButton("home"))
+            {
+                ImGuiManagerBus::Broadcast(&IImGuiManager::ToggleThroughImGuiVisibleState);
+            }
+            ImGui::PopStyleColor(3);
             ImGui::EndMainMenuBar();
         }
 

+ 1 - 1
Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp

@@ -590,7 +590,7 @@ namespace ImGui
                 if (ImGui::SmallButton(targetLabel.c_str()))
                 {
                     // Send EBUS event out to Target an Entity. Up to game code to implement.
-                    ImGuiEntityOutlinerNotifcationBus::Broadcast(&IImGuiEntityOutlinerNotifcations::OnImGuiEntityOutlinerTarget, node->m_entityId);
+                    ImGuiEntityOutlinerNotificationBus::Broadcast(&IImGuiEntityOutlinerNotifications::OnImGuiEntityOutlinerTarget, node->m_entityId);
                 }
             }