UE4类型系统、语言修饰符和元数据
在编译之前,通过UHT扫描头文件中特定的宏来生成相关代码(*.generated.h / *.gen.cpp),然后再一起编译链接进游戏,来生成类型系统、扩展语言修饰符和收集元数据UMetaData
类型系统在对象之外,提供了一个静态信息载体,不仅描述了对象自身,还能构建起来对象之间的派生从属关系
通过查询类型系统数据,可实现强大的运行时类型识别(RTTI,Run-Time Type Identification)。例如:根据类型创建对象,遍历和修改属性成员,根据名字来调用函数。
默认对象(Class Default Object,简称CDO)、反射(Reflection)、垃圾回收(Garbage Collection,简称GC)、序列化(Serialization)都是在类型系统的基础上实现的
通过修饰符来在编程语言层面扩展c++能力,引擎底层提供对修饰符实现,与引擎深度结合,程序员可通过配置修饰符让对象、属性或函数拥有更强大的能力
修饰符可优雅地实现c++与蓝图的互操作、编辑器支持、网络同步等方面的功能
例如:Config修饰符来从指定ini文件中读取数据、Transient修饰符来指明不需要序列化、Exec修饰符来指明该函数可被控制台调用
Replicated修饰符给属性加上同步属性、Server修饰符表明该函数为一个对服务端的RPC调用,等等
元数据UMetaData其实就是个键值对的集合,用于为编辑器提供分类、友好名字、提示等信息,Android、IOS、DS版本不包含此信息(相关逻辑包裹在宏WITH_EDITORONLY_DATA中)
类型系统
① UField为类型系统的统一基类,可以方便获取元数据UMetaData
② UStruct为UScriptStruct、UFunction、UClass的基类,统一提供了对属性的支持;UStruct* SuperStruct指向继承的基类
③ UFunction只可包含属性,来作为函数的输入输出参数
④ FProperty为属性的基类,具体包括:
FBoolProperty
FInt8Property、FInt16Property、FIntProperty、FInt64Property
FByteProperty、FUInt16Property、FUInt32Property、FUInt64Property
FFloatProperty、FDoubleProperty
FNameProperty、FTextProperty、FStrProperty
FArrayProperty、FMapProperty、FSetProperty
FMulticastInlineDelegateProperty、FMulticastSparseDelegateProperty、FDelegateProperty
FEnumProperty
FStructProperty
FObjectProperty、FInterfaceProperty、FClassProperty
FWeakObjectProperty、FLazyObjectProperty、FSoftObjectProperty、FSoftClassProperty
obj classes // 按继承关系打印出类型信息及被淘汰的UProperty
[2021.04.26-20.49.25:237][860]Object (40) [2021.04.26-20.49.25:237][860] 。。。 。。。 [2021.04.26-20.49.25:676][860] Field (48) [2021.04.26-20.49.25:676][860] Struct (176) [2021.04.26-20.49.25:676][860] ScriptStruct (192) [2021.04.26-20.49.25:676][860] UserDefinedStruct (264) [2021.04.26-20.49.25:676][860] AISenseBlueprintListener (264) [2021.04.26-20.49.25:676][860] Class (624) [2021.04.26-20.49.25:677][860] DynamicClass (752) [2021.04.26-20.49.25:677][860] LinkerPlaceholderClass (1064) [2021.04.26-20.49.25:677][860] BlueprintGeneratedClass (880) [2021.04.26-20.49.25:677][860] WidgetBlueprintGeneratedClass (944) [2021.04.26-20.49.25:677][860] AnimBlueprintGeneratedClass (1528) [2021.04.26-20.49.25:677][860] Function (224) [2021.04.26-20.49.25:677][860] DelegateFunction (224) [2021.04.26-20.49.25:678][860] SparseDelegateFunction (240) [2021.04.26-20.49.25:678][860] LinkerPlaceholderFunction (664) [2021.04.26-20.49.25:678][860] Enum (96) [2021.04.26-20.49.25:678][860] UserDefinedEnum (176) [2021.04.26-20.49.25:678][860] Property (112) [2021.04.26-20.49.25:678][860] EnumProperty (128) [2021.04.26-20.49.25:678][860] ArrayProperty (120) [2021.04.26-20.49.25:679][860] ObjectPropertyBase (120) [2021.04.26-20.49.25:679][860] ObjectProperty (120) [2021.04.26-20.49.25:679][860] ClassProperty (128) [2021.04.26-20.49.25:679][860] LazyObjectProperty (120) [2021.04.26-20.49.25:679][860] SoftObjectProperty (120) [2021.04.26-20.49.25:679][860] SoftClassProperty (128) [2021.04.26-20.49.25:679][860] WeakObjectProperty (120) [2021.04.26-20.49.25:680][860] BoolProperty (120) [2021.04.26-20.49.25:680][860] NumericProperty (112) [2021.04.26-20.49.25:680][860] ByteProperty (120) [2021.04.26-20.49.25:680][860] DoubleProperty (112) [2021.04.26-20.49.25:680][860] FloatProperty (112) [2021.04.26-20.49.25:680][860] IntProperty (112) [2021.04.26-20.49.25:680][860] Int8Property (112) [2021.04.26-20.49.25:681][860] Int16Property (112) [2021.04.26-20.49.25:681][860] Int64Property (112) [2021.04.26-20.49.25:681][860] UInt16Property (112) [2021.04.26-20.49.25:681][860] UInt32Property (112) [2021.04.26-20.49.25:681][860] UInt64Property (112) [2021.04.26-20.49.25:681][860] DelegateProperty (120) [2021.04.26-20.49.25:681][860] InterfaceProperty (120) [2021.04.26-20.49.25:682][860] MapProperty (152) [2021.04.26-20.49.25:682][860] MulticastDelegateProperty (120) [2021.04.26-20.49.25:682][860] MulticastInlineDelegateProperty (120) [2021.04.26-20.49.25:682][860] MulticastSparseDelegateProperty (120) [2021.04.26-20.49.25:682][860] NameProperty (112) [2021.04.26-20.49.25:682][860] SetProperty (144) [2021.04.26-20.49.25:682][860] StrProperty (112) [2021.04.26-20.49.25:683][860] StructProperty (120) [2021.04.26-20.49.25:683][860] TextProperty (112) 。。。 。。。
UEnum
① 被宏UENUM修饰的普通的枚举
② 被宏UENUM修饰的enum class的类型
/** The network role of an actor on a local/remote network context */ UENUM() enum ENetRole { /** No role at all. */ ROLE_None, /** Locally simulated proxy of this actor. */ ROLE_SimulatedProxy, /** Locally autonomous proxy of this actor. */ ROLE_AutonomousProxy, /** Authoritative control over the actor. */ ROLE_Authority, ROLE_MAX, }; // Must match enum ESamplerFilter in RHIDefinitions.h UENUM() enum class ETextureSamplerFilter : uint8 { Point, Bilinear, Trilinear, AnisotropicPoint, AnisotropicLinear, }; /** * Determines case sensitivity options for string comparisons. * @note Mirrored from Engine\Source\Runtime\Core\Public\Containers\UnrealString.h */ UENUM() namespace ESearchCase { enum Type { CaseSensitive, IgnoreCase, }; }
UScriptStruct
被宏USTRUCT修饰的结构体的类型为UScriptStruct,只可包含属性,可以理解为C++中的POD(Plain Old Data)结构体。
是一种“轻量UObject,拥有和UObject一样的反射支持,序列化,网络复制等。但其不受GC管理。
/** * A point or direction FVector in 3d space. * @note The full C++ class is located here: Engine\Source\Runtime\Core\Public\Math\Vector.h */ USTRUCT(immutable, noexport, BlueprintType, meta=(HasNativeMake="Engine.KismetMathLibrary.MakeVector", HasNativeBreak="Engine.KismetMathLibrary.BreakVector")) struct FVector { UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Vector, SaveGame) float X; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Vector, SaveGame) float Y; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Vector, SaveGame) float Z; }; /** * A plane definition in 3D space. * @note The full C++ class is located here: Engine\Source\Runtime\Core\Public\Math\Plane.h */ USTRUCT(immutable, noexport, BlueprintType) struct FPlane : public FVector { UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Plane, SaveGame) float W; }; /** Struct to help hold information about packages needing to be fully-loaded for DLC, etc. */ USTRUCT() struct FFullyLoadedPackagesInfo { GENERATED_USTRUCT_BODY() /** When to load these packages */ UPROPERTY() TEnumAsByte<enum EFullyLoadPackageType> FullyLoadType; /** When this map or gametype is loaded, the packages in the following array will be loaded and added to root, then removed from root when map is unloaded */ UPROPERTY() FString Tag; /** The list of packages that will be fully loaded when the above Map is loaded */ UPROPERTY() TArray<FName> PackagesToLoad; /** List of objects that were loaded, for faster cleanup */ UPROPERTY() TArray<class UObject*> LoadedObjects; FFullyLoadedPackagesInfo() : FullyLoadType(0) { } }; /** * FFocusEvent is used when notifying widgets about keyboard focus changes * It is passed to event handlers dealing with keyboard focus */ USTRUCT(BlueprintType) struct FFocusEvent { GENERATED_USTRUCT_BODY() public: /** * UStruct Constructor. Not meant for normal usage. */ FFocusEvent() : Cause(EFocusCause::SetDirectly) , UserIndex(0) { } /** * Constructor. Events are immutable once constructed. * * @param InCause The cause of the focus event */ FFocusEvent(const EFocusCause InCause, uint32 InUserIndex) : Cause(InCause) , UserIndex(InUserIndex) { } /** * Queries the reason for the focus change * * @return The cause of the focus change */ EFocusCause GetCause() const { return Cause; } /** * Queries the user that is changing focus * * @return The user that is changing focus */ uint32 GetUser() const { return UserIndex; } private: /** The cause of the focus change */ EFocusCause Cause; /** User that is changing focus*/ uint32 UserIndex; };
Struct Viewer
在编辑器菜单“Window” -- “Developer Tools” -- “Struct Viewer”,弹出的结构体面板中,可以看到所有的UScriptStruct类型:
UClass
被宏UCLASS修饰的UObject的类型为UClass,可包含属性和函数
在UObject对象上调用GetClass()可获得它的UClass对象,在UClass对象上调用GetClass()返回的是自己本身,这样可以用来区分对象和类型数据。
UCLASS(Transient, BlueprintType) class UMG_API UUMGSequencePlayer : public UObject, public IMovieScenePlayer // IMovieScenePlayer为普通的c++纯虚类 { GENERATED_UCLASS_BODY() // ... ... }; /** * The user widget is extensible by users through the WidgetBlueprint. */ UCLASS(Abstract, editinlinenew, BlueprintType, Blueprintable, meta=( DontUseGenericSpawnObject="True", DisableNativeTick) ) class UMG_API UUserWidget : public UWidget, public INamedSlotInterface // INamedSlotInterface为虚幻Interface类型 { GENERATED_BODY() friend class SObjectWidget; public: UUserWidget(const FObjectInitializer& ObjectInitializer); //UObject interface virtual class UWorld* GetWorld() const override; virtual void PostDuplicate(bool bDuplicateForPIE) override; virtual void BeginDestroy() override; virtual void PostLoad() override; virtual void Serialize(FArchive& Ar) override; //~ End UObject Interface void DuplicateAndInitializeFromWidgetTree(UWidgetTree* InWidgetTree); virtual bool Initialize(); EWidgetTickFrequency GetDesiredTickFrequency() const { return TickFrequency; } // ... ... public: // ... ... /** * Adds it to the game's viewport and fills the entire screen, unless SetDesiredSizeInViewport is called * to explicitly set the size. * * @param ZOrder The higher the number, the more on top this widget will be. */ UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="User Interface|Viewport", meta=( AdvancedDisplay = "ZOrder" )) void AddToViewport(int32 ZOrder = 0); /** * Adds the widget to the game's viewport in a section dedicated to the player. This is valuable in a split screen * game where you need to only show a widget over a player's portion of the viewport. * * @param ZOrder The higher the number, the more on top this widget will be. */ UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="User Interface|Viewport", meta=( AdvancedDisplay = "ZOrder" )) bool AddToPlayerScreen(int32 ZOrder = 0); /** * Removes the widget from the viewport. */ UFUNCTION(BlueprintCallable, BlueprintCosmetic, Category="User Interface|Viewport", meta=( DeprecatedFunction, DeprecationMessage="Use RemoveFromParent instead" )) void RemoveFromViewport(); /** * Removes the widget from its parent widget. If this widget was added to the player's screen or the viewport * it will also be removed from those containers. */ virtual void RemoveFromParent() override; // ... ... public: // ... ... /** Setting this flag to true, allows this widget to accept focus when clicked, or when navigated to. */ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Interaction") uint8 bIsFocusable : 1; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Input") uint8 bStopAction : 1; /** If a widget has an implemented tick blueprint function */ UPROPERTY() uint8 bHasScriptImplementedTick : 1; /** If a widget has an implemented paint blueprint function */ UPROPERTY() uint8 bHasScriptImplementedPaint : 1; protected: /** Has this widget been initialized by its class yet? */ uint8 bInitialized : 1; /** If we're stopping all animations, don't allow new animations to be created as side-effects. */ uint8 bStoppingAllAnimations : 1; // ... ... }; UCLASS(abstract, BlueprintType, MinimalAPI, HideCategories = (Thumbnail)) class UMaterialInterface : public UObject, public IBlendableInterface, public IInterface_AssetUserData // UMaterialInterface为UObject,继承了2个Interface { GENERATED_UCLASS_BODY() /** SubsurfaceProfile, for Screen Space Subsurface Scattering */ UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Material, meta = (DisplayName = "Subsurface Profile")) class USubsurfaceProfile* SubsurfaceProfile; /* -------------------------- */ /** A fence to track when the primitive is no longer used as a parent */ FRenderCommandFence ParentRefFence; protected: /** The Lightmass settings for this object. */ UPROPERTY(EditAnywhere, Category=Lightmass) struct FLightmassMaterialInterfaceSettings LightmassSettings; // ... ... public: //~ Begin IInterface_AssetUserData Interface ENGINE_API virtual void AddAssetUserData(UAssetUserData* InUserData) override; ENGINE_API virtual void RemoveUserDataOfClass(TSubclassOf<UAssetUserData> InUserDataClass) override; ENGINE_API virtual UAssetUserData* GetAssetUserDataOfClass(TSubclassOf<UAssetUserData> InUserDataClass) override; //~ End IInterface_AssetUserData Interface // ... ... //~ Begin Begin Interface IBlendableInterface ENGINE_API virtual void OverrideBlendableSettings(class FSceneView& View, float Weight) const override; //~ Begin End Interface IBlendableInterface /** Walks up parent chain and finds the base Material that this is an instance of. Just calls the virtual GetMaterial() */ UFUNCTION(BlueprintCallable, Category="Rendering|Material") ENGINE_API UMaterial* GetBaseMaterial(); // ... ... };
创建BlueprintClass
点击Content Browser菜单“Add/Import” -- “BlueprintClass”
弹出的Pick Parent Class面板,可以看到所有的UObject类型:
Add C++ Class
在编辑器菜单“File” -- “New C++ Class...”,弹出面板:
勾上“Show All Classes”后,可以看到Object完整的继承体系:
Class Viewer
在编辑器菜单“Window” -- “Developer Tools” -- “Class Viewer”,弹出的结构体面板中,去掉Actors Only勾选可以看到所有的UObject类型:
UInterface
一个自定义的UObject类,只能有一个UObject基类,但可以有多个UInterface接口
UINTERFACE宏即UCLASS宏。 #define UINTERFACE(...) UCLASS()
因此,接口也是被宏UCLASS修饰的UObject,其类型也为UClass,但它只可包含函数
在UClass里保存了一个TArray<FImplementedInterface> Interfaces数组,FImplementedInterface中的成员UClass* Class来支持查询当前类实现了那些接口。
UINTERFACE需要定义两个类:一个是UXXXInterface类,继承UInterface,其中什么数据都没有。另一个是IXXXInterface类,什么都不继承。
UINTERFACE用两个类来实现,可以避免菱形继承导致的虚表扩张及二义性。外部类如果要继承接口的话,只用继承IXXXInterface类即可,非常干净。
UINTERFACE(meta=( CannotImplementInterfaceInBlueprint )) class UMG_API UNamedSlotInterface : public UInterface { GENERATED_UINTERFACE_BODY() // 使用该宏,需要在cpp中实现UNamedSlotInterface::UNamedSlotInterface(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {}构造函数 }; class UMG_API INamedSlotInterface { GENERATED_IINTERFACE_BODY() public: /** */ virtual void GetSlotNames(TArray<FName>& SlotNames) const = 0; /** */ virtual UWidget* GetContentForSlot(FName SlotName) const = 0; /** */ virtual void SetContentForSlot(FName SlotName, UWidget* Content) = 0; /** */ bool ContainsContent(UWidget* Content) const; /** */ void ReleaseNamedSlotSlateResources(bool bReleaseChildren); #if WITH_EDITOR void SetNamedSlotDesignerFlags(EWidgetDesignFlags NewFlags); #endif }; // --------------------------------------------------------------------------------------------------------------------------------- UINTERFACE() class MOVIESCENE_API UMovieSceneCustomClockSource : public UInterface { GENERATED_BODY() }; /** * */ class IMovieSceneCustomClockSource { public: GENERATED_BODY() UFUNCTION() virtual void OnTick(float DeltaSeconds, float InPlayRate) {} UFUNCTION() virtual void OnStartPlaying(const FQualifiedFrameTime& InStartTime) {} UFUNCTION() virtual void OnStopPlaying(const FQualifiedFrameTime& InStopTime) {} UFUNCTION() virtual FFrameTime OnRequestCurrentTime(const FQualifiedFrameTime& InCurrentTime, float InPlayRate) { return 0; } }; // --------------------------------------------------------------------------------------------------------------------------------- /** Interface for assets which contain gameplay tags */ UINTERFACE(Blueprintable, MinimalAPI, meta=(CannotImplementInterfaceInBlueprint)) class UGameplayTagAssetInterface : public UInterface { GENERATED_UINTERFACE_BODY() // 使用该宏,需要在cpp中实现UGameplayTagAssetInterface::UGameplayTagAssetInterface(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {}构造函数 }; class GAMEPLAYTAGS_API IGameplayTagAssetInterface { GENERATED_IINTERFACE_BODY() /** * Get any owned gameplay tags on the asset * * @param OutTags [OUT] Set of tags on the asset */ UFUNCTION(BlueprintCallable, Category = GameplayTags) virtual void GetOwnedGameplayTags(FGameplayTagContainer& TagContainer) const=0; /** * Check if the asset has a gameplay tag that matches against the specified tag (expands to include parents of asset tags) * * @param TagToCheck Tag to check for a match * * @return True if the asset has a gameplay tag that matches, false if not */ UFUNCTION(BlueprintCallable, Category=GameplayTags) virtual bool HasMatchingGameplayTag(FGameplayTag TagToCheck) const; /** * Check if the asset has gameplay tags that matches against all of the specified tags (expands to include parents of asset tags) * * @param TagContainer Tag container to check for a match * * @return True if the asset has matches all of the gameplay tags, will be true if container is empty */ UFUNCTION(BlueprintCallable, Category=GameplayTags) virtual bool HasAllMatchingGameplayTags(const FGameplayTagContainer& TagContainer) const; /** * Check if the asset has gameplay tags that matches against any of the specified tags (expands to include parents of asset tags) * * @param TagContainer Tag container to check for a match * * @return True if the asset has matches any of the gameplay tags, will be false if container is empty */ UFUNCTION(BlueprintCallable, Category=GameplayTags) virtual bool HasAnyMatchingGameplayTags(const FGameplayTagContainer& TagContainer) const; };
FProperty
FXXXProperty用来描述:
① USTRUCT宏修饰的结构体中被UPROPERTY宏修饰的成员变量
② UCLASS宏修饰的UObject中被UPROPERTY宏修饰的成员变量
③ UFUNCTION宏修饰的成员函数的参数及返回值
4.25版本之后,属性相关类型的名称从UXXXProperty修改为FXXXProperty。继承的基类也不再是UField --> UObject,而是FField。
如果你在代码中仍然使用UXXXProperty,编译器会将其宏替换为FXXXProperty,并得到如下编译warning:
warning C4996: UProperty has been renamed to FProperty Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
详见:G:\svn\UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject\DefineUPropertyMacros.h
另外,可以调用FField* FField::CreateFromUField(UField* InField)函数将一个UField转换为FField
布尔、整型、浮点型
FBoolProperty(bool、TEnumAsByte<ENetRole>)
FNumericProperty:FInt8Property(int8)、FInt16Property(int16)、FIntProperty(int32)、FInt64Property(int64)、
FByteProperty(uint8)、FUInt16Property(uint16)、FUInt32Property(uint32)、FUInt64Property(uint64)、
FFloatProperty(float)、FDoubleProperty(double)
字符串
FName:FNameProperty
FText:FTextProperty
FString:FStrProperty
容器
TArray:FArrayProperty
TMap:FMapProperty
TSet:FSetProperty
Delegate
DECLARE_DYNAMIC_MULTICAST_DELEGATE_*:FMulticastInlineDelegateProperty
DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE*:FMulticastSparseDelegateProperty
DECLARE_DYNAMIC_DELEGATE*:FDelegateProperty
枚举、结构体、接口、Object等复合类型
UENUM宏修饰的enum class:FEnumProperty
USTRUCT宏修饰的结构体(如:FVector、FPlane、FSoftObjectPath、FSoftClassPath):FStructProperty
TScriptInterface<UNamedSlotInterface>、TScriptInterface <INamedSlotInterface>:FInterfaceProperty
UObject*、UStruct、UScriptStruct、UFunction、UEnum、UField:FObjectProperty
UClass*、TSubclassOf<UObject>:FClassProperty
TWeakObjectPtr<UObject>:FWeakObjectProperty 注:FWeakObjectPtr不能作为属性
TLazyObjectPtr<UObject>:FLazyObjectProperty 注:FLazyObjectPtr不能作为属性
TSoftObjectPtr<UObject>:FSoftObjectProperty 注1:FSoftObjectPath的类型为FStructProperty 注2:FSoftObjectPtr不能作为属性
TSoftClassPtr<UObject>:FSoftClassProperty 注:FSoftClassPath的类型为FStructProperty
语言修饰符
结构体说明符
类说明符
接口说明符
函数说明符
属性说明符
元数据UMetaData
UMetaData虽然在UPackage中,但是UField对其做了封装,并提供了GetMetaData的接口。
UMetaData通过TMap< FWeakObjectPtr, TMap<FName, FString> > ObjectMetaDataMap来存放Object的键值对信息
UENUM元数据
UENUM(meta=(ScriptName="EnvDirectionType")) namespace EEnvDirection { enum Type { TwoPoints UMETA(DisplayName="Two Points",ToolTip="Direction from location of one context to another."), Rotation UMETA(ToolTip="Context's rotation will be used as a direction."), }; } UENUM() enum TextureGroup { TEXTUREGROUP_World UMETA(DisplayName="ini:World"), TEXTUREGROUP_WorldNormalMap UMETA(DisplayName="ini:WorldNormalMap"), TEXTUREGROUP_WorldSpecular UMETA(DisplayName="ini:WorldSpecular"), TEXTUREGROUP_Character UMETA(DisplayName="ini:Character"), TEXTUREGROUP_CharacterNormalMap UMETA(DisplayName="ini:CharacterNormalMap"), TEXTUREGROUP_CharacterSpecular UMETA(DisplayName="ini:CharacterSpecular"), TEXTUREGROUP_Weapon UMETA(DisplayName="ini:Weapon"), TEXTUREGROUP_WeaponNormalMap UMETA(DisplayName="ini:WeaponNormalMap"), TEXTUREGROUP_WeaponSpecular UMETA(DisplayName="ini:WeaponSpecular"), TEXTUREGROUP_Vehicle UMETA(DisplayName="ini:Vehicle"), TEXTUREGROUP_VehicleNormalMap UMETA(DisplayName="ini:VehicleNormalMap"), TEXTUREGROUP_VehicleSpecular UMETA(DisplayName="ini:VehicleSpecular"), TEXTUREGROUP_Cinematic UMETA(DisplayName="ini:Cinematic"), TEXTUREGROUP_Effects UMETA(DisplayName="ini:Effects"), TEXTUREGROUP_EffectsNotFiltered UMETA(DisplayName="ini:EffectsNotFiltered"), TEXTUREGROUP_Skybox UMETA(DisplayName="ini:Skybox"), TEXTUREGROUP_UI UMETA(DisplayName="ini:UI"), TEXTUREGROUP_Lightmap UMETA(DisplayName="ini:Lightmap"), TEXTUREGROUP_RenderTarget UMETA(DisplayName="ini:RenderTarget"), TEXTUREGROUP_MobileFlattened UMETA(DisplayName="ini:MobileFlattened"), /** Obsolete - kept for backwards compatibility. */ TEXTUREGROUP_ProcBuilding_Face UMETA(DisplayName="ini:ProcBuilding_Face"), /** Obsolete - kept for backwards compatibility. */ TEXTUREGROUP_ProcBuilding_LightMap UMETA(DisplayName="ini:ProcBuilding_LightMap"), TEXTUREGROUP_Shadowmap UMETA(DisplayName="ini:Shadowmap"), /** No compression, no mips. */ TEXTUREGROUP_ColorLookupTable UMETA(DisplayName="ini:ColorLookupTable"), TEXTUREGROUP_Terrain_Heightmap UMETA(DisplayName="ini:Terrain_Heightmap"), TEXTUREGROUP_Terrain_Weightmap UMETA(DisplayName="ini:Terrain_Weightmap"), /** Using this TextureGroup triggers special mip map generation code only useful for the BokehDOF post process. */ TEXTUREGROUP_Bokeh UMETA(DisplayName="ini:Bokeh"), /** No compression, created on import of a .IES file. */ TEXTUREGROUP_IESLightProfile UMETA(DisplayName="ini:IESLightProfile"), /** Non-filtered, useful for 2D rendering. */ TEXTUREGROUP_Pixels2D UMETA(DisplayName="ini:2D Pixels (unfiltered)"), /** Hierarchical LOD generated textures*/ TEXTUREGROUP_HierarchicalLOD UMETA(DisplayName="ini:Hierarchical LOD"), /** Impostor Color Textures*/ TEXTUREGROUP_Impostor UMETA(DisplayName="ini:Impostor Color"), /** Impostor Normal and Depth, use default compression*/ TEXTUREGROUP_ImpostorNormalDepth UMETA(DisplayName="ini:Impostor Normal and Depth"), /** 8 bit data stored in textures */ TEXTUREGROUP_8BitData UMETA(DisplayName="ini:8 Bit Data"), /** 16 bit data stored in textures */ TEXTUREGROUP_16BitData UMETA(DisplayName="ini:16 Bit Data"), /** Project specific group, rename in Engine.ini, [EnumRemap] TEXTUREGROUP_Project**.DisplayName=My Fun Group */ TEXTUREGROUP_Project01 UMETA(DisplayName="ini:Project Group 01"), TEXTUREGROUP_Project02 UMETA(DisplayName="ini:Project Group 02"), TEXTUREGROUP_Project03 UMETA(DisplayName="ini:Project Group 03"), TEXTUREGROUP_Project04 UMETA(DisplayName="ini:Project Group 04"), TEXTUREGROUP_Project05 UMETA(DisplayName="ini:Project Group 05"), TEXTUREGROUP_Project06 UMETA(DisplayName="ini:Project Group 06"), TEXTUREGROUP_Project07 UMETA(DisplayName="ini:Project Group 07"), TEXTUREGROUP_Project08 UMETA(DisplayName="ini:Project Group 08"), TEXTUREGROUP_Project09 UMETA(DisplayName="ini:Project Group 09"), TEXTUREGROUP_Project10 UMETA(DisplayName="ini:Project Group 10"), TEXTUREGROUP_Project11 UMETA(DisplayName="ini:Project Group 11"), TEXTUREGROUP_Project12 UMETA(DisplayName="ini:Project Group 12"), TEXTUREGROUP_Project13 UMETA(DisplayName="ini:Project Group 13"), TEXTUREGROUP_Project14 UMETA(DisplayName="ini:Project Group 14"), TEXTUREGROUP_Project15 UMETA(DisplayName="ini:Project Group 15"), TEXTUREGROUP_MAX, };
USTRUCT元数据
USTRUCT(meta=(DisplayName="Static Mesh Control", Category="Controls", ShowVariableNameInTitle)) struct CONTROLRIG_API FRigUnit_Control_StaticMesh : public FRigUnit_Control { GENERATED_BODY() FRigUnit_Control_StaticMesh(); RIGVM_METHOD() virtual void Execute(const FRigUnitContext& Context) override; /** The the transform the mesh will be rendered with (applied on top of the control's transform in the viewport) */ UPROPERTY(meta=(Input)) FTransform MeshTransform; };
UCLASS元数据
UCLASS(BlueprintType, meta=(DisplayName="Empty Comp Shot", ShortTooltip="A simple base actor used to composite multiple render layers together.")) class COMPOSURE_API ACompositingElement : public AComposurePipelineBaseActor, public ICompImageColorPickerInterface { GENERATED_UCLASS_BODY() // ... ... protected: /*********************************/ // Pipeline Passes // - protected to prevent users from directly modifying these lists (use the accessor functions instead) UPROPERTY(EditAnywhere, Instanced, BlueprintReadOnly, BlueprintGetter = GetInputsList, Category = "Composure|Input", meta=(ShowOnlyInnerProperties)) TArray<UCompositingElementInput*> Inputs; UPROPERTY(EditAnywhere, Instanced, BlueprintReadOnly, BlueprintGetter = GetTransformsList, Category = "Composure|Transform/Compositing Passes", meta=(DisplayName = "Transform Passes", ShowOnlyInnerProperties, DisplayAfter="Inputs")) TArray<UCompositingElementTransform*> TransformPasses; UPROPERTY(EditAnywhere, Instanced, BlueprintReadOnly, BlueprintGetter = GetOutputsList, Category = "Composure|Output", meta = (ShowOnlyInnerProperties)) TArray<UCompositingElementOutput*> Outputs; // ... ... public: // ... ... /*********************************/ // Pass Management UFUNCTION(BlueprintCallable, Category = "Composure", meta = (DeterminesOutputType = "InputType")) UCompositingElementInput* FindInputPass(UPARAM(meta = (AllowAbstract = "false"))TSubclassOf<UCompositingElementInput> InputType, UTexture*& PassResult, FName OptionalPassName = NAME_None); UFUNCTION(BlueprintCallable, Category = "Composure", meta = (DeterminesOutputType = "TransformType")) UCompositingElementTransform* FindTransformPass(UPARAM(meta = (AllowAbstract = "false"))TSubclassOf<UCompositingElementTransform> TransformType, UTexture*& PassResult, FName OptionalPassName = NAME_None); UFUNCTION(BlueprintCallable, Category = "Composure", meta = (DeterminesOutputType = "OutputType")) UCompositingElementOutput* FindOutputPass(UPARAM(meta = (AllowAbstract = "false"))TSubclassOf<UCompositingElementOutput> OutputType, FName OptionalPassName = NAME_None); // ... ... };
UINTERFACE元数据
UINTERFACE(MinimalAPI, meta=(CannotImplementInterfaceInBlueprint)) class UNavRelevantInterface : public UInterface { GENERATED_UINTERFACE_BODY() // 使用该宏,需要在cpp中实现UNamedSlotInterface::UNamedSlotInterface(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) {}构造函数 }; class INavRelevantInterface { GENERATED_IINTERFACE_BODY() /** Prepare navigation modifiers */ virtual void GetNavigationData(FNavigationRelevantData& Data) const {} /** Get bounds for navigation octree */ virtual FBox GetNavigationBounds() const { return FBox(ForceInit); } // ... ... };
可通过命令Metadata.Dump来Dump所有的元信息到日志中
[2021.04.23-06.51.36:018][744]LogMetaData: METADATA /Script/CoreUObject.PackageMetaData [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.JoinabilitySettings: Comment=// Circular dependency on Core vs UHT means we have to noexport these structs so tools can build [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.JoinabilitySettings: ModuleRelativePath=Public/UObject/CoreOnline.h [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.UniqueNetIdWrapper: ModuleRelativePath=Public/UObject/CoreOnline.h [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Guid: BlueprintType=true [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Guid: Comment=/** A globally unique identifier (mirrored from Guid.h) */ [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Guid: ModuleRelativePath=Public/UObject/NoExportTypes.h [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Vector: BlueprintType=true [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Vector: Comment=/** * A point or direction FVector in 3d space. * @note The full C++ class is located here: Engine\Source\Runtime\Core\Public\Math\Vector.h */ [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Vector: HasNativeBreak=Engine.KismetMathLibrary.BreakVector [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Vector: HasNativeMake=Engine.KismetMathLibrary.MakeVector [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Vector: ModuleRelativePath=Public/UObject/NoExportTypes.h [2021.04.23-06.51.36:018][744]LogMetaData: /Script/CoreUObject.Vector4: BlueprintType=true 。。。 。。。 [2021.04.23-06.51.37:464][744]LogMetaData: /Script/AITestSuite.TestPawnAction_CallFunction: IncludePath=Actions/TestPawnAction_CallFunction.h [2021.04.23-06.51.37:464][744]LogMetaData: /Script/AITestSuite.TestPawnAction_CallFunction: ModuleRelativePath=Classes/Actions/TestPawnAction_CallFunction.h [2021.04.23-06.51.37:464][744]LogMetaData: METADATA /Engine/EditorResources/SequenceRecorder/Countdown.PackageMetaData [2021.04.23-06.51.37:464][744]LogMetaData: Root: PackageLocalizationNamespace=E807D18340E352E3392B57A9706DA988 [2021.04.23-06.51.37:464][744]LogMetaData: METADATA /Script/SequenceRecorderSections.PackageMetaData [2021.04.23-06.51.37:464][744]LogMetaData: /Script/SequenceRecorderSections.MovieSceneParticleTrackSectionRecorder:OnTriggered: ModuleRelativePath=Public/MovieSceneParticleTrackSectionRecorder.h [2021.04.23-06.51.37:464][744]LogMetaData: /Script/SequenceRecorderSections.MovieSceneParticleTrackSectionRecorder: IncludePath=MovieSceneParticleTrackSectionRecorder.h [2021.04.23-06.51.37:464][744]LogMetaData: /Script/SequenceRecorderSections.MovieSceneParticleTrackSectionRecorder: IsBlueprintBase=false [2021.04.23-06.51.37:464][744]LogMetaData: /Script/SequenceRecorderSections.MovieSceneParticleTrackSectionRecorder: ModuleRelativePath=Public/MovieSceneParticleTrackSectionRecorder.h [2021.04.23-06.51.37:464][744]LogMetaData: /Script/SequenceRecorderSections.MovieSceneVisibilitySectionRecorderSettings: IncludePath=MovieSceneVisibilitySectionRecorderSettings.h [2021.04.23-06.51.37:464][744]LogMetaData: /Script/SequenceRecorderSections.MovieSceneVisibilitySectionRecorderSettings: ModuleRelativePath=Public/MovieSceneVisibilitySectionRecorderSettings.h
枚举元数据UMetaData说明符
结构体元数据UMetaData说明符
类元数据UMetaData说明符
接口元数据UMetaData说明符
函数元数据UMetaData说明符
属性元数据UMetaData说明符
修饰符在代码中的定义
/** UnrealEngine\Engine\Source\Runtime\CoreUObject\Public\UObject\ObjectMacros.h */ namespace UC { // valid keywords for the UCLASS macro enum { /// This keyword is used to set the actor group that the class is show in, in the editor. classGroup, /// Declares that instances of this class should always have an outer of the specified class. This is inherited by subclasses unless overridden. Within, /* =OuterClassName */ /// Exposes this class as a type that can be used for variables in blueprints BlueprintType, /// Prevents this class from being used for variables in blueprints NotBlueprintType, /// Exposes this class as an acceptable base class for creating blueprints. The default is NotBlueprintable, unless inherited otherwise. This is inherited by subclasses. Blueprintable, /// Specifies that this class is *NOT* an acceptable base class for creating blueprints. The default is NotBlueprintable, unless inherited otherwise. This is inherited by subclasses. NotBlueprintable, /// This keyword indicates that the class should be accessible outside of it's module, but does not need all methods exported. /// It exports only the autogenerated methods required for dynamic_cast<>, etc... to work. MinimalAPI, /// Prevents automatic generation of the constructor declaration. customConstructor, /// Class was declared directly in C++ and has no boilerplate generated by UnrealHeaderTool. /// DO NOT USE THIS FLAG ON NEW CLASSES. Intrinsic, /// No autogenerated code will be created for this class; the header is only provided to parse metadata from. /// DO NOT USE THIS FLAG ON NEW CLASSES. noexport, /// Allow users to create and place this class in the editor. This flag is inherited by subclasses. placeable, /// This class cannot be placed in the editor (it cancels out an inherited placeable flag). notplaceable, /// All instances of this class are considered "instanced". Instanced classes (components) are duplicated upon construction. This flag is inherited by subclasses. DefaultToInstanced, /// All properties and functions in this class are const and should be exported as const. This flag is inherited by subclasses. Const, /// Class is abstract and can't be instantiated directly. Abstract, /// This class is deprecated and objects of this class won't be saved when serializing. This flag is inherited by subclasses. deprecated, /// This class can't be saved; null it out at save time. This flag is inherited by subclasses. Transient, /// This class should be saved normally (it cancels out an inherited transient flag). nonTransient, /// Load object configuration at construction time. These flags are inherited by subclasses. /// Class containing config properties. Usage config=ConfigName or config=inherit (inherits config name from base class). config, /// Handle object configuration on a per-object basis, rather than per-class. perObjectConfig, /// Determine whether on serialize to configs a check should be done on the base/defaults ini's configdonotcheckdefaults, /// Save object config only to Default INIs, never to local INIs. defaultconfig, /// These affect the behavior of the property editor. /// Class can be constructed from editinline New button. editinlinenew, /// Class can't be constructed from editinline New button. noteditinlinenew, /// Class not shown in editor drop down for class selection. hidedropdown, /// Shows the specified categories in a property viewer. Usage: showCategories=CategoryName or showCategories=(category0, category1, ...) showCategories, /// Hides the specified categories in a property viewer. Usage: hideCategories=CategoryName or hideCategories=(category0, category1, ...) hideCategories, /// Indicates that this class is a wrapper class for a component with little intrinsic functionality (this causes things like hideCategories and showCategories to be ignored if the class is subclassed in a Blueprint) ComponentWrapperClass, /// Shows the specified function in a property viewer. Usage: showFunctions=FunctionName or showFunctions=(category0, category1, ...) showFunctions, /// Hides the specified function in a property viewer. Usage: hideFunctions=FunctionName or hideFunctions=(category0, category1, ...) hideFunctions, /// Specifies which categories should be automatically expanded in a property viewer. autoExpandCategories, /// Specifies which categories should be automatically collapsed in a property viewer. autoCollapseCategories, /// Clears the list of auto collapse categories. dontAutoCollapseCategories, /// Display properties in the editor without using categories. collapseCategories, /// Display properties in the editor using categories (default behaviour). dontCollapseCategories, /// All the properties of the class are hidden in the main display by default, and are only shown in the advanced details section. AdvancedClassDisplay, /// A root convert limits a sub-class to only be able to convert to child classes of the first root class going up the hierarchy. ConversionRoot, /// Marks this class as 'experimental' (a totally unsupported and undocumented prototype) Experimental, /// Marks this class as an 'early access' preview (while not considered production-ready, it's a step beyond 'experimental' and is being provided as a preview of things to come) EarlyAccessPreview, /// Some properties are stored once per class in a sidecar structure and not on instances of the class SparseClassDataType, /// Specifies the struct that contains the CustomThunk implementations CustomThunkTemplates }; } namespace UI { // valid keywords for the UINTERFACE macro, see the UCLASS versions, above enum { /// This keyword indicates that the interface should be accessible outside of it's module, but does not need all methods exported. /// It exports only the autogenerated methods required for dynamic_cast<>, etc... to work. MinimalAPI, /// Exposes this interface as an acceptable base class for creating blueprints. The default is NotBlueprintable, unless inherited otherwise. This is inherited by subclasses. Blueprintable, /// Specifies that this interface is *NOT* an acceptable base class for creating blueprints. The default is NotBlueprintable, unless inherited otherwise. This is inherited by subclasses. NotBlueprintable, /// Sets IsConversionRoot metadata flag for this interface. ConversionRoot, }; } namespace UF { // valid keywords for the UFUNCTION and UDELEGATE macros enum { /// This function is designed to be overridden by a blueprint. Do not provide a body for this function; /// the autogenerated code will include a thunk that calls ProcessEvent to execute the overridden body. BlueprintImplementableEvent, /// This function is designed to be overridden by a blueprint, but also has a native implementation. /// Provide a body named [FunctionName]_Implementation instead of [FunctionName]; the autogenerated /// code will include a thunk that calls the implementation method when necessary. BlueprintNativeEvent, /// This function is sealed and cannot be overridden in subclasses. /// It is only a valid keyword for events; declare other methods as static or final to indicate that they are sealed. SealedEvent, /// This function is executable from the command line. Exec, /// This function is replicated, and executed on servers. Provide a body named [FunctionName]_Implementation instead of [FunctionName]; /// the autogenerated code will include a thunk that calls the implementation method when necessary. Server, /// This function is replicated, and executed on clients. Provide a body named [FunctionName]_Implementation instead of [FunctionName]; /// the autogenerated code will include a thunk that calls the implementation method when necessary. Client, /// This function is both executed locally on the server and replicated to all clients, regardless of the Actor's NetOwner NetMulticast, /// Replication of calls to this function should be done on a reliable channel. /// Only valid when used in conjunction with Client or Server Reliable, /// Replication of calls to this function can be done on an unreliable channel. /// Only valid when used in conjunction with Client or Server Unreliable, /// This function fulfills a contract of producing no side effects, and additionally implies BlueprintCallable. BlueprintPure, /// This function can be called from blueprint code and should be exposed to the user of blueprint editing tools. BlueprintCallable, /// This function is used as the get accessor for a blueprint exposed property. Implies BlueprintPure and BlueprintCallable. BlueprintGetter, /// This function is used as the set accessor for a blueprint exposed property. Implies BlueprintCallable. BlueprintSetter, /// This function will not execute from blueprint code if running on something without network authority BlueprintAuthorityOnly, /// This function is cosmetic and will not run on dedicated servers BlueprintCosmetic, /// Indicates that a Blueprint exposed function should not be exposed to the end user BlueprintInternalUseOnly, /// This function can be called in the editor on selected instances via a button in the details panel. CallInEditor, /// The UnrealHeaderTool code generator will not produce a execFoo thunk for this function; it is up to the user to provide one. CustomThunk, /// Specifies the category of the function when displayed in blueprint editing tools. /// Usage: Category=CategoryName or Category="MajorCategory,SubCategory" Category, /// This function must supply a _Validate implementation WithValidation, /// This function is RPC service request ServiceRequest, /// This function is RPC service response ServiceResponse, /// [FunctionMetadata] Marks a UFUNCTION as accepting variadic arguments. Variadic functions may have extra terms they need to emit after the main set of function arguments /// These are all considered wildcards so no type checking will be performed on them Variadic, /// [FunctionMetadata] Indicates the display name of the return value pin ReturnDisplayName, /// [FunctionMetadata] Indicates that a particular function parameter is for internal use only, which means it will be both hidden and not connectible. InternalUseParam, }; } namespace UP { // valid keywords for the UPROPERTY macro enum { /// This property is const and should be exported as const. Const, /// Property should be loaded/saved to ini file as permanent profile. Config, /// Same as above but load config from base class, not subclass. GlobalConfig, /// Property should be loaded as localizable text. Implies ReadOnly. Localized, /// Property is transient: shouldn't be saved, zero-filled at load time. Transient, /// Property should always be reset to the default value during any type of duplication (copy/paste, binary duplication, etc.) DuplicateTransient, /// Property should always be reset to the default value unless it's being duplicated for a PIE session - deprecated, use NonPIEDuplicateTransient instead NonPIETransient, /// Property should always be reset to the default value unless it's being duplicated for a PIE session NonPIEDuplicateTransient, /// Value is copied out after function call. Only valid on function param declaration. Ref, /// Object property can be exported with it's owner. Export, /// Hide clear (and browse) button in the editor. NoClear, /// Indicates that elements of an array can be modified, but its size cannot be changed. EditFixedSize, /// Property is relevant to network replication. Replicated, /// Property is relevant to network replication. Notify actors when a property is replicated (usage: ReplicatedUsing=FunctionName). ReplicatedUsing, /// Skip replication (only for struct members and parameters in service request functions). NotReplicated, /// Interpolatable property for use with matinee. Always user-settable in the editor. Interp, /// Property isn't transacted. NonTransactional, /// Property is a component reference. Implies EditInline and Export. Instanced, /// MC Delegates only. Property should be exposed for assigning in blueprints. BlueprintAssignable, /// Specifies the category of the property. Usage: Category=CategoryName. Category, /// Properties appear visible by default in a details panel SimpleDisplay, /// Properties are in the advanced dropdown in a details panel AdvancedDisplay, /// Indicates that this property can be edited by property windows in the editor EditAnywhere, /// Indicates that this property can be edited by property windows, but only on instances, not on archetypes EditInstanceOnly, /// Indicates that this property can be edited by property windows, but only on archetypes EditDefaultsOnly, /// Indicates that this property is visible in property windows, but cannot be edited at all VisibleAnywhere, /// Indicates that this property is only visible in property windows for instances, not for archetypes, and cannot be edited VisibleInstanceOnly, /// Indicates that this property is only visible in property windows for archetypes, and cannot be edited VisibleDefaultsOnly, /// This property can be read by blueprints, but not modified. BlueprintReadOnly, /// This property has an accessor to return the value. Implies BlueprintReadOnly if BlueprintSetter or BlueprintReadWrite is not specified. (usage: BlueprintGetter=FunctionName). BlueprintGetter, /// This property can be read or written from a blueprint. BlueprintReadWrite, /// This property has an accessor to set the value. Implies BlueprintReadWrite. (usage: BlueprintSetter=FunctionName). BlueprintSetter, /// The AssetRegistrySearchable keyword indicates that this property and it's value will be automatically added /// to the asset registry for any asset class instances containing this as a member variable. It is not legal /// to use on struct properties or parameters. AssetRegistrySearchable, /// Property should be serialized for save games. /// This is only checked for game-specific archives with ArIsSaveGame set SaveGame, /// MC Delegates only. Property should be exposed for calling in blueprint code BlueprintCallable, /// MC Delegates only. This delegate accepts (only in blueprint) only events with BlueprintAuthorityOnly. BlueprintAuthorityOnly, /// Property shouldn't be exported to text format (e.g. copy/paste) TextExportTransient, /// Property shouldn't be serialized, can still be exported to text SkipSerialization, /// If true, the self pin should not be shown or connectable regardless of purity, const, etc. similar to InternalUseParam HideSelfPin, }; } namespace US { // valid keywords for the USTRUCT macro enum { /// No autogenerated code will be created for this class; the header is only provided to parse metadata from. NoExport, /// Indicates that this struct should always be serialized as a single unit Atomic, /// Immutable is only legal in Object.h and is being phased out, do not use on new structs! Immutable, /// Exposes this struct as a type that can be used for variables in blueprints BlueprintType, /// Indicates that a BlueprintType struct should not be exposed to the end user BlueprintInternalUseOnly }; } // Metadata specifiers namespace UM { // Metadata usable in any UField (UCLASS(), USTRUCT(), UPROPERTY(), UFUNCTION(), etc...) enum { /// Overrides the automatically generated tooltip from the class comment ToolTip, /// A short tooltip that is used in some contexts where the full tooltip might be overwhelming (such as the parent class picker dialog) ShortTooltip, /// A setting to determine validation of tooltips and comments. Needs to be set to "Strict" DocumentationPolicy, }; // Metadata usable in UCLASS enum { /// [ClassMetadata] Used for Actor Component classes. If present indicates that it can be spawned by a Blueprint. BlueprintSpawnableComponent, /// [ClassMetadata] Used for Actor and Component classes. If the native class cannot tick, Blueprint generated classes based this Actor or Component can have bCanEverTick flag overridden even if bCanBlueprintsTickByDefault is false. ChildCanTick, /// [ClassMetadata] Used for Actor and Component classes. If the native class cannot tick, Blueprint generated classes based this Actor or Component can never tick even if bCanBlueprintsTickByDefault is true. ChildCannotTick, /// [ClassMetadata] Used to make the first subclass of a class ignore all inherited showCategories and hideCategories commands IgnoreCategoryKeywordsInSubclasses, /// [ClassMetadata] For BehaviorTree nodes indicates that the class is deprecated and will display a warning when compiled. DeprecatedNode, /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] Used in conjunction with DeprecatedNode, DeprecatedProperty, or DeprecatedFunction to customize the warning message displayed to the user. DeprecationMessage, /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to display for this class, property, or function instead of auto-generating it from the name. DisplayName, /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to use for this class, property, or function when exporting it to a scripting language. May include deprecated names as additional semi-colon separated entries. ScriptName, /// [ClassMetadata] Specifies that this class is an acceptable base class for creating blueprints. IsBlueprintBase, /// [ClassMetadata] Comma delimited list of blueprint events that are not be allowed to be overridden in classes of this type KismetHideOverrides, /// [ClassMetadata] Specifies interfaces that are not compatible with the class. ProhibitedInterfaces, /// [ClassMetadata] Used by BlueprintFunctionLibrary classes to restrict the graphs the functions in the library can be used in to the classes specified. RestrictedToClasses, /// [ClassMetadata] Indicates that when placing blueprint nodes in graphs owned by this class that the hidden world context pin should be visible because the self context of the class cannot /// provide the world context and it must be wired in manually ShowWorldContextPin, //[ClassMetadata] Do not spawn an object of the class using Generic Create Object node in Blueprint. It makes sense only for a BluprintType class, that is neither Actor, nor ActorComponent. DontUseGenericSpawnObject, //[ClassMetadata] Expose a proxy object of this class in Async Task node. ExposedAsyncProxy, //[ClassMetadata] Only valid on Blueprint Function Libraries. Mark the functions in this class as callable on non-game threads in an Animation Blueprint. BlueprintThreadSafe, /// [ClassMetadata] Indicates the class uses hierarchical data. Used to instantiate hierarchical editing features in details panels UsesHierarchy, }; // Metadata usable in USTRUCT enum { /// [StructMetadata] Indicates that the struct has a custom break node (and what the path to the BlueprintCallable UFunction is) that should be used instead of the default BreakStruct node. HasNativeBreak, /// [StructMetadata] Indicates that the struct has a custom make node (and what the path to the BlueprintCallable UFunction is) that should be used instead of the default MakeStruct node. HasNativeMake, /// [StructMetadata] Pins in Make and Break nodes are hidden by default. HiddenByDefault, /// [StructMetadata] Indicates that node pins of this struct type cannot be split DisableSplitPin, }; // Metadata usable in UPROPERTY enum { /// [PropertyMetadata] Used for Subclass and SoftClass properties. Indicates whether abstract class types should be shown in the class picker. AllowAbstract, /// [PropertyMetadata] Used for ComponentReference properties. Indicates whether other actor that are not in the property outer hierarchy should be shown in the component picker. AllowAnyActor, /// [PropertyMetadata] Used for FSoftObjectPath, ComponentReference and UClass properties. Comma delimited list that indicates the class type(s) of assets to be displayed in the asset picker(FSoftObjectPath) or component picker or class viewer (UClass). AllowedClasses, /// [PropertyMetadata] Used for FVector properties. It causes a ratio lock to be added when displaying this property in details panels. AllowPreserveRatio, /// [PropertyMetadata] Indicates that a private member marked as BluperintReadOnly or BlueprintReadWrite should be accessible from blueprints AllowPrivateAccess, /// [PropertyMetadata] Used for integer properties. Clamps the valid values that can be entered in the UI to be between 0 and the length of the array specified. ArrayClamp, /// [PropertyMetadata] Used for SoftObjectPtr/SoftObjectPath properties. Comma separated list of Bundle names used inside PrimaryDataAssets to specify which bundles this reference is part of AssetBundles, /// [PropertyMetadata] Used for Subclass and SoftClass properties. Indicates whether only blueprint classes should be shown in the class picker. BlueprintBaseOnly, /// [PropertyMetadata] Property defaults are generated by the Blueprint compiler and will not be copied when CopyPropertiesForUnrelatedObjects is called post-compile. BlueprintCompilerGeneratedDefaults, /// [PropertyMetadata] Used for float and integer properties. Specifies the minimum value that may be entered for the property. ClampMin, /// [PropertyMetadata] Used for float and integer properties. Specifies the maximum value that may be entered for the property. ClampMax, /// [PropertyMetadata] Property is serialized to config and we should be able to set it anywhere along the config hierarchy. ConfigHierarchyEditable, /// [PropertyMetadata] Used by FDirectoryPath properties. Indicates that the path will be picked using the Slate-style directory picker inside the game Content dir. ContentDir, /// [PropertyMetadata] This property is deprecated, any blueprint references to it cause a compilation warning. DeprecatedProperty, /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] Used in conjunction with DeprecatedNode, DeprecatedProperty, or DeprecatedFunction to customize the warning message displayed to the user. // DeprecationMessage, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the property section) /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to display for this class, property, or function instead of auto-generating it from the name. // DisplayName, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the property section) /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to use for this class, property, or function when exporting it to a scripting language. May include deprecated names as additional semi-colon separated entries. //ScriptName, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the property section) /// [PropertyMetadata] Used for FSoftObjectPath, ActorComponentReference and UClass properties. Comma delimited list that indicates the class type(s) of assets that will NOT be displayed in the asset picker (FSoftObjectPath) or component picker or class viewer (UClass). DisallowedClasses, /// [PropertyMetadata] Indicates that the property should be displayed immediately after the property named in the metadata. DisplayAfter, /// [PropertyMetadata] The relative order within its category that the property should be displayed in where lower values are sorted first.. /// If used in conjunction with DisplayAfter, specifies the priority relative to other properties with same DisplayAfter specifier. DisplayPriority, /// [PropertyMetadata] Indicates that the property is an asset type and it should display the thumbnail of the selected asset. DisplayThumbnail, /// [PropertyMetadata] Specifies a boolean property that is used to indicate whether editing of this property is disabled. EditCondition, /// [PropertyMetadata] Keeps the elements of an array from being reordered by dragging EditFixedOrder, /// [PropertyMetadata] Used for FSoftObjectPath properties in conjunction with AllowedClasses. Indicates whether only the exact classes specified in AllowedClasses can be used or whether subclasses are valid. ExactClass, /// [PropertyMetadata] Specifies a list of categories whose functions should be exposed when building a function list in the Blueprint Editor. ExposeFunctionCategories, /// [PropertyMetadata] Specifies whether the property should be exposed on a Spawn Actor for the class type. ExposeOnSpawn, /// [PropertyMetadata] Used by FFilePath properties. Indicates the path filter to display in the file picker. FilePathFilter, /// [PropertyMetadata] Used by FFilePath properties. Indicates that the FilePicker dialog will output a path relative to the game directory when setting the property. An absolute path will be used when outside the game directory. RelativeToGameDir, /// [PropertyMetadata] Deprecated. FixedIncrement, /// [PropertyMetadata] Used by asset properties. Indicates that the asset pickers should always show engine content ForceShowEngineContent, /// [PropertyMetadata] Used by asset properties. Indicates that the asset pickers should always show plugin content ForceShowPluginContent, /// [PropertyMetadata] Used for FColor and FLinearColor properties. Indicates that the Alpha property should be hidden when displaying the property widget in the details. HideAlphaChannel, /// [PropertyMetadata] Indicates that the property should be hidden in the details panel. Currently only used by events. HideInDetailPanel, /// [PropertyMetadata] Used for Subclass and SoftClass properties. Specifies to hide the ability to change view options in the class picker HideViewOptions, /// [PropertyMetadata] Used for bypassing property initialization tests when the property cannot be safely tested in a deterministic fashion. Example: random numbers, guids, etc. IgnoreForMemberInitializationTest, /// [PropertyMetadata] Signifies that the bool property is only displayed inline as an edit condition toggle in other properties, and should not be shown on its own row. InlineEditConditionToggle, /// [PropertyMetadata] Used by FDirectoryPath properties. Converts the path to a long package name LongPackageName, /// [PropertyMetadata] Used for Transform/Rotator properties (also works on arrays of them). Indicates that the property should be exposed in the viewport as a movable widget. MakeEditWidget, /// [PropertyMetadata] For properties in a structure indicates the default value of the property in a blueprint make structure node. MakeStructureDefaultValue, /// [PropertyMetadata] Used FSoftClassPath properties. Indicates the parent class that the class picker will use when filtering which classes to display. MetaClass, /// [PropertyMetadata] Used for Subclass and SoftClass properties. Indicates the selected class must implement a specific interface MustImplement, /// [PropertyMetadata] Used for numeric properties. Stipulates that the value must be a multiple of the metadata value. Multiple, /// [PropertyMetadata] Used for FString and FText properties. Indicates that the edit field should be multi-line, allowing entry of newlines. MultiLine, /// [PropertyMetadata] Used for FString and FText properties. Indicates that the edit field is a secret field (e.g a password) and entered text will be replaced with dots. Do not use this as your only security measure. The property data is still stored as plain text. PasswordField, /// [PropertyMetadata] Used for array properties. Indicates that the duplicate icon should not be shown for entries of this array in the property panel. NoElementDuplicate, /// [PropertyMetadata] Property wont have a 'reset to default' button when displayed in property windows NoResetToDefault, /// [PropertyMetadata] Used for integer and float properties. Indicates that the spin box element of the number editing widget should not be displayed. NoSpinbox, /// [PropertyMetadata] Used for Subclass properties. Indicates whether only placeable classes should be shown in the class picker. OnlyPlaceable, /// [PropertyMetadata] Used by FDirectoryPath properties. Indicates that the directory dialog will output a relative path when setting the property. RelativePath, /// [PropertyMetadata] Used by FDirectoryPath properties. Indicates that the directory dialog will output a path relative to the game content directory when setting the property. RelativeToGameContentDir, /// [PropertyMetadata] [FunctionMetadata] Flag set on a property or function to prevent it being exported to a scripting language. ScriptNoExport, /// [PropertyMetadata] Used by struct properties. Indicates that the inner properties will not be shown inside an expandable struct, but promoted up a level. ShowOnlyInnerProperties, /// [PropertyMetadata] Used for Subclass and SoftClass properties. Shows the picker as a tree view instead of as a list ShowTreeView, /// [PropertyMetadata] Used by numeric properties. Indicates how rapidly the value will grow when moving an unbounded slider. SliderExponent, /// [PropertyMetadata] Used by arrays of structs. Indicates a single property inside of the struct that should be used as a title summary when the array entry is collapsed. TitleProperty, /// [PropertyMetadata] Used for float and integer properties. Specifies the lowest that the value slider should represent. UIMin, /// [PropertyMetadata] Used for float and integer properties. Specifies the highest that the value slider should represent. UIMax, /// [PropertyMetadata] Used for SoftObjectPtr/SoftObjectPath properties to specify a reference should not be tracked. This reference will not be automatically cooked or saved into the asset registry for redirector/delete fixup. Untracked, /// [PropertyMetadata] For functions that should be compiled in development mode only. DevelopmentOnly, /// [PropertyMetadata] (Internal use only) Used for the latent action manager to fix up a latent action with the VM NeedsLatentFixup, /// [PropertyMetadata] (Internal use only) Used for the latent action manager to track where it's re-entry should be LatentCallbackTarget, /// [PropertyMetadata] Causes FString and FName properties to have a limited set of options generated dynamically, e.g. meta=(GetOptions="FuncName") /// /// UFUNCTION() /// TArray<FString> FuncName() const; // Always return string array even if FName property. GetOptions, }; // Metadata usable in UPROPERTY for customizing the behavior of Persona and UMG // TODO: Move this to be contained in those modules specifically? enum { /// [PropertyMetadata] The property is not exposed as a data pin and is only be editable in the details panel. Applicable only to properties that will be displayed in Persona and UMG. NeverAsPin, /// [PropertyMetadata] The property can be exposed as a data pin, but is hidden by default. Applicable only to properties that will be displayed in Persona and UMG. PinHiddenByDefault, /// [PropertyMetadata] The property can be exposed as a data pin and is visible by default. Applicable only to properties that will be displayed in Persona and UMG. PinShownByDefault, /// [PropertyMetadata] The property is always exposed as a data pin. Applicable only to properties that will be displayed in Persona and UMG. AlwaysAsPin, /// [PropertyMetadata] Indicates that the property has custom code to display and should not generate a standard property widget int he details panel. Applicable only to properties that will be displayed in Persona. CustomizeProperty, }; // Metadata usable in UPROPERTY for customizing the behavior of Material Expressions // TODO: Move this to be contained in that module? enum { /// [PropertyMetadata] Used for float properties in MaterialExpression classes. If the specified FMaterialExpression pin is not connected, this value is used instead. OverridingInputProperty, /// [PropertyMetadata] Used for FMaterialExpression properties in MaterialExpression classes. If specified the pin need not be connected and the value of the property marked as OverridingInputProperty will be used instead. RequiredInput, }; // Metadata usable in UFUNCTION enum { /// [FunctionMetadata] Used with a comma-separated list of parameter names that should show up as advanced pins (requiring UI expansion). /// Alternatively you can set a number, which is the number of paramaters from the start that should *not* be marked as advanced (eg 'AdvancedDisplay="2"' will mark all but the first two advanced). AdvancedDisplay, /// [FunctionMetadata] Indicates that a BlueprintCallable function should use a Call Array Function node and that the parameters specified in the comma delimited list should be treated as wild card array properties. ArrayParm, /// [FunctionMetadata] Used when ArrayParm has been specified to indicate other function parameters that should be treated as wild card properties linked to the type of the array parameter. ArrayTypeDependentParams, /// [FunctionMetadata] For reference parameters, indicates that a value should be created to be used for the input if none is linked via BP. /// This also allows for inline editing of the default value on some types (take FRotator for instance). Only valid for inputs. AutoCreateRefTerm, /// [FunctionMetadata] This function is an internal implementation detail, used to implement another function or node. It is never directly exposed in a graph. BlueprintInternalUseOnly, /// [FunctionMetadata] This function is only accessible from within its class and derived classes. BlueprintProtected, /// [FunctionMetadata] Used for BlueprintCallable functions that have a WorldContext pin to indicate that the function can be called even if the class does not implement the virtual function GetWorld(). CallableWithoutWorldContext, /// [FunctionMetadata] Indicates that a BlueprintCallable function should use the Commutative Associative Binary node. CommutativeAssociativeBinaryOperator, /// [FunctionMetadata] Indicates that a BlueprintCallable function should display in the compact display mode and the name to use in that mode. CompactNodeTitle, /// [FunctionMetadata] Used with CustomThunk to declare that a parameter is actually polymorphic CustomStructureParam, /// [FunctionMetadata] For BlueprintCallable functions indicates that the object property named's default value should be the self context of the node DefaultToSelf, /// [FunctionMetadata] This function is deprecated, any blueprint references to it cause a compilation warning. DeprecatedFunction, /// [ClassMetadata] [FunctionMetadata] Used in conjunction with DeprecatedNode or DeprecatedFunction to customize the warning message displayed to the user. // DeprecationMessage, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the function section) /// [FunctionMetadata] For BlueprintCallable functions indicates that an input/output (determined by whether it is an input/output enum) exec pin should be created for each entry in the enum specified. /// Use ReturnValue to refer to the return value of the function. Also works for bools. ExpandEnumAsExecs, // Synonym for ExpandEnumAsExecs ExpandBoolAsExecs, /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to display for this class, property, or function instead of auto-generating it from the name. // DisplayName, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the function section) /// [ClassMetadata] [PropertyMetadata] [FunctionMetadata] The name to use for this class, property, or function when exporting it to a scripting language. May include deprecated names as additional semi-colon separated entries. //ScriptName, (Commented out so as to avoid duplicate name with version in the Class section, but still show in the function section) /// [PropertyMetadata] [FunctionMetadata] Flag set on a property or function to prevent it being exported to a scripting language. //ScriptNoExport, (Commented out so as to avoid duplicate name with version in the Property section, but still show in the function section) /// [FunctionMetadata] Flags a static function taking a struct or or object as its first argument so that it "hoists" the function to be a method of the struct or class when exporting it to a scripting language. /// The value is optional, and may specify a name override for the method. May include deprecated names as additional semi-colon separated entries. ScriptMethod, /// [FunctionMetadata] Used with ScriptMethod to denote that the return value of the function should overwrite the value of the instance that made the call (structs only, equivalent to using UPARAM(self) on the struct argument). ScriptMethodSelfReturn, /// [FunctionMetadata] Flags a static function taking a struct as its first argument so that it "hoists" the function to be an operator of the struct when exporting it to a scripting language. /// The value describes the kind of operator using C++ operator syntax (see below), and may contain multiple semi-colon separated values. /// The signature of the function depends on the operator type, and additional parameters may be passed as long as they're defaulted and the basic signature requirements are met. /// - For the bool conversion operator (bool) the signature must be: /// bool FuncName(const FMyStruct&); // FMyStruct may be passed by value rather than const-ref /// - For the unary conversion operators (neg(-obj)) the signature must be: /// FMyStruct FuncName(const FMyStruct&); // FMyStruct may be passed by value rather than const-ref /// - For comparison operators (==, !=, <, <=, >, >=) the signature must be: /// bool FuncName(const FMyStruct, OtherType); // OtherType can be any type, FMyStruct may be passed by value rather than const-ref /// - For mathematical operators (+, -, *, /, %, &, |, ^, >>, <<) the signature must be: /// ReturnType FuncName(const FMyStruct&, OtherType); // ReturnType and OtherType can be any type, FMyStruct may be passed by value rather than const-ref /// - For mathematical assignment operators (+=, -=, *=, /=, %=, &=, |=, ^=, >>=, <<=) the signature must be: /// FMyStruct FuncName(const FMyStruct&, OtherType); // OtherType can be any type, FMyStruct may be passed by value rather than const-ref ScriptOperator, /// [FunctionMetadata] Flags a static function returning a value so that it "hoists" the function to be a constant of its host type when exporting it to a scripting language. /// The constant will be hosted on the class that owns the function, but ScriptConstantHost can be used to host it on a different type (struct or class). /// The value is optional, and may specify a name override for the constant. May include deprecated names as additional semi-colon separated entries. ScriptConstant, /// [FunctionMetadata] Used with ScriptConstant to override the host type for a constant. Should be the name of a struct or class with no prefix, eg) Vector2D or Actor ScriptConstantHost, /// [FunctionMetadata] For BlueprintCallable functions indicates that the parameter pin should be hidden from the user's view. HidePin, /// [FunctionMetadata] For some functions used by async task nodes, specify this parameter should be skipped when exposing pins HideSpawnParms, /// [FunctionMetadata] For BlueprintCallable functions provides additional keywords to be associated with the function for search purposes. Keywords, /// [FunctionMetadata] Indicates that a BlueprintCallable function is Latent Latent, /// [FunctionMetadata] For Latent BlueprintCallable functions indicates which parameter is the LatentInfo parameter LatentInfo, /// [FunctionMetadata] For BlueprintCallable functions indicates that the material override node should be used MaterialParameterCollectionFunction, /// [FunctionMetadata] For BlueprintCallable functions indicates that the function should be displayed the same as the implicit Break Struct nodes NativeBreakFunc, /// [FunctionMetadata] For BlueprintCallable functions indicates that the function should be displayed the same as the implicit Make Struct nodes NativeMakeFunc, /// [FunctionMetadata] Used by BlueprintCallable functions to indicate that this function is not to be allowed in the Construction Script. UnsafeDuringActorConstruction, /// [FunctionMetadata] Used by BlueprintCallable functions to indicate which parameter is used to determine the World that the operation is occurring within. WorldContext, /// [FunctionMetadata] Used only by static BlueprintPure functions from BlueprintLibrary. A cast node will be automatically added for the return type and the type of the first parameter of the function. BlueprintAutocast, // [FunctionMetadata] Only valid in Blueprint Function Libraries. Mark this function as an exception to the class's general BlueprintThreadSafe metadata. NotBlueprintThreadSafe, /// [FunctionMetadata] [InterfaceMetadata] Metadata that flags function params that govern what type of object the function returns DeterminesOutputType, /// [FunctionMetadata] [InterfaceMetadata] Metadata that flags the function output param that will be controlled by the "MD_DynamicOutputType" pin DynamicOutputParam, /// [FunctionMetadata][InterfaceMetadata] Metadata to identify an DataTable Pin. Depending on which DataTable is selected, we display different RowName options DataTablePin, /// [FunctionMetadata][InterfaceMetadata] Metadata that flags TSet parameters that will have their type determined at blueprint compile time SetParam, /// [FunctionMetadata] [InterfaceMetadata] Metadata that flags TMap function parameters that will have their type determined at blueprint compile time MapParam, /// [FunctionMetadata] [InterfaceMetadata] Metadata that flags TMap function parameters that will have their key type determined at blueprint compile time MapKeyParam, /// [FunctionMetadata][InterfaceMetadata] Metadata that flags TMap function parameter that will have their value type determined at blueprint compile time MapValueParam, /// [FunctionMetadata] [InterfaceMetadata] Metadata that identifies an integral property as a bitmask. Bitmask, /// [FunctionMetadata] [InterfaceMetadata] Metadata that associates a bitmask property with a bitflag enum. BitmaskEnum, /// [InterfaceMetadata] Metadata that identifies an enum as a set of explicitly-named bitflags. Bitflags, /// [InterfaceMetadata] Metadata that signals to the editor that enum values correspond to mask values instead of bitshift (index) values. UseEnumValuesAsMaskValuesInEditor, /// [InterfaceMetadata] Stub function used internally by animation blueprints AnimBlueprintFunction, /// [FunctionMetadata] [InterfaceMetadata] Metadata that flags TArray function parameters that will have their type determined at blueprint compile time ArrayParam, }; // Metadata usable in UINTERFACE enum { /// [InterfaceMetadata] This interface cannot be implemented by a blueprint (e.g., it has only non-exposed C++ member methods) CannotImplementInterfaceInBlueprint, }; }
参考
《InsideUE4》UObject(三)类型系统设定和结构
《InsideUE4》UObject(十三)类型系统-反射实战