2025-01-08 05:30:09 +00:00
|
|
|
|
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Engine/StreamableManager.h"
|
|
|
|
|
|
2025-01-16 19:19:53 +00:00
|
|
|
|
DECLARE_LOG_CATEGORY_EXTERN(LogOLSAssetManagerStartupJob, Verbose, All);
|
2025-01-08 05:30:09 +00:00
|
|
|
|
|
|
|
|
|
DECLARE_DELEGATE_OneParam(FOLSAssetManagerStartupJobSubstepProgress, float /*newProgress*/);
|
|
|
|
|
|
|
|
|
|
/** Handles reporting progress from streamable handles */
|
|
|
|
|
struct FOLSAssetManagerStartupJob
|
|
|
|
|
{
|
|
|
|
|
FOLSAssetManagerStartupJobSubstepProgress SubstepProgressDelegate;
|
|
|
|
|
TFunction<void(const FOLSAssetManagerStartupJob&, TSharedPtr<FStreamableHandle>&)> JobFunc;
|
|
|
|
|
FString JobName;
|
|
|
|
|
float JobWeight;
|
|
|
|
|
mutable double LastUpdate = 0;
|
|
|
|
|
|
|
|
|
|
/** Simple job that is all synchronous */
|
|
|
|
|
FOLSAssetManagerStartupJob(const FString& jobName, const TFunction<void(const FOLSAssetManagerStartupJob&, TSharedPtr<FStreamableHandle>&)>& jobFunc, float jobWeight)
|
|
|
|
|
: JobFunc(jobFunc)
|
|
|
|
|
, JobName(jobName)
|
|
|
|
|
, JobWeight(jobWeight)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
/** Perform actual loading, will return a handle if it created one */
|
|
|
|
|
TSharedPtr<FStreamableHandle> DoJob() const;
|
|
|
|
|
|
|
|
|
|
void UpdateSubstepProgress(float newProgress) const;
|
|
|
|
|
|
|
|
|
|
void UpdateSubstepProgressFromStreamable(TSharedRef<FStreamableHandle> streamableHandle) const;
|
|
|
|
|
};
|