UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VerseValueProperty.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_VERSE_VM || defined(__INTELLISENSE__)
6#include "HAL/Platform.h"
9#include "VerseVM/VVMValue.h"
11#elif WITH_VERSE_BPVM
12// When using the BPVM, we use a different property type for FVerseValue structs with UPROPERTY markup
15#endif
16
17#if WITH_VERSE_VM || defined(__INTELLISENSE__)
18
19namespace Verse
20{
21struct VType;
22}
23
25// Note that the property type for FVerseValue is FVRestValueProperty and not FVValueProperty
27
28template <>
30{
31 return TEXT("Verse::TWriteBarrier<Verse::VCell>");
32}
33
34template <>
36{
37 return TEXT("Verse::TWriteBarrier<Verse::VValue>");
38}
39
40template <>
42{
43 return TEXT("Verse::VRestValue");
44}
45
46template <>
48{
49 Verse::VRestValue Value(0);
50 Value.SetNonCellNorPlaceholder(Verse::VValue());
51 return Value;
52}
53
54template <>
56{
57 Verse::VRestValue* Value = new (A) Verse::VRestValue(0);
58 Value->SetNonCellNorPlaceholder(Verse::VValue());
59 return Value;
60}
61
62// Template base class for the verse property types
63template <typename InTCppType>
64class TFVersePropertyBase : public TProperty<InTCppType, FProperty>
65{
66public:
68 using TCppType = InTCppType;
69
72 {
73 }
74
76 : Super(InOwner, InName, InObjectFlags)
77 {
78 }
79
80 TFVersePropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FVerseValuePropertyParams& Prop)
82 {
83 }
84
85 TFVersePropertyBase(FFieldVariant InOwner, const UECodeGen_Private::FClassPropertyParams& Prop)
87 {
88 }
89
90#if UE_WITH_CONSTINIT_UOBJECT
91 explicit consteval TFVersePropertyBase(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
92 : Super(InBaseParams)
93 {
94 }
95#endif
96
97#if WITH_EDITORONLY_DATA
99 : Super(InField)
100 {
101 }
102#endif // WITH_EDITORONLY_DATA
103
104 // UHT interface
105 COREUOBJECT_API virtual FString GetCPPMacroType(FString& ExtendedTypeText) const override;
106 // End of UHT interface
107
108 // FProperty interface
109 COREUOBJECT_API virtual bool Identical(const void* A, const void* B, uint32 PortFlags) const override;
110 COREUOBJECT_API virtual void SerializeItem(FStructuredArchive::FSlot Slot, void* Value, void const* Defaults) const override;
111 COREUOBJECT_API virtual void ExportText_Internal(FString& ValueStr, const void* PropertyValueOrContainer, EPropertyPointerType PointerType, const void* DefaultValue, UObject* Parent, int32 PortFlags, UObject* ExportRootScope) const override;
112 COREUOBJECT_API virtual const TCHAR* ImportText_Internal(const TCHAR* Buffer, void* ContainerOrPropertyPtr, EPropertyPointerType PropertyPointerType, UObject* OwnerObject, int32 PortFlags, FOutputDevice* ErrorText) const override;
115
116 virtual bool HasIntrusiveUnsetOptionalState() const override
117 {
118 return false;
119 }
120 // End of FProperty interface
121};
122
123class FVCellProperty : public TFVersePropertyBase<Verse::TWriteBarrier<Verse::VCell>>
124{
126
127public:
129
135 COREUOBJECT_API FVCellProperty(FFieldVariant InOwner, const UECodeGen_Private::FVerseValuePropertyParams& Prop);
136
137#if UE_WITH_CONSTINIT_UOBJECT
138 explicit consteval FVCellProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
139 : Super(InBaseParams)
140 {
141 }
142#endif
143};
144
145//
146// Metadata for a property of FVValueProperty type.
147//
148class FVValueProperty : public TFVersePropertyBase<Verse::TWriteBarrier<Verse::VValue>>
149{
151
152public:
154
160 COREUOBJECT_API FVValueProperty(FFieldVariant InOwner, const UECodeGen_Private::FVerseValuePropertyParams& Prop);
161
162#if UE_WITH_CONSTINIT_UOBJECT
163 explicit consteval FVValueProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
164 : Super(InBaseParams)
165 {
166 }
167#endif
168};
169
170//
171// Metadata for a property of FVRestValueProperty type.
172//
173class FVRestValueProperty : public TFVersePropertyBase<Verse::VRestValue>
174{
176
177public:
178
179 Verse::TWriteBarrier<Verse::VValue> Type;
180 FProperty* LegacyProperty = nullptr;
181#if WITH_EDITORONLY_DATA
182 // See CDataDefinition::IsNativeRepresentation for the meaning of this flag.
183 bool bNativeRepresentation = true;
184#endif
185
187
193 COREUOBJECT_API FVRestValueProperty(FFieldVariant InOwner, const UECodeGen_Private::FVerseValuePropertyParams& Prop);
194 COREUOBJECT_API FVRestValueProperty(FFieldVariant InOwner, const UECodeGen_Private::FVerseClassPropertyParams& Prop);
195
196#if UE_WITH_CONSTINIT_UOBJECT
197 explicit consteval FVRestValueProperty(UE::CodeGen::ConstInit::FPropertyParams InBaseParams)
198 : Super(InBaseParams)
199 {
200 }
201#endif
202
204 COREUOBJECT_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
206
207 COREUOBJECT_API virtual void PostDuplicate(const FField& InField) override;
208
209#if WITH_EDITORONLY_DATA
210 // For conversion from uncooked BPVM data during deserialization.
211 COREUOBJECT_API static Verse::VValue ConvertToVValueLegacy(Verse::FAllocationContext Context, const void* Container, FProperty* Property);
212 COREUOBJECT_API static bool ConvertFromVValueLegacy(Verse::FAllocationContext Context, void* Container, FProperty* Property, Verse::VValue Value);
213 COREUOBJECT_API virtual EConvertFromTypeResult ConvertFromType(const FPropertyTag& Tag, FStructuredArchive::FSlot Slot, uint8* Data, const UStruct* DefaultsStruct, const uint8* Defaults) override;
214#endif
215
216 COREUOBJECT_API virtual void CopyValuesInternal(void* Dest, const void* Src, int32 Count) const override;
217 COREUOBJECT_API virtual void InstanceSubobjects(void* Data, const void* DefaultData, TNotNull<UObject*> Owner, FObjectInstancingGraph* InstanceGraph) override;
218};
219
220inline bool IsVerseProperty(const FProperty* Property)
221{
222 return Property->IsA<FVRestValueProperty>() || Property->IsA<FVValueProperty>() || Property->IsA<FVCellProperty>();
223}
224
225COREUOBJECT_API TSharedPtr<FJsonValue> VersePropertyToJSON(Verse::FRunningContext Context, const FProperty* Property, const void* InValue, TMap<const void*, Verse::EVisitState>& VisitedObjects, const Verse::VerseVMToJsonCallback& Callback, const uint32 RecursionDepth = 0);
226
227#endif // WITH_VERSE_VM
FString GetTypeName()
Definition Casts.h:66
#define DECLARE_FIELD_API(TClass, TSuperClass, TStaticFlags, TRequiredAPI)
Definition Field.h:257
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
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
T TNotNull
Definition NotNull.h:307
@ CASTCLASS_FVCellProperty
Definition ObjectMacros.h:398
@ CASTCLASS_FVRestValueProperty
Definition ObjectMacros.h:394
@ CASTCLASS_FVValueProperty
Definition ObjectMacros.h:393
EObjectFlags
Definition ObjectMacros.h:552
EPropertyObjectReferenceType
Definition ObjectMacros.h:533
EInternal
Definition ObjectMacros.h:175
@ EC_InternalUseOnlyConstructor
Definition ObjectMacros.h:175
EPropertyPointerType
Definition UnrealType.h:156
EConvertFromTypeResult
Definition UnrealType.h:130
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Field.h:66
Definition Field.h:353
Definition Field.h:556
Definition NameTypes.h:617
Definition OutputDevice.h:133
Definition UnrealType.h:174
Definition UObjectGlobals.h:2492
Definition StructuredArchiveSlots.h:52
Definition VBPVMDynamicProperty.h:13
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition UnrealType.h:1446
static UE_FORCEINLINE_HINT TCppType * InitializePropertyValue(void *A)
Definition UnrealType.h:1492
static UE_FORCEINLINE_HINT TCHAR const * GetTypeName()
Definition UnrealType.h:1456
static UE_FORCEINLINE_HINT TCppType GetDefaultPropertyValue()
Definition UnrealType.h:1477
Definition UnrealType.h:1538
virtual bool HasIntrusiveUnsetOptionalState() const override
Definition UnrealType.h:1670
Definition SharedPointer.h:692
Definition GarbageCollectionSchema.h:62
Definition GarbageCollectionSchema.h:265
Definition Class.h:181
Definition Object.h:95
Definition Class.h:480
Type
Definition PawnAction_Move.h:11
Definition UObjectConstructInternal.h:15
bool Identical(const void *A, const void *B, uint32 PortFlags, bool &bOutResult)
Definition Class.h:1353
Definition Archive.h:36
Definition Class.h:4941
Definition PropertyTag.h:38