UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AnimCurveCompressionCodec.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"
8#include "AnimCurveCompressionCodec.generated.h"
9
11class UAnimSequence;
12struct FBlendedCurve;
13
14#if WITH_EDITORONLY_DATA
17{
19 TArray<uint8> CompressedBytes;
20
23
25 FAnimCurveCompressionResult() : CompressedBytes(), Codec(nullptr) {}
26};
27#endif
28
29/*
30 * Base class for all curve compression codecs.
31 */
34{
36
37
38 virtual UAnimCurveCompressionCodec* GetCodec(const FString& Path) { return this; }
39
41
42 ENGINE_API virtual void Serialize(FArchive& Ar) override;
43
44 /*
45 * Called on load and when cooking to validate that the compressed data is good.
46 * Codecs should perform necessary validation and emit an error when appropriate.
47 * e.g: UE_LOG(LogAnimationCompression, Error, TEXT("Bad data!"));
48 *
49 * Returns true when the data is valid, false otherwise.
50 */
51 virtual bool ValidateCompressedData(UObject* DataOwner, const FCompressedAnimSequence& AnimSeq) const { return true; }
52
53#if WITH_EDITORONLY_DATA
55 virtual bool IsCodecValid() const { return true; }
56
58 virtual bool Compress(const FCompressibleAnimData& AnimSeq, FAnimCurveCompressionResult& OutResult) PURE_VIRTUAL(UAnimCurveCompressionCodec::Compress, return false;);
59
71 ENGINE_API virtual int64 EstimateCompressionMemoryUsage(const UAnimSequence& AnimSequence) const;
72
73 /*
74 * Called to generate a unique DDC key for this codec instance.
75 * A suitable key should be generated from: the InstanceGuid, a codec version, and all relevant properties that drive the behavior.
76 */
77 ENGINE_API virtual void PopulateDDCKey(FArchive& Ar);
78#endif
79
80 /*
81 * Decompresses all the active blended curves.
82 * Note: Codecs should _NOT_ rely on any member properties during decompression. Decompression
83 * behavior should entirely be driven by code and the compressed data.
84 */
85 virtual void DecompressCurves(const FCompressedAnimSequence& AnimSeq, FBlendedCurve& Curves, float CurrentTime) const PURE_VIRTUAL(UAnimCurveCompressionCodec::DecompressCurves, );
86
87 /*
88 * Decompress a single curve.
89 * Note: Codecs should _NOT_ rely on any member properties during decompression. Decompression
90 * behavior should entirely be driven by code and the compressed data.
91 */
92 virtual float DecompressCurve(const FCompressedAnimSequence& AnimSeq, FName CurveName, float CurrentTime) const PURE_VIRTUAL(UAnimCurveCompressionCodec::DecompressCurve, return 0.0f;);
93
94 UE_DEPRECATED(5.3, "Please use DecompressCurve that takes an FName.")
95 virtual float DecompressCurve(const FCompressedAnimSequence& AnimSeq, SmartName::UID_Type CurveUID, float CurrentTime) const { return 0.0f; }
96};
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition Archive.h:1208
Definition NameTypes.h:617
Definition Array.h:670
Definition AnimCurveCompressionCodec.h:34
Definition AnimSequence.h:203
Definition Object.h:95
uint16 UID_Type
Definition AnimationAsset.h:39
Definition AnimCurveTypes.h:1041
Definition AnimCompressionTypes.h:775