Fix input priority conflict with LyShine and ImGuiPass (#3329)

* Fix input priority conflict with LyShine and ImGuiPass

Signed-off-by: abrmich <abrmich@amazon.com>

* Add GetPriorityDebugUI() input listener priority

Signed-off-by: abrmich <abrmich@amazon.com>
This commit is contained in:
michabr
2021-08-23 13:05:19 -07:00
committed by GitHub
parent c66dcc7413
commit 89cc27fdef
5 changed files with 5 additions and 9 deletions
@@ -35,6 +35,7 @@ namespace AzFramework
//! Predefined input event listener priority, used to sort handlers from highest to lowest
inline static AZ::s32 GetPriorityFirst() { return std::numeric_limits<AZ::s32>::max(); }
inline static AZ::s32 GetPriorityDebug() { return (GetPriorityFirst() / 4) * 3; }
inline static AZ::s32 GetPriorityDebugUI() { return (GetPriorityFirst() / 8) * 5; }
inline static AZ::s32 GetPriorityUI() { return GetPriorityFirst() / 2; }
inline static AZ::s32 GetPriorityDefault() { return 0; }
inline static AZ::s32 GetPriorityLast() { return std::numeric_limits<AZ::s32>::min(); }
@@ -28,6 +28,7 @@ namespace AzFramework
//! Predefined text event listener priority, used to sort handlers from highest to lowest
inline static AZ::s32 GetPriorityFirst() { return std::numeric_limits<AZ::s32>::max(); }
inline static AZ::s32 GetPriorityDebug() { return (GetPriorityFirst() / 4) * 3; }
inline static AZ::s32 GetPriorityDebugUI() { return (GetPriorityFirst() / 8) * 5; }
inline static AZ::s32 GetPriorityUI() { return GetPriorityFirst() / 2; }
inline static AZ::s32 GetPriorityDefault() { return 0; }
inline static AZ::s32 GetPriorityLast() { return std::numeric_limits<AZ::s32>::min(); }
@@ -67,8 +67,8 @@ namespace AZ
ImGuiPass::ImGuiPass(const RPI::PassDescriptor& descriptor)
: Base(descriptor)
, AzFramework::InputChannelEventListener(AzFramework::InputChannelEventListener::GetPriorityUI())
, AzFramework::InputTextEventListener(AzFramework::InputTextEventListener::GetPriorityUI())
, AzFramework::InputChannelEventListener(AzFramework::InputChannelEventListener::GetPriorityDebugUI() - 1) // Give ImGui manager priority over the pass
, AzFramework::InputTextEventListener(AzFramework::InputTextEventListener::GetPriorityDebugUI() - 1) // Give ImGui manager priority over the pass
{
const ImGuiPassData* imguiPassData = RPI::PassUtils::GetPassData<ImGuiPassData>(descriptor);
@@ -157,11 +157,6 @@ namespace AZ
return io.WantTextInput;
}
AZ::s32 ImGuiPass::GetPriority() const
{
return AzFramework::InputChannelEventListener::GetPriorityUI();
}
bool ImGuiPass::OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel)
{
if (!IsEnabled() || GetRenderPipeline()->GetScene() == nullptr)
@@ -84,7 +84,6 @@ namespace AZ
// AzFramework::InputChannelEventListener overrides...
bool OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) override;
AZ::s32 GetPriority() const override;
protected:
explicit ImGuiPass(const RPI::PassDescriptor& descriptor);
+1 -1
View File
@@ -67,7 +67,7 @@ namespace ImGui
// -- AzFramework::InputChannelEventListener and AzFramework::InputTextEventListener Interface ------------
bool OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) override;
bool OnInputTextEventFiltered(const AZStd::string& textUTF8) override;
int GetPriority() const override { return AzFramework::InputChannelEventListener::GetPriorityDebug(); }
int GetPriority() const override { return AzFramework::InputChannelEventListener::GetPriorityDebugUI(); }
// -- AzFramework::InputChannelEventListener and AzFramework::InputTextEventListener Interface ------------
// AzFramework::WindowNotificationBus::Handler overrides...