.obsidian
.vs
00-MOC
01-Diary
02-Note
03-UnrealEngine
Animation
Editor
Gameplay
AI
Animation
Code
Debug
GAS
Gameplay
Http
Lyra
Mass
Online
Other
PuerTS
UObject
UnrealSpecifiers
Flags
Meta
Actor
AnimationGraph
Asset
Blueprint
AdvancedDisplay
AdvancedDisplay.md
Untitled.png
AllowPrivateAccess
BlueprintAutocast
BlueprintPrivate
BlueprintProtected
BlueprintThreadSafe
CallableWithoutWorldContext
CommutativeAssociativeBinaryOperator
CompactNodeTitle
DefaultToSelf
DontUseGenericSpawnObject
Exec
ExposeOnSpawn
ExposedAsyncProxy
ForceAsFunction
HasDedicatedAsyncNode
HiddenNode
HideThen
IgnoreTypePromotion
Keywords
KismetHideOverrides
Latent
NativeMakeFunc
NotInputConfigurable
ObjectSetType
Param
ProhibitedInterfaces
RestrictedToClasses
ReturnDisplayName
SetParam
ShowWorldContextPin
UnsafeDuringActorConstruction
WorldContext
BlueprintGetter.md
BlueprintInternalUseOnly.md
BlueprintInternalUseOnlyHierarchical.md
BlueprintSetter.md
BlueprintType.md
CPP_Default_XXX.md
CallInEditor.md
CannotImplementInterfaceInBlueprint.md
DisplayName.md
GetByRef.md
HideFunctions.md
IsBlueprintBase.md
IsConversionRoot.md
NativeBreakFunc.md
NativeConst.md
NotBlueprintThreadSafe.md
SparseClassDataTypes.md
Variadic.md
Component
Config
Container
Debug
DetailsPanel
Development
Enum
GAS
Material
Niagara
Numeric
Object
Path
Pin
RigVM
Scene
Script
Sequencer
Serialization
SparseDataType
String
Struct
TypePicker
UHT
Widget
Meta.md
Specifier
UnrealSpecifiers.md
Ue4 c++ UProperty反射 PostEditChangeProperty.md
Ue4Object生命周期.jpg
大钊提供的一种获取UE Private函数的方法.md
LevelScene
Math
Mobile
Plugins
Rendering
Sequence
UI
VirtualProduction
VisualEffect
卡通渲染相关资料
性能优化
流程管理与部署
.keep
03-UnrealEngine.md
04-ComputerGraphics
05-SDHGame
06-DCC
07-Other
08-Assets
09-Templates
.gitattributes
.gitignore
.gitmodules
LICENSE
3.3 KiB
3.3 KiB
AdvancedDisplay
- 功能描述: 把函数的一些参数折叠起来不显示,需要手动点开下拉箭头来展开编辑。
- 使用位置: UFUNCTION
- 引擎模块: Blueprint
- 元数据类型: strings="a,b,c"
- 常用程度: ★★★★★
把函数的一些参数折叠起来不显示,需要手动点开下拉箭头来展开编辑。
AdvancedDisplay同时支持两种格式,一是用"Parameter1, Parameter2, ..”来显式的指定需要折叠的参数名字,适用于要折叠的参数不连续或者处在函数参数列表中中央的情况下。二是”N”指定一个数字序号,第N之后的所有参数将显示为高级引脚。
测试代码:
UFUNCTION(BlueprintCallable, meta = (AdvancedDisplay = "2"))
static int32 MyFunc_HasAdvancedDisplay_WithOrder(int32 First, int32 Second, int32 Third, int32 Fourth, int32 Fifth) { return 0; }
UFUNCTION(BlueprintCallable, meta = (AdvancedDisplay = "Fourth,Fifth"))
static int32 MyFunc_HasAdvancedDisplay_WithName(int32 First, int32 Second, int32 Third, int32 Fourth, int32 Fifth) { return 0; }
UFUNCTION(BlueprintCallable, meta = ())
static int32 MyFunc_NoAdvancedDisplay(int32 First, int32 Second, int32 Third, int32 Fourth, int32 Fifth) { return 0; }
蓝图效果:
源码中典型的例子是PrintString,在第2个参数后的其他参数就都折叠了起来。
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);
原理:
AdvancedDisplay使得被标注的函数参数增加EPropertyFlags.AdvancedDisplay的标记,从而使得其被折叠起来。这个逻辑是在UHT对函数进行解析的时候设置的。
//支持参数名字和数字序号两种模式
if (_metaData.TryGetValue(UhtNames.AdvancedDisplay, out string? foundString))
{
_parameterNames = foundString.ToString().Split(',', StringSplitOptions.RemoveEmptyEntries);
for (int index = 0, endIndex = _parameterNames.Length; index < endIndex; ++index)
{
_parameterNames[index] = _parameterNames[index].Trim();
}
if (_parameterNames.Length == 1)
{
_bUseNumber = Int32.TryParse(_parameterNames[0], out _numberLeaveUnmarked);
}
}
//设置EPropertyFlags.AdvancedDisplay
private static void UhtFunctionParser::ParseParameterList(UhtParsingScope topScope, UhtPropertyParseOptions options)
{
UhtAdvancedDisplayParameterHandler advancedDisplay = new(topScope.ScopeType.MetaData);
topScope.TokenReader.RequireList(')', ',', false, () =>
{
topScope.HeaderParser.GetCachedPropertyParser().Parse(topScope, disallowFlags, options, propertyCategory,
(UhtParsingScope topScope, UhtProperty property, ref UhtToken nameToken, UhtLayoutMacroType layoutMacroType) =>
{
property.PropertyFlags |= EPropertyFlags.Parm;
if (advancedDisplay.CanMarkMore() && advancedDisplay.ShouldMarkParameter(property.EngineName))
{
property.PropertyFlags |= EPropertyFlags.AdvancedDisplay;
}
}