Files
.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
Component
Config
Container
Debug
DetailsPanel
AllowEditInlineCustomization
DeprecatedNode
DisplayAfter
DisplayAfter.md
Untitled.png
DisplayPriority
EditCondition
EditConditionHides
EditInline
ForceInlineRow
HideEditConditionToggle
HideInDetailPanel
InlineEditConditionToggle
MaxPropertyDepth
NoResetToDefault
bShowOnlyWhenTrue
AdvancedClassDisplay.md
AutoCollapseCategories.md
AutoExpandCategories.md
Category.md
ClassGroupNames.md
HideBehind.md
HideCategories.md
IgnoreCategoryKeywordsInSubclasses.md
NoEditInline.md
PrioritizeCategories.md
ReapplyCondition.md
ShowCategories.md
UsesHierarchy.md
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
Physical
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

64 lines
1.8 KiB
Markdown
Raw Normal View History

2024-10-12 17:19:46 +08:00
# DisplayAfter
- **功能描述:** 使本属性在指定的属性之后显示。
- **使用位置:** UPROPERTY
- **引擎模块:** DetailsPanel
- **元数据类型:** string="abc"
- **常用程度:** ★★★
使本属性在指定的属性之后显示。
- 默认情况下,属性在细节面板中的顺序是依照头文件中的定义顺序。但如果我们想自己调节这个顺序,就可以用该标记。
- 限制条件是这两个属性必须得是在同一个Category下。这也很好理解Category组织的优先级肯定更大。
## 测试代码:
```cpp
UCLASS(BlueprintType)
class INSIDER_API UMyProperty_Priority :public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AfterTest)
int32 MyInt = 123;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AfterTest)
FString MyString;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AfterTest, meta = (DisplayAfter = "MyInt"))
int32 MyInt_After = 123;
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AfterTest2, meta = (DisplayAfter = "MyInt"))
int32 MyInt_After2 = 123;
};
```
## 测试效果:
可见MyInt_After直接在Int后显示。
而MyInt_After2 因为在不同的Category下因此就保留原样。
![Untitled](Untitled.png)
## 原理:
检查该属性如果有DisplayAfter就把它插入在指定的属性之后。
```cpp
void PropertyEditorHelpers::OrderPropertiesFromMetadata(TArray<FProperty*>& Properties)
{
const FString& DisplayAfterPropertyName = Prop->GetMetaData(NAME_DisplayAfter);
if (DisplayAfterPropertyName.IsEmpty())
{
InsertProperty(OrderedProperties);
}
else
{
TArray<TPair<FProperty*, int32>>& DisplayAfterProperties = DisplayAfterPropertyMap.FindOrAdd(FName(*DisplayAfterPropertyName));
InsertProperty(DisplayAfterProperties);
}
}
```