UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IndexedCurve.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 "Curves/KeyHandle.h"
8#include "IndexedCurve.generated.h"
9
10
16USTRUCT()
18{
20
21public:
22
25
26 virtual ~FIndexedCurve() { }
27
28public:
29
31 ENGINE_API int32 GetIndexSafe(FKeyHandle KeyHandle) const;
32
35 {
36 EnsureAllIndicesHaveHandles();
37 return KeyHandlesToIndices.CreateConstIterator();
38 }
39
41 virtual int32 GetNumKeys() const PURE_VIRTUAL(FIndexedCurve::GetNumKeys, return 0;);
42
44 virtual void SetKeyTime(FKeyHandle KeyHandle, float NewTime) PURE_VIRTUAL(FIndexedCurve::SetKeyTime, );
45
47 virtual float GetKeyTime(FKeyHandle KeyHandle) const PURE_VIRTUAL(FIndexedCurve::GetKeyTime, return 0.f;);
48
51
53 ENGINE_API bool IsKeyHandleValid(FKeyHandle KeyHandle) const;
54
56 FKeyHandle GetFirstKeyHandle() const { return (GetNumKeys() > 0 ? GetKeyHandle(0) : FKeyHandle::Invalid()); }
57
59 FKeyHandle GetLastKeyHandle() const { const int32 NumKeys = GetNumKeys(); return (NumKeys > 0 ? GetKeyHandle(NumKeys-1) : FKeyHandle::Invalid()); }
60
62 ENGINE_API FKeyHandle GetNextKey(FKeyHandle KeyHandle) const;
63
65 ENGINE_API FKeyHandle GetPreviousKey(FKeyHandle KeyHandle) const;
66
68 ENGINE_API void ShiftCurve(float DeltaTime);
69 ENGINE_API void ShiftCurve(float DeltaTime, const TSet<FKeyHandle>& KeyHandles);
70
72 ENGINE_API void ScaleCurve(float ScaleOrigin, float ScaleFactor);
73 ENGINE_API void ScaleCurve(float ScaleOrigin, float ScaleFactor, const TSet<FKeyHandle>& KeyHandles);
74
75protected:
76
78 void EnsureAllIndicesHaveHandles() const { EnsureAllIndicesHaveHandles_Internal(GetNumKeys()); }
79 void EnsureIndexHasAHandle(int32 KeyIndex) const { KeyHandlesToIndices.EnsureIndexHasAHandle(KeyIndex); }
80
81private:
82 ENGINE_API void EnsureAllIndicesHaveHandles_Internal(int32 NumKeys) const;
83
84protected:
85
87 const int32* FindIndex(FKeyHandle KeyHandle) const { return KeyHandlesToIndices.Find(KeyHandle); }
88
90 ENGINE_API int32 GetIndex(FKeyHandle KeyHandle) const;
91
93 ENGINE_API FKeyHandle GetKeyHandle(int32 KeyIndex) const;
94
95protected:
96
99 mutable FKeyHandleMap KeyHandlesToIndices;
100};
101
102template<>
104{
105 enum
106 {
107 WithPureVirtual = true,
108 };
109};
#define PURE_VIRTUAL(func,...)
Definition CoreMiscDefines.h:103
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
Definition Array.h:64
Definition IndexedCurve.h:18
FIndexedCurve()
Definition IndexedCurve.h:24
FKeyHandle GetLastKeyHandle() const
Definition IndexedCurve.h:59
virtual int32 GetNumKeys() const PURE_VIRTUAL(FIndexedCurve
Definition IndexedCurve.h:41
void EnsureAllIndicesHaveHandles() const
Definition IndexedCurve.h:78
TArray< FKeyHandle >::TConstIterator GetKeyHandleIterator() const
Definition IndexedCurve.h:34
virtual ~FIndexedCurve()
Definition IndexedCurve.h:26
void EnsureIndexHasAHandle(int32 KeyIndex) const
Definition IndexedCurve.h:79
const int32 * FindIndex(FKeyHandle KeyHandle) const
Definition IndexedCurve.h:87
Definition KeyHandle.h:69
Definition KeyHandle.h:15
static ENGINE_API FKeyHandle Invalid()
Definition KeyHandle.cpp:37
Definition StructOpsTypeTraits.h:11
Definition StructOpsTypeTraits.h:46