From 9446cece62d0215bcdbb387605a5f4a6ee3859f7 Mon Sep 17 00:00:00 2001 From: Bret Curtis Date: Thu, 18 Jun 2020 13:23:39 +0200 Subject: [PATCH] Issue #5468: Apparently this was always a problem but OP made "nested loading" more visible. This should resolve nested loading correctly. --- apps/openmw/mwgui/loadingscreen.cpp | 8 ++++++-- apps/openmw/mwgui/loadingscreen.hpp | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/loadingscreen.cpp b/apps/openmw/mwgui/loadingscreen.cpp index 436e9c2bc9..521b88f296 100644 --- a/apps/openmw/mwgui/loadingscreen.cpp +++ b/apps/openmw/mwgui/loadingscreen.cpp @@ -40,6 +40,7 @@ namespace MWGui , mLoadingOnTime(0.0) , mImportantLabel(false) , mVisible(false) + , mNestedLoadingCount(0) , mProgress(0) , mShowWallpaper(true) { @@ -163,11 +164,12 @@ namespace MWGui void LoadingScreen::loadingOn(bool visible) { - mLoadingOnTime = mTimer.time_m(); // Early-out if already on - if (mMainWidget->getVisible()) + if (mNestedLoadingCount++ > 0 && mMainWidget->getVisible()) return; + mLoadingOnTime = mTimer.time_m(); + // Assign dummy bounding sphere callback to avoid the bounding sphere of the entire scene being recomputed after each frame of loading // We are already using node masks to avoid the scene from being updated/rendered, but node masks don't work for computeBound() mViewer->getSceneData()->setComputeBoundingSphereCallback(new DontComputeBoundCallback); @@ -200,6 +202,8 @@ namespace MWGui void LoadingScreen::loadingOff() { + if (--mNestedLoadingCount > 0) + return; mLoadingBox->setVisible(true); // restore if (mLastRenderTime < mLoadingOnTime) diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp index 1be1b3a0ce..b3e2534ce3 100644 --- a/apps/openmw/mwgui/loadingscreen.hpp +++ b/apps/openmw/mwgui/loadingscreen.hpp @@ -66,6 +66,7 @@ namespace MWGui bool mImportantLabel; bool mVisible; + int mNestedLoadingCount; size_t mProgress;