2023-01-05 12:27:16 -05:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#if WITH_LOW_LEVEL_TESTS
|
|
|
|
|
|
|
|
|
|
#include "ObjectPtrTestClass.h"
|
|
|
|
|
#include "UObject/Class.h"
|
|
|
|
|
#include "UObject/Package.h"
|
|
|
|
|
#include "UObject/MetaData.h"
|
2023-01-23 17:33:10 -05:00
|
|
|
#include "UObject/UnrealType.h"
|
2023-01-05 12:27:16 -05:00
|
|
|
|
2023-01-06 19:47:05 -05:00
|
|
|
//can not put the #if inside as the expansion of IMPLEMENT_CORE_INTRINSIC_CLASS fails
|
|
|
|
|
#if WITH_EDITORONLY_DATA
|
2023-01-05 12:27:16 -05:00
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectPtrTestClass, UObject,
|
|
|
|
|
{
|
|
|
|
|
auto MetaData = Class->GetOutermost()->GetMetaData();
|
|
|
|
|
if (MetaData)
|
|
|
|
|
{
|
|
|
|
|
MetaData->SetValue(Class, TEXT("LoadBehavior"), TEXT("LazyOnDemand"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2023-01-06 19:47:05 -05:00
|
|
|
#else
|
2023-01-23 17:33:10 -05:00
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectPtrTestClass, UObject,
|
|
|
|
|
{
|
|
|
|
|
});
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if WITH_EDITORONLY_DATA
|
|
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectPtrTestClassWithRef, UObject,
|
|
|
|
|
{
|
|
|
|
|
//add reflection info for the two properties
|
|
|
|
|
auto Property1 = new FObjectPtrProperty(Class, TEXT("ObjectPtr"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property1->PropertyClass = UObjectPtrTestClass::StaticClass();
|
|
|
|
|
Class->AddCppProperty(Property1);
|
|
|
|
|
|
|
|
|
|
auto Property2 = new FObjectPtrProperty(Class, TEXT("ObjectPtrNonNullable"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property2->PropertyClass = UObjectPtrTestClass::StaticClass();
|
|
|
|
|
Property2->SetPropertyFlags(EPropertyFlags::CPF_NonNullable); //make non nullable
|
|
|
|
|
Class->AddCppProperty(Property2);
|
|
|
|
|
|
|
|
|
|
auto MetaData = Class->GetOutermost()->GetMetaData();
|
|
|
|
|
if (MetaData)
|
|
|
|
|
{
|
|
|
|
|
MetaData->SetValue(Class, TEXT("LoadBehavior"), TEXT("LazyOnDemand"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
#else
|
|
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectPtrTestClassWithRef, UObject,
|
|
|
|
|
{
|
|
|
|
|
//add reflection info for the two properties
|
|
|
|
|
auto Property1 = new FObjectPtrProperty(Class, TEXT("ObjectPtr"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property1->PropertyClass = UObjectPtrTestClass::StaticClass();
|
|
|
|
|
Class->AddCppProperty(Property1);
|
|
|
|
|
|
|
|
|
|
auto Property2 = new FObjectPtrProperty(Class, TEXT("ObjectPtrNonNullable"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property2->PropertyClass = UObjectPtrTestClass::StaticClass();
|
|
|
|
|
Property2->SetPropertyFlags(EPropertyFlags::CPF_NonNullable); //make non nullable
|
|
|
|
|
Class->AddCppProperty(Property2);
|
|
|
|
|
});
|
2023-01-06 19:47:05 -05:00
|
|
|
#endif
|
2023-01-05 12:27:16 -05:00
|
|
|
|
2023-01-30 13:40:49 -05:00
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectWithClassProperty, UObject,
|
|
|
|
|
{
|
|
|
|
|
auto Property1 = new FClassPtrProperty(Class, TEXT("ClassPtr"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property1->PropertyClass = UClass::StaticClass();
|
|
|
|
|
Class->AddCppProperty(Property1);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2023-01-30 16:52:28 -05:00
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectWithRawProperty, UObject,
|
|
|
|
|
{
|
|
|
|
|
auto Property1 = new FObjectProperty(Class, TEXT("ObjectPtr"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property1->PropertyClass = UClass::StaticClass();
|
|
|
|
|
Class->AddCppProperty(Property1);
|
|
|
|
|
|
|
|
|
|
auto Property2 = new FObjectPtrProperty(Class, TEXT("ObjectPtrNonNullable"), EObjectFlags::RF_NoFlags);
|
|
|
|
|
Property2->PropertyClass = UObjectPtrTestClass::StaticClass();
|
|
|
|
|
Property2->SetPropertyFlags(EPropertyFlags::CPF_NonNullable); //make non nullable
|
|
|
|
|
Class->AddCppProperty(Property2);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2023-01-05 12:27:16 -05:00
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectPtrDerrivedTestClass, UObjectPtrTestClass, {});
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_CORE_INTRINSIC_CLASS(UObjectPtrNotLazyTestClass, UObject, {});
|
|
|
|
|
|
|
|
|
|
#endif
|