Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed editor view rendering to properly skip drawing a view if it's not visible #334

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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