UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ObjectEditorUtils.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
8#include "ObjectEditorUtils.generated.h"
9
10#if WITH_EDITOR
11class FField;
12class FProperty;
13
14namespace FObjectEditorUtils
15{
22 ENGINE_API FText GetCategoryText( const FName InName );
23
31
39
46 ENGINE_API FString GetCategory( const FField* InField );
47
54 ENGINE_API FString GetCategory( const UField* InField );
55
64
73
83
93
102 ENGINE_API void GetClassDevelopmentStatus(UClass* Class, bool& bIsExperimental, bool& bIsEarlyAccess, FString& MostDerivedClassName);
103
110
117
128 ENGINE_API bool MigratePropertyValue(UObject* SourceObject, FProperty* SourceProperty, UObject* DestinationObject, FProperty* DestinationProperty);
129
140 template <typename SourceType, typename DestinationType>
141 bool MigratePropertyValue(SourceType* SourceObject, FName SourcePropertyName, DestinationType* DestinationObject, FName DestinationPropertyName)
142 {
144 FProperty* DestinationProperty = FindFieldChecked<FProperty>(DestinationType::StaticClass(), DestinationPropertyName);
145
146 return FObjectEditorUtils::MigratePropertyValue(SourceObject, SourceProperty, DestinationObject, DestinationProperty);
147 }
148
157 template <typename ObjectType, typename ValueType>
158 bool SetPropertyValue(ObjectType* Object, FName PropertyName, ValueType Value)
159 {
160 // Get the property addresses for the source and destination objects.
161 FProperty* Property = FindFieldChecked<FProperty>(ObjectType::StaticClass(), PropertyName);
162
163 // Get the property addresses for the object
164 ValueType* SourceAddr = Property->ContainerPtrToValuePtr<ValueType>(Object);
165
166 if ( SourceAddr == NULL )
167 {
168 return false;
169 }
170
171 if ( !Object->HasAnyFlags(RF_ClassDefaultObject) )
172 {
173 FEditPropertyChain PropertyChain;
174 PropertyChain.AddHead(Property);
175 Object->PreEditChange(PropertyChain);
176 }
177
178 // Set the value on the destination object.
179 *SourceAddr = Value;
180
181 if ( !Object->HasAnyFlags(RF_ClassDefaultObject) )
182 {
184 Object->PostEditChangeProperty(PropertyEvent);
185 }
186
187 return true;
188 }
189
191 template <typename T>
193 {
194 check(InObjects.Num() > 0);
195
197 for(auto ObjIt = InObjects.CreateConstIterator(); ObjIt; ++ObjIt)
198 {
200 }
201
202 return TypedObjects;
203 }
204};
205
206#endif // WITH_EDITOR
207
208UCLASS(MinimalAPI, Config = Editor, DefaultConfig)
210{
212
213public:
214
215 UPROPERTY(config)
216 FName DevelopmentStatusKey{TEXT("Valkyrie_DevelopmentStatus")};
217 FString DevelopmentStatusValue_Experimental{TEXT("Experimental")};
218
219 UPROPERTY(config)
220 FName DeprecationStatusKey{TEXT("Valkyrie_DeprecationStatus")};
221 FString DeprecationStatusValue_Deprecated{TEXT("Deprecated")};
222};
#define NULL
Definition oodle2base.h:134
#define check(expr)
Definition AssertionMacros.h:314
const void * SourceAddr
Definition BlueprintTypeConversions.cpp:392
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
@ RF_ClassDefaultObject
This object is used as the default template for all instances of a class. One object is created for e...
Definition ObjectMacros.h:563
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition UnrealType.h:6738
Definition Field.h:556
Definition NameTypes.h:617
Definition UnrealType.h:174
Definition Text.h:385
Definition Array.h:670
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
bool AddHead(const ElementType &InElement)
Definition List.h:538
Definition Class.h:3793
Definition Class.h:181
Definition Class.h:2476
Definition Object.h:95
Definition Class.h:480
Definition ObjectEditorUtils.h:210
EPropertyBagResult SetPropertyValue(const FPropertyBagPropertyDesc *Desc, void *Address, const T &InValue)
Definition PropertyBag.cpp:1155
Definition UnrealType.h:6865