编辑
2023-08-03
code
00
请注意,本文编写于 413 天前,最后修改于 413 天前,其中某些信息可能已经过时。

目录

UE4 UFUNCTION常用的的元信息宏
BlueprintCallable
BlueprintImplementableEvent
Category
元数据说明符
CommutativeAssociativeBinaryOperator=”true”
CompactNodeTitle=”Name”
DisplayName=”Blueprint Node Name”
HidePin=”Parameter”

UE4 UFUNCTION常用的的元信息宏

参考原文: UE4-常见的宏-UFUNCTION

BlueprintCallable

该函数可以在蓝图或关卡蓝图图表中执行

cpp
public: UFUNCTION(BlueprintCallable, Category = "Snowing,BlueprintFunc") void BlueprintCallableFunction();

img

BlueprintImplementableEvent

此函数可以在蓝图或关卡蓝图图表内进行重载 不能修饰private级别的函数,函数在C++代码中不需要实现定义

cpp
public: UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Blueprint Implementable Event Function"), Category = "Snowing|BlueprintFunc") float BlueprintImplementableEventFunction(float In_Float);

img

Category

Category = TopCategory|SubCategory|Etc

指定函数在编辑器中的显示分类层级,| 是分层级的符号

cpp
UFUNCTION(BlueprintPure, Category = "Snowing|BlueprintFunc") AActor* BlueprintPureFunction();

img

元数据说明符

用法:UFUNCTION( [函数说明符], meta = (元数据说明符) )

CommutativeAssociativeBinaryOperator=”true”

指示BlueprintCallable函数应该使用“Commutative Associative Binary”节点。该节点缺少引脚名称,但具有创建附加输入引脚的“Add Pin”按钮

cpp
//.h文件函数声明 UFUNCTION(BlueprintPure, meta = (DisplayName = "Add Pin Function", CommutativeAssociativeBinaryOperator = "true"), Category = "Snowing|Parameters") float CommutativeAssociativeBinaryOperatorFunction(const float A, const float B); //.cpp文件行数定义 float AActorTest::CommutativeAssociativeBinaryOperatorFunction(const float A, const float B) { float Result{0.f}; Result += A; Result += B; return Result; }

img

CompactNodeTitle=”Name”

指示BlueprintCallable函数应在紧凑显示模式下显示,并提供在该模式下显示的名称

cpp
UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "In_Int32", CompactNodeTitle = "CompactNodeTitleFunction"), Category = "Snowing|Parameters") int32 AutoCreateRefTermFunction(UPARAM(Ref) int32& In_Int32);

img

DisplayName=”Blueprint Node Name”

蓝图中此节点的名称将替换为此处提供的值,而不是代码生成的名称(在蓝图中搜索被修饰函数也用这里提供的值)

HidePin=”Parameter”

对于BlueprintCallable函数,这表示参数引脚应该隐藏在用户的视图中。请注意,每个功能只能有一个参数引脚以这种方式隐藏

cpp
UFUNCTION(BlueprintCallable, meta = (HidePin = "In_Float"), Category = "Snowing|Parameters") void HidePinFunction(int In_Int, float In_Float, FString In_FString, TArray<AActor*> In_TArray);

img

本文作者:OhtoAi

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!