KarmaEngine
Game Engine for practical learning and research purposes
Loading...
Searching...
No Matches
UObjectGlobals.h
Go to the documentation of this file.
1
10
11#pragma once
12
13#include "krpch.h"
14
15namespace Karma
16{
17 class UObject;
18 class AActor;
19 class UClass;
20 class UPackage;
21
25 #define INVALID_OBJECT (UObject*)-1
26
33 typedef signed int int32;
34
44 template<typename Enum>
45 constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
46 {
47 return(((__underlying_type(Enum))Flags) & (__underlying_type(Enum))Contains) != 0;
48 }
49
57 {
59 CLASS_None = 0x00000000u,
61 CLASS_Abstract = 0x00000001u,
63 CLASS_DefaultConfig = 0x00000002u,
65 CLASS_Config = 0x00000004u,
67 CLASS_Transient = 0x00000008u,
69 CLASS_Optional = 0x00000010u,
71 CLASS_MatchedSerializers = 0x00000020u,
75 CLASS_Native = 0x00000080u,
77 //CLASS_NoExport UE_DEPRECATED(5.1, "CLASS_NoExport should no longer be used. It is no longer being set by engine code.") = 0x00000100u,
79 CLASS_NotPlaceable = 0x00000200u,
81 CLASS_PerObjectConfig = 0x00000400u,
82
85
87 CLASS_EditInlineNew = 0x00001000u,
91 CLASS_Interface = 0x00004000u,
93 //CLASS_CustomConstructor UE_DEPRECATED(5.1, "CLASS_CustomConstructor should no longer be used. It is no longer being set by engine code.") = 0x00008000u,
95 CLASS_Const = 0x00010000u,
96
99
102
104 CLASS_MinimalAPI = 0x00080000u,
105
107 CLASS_RequiredAPI = 0x00100000u,
108
111
117 CLASS_Hidden = 0x01000000u,
119 CLASS_Deprecated = 0x02000000u,
121 CLASS_HideDropDown = 0x04000000u,
125 CLASS_Intrinsic = 0x10000000u,
127 CLASS_Constructed = 0x20000000u,
132 };
133
141 {
142 PKG_None = 0x00000000,
143 PKG_NewlyCreated = 0x00000001,
144 PKG_ClientOptional = 0x00000002,
145 PKG_ServerSideOnly = 0x00000004,
146 PKG_CompiledIn = 0x00000010,
147 PKG_ForDiffing = 0x00000020,
148 PKG_EditorOnly = 0x00000040,
149 PKG_Developer = 0x00000080,
150 PKG_UncookedOnly = 0x00000100,
151 PKG_Cooked = 0x00000200,
152 PKG_ContainsNoAsset = 0x00000400,
154 // PKG_Unused = 0x00001000,
156 PKG_ContainsMapData = 0x00004000,
157 PKG_IsSaving = 0x00008000,
158 PKG_Compiling = 0x00010000,
159 PKG_ContainsMap = 0x00020000,
161 // PKG_Unused = 0x00080000,
162 PKG_PlayInEditor = 0x00100000,
163 PKG_ContainsScript = 0x00200000,
164 PKG_DisallowExport = 0x00400000,
165 // PKG_Unused = 0x00800000,
166 // PKG_Unused = 0x01000000,
167 // PKG_Unused = 0x02000000,
168 // PKG_Unused = 0x04000000,
169 PKG_CookGenerated = 0x08000000,
170 PKG_DynamicImports = 0x10000000,
171 PKG_RuntimeGenerated = 0x20000000,
173 PKG_FilterEditorOnly = 0x80000000,
174
175 // Transient Flags are cleared when serializing to or from PackageFileSummary
177 };
178
183 {
184 // Do not add new flags unless they truly belong here. There are alternatives.
185 // if you change any the bit of any of the RF_Load flags, then you will need legacy serialization
186 RF_NoFlags = 0x00000000,
187
188 // This first group of flags mostly has to do with what kind of object it is. Other than transient, these are the persistent object flags.
189 // The garbage collector also tends to look at these.
190 RF_Public = 0x00000001,
191 RF_Standalone = 0x00000002,
192 RF_MarkAsNative = 0x00000004,
193 RF_Transactional = 0x00000008,
195 RF_ArchetypeObject = 0x00000020,
196 RF_Transient = 0x00000040,
197
198 // This group of flags is primarily concerned with garbage collection.
199 RF_MarkAsRootSet = 0x00000080,
200 RF_TagGarbageTemp = 0x00000100,
201
202 // The group of flags tracks the stages of the lifetime of a uobject
204 RF_NeedLoad = 0x00000400,
205 RF_KeepForCooker = 0x00000800,
206 RF_NeedPostLoad = 0x00001000,
209 RF_BeginDestroyed = 0x00008000,
210 RF_FinishDestroyed = 0x00010000,
211
212 // Misc. Flags
213 RF_BeingRegenerated = 0x00020000,
214 RF_DefaultSubObject = 0x00040000,
215 RF_WasLoaded = 0x00080000,
217 RF_LoadCompleted = 0x00200000,
220 RF_StrongRefOnFrame = 0x01000000,
222 RF_Dynamic /*UE_DEPRECATED(5.0, "RF_Dynamic should no longer be used. It is no longer being set by engine code.")*/ = 0x04000000,
223 RF_WillBeLoaded = 0x08000000,
225
226 // RF_Garbage and RF_PendingKill are mirrored in EInternalObjectFlags because checking the internal flags is much faster for the Garbage Collector
227 // while checking the object flags is much faster outside of it where the Object pointer is already available and most likely cached.
228 // RF_PendingKill is mirrored in EInternalObjectFlags because checking the internal flags is much faster for the Garbage Collector
229 // while checking the object flags is much faster outside of it where the Object pointer is already available and most likely cached.
230
231 RF_PendingKill /*UE_DEPRECATED(5.0, "RF_PendingKill should not be used directly. Make sure references to objects are released using one of the existing engine callbacks or use weak object pointers.")*/ = 0x20000000,
232 RF_Garbage /*UE_DEPRECATED(5.0, "RF_Garbage should not be used directly. Use MarkAsGarbage and ClearGarbage instead.")*/ = 0x40000000,
234 };
235
243 {
244 None = 0,
245
246 LoaderImport = 1 << 20,
247 Garbage = 1 << 21,
250 ClusterRoot = 1 << 24,
251 Native = 1 << 25,
252 Async = 1 << 26,
253 AsyncLoading = 1 << 27,
254 Unreachable = 1 << 28,
255 PendingKill /*UE_DEPRECATED(5.0, "PendingKill flag should no longer be used. Use Garbage flag instead.")*/ = 1 << 29,
256 RootSet = 1 << 30,
258
259 GarbageCollectionKeepFlags = Native | Async | AsyncLoading | LoaderImport,
260 MirroredFlags = Garbage | PendingKill,
261
262 //~ Make sure this is up to date!
264 };
265
270 {
275
283
290 {
291 }
292
293 // Non-copyable
294 FUObjectItem(FUObjectItem&&) = delete;
295 FUObjectItem(const FUObjectItem&) = delete;
296 FUObjectItem& operator=(FUObjectItem&&) = delete;
297 FUObjectItem& operator=(const FUObjectItem&) = delete;
298
308 {
309 KR_CORE_ASSERT((int32_t(FlagsToSet) & ~int32_t(EInternalObjectFlags::AllFlags)) == 0, "");
310
311 m_InternalFlags = int32_t(FlagsToSet);
312 }
313
321 {
322 //return FPlatformAtomics::AtomicRead_Relaxed((int32*)&Flags);
324 }
325
335 {
336 return !!(m_InternalFlags & int32_t(InFlags));
337 }
338 };
339
349 class KARMA_API FUObjectArray : public KarmaVector<FUObjectItem*>
350 {
351 public:
356 {
357 public:
358 enum EEndTagType
359 {
360 EndTag
361 };
362
374 TIterator(const FUObjectArray& InArray, bool bOnlyGCedObjects = false) :
375 m_Array(InArray),
376 m_Index(-1),
377 m_CurrentObject(nullptr)
378 {
379 if (bOnlyGCedObjects)
380 {
381 //m_Index = m_Array.ObjLastNonGCIndex;
382 }
383 Advance();
384 }
385
394 TIterator(EEndTagType, const TIterator& InIter) :
395 m_Array(InIter.m_Array)
396 {
397 m_Index = m_Array.Num();
398 }
399
406 {
407 Advance();
408 }
409
415 bool operator==(const TIterator& Rhs) const { return m_Index == Rhs.m_Index; }
416
422 bool operator!=(const TIterator& Rhs) const { return m_Index != Rhs.m_Index; }
423
429 FORCEINLINE explicit operator bool() const
430 {
431 return !!m_CurrentObject;
432 }
433
440 FORCEINLINE bool operator !() const
441 {
442 return !(bool)*this;
443 }
444
452 {
453 return m_Index;
454 }
455
456 protected:
457
465 {
466 return m_CurrentObject;
467 }
468
478 {
479 //@todo UE check this for LHS on Index on consoles
480 FUObjectItem* NextObject = nullptr;
481 m_CurrentObject = nullptr;
482 while(++m_Index < m_Array.GetObjectsList().size())
483 {
484 NextObject = m_Array.GetObjectsList()[m_Index];
485 if (NextObject->m_Object)
486 {
487 m_CurrentObject = NextObject;
488 return true;
489 }
490 }
491 return false;
492 }
493
500 {
501 return m_Array;
502 }
503
504 private:
506 const FUObjectArray& m_Array;
508 int32_t m_Index;
509
511 mutable FUObjectItem* m_CurrentObject;
512 };
513
514 public:
525 void AddUObject(UObject* Object);
526
532 const std::vector<FUObjectItem*>& GetObjectsList() const { return m_Elements; }
533
542 bool IsValid(const UObjectBase* Object) const;
543 };
544
548 class KarmaClassObjectMap : public KarmaMap<UClass*, KarmaVector<UObject*>*>
549 {
550 public:
551
559
566
578
590 };
591
598 extern KARMA_API FUObjectArray GUObjectStore;
599
610 extern KARMA_API KarmaClassObjectMap m_ClassToObjectVectorMap;
611
617 {
620
626
631 std::string m_Name;
632
639
646 EInternalObjectFlags m_InternalSetFlags = EInternalObjectFlags::None;
647
650
653
658 UObject* m_Template = nullptr;
659
661 //FObjectInstancingGraph* InstanceGraph = nullptr;
662
664 //UPackage* ExternalPackage = nullptr;
665
667 //TFunction<void()> PropertyInitCallback;
668
670 //FObjectInstancingGraph* InstanceGraph = nullptr;
671
672 private:
673 //FObjectInitializer::FOverrides* SubobjectOverrides = nullptr;
674
675 public:
676
677 //COREUOBJECT_API FStaticConstructObjectParameters(const UClass* InClass);
678
679 //friend FObjectInitializer;
680 };
681
684{
692};
693
703template <class T, class U>
705{
706 if (Src)
707 {
708 T* Result = static_cast<T*>(Src);// this line may need some generalization, I will come back later
709 if (!Result)
710 {
711 KR_CORE_ERROR("Casting failed");
712 }
713
714 return Result;
715 }
716
717 if (CheckType == ECastCheckedType::NullChecked)
718 {
719 KR_CORE_ASSERT(false, "Attempting to cast nullptr");
720 }
721
722 return nullptr;
723}
724
734KARMA_API UObject* StaticConstructObject_Internal(const FStaticConstructObjectParameters& Params);
735
752KARMA_API UObject* StaticAllocateObject(const UClass* Class, UObject* InOuter, const std::string& name, EObjectFlags SetFlags = EObjectFlags::RF_NoFlags, EInternalObjectFlags InternalSetFlags = EInternalObjectFlags::None);
753
754
769template< class T >
770FUNCTION_NON_NULL_RETURN_START
771T* NewObject(UObject* Outer, const UClass* Class, std::string name = "No_Name", EObjectFlags Flags = RF_NoFlags, UObject* Template = nullptr, bool bCopyTransientsFromClassDefaults = false/*, FObjectInstancingGraph* InInstanceGraph = nullptr, UPackage* ExternalPackage = nullptr*/)
772FUNCTION_NON_NULL_RETURN_END
773{
774 if (name == "")
775 {
776 KR_CORE_ASSERT(false, "NewObject with empty name can't be used to create default subobjects");
777 //FObjectInitializer::AssertIfInConstructor(Outer, TEXT("NewObject with empty name can't be used to create default subobjects (inside of UObject derived class constructor) as it produces inconsistent object names. Use ObjectInitializer.CreateDefaultSubobject<> instead."));
778 }
779
781 Params.m_Class = Class;
782 Params.m_Outer = Outer;
783 Params.m_Name = name;
784 Params.m_SetFlags = Flags;
785 Params.m_Class = Class;
786 //Params.m_Template = Template;
787 Params.m_bCopyTransientsFromClassDefaults = bCopyTransientsFromClassDefaults;
788 //Params.InstanceGraph = InInstanceGraph;
789 //Params.ExternalPackage = ExternalPackage;
790
791 return static_cast<T*>(StaticConstructObject_Internal(Params));
792}
793/*
794template< class T >
795FUNCTION_NON_NULL_RETURN_START*/
796//T* NewObject(UObject* Outer, const std::string& Name, EObjectFlags Flags = RF_NoFlags, UObject* Template = nullptr, bool bCopyTransientsFromClassDefaults = false/*, FObjectInstancingGraph* InInstanceGraph = nullptr*/)
797/*FUNCTION_NON_NULL_RETURN_END
798{
799 if (Name == "")
800 {
801 KR_CORE_ASSERT(false, "NewObject with empty name can't be used to create default subobjects");
802 //FObjectInitializer::AssertIfInConstructor(Outer, TEXT("NewObject with empty name can't be used to create default subobjects (inside of UObject derived class constructor) as it produces inconsistent object names. Use ObjectInitializer.CreateDefaultSubobject<> instead."));
803 }
804
805 FStaticConstructObjectParameters Params;// (T::StaticClass());
806 Params.m_Outer = Outer;
807 Params.m_Name = Name;
808 Params.m_SetFlags = Flags;
809 //Params.Template = Template;
810 Params.m_bCopyTransientsFromClassDefaults = bCopyTransientsFromClassDefaults;
811 Params.m_Class = T::StaticClass<T>();
812 //Params.InstanceGraph = InInstanceGraph;
813
814 return static_cast<T*>(StaticConstructObject_Internal(Params));
815}*/
816
833KARMA_API UObject* StaticFindObjectFastInternal(const UClass* ObjectClass, const UObject* ObjectPackage, const std::string& ObjectName, bool bExactClass = false, EObjectFlags ExcludeFlags = RF_NoFlags, EInternalObjectFlags ExclusiveInternalFlags = EInternalObjectFlags::None);
834
845 KARMA_API UObject* StaticFindObject(UClass* Class, UObject* InOuter, const std::string& Name, bool ExactClass = false);
846
853template< class T >
854inline KARMA_API T* FindObject(UObject* Outer, const std::string& Name, bool ExactClass = false)
855{
856 return (T*)StaticFindObjectFastInternal(T::StaticClass(), Outer, Name, ExactClass);
857}
858
865KARMA_API UPackage* CreatePackage(const std::string& PackageName);
866
879KARMA_API void GetObjectsOfClass(const UClass* ClassToLookFor, KarmaVector<UObject *>& Results, bool bIncludeDerivedClasses = true, EObjectFlags ExcludeFlags = RF_ClassDefaultObject, EInternalObjectFlags ExclusionInternalFlags = EInternalObjectFlags::None);
880
890KARMA_API void ForEachObjectOfClass(const UClass* ClassToLookFor, std::function<void(UObject*)> Operation, bool bIncludeDerivedClasses = true, EObjectFlags ExcludeFlags = RF_ClassDefaultObject, EInternalObjectFlags ExclusionInternalFlags = EInternalObjectFlags::None);
891
895typedef void (*FUObjectAllocatorCallback)(void* InObject, const std::string& InName, size_t InSize, size_t InAlignment, class UClass* InClass);
896
903KARMA_API extern void RegisterUObjectsStatisticsCallback(FUObjectAllocatorCallback dumpCallback);
904
911KARMA_API void CacheObject(class UObject* Object);
912
913// Global Internal functions
914extern void StaticUObjectInit();
915extern UPackage* GetTransientPackage();
916
921 {
922 public:
933
944 FObjectInitializer(UObject* InObj, UObject* InObjectArchetype, bool bInCopyTransientsFromClassDefaults, bool bInShouldInitializeProps, struct FObjectInstancingGraph* InInstanceGraph = nullptr);
945
947
954 FORCEINLINE UObject* GetObj() const
955 {
956 return m_Object;
957 }
958
959 private:
960 friend class UObject;
961
962 template<class T>
963 friend void InternalConstructor(const class FObjectInitializer& X);
964
974 void PostConstructInit();
975
988 static void InitProperties(UObject* Object, UClass* DefaultsClass, UObject* DefaultData, bool bCopyTransientsFromClassDefaults);
989
990 private:
992 UObject* m_Object;
993
995 UObject* m_ObjectArchetype;
996
998 bool m_bCopyTransientsFromClassDefaults;
999
1001 bool m_bShouldInitializePropsFromArchetype;
1002
1004 bool m_bSubobjectClassInitializationAllowed;
1005
1007 UObject* m_LastConstructedObject;
1008 };
1009}
#define KARMA_API
Defining Karma's API macro for storage class information.
Definition Core.h:41
#define FORCEINLINE
Typical inlining macro for clarity.
Definition Core.h:157
@ None
Events of the unknown category.
Definition Event.h:37
#define KR_CORE_ERROR(...)
A macro for logging error in Core part.
Definition Log.h:73
void InternalConstructor(const FObjectInitializer &X)
Helper template to call the default constructor for a class.
Definition Object.h:33
FORCEINLINE bool IsValid(const UObject *Test)
Test validity of object.
Definition Object.h:239
FUNCTION_NON_NULL_RETURN_START T * NewObject(UObject *Outer, const UClass *Class, std::string name="No_Name", EObjectFlags Flags=RF_NoFlags, UObject *Template=nullptr, bool bCopyTransientsFromClassDefaults=false) FUNCTION_NON_NULL_RETURN_END
Definition UObjectGlobals.h:771
FORCEINLINE T * CastChecked(const U &Src, ECastCheckedType::Type CheckType=ECastCheckedType::NullChecked)
Definition UObjectGlobals.h:704
constexpr bool EnumHasAnyFlags(Enum Flags, Enum Contains)
Sees if a specified flag(s) exists in the linear combination of flags.
Definition UObjectGlobals.h:45
EObjectFlags
Flags describing an object instance.
Definition UObjectGlobals.h:183
@ RF_BeingRegenerated
Flagged on UObjects that are used to create UClasses (e.g. Blueprints) while they are regenerating th...
Definition UObjectGlobals.h:213
@ RF_ClassDefaultObject
This object is its class's default object.
Definition UObjectGlobals.h:194
@ RF_MarkAsNative
Object (UField) will be marked as native on construction (DO NOT USE THIS FLAG in HasAnyFlags() etc)
Definition UObjectGlobals.h:192
@ RF_NeedLoad
During load, indicates object needs loading.
Definition UObjectGlobals.h:204
@ RF_TextExportTransient
Do not export object to text form (e.g. copy/paste). Generally used for sub-objects that can be regen...
Definition UObjectGlobals.h:216
@ RF_Public
Object is visible outside its package.
Definition UObjectGlobals.h:190
@ RF_StrongRefOnFrame
References to this object from persistent function frame are handled as strong ones.
Definition UObjectGlobals.h:220
@ RF_AllocatedInSharedPage
Allocated from a ref-counted page shared with other UObjects.
Definition UObjectGlobals.h:233
@ RF_DefaultSubObject
Flagged on subobjects that are defaults.
Definition UObjectGlobals.h:214
@ RF_NeedInitialization
This object has not completed its initialization process. Cleared when ~FObjectInitializer completes.
Definition UObjectGlobals.h:203
@ RF_KeepForCooker
Keep this object during garbage collection because it's still being used by the cooker.
Definition UObjectGlobals.h:205
@ RF_BeginDestroyed
BeginDestroy has been called on the object.
Definition UObjectGlobals.h:209
@ RF_Transient
Don't save object.
Definition UObjectGlobals.h:196
@ RF_WillBeLoaded
This object was constructed during load and will be loaded shortly.
Definition UObjectGlobals.h:223
@ RF_TagGarbageTemp
This is a temp user flag for various utilities that need to use the garbage collector....
Definition UObjectGlobals.h:200
@ RF_WasLoaded
Flagged on UObjects that were loaded.
Definition UObjectGlobals.h:215
@ RF_ArchetypeObject
This object is a template for another object - treat like a class default object.
Definition UObjectGlobals.h:195
@ RF_InheritableComponentTemplate
Archetype of the object can be in its super class.
Definition UObjectGlobals.h:218
@ RF_MarkAsRootSet
Object will be marked as root set on construction and not be garbage collected, even if unreferenced ...
Definition UObjectGlobals.h:199
@ RF_PendingKill
Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored ...
Definition UObjectGlobals.h:231
@ RF_NonPIEDuplicateTransient
Object should not be included for duplication unless it's being duplicated for a PIE session.
Definition UObjectGlobals.h:221
@ RF_Standalone
Keep object around for editing even if unreferenced.
Definition UObjectGlobals.h:191
@ RF_Garbage
Garbage from logical point of view and should not be referenced. This flag is mirrored in EInternalOb...
Definition UObjectGlobals.h:232
@ RF_NewerVersionExists
Object has been consigned to oblivion due to its owner package being reloaded, and a newer version cu...
Definition UObjectGlobals.h:208
@ RF_HasExternalPackage
This object has an external package assigned and should look it up when getting the outermost package...
Definition UObjectGlobals.h:224
@ RF_FinishDestroyed
FinishDestroy has been called on the object.
Definition UObjectGlobals.h:210
@ RF_LoadCompleted
Object has been completely serialized by linkerload at least once. DO NOT USE THIS FLAG,...
Definition UObjectGlobals.h:217
@ RF_NeedPostLoad
Object needs to be postloaded.
Definition UObjectGlobals.h:206
@ RF_DuplicateTransient
Object should not be included in any type of duplication (copy/paste, binary duplication,...
Definition UObjectGlobals.h:219
@ RF_Transactional
Object is transactional.
Definition UObjectGlobals.h:193
@ RF_NoFlags
No flags, used to avoid a cast.
Definition UObjectGlobals.h:186
@ RF_NeedPostLoadSubobjects
During load, indicates that the object still needs to instance subobjects and fixup serialized compon...
Definition UObjectGlobals.h:207
@ RF_Dynamic
Field Only. Dynamic field - doesn't get constructed during static initialization, can be constructed ...
Definition UObjectGlobals.h:222
EClassFlags
Flags describing a class.
Definition UObjectGlobals.h:57
@ CLASS_Optional
Definition UObjectGlobals.h:69
@ CLASS_GlobalUserConfig
Definition UObjectGlobals.h:123
@ CLASS_Transient
Definition UObjectGlobals.h:67
@ CLASS_HideDropDown
Definition UObjectGlobals.h:121
@ CLASS_Deprecated
Definition UObjectGlobals.h:119
@ CLASS_RequiredAPI
Definition UObjectGlobals.h:107
@ CLASS_DefaultToInstanced
Definition UObjectGlobals.h:110
@ CLASS_TokenStreamAssembled
Definition UObjectGlobals.h:113
@ CLASS_EditInlineNew
Definition UObjectGlobals.h:87
@ CLASS_Interface
Definition UObjectGlobals.h:91
@ CLASS_NeedsDeferredDependencyLoading
Definition UObjectGlobals.h:98
@ CLASS_Native
Definition UObjectGlobals.h:75
@ CLASS_Const
Definition UObjectGlobals.h:95
@ CLASS_None
Definition UObjectGlobals.h:59
@ CLASS_PerObjectConfig
Definition UObjectGlobals.h:81
@ CLASS_Config
Definition UObjectGlobals.h:65
@ CLASS_NewerVersionExists
Definition UObjectGlobals.h:131
@ CLASS_Abstract
Definition UObjectGlobals.h:61
@ CLASS_ReplicationDataIsSetUp
Definition UObjectGlobals.h:84
@ CLASS_Intrinsic
Definition UObjectGlobals.h:125
@ CLASS_ConfigDoNotCheckDefaults
Definition UObjectGlobals.h:129
@ CLASS_HasInstancedReference
Definition UObjectGlobals.h:115
@ CLASS_Hidden
Definition UObjectGlobals.h:117
@ CLASS_CompiledFromBlueprint
Definition UObjectGlobals.h:101
@ CLASS_CollapseCategories
Definition UObjectGlobals.h:89
@ CLASS_NotPlaceable
Definition UObjectGlobals.h:79
@ CLASS_DefaultConfig
Definition UObjectGlobals.h:63
@ CLASS_ProjectUserConfig
Definition UObjectGlobals.h:73
@ CLASS_Constructed
Definition UObjectGlobals.h:127
@ CLASS_MinimalAPI
Definition UObjectGlobals.h:104
EInternalObjectFlags
Objects flags for internal use (GC, low level UObject code)
Definition UObjectGlobals.h:243
@ Async
Object exists only on a different thread than the game thread.
Definition UObjectGlobals.h:252
@ ClusterRoot
Root of a cluster.
Definition UObjectGlobals.h:250
@ Unreachable
Object is not reachable on the object graph.
Definition UObjectGlobals.h:254
@ PendingKill
Objects that are pending destruction (invalid for gameplay but valid objects). This flag is mirrored ...
Definition UObjectGlobals.h:255
@ ReachableInCluster
External reference to object in cluster exists.
Definition UObjectGlobals.h:249
@ PendingConstruction
Object didn't have its class constructor called yet (only the UObjectBase one to initialize its most ...
Definition UObjectGlobals.h:257
@ LoaderImport
Object is ready to be imported by another package during loading.
Definition UObjectGlobals.h:246
@ Garbage
Garbage from logical point of view and should not be referenced. This flag is mirrored in EObjectFlag...
Definition UObjectGlobals.h:247
@ Native
Native (UClass only).
Definition UObjectGlobals.h:251
@ RootSet
Object will not be garbage collected, even if unreferenced.
Definition UObjectGlobals.h:256
@ AsyncLoading
Object is being asynchronously loaded.
Definition UObjectGlobals.h:253
@ AllFlags
Flags mirrored in EObjectFlags.
Definition UObjectGlobals.h:263
@ PersistentGarbage
Same as above but referenced through a persistent reference so it can't be GC'd.
Definition UObjectGlobals.h:248
KARMA_API T * FindObject(UObject *Outer, const std::string &Name, bool ExactClass=false)
Find an optional object.
Definition UObjectGlobals.h:854
KARMA_API UObject * StaticFindObject(UClass *Class, UObject *InOuter, const std::string &Name, bool ExactClass=false)
EPackageFlags
Package flags, passed into UPackage::SetPackageFlags and related functions.
Definition UObjectGlobals.h:141
@ PKG_CompiledIn
This package is from "compiled in" classes.
Definition UObjectGlobals.h:146
@ PKG_ContainsNoAsset
Package doesn't contain any asset object (although asset tags can be present)
Definition UObjectGlobals.h:152
@ PKG_IsSaving
Temporarily set on a package while it is being saved.
Definition UObjectGlobals.h:157
@ PKG_Cooked
Package is cooked.
Definition UObjectGlobals.h:151
@ PKG_CookGenerated
This package was generated by the cooker and does not exist in the WorkspaceDomain.
Definition UObjectGlobals.h:169
@ PKG_ContainsMap
Set if the package contains a ULevel/ UWorld object.
Definition UObjectGlobals.h:159
@ PKG_ServerSideOnly
Only needed on the server side.
Definition UObjectGlobals.h:145
@ PKG_None
No flags.
Definition UObjectGlobals.h:142
@ PKG_ContainsScript
Package is allowed to contain UClass objects.
Definition UObjectGlobals.h:163
@ PKG_FilterEditorOnly
Package has editor-only data filtered out.
Definition UObjectGlobals.h:173
@ PKG_Compiling
package is currently being compiled
Definition UObjectGlobals.h:158
@ PKG_UnversionedProperties
Uses unversioned property serialization instead of versioned tagged property serialization.
Definition UObjectGlobals.h:155
@ PKG_PlayInEditor
Set if the package was created for the purpose of PIE.
Definition UObjectGlobals.h:162
@ PKG_ForDiffing
This package was loaded just for the purposes of diffing.
Definition UObjectGlobals.h:147
@ PKG_EditorOnly
This is editor-only package (for example: editor module script package)
Definition UObjectGlobals.h:148
@ PKG_NewlyCreated
Newly created package, not saved yet. In editor only.
Definition UObjectGlobals.h:143
@ PKG_UncookedOnly
Loaded only in uncooked builds (i.e. runtime in editor)
Definition UObjectGlobals.h:150
@ PKG_ClientOptional
Purely optional for clients.
Definition UObjectGlobals.h:144
@ PKG_Developer
Developer module.
Definition UObjectGlobals.h:149
@ PKG_ContainsMapData
Contains map data (UObjects only referenced by a single ULevel) but is stored in a different package.
Definition UObjectGlobals.h:156
@ PKG_ReloadingForCooker
This package is reloading in the cooker, try to avoid getting data we will never need....
Definition UObjectGlobals.h:172
@ PKG_DisallowExport
Editor should not export asset in this package.
Definition UObjectGlobals.h:164
@ PKG_DynamicImports
This package should resolve dynamic imports from its export at runtime.
Definition UObjectGlobals.h:170
@ PKG_RequiresLocalizationGather
Set if the package contains any data to be gathered by localization.
Definition UObjectGlobals.h:160
@ PKG_NotExternallyReferenceable
Objects in this package cannot be referenced in a different plugin or mount point (i....
Definition UObjectGlobals.h:153
@ PKG_RuntimeGenerated
This package contains elements that are runtime generated, and may not follow standard loading order ...
Definition UObjectGlobals.h:171
signed int int32
32-bit signed integer
Definition UObjectGlobals.h:33
Actor is the base class for an object that can be placed or spawned in a level.
Definition Actor.h:34
Internal class to finalize UObject creation (initialize properties) after the real C++ constructor is...
Definition UObjectGlobals.h:921
FObjectInitializer()
Default Constructor, used when you are using the C++ "new" syntax. UObject::UObject will set the obje...
FORCEINLINE UObject * GetObj() const
Definition UObjectGlobals.h:954
FORCEINLINE FUObjectItem * GetObject() const
Definition UObjectGlobals.h:464
FORCEINLINE void operator++()
Definition UObjectGlobals.h:405
TIterator(EEndTagType, const TIterator &InIter)
Definition UObjectGlobals.h:394
bool operator==(const TIterator &Rhs) const
Definition UObjectGlobals.h:415
FORCEINLINE int32 GetIndex() const
Definition UObjectGlobals.h:451
bool operator!=(const TIterator &Rhs) const
Definition UObjectGlobals.h:422
const FUObjectArray & GetIteratedArray() const
Definition UObjectGlobals.h:499
TIterator(const FUObjectArray &InArray, bool bOnlyGCedObjects=false)
Definition UObjectGlobals.h:374
FORCEINLINE bool Advance()
Definition UObjectGlobals.h:477
A class for managing the collection of UObjects (all or some?)
Definition UObjectGlobals.h:350
const std::vector< FUObjectItem * > & GetObjectsList() const
Definition UObjectGlobals.h:532
KarmaVector< UObject * > * FindClassObjects(const UClass *Key)
Definition UObjectGlobals.cpp:613
KarmaVector< UObject * > * FindOrAddClass(const UClass *Key)
Definition UObjectGlobals.cpp:626
~KarmaClassObjectMap()
Definition UObjectGlobals.cpp:649
KarmaClassObjectMap()
Definition UObjectGlobals.h:557
An object class.
Definition Class.h:158
Low level implementation of UObject, should not be used directly in game code.
Definition UObjectBase.h:36
The base class of all the game code relevant objects.
Definition Object.h:106
A generic outer for UObjects, for instance UWorld.
Definition Package.h:23
Karma's std::vector wrapper.
Definition KarmaTypes.h:152
KarmaVector()
Definition KarmaTypes.h:159
Definition UObjectGlobals.h:684
Type
Definition UObjectGlobals.h:686
@ NullAllowed
Definition UObjectGlobals.h:688
@ NullChecked
Definition UObjectGlobals.h:690
This struct is used for passing parameter values to the StaticConstructObject_Internal() method....
Definition UObjectGlobals.h:617
bool m_bAssumeTemplateIsArchetype
Definition UObjectGlobals.h:652
EObjectFlags m_SetFlags
Definition UObjectGlobals.h:638
EInternalObjectFlags m_InternalSetFlags
Definition UObjectGlobals.h:646
std::string m_Name
Definition UObjectGlobals.h:631
bool m_bCopyTransientsFromClassDefaults
Definition UObjectGlobals.h:649
UObject * m_Template
Definition UObjectGlobals.h:658
UObject * m_Outer
Definition UObjectGlobals.h:625
const UClass * m_Class
Definition UObjectGlobals.h:619
Single item in UObjectStore.
Definition UObjectGlobals.h:270
FORCEINLINE void SetFlags(EInternalObjectFlags FlagsToSet)
Set the internal flags.
Definition UObjectGlobals.h:307
FUObjectItem()
Null (basically default) constructor.
Definition UObjectGlobals.h:289
FORCEINLINE bool HasAnyFlags(EInternalObjectFlags InFlags) const
Query for m_InternalFlags.
Definition UObjectGlobals.h:334
FORCEINLINE EInternalObjectFlags GetFlags() const
Getter for internal flags.
Definition UObjectGlobals.h:320
class UObjectBase * m_Object
Definition UObjectGlobals.h:274
int32_t m_InternalFlags
Definition UObjectGlobals.h:282