UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MovieSceneCondition.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
8#include "Containers/Array.h"
10#include "MovieSceneCondition.generated.h"
11
12namespace UE
13{
14 namespace MovieScene
15 {
16 struct FSharedPlaybackState;
17 }
18}
19
20/*
21* Defines the scope of a particular condition type.
22* By default, the condition scope will determine whether conditions need to be re-evaluated for different bindings or entities in the Sequence.
23*/
24UENUM(BlueprintType)
26{
27 /* Condition has the same result regardless of the binding or entity.*/
28 Global,
29 /* Condition may have different results for different object bindings. */
30 Binding,
31 /* Condition may have different results for each different outer object owner (i.e. track, section) in the Sequence.*/
33};
34
35/* Defines how often a condition needs to be checked.
36* Most conditions should return 'Once', but if the condition result can change during playback, 'OnTick' can be chosen to have the condition re-evaluated each tick.
37*/
38UENUM(BlueprintType)
40{
41 /* Condition result will not change during sequence playback and only needs to get checked once. */
42 Once,
43 /* Condition result may change during sequence playback and should be checked per tick. */
44 OnTick,
45};
46
47/*
48* Blueprint-friendly struct containing any context needed to evaluate conditions.
49*/
50USTRUCT(BlueprintType)
52{
54public:
55
56 /* The world context*/
57 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Default")
58 TObjectPtr<UObject> WorldContext;
59
60 /* Binding for the bound object currently evaluating this condition if applicable (BindingId will be invalid for conditions on global tracks/sections). */
61 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Default")
63
64 /* Array of objects bound to the binding currently evaluating this condition if applicable (will be empty for conditions on global tracks/sections)*/
65 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Default")
66 TArray<TObjectPtr<UObject>> BoundObjects;
67};
68
69/*
70* Container struct for instanced UMovieSceneConditions, existing only to allow property type customization for choosing conditions.
71*/
72USTRUCT(BlueprintType)
74{
76
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced, Category="Sequencer|Condition", meta = (EditInline, AllowEditInlineCustomization))
78 TObjectPtr<UMovieSceneCondition> Condition = nullptr;
79};
80
85UCLASS(abstract, Blueprintable, DefaultToInstanced, EditInlineNew, meta = (ShowWorldContextPin), CollapseCategories, MinimalAPI)
88{
90
91public:
92
93 /* Called by Sequencer code to evaluate this condition, passing relevant context. Note that BindingGuid will be invalid for conditions on global sections/tracks. */
94 MOVIESCENE_API bool EvaluateCondition(FGuid BindingGuid, FMovieSceneSequenceID SequenceID, TSharedRef<const UE::MovieScene::FSharedPlaybackState> SharedPlaybackState) const;
95
96 /* Called by Sequencer to compute a cache key for this condition given the passed in context.
97 * By default, this key will be computed based on the Binding Scope, and if relevant, the binding and entity owner.
98 * If a condition returns the same cache key given the same or different contexts, it will not be rechecked, and a cached value may be used.
99 */
100 MOVIESCENE_API virtual uint32 ComputeCacheKey(FGuid BindingGuid, FMovieSceneSequenceID SequenceID, TSharedRef<const UE::MovieScene::FSharedPlaybackState> SharedPlaybackState, UObject* EntityOwner) const;
101
102 MOVIESCENE_API virtual bool CanCacheResult(TSharedRef<const UE::MovieScene::FSharedPlaybackState> SharedPlaybackState) const;
103
104 MOVIESCENE_API EMovieSceneConditionScope GetConditionScope() const;
105
106#if WITH_EDITORONLY_DATA
107 /* If true, will skip evaluating the condition and always return true. Useful for authoring or debugging. */
108 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Default")
109 bool bEditorForceTrue = false;
110
112#endif
113
114protected:
115
116 /* Override to implement your condition.*/
117 UFUNCTION(BlueprintImplementableEvent, CallInEditor, meta=(DisplayName = "On Evaluate Condition"))
118 MOVIESCENE_API bool BP_EvaluateCondition(const FMovieSceneConditionContext& ConditionContext) const;
119
120 /* Override in native code to implement your condition. Note that BindingGuid will be invalid for conditions on global sections/tracks.*/
121 MOVIESCENE_API virtual bool EvaluateConditionInternal(FGuid BindingGuid, FMovieSceneSequenceID SequenceID, TSharedRef<const UE::MovieScene::FSharedPlaybackState> SharedPlaybackState) const;
122
123 /* Returns the scope of the condition, which determines whether the condition needs to be re-evaluated for different bindings or entities in the Sequence. */
124 UFUNCTION(BlueprintNativeEvent, CallInEditor, meta=(DisplayName = "Get Scope"))
126
127 /* Returns the scope of the condition, which determines whether the condition needs to be re-evaluated for different bindings or entities in the Sequence. */
128 MOVIESCENE_API virtual EMovieSceneConditionScope GetScopeInternal() const;
129
130 /* Returns the check frequency of the condition, which determines whether the condition result can change during playback and needs to get re-evaluated. */
131 UFUNCTION(BlueprintNativeEvent, CallInEditor, meta=(DisplayName = "Get Check Frequency"))
133
134 /* Returns the check frequency of the condition, which determines whether the condition result can change during playback and needs to get re-evaluated. */
135 MOVIESCENE_API virtual EMovieSceneConditionCheckFrequency GetCheckFrequencyInternal() const;
136
138 /* If true, inverts the result of the condition check.*/
139 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Default")
140 bool bInvert = false;
141
142};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EMovieSceneConditionScope
Definition MovieSceneCondition.h:26
EMovieSceneConditionCheckFrequency
Definition MovieSceneCondition.h:40
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition MovieScene.Build.cs:6
Definition Array.h:670
Definition SharedPointer.h:153
Definition MovieSceneCondition.h:88
Definition MovieSceneSignedObject.h:72
Definition Object.h:95
Definition AdvancedWidgetsModule.cpp:13
@ false
Definition radaudio_common.h:23
Definition Guid.h:109
Definition MovieSceneBindingProxy.h:23
Definition MovieSceneCondition.h:74
Definition MovieSceneCondition.h:52
Definition MovieSceneSequenceID.h:13
Definition ObjectPtr.h:488