UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MovieSceneTimeWarping.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreMinimal.h"
7#include "HAL/Platform.h"
8#include "Math/Range.h"
9#include "Math/RangeBound.h"
11#include "Misc/FrameNumber.h"
12#include "Misc/FrameTime.h"
15
16#include "MovieSceneTimeWarping.generated.h"
17
22USTRUCT()
24{
25 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
26 MOVIESCENE_API static const uint32 InvalidWarpCount;
27
29
31 : Start(0)
32 , End(0)
33 {}
34
36 : Start(InStart)
37 , End(InEnd)
38 {
39 check(Start <= End);
40 }
41
45 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
46 FFrameNumber Length() const { return End - Start; }
47
51 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
52 bool IsValid() const { return End > Start; }
53
57 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
64
68 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
69 FMovieSceneTimeTransform InverseFromWarp(uint32 WarpCount) const;
70
74 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
75 void TransformFrame(FFrameNumber InFrame, FFrameNumber& OutFrame, uint32& OutWarpIndex) const;
76
80 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
81 void TransformTime(FFrameTime InTime, FFrameTime& OutTime, uint32& OutWarpIndex) const;
82
87 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
88 void TransformTimeSpecific(FFrameTime InTime, uint32 WarpCount, FFrameTime& OutTime) const;
89
96 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
97 TRange<FFrameTime> TransformRangePure(const TRange<FFrameTime>& Range) const;
98
105 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
106 TRange<FFrameTime> TransformRangeUnwarped(const TRange<FFrameTime>& Range) const;
107
115 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
116 TRange<FFrameTime> TransformRangeConstrained(const TRange<FFrameTime>& Range) const;
117
118 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
120 {
121 return A.Start == B.Start && A.End == B.End;
122 }
123
124 UE_DEPRECATED(5.5, "Please update your code to the new FMovieSceneSequenceTransform API. The closest analogue is FMovieSceneTimeWarpLoop.")
126 {
127 return A.Start != B.Start || A.End != B.End;
128 }
129
130 UPROPERTY()
132
133 UPROPERTY()
135};
136
138
140{
141 checkSlow(RHS.IsValid());
142 const FFrameNumber WarpLength = RHS.Length();
143 return (InFrame - RHS.Start) % WarpLength + RHS.Start;
144}
145
147{
148 checkSlow(RHS.IsValid());
149 const FFrameNumber WarpLength = RHS.Length();
150 return (InTime - RHS.Start) % WarpLength + RHS.Start;
151}
152
154{
155 InFrame = InFrame * RHS;
156 return InFrame;
157}
158
160{
161 InTime = InTime * RHS;
162 return InTime;
163}
164
180
194
196{
198 const FFrameTime WarpLength = Length();
199 OutWarpIndex = 0;
200 FFrameTime TempTime = InTime - Start;
201 while (TempTime >= WarpLength)
202 {
203 TempTime = TempTime - WarpLength;
204 ++OutWarpIndex;
205 }
206 OutTime = TempTime + Start;
207}
208
210{
212 const FFrameTime WarpLength = Length();
213 FFrameTime TempTime = InTime - Start;
215 {
216 TempTime = TempTime - WarpLength;
217 }
218 OutTime = TempTime + Start;
219}
220
243
245{
247
248 if (!Range.GetLowerBound().IsOpen() && !Range.GetUpperBound().IsOpen())
249 {
250 const TRangeBound<FFrameTime> SourceLower = Range.GetLowerBound();
253 TRangeBound<FFrameTime>::Inclusive(SourceLower.GetValue() * (*this)) :
255
256 const FFrameTime RangeSize = Range.Size<FFrameTime>();
257 const FFrameTime TransformedUpperValue = TransformedLower.GetValue() + RangeSize;
259 Range.GetUpperBound().IsInclusive() ?
262
264 }
265 else
266 {
267 return TransformRangePure(Range);
268 }
269}
270
272{
274
275 if (!Range.GetLowerBound().IsOpen() && !Range.GetUpperBound().IsOpen())
276 {
278 const FFrameTime RangeSize = Range.Size<FFrameTime>();
279 if (RangeSize >= WarpLength)
280 {
281 // If the range is longer than a loop, we could, in theory, end up with a disjointed range, like, for
282 // example, a range that starts in the first loop and ends in the second loop. Regardless of whether
283 // we actually finished a full loop or not, we need here to take the "hull" of that, which is always
284 // the looping range inside our local space.
285 return GetRange();
286 }
287
289 if (UnwarpedTransformedRange.GetUpperBoundValue() > End || UnwarpedTransformedRange.GetLowerBoundValue() < Start)
290 {
291 // The input range is going over a warp boundary, so we return the whole warping range.
292 return GetRange();
293 }
294
295 // The input range fits inside a single loop, so we can return that.
297 }
298 else
299 {
300 // One of the bounds is open, so we are looping from or to infinitiy. That encompasses our whole
301 // looping range.
302 return GetRange();
303 }
304}
305
308{
309 return *FString::Printf(TEXT("[ %+i ⟳ %+i ]"), InWarping.Start.Value, InWarping.End.Value);
310}
311
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define check(expr)
Definition AssertionMacros.h:314
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
PRAGMA_DISABLE_DEPRECATION_WARNINGS FFrameNumber operator*(FFrameNumber InFrame, const FMovieSceneTimeWarping &RHS)
Definition MovieSceneTimeWarping.h:139
FString LexToString(const FMovieSceneTimeWarping &InWarping)
Definition MovieSceneTimeWarping.h:307
FFrameNumber & operator*=(FFrameNumber &InFrame, const FMovieSceneTimeWarping &RHS)
Definition MovieSceneTimeWarping.h:153
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define USTRUCT(...)
Definition ObjectMacros.h:746
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition RangeBound.h:36
static TRangeBound Inclusive(ElementValueOrConstRef Value)
Definition RangeBound.h:209
UE_FORCEINLINE_HINT bool IsInclusive() const
Definition RangeBound.h:145
UE_FORCEINLINE_HINT bool IsOpen() const
Definition RangeBound.h:155
static TRangeBound Exclusive(ElementValueOrConstRef Value)
Definition RangeBound.h:193
Definition Range.h:50
Definition FrameNumber.h:18
Definition FrameTime.h:16
Definition MovieSceneSequenceTransform.h:625
Definition MovieSceneTimeTransform.h:23
Definition MovieSceneTimeWarpVariantPayloads.h:70
Definition MovieSceneTimeWarping.h:24
void TransformTimeSpecific(FFrameTime InTime, uint32 WarpCount, FFrameTime &OutTime) const
Definition MovieSceneTimeWarping.h:209
bool IsValid() const
Definition MovieSceneTimeWarping.h:52
FFrameNumber Start
Definition MovieSceneTimeWarping.h:131
TRange< FFrameTime > TransformRangePure(const TRange< FFrameTime > &Range) const
Definition MovieSceneTimeWarping.h:221
void TransformFrame(FFrameNumber InFrame, FFrameNumber &OutFrame, uint32 &OutWarpIndex) const
Definition MovieSceneTimeWarping.h:181
FFrameNumber End
Definition MovieSceneTimeWarping.h:134
FMovieSceneTimeWarping(FFrameNumber InStart, FFrameNumber InEnd)
Definition MovieSceneTimeWarping.h:35
FFrameNumber Length() const
Definition MovieSceneTimeWarping.h:46
TRange< FFrameTime > TransformRangeUnwarped(const TRange< FFrameTime > &Range) const
Definition MovieSceneTimeWarping.h:244
static MOVIESCENE_API const uint32 InvalidWarpCount
Definition MovieSceneTimeWarping.h:26
TRange< FFrameTime > GetRange() const
Definition MovieSceneTimeWarping.h:58
FMovieSceneTimeTransform InverseFromWarp(uint32 WarpCount) const
Definition MovieSceneTimeWarping.h:165
TRange< FFrameTime > TransformRangeConstrained(const TRange< FFrameTime > &Range) const
Definition MovieSceneTimeWarping.h:271
void TransformTime(FFrameTime InTime, FFrameTime &OutTime, uint32 &OutWarpIndex) const
Definition MovieSceneTimeWarping.h:195