UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IKeyFrameManipulator.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"
6#include "Curves/KeyHandle.h"
7
8template<typename TimeType> class TKeyFrameManipulator;
9template<typename TimeType> struct TKeyTimeIterator;
10
15template<typename TimeType = float>
17{
18public:
19
20 // Pass by value/ref parameter type
22
30 {
31 return AddKeyImpl(InTime);
32 }
33
40 inline void SetKeyTime(FKeyHandle KeyHandle, TimeTypeRef NewTime)
41 {
42 SetKeyTimeImpl(KeyHandle, NewTime);
43 }
44
45
51 inline void RemoveKey(FKeyHandle KeyHandle)
52 {
53 RemoveKeyImpl(KeyHandle);
54 }
55
63 {
64 return GetKeyTimeImpl(KeyHandle);
65 }
66
74 {
75 auto Predicate = [=](TimeTypeRef InTime) { return FMath::IsNearlyEqual(KeyTime, KeyTimeTolerance); };
76 return FindKeyImpl(Predicate);
77 }
78
79private:
80
87 virtual FKeyHandle AddKeyImpl(TimeTypeRef InTime) = 0;
88
95 virtual void SetKeyTimeImpl(FKeyHandle KeyHandle, TimeTypeRef NewTime) = 0;
96
102 virtual void RemoveKeyImpl(FKeyHandle KeyHandle) = 0;
103
110 virtual TOptional<TimeType> GetKeyTimeImpl(FKeyHandle KeyHandle) const = 0;
111
118 virtual TOptional<FKeyHandle> FindKeyImpl(const TFunctionRef<bool(TimeTypeRef)>& InPredicate) const = 0;
119
125 virtual TKeyTimeIterator<TimeType> IterateKeysImpl() const = 0;
126};
127
128template<typename> class TKeyFrameManipulator;
129
133template<typename TimeType>
135{
140
142 {
143 ++Index;
144 return *this;
145 }
146
148 inline explicit operator bool() const
149 {
150 return Index < Manipulator.KeyTimes->Num();
151 }
153 inline bool operator !() const
154 {
155 return !(bool)*this;
156 }
157
158 inline bool operator==(const TKeyTimeIterator& RHS) const
159 {
160 return Manipulator.KeyTimes == RHS.Manipulator.KeyTimes && Index == RHS.Index;
161 }
162
163 inline friend bool operator!=(const TKeyTimeIterator& LHS, const TKeyTimeIterator& RHS)
164 {
165 return !(LHS == RHS);
166 }
167
168 inline TimeType operator*() const
169 {
170 return (*Manipulator.KeyTimes)[Index];
171 }
172
174 {
175 return Manipulator.KeyHandleLUT->FindOrAddKeyHandle(Index);
176 }
177
179 {
180 return 0;
181 }
182
184 {
185 return Manipulator.KeyTimes->Num();
186 }
187
189 {
191 NewIter.Index = Iter.GetStartIndex();
192 return NewIter;
193 }
195 {
197 NewIter.Index = NewIter.GetEndIndex();
198 return NewIter;
199 }
200
201private:
202 const TKeyFrameManipulator<TimeType>& Manipulator;
203 int32 Index;
204};
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
const bool
Definition NetworkReplayStreaming.h:178
Definition IKeyFrameManipulator.h:17
TOptional< TimeType > GetKeyTime(FKeyHandle KeyHandle) const
Definition IKeyFrameManipulator.h:62
void SetKeyTime(FKeyHandle KeyHandle, TimeTypeRef NewTime)
Definition IKeyFrameManipulator.h:40
void RemoveKey(FKeyHandle KeyHandle)
Definition IKeyFrameManipulator.h:51
TOptional< FKeyHandle > FindKey(TimeTypeRef KeyTime, TimeTypeRef KeyTimeTolerance) const
Definition IKeyFrameManipulator.h:73
TCallTraits< TimeType >::ParamType TimeTypeRef
Definition IKeyFrameManipulator.h:21
FKeyHandle AddKey(TimeTypeRef InTime)
Definition IKeyFrameManipulator.h:29
Definition AssetRegistryState.h:50
Definition KeyFrameManipulator.h:17
U16 Index
Definition radfft.cpp:71
Definition KeyHandle.h:15
static UE_FORCEINLINE_HINT bool IsNearlyEqual(float A, float B, float ErrorTolerance=UE_SMALL_NUMBER)
Definition UnrealMathUtility.h:388
TCallTraitsParamTypeHelper< T, PassByValue >::ParamType ParamType
Definition UnrealTypeTraits.h:275
Definition IKeyFrameManipulator.h:135
friend bool operator!=(const TKeyTimeIterator &LHS, const TKeyTimeIterator &RHS)
Definition IKeyFrameManipulator.h:163
bool operator!() const
Definition IKeyFrameManipulator.h:153
TKeyTimeIterator(const TKeyFrameManipulator< TimeType > &InManipulator)
Definition IKeyFrameManipulator.h:136
bool operator==(const TKeyTimeIterator &RHS) const
Definition IKeyFrameManipulator.h:158
FKeyHandle GetKeyHandle()
Definition IKeyFrameManipulator.h:173
int32 GetEndIndex() const
Definition IKeyFrameManipulator.h:183
friend TKeyTimeIterator< TimeType > begin(const TKeyTimeIterator< TimeType > &Iter)
Definition IKeyFrameManipulator.h:188
int32 GetStartIndex() const
Definition IKeyFrameManipulator.h:178
TKeyTimeIterator & operator++()
Definition IKeyFrameManipulator.h:141
TimeType operator*() const
Definition IKeyFrameManipulator.h:168
friend TKeyTimeIterator< TimeType > end(const TKeyTimeIterator< TimeType > &Iter)
Definition IKeyFrameManipulator.h:194
Definition Optional.h:131