UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
LandscapeTextureHash.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
7#include "LandscapeTextureHash.generated.h"
8
9class UTexture2D;
10
11UENUM()
18
19UENUM()
21{
22 Unknown,
23 EditLayerData, // used as data for an edit layer, input to the layer merge operation
24 FinalData // used for runtime/rendering
25};
26
27UCLASS(NotBlueprintable, MinimalAPI, Within = Texture2D)
29{
31
32 UPROPERTY()
33 FGuid TextureHashGUID;
34
35 UPROPERTY()
36 FGuid LastSourceID;
37
38 // heightmap or weightmap. When unknown, we fallback to using the texture source ID as hash (old behavior)
39 UPROPERTY()
41
42 // edit layer data or final data. When unknown, we fallback to using the texture source ID as hash (old behavior)
43 UPROPERTY()
45
46 // cache of recently serialized hash values
47 // this ensure that if the texture is brought back to match exactly a recently serialized state, it will have exactly the same hash that it was serialized with.
48 // This helps us come back to the serialized (presumably cache-friendly) state after no-ops like: modify + undo, hide layer + unhide layer, etc.
49 TMap<FGuid, FGuid> RecentlySerializedHashes;
50
51public:
52
53#if WITH_EDITORONLY_DATA
54 // setup initial state on load, if it doesn't yet exist
56
57 // Update the stored hash based on the source data
58 static void UpdateHash(UTexture2D* LandscapeTexture, ELandscapeTextureUsage TextureUsage = ELandscapeTextureUsage::Unknown, ELandscapeTextureType TextureType = ELandscapeTextureType::Unknown, bool bForceUpdate = false);
59
60 // Explicitly set the hash for the specified LandscapeTexture
62
63 // calculate the texture hash directly from the source mip0 contents
66
67 // calculate the texture hash from the Mip0Data buffer
69
70 // check if the Mip0Data is within the change threshold of OldMip0Data
72
73 // get the current stored hash for the landscape texture, checking that it is up to date
74 static FGuid GetHash(UTexture2D* LandscapeTexture);
75
76 // Check the hash is up to date
78
79 // UObject Interface
80 virtual void Serialize(FArchive& Ar) override;
81 virtual bool IsEditorOnly() const override { return true; }
82 virtual bool NeedsLoadForClient() const override { return false; }
83 virtual bool NeedsLoadForServer() const override { return false; }
84#endif // WITH_EDITORONLY_DATA
85};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ELandscapeTextureType
Definition LandscapeTextureHash.h:13
ELandscapeTextureUsage
Definition LandscapeTextureHash.h:21
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition UnrealString.h.inl:34
Definition AssetUserData.h:18
Definition LandscapeTextureHash.h:29
virtual bool IsEditorOnly() const
Definition Object.h:593
virtual COREUOBJECT_API bool NeedsLoadForClient() const
Definition Obj.cpp:992
virtual COREUOBJECT_API bool NeedsLoadForServer() const
Definition Obj.cpp:977
Definition Texture2D.h:26
Definition Color.h:486
Definition Guid.h:109
Definition Optional.h:131