UE4 UFUNCTION常用的的元信息宏
参考原文: UE4-常见的宏-UFUNCTION
BlueprintCallable
该函数可以在蓝图或关卡蓝图图表中执行
public:
UFUNCTION(BlueprintCallable, Category = "Snowing,BlueprintFunc")
void BlueprintCallableFunction();
BlueprintImplementableEvent
此函数可以在蓝图或关卡蓝图图表内进行重载 不能修饰private级别的函数,函数在C++代码中不需要实现定义
public:
UFUNCTION(BlueprintImplementableEvent, meta = (DisplayName = "Blueprint Implementable Event Function"), Category = "Snowing|BlueprintFunc")
float BlueprintImplementableEventFunction(float In_Float);
Category
Category = TopCategory|SubCategory|Etc
指定函数在编辑器中的显示分类层级,|
是分层级的符号
元数据说明符
用法:UFUNCTION( [函数说明符], meta = (元数据说明符) )
CommutativeAssociativeBinaryOperator=”true”
指示BlueprintCallable函数应该使用“Commutative Associative Binary”节点。该节点缺少引脚名称,但具有创建附加输入引脚的“Add Pin”按钮
//.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;
}
CompactNodeTitle=”Name”
指示BlueprintCallable函数应在紧凑显示模式下显示,并提供在该模式下显示的名称
UFUNCTION(BlueprintCallable, meta = (AutoCreateRefTerm = "In_Int32", CompactNodeTitle = "CompactNodeTitleFunction"), Category = "Snowing|Parameters")
int32 AutoCreateRefTermFunction(UPARAM(Ref) int32& In_Int32);
DisplayName=”Blueprint Node Name”
蓝图中此节点的名称将替换为此处提供的值,而不是代码生成的名称(在蓝图中搜索被修饰函数也用这里提供的值)
HidePin=”Parameter”
对于BlueprintCallable函数,这表示参数引脚应该隐藏在用户的视图中。请注意,每个功能只能有一个参数引脚以这种方式隐藏
UFUNCTION(BlueprintCallable, meta = (HidePin = "In_Float"), Category = "Snowing|Parameters")
void HidePinFunction(int In_Int, float In_Float, FString In_FString, TArray<AActor*> In_TArray);