You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Extended the Instance/Descriptor api to support setting a UTexture2D directly as a Texture Parameter. [REVIEW] [at]alexei.lebedev [FYI] [at]devlin.willis #rnx #preflight 6363f7671052c15f1395b033 [CL 22985536 by gerard martin in ue5-main branch]
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "MuCO/CustomizableObjectSystem.h"
|
|
|
|
#include "DefaultImageProvider.generated.h"
|
|
|
|
class UTexture2D;
|
|
class UCustomizableObjectInstance;
|
|
|
|
|
|
UCLASS()
|
|
class CUSTOMIZABLEOBJECT_API UDefaultImageProvider : public UCustomizableSystemImageProvider
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
// UCustomizableSystemImageProvider interface
|
|
virtual ValueType HasTextureParameterValue(int64 ID) override;
|
|
virtual UTexture2D* GetTextureParameterValue(int64 ID) override;
|
|
virtual void GetTextureParameterValues(TArray<FCustomizableObjectExternalTexture>& OutValues) override;
|
|
|
|
// Own interface
|
|
|
|
UTexture2D* Get(uint64 TextureId) const;
|
|
|
|
int64 Get(UTexture2D* Texture) const;
|
|
|
|
/** If the TextureId does not get assigned to an Instance Texture Parameter it will be GC on the next Instance update. */
|
|
uint64 GetOrAdd(UTexture2D* Texture);
|
|
|
|
void CacheTextures(UCustomizableObjectInstance& Instance);
|
|
|
|
/** Keep the TextureId from being collected by the GC. */
|
|
void Keep(uint64 TextureId, bool bKeep);
|
|
|
|
void GarbageCollectTextureIds();
|
|
|
|
private:
|
|
int32 ToIndex(uint64 TextureId) const;
|
|
|
|
uint64 ToTextureId(int32 Index) const;
|
|
|
|
/** Change it to avoid TextureId collisions with other Image Providers. */
|
|
const int32 BASE_ID = 0;
|
|
const int32 MAX_IDS = 1000;
|
|
|
|
UPROPERTY()
|
|
TArray<TObjectPtr<UTexture2D>> Textures;
|
|
|
|
UPROPERTY()
|
|
TArray<bool> KeepTextures;
|
|
};
|
|
|