UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
AnimNode_SequencePlayer.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"
10#include "AnimNode_SequencePlayer.generated.h"
11
12
13// Sequence player node. Not instantiated directly, use FAnimNode_SequencePlayer or FAnimNode_SequencePlayer_Standalone
14USTRUCT(BlueprintInternalUseOnly)
16{
18
19protected:
20 // Corresponding state for PlayRateScaleBiasClampConstants
21 UPROPERTY()
22 FInputScaleBiasClampState PlayRateScaleBiasClampState;
23
24public:
25 // FAnimNode_AssetPlayerBase interface
26 ENGINE_API virtual float GetCurrentAssetTime() const override;
27 ENGINE_API virtual float GetCurrentAssetTimePlayRateAdjusted() const override;
28 ENGINE_API virtual float GetCurrentAssetLength() const override;
29 virtual UAnimationAsset* GetAnimAsset() const override { return GetSequence(); }
30 // End of FAnimNode_AssetPlayerBase interface
31
32 // FAnimNode_Base interface
33 ENGINE_API virtual void Initialize_AnyThread(const FAnimationInitializeContext& Context) override;
34 ENGINE_API virtual void CacheBones_AnyThread(const FAnimationCacheBonesContext& Context) override;
35 ENGINE_API virtual void UpdateAssetPlayer(const FAnimationUpdateContext& Context) override;
36 ENGINE_API virtual void Evaluate_AnyThread(FPoseContext& Output) override;
37 ENGINE_API virtual void GatherDebugData(FNodeDebugData& DebugData) override;
38 // End of FAnimNode_Base interface
39
40 ENGINE_API float GetTimeFromEnd(float CurrentNodeTime) const;
41 ENGINE_API float GetEffectiveStartPosition(const FAnimationBaseContext& Context) const;
42
43 // The animation sequence asset to play
44 virtual UAnimSequenceBase* GetSequence() const { return nullptr; }
45
46 // Should the animation loop back to the start when it reaches the end?
47 UE_DEPRECATED(5.3, "Please use IsLooping instead.")
48 virtual bool GetLoopAnimation() const final { return IsLooping(); }
49
50protected:
51 // Set the animation sequence asset to play
52 virtual bool SetSequence(UAnimSequenceBase* InSequence) { return false; }
53
54 // Set the animation to continue looping when it reaches the end
55 virtual bool SetLoopAnimation(bool bInLoopAnimation) { return false; }
56
57 // The Basis in which the PlayRate is expressed in. This is used to rescale PlayRate inputs.
58 // For example a Basis of 100 means that the PlayRate input will be divided by 100.
59 virtual float GetPlayRateBasis() const { return 1.0f; }
60
61 // The play rate multiplier. Can be negative, which will cause the animation to play in reverse.
62 virtual float GetPlayRate() const { return 1.0f; }
63
64 // Additional scaling, offsetting and clamping of PlayRate input.
65 // Performed after PlayRateBasis.
67
68 // The start position [range: 0 - sequence length] to use when initializing. When looping, play will still jump back to the beginning when reaching the end.
69 virtual float GetStartPosition() const { return 0.0f; }
70
71 // Use pose matching to choose the start position. Requires PoseSearch plugin.
72 virtual bool GetStartFromMatchingPose() const { return false; }
73
74 // Set the start time of this node.
75 // @return true if the value was set (it is dynamic), or false if it could not (it is not dynamic or pin exposed)
76 virtual bool SetStartPosition(float InStartPosition) { return false; }
77
78 // Set the play rate of this node.
79 // @return true if the value was set (it is dynamic), or false if it could not (it is not dynamic or pin exposed)
80 virtual bool SetPlayRate(float InPlayRate) { return false; }
81};
82
83// Sequence player node that can be used with constant folding
84USTRUCT(BlueprintInternalUseOnly)
86{
88
89protected:
90 friend class UAnimGraphNode_SequencePlayer;
91
92#if WITH_EDITORONLY_DATA
93 // The group name that we synchronize with (NAME_None if it is not part of any group).
94 UPROPERTY(EditAnywhere, Category=Sync, meta=(FoldProperty))
95 FName GroupName = NAME_None;
96
97 // The role this node can assume within the group (ignored if GroupName is not set)
98 UPROPERTY(EditAnywhere, Category=Sync, meta=(FoldProperty))
99 TEnumAsByte<EAnimGroupRole::Type> GroupRole = EAnimGroupRole::CanBeLeader;
100
101 // When enabled, acting as the leader, and using marker-based sync, this asset player will not sync to the previous leader's sync position when joining a sync group and before becoming the leader but instead force everyone else to match its position.
102 UPROPERTY(EditAnywhere, Category = Sync, meta = (FoldProperty, EditCondition = "GroupRole != EAnimGroupRole::TransitionFollower && GroupRole != EAnimGroupRole::AlwaysFollower", EditConditionHides))
103 bool bOverridePositionWhenJoiningSyncGroupAsLeader = false;
104
105 // How this node will synchronize with other animations.
106 UPROPERTY(EditAnywhere, Category=Sync, meta=(FoldProperty))
108
109 // If true, "Relevant anim" nodes that look for the highest weighted animation in a state will ignore this node
110 UPROPERTY(EditAnywhere, Category=Relevancy, meta=(FoldProperty, PinHiddenByDefault))
111 bool bIgnoreForRelevancyTest = false;
112#endif
113
114 // The animation sequence asset to play
115 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault, DisallowedClasses="/Script/Engine.AnimMontage"))
116 TObjectPtr<UAnimSequenceBase> Sequence = nullptr;
117
118#if WITH_EDITORONLY_DATA
119 // The Basis in which the PlayRate is expressed in. This is used to rescale PlayRate inputs.
120 // For example a Basis of 100 means that the PlayRate input will be divided by 100.
121 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault, FoldProperty))
122 float PlayRateBasis = 1.0f;
123
124 // The play rate multiplier. Can be negative, which will cause the animation to play in reverse.
125 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault, FoldProperty))
126 float PlayRate = 1.0f;
127
128 // Additional scaling, offsetting and clamping of PlayRate input.
129 // Performed after PlayRateBasis.
130 UPROPERTY(EditAnywhere, Category = Settings, meta = (DisplayName="PlayRateScaleBiasClamp", FoldProperty))
131 FInputScaleBiasClampConstants PlayRateScaleBiasClampConstants;
132
133 UPROPERTY()
135
136 // The start position between 0 and the length of the sequence to use when initializing. When looping, play will still jump back to the beginning when reaching the end.
137 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault, FoldProperty))
138 float StartPosition = 0.0f;
139
140 // Should the animation loop back to the start when it reaches the end?
141 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault, FoldProperty))
142 bool bLoopAnimation = true;
143
144 // Use pose matching to choose the start position. Requires PoseSearch plugin.
145 UPROPERTY(EditAnywhere, Category = PoseMatching, meta = (PinHiddenByDefault, FoldProperty))
146 bool bStartFromMatchingPose = false;
147#endif
148
149public:
150 // FAnimNode_SequencePlayerBase interface
151 ENGINE_API virtual bool SetSequence(UAnimSequenceBase* InSequence) override;
152 ENGINE_API virtual bool SetLoopAnimation(bool bInLoopAnimation) override;
153 ENGINE_API virtual UAnimSequenceBase* GetSequence() const override;
154 ENGINE_API virtual float GetPlayRateBasis() const override;
155 ENGINE_API virtual float GetPlayRate() const override;
156 ENGINE_API virtual const FInputScaleBiasClampConstants& GetPlayRateScaleBiasClampConstants() const override;
157 ENGINE_API virtual float GetStartPosition() const override;
158 ENGINE_API virtual bool GetStartFromMatchingPose() const override;
159 ENGINE_API virtual bool SetStartPosition(float InStartPosition) override;
160 ENGINE_API virtual bool SetPlayRate(float InPlayRate) override;
161
162 // FAnimNode_AssetPlayerBase interface
163 ENGINE_API virtual FName GetGroupName() const override;
164 ENGINE_API virtual EAnimGroupRole::Type GetGroupRole() const override;
165 ENGINE_API virtual bool GetOverridePositionWhenJoiningSyncGroupAsLeader() const override;
166 ENGINE_API virtual EAnimSyncMethod GetGroupMethod() const override;
167 ENGINE_API virtual bool IsLooping() const override;
168 ENGINE_API virtual bool GetIgnoreForRelevancyTest() const override;
169 ENGINE_API virtual bool SetGroupName(FName InGroupName) override;
170 ENGINE_API virtual bool SetGroupRole(EAnimGroupRole::Type InRole) override;
171 ENGINE_API virtual bool SetOverridePositionWhenJoiningSyncGroupAsLeader(bool InOverridePositionWhenJoiningSyncGroupAsLeader) override;
172 ENGINE_API virtual bool SetGroupMethod(EAnimSyncMethod InMethod) override;
173 ENGINE_API virtual bool SetIgnoreForRelevancyTest(bool bInIgnoreForRelevancyTest) override;
174};
175
176// Sequence player node that can be used standalone (without constant folding)
177USTRUCT(BlueprintInternalUseOnly)
179{
181
182protected:
183 // The group name that we synchronize with (NAME_None if it is not part of any group).
184 UPROPERTY(EditAnywhere, Category=Sync)
185 FName GroupName = NAME_None;
186
187 // The role this node can assume within the group (ignored if GroupName is not set)
188 UPROPERTY(EditAnywhere, Category=Sync)
189 TEnumAsByte<EAnimGroupRole::Type> GroupRole = EAnimGroupRole::CanBeLeader;
190
191 // When enabled, acting as the leader, and using marker-based sync, this asset player will not sync to the previous leader's sync position when joining a sync group and before becoming the leader but instead force everyone else to match its position.
192 UPROPERTY(EditAnywhere, Category = Sync, meta = (EditCondition = "GroupRole != EAnimGroupRole::TransitionFollower && GroupRole != EAnimGroupRole::AlwaysFollower", EditConditionHides))
193 bool bOverridePositionWhenJoiningSyncGroupAsLeader = false;
194
195 // How this node will synchronize with other animations.
196 UPROPERTY(EditAnywhere, Category=Sync)
198
199 // If true, "Relevant anim" nodes that look for the highest weighted animation in a state will ignore this node
200 UPROPERTY(EditAnywhere, Category=Relevancy, meta=(PinHiddenByDefault))
201 bool bIgnoreForRelevancyTest = false;
202
203 // The animation sequence asset to play
204 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault, DisallowedClasses="/Script/Engine.AnimMontage"))
205 TObjectPtr<UAnimSequenceBase> Sequence = nullptr;
206
207 // The Basis in which the PlayRate is expressed in. This is used to rescale PlayRate inputs.
208 // For example a Basis of 100 means that the PlayRate input will be divided by 100.
209 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault))
210 float PlayRateBasis = 1.0f;
211
212 // The play rate multiplier. Can be negative, which will cause the animation to play in reverse.
213 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault))
214 float PlayRate = 1.0f;
215
216 // Additional scaling, offsetting and clamping of PlayRate input.
217 // Performed after PlayRateBasis.
218 UPROPERTY(EditAnywhere, Category = Settings, meta = (DisplayName="PlayRateScaleBiasClamp"))
219 FInputScaleBiasClampConstants PlayRateScaleBiasClampConstants;
220
221 // The start position between 0 and the length of the sequence to use when initializing. When looping, play will still jump back to the beginning when reaching the end.
222 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault))
223 float StartPosition = 0.0f;
224
225 // Should the animation loop back to the start when it reaches the end?
226 UPROPERTY(EditAnywhere, Category = Settings, meta = (PinHiddenByDefault))
227 bool bLoopAnimation = true;
228
229 // Use pose matching to choose the start position. Requires PoseSearch plugin.
230 UPROPERTY(EditAnywhere, Category = PoseMatching, meta = (PinHiddenByDefault))
231 bool bStartFromMatchingPose = false;
232
233public:
234 // FAnimNode_SequencePlayerBase interface
235 virtual bool SetSequence(UAnimSequenceBase* InSequence) override { Sequence = InSequence; return true; }
236 virtual bool SetLoopAnimation(bool bInLoopAnimation) override { bLoopAnimation = bInLoopAnimation; return true; }
237 virtual UAnimSequenceBase* GetSequence() const override { return Sequence; }
238 virtual float GetPlayRateBasis() const override { return PlayRateBasis; }
239 virtual float GetPlayRate() const override { return PlayRate; }
240 virtual const FInputScaleBiasClampConstants& GetPlayRateScaleBiasClampConstants() const override { return PlayRateScaleBiasClampConstants; }
241 virtual float GetStartPosition() const override { return StartPosition; }
242 virtual bool GetStartFromMatchingPose() const override { return bStartFromMatchingPose; }
243
244 // FAnimNode_AssetPlayerBase interface
245 virtual FName GetGroupName() const override { return GroupName; }
246 virtual EAnimGroupRole::Type GetGroupRole() const override { return GroupRole; }
247 virtual EAnimSyncMethod GetGroupMethod() const override { return Method; }
248 virtual bool GetOverridePositionWhenJoiningSyncGroupAsLeader() const override { return bOverridePositionWhenJoiningSyncGroupAsLeader; }
249 virtual bool IsLooping() const override { return bLoopAnimation; }
250 virtual bool GetIgnoreForRelevancyTest() const override { return bIgnoreForRelevancyTest; }
251 virtual bool SetGroupName(FName InGroupName) override { GroupName = InGroupName; return true; }
252 virtual bool SetGroupRole(EAnimGroupRole::Type InRole) override { GroupRole = InRole; return true; }
253 virtual bool SetGroupMethod(EAnimSyncMethod InMethod) override { Method = InMethod; return true; }
254 virtual bool SetOverridePositionWhenJoiningSyncGroupAsLeader(bool InOverridePositionWhenJoiningSyncGroupAsLeader) override { bOverridePositionWhenJoiningSyncGroupAsLeader = InOverridePositionWhenJoiningSyncGroupAsLeader; return true; }
255 virtual bool SetIgnoreForRelevancyTest(bool bInIgnoreForRelevancyTest) override { bIgnoreForRelevancyTest = bInIgnoreForRelevancyTest; return true; }
256 virtual bool SetStartPosition(float InStartPosition) override { StartPosition = InStartPosition; return true; }
257 virtual bool SetPlayRate(float InPlayRate) override { PlayRate = InPlayRate; return true; }
258};
EAnimSyncMethod
Definition AnimationAsset.h:629
#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
return true
Definition ExternalRpcRegistry.cpp:601
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define USTRUCT(...)
Definition ObjectMacros.h:746
Definition Engine.Build.cs:7
Definition NameTypes.h:617
Definition EnumAsByte.h:22
Definition AnimSequenceBase.h:37
Definition AnimationAsset.h:1020
Definition AnimationAsset.h:592
@ false
Definition radaudio_common.h:23
Definition AnimNode_AssetPlayerBase.h:15
Definition AnimNode_SequencePlayer.h:16
virtual float GetStartPosition() const
Definition AnimNode_SequencePlayer.h:69
virtual UAnimSequenceBase * GetSequence() const
Definition AnimNode_SequencePlayer.h:44
virtual bool SetPlayRate(float InPlayRate)
Definition AnimNode_SequencePlayer.h:80
virtual const FInputScaleBiasClampConstants & GetPlayRateScaleBiasClampConstants() const
Definition AnimNode_SequencePlayer.h:66
virtual float GetPlayRate() const
Definition AnimNode_SequencePlayer.h:62
virtual bool GetStartFromMatchingPose() const
Definition AnimNode_SequencePlayer.h:72
virtual bool SetLoopAnimation(bool bInLoopAnimation)
Definition AnimNode_SequencePlayer.h:55
virtual bool SetSequence(UAnimSequenceBase *InSequence)
Definition AnimNode_SequencePlayer.h:52
virtual float GetPlayRateBasis() const
Definition AnimNode_SequencePlayer.h:59
virtual bool SetStartPosition(float InStartPosition)
Definition AnimNode_SequencePlayer.h:76
Definition AnimNode_SequencePlayer.h:179
virtual const FInputScaleBiasClampConstants & GetPlayRateScaleBiasClampConstants() const override
Definition AnimNode_SequencePlayer.h:240
virtual bool IsLooping() const override
Definition AnimNode_SequencePlayer.h:249
virtual bool GetOverridePositionWhenJoiningSyncGroupAsLeader() const override
Definition AnimNode_SequencePlayer.h:248
virtual float GetPlayRate() const override
Definition AnimNode_SequencePlayer.h:239
virtual bool GetStartFromMatchingPose() const override
Definition AnimNode_SequencePlayer.h:242
virtual EAnimSyncMethod GetGroupMethod() const override
Definition AnimNode_SequencePlayer.h:247
virtual bool SetIgnoreForRelevancyTest(bool bInIgnoreForRelevancyTest) override
Definition AnimNode_SequencePlayer.h:255
virtual float GetStartPosition() const override
Definition AnimNode_SequencePlayer.h:241
virtual bool SetGroupRole(EAnimGroupRole::Type InRole) override
Definition AnimNode_SequencePlayer.h:252
virtual bool SetStartPosition(float InStartPosition) override
Definition AnimNode_SequencePlayer.h:256
virtual bool GetIgnoreForRelevancyTest() const override
Definition AnimNode_SequencePlayer.h:250
virtual float GetPlayRateBasis() const override
Definition AnimNode_SequencePlayer.h:238
virtual bool SetGroupName(FName InGroupName) override
Definition AnimNode_SequencePlayer.h:251
virtual FName GetGroupName() const override
Definition AnimNode_SequencePlayer.h:245
virtual bool SetPlayRate(float InPlayRate) override
Definition AnimNode_SequencePlayer.h:257
virtual UAnimSequenceBase * GetSequence() const override
Definition AnimNode_SequencePlayer.h:237
virtual bool SetGroupMethod(EAnimSyncMethod InMethod) override
Definition AnimNode_SequencePlayer.h:253
virtual bool SetOverridePositionWhenJoiningSyncGroupAsLeader(bool InOverridePositionWhenJoiningSyncGroupAsLeader) override
Definition AnimNode_SequencePlayer.h:254
virtual bool SetLoopAnimation(bool bInLoopAnimation) override
Definition AnimNode_SequencePlayer.h:236
virtual EAnimGroupRole::Type GetGroupRole() const override
Definition AnimNode_SequencePlayer.h:246
Definition AnimNode_SequencePlayer.h:86
Definition AnimNodeBase.h:159
Definition AnimNodeBase.h:337
Definition AnimNodeBase.h:324
Definition AnimNodeBase.h:354
Definition InputScaleBias.h:188
Definition InputScaleBias.h:250
Definition InputScaleBias.h:74
Definition AnimNodeBase.h:642
Definition AnimNodeBase.h:479
Definition ObjectPtr.h:488