### PerObjectConfig Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5标识符详解.md Demonstrates saving and loading configurations for objects with the PerObjectConfig attribute. Each object instance saves its configuration independently. ```cpp UCLASS(Config = Game,PerObjectConfig) class INSIDER_API UMyClass_PerObjectConfig :public UObject { GENERATED_BODY() public: UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 MyProperty = 123; UPROPERTY(EditAnywhere, BlueprintReadWrite, Config) int32 MyPropertyWithConfig = 123; }; void UMyClass_Config_Test::TestPerObjectConfigSave() { UMyClass_PerObjectConfig* testObject1 = NewObject(GetTransientPackage(), TEXT("testObject1")); testObject1->MyPropertyWithConfig = 456; testObject1->SaveConfig(); UMyClass_PerObjectConfig* testObject2 = NewObject(GetTransientPackage(), TEXT("testObject2")); testObject2->MyPropertyWithConfig = 789; testObject2->SaveConfig(); } void UMyClass_Config_Test::TestPerObjectConfigLoad() { UMyClass_PerObjectConfig* testObject1 = NewObject(GetTransientPackage(), TEXT("testObject1")); //testObject1->LoadConfig(); //不需要显式调用LoadConfig UMyClass_PerObjectConfig* testObject2 = NewObject(GetTransientPackage(), TEXT("testObject2")); //testObject2->LoadConfig(); } //\Saved\Config\WindowsEditor\Game.ini [testObject1 MyClass_PerObjectConfig] MyPropertyWithConfig=456 [testObject2 MyClass_PerObjectConfig] MyPropertyWithConfig=789 ``` -------------------------------- ### Blueprintable and NotBlueprintable UInterface Examples Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5_Specifiers.md Demonstrates how to define UInterfaces that can or cannot be realized in blueprints using Blueprintable and NotBlueprintable specifiers. ```cpp UINTERFACE(Blueprintable,MinimalAPI) class UMyInterface_Blueprintable:public UInterface { GENERATED_UINTERFACE_BODY() }; class INSIDER_API IMyInterface_Blueprintable { GENERATED_IINTERFACE_BODY() public: UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void Func_ImplementableEvent() const; UFUNCTION(BlueprintCallable,BlueprintNativeEvent) void Func_NativeEvent() const; }; UINTERFACE(NotBlueprintable,MinimalAPI) class UMyInterface_NotBlueprintable:public UInterface { GENERATED_UINTERFACE_BODY() }; class INSIDER_API IMyInterface_NotBlueprintable { GENERATED_IINTERFACE_BODY() public: //Blueprint functions should not be defined either, as they can no longer be realized in blueprints //UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) //void Func_ImplementableEvent() const; // UFUNCTION(BlueprintCallable,BlueprintNativeEvent) //void Func_NativeEvent() const; }; ``` -------------------------------- ### PrintString Example with AdvancedDisplay Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/Blueprint/AdvancedDisplay/AdvancedDisplay.md Demonstrates the AdvancedDisplay specifier on the PrintString function, collapsing parameters after the second one. ```cpp UFUNCTION(BlueprintCallable, meta=(WorldContext="WorldContextObject", CallableWithoutWorldContext, Keywords = "log print", AdvancedDisplay = "2", DevelopmentOnly), Category="Development") static ENGINE_API void PrintString(const UObject* WorldContextObject, const FString& InString = FString(TEXT("Hello")), bool bPrintToScreen = true, bool bPrintToLog = true, FLinearColor TextColor = FLinearColor(0.0f, 0.66f, 1.0f), float Duration = 2.f, const FName Key = NAME_None); ``` -------------------------------- ### UPROPERTY AdvancedDisplay Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/UPROPERTY/DetaisPanel/AdvancedDisplay/AdvancedDisplay.md Demonstrates the usage of SimpleDisplay and AdvancedDisplay specifiers for integer properties within a UObject class. ```cpp UCLASS(Blueprintable, BlueprintType) class INSIDER_API UMyProperty_Test :public UObject { //PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_IsPlainOldData | CPF_NoDestructor | CPF_SimpleDisplay | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic UPROPERTY(EditAnywhere, SimpleDisplay, Category = Display) int32 MyInt_SimpleDisplay = 123; //PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_IsPlainOldData | CPF_NoDestructor | CPF_AdvancedDisplay | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic UPROPERTY(EditAnywhere, AdvancedDisplay, Category = Display) int32 MyInt_AdvancedDisplay = 123; } ``` -------------------------------- ### Example UPROPERTY with NoResetToDefault Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/DetailsPanel/NoResetToDefault/NoResetToDefault.md Demonstrates how to use the NoResetToDefault specifier on a UPROPERTY. This prevents the 'Reset to Default' button from appearing for MyInt_NoResetToDefault. ```cpp public: UPROPERTY(EditAnywhere, BlueprintReadWrite,Category=ResetToDefaultTest) int32 MyInt_Default = 123; UPROPERTY(EditAnywhere, BlueprintReadWrite,Category=ResetToDefaultTest, meta = (NoResetToDefault)) int32 MyInt_NoResetToDefault = 123; ``` -------------------------------- ### Getting World in Runtime and Editor Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Blueprint/WorldContext/WorldContext.md Demonstrates how to obtain the UWorld object in different contexts: Runtime and Editor. ```cpp //在Runtime下获得World的方式一般是: UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull); //在Editor下(如CallInEditor函数)获得World的方式一般是: UObject* WorldContextObject = EditorEngine->GetEditorWorldContext().World(); ``` -------------------------------- ### C++ Example: Hiding a Pin with HidePin Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Pin/HidePin/HidePin.md Demonstrates hiding the 'options' parameter using the HidePin specifier in a BlueprintCallable function. ```cpp UCLASS(Blueprintable, BlueprintType) class INSIDER_API AMyFunction_HidePinfTest :public AActor { public: GENERATED_BODY() public: UFUNCTION(BlueprintCallable) int MyFunc_Default(FName name, float value, FString options) { return 0; } UFUNCTION(BlueprintCallable, meta = (HidePin = "options")) int MyFunc_HidePin(FName name, float value, FString options) { return 0; } UFUNCTION(BlueprintCallable, meta = (InternalUseParam = "options,comment")) int MyFunc_HidePin2(FName name, float value, FString options,FString comment) { return 0; } UFUNCTION(BlueprintCallable, meta = (InternalUseParam = "options")) int MyFunc_InternalUseParam(FName name, float value, FString options) { return 0; } UFUNCTION(BlueprintCallable, meta = (HidePin = "ReturnValue")) int MyFunc_HideReturn(FName name, float value, FString options, FString& otherReturn) { return 0; } public: UFUNCTION(BlueprintPure) int MyPure_Default(FName name, float value, FString options) { return 0; } UFUNCTION(BlueprintPure, meta = (HidePin = "options")) int MyPure_HidePin(FName name, float value, FString options) { return 0; } UFUNCTION(BlueprintPure, meta = (InternalUseParam = "options")) int MyPure_InternalUseParam(FName name, float value, FString options) { return 0; } UFUNCTION(BlueprintPure, meta = (HidePin = "ReturnValue")) int MyPure_HideReturn(FName name, float value, FString options, FString& otherReturn) { return 0; } public: UFUNCTION(BlueprintCallable, meta = (InternalUseParam = "options,comment")) int MyFunc_InternalUseParams2(FName name, float value, FString options,FString comment) { return 0; } UFUNCTION(BlueprintCallable, meta = (InternalUseParam = "options,comment,ReturnValue")) int MyFunc_InternalUseParams3(FName name, float value, FString options,FString comment) { return 0; } }; ``` -------------------------------- ### EditInline UPROPERTY Examples Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/DetailsPanel/EditInline/EditInline.md Demonstrates the usage of EditInline, NoEditInline, and standard UPROPERTY declarations for object properties and arrays. ```cpp UPROPERTY(EditAnywhere, BlueprintReadWrite) UMyProperty_EditInline_Sub* MyObject; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (EditInline)) UMyProperty_EditInline_Sub* MyObject_EditInline; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (NoEditInline)) UMyProperty_EditInline_Sub* MyObject_NoEditInline; UPROPERTY(EditAnywhere, BlueprintReadWrite) TArray MyObjectArray; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (EditInline)) TArray MyObjectArray_EditInline; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (NoEditInline)) TArray MyObjectArray_NoEditInline; ``` -------------------------------- ### BlueprintPure Get Function Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/UFUNCTION/Blueprint/BlueprintPure/BlueprintPure.md This C++ code demonstrates how to use the BlueprintPure specifier for a Get function that returns an integer. The function is marked as const, indicating it does not modify the object's state. ```cpp UFUNCTION(BlueprintPure) int32 GetMyInt()const { return MyInt; } private: int32 MyInt; ``` -------------------------------- ### Saving a Package with Optional Objects Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Specifier/UCLASS/Serialization/Optional/Optional.md Illustrates the process of creating and saving a package that includes optional objects. This example demonstrates setting up save arguments and conditionally creating optional objects before saving the package. ```cpp void UMyClass_Optional_Test::CreatePackageAndSave() { FString packageName = TEXT("/Game/MyOptionTestPackage"); FString assetPath = FPackageName::LongPackageNameToFilename(packageName, FPackageName::GetAssetPackageExtension()); IFileManager::Get().Delete(*assetPath, false, true); UPackage* package = CreatePackage(*packageName); FSavePackageArgs saveArgs{}; //saveArgs.TopLevelFlags = EObjectFlags::RF_Public | EObjectFlags::RF_Standalone; saveArgs.Error = GError; saveArgs.SaveFlags=SAVE_NoError; //SAVE_Optional = 0x00008000, ///< Indicate that we to save optional exports. This flag is only valid while cooking. Optional exports are filtered if not specified during cooking. UMyClass_Optional_Test* testObject = NewObject(package, TEXT("testObject")); #if WITH_EDITORONLY_DATA testObject->MyOptionalObject = NewObject(testObject, TEXT("MyOptionalObject")); testObject->MyOptionalObject->MyProperty = 456; #endif testObject->MyNotOptionalObject = NewObject(testObject, TEXT("MyNotOptionalObject")); testObject->MyNotOptionalObject->MyProperty = 456; FString str = UInsiderSubsystem::Get().PrintObject(package, EInsiderPrintFlags::All); FString str2 = UInsiderSubsystem::Get().PrintObject(testObject, EInsiderPrintFlags::All); FString str3 = UInsiderSubsystem::Get().PrintObject(UMyClass_Optional::StaticClass(), EInsiderPrintFlags::All); FString str4 = UInsiderSubsystem::Get().PrintObject(UMyClass_NotOptional::StaticClass(), EInsiderPrintFlags::All); bool result = UPackage::SavePackage(package, testObject, *assetPath, saveArgs); } ``` -------------------------------- ### Defining a RigVM Struct with CustomWidget Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/RigVM/CustomWidget/CustomWidget.md Use the CustomWidget metadata within UPROPERTY to assign a specific editor widget to a property. This example shows how to use 'BoneName' to get a dropdown list of bone names for editing. ```cpp USTRUCT(meta = (DisplayName = "MyRigCustomWidget")) struct INSIDER_API FRigUnit_MyRigCustomWidget : public FRigUnit { GENERATED_BODY() RIGVM_METHOD() virtual void Execute() override; public: UPROPERTY(meta = (Input)) FString MyString; UPROPERTY(meta = (Input, CustomWidget = "BoneName")) FString MyString_Custom; UPROPERTY(meta = (Output)) float MyFloat_Output = 123.f; }; ``` -------------------------------- ### Defining AnimGetter Functions in UMyAnimInstance Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/AnimationGraph/AnimGetter/AnimGetter.md This C++ code demonstrates how to define functions within a UAnimInstance subclass that are marked as AnimGetter functions. It includes examples for getting animation length, state weight, and transition time elapsed, contrasting them with regular blueprint functions. ```cpp UCLASS(BlueprintType) class INSIDER_API UMyAnimInstance :public UAnimInstance { GENERATED_BODY() public: UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintInternalUseOnly = "true", AnimGetter, BlueprintThreadSafe)) float MyGetAnimationLength_AnimGetter(int32 AssetPlayerIndex); UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintThreadSafe)) float MyGetAnimationLength(int32 AssetPlayerIndex); public: UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintInternalUseOnly = "true", AnimGetter, BlueprintThreadSafe)) float MyGetStateWeight_AnimGetter(int32 MachineIndex, int32 StateIndex); UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintThreadSafe)) float MyGetStateWeight(int32 MachineIndex, int32 StateIndex); public: UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintInternalUseOnly = "true", AnimGetter, BlueprintThreadSafe)) float MyGetTransitionTimeElapsed_AnimGetter(int32 MachineIndex, int32 TransitionIndex); UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintThreadSafe)) float MyGetTransitionTimeElapsed(int32 MachineIndex, int32 TransitionIndex); }; ``` -------------------------------- ### Example UPROPERTY with ForceShowEngineContent Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/Asset/ForceShowEngineContent/ForceShowEngineContent.md Demonstrates how to use the ForceShowEngineContent specifier on a UObject pointer property within a UCLASS. This forces engine content to be selectable in the editor's asset picker. ```cpp UCLASS(Blueprintable, BlueprintType) class INSIDER_API UMyProperty_ShowContent :public UDataAsset { public: GENERATED_BODY() public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Object) TObjectPtr MyAsset_Default; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Object, meta = (ForceShowEngineContent)) TObjectPtr MyAsset_ForceShowEngineContent; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Object, meta = (ForceShowPluginContent)) TObjectPtr MyAsset_ForceShowPluginContent; }; ``` -------------------------------- ### UMyProperty_BindWidget Class Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Widget/IsBindableEvent/IsBindableEvent.md A UCLASS demonstrating various dynamic delegate declarations and UPROPERTY configurations, including multicast, default unicast, and unicast with IsBindableEvent metadata. ```cpp UCLASS(BlueprintType) class INSIDER_API UMyProperty_BindWidget :public UUserWidget { public: DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnMyClickedMulticastDelegate); UPROPERTY(EditAnywhere, BlueprintAssignable, Category = MyEvent) FOnMyClickedMulticastDelegate MyClickedMulticastDelegate; public: DECLARE_DYNAMIC_DELEGATE_RetVal_OneParam(FString,FOnMyClickedDelegate,int32,MyValue); UPROPERTY(EditAnywhere, Category = MyEvent) FOnMyClickedDelegate MyClickedDelegate_Default; UPROPERTY(EditAnywhere, Category = MyEvent) FOnMyClickedDelegate MyClickedEvent; UPROPERTY(EditAnywhere, Category = MyEvent, meta = (IsBindableEvent = "True")) FOnMyClickedDelegate MyClickedDelegate_Bind; } ``` -------------------------------- ### ReapplyCondition UPROPERTY Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5_Specifiers.md Example of using the 'ReapplyCondition' specifier on a UPROPERTY, which affects its visibility and enabled state during reapply mode. ```cpp UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Placement, meta=(UIMin = 0, ClampMin = 0, UIMax = 359, ClampMax = 359, ReapplyCondition="ReapplyRandomPitchAngle")) float RandomPitchAngle; ``` -------------------------------- ### Config File and UPROPERTY Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/DetailsPanel/bShowOnlyWhenTrue/bShowOnlyWhenTrue.md Demonstrates how to configure a property to be shown only when a specific key in the 'UnrealEd.PropertyFilters' section of the DefaultEditorPerProjectUserSettings.ini file is set to true. The MyString_WithShowOnly property is hidden because 'ShowMyString' is set to false in the INI file. ```ini D:\github\GitWorkspace\Hello\Config\DefaultEditorPerProjectUserSettings.ini [UnrealEd.PropertyFilters] ShowMyInt=true ShowMyString=false ``` ```cpp UCLASS(BlueprintType) class INSIDER_API UMyProperty_Show :public UObject { GENERATED_BODY() public: UPROPERTY(EditAnywhere, BlueprintReadWrite) int32 MyInt = 123; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (bShowOnlyWhenTrue = "ShowMyInt")) int32 MyInt_WithShowOnly = 123; UPROPERTY(EditAnywhere, BlueprintReadWrite, meta = (bShowOnlyWhenTrue = "ShowMyString")) FString MyString_WithShowOnly; }; ``` -------------------------------- ### Example UFUNCTION with CustomStructureParam Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Blueprint/Param/CustomStructureParam/CustomStructureParam.md An example of a UFUNCTION declaration using CustomStructureParam to specify a generic output row parameter for data table lookups. ```cpp UFUNCTION(BlueprintCallable, CustomThunk, Category = "DataTable", meta=(CustomStructureParam = "OutRow", BlueprintInternalUseOnly="true")) static ENGINE_API bool GetDataTableRowFromName(UDataTable* Table, FName RowName, FTableRowBase& OutRow); ``` -------------------------------- ### Deprecated Behavior Tree Task Node Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/DetailsPanel/DeprecatedNode/DeprecatedNode.md This C++ example demonstrates how to mark a UBTTaskNode as deprecated using the DeprecatedNode specifier and providing a deprecation message. ```cpp UCLASS(meta = (DeprecatedNode, DeprecationMessage = "This BT node is deprecated. Don't use this anymore."), MinimalAPI) class UBTTask_MyDeprecatedNode : public UBTTaskNode { GENERATED_UCLASS_BODY() }; ``` -------------------------------- ### UPROPERTY Examples with LinearDeltaSensitivity Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/Numeric/LinearDeltaSensitivity.md Demonstrates how to apply LinearDeltaSensitivity, Delta, UIMin, and UIMax meta tags to float properties in Unreal Engine. ```cpp UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DeltaTest, meta = (UIMin = "0", UIMax = "1000", Delta = 10)) float MyFloat_Delta10_UIMinMax = 100; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DeltaTest, meta = (Delta = 10, LinearDeltaSensitivity = 50)) float MyFloat_Delta10_LinearDeltaSensitivity50 = 100; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DeltaTest, meta = (UIMin = "0", UIMax = "1000", Delta = 10, LinearDeltaSensitivity = 50)) float MyFloat_Delta10_LinearDeltaSensitivity50_UIMinMax = 100; ``` -------------------------------- ### Dynamic Multicast Delegate Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Widget/IsBindableEvent/IsBindableEvent.md Example of a dynamic multicast delegate declared and assigned to a UButton's OnClicked event. Dynamic multicast delegates are automatically exposed in UMG. ```cpp DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnButtonClickedEvent); class UButton : public UContentWidget { UPROPERTY(BlueprintAssignable, Category="Button|Event") FOnButtonClickedEvent OnClicked; } ``` -------------------------------- ### AssetBundleData Example (Client Bundle) Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/Object/IncludeAssetBundles/IncludeAssetBundles.md Illustrates the structure of AssetBundleData for a 'Client' bundle, showing the included asset path after processing with IncludeAssetBundles. ```cpp { BundleName = "Client"; BundleAssets = { { AssetPath = { PackageName = "/Game/Asset/Image/T_Shop_Stone"; AssetName = "T_Shop_Stone"; }; SubPathString = ""; }; }, AssetPaths = { { PackageName = "/Game/Asset/Image/T_Shop_Stone"; AssetName = "T_Shop_Stone"; }; }, }; ``` -------------------------------- ### Variadic Specifier Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5_Specifiers.md Illustrates the Variadic specifier, enabling a UFUNCTION to accept a variable number of parameters. This example shows how to define and implement a function that processes variable inputs and outputs. ```cpp UFUNCTION(BlueprintCallable, CustomThunk, Category = "Python|Execution", meta=(Variadic, BlueprintInternalUseOnly="true")) static bool ExecutePythonScript(UPARAM(meta=(MultiLine=True)) const FString& PythonScript, const TArray& PythonInputs, const TArray& PythonOutputs); DECLARE_FUNCTION(execExecutePythonScript); ``` ```cpp UCLASS(Blueprintable, BlueprintType) class INSIDER_API UMyFunction_Variadic : public UBlueprintFunctionLibrary { public: GENERATED_BODY() public: /* [PrintVariadicFields Function->Struct->Field->Object /Script/Insider.MyFunction_Variadic:PrintVariadicFields] (BlueprintInternalUseOnly = true, BlueprintType = true, CustomThunk = true, ModuleRelativePath = Function/Variadic/MyFunction_Variadic.h, Variadic = ) */ UFUNCTION(BlueprintCallable, CustomThunk, BlueprintInternalUseOnly, meta = (Variadic)) static FString PrintVariadicFields(const TArray& Inputs, const TArray& Outputs); DECLARE_FUNCTION(execPrintVariadicFields); }; FString UMyFunction_Variadic::PrintVariadicFields(const TArray& Inputs, const TArray& Outputs) { check(0); return TEXT(""); } DEFINE_FUNCTION(UMyFunction_Variadic::execPrintVariadicFields) { FString str; P_GET_TARRAY_REF(FString, Inputs); P_GET_TARRAY_REF(FString, Outputs); for (const FString& PythonInput : Inputs) { Stack.MostRecentPropertyAddress = nullptr; Stack.MostRecentProperty = nullptr; Stack.StepCompiledIn(nullptr); check(Stack.MostRecentProperty && Stack.MostRecentPropertyAddress); FProperty* p = CastField(Stack.MostRecentProperty); FString propertyValueString; const void* propertyValuePtr = p->ContainerPtrToValuePtr(Stack.MostRecentPropertyContainer); p->ExportTextItem_Direct(propertyValueString, propertyValuePtr, nullptr, nullptr, PPF_None); str += FString::Printf(TEXT("%s:%s\n"), *p->GetFName().ToString(), *propertyValueString); } P_FINISH; *(FString*)RESULT_PARAM = str; } ``` -------------------------------- ### GlobalConfig Specifier INI File Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5_Specifiers.md Illustrates the resulting INI file content after using the GlobalConfig specifier, showing how base class settings are adopted. ```ini [/Script/Insider.MyProperty_Config] MyPropertyWithConfig=777 MyPropertyWithGlobalConfig=888 [/Script/Insider.MyProperty_Config_Child] MyPropertyWithConfig=888 ``` -------------------------------- ### UPROPERTY with ShowAsInputPin Metadata Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/Material/ShowAsInputPin/ShowAsInputPin.md Demonstrates how to use the ShowAsInputPin metadata specifier with 'Primary' and 'Advanced' options on float properties within a UPROPERTY. ```cpp public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PinTest) float MyFloat; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PinTest, meta = (ShowAsInputPin = "Primary")) float MyFloat_Primary; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PinTest, meta = (ShowAsInputPin = "Advanced")) float MyFloat_Advanced; ``` -------------------------------- ### HideFunctions Specifier Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5标识符详解.md This C++ code demonstrates the 'HideFunctions' specifier in Unreal Engine. It's used within a UCLASS definition to hide specific functions from the Blueprint function override list, as shown in the UCineCameraComponent example. ```cpp class ENGINE_API UCameraComponent : public USceneComponent { UFUNCTION(BlueprintCallable, Category = Camera) virtual void SetFieldOfView(float InFieldOfView) { FieldOfView = InFieldOfView; } UFUNCTION(BlueprintCallable, Category = Camera) void SetAspectRatio(float InAspectRatio) { AspectRatio = InAspectRatio; } } UCLASS(HideCategories = (CameraSettings), HideFunctions = (SetFieldOfView, SetAspectRatio), Blueprintable, ClassGroup = Camera, meta = (BlueprintSpawnableComponent), Config = Engine) class CINEMATICCAMERA_API UCineCameraComponent : public UCameraComponent ``` -------------------------------- ### Internal Engine Use Example: GetLevelScriptActor Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/UFUNCTION/UHT/BlueprintInternalUseOnly/BlueprintInternalUseOnly.md This example illustrates an internal engine use case where GetLevelScriptActor is marked with BlueprintInternalUseOnly. This allows the function to be found by name for reflection and specific node creation within the engine, without exposing it for direct Blueprint calls. ```cpp UFUNCTION(BlueprintPure, meta = (BlueprintInternalUseOnly = "true")) ENGINE_API ALevelScriptActor* GetLevelScriptActor(); ``` -------------------------------- ### Apply RequiredAssetDataTags to UObject and DataTable Properties Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/Asset/RequiredAssetDataTags/RequiredAssetDataTags.md Demonstrates applying the RequiredAssetDataTags specifier to UPROPERTYs. The first example filters UObjects based on a 'Schema' tag, while the second filters DataTables based on 'RowStructure'. The third example shows filtering a UTexture based on an 'IsSourceValid' tag. ```cpp UPROPERTY(Category="StateTree", EditAnywhere, meta=(RequiredAssetDataTags="Schema=/Script/MassAIBehavior.MassStateTreeSchema")) TObjectPtr StateTree; UPROPERTY(EditAnywhere, Category=Appearance, meta = (RequiredAssetDataTags = "RowStructure=/Script/UMG.RichImageRow")) TObjectPtr ImageSet; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Compositing, meta = (AllowPrivateAccess, RequiredAssetDataTags = "IsSourceValid=True"), Setter = SetCompositeTexture, Getter = GetCompositeTexture) TObjectPtr CompositeTexture; ``` -------------------------------- ### UPROPERTY Examples for Delta and LinearDeltaSensitivity Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5标识符详解.md Demonstrates how to use UPROPERTY meta tags to configure Delta and LinearDeltaSensitivity for float properties in Unreal Engine. These settings affect how the SSpinBox behaves when modified via mouse or keyboard. ```cpp UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DeltaTest, meta = (UIMin = "0", UIMax = "1000", Delta = 10)) float MyFloat_Delta10_UIMinMax = 100; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DeltaTest, meta = (Delta = 10, LinearDeltaSensitivity = 50)) float MyFloat_Delta10_LinearDeltaSensitivity50 = 100; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = DeltaTest, meta = (UIMin = "0", UIMax = "1000", Delta = 10, LinearDeltaSensitivity = 50)) float MyFloat_Delta10_LinearDeltaSensitivity50_UIMinMax = 100; ``` -------------------------------- ### Saving Config Properties to INI Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/UCLASS/Config/Config.md This example demonstrates how to create an object instance and call SaveConfig() to persist its configuration properties to the designated INI file. This is typically done for objects that need their settings saved. ```cpp //测试代码 UMyClass_Config* testObject = NewObject(GetTransientPackage(),TEXT("testObject")); testObject->SaveConfig(); ``` -------------------------------- ### BlueprintImplementableEvent Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5标识符详解.md Defines a function that can only be implemented in Blueprints. C++ cannot provide an implementation. ```cpp //FunctionFlags: FUNC_Event | FUNC_Public | FUNC_BlueprintCallable | FUNC_BlueprintEvent UFUNCTION(BlueprintCallable, BlueprintImplementableEvent) void MyFunc_ImplementableEvent(); ``` ```cpp void AMyFunction_Default::MyFunc_ImplementableEvent() { ProcessEvent(FindFunctionChecked(NAME_AMyFunction_Default_MyFunc_ImplementableEvent),NULL); } ``` -------------------------------- ### Declare BlueprintCosmetic Function Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/UFUNCTION/Network/BlueprintCosmetic/BlueprintCosmetic.md Example of declaring a function with the BlueprintCosmetic specifier in C++. ```cpp UFUNCTION(BlueprintCallable, BlueprintCosmetic) void MyFunc_BlueprintCosmetic(); ``` -------------------------------- ### ListView Entry Widget Configuration Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5标识符详解.md Example of configuring a ListView's entry widget class and interface using UPROPERTY metadata in C++. ```cpp //1. ListView作为别的Widget的属性,因此会在Property上进行Meta的提取判断。 //该属性必须是BindWidget,才能自动绑定到UMG里的控件,同时作为C++ property才能被枚举到。 class UMyUserWidget : public UUserWidget { UPROPERTY(BindWidget, meta = (EntryClass = MyListEntryWidget,EntryInterface = MyUserListEntry )) UListViewBase* MyListView; } //2. 如果在Property上没有找到改Meta,也会尝试在Widget Class身上直接找 UCLASS(meta = (EntryClass = MyListEntryWidget, EntryInterface = "/Script/UMG.UserObjectListEntry")) class UMyListView : public UListViewBase, public ITypedUMGListView {} ``` -------------------------------- ### RigVMPinInfo Constructor Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/RigVM/Visible/Visible.md Initializes RigVMPinInfo, checking for the 'Constant' metadata which influences pin behavior. ```cpp FRigVMPinInfo::FRigVMPinInfo(FProperty* InProperty, ERigVMPinDirection InDirection, int32 InParentIndex, const uint8* InDefaultValueMemory) { bIsConstant = InProperty->HasMetaData(TEXT("Constant")); } ``` -------------------------------- ### HideEditConditionToggle Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/DetailsPanel/HideEditConditionToggle/HideEditConditionToggle.md Demonstrates the usage of HideEditConditionToggle alongside EditCondition on UPROPERTY declarations. ```cpp public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = InlineEditConditionToggle, meta = (InlineEditConditionToggle)) bool MyBool_Inline; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = InlineEditConditionToggle, meta = (EditCondition = "MyBool_Inline")) int32 MyInt_EditCondition_UseInline = 123; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = InlineEditConditionToggle, meta = (HideEditConditionToggle,EditCondition = "MyBool_Inline")) int32 MyInt_EditCondition_UseInline_Hide = 123; }; ``` -------------------------------- ### ComponentReference Property Examples Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5标识符详解.md Demonstrates the usage of UseComponentPicker and AllowAnyActor meta-specifiers with FComponentReference properties. ```cpp UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category = "UseComponentPickerTest") FComponentReference MyComponentReference_NoUseComponentPicker; UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category = "UseComponentPickerTest", meta = (UseComponentPicker)) FComponentReference MyComponentReference_UseComponentPicker; UPROPERTY(EditInstanceOnly, BlueprintReadWrite, Category = "UseComponentPicker_AllowAnyActor_Test", meta = (UseComponentPicker,AllowAnyActor)) FComponentReference MyComponentReference_UseComponentPicker_AllowAnyActor; ``` -------------------------------- ### Built-in Structs with BlueprintInternalUseOnly Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/USTRUCT/Blueprint/BlueprintInternalUseOnly/BlueprintInternalUseOnly.md Examples of built-in Unreal Engine structs that are marked with BlueprintInternalUseOnly. ```cpp USTRUCT(BlueprintInternalUseOnly) struct FLatentActionInfo {} ``` ```cpp USTRUCT(BlueprintInternalUseOnly) struct FTableRowBase {} ``` -------------------------------- ### UPROPERTY with Units and ForceUnits Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Numeric/Units/Units.md Demonstrates how to apply 'Units' and 'ForceUnits' metadata to float properties within UPROPERTY declarations. 'Units' allows for dynamic display adjustment, while 'ForceUnits' fixes the display unit. ```cpp UPROPERTY(EditAnywhere, Category = UnitsTest) float MyFloat_NoUnits = 0.0; UPROPERTY(EditAnywhere, Category = UnitsTest, Meta = (Units = "cm")) float MyFloat_HasUnits_Distance = 100.f; UPROPERTY(EditAnywhere, Category = UnitsTest, Meta = (ForceUnits = "cm")) float MyFloat_HasForceUnits_Distance = 100.f; ``` -------------------------------- ### Loading and Testing a Package with Optional Objects Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Specifier/UCLASS/Serialization/Optional/Optional.md Demonstrates how to load a previously saved Unreal Engine package and retrieve objects from it. This function is used to verify the contents of the package after it has been saved, including optional objects if they were included. ```cpp void UMyClass_Optional_Test::LoadPackageAndTest() { FString packageName = TEXT("/Game/MyOptionTestPackage"); FString assetPath = FPackageName::LongPackageNameToFilename(packageName, FPackageName::GetAssetPackageExtension()); UPackage* package = LoadPackage(nullptr, *assetPath, LOAD_None); package->FullyLoad(); UMyClass_Optional_Test* newTestObject = LoadObject(package, TEXT("testObject"), *assetPath); //UMyClass_Transient_Test* newTestObject = nullptr; /*const TArray& exportMap = package->GetLinker()->ExportMap; for (const auto& objExport : exportMap) { if (objExport.ObjectName == TEXT("testObject")) { newTestObject = Cast(objExport.Object); break; } }*/ FString str = UInsiderSubsystem::Get().PrintObject(package, EInsiderPrintFlags::All); } ``` -------------------------------- ### UAnimNotifyState_TimedNiagaraEffect Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/AnimationGraph/AnimNotifyBoneName/AnimNotifyBoneName.md Shows how to apply AnimNotifyBoneName to the SocketName FName attribute in a UAnimNotifyState subclass. ```cpp UCLASS(Blueprintable, meta = (DisplayName = "Timed Niagara Effect"), MinimalAPI) class UAnimNotifyState_TimedNiagaraEffect : public UAnimNotifyState { // The socket within our mesh component to attach to when we spawn the Niagara component UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = NiagaraSystem, meta = (ToolTip = "The socket or bone to attach the system to", AnimNotifyBoneName = "true")) FName SocketName; } ``` -------------------------------- ### Loading a Package with Optional Objects Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Specifier/UCLASS/Serialization/Optional/Optional.md Demonstrates how to load a previously saved package that may contain optional objects. This function shows the standard procedure for loading a package and then loading a specific object from it. ```cpp void UMyClass_Optional_Test::LoadPackageAndTest() { FString packageName = TEXT("/Game/MyOptionTestPackage"); FString assetPath = FPackageName::LongPackageNameToFilename(packageName, FPackageName::GetAssetPackageExtension()); UPackage* package = LoadPackage(nullptr, *assetPath, LOAD_None); package->FullyLoad(); UMyClass_Optional_Test* newTestObject = LoadObject(package, TEXT("testObject"), *assetPath); //UMyClass_Transient_Test* newTestObject = nullptr; /*const TArray& exportMap = package->GetLinker()->ExportMap; for (const auto& objExport : exportMap) { if (objExport.ObjectName == TEXT("testObject")) { newTestObject = Cast(objExport.Object); break; } }*/ FString str = UInsiderSubsystem::Get().PrintObject(package, EInsiderPrintFlags::All); } ``` -------------------------------- ### UAnimNotify_PlayNiagaraEffect Example Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Meta/AnimationGraph/AnimNotifyBoneName/AnimNotifyBoneName.md Demonstrates using AnimNotifyBoneName for the SocketName FName attribute in a UAnimNotify subclass. ```cpp UCLASS(const, hidecategories = Object, collapsecategories, meta = (DisplayName = "Play Niagara Particle Effect"), MinimalAPI) class UAnimNotify_PlayNiagaraEffect : public UAnimNotify { // SocketName to attach to UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "AnimNotify", meta = (AnimNotifyBoneName = "true")) FName SocketName; } ``` -------------------------------- ### UFUNCTION and UPROPERTY Examples with ExactClass Source: https://github.com/fjz13/unrealspecifiers/blob/main/Tools/PDF/UE5_Specifiers.md Demonstrates the usage of the ExactClass specifier within UPROPERTY metadata, alongside AllowedClasses and GetAllowedClasses, for controlling the types of objects that can be assigned. ```cpp TArray MyGetAllowedClassesFunc() { TArray classes; classes.Add(UTextureLightProfile::StaticClass()); classes.Add(UTextureCube::StaticClass()); return classes; } UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ExactClassTest|UObject*", meta = (AllowedClasses = "/Script/Engine.Texture2D,/Script/Engine.TextureCube",GetAllowedClasses = "MyGetAllowedClassesFunc")) UObject* MyObject_NoExactClass; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ExactClassTest|UObject*", meta = (ExactClass, AllowedClasses = "/Script/Engine.Texture2D,/Script/Engine.TextureCube",GetAllowedClasses = "MyGetAllowedClassesFunc")) UObject* MyObject_ExactClass; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ExactClassTest|FSoftObjectPath", meta = (AllowedClasses = "/Script/Engine.Texture2D,/Script/Engine.TextureCube",GetAllowedClasses = "MyGetAllowedClassesFunc")) FSoftObjectPath MySoftObject_NoExactClass; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ExactClassTest|FSoftObjectPath", meta = (ExactClass, AllowedClasses = "/Script/Engine.Texture2D,/Script/Engine.TextureCube",GetAllowedClasses = "MyGetAllowedClassesFunc")) FSoftObjectPath MySoftObject_ExactClass; ``` -------------------------------- ### Actor Class Definitions Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/Blueprint/Param/DeterminesOutputType/DeterminesOutputType.md Defines base and derived actor classes used in DeterminesOutputType examples. ```cpp UCLASS(Blueprintable, BlueprintType) class INSIDER_API AMyAnimalActor :public AActor { public: GENERATED_BODY() }; UCLASS(Blueprintable, BlueprintType) class INSIDER_API AMyCatActor :public AMyAnimalActor { public: GENERATED_BODY() }; UCLASS(Blueprintable, BlueprintType) class INSIDER_API AMyDogActor :public AMyAnimalActor { public: GENERATED_BODY() }; ``` -------------------------------- ### AnimGetter Without GetterContext Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/AnimationGraph/GetterContext/GetterContext.md An example of an AnimGetter function that does not specify GetterContext, making it available in all contexts. ```cpp UFUNCTION(BlueprintPure, Category = "Animation|Insider", meta = (BlueprintThreadSafe)) float MyGetStateWeight(int32 MachineIndex, int32 StateIndex); ``` -------------------------------- ### FRigUnit with ExpandByDefault Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/zh/Meta/RigVM/ExpandByDefault/ExpandByDefault.md Demonstrates how to use the 'ExpandByDefault' meta tag on a UPROPERTY within an FRigUnit struct. This causes the property's pins to be expanded by default in the RigVM editor. ```cpp USTRUCT(meta = (DisplayName = "MyRig")) struct INSIDER_API FRigUnit_MyRig : public FRigUnit { UPROPERTY(meta = (Input)) FMyCommonStruct MyStruct_Normal; UPROPERTY(meta = (Input, ExpandByDefault)) FMyCommonStruct MyStruct_ExpandByDefault; UPROPERTY(meta = (Output)) float MyFloat_Output = 123.f; } ``` -------------------------------- ### Saving a Package with Transient Objects Source: https://github.com/fjz13/unrealspecifiers/blob/main/Doc/en/Specifier/UCLASS/Serialization/Transient/Transient.md Demonstrates the process of creating a package, adding transient and non-transient objects to it, setting their properties, and saving the package using UPackage::SavePackage. ```cpp FString packageName = TEXT("/Game/MyTestPackage"); FString assetPath = FPackageName::LongPackageNameToFilename(packageName, FPackageName::GetAssetPackageExtension()); UPackage* package = CreatePackage(*packageName); FSavePackageArgs saveArgs{}; saveArgs.Error = GError; //ObjectFlags: RF_NoFlags UMyClass_Transient_Test* testObject = NewObject(package, TEXT("testObject")); //ObjectFlags: RF_Transient testObject->MyTransientObject = NewObject(testObject, TEXT("MyTransientObject")); //ObjectFlags: RF_NoFlags testObject->MyNonTransientObject = NewObject(testObject, TEXT("MyNonTransientObject")); testObject->MyTransientObject->MyProperty = 456; testObject->MyNonTransientObject->MyProperty = 456; testObject->MyInt_Normal = 456; testObject->MyInt_Transient = 456; bool result = UPackage::SavePackage(package, testObject, *assetPath, saveArgs); ```