diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.h b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.h index 7ce68c0cc7..0186f68282 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.h +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.h @@ -38,14 +38,13 @@ namespace AZ ~ImGuiFrameVisualizer() = default; AZStd::vector& GetFrameAttachments(); void Init(RHI::Device* device); - void Draw(bool draw); + void Draw(bool& draw); void DrawTreeView(); void Reset(); protected: AZStd::vector m_framesAttachments; RHI::Device* m_device = nullptr; bool m_deviceInit = false; - bool m_draw = false; ////////////////////////////////////////////////////////////////////////// // FrameEventBus::Handler void OnFrameCompileEnd(RHI::FrameGraph& frameGraph); diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.inl index b5cf2e8f6b..5230a6869b 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiFrameVisualizer.inl @@ -466,10 +466,10 @@ namespace ImGui } //!Draw the UI and all the nodes. - void Paint() + void Paint(bool& draw) { ImGui::SetNextWindowSize(ImVec2((float)m_windowWidth, (float)m_windowHeight), ImGuiCond_FirstUseEver); - if (!ImGui::Begin(m_windowName.c_str(), &m_open)) + if (!ImGui::Begin(m_windowName.c_str(), &draw)) { ImGui::End(); return; @@ -572,7 +572,6 @@ namespace ImGui AZStd::string m_windowName; unsigned int m_windowWidth = 1; unsigned int m_windowHeight = 1; - bool m_open = false; bool m_frameCapture = false; bool m_showGrid = true; }; @@ -581,7 +580,7 @@ static ImGui::ImGuiFrameVisualizerWindow* visualizerWindow = nullptr; namespace AZ::Render { //! Draw the frame graph. - inline void ImGuiFrameVisualizer::Draw([[maybe_unused]] bool draw) + inline void ImGuiFrameVisualizer::Draw(bool& draw) { if (!visualizerWindow) { @@ -595,7 +594,7 @@ namespace AZ::Render visualizerWindow->CaptureFrame(this); visualizerWindow->DisableCaptureFrame(); } - visualizerWindow->Paint(); + visualizerWindow->Paint(draw); } }