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
@@ -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