diff --git a/Code/Editor/MainWindow.cpp b/Code/Editor/MainWindow.cpp index 10dfddbf8c..b2cb2fc8b6 100644 --- a/Code/Editor/MainWindow.cpp +++ b/Code/Editor/MainWindow.cpp @@ -41,6 +41,7 @@ AZ_POP_DISABLE_WARNING // AzToolsFramework #include +#include #include #include #include @@ -93,6 +94,8 @@ AZ_POP_DISABLE_WARNING #include "AssetEditor/AssetEditorWindow.h" #include "ActionManager.h" +#include + 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::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); } diff --git a/Code/Editor/MainWindow.h b/Code/Editor/MainWindow.h index 34b121537d..99af2ea326 100644 --- a/Code/Editor/MainWindow.h +++ b/Code/Editor/MainWindow.h @@ -249,6 +249,7 @@ private: QPointer m_toolbarCustomizationDialog; QScopedPointer m_sourceControlNotifHandler; + AZ::Event::Handler m_handleImGuiStateChangeHandler; AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING static MainWindow* m_instance; diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp index d69480b169..02dabb8b20 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.cpp +++ b/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& componentModeTypes) { - SetEntityOutlinerState(m_gui, false); - setEnabled(false); + EnableUi(false); } void OutlinerWidget::LeftComponentMode([[maybe_unused]] const AZStd::vector& 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*/) diff --git a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.hxx b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.hxx index 75991424bb..aff305e0fe 100644 --- a/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.hxx +++ b/Code/Editor/Plugins/ComponentEntityEditorPlugin/UI/Outliner/OutlinerWidget.hxx @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -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& componentModeTypes) override; void LeftComponentMode(const AZStd::vector& 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 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 diff --git a/Code/Editor/QtViewPaneManager.cpp b/Code/Editor/QtViewPaneManager.cpp index 35b2160a1f..9f2b9f9cf8 100644 --- a/Code/Editor/QtViewPaneManager.cpp +++ b/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& /*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(); } diff --git a/Code/Editor/QtViewPaneManager.h b/Code/Editor/QtViewPaneManager.h index aa382c41c0..2b3412aad6 100644 --- a/Code/Editor/QtViewPaneManager.h +++ b/Code/Editor/QtViewPaneManager.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -249,8 +250,12 @@ private: QPointer 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 }; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorWindowRequestBus.h b/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorWindowRequestBus.h index 03bb76b03a..ef4d2deb5e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/API/EditorWindowRequestBus.h +++ b/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; + + class EditorWindowUIRequests : public AZ::EBusTraits + { + public: + using Bus = AZ::EBus; + + ////////////////////////////////////////////////////////////////////////// + // 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; + + using EnableUiFunction = AZStd::function; + + /// 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 diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp index 96479bb54c..03784343f5 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp +++ b/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& componentModeTypes) { - SetEntityOutlinerState(m_gui, false); - setEnabled(false); + EnableUi(false); } void EntityOutlinerWidget::LeftComponentMode([[maybe_unused]] const AZStd::vector& componentModeTypes) { - setEnabled(true); - SetEntityOutlinerState(m_gui, true); + EnableUi(true); } void EntityOutlinerWidget::OnPrefabInstancePropagationBegin() diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx index 68f538c3ff..e3f9ad2135 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -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 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 diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 6a399ad816..5d1ec93fda 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/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& componentModeTypes) { DisableComponentActions(this, m_entityComponentActions); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx index b15e27e41a..f2ff4eb927 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -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; diff --git a/Gems/ImGui/Code/Include/ImGuiBus.h b/Gems/ImGui/Code/Include/ImGuiBus.h index ea7fe1631e..06a3b472da 100644 --- a/Gems/ImGui/Code/Include/ImGuiBus.h +++ b/Gems/ImGui/Code/Include/ImGuiBus.h @@ -8,6 +8,7 @@ #pragma once #include +#include // 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; + 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; + 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; + + virtual void ImGuiSetEnabled( [[maybe_unused]] bool enabled) {} + }; + using ImGuiManagerNotificationBus = AZ::EBus; + // 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; + using Bus = AZ::EBus; // Callback for game code to handle targetting an IMGUI entity virtual void OnImGuiEntityOutlinerTarget(AZ::EntityId target) { (void)target; } }; - typedef AZ::EBus ImGuiEntityOutlinerNotifcationBus; + typedef AZ::EBus ImGuiEntityOutlinerNotificationBus; // a pair of an entity id, and a typeid, used to represent component rtti type info typedef AZStd::pair ImGuiEntComponentId; diff --git a/Gems/ImGui/Code/Source/ImGuiManager.cpp b/Gems/ImGui/Code/Source/ImGuiManager.cpp index 42c8d3929c..7b2506fbcb 100644 --- a/Gems/ImGui/Code/Source/ImGuiManager.cpp +++ b/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); diff --git a/Gems/ImGui/Code/Source/ImGuiManager.h b/Gems/ImGui/Code/Source/ImGuiManager.h index 1509f27c57..02af3d0c09 100644 --- a/Gems/ImGui/Code/Source/ImGuiManager.h +++ b/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 ------------ diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp index 2f996f5768..d9d81c24f2 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYAssetExplorer.cpp +++ b/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(); diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp index 9994851faa..eb918041f7 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYCommonMenu.cpp +++ b/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(); } diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp index aca52af238..57502296ae 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp +++ b/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); } }