Performance settings changes are now delayed until the load screen is fully faded in, so that the 3D renderer is disabled only after we can't see it any more anyway.
This commit is contained in:
parent
af66792d04
commit
d4f5bbd834
@ -163,7 +163,10 @@ ULoadingScreenWidget *ULoadingScreenManager::ShowLoadingScreen()
|
||||
UGameViewportClient *GameViewportClient = LocalGameInstance->GetGameViewportClient();
|
||||
GameViewportClient->AddViewportWidgetContent(this->LoadingScreenWidget.ToSharedRef(), Settings->LoadingScreenZOrder);
|
||||
|
||||
this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ true);
|
||||
// After the load screen is fully loaded in, change the performance settings. We delay
|
||||
// this because one of the performance settings disables 3D rendering, which we don't
|
||||
// want to do until the load screen is completely obscuring that fact.
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenOpened.AddLambda([this]{ this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ true); });
|
||||
|
||||
if (!GIsEditor || Settings->ForceTickLoadingScreenEvenInEditor)
|
||||
{
|
||||
@ -196,7 +199,7 @@ void ULoadingScreenManager::HideLoadingScreen_Private()
|
||||
{
|
||||
this->ChangePerformanceSettings(/*bEnableLoadingScreen=*/ false);
|
||||
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenClosed.BindUObject(this, &ULoadingScreenManager::RemoveLoadingScreen);
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenClosed.AddUObject(this, &ULoadingScreenManager::RemoveLoadingScreen);
|
||||
this->LoadingScreenUMGWidget->BeginFadeOut();
|
||||
}
|
||||
}
|
||||
@ -211,8 +214,8 @@ void ULoadingScreenManager::RemoveLoadingScreen()
|
||||
this->StopBlockingInput();
|
||||
this->RemoveWidgetFromViewport();
|
||||
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenOpened.Unbind();
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenClosed.Unbind();
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenOpened.Clear();
|
||||
this->LoadingScreenUMGWidget->OnLoadScreenClosed.Clear();
|
||||
|
||||
// Let observers know that the loading screen is done
|
||||
this->LoadingScreenVisibilityChanged.Broadcast(/*bIsVisible=*/ false);
|
||||
@ -256,26 +259,26 @@ void ULoadingScreenManager::StopBlockingInput()
|
||||
}
|
||||
}
|
||||
|
||||
void ULoadingScreenManager::ChangePerformanceSettings(bool bEnabingLoadingScreen)
|
||||
void ULoadingScreenManager::ChangePerformanceSettings(bool bEnableLoadingScreen)
|
||||
{
|
||||
UGameInstance *LocalGameInstance = this->GetGameInstance();
|
||||
UGameViewportClient *GameViewportClient = LocalGameInstance->GetGameViewportClient();
|
||||
|
||||
FShaderPipelineCache::SetBatchMode(bEnabingLoadingScreen ? FShaderPipelineCache::BatchMode::Fast : FShaderPipelineCache::BatchMode::Background);
|
||||
FShaderPipelineCache::SetBatchMode(bEnableLoadingScreen ? FShaderPipelineCache::BatchMode::Fast : FShaderPipelineCache::BatchMode::Background);
|
||||
|
||||
// Don't bother drawing the 3D world while we're loading
|
||||
GameViewportClient->bDisableWorldRendering = bEnabingLoadingScreen;
|
||||
GameViewportClient->bDisableWorldRendering = bEnableLoadingScreen;
|
||||
|
||||
// Make sure to prioritize streaming in levels if the loading screen is up
|
||||
if (UWorld* ViewportWorld = GameViewportClient->GetWorld())
|
||||
{
|
||||
if (AWorldSettings *WorldSettings = ViewportWorld->GetWorldSettings(false, false))
|
||||
{
|
||||
WorldSettings->bHighPriorityLoadingLocal = bEnabingLoadingScreen;
|
||||
WorldSettings->bHighPriorityLoadingLocal = bEnableLoadingScreen;
|
||||
}
|
||||
}
|
||||
|
||||
if (bEnabingLoadingScreen)
|
||||
if (bEnableLoadingScreen)
|
||||
{
|
||||
// Set a new hang detector timeout multiplier when the loading screen is visible.
|
||||
double HangDurationMultiplier;
|
||||
|
||||
@ -61,7 +61,7 @@ private:
|
||||
/** Resumes in-game input, if blocking */
|
||||
void StopBlockingInput();
|
||||
|
||||
void ChangePerformanceSettings(bool bEnabingLoadingScreen);
|
||||
void ChangePerformanceSettings(bool bEnableLoadingScreen);
|
||||
|
||||
private:
|
||||
/** Delegate broadcast when the loading screen visibility changes */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user