Fix frame visualizer not closing (#1383)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user