Skip to content

Commit

Permalink
Fixed editor view rendering to properly skip drawing a view if it's n…
Browse files Browse the repository at this point in the history
…ot visible (#334)
  • Loading branch information
adriengivry authored Feb 7, 2025
1 parent c4262a1 commit 7660ac0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/Overload/OvEditor/src/OvEditor/Core/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,19 +223,19 @@ void OvEditor::Core::Editor::RenderViews(float p_deltaTime)
sceneView.Update(p_deltaTime);
}

if (assetView.IsOpened())
if (assetView.IsOpened() && assetView.IsVisible())
{
PROFILER_SPY("Asset View Rendering");
assetView.Render();
}

if (gameView.IsOpened())
if (gameView.IsOpened() && gameView.IsVisible())
{
PROFILER_SPY("Game View Rendering");
gameView.Render();
}

if (sceneView.IsOpened())
if (sceneView.IsOpened() && sceneView.IsVisible())
{
PROFILER_SPY("Scene View Rendering");
sceneView.Render();
Expand Down
5 changes: 5 additions & 0 deletions Sources/Overload/OvUI/include/OvUI/Panels/PanelWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ namespace OvUI::Panels
*/
bool IsAppearing() const;

/**
* Returns true if the panel is visible
*/
bool IsVisible() const;

/**
* Scrolls to the bottom of the window
*/
Expand Down
8 changes: 8 additions & 0 deletions Sources/Overload/OvUI/src/OvUI/Panels/PanelWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ bool OvUI::Panels::PanelWindow::IsAppearing() const
return false;
}

bool OvUI::Panels::PanelWindow::IsVisible() const
{
if (auto window = ImGui::FindWindowByName((name + GetPanelID()).c_str()); window)
return !window->Hidden;
else
return false;
}

void OvUI::Panels::PanelWindow::ScrollToBottom()
{
m_mustScrollToBottom = true;
Expand Down

0 comments on commit 7660ac0

Please sign in to comment.