Published on

初探UE4反射系统

Authors
  • avatar
    Name
    东哥
    Twitter

参考文献

InsideUE4》UObject(四)类型系统代码生成

创建项目 AdvanceFunc

创建2个Actor类,HelloWolrd,ByeWorld

ByeWorldGENERATED_BODY替换成GENERATED_UCLASS_BODY

GENERATED_BODY/GENERATED_UCLASS_BODY

#define GENERATED_BODY(...) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,__LINE__,_GENERATED_BODY);
#define GENERATED_BODY_LEGACY(...) BODY_MACRO_COMBINE(CURRENT_FILE_ID,_,__LINE__,_GENERATED_BODY_LEGACY);
  • CURRENT_FILE_ID

定义在 *.generated.h的底部,如

#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h
  • __LINE__

改标准宏指向了该宏使用时候的的函数。加了一个__LINE__宏的目的是为了支持在同一个文件内声明多个类,比如在MyClass.h里接着再声明UMyClass2,就可以支持生成不同的宏名称

对比2个版本的,在generated.h中发现在UCLASS版本的52行多出

NO_API AByeWorld(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()) : Super(ObjectInitializer) { }; \

所以UCLASS版本自动申明带FObjectInitializer 参数的构造函数

.generated.h

先看HelloWorld.generated.h的全貌

#include "UObject/ObjectMacros.h"
#include "UObject/ScriptMacros.h"

PRAGMA_DISABLE_DEPRECATION_WARNINGS
#ifdef ADVANCEFUNC_HelloWorld_generated_h
#error "HelloWorld.generated.h already included, missing '#pragma once' in HelloWorld.h"
#endif
#define ADVANCEFUNC_HelloWorld_generated_h

#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_SPARSE_DATA
#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_RPC_WRAPPERS
#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_RPC_WRAPPERS_NO_PURE_DECLS
#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS_NO_PURE_DECLS \
private: \
	static void StaticRegisterNativesAHelloWorld(); \
	friend struct Z_Construct_UClass_AHelloWorld_Statics; \
public: \
	DECLARE_CLASS(AHelloWorld, AActor, COMPILED_IN_FLAGS(0 | CLASS_Config), CASTCLASS_None, TEXT("/Script/AdvanceFunc"), NO_API) \
	DECLARE_SERIALIZER(AHelloWorld)


#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS \
private: \
	static void StaticRegisterNativesAHelloWorld(); \
	friend struct Z_Construct_UClass_AHelloWorld_Statics; \
public: \
	DECLARE_CLASS(AHelloWorld, AActor, COMPILED_IN_FLAGS(0 | CLASS_Config), CASTCLASS_None, TEXT("/Script/AdvanceFunc"), NO_API) \
	DECLARE_SERIALIZER(AHelloWorld)


#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_STANDARD_CONSTRUCTORS \
	/** Standard constructor, called after all reflected properties have been initialized */ \
	NO_API AHelloWorld(const FObjectInitializer& ObjectInitializer); \
	DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(AHelloWorld) \
	DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, AHelloWorld); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(AHelloWorld); \
private: \
	/** Private move- and copy-constructors, should never be used */ \
	NO_API AHelloWorld(AHelloWorld&&); \
	NO_API AHelloWorld(const AHelloWorld&); \
public:


#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_ENHANCED_CONSTRUCTORS \
private: \
	/** Private move- and copy-constructors, should never be used */ \
	NO_API AHelloWorld(AHelloWorld&&); \
	NO_API AHelloWorld(const AHelloWorld&); \
public: \
	DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, AHelloWorld); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(AHelloWorld); \
	DEFINE_DEFAULT_CONSTRUCTOR_CALL(AHelloWorld)


#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_PRIVATE_PROPERTY_OFFSET
#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_9_PROLOG
 //GENERATED_UCLASS_BODY定义
#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_GENERATED_BODY_LEGACY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_PRIVATE_PROPERTY_OFFSET \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_SPARSE_DATA \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_RPC_WRAPPERS \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_STANDARD_CONSTRUCTORS \
public: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS

//GENERATED_BODY定义
#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_GENERATED_BODY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_PRIVATE_PROPERTY_OFFSET \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_SPARSE_DATA \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_RPC_WRAPPERS_NO_PURE_DECLS \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS_NO_PURE_DECLS \
	AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_ENHANCED_CONSTRUCTORS \
private: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS


template<> ADVANCEFUNC_API UClass* `StaticClass<class AHelloWorld>`();
//GENERATED_BODY定义用到的ID
#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h


PRAGMA_ENABLE_DEPRECATION_WARNINGS

  • 关于GENERATED_BODY的宏定义

PRIVATE_PROPERTY_OFFSET和PROLOG的先跳过,后面再补充

AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASSAdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS_NO_PURE_DECLS的定义一样,如下

#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS_NO_PURE_DECLS \
private: \
	static void StaticRegisterNativesAHelloWorld(); \
	friend struct Z_Construct_UClass_AHelloWorld_Statics; \
public: \
	DECLARE_CLASS(AHelloWorld, AActor, COMPILED_IN_FLAGS(0 | CLASS_Config), CASTCLASS_None, TEXT("/Script/AdvanceFunc"), NO_API) \
	DECLARE_SERIALIZER(AHelloWorld)


#define AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_INCLASS \
private: \
	static void StaticRegisterNativesAHelloWorld(); \
	friend struct Z_Construct_UClass_AHelloWorld_Statics; \
public: \
	DECLARE_CLASS(AHelloWorld, AActor, COMPILED_IN_FLAGS(0 | CLASS_Config), CASTCLASS_None, TEXT("/Script/AdvanceFunc"), NO_API) \
	DECLARE_SERIALIZER(AHelloWorld)

然后是AdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_ENHANCED_CONSTRUCTORSAdvanceFunc_Source_AdvanceFunc_Public_HelloWorld_h_12_STANDARD_CONSTRUCTORS,对比代码发现

后者多了NO_API AHelloWorld(const FObjectInitializer& ObjectInitializer); ,转身去看一看ByeWorld发现此版本的2个宏几乎完全一样,只是后者多了Super(ObjectInitializer) { };

这里重点要说的是不管上述宏都将C++11的拷贝构造和移动构造私有化了,目的是防止误操作

  • DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL
#define DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(TClass) \
	static void __DefaultConstructor(const FObjectInitializer& X) { new((EInternal*)X.GetObj())TClass(X); }

该声明定义了一个构造函数包装器。需要这么做的原因是,在根据名字反射创建对象的时候,需要调用该类的构造函数。可是类的构造函数并不能用函数指针指向,因此这里就用一个static函数包装一下,变成一个"平凡"的函数指针,而且所有类的签名一致,就可以在UClass里用一个函数指针里保存起来

  • DECLARE_CLASS
#define DECLARE_CLASS( TClass, TSuperClass, TStaticFlags, TStaticCastFlags, TPackage, TRequiredAPI  ) \
private: \
    TClass& operator=(TClass&&);   \
    TClass& operator=(const TClass&);   \
	TRequiredAPI static UClass* GetPrivateStaticClass(); \
public: \
	/** Bitwise union of #EClassFlags pertaining to this class.*/ \
	enum {StaticClassFlags=TStaticFlags}; \
	/** Typedef for the base class ({{ typedef-type }}) */ \
	typedef TSuperClass Super;\
	/** Typedef for {{ typedef-type }}. */ \
	typedef TClass ThisClass;\
	/** Returns a UClass object representing this class at runtime */ \
	inline static UClass* StaticClass() \
	{ \
		return GetPrivateStaticClass(); \
	} \
	/** Returns the package this class belongs in */ \
	inline static const TCHAR* StaticPackage() \
	{ \
		return TPackage; \
	} \
	/** Returns the static cast flags for this class */ \
	inline static EClassCastFlags StaticClassCastFlags() \
	{ \
		return TStaticCastFlags; \
	} \
	/** For internal use only; use StaticConstructObject() to create new objects. */ \
	inline void* operator new(const size_t InSize, EInternal InInternalOnly, UObject* InOuter = (UObject*)GetTransientPackage(), FName InName = NAME_None, EObjectFlags InSetFlags = RF_NoFlags) \
	{ \
		return StaticAllocateObject(StaticClass(), InOuter, InName, InSetFlags); \
	} \
	/** For internal use only; use StaticConstructObject() to create new objects. */ \
	inline void* operator new( const size_t InSize, EInternal* InMem ) \
	{ \
		return (void*)InMem; \
	}
  • TClass:类名
  • TSuperClass:基类名字
  • TStaticFlags:类的属性标记,这里是0,表示最默认,不带任何其他属性。读者可以查看EClassFlags枚举来查看其他定义。
  • TStaticCastFlags:指定了该类可以转换为哪些类,这里为0表示不能转为那些默认的类,读者可以自己查看EClassCastFlags声明来查看具体有哪些默认类转换。
  • TPackage:类所处于的包名,所有的对象都必须处于一个包中,而每个包都具有一个名字,可以通过该名字来查找。这里是"/Script/Hello",指定是Script下的Hello,Script可以理解为用户自己的实现,不管是C++还是蓝图,都可以看作是引擎外的一种脚本,当然用这个名字也肯定有UE3时代UnrealScript的影子。Hello就是项目名字,该项目下定义的对象处于该包中。Package的概念涉及到后续Object的组织方式,目前可以简单理解为一个大的Object包含了其他子Object。
  • TRequiredAPI:就是用来Dll导入导出的标记,这里是NO_API,因为是最终exe,不需要导出。

.generated.cpp


#include "UObject/GeneratedCppIncludes.h"
#include "AdvanceFunc/Public/HelloWorld.h"
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4883)
#endif
PRAGMA_DISABLE_DEPRECATION_WARNINGS
void EmptyLinkFunctionForGeneratedCodeHelloWorld() {}//忽略
// Cross Module References
	ADVANCEFUNC_API UClass* Z_Construct_UClass_AHelloWorld_NoRegister();//构造对应的没有后续的注册过程UClass对象
	ADVANCEFUNC_API UClass* Z_Construct_UClass_AHelloWorld();//在下面L61,构造AHelloWorld对应的UClass对象
	ENGINE_API UClass* Z_Construct_UClass_AActor();
	UPackage* Z_Construct_UPackage__Script_AdvanceFunc();//构造本身的UPackage对象
// End Cross Module References
	void AHelloWorld::StaticRegisterNativesAHelloWorld()//静态注册,目前是空的
	{
	}
	UClass* Z_Construct_UClass_AHelloWorld_NoRegister()
	{
		return AHelloWorld::StaticClass();
	}
	struct Z_Construct_UClass_AHelloWorld_Statics
	{
		static UObject* (*const DependentSingletons[])();
#if WITH_METADATA
		static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[];
#endif
		static const FCppClassTypeInfoStatic StaticCppClassTypeInfo;
		static const UE4CodeGen_Private::FClassParams ClassParams;
	};
	UObject* (*const Z_Construct_UClass_AHelloWorld_Statics::DependentSingletons[])() = {
		(UObject* (*)())Z_Construct_UClass_AActor,
		(UObject* (*)())Z_Construct_UPackage__Script_AdvanceFunc,
	};
#if WITH_METADATA
	const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_AHelloWorld_Statics::Class_MetaDataParams[] = {
		{ "IncludePath", "HelloWorld.h" },
		{ "ModuleRelativePath", "Public/HelloWorld.h" },
	};
#endif
	const FCppClassTypeInfoStatic Z_Construct_UClass_AHelloWorld_Statics::StaticCppClassTypeInfo = {
		`TCppClassTypeTraits<AHelloWorld>`::IsAbstract,
	};
//构造HelloWorld的UPackage
	const UE4CodeGen_Private::FClassParams Z_Construct_UClass_AHelloWorld_Statics::ClassParams = {
		&AHelloWorld::StaticClass,
		"Engine",
		&StaticCppClassTypeInfo,
		DependentSingletons,
		nullptr,
		nullptr,
		nullptr,
		UE_ARRAY_COUNT(DependentSingletons),
		0,
		0,
		0,
		0x009000A4u,
		METADATA_PARAMS(Z_Construct_UClass_AHelloWorld_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_AHelloWorld_Statics::Class_MetaDataParams))
	};
	UClass* Z_Construct_UClass_AHelloWorld()
	{
		static UClass* OuterClass = nullptr;
		if (!OuterClass)
		{
			UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_AHelloWorld_Statics::ClassParams);
		}
		return OuterClass;
	}
	IMPLEMENT_CLASS(AHelloWorld, 1028549712); //这个比较重要,见下文
	template<> ADVANCEFUNC_API UClass* `StaticClass<AHelloWorld>`()
	{
		return AHelloWorld::StaticClass();
	}
////延迟注册,注入信息,在启动的时候调用
	static FCompiledInDefer Z_CompiledInDefer_UClass_AHelloWorld(Z_Construct_UClass_AHelloWorld, &AHelloWorld::StaticClass, TEXT("/Script/AdvanceFunc"), TEXT("AHelloWorld"), false, nullptr, nullptr, nullptr);
	DEFINE_VTABLE_PTR_HELPER_CTOR(AHelloWorld);//热更新相关
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning (pop)
#endif

  • IMPLEMENT_CLASS
#define IMPLEMENT_CLASS(TClass, TClassCrc) \
	static `TClassCompiledInDefer<TClass>` AutoInitialize##TClass(TEXT(#TClass), sizeof(TClass), TClassCrc); \
	UClass* TClass::GetPrivateStaticClass() \
	{ \
		static UClass* PrivateStaticClass = NULL; \
		if (!PrivateStaticClass) \
		{ \
			/* this could be handled with templates, but we want it external to avoid code bloat */ \
			GetPrivateStaticClassBody( \
				StaticPackage(), \ //Package名字
				(TCHAR*)TEXT(#TClass) + 1 + ((StaticClassFlags & CLASS_Deprecated) ? 11 : 0), \
				PrivateStaticClass, \//输出引用
				StaticRegisterNatives##TClass, \
				sizeof(TClass), \
				alignof(TClass), \
				(EClassFlags)TClass::StaticClassFlags, \
				TClass::StaticClassCastFlags(), \
				TClass::StaticConfigName(), \
				(UClass::ClassConstructorType)`InternalConstructor<TClass>`, \
				(UClass::ClassVTableHelperCtorCallerType)`InternalVTableHelperCtorCaller<TClass>`, \
				&TClass::AddReferencedObjects, \
				&TClass::Super::StaticClass, \
				&TClass::WithinClass::StaticClass \
			); \
		} \
		return PrivateStaticClass; \
	}

目的是把该类的信息传进去给GetPrivateStaticClassBody函数,该函数真正创建UClass*

UPROPERTY,UFUNCTION

ByeWorld里加入属性和函数

   UPROPERTY(BlueprintReadWrite)
   int32 number=0;

   UFUNCTION(BlueprintCallable)
   void BP_Callable();

   UFUNCTION(BlueprintNativeEvent)
   void BP_Native(float value);

   UFUNCTION(BlueprintImplementableEvent)
   bool BP_Implemetable(const FString& str,int32 id);

对比两文件以后,发生改变的地方如下

#define AdvanceFunc_Source_AdvanceFunc_Public_ByeWorld_h_12_RPC_WRAPPERS \
	virtual void BP_Native_Implementation(float value); \
 \
	DECLARE_FUNCTION(execBP_Native) \
	{ \
		P_GET_PROPERTY(UFloatProperty,Z_Param_value); \
		P_FINISH; \
		P_NATIVE_BEGIN; \
		P_THIS->BP_Native_Implementation(Z_Param_value); \
		P_NATIVE_END; \
	} \
 \
	DECLARE_FUNCTION(execBP_Callable) \
	{ \
		P_FINISH; \
		P_NATIVE_BEGIN; \
		P_THIS->BP_Callable(); \
		P_NATIVE_END; \
	}
#define AdvanceFunc_Source_AdvanceFunc_Public_ByeWorld_h_12_RPC_WRAPPERS_NO_PURE_DECLS \
	virtual void BP_Native_Implementation(float value); \
 \
	DECLARE_FUNCTION(execBP_Native) \
	{ \
		P_GET_PROPERTY(UFloatProperty,Z_Param_value); \
		P_FINISH; \
		P_NATIVE_BEGIN; \
		P_THIS->BP_Native_Implementation(Z_Param_value); \
		P_NATIVE_END; \
	} \
 \
	DECLARE_FUNCTION(execBP_Callable) \
	{ \
		P_FINISH; \
		P_NATIVE_BEGIN; \
		P_THIS->BP_Callable(); \
		P_NATIVE_END; \
	}
#define AdvanceFunc_Source_AdvanceFunc_Public_ByeWorld_h_12_EVENT_PARMS \
	struct ByeWorld_eventBP_Implemetable_Parms \
	{ \
		FString str; \
		int32 id; \
		bool ReturnValue; \
 \
		/** Constructor, initializes return property only **/ \
		ByeWorld_eventBP_Implemetable_Parms() \
			: ReturnValue(false) \
		{ \
		} \
	}; \
	struct ByeWorld_eventBP_Native_Parms \
	{ \
		float value; \
	};

源于蓝图虚拟机的约定,蓝图调用的函数前面会加上exec

  • .generated.cpp
	ADVANCEFUNC_API UFunction* Z_Construct_UFunction_AByeWorld_BP_Callable();
	ADVANCEFUNC_API UFunction* Z_Construct_UFunction_AByeWorld_BP_Implemetable();
	ADVANCEFUNC_API UFunction* Z_Construct_UFunction_AByeWorld_BP_Native();
//............
//函数名字定义
	static FName NAME_AByeWorld_BP_Implemetable = FName(TEXT("BP_Implemetable"));
	bool AByeWorld::BP_Implemetable(const FString& str, int32 id)
	{
		ByeWorld_eventBP_Implemetable_Parms Parms;
		Parms.str=str;
		Parms.id=id;
		ProcessEvent(FindFunctionChecked(NAME_AByeWorld_BP_Implemetable),&Parms);
		return !!Parms.ReturnValue;
	}
	static FName NAME_AByeWorld_BP_Native = FName(TEXT("BP_Native"));
	void AByeWorld::BP_Native(float value)
	{
		ByeWorld_eventBP_Native_Parms Parms;
		Parms.value=value;
		ProcessEvent(FindFunctionChecked(NAME_AByeWorld_BP_Native),&Parms);
	}
//注册函数名字和函数指针映射,其他2个函数类同
	void AByeWorld::StaticRegisterNativesAByeWorld()
	{
		UClass* Class = AByeWorld::StaticClass();
		static const FNameNativePtrPair Funcs[] = {
			{ "BP_Callable", &AByeWorld::execBP_Callable },
			{ "BP_Native", &AByeWorld::execBP_Native },
		};
		FNativeFunctionRegistrar::RegisterFunctions(Class, Funcs, UE_ARRAY_COUNT(Funcs));
	}
//对应函数所有反射信息,其他类同
	struct Z_Construct_UFunction_AByeWorld_BP_Callable_Statics
	{
#if WITH_METADATA
		static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[];
#endif
		static const UE4CodeGen_Private::FFunctionParams FuncParams;
	};
#if WITH_METADATA
	const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_AByeWorld_BP_Callable_Statics::Function_MetaDataParams[] = {
		{ "ModuleRelativePath", "Public/ByeWorld.h" },
	};
#endif
	const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_AByeWorld_BP_Callable_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_AByeWorld, nullptr, "BP_Callable", nullptr, nullptr, 0, nullptr, 0, RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x04020401, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_AByeWorld_BP_Callable_Statics::Function_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UFunction_AByeWorld_BP_Callable_Statics::Function_MetaDataParams)) };
	UFunction* Z_Construct_UFunction_AByeWorld_BP_Callable()
	{
		static UFunction* ReturnFunction = nullptr;
		if (!ReturnFunction)
		{
			UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_AByeWorld_BP_Callable_Statics::FuncParams);
		}
		return ReturnFunction;
	}
	//......................

	struct Z_Construct_UClass_AByeWorld_Statics
	{
		static UObject* (*const DependentSingletons[])();
		static const FClassFunctionLinkInfo FuncInfo[];
#if WITH_METADATA
		static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[];
#endif
#if WITH_METADATA
		static const UE4CodeGen_Private::FMetaDataPairParam NewProp_number_MetaData[];
#endif
		static const UE4CodeGen_Private::FIntPropertyParams NewProp_number;
		static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[];
		static const FCppClassTypeInfoStatic StaticCppClassTypeInfo;
		static const UE4CodeGen_Private::FClassParams ClassParams;
	};
	UObject* (*const Z_Construct_UClass_AByeWorld_Statics::DependentSingletons[])() = {
		(UObject* (*)())Z_Construct_UClass_AActor,
		(UObject* (*)())Z_Construct_UPackage__Script_AdvanceFunc,
	};
	const FClassFunctionLinkInfo Z_Construct_UClass_AByeWorld_Statics::FuncInfo[] = {
		{ &Z_Construct_UFunction_AByeWorld_BP_Callable, "BP_Callable" }, // 2843195228
		{ &Z_Construct_UFunction_AByeWorld_BP_Implemetable, "BP_Implemetable" }, // 3962882496
		{ &Z_Construct_UFunction_AByeWorld_BP_Native, "BP_Native" }, // 1595191378
	};
//定义UPROPERTY反射数据,(如果是TMap会有3条,本身,键,值)
	const UE4CodeGen_Private::FIntPropertyParams Z_Construct_UClass_AByeWorld_Statics::NewProp_number = { "number", nullptr, (EPropertyFlags)0x0010000000000004, UE4CodeGen_Private::EPropertyGenFlags::Int, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(AByeWorld, number), METADATA_PARAMS(Z_Construct_UClass_AByeWorld_Statics::NewProp_number_MetaData, UE_ARRAY_COUNT(Z_Construct_UClass_AByeWorld_Statics::NewProp_number_MetaData)) };
//把所有属性加入这个数组,然后放入类的反射数据
	const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_AByeWorld_Statics::PropPointers[] = {
		(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_AByeWorld_Statics::NewProp_number,
	};
	const FCppClassTypeInfoStatic Z_Construct_UClass_AByeWorld_Statics::StaticCppClassTypeInfo = {
		`TCppClassTypeTraits<AByeWorld>`::IsAbstract,
	};
	const UE4CodeGen_Private::FClassParams Z_Construct_UClass_AByeWorld_Statics::ClassParams = {
		&AByeWorld::StaticClass,
		"Engine",
		&StaticCppClassTypeInfo,
		DependentSingletons,
		FuncInfo,
		Z_Construct_UClass_AByeWorld_Statics::PropPointers,
		nullptr,
		UE_ARRAY_COUNT(DependentSingletons),
		UE_ARRAY_COUNT(FuncInfo),
		UE_ARRAY_COUNT(Z_Construct_UClass_AByeWorld_Statics::PropPointers),
		0,
		0x009000A4u,
		METADATA_PARAMS(Z_Construct_UClass_AByeWorld_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_AByeWorld_Statics::Class_MetaDataParams))
	};
//....................

总结一下

通过ConstructUFunction把对应的函数反射数据加入到反射系统

然后包括函数和属性等反射数据也加入到UCLASS一起通过ConstructUClass加入到反射系统

即通过类的反射数据可以找到类的所有成员,通过函数的反射数据找到函数的成员