Fix frame visualizer not closing (#1383)

This commit is contained in:
Jacob Hilliard
2021-06-17 14:36:42 -07:00
committed by GitHub
parent 24dfa0c562
commit 28d0d0cce9
2 changed files with 5 additions and 7 deletions
@@ -38,14 +38,13 @@ namespace AZ
~ImGuiFrameVisualizer() = default;
AZStd::vector<FrameAttachmentVisualizeInfo>& GetFrameAttachments();
void Init(RHI::Device* device);
void Draw(bool draw);
void Draw(bool& draw);
void DrawTreeView();
void Reset();
protected:
AZStd::vector<FrameAttachmentVisualizeInfo> m_framesAttachments;
RHI::Device* m_device = nullptr;
bool m_deviceInit = false;
bool m_draw = false;
//////////////////////////////////////////////////////////////////////////
// FrameEventBus::Handler
void OnFrameCompileEnd(RHI::FrameGraph& frameGraph);
@@ -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);
}
}