You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rb: none #fyi: Laurent.Delayen, Thomas.Sarkanen [CL 11088765 by Lina Halper in Main branch]
43 lines
1.7 KiB
C++
43 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "AsyncAnimCompressionUI.h"
|
|
#include "GlobalEditorNotification.h"
|
|
#include "Widgets/Notifications/SNotificationList.h"
|
|
#include "Animation/AnimCompressionDerivedDataPublic.h"
|
|
#include "Animation/AnimSequence.h"
|
|
|
|
/** Notification class for asynchronous shader compiling. */
|
|
class FAnimCompressionNotificationImpl : public FGlobalEditorNotification
|
|
{
|
|
protected:
|
|
/** FGlobalEditorNotification interface */
|
|
virtual bool ShouldShowNotification(const bool bIsNotificationAlreadyActive) const override;
|
|
virtual void SetNotificationText(const TSharedPtr<SNotificationItem>& InNotificationItem) const override;
|
|
};
|
|
|
|
/** Global notification object. */
|
|
FAnimCompressionNotificationImpl GAnimCompressionNotification;
|
|
|
|
bool FAnimCompressionNotificationImpl::ShouldShowNotification(const bool bIsNotificationAlreadyActive) const
|
|
{
|
|
const uint32 RemainingJobsThreshold = bIsNotificationAlreadyActive ? 0 : 10;
|
|
const uint32 ActiveJobs = GAsyncCompressedAnimationsTracker ? GAsyncCompressedAnimationsTracker->GetNumRemainingJobs() : 0;
|
|
|
|
return ActiveJobs > RemainingJobsThreshold;
|
|
}
|
|
|
|
void FAnimCompressionNotificationImpl::SetNotificationText(const TSharedPtr<SNotificationItem>& InNotificationItem) const
|
|
{
|
|
if(GAsyncCompressedAnimationsTracker)
|
|
{
|
|
const int32 RemainingJobs = GAsyncCompressedAnimationsTracker->GetNumRemainingJobs();
|
|
if (RemainingJobs > 0)
|
|
{
|
|
FFormatNamedArguments Args;
|
|
Args.Add(TEXT("AnimsToCompress"), FText::AsNumber(RemainingJobs));
|
|
const FText ProgressMessage = FText::Format(NSLOCTEXT("AsyncAnimCompression", "AnimCompressionInProgressFormat", "Compressing Animations ({AnimsToCompress})"), Args);
|
|
|
|
InNotificationItem->SetText(ProgressMessage);
|
|
}
|
|
}
|
|
} |