UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UObjectArchetypeHelper.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreFwd.h"
6#include "Misc/NotNull.h"
7#include "UObject/Object.h"
9
11{
12public:
14 {
15#if WITH_EDITOR
16 public:
17 virtual UObject* GetArchetype(const UObject* InObject) const = 0;
18#endif
19 };
20
21#if WITH_EDITOR
22private:
23 // Restrict usage to FPropertyNode
24 friend class FPropertyNode;
25#endif
27};
28
29#if WITH_EDITOR
30
31struct FCacheArchetype
32{
33 bool IsDefault() const
34 {
35 return CachedArchetype == nullptr;
36 }
37
40};
41
43{
44public:
48
55 void CacheArchetype(TNotNull<const UObject*> Object, UObject* Archetype = nullptr)
56 {
58 if (Annotation.CachedArchetype == nullptr)
59 {
60 Annotation.CachedArchetype = Archetype ? Archetype : Object->GetArchetype();
61 ObjectCachedArchetypeAnnotations.AddAnnotation(Object, Annotation);
62 }
63 }
64
66 {
68 }
69
74 {
75 return ObjectCachedArchetypeAnnotations.GetAnnotation(Object).CachedArchetype;
76 }
77
78private:
80};
81
82#endif // WITH_EDITOR
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
T TNotNull
Definition NotNull.h:307
Definition UObjectArchetypeHelper.h:14
Definition UObjectArchetypeHelper.h:11
static COREUOBJECT_API UObject * GetArchetype(const UObject *InObject, const IObjectArchetypePolicy *InPolicy)
Definition UObjectArchetype.cpp:288
Definition UObjectAnnotation.h:33
Definition Object.h:95
FORCEINLINE T * Get(const FObjectPtr &ObjectPtr)
Definition ObjectPtr.h:426
Definition ObjectPtr.h:488