// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include "HAL/Runnable.h" #include "MuCO/CustomizableObjectPrivate.h" #include "MuCO/CustomizableObjectCompilerTypes.h" #include "MuCO/UnrealToMutableTextureConversionUtils.h" #include "MuR/Image.h" #include "MuR/Mesh.h" #include "MuR/Ptr.h" #include "MuT/Node.h" #include "MuCOE/CustomizableObjectEditorLogger.h" #include "MuCOE/GenerateMutableSource/GenerateMutableSource.h" #include "DerivedDataCacheKey.h" #include "DerivedDataCachePolicy.h" #include struct FCompilationRequest; class ITargetPlatform; class FCustomizableObjectCompileRunnable : public FRunnable { public: struct FErrorAttachedData { TArray UnassignedUVs; }; struct FError { EMessageSeverity::Type Severity = EMessageSeverity::Error; ELoggerSpamBin SpamBin = ELoggerSpamBin::ShowAll; FText Message; TSharedPtr AttachedData; TObjectPtr Context = nullptr; TObjectPtr Context2 = nullptr; FError(const EMessageSeverity::Type InSeverity, const FText& InMessage, const UObject* InContext, const UObject* InContext2=nullptr, const ELoggerSpamBin InSpamBin = ELoggerSpamBin::ShowAll ) : Severity(InSeverity), SpamBin(InSpamBin), Message(InMessage), Context(InContext), Context2(InContext2) {} FError(const EMessageSeverity::Type InSeverity, const FText& InMessage, const TSharedPtr& InAttachedData, const UObject* InContext, const ELoggerSpamBin InSpamBin = ELoggerSpamBin::ShowAll) : Severity(InSeverity), SpamBin(InSpamBin), Message(InMessage), AttachedData(InAttachedData), Context(InContext) {} }; private: UE::Mutable::Private::Ptr MutableRoot; TArray ArrayErrors; TSharedPtr LoadImageResourceReferenced(int32 ID); public: FCustomizableObjectCompileRunnable(UE::Mutable::Private::Ptr Root, const TSharedRef& InCompiler); // FRunnable interface uint32 Run() override; // Own interface // bool IsCompleted() const; // const TArray& GetArrayErrors() const; TSharedPtr Model; FCompilationOptions Options; TWeakPtr WeakCompiler; TArray ReferencedTextures; TArray ReferencedMeshes; FString ErrorMsg; // Whether the thread has finished running std::atomic bThreadCompleted; }; class FCustomizableObjectSaveDDRunnable : public FRunnable { public: FCustomizableObjectSaveDDRunnable(const TSharedPtr& InRequest, TSharedPtr& InPlatformData); // FRunnable interface uint32 Run() override; // bool IsCompleted() const; const ITargetPlatform* GetTargetPlatform() const; private: void CachePlatformData(); void StoreCachedPlatformDataInDDC(bool& bStoredSuccessfully); void StoreCachedPlatformDataToDisk(); FCompilationOptions Options; FString CustomizableObjectName; FGuid CustomizableObjectId; MutableCompiledDataStreamHeader CustomizableObjectHeader; // Used to save files to disk FString FullFileName; UE::DerivedData::FCacheKey DDCKey; UE::DerivedData::ECachePolicy DefaultDDCPolicy; // Whether the thread has finished running std::atomic bThreadCompleted = false; public: TArray64 ModelData; TArray64 ModelResourcesData; // Cached platform data TSharedPtr PlatformData; // DDC Helpers TArray BulkDataFilesDDC; };