2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-06-30 10:25:10 -04:00
|
|
|
|
2014-03-14 14:13:41 -04:00
|
|
|
#include "UnrealEd.h"
|
2014-08-22 05:53:08 -04:00
|
|
|
#include "GlobalEditorNotification.h"
|
2014-08-11 07:14:41 -04:00
|
|
|
#include "ShaderCompiler.h"
|
2014-10-14 22:50:06 -04:00
|
|
|
#include "SNotificationList.h"
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/** Notification class for asynchronous shader compiling. */
|
2014-08-22 05:53:08 -04:00
|
|
|
class FShaderCompilingNotificationImpl : public FGlobalEditorNotification
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
|
|
|
|
protected:
|
2014-08-22 05:53:08 -04:00
|
|
|
/** FGlobalEditorNotification interface */
|
|
|
|
|
virtual bool ShouldShowNotification(const bool bIsNotificationAlreadyActive) const override;
|
|
|
|
|
virtual void SetNotificationText(const TSharedPtr<SNotificationItem>& InNotificationItem) const override;
|
2014-03-14 14:13:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** Global notification object. */
|
|
|
|
|
FShaderCompilingNotificationImpl GShaderCompilingNotification;
|
|
|
|
|
|
2014-08-22 05:53:08 -04:00
|
|
|
bool FShaderCompilingNotificationImpl::ShouldShowNotification(const bool bIsNotificationAlreadyActive) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-08-22 05:53:08 -04:00
|
|
|
// ShouldDisplayCompilingNotification is more a hint, and may start returning false while there's still work being done
|
|
|
|
|
// If we're already showing the notification, we should continue to do so until all the jobs have finished
|
|
|
|
|
return GShaderCompilingManager->ShouldDisplayCompilingNotification() || (bIsNotificationAlreadyActive && GShaderCompilingManager->IsCompiling());
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
|
2014-08-22 05:53:08 -04:00
|
|
|
void FShaderCompilingNotificationImpl::SetNotificationText(const TSharedPtr<SNotificationItem>& InNotificationItem) const
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-08-22 05:53:08 -04:00
|
|
|
if (GShaderCompilingManager->IsCompiling())
|
2014-03-14 14:13:41 -04:00
|
|
|
{
|
2014-08-22 05:53:08 -04:00
|
|
|
FFormatNamedArguments Args;
|
|
|
|
|
Args.Add(TEXT("ShaderJobs"), FText::AsNumber(GShaderCompilingManager->GetNumRemainingJobs()));
|
|
|
|
|
const FText ProgressMessage = FText::Format(NSLOCTEXT("ShaderCompile", "ShaderCompileInProgressFormat", "Compiling Shaders ({ShaderJobs})"), Args);
|
2014-03-14 14:13:41 -04:00
|
|
|
|
2014-08-22 05:53:08 -04:00
|
|
|
InNotificationItem->SetText(ProgressMessage);
|
2014-03-14 14:13:41 -04:00
|
|
|
}
|
|
|
|
|
}
|