OLS/Source/ols/Public/Systems/OLSAssetManagerStartupJob.h

34 lines
1.2 KiB
C
Raw Normal View History

// © 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"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSAssetManagerStartupJob, Verbose, All);
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;
};