UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MovieSceneCurveChannelImpl.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
10#include "Curves/RealCurve.h"
11#include "Curves/RichCurve.h"
12#include "KeyParams.h"
13#include "MovieSceneFwd.h"
14
15
20
21
23template<typename ChannelType>
25{
27 using ChannelValueType = typename ChannelType::ChannelValueType;
29 using CurveValueType = typename ChannelType::CurveValueType;
30
39
43 static bool Evaluate(const ChannelType* InChannel, FFrameTime InTime, CurveValueType& OutValue);
44
50
53
56
57 /*
58 * Populate the specified array with times and values that represent the smooth interpolation of
59 * the given channel across the specified range
60 */
61 static void PopulateCurvePoints(const ChannelType* InChannel, double StartTimeSeconds, double EndTimeSeconds, double TimeThreshold, CurveValueType ValueThreshold, FFrameRate TickResolution, TArray<TTuple<double, double>>& OutPoints);
62
64 static bool ValueExistsAtTime(const ChannelType* Channel, FFrameNumber InFrameNumber, typename ChannelType::CurveValueType Value);
65
67 static bool ValueExistsAtTime(const ChannelType* Channel, FFrameNumber InFrameNumber, const typename ChannelType::ChannelValueType& InValue);
68
69
70
75
78
81
84
86 static float CalcSmartTangent(ChannelType* InChannel, int32 Index);
87
89 static void AutoSetTangents(ChannelType* InChannel, float Tension = 0.f);
90
92 static void DeleteKeysFrom(ChannelType* InChannel, FFrameNumber InTime, bool bDeleteKeysBefore);
93
95 UE_DEPRECATED(5.6, "Please use RemapTimes")
96 static void ChangeFrameResolution(ChannelType* InChannel, FFrameRate SourceRate, FFrameRate DestinationRate);
97
99 static void RemapTimes(ChannelType* InChannel, const UE::MovieScene::IRetimingInterface& Retimer);
100
103
106
108 static double GetTangentValue(ChannelType* InChannel, const FFrameNumber InFrameTime, const float InValue, double InDeltaTime);
109
119
127 static bool CacheExtrapolation(const ChannelType* InChannel, FFrameTime InTime, UE::MovieScene::Interpolation::FCachedInterpolation& OutValue);
128
130 static void Dilate(ChannelType* InChannel, FFrameNumber Origin, float DilationFactor);
131
134
138 static bool Serialize(ChannelType* InChannel, FArchive& Ar);
139
141 static bool SerializeFromRichCurve(ChannelType* InChannel, const FPropertyTag& Tag, FStructuredArchive::FSlot Slot);
142
145
146
152
153private:
154
161 static int32 InsertKeyInternal(ChannelType* InChannel, FFrameNumber InTime);
162
164};
165
166template<typename ChannelType>
169{
170 using OtherChannelValueType = typename OtherChannelType::ChannelValueType;
171 using OtherCurveValueType = typename OtherChannelType::CurveValueType;
172
173 OutDestinationChannel->PreInfinityExtrap = InSourceChannel->PreInfinityExtrap;
174 OutDestinationChannel->PostInfinityExtrap = InSourceChannel->PostInfinityExtrap;
175
178 OutDestinationChannel->bHasDefaultValue = OtherChannelDefaultValue.IsSet();
179
182 OutDestinationChannel->Times.Empty(OtherChannelTimes.Num());
183 OutDestinationChannel->Values.Empty(OtherChannelValues.Num());
184 for (int32 Index = 0; Index < OtherChannelTimes.Num(); ++Index)
185 {
187
190 NewDoubleValue.Tangent = OtherChannelValue.Tangent;
191 NewDoubleValue.InterpMode = OtherChannelValue.InterpMode;
192 NewDoubleValue.TangentMode = OtherChannelValue.TangentMode;
194 }
195
196 OutDestinationChannel->TickResolution = InSourceChannel->GetTickResolution();
197
198#if WITH_EDITORONLY_DATA
199 OutDestinationChannel->bShowCurve = InSourceChannel->GetShowCurve();
200#endif
201}
202
203
@ INDEX_NONE
Definition CoreMiscDefines.h:150
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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
EMovieSceneKeyInterpolation
Definition KeyParams.h:12
ERichCurveTangentMode
Definition RichCurve.h:16
Definition Archive.h:1208
Definition StructuredArchive.h:57
Definition MovieScene.Build.cs:6
Definition ArrayView.h:139
Definition Array.h:670
Definition MovieSceneCurveChannelImpl.h:17
Definition AdvancedWidgetsModule.cpp:13
U16 Index
Definition radfft.cpp:71
Definition FrameNumber.h:18
Definition FrameRate.h:21
Definition FrameTime.h:16
Definition MovieSceneChannelTraits.h:20
Definition KeyHandle.h:15
Definition MovieSceneCurveChannelCommon.h:26
Definition PropertyTag.h:38
Definition MovieSceneCurveChannelImpl.h:33
double InterpValue
Definition MovieSceneCurveChannelImpl.h:34
int32 Index2
Definition MovieSceneCurveChannelImpl.h:35
FFrameTime CacheFrameTime
Definition MovieSceneCurveChannelImpl.h:37
int32 CachedNumFrames
Definition MovieSceneCurveChannelImpl.h:36
int32 Index1
Definition MovieSceneCurveChannelImpl.h:35
Definition MovieSceneCurveChannelImpl.h:25
static UE::MovieScene::Interpolation::FCachedInterpolation GetInterpolationForTime(const ChannelType *InChannel, FFrameTime InTime)
Definition MovieSceneCurveChannelImpl.cpp:294
static bool EvaluateWithCache(const ChannelType *InChannel, FTimeEvaluationCache *InOutEvaluationCache, FFrameTime InTime, CurveValueType &OutValue)
Definition MovieSceneCurveChannelImpl.cpp:550
static EMovieSceneKeyInterpolation GetInterpolationMode(ChannelType *InChannel, const FFrameNumber &InTime, EMovieSceneKeyInterpolation DefaultInterpolationMode)
Definition MovieSceneCurveChannelImpl.cpp:925
typename ChannelType::CurveValueType CurveValueType
Definition MovieSceneCurveChannelImpl.h:29
static void AutoSetTangents(ChannelType *InChannel, float Tension=0.f)
Definition MovieSceneCurveChannelImpl.cpp:682
static void CopyChannel(const OtherChannelType *InSourceChannel, ChannelType *OutDestinationChannel)
Definition MovieSceneCurveChannelImpl.h:168
static bool SerializeFromRichCurve(ChannelType *InChannel, const FPropertyTag &Tag, FStructuredArchive::FSlot Slot)
Definition MovieSceneCurveChannelImpl.cpp:1224
static double GetTangentValue(ChannelType *InChannel, const FFrameNumber InFrameTime, const float InValue, double InDeltaTime)
Definition MovieSceneCurveChannelImpl.cpp:973
static int32 AddCubicKey(ChannelType *InChannel, FFrameNumber InTime, CurveValueType InValue, ERichCurveTangentMode TangentMode=RCTM_Auto, const FMovieSceneTangentData &Tangent=FMovieSceneTangentData())
Definition MovieSceneCurveChannelImpl.cpp:186
static void DeleteKeysFrom(ChannelType *InChannel, FFrameNumber InTime, bool bDeleteKeysBefore)
Definition MovieSceneCurveChannelImpl.cpp:836
static void Optimize(ChannelType *InChannel, const FKeyDataOptimizationParams &InParameters)
Definition MovieSceneCurveChannelImpl.cpp:879
static FKeyHandle AddKeyToChannel(ChannelType *InChannel, FFrameNumber InFrameNumber, float InValue, EMovieSceneKeyInterpolation Interpolation)
Definition MovieSceneCurveChannelImpl.cpp:1017
static int32 AddLinearKey(ChannelType *InChannel, FFrameNumber InTime, CurveValueType InValue)
Definition MovieSceneCurveChannelImpl.cpp:172
static bool CacheExtrapolation(const ChannelType *InChannel, FFrameTime InTime, UE::MovieScene::Interpolation::FCachedInterpolation &OutValue)
Definition MovieSceneCurveChannelImpl.cpp:202
static void ChangeFrameResolution(ChannelType *InChannel, FFrameRate SourceRate, FFrameRate DestinationRate)
Definition MovieSceneCurveChannelImpl.cpp:857
static bool ValueExistsAtTime(const ChannelType *Channel, FFrameNumber InFrameNumber, typename ChannelType::CurveValueType Value)
Definition MovieSceneCurveChannelImpl.cpp:1105
static int32 AddConstantKey(ChannelType *InChannel, FFrameNumber InTime, CurveValueType InValue)
Definition MovieSceneCurveChannelImpl.cpp:158
static UE::MovieScene::Interpolation::FCachedInterpolation GetInterpolationForKey(const ChannelType *InChannel, int32 KeyIndex, const UE::MovieScene::FCycleParams *Params=nullptr)
Definition MovieSceneCurveChannelImpl.cpp:409
static bool SerializeChannelValue(ChannelValueType &InValue, FArchive &Ar)
Definition MovieSceneCurveChannelImpl.cpp:1273
static void RemapTimes(ChannelType *InChannel, const UE::MovieScene::IRetimingInterface &Retimer)
Definition MovieSceneCurveChannelImpl.cpp:863
typename ChannelType::ChannelValueType ChannelValueType
Definition MovieSceneCurveChannelImpl.h:27
static void Dilate(ChannelType *InChannel, FFrameNumber Origin, float DilationFactor)
Definition MovieSceneCurveChannelImpl.cpp:1066
static bool Evaluate(const ChannelType *InChannel, FFrameTime InTime, CurveValueType &OutValue)
Definition MovieSceneCurveChannelImpl.cpp:544
static float CalcSmartTangent(ChannelType *InChannel, int32 Index)
Definition MovieSceneCurveChannelImpl.cpp:593
static void PopulateCurvePoints(const ChannelType *InChannel, double StartTimeSeconds, double EndTimeSeconds, double TimeThreshold, CurveValueType ValueThreshold, FFrameRate TickResolution, TArray< TTuple< double, double > > &OutPoints)
Definition MovieSceneCurveChannelImpl.cpp:1089
static void AssignValue(ChannelType *InChannel, FKeyHandle InKeyHandle, typename ChannelType::CurveValueType InValue)
Definition MovieSceneCurveChannelImpl.cpp:1077
Definition Optional.h:131
constexpr const OptionalType & Get(const OptionalType &DefaultValue UE_LIFETIMEBOUND) const UE_LIFETIMEBOUND
Definition Optional.h:472
Definition Tuple.h:652
Definition MovieSceneChannel.h:60
Definition MovieSceneInterpolation.h:460