UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TimelineComponent.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 "TimelineComponent.generated.h"
9
10class UCurveFloat;
12class UCurveVector;
13
22
31
33UENUM()
39
41UENUM(BlueprintType)
43{
44 enum Type : int
45 {
48 };
49}
50
52USTRUCT()
54{
56
57
58 UPROPERTY()
60
62 UPROPERTY()
64
65
67 : Time(0)
68 {
69 }
70
71};
72
74USTRUCT()
76{
78
79
80 UPROPERTY()
81 TObjectPtr<class UCurveVector> VectorCurve;
82
84 UPROPERTY()
86
88 UPROPERTY()
89 FName TrackName;
90
92 UPROPERTY()
93 FName VectorPropertyName;
94
96 FStructProperty* VectorProperty;
97
99 FOnTimelineVectorStatic InterpFuncStatic;
100
102 : VectorCurve(NULL)
103 , VectorPropertyName(NAME_None)
104 , VectorProperty(NULL)
105 {
106 }
107
108};
109
111USTRUCT()
113{
115
116
117 UPROPERTY()
118 TObjectPtr<class UCurveFloat> FloatCurve;
119
121 UPROPERTY()
123
125 UPROPERTY()
126 FName TrackName;
127
129 UPROPERTY()
130 FName FloatPropertyName;
131
133 FFloatProperty* FloatProperty;
134
136 FOnTimelineFloatStatic InterpFuncStatic;
137
139 : FloatCurve(NULL)
140 , FloatPropertyName(NAME_None)
141 , FloatProperty(NULL)
142 {
143 }
144
145};
146
147
149USTRUCT()
151{
153
154
155 UPROPERTY()
156 TObjectPtr<class UCurveLinearColor> LinearColorCurve;
157
159 UPROPERTY()
161
163 UPROPERTY()
164 FName TrackName;
165
167 UPROPERTY()
168 FName LinearColorPropertyName;
169
171 FStructProperty* LinearColorProperty;
172
175
177 : LinearColorCurve(NULL)
178 , LinearColorPropertyName(NAME_None)
179 , LinearColorProperty(NULL)
180 {
181 }
182
183};
184
185USTRUCT()
187{
189
190private:
192 UPROPERTY(NotReplicated)
194
196 UPROPERTY()
197 uint8 bLooping:1;
198
200 UPROPERTY()
201 uint8 bReversePlayback:1;
202
203 UE_DEPRECATED(5.5, "Use PlayingStateTracker instead")
204 UPROPERTY(Meta = (DeprecatedProperty, DeprecationMessage = "This property is no longer supported. Use PlayingStateTracker instead"))
205 uint8 bPlaying_DEPRECATED:1;
206
217 UPROPERTY()
218 uint8 PlayingStateTracker;
219
221 UPROPERTY(NotReplicated)
222 float Length;
223
225 UPROPERTY()
226 float PlayRate;
227
229 UPROPERTY()
230 float Position;
231
233 UPROPERTY(NotReplicated)
235
237 UPROPERTY(NotReplicated)
239
241 UPROPERTY(NotReplicated)
243
245 UPROPERTY(NotReplicated)
247
249 UPROPERTY(NotReplicated)
250 FOnTimelineEvent TimelinePostUpdateFunc;
251
253 UPROPERTY(NotReplicated)
254 FOnTimelineEvent TimelineFinishedFunc;
255
257 UPROPERTY(NotReplicated)
258 TWeakObjectPtr<UObject> PropertySetObject;
259
261 UPROPERTY(NotReplicated)
262 FName DirectionPropertyName;
263
265 FOnTimelineEventStatic TimelineFinishFuncStatic;
266
268 FProperty* DirectionProperty;
269
270public:
271
273
275 : LengthMode( TL_LastKeyFrame )
276 , bLooping( false )
277 , bReversePlayback( false )
278 , bPlaying_DEPRECATED ( false )
279 , PlayingStateTracker( 2 )
280 , Length( 5.f )
281 , PlayRate( 1.f )
282 , Position( 0.0f )
283 , PropertySetObject(nullptr)
284 , DirectionProperty(nullptr)
285 {
286 }
287
288 // Note: We need to explicitly disable warnings on these constructors/operators for clang to be happy with deprecated variables
289 ~FTimeline() = default;
290 FTimeline(const FTimeline&) = default;
291 FTimeline(FTimeline&&) = default;
292 FTimeline& operator=(const FTimeline&) = default;
294
296
298 ENGINE_API static UEnum* GetTimelineDirectionEnum();
299
301 ENGINE_API void Play();
302
304 ENGINE_API void PlayFromStart();
305
307 ENGINE_API void Reverse();
308
310 ENGINE_API void ReverseFromEnd();
311
313 ENGINE_API void Stop();
314
316 ENGINE_API bool IsPlaying() const;
317
319 ENGINE_API bool IsReversing() const;
320
322 ENGINE_API void SetPlaybackPosition(float NewPosition, bool bFireEvents, bool bFireUpdate = true);
323
325 ENGINE_API float GetPlaybackPosition() const;
326
328 ENGINE_API void SetLooping(bool bNewLooping);
329
331 ENGINE_API bool IsLooping() const;
332
334 ENGINE_API void SetPlayRate(float NewRate);
335
337 ENGINE_API float GetPlayRate() const;
338
340 ENGINE_API void SetNewTime(float NewTime);
341
343 ENGINE_API float GetTimelineLength() const;
344
346 ENGINE_API float GetScaledTimelineLength() const;
347
349 ENGINE_API void SetTimelineLengthMode(ETimelineLengthMode NewMode);
350
352 ENGINE_API void SetTimelineLength(float NewLength);
353
356
359
362
364 ENGINE_API void SetPropertySetObject(UObject* NewPropertySetObject);
365
367 ENGINE_API void SetTimelinePostUpdateFunc(FOnTimelineEvent NewTimelinePostUpdateFunc);
368
370 ENGINE_API void SetTimelineFinishedFunc(FOnTimelineEvent NewTimelineFinishedFunc);
371
373 ENGINE_API void SetTimelineFinishedFunc(FOnTimelineEventStatic NewTimelineFinishedFunc);
374
376 ENGINE_API void AddEvent(float Time, FOnTimelineEvent EventFunc);
377
379 ENGINE_API void AddInterpVector(UCurveVector* VectorCurve, FOnTimelineVector InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None);
380
382 ENGINE_API void AddInterpVector(UCurveVector* VectorCurve, FOnTimelineVectorStatic InterpFunc);
383
385 ENGINE_API void AddInterpFloat(UCurveFloat* FloatCurve, FOnTimelineFloat InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None);
386
388 ENGINE_API void AddInterpFloat(UCurveFloat* FloatCurve, FOnTimelineFloatStatic InterpFunc );
389
391 ENGINE_API void AddInterpLinearColor(UCurveLinearColor* LinearColorCurve, FOnTimelineLinearColor InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None);
392
394 ENGINE_API void AddInterpLinearColor(UCurveLinearColor* LinearColorCurve, FOnTimelineLinearColorStatic InterpFunc);
395
396
398 ENGINE_API void TickTimeline(float DeltaTime);
399
401 ENGINE_API void SetDirectionPropertyName(FName InDirectionPropertyName);
402
404 void GetAllCurves(TSet<class UCurveBase*>& InOutCurves) const;
405
406 ENGINE_API bool Serialize(FArchive& Ar);
407 ENGINE_API void PostSerialize(const FArchive& Ar);
408
409private:
411 float GetLastKeyframeTime() const;
412
418 void ChangeMarkPlayingState(const bool bIsPlaying);
419};
420
421// Need to customize serialization to safely update the old bPlaying flag to the newer play state tracer
422template<> struct TStructOpsTypeTraits<FTimeline> : public TStructOpsTypeTraitsBase2<FTimeline>
423{
424 enum
425 {
428 };
429};
430
436UCLASS(MinimalAPI)
438{
440
441private:
442
444 UPROPERTY(ReplicatedUsing=OnRep_Timeline)
445 FTimeline TheTimeline;
446
448 UPROPERTY()
449 uint32 bIgnoreTimeDilation : 1;
450
451public:
452
454 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
455 ENGINE_API void Play();
456
458 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
459 ENGINE_API void PlayFromStart();
460
462 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
463 ENGINE_API void Reverse();
464
466 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
467 ENGINE_API void ReverseFromEnd();
468
470 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
471 ENGINE_API void Stop();
472
474 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
475 ENGINE_API bool IsPlaying() const;
476
478 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
479 ENGINE_API bool IsReversing() const;
480
485 UFUNCTION(BlueprintCallable, Category="Components|Timeline", meta=(AdvancedDisplay="bFireUpdate"))
486 ENGINE_API void SetPlaybackPosition(float NewPosition, bool bFireEvents, bool bFireUpdate = true);
487
489 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
490 ENGINE_API float GetPlaybackPosition() const;
491
493 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
494 ENGINE_API void SetLooping(bool bNewLooping);
495
497 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
498 ENGINE_API bool IsLooping() const;
499
501 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
502 ENGINE_API void SetPlayRate(float NewRate);
503
505 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
506 ENGINE_API float GetPlayRate() const;
507
509 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
510 ENGINE_API void SetNewTime(float NewTime);
511
513 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
514 ENGINE_API float GetTimelineLength() const;
515
517 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
518 ENGINE_API float GetScaledTimelineLength() const;
519
521 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
522 ENGINE_API void SetTimelineLength(float NewLength);
523
525 UFUNCTION(BlueprintCallable, Category="Components|Timeline")
526 ENGINE_API void SetTimelineLengthMode(ETimelineLengthMode NewLengthMode);
527
529 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
530 ENGINE_API void SetIgnoreTimeDilation(bool bNewIgnoreTimeDilation);
531
533 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
534 ENGINE_API bool GetIgnoreTimeDilation() const;
535
537 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
539
541 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
543
545 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
547
548 UFUNCTION()
549 void OnRep_Timeline(FTimeline& OldTimeline);
550
551 //~ Begin ActorComponent Interface.
552 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
553 virtual void Activate(bool bReset=false) override;
554 virtual void Deactivate() override;
555 virtual bool IsReadyForOwnerToAutoDestroy() const override;
556 //~ End ActorComponent Interface.
557
558 //~ Begin UObject Interface.
559 virtual bool IsPostLoadThreadSafe() const override;
560 //~ End UObject Interface
561
563 ENGINE_API static UFunction* GetTimelineEventSignature();
565 ENGINE_API static UFunction* GetTimelineFloatSignature();
567 ENGINE_API static UFunction* GetTimelineVectorSignature();
569 ENGINE_API static UFunction* GetTimelineLinearColorSignature();
570
572 static ETimelineSigType GetTimelineSignatureForFunction(const UFunction* InFunc);
573
575 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
576 ENGINE_API void AddEvent(float Time, FOnTimelineEvent EventFunc);
577
579 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
580 ENGINE_API void AddInterpVector(UCurveVector* VectorCurve, FOnTimelineVector InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None);
581 ENGINE_API void AddInterpVector(UCurveVector* VectorCurve, FOnTimelineVectorStatic InterpFunc);
582
584 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
585 ENGINE_API void AddInterpFloat(UCurveFloat* FloatCurve, FOnTimelineFloat InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None);
586 ENGINE_API void AddInterpFloat(UCurveFloat* FloatCurve, FOnTimelineFloatStatic InterpFunc);
587
589 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
590 ENGINE_API void AddInterpLinearColor(UCurveLinearColor* LinearColorCurve, FOnTimelineLinearColor InterpFunc, FName PropertyName = NAME_None, FName TrackName = NAME_None);
591 ENGINE_API void AddInterpLinearColor(UCurveLinearColor* LinearColorCurve, FOnTimelineLinearColorStatic InterpFunc);
592
594 ENGINE_API void SetPropertySetObject(UObject* NewPropertySetObject);
595
597 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
598 ENGINE_API void SetTimelinePostUpdateFunc(FOnTimelineEvent NewTimelinePostUpdateFunc);
599
601 UFUNCTION(BlueprintCallable, Category = "Components|Timeline")
602 ENGINE_API void SetTimelineFinishedFunc(FOnTimelineEvent NewTimelineFinishedFunc);
604 ENGINE_API void SetTimelineFinishedFunc(FOnTimelineEventStatic NewTimelineFinishedFunc);
605
607 ENGINE_API void SetDirectionPropertyName(FName DirectionPropertyName);
608
610 ENGINE_API void GetAllCurves(TSet<class UCurveBase*>& InOutCurves) const;
611};
#define NULL
Definition oodle2base.h:134
virtual bool IsPostLoadThreadSafe() const override
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DELEGATE(DelegateName)
Definition DelegateCombinations.h:20
#define DECLARE_DELEGATE_OneParam(DelegateName, Param1Type)
Definition DelegateCombinations.h:48
#define DECLARE_DYNAMIC_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:52
#define DECLARE_DYNAMIC_DELEGATE(DelegateName)
Definition DelegateCombinations.h:35
ELevelTick
Definition EngineBaseTypes.h:70
ETimelineSigType
Definition EngineTypes.h:1559
#define PRAGMA_ENABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:12
#define PRAGMA_DISABLE_DEPRECATION_WARNINGS
Definition GenericPlatformCompilerPreSetup.h:8
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
@ Stop
Definition PrecomputedVolumetricLightmapStreaming.cpp:26
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
ETimelineLengthMode
Definition TimelineComponent.h:35
@ TL_LastKeyFrame
Definition TimelineComponent.h:37
@ TL_TimelineLength
Definition TimelineComponent.h:36
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition UnrealType.h:2465
Definition NameTypes.h:617
Definition UnrealType.h:174
Definition UnrealType.h:6306
Definition Array.h:670
Definition EnumAsByte.h:22
Definition ActorComponent.h:152
Definition CurveFloat.h:31
Definition CurveLinearColor.h:29
Definition CurveVector.h:31
Definition Class.h:2791
Definition Class.h:2476
Definition Object.h:95
Definition TimelineComponent.h:438
Definition TimelineComponent.h:43
Type
Definition TimelineComponent.h:45
@ false
Definition radaudio_common.h:23
Definition EngineBaseTypes.h:571
Definition Color.h:48
Definition TimelineComponent.h:54
Definition TimelineComponent.h:113
Definition TimelineComponent.h:151
Definition TimelineComponent.h:76
Definition TimelineComponent.h:187
FTimeline(FTimeline &&)=default
FTimeline & operator=(const FTimeline &)=default
FTimeline(const FTimeline &)=default
FTimeline & operator=(FTimeline &&)=default
PRAGMA_DISABLE_DEPRECATION_WARNINGS FTimeline()
Definition TimelineComponent.h:274
~FTimeline()=default
Definition ObjectPtr.h:488
Definition StructOpsTypeTraits.h:11
@ WithSerializer
Definition StructOpsTypeTraits.h:23
@ WithPostSerialize
Definition StructOpsTypeTraits.h:25
Definition StructOpsTypeTraits.h:46
Definition WeakObjectPtrTemplates.h:25