UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StringCurve.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"
7#include "UObject/Class.h"
8#include "Curves/KeyHandle.h"
10#include "StringCurve.generated.h"
11
15USTRUCT()
17{
19
20
21 UPROPERTY(EditAnywhere, Category="Key")
23
25 UPROPERTY(EditAnywhere, Category="Key")
26 FString Value;
27
30 : Time(0.0f)
31 { }
32
34 FStringCurveKey(float InTime, const FString& InValue)
35 : Time(InTime)
36 , Value(InValue)
37 { }
38
39public:
40
41 //~ TStructOpsTypeTraits interface
42
43 ENGINE_API bool operator==(const FStringCurveKey& Other) const;
44 ENGINE_API bool operator!=(const FStringCurveKey& Other) const;
46
49 {
50 Key.Serialize(Ar);
51 return Ar;
52 }
53};
54
55
56template<>
68
69
73USTRUCT()
76{
78
79
81
82public:
83
87 bool HasAnyData() const
88 {
89 return DefaultValue.Len() || Keys.Num();
90 }
91
99 ENGINE_API FKeyHandle AddKey(float InTime, const FString& InValue, FKeyHandle KeyHandle = FKeyHandle());
100
106 ENGINE_API void DeleteKey(FKeyHandle KeyHandle);
107
115 ENGINE_API FString Eval(float Time, const FString& InDefaultValue) const;
116
125
127 FString GetDefaultValue() const
128 {
129 return DefaultValue;
130 }
131
138 ENGINE_API FStringCurveKey& GetKey(FKeyHandle KeyHandle);
139 ENGINE_API FStringCurveKey GetKey(FKeyHandle KeyHandle) const;
140
147 {
148 return Keys;
149 }
150
157 ENGINE_API virtual float GetKeyTime(FKeyHandle KeyHandle) const override final;
158
165 ENGINE_API FString GetKeyValue(FKeyHandle KeyHandle) const;
166
172 void SetDefaultValue(const FString& InDefaultValue)
173 {
174 DefaultValue = InDefaultValue;
175 }
176
181 {
182 DefaultValue.Empty();
183 }
184
191 ENGINE_API virtual void SetKeyTime(FKeyHandle KeyHandle, float NewTime) override final;
192
199 ENGINE_API void SetKeyValue(FKeyHandle KeyHandle, FString NewValue);
200
208 ENGINE_API FKeyHandle UpdateOrAddKey(float InTime, const FString& InValue, float KeyTimeTolerance = UE_KINDA_SMALL_NUMBER);
209
211 ENGINE_API void RemoveRedundantKeys();
212public:
213
214 //~ FIndexedCurve interface
215
216 virtual int32 GetNumKeys() const override final { return Keys.Num(); }
217
219 virtual FIndexedCurve* Duplicate() const final { return new FStringCurve(*this); }
220
221public:
222
224 UPROPERTY(EditAnywhere, Category="Curve")
225 FString DefaultValue;
226
228 UPROPERTY(EditAnywhere, EditFixedSize, Category="Curve")
230};
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
UE_FORCEINLINE_HINT bool operator!=(const FIndexedPointer &Other) const
Definition LockFreeList.h:76
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define USTRUCT(...)
Definition ObjectMacros.h:746
EPropertyObjectReferenceType
Definition ObjectMacros.h:533
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
#define UE_KINDA_SMALL_NUMBER
Definition UnrealMathUtility.h:131
Definition Archive.h:1208
Definition Array.h:670
Definition IndexedCurve.h:18
Definition KeyHandle.h:15
Definition StringCurve.h:17
friend FArchive & operator<<(FArchive &Ar, FStringCurveKey &Key)
Definition StringCurve.h:48
FStringCurveKey(float InTime, const FString &InValue)
Definition StringCurve.h:34
Definition StringCurve.h:76
const TArray< FStringCurveKey > & GetKeys() const
Definition StringCurve.h:146
virtual int32 GetNumKeys() const override final
Definition StringCurve.h:216
bool HasAnyData() const
Definition StringCurve.h:87
void SetDefaultValue(const FString &InDefaultValue)
Definition StringCurve.h:172
FString GetDefaultValue() const
Definition StringCurve.h:127
virtual FIndexedCurve * Duplicate() const final
Definition StringCurve.h:219
void ClearDefaultValue()
Definition StringCurve.h:180
Definition StructOpsTypeTraits.h:11
@ WithIdenticalViaEquality
Definition StructOpsTypeTraits.h:18
@ WithCopy
Definition StructOpsTypeTraits.h:17
@ WithSerializer
Definition StructOpsTypeTraits.h:23
static constexpr EPropertyObjectReferenceType WithSerializerObjectReferences
Definition StructOpsTypeTraits.h:41
Definition StructOpsTypeTraits.h:46