vault backup: 2024-10-12 17:19:45
@@ -0,0 +1,43 @@
|
||||
# AdvancedDisplay
|
||||
|
||||
- **功能描述:** 被折叠到高级栏下,要手动打开。一般用在不太常用的属性上面。
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_AdvancedDisplay](../../../../Flags/EPropertyFlags/CPF_AdvancedDisplay.md)
|
||||
- **常用程度:★★★★★**
|
||||
|
||||
被折叠到高级栏下,要手动打开。一般用在不太常用的属性上面。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
```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;
|
||||
}
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
如果CPF_AdvancedDisplay,bAdvanced =true
|
||||
|
||||
```cpp
|
||||
void FPropertyNode::InitNode(const FPropertyNodeInitParams& InitParams)
|
||||
{
|
||||
// Property is advanced if it is marked advanced or the entire class is advanced and the property not marked as simple
|
||||
static const FName Name_AdvancedClassDisplay("AdvancedClassDisplay");
|
||||
bool bAdvanced = Property.IsValid() ? ( Property->HasAnyPropertyFlags(CPF_AdvancedDisplay) || ( !Property->HasAnyPropertyFlags( CPF_SimpleDisplay ) && Property->GetOwnerClass() && Property->GetOwnerClass()->GetBoolMetaData(Name_AdvancedClassDisplay) ) ) : false;
|
||||
|
||||
}
|
||||
```
|
After Width: | Height: | Size: 7.1 KiB |
@@ -0,0 +1,53 @@
|
||||
# Category
|
||||
|
||||
- **功能描述:** 指定属性的类别,使用 | 运算符定义嵌套类目。
|
||||
- **元数据类型:** strings=“a|b|c”
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在Meta中加入[Category](../../../../Meta/DetailsPanel/Category.md)
|
||||
- **常用程度:★★★★★**
|
||||
|
||||
指定属性的类别,使用 | 运算符定义嵌套类目。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
```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;
|
||||
public:
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditAnywhere, Category = Edit)
|
||||
int32 MyInt_EditAnywhere = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnInstance | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditDefaultsOnly, Category = Edit)
|
||||
int32 MyInt_EditDefaultsOnly = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnTemplate | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditInstanceOnly, Category = Edit)
|
||||
int32 MyInt_EditInstanceOnly = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_EditConst | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(VisibleAnywhere, Category = Edit)
|
||||
int32 MyInt_VisibleAnywhere = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnInstance | CPF_EditConst | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(VisibleDefaultsOnly, Category = Edit)
|
||||
int32 MyInt_VisibleDefaultsOnly = 123;
|
||||
}
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
比较简单,把值设置到meta里的Category,之后读取出来使用。
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1,50 @@
|
||||
# EditAnywhere
|
||||
|
||||
- **功能描述:** 在默认值和实例的细节面板上均可编辑
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../../Flags/EPropertyFlags/CPF_Edit.md)
|
||||
- **常用程度:★★★★★**
|
||||
|
||||
在默认值和实例的细节面板上均可编辑。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
```cpp
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class INSIDER_API UMyProperty_Test :public UObject
|
||||
{
|
||||
public:
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditAnywhere, Category = Edit)
|
||||
int32 MyInt_EditAnywhere = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnInstance | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditDefaultsOnly, Category = Edit)
|
||||
int32 MyInt_EditDefaultsOnly = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnTemplate | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditInstanceOnly, Category = Edit)
|
||||
int32 MyInt_EditInstanceOnly = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_EditConst | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(VisibleAnywhere, Category = Edit)
|
||||
int32 MyInt_VisibleAnywhere = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnInstance | CPF_EditConst | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(VisibleDefaultsOnly, Category = Edit)
|
||||
int32 MyInt_VisibleDefaultsOnly = 123;
|
||||
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_DisableEditOnTemplate | CPF_EditConst | CPF_IsPlainOldData | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(VisibleInstanceOnly, Category = Edit)
|
||||
int32 MyInt_VisibleInstanceOnly = 123;
|
||||
}
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
CPF_Edit在源码里有非常多的使用,决定了很多地方属性是否可以显示和编辑。有兴趣可以自己去搜搜CPF_Edit的使用。
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,9 @@
|
||||
# EditDefaultsOnly
|
||||
|
||||
- **功能描述:** 只能在默认值面板里编辑
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../Flags/EPropertyFlags/CPF_Edit.md), [CPF_DisableEditOnInstance](../../../Flags/EPropertyFlags/CPF_DisableEditOnInstance.md)
|
||||
- **常用程度:** ★★★★★
|
||||
|
||||
一并参见EditAnywhere里的示例代码和效果。
|
@@ -0,0 +1,52 @@
|
||||
# EditFixedSize
|
||||
|
||||
- **功能描述:** 在细节面板上不允许改变该容器的元素个数。
|
||||
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **限制类型:** TArray<T>,TSet<T>,TMap<T>
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_EditFixedSize](../../../../Flags/EPropertyFlags/CPF_EditFixedSize.md)
|
||||
- **常用程度:** ★★★
|
||||
|
||||
在细节面板上不允许改变该容器的元素个数。
|
||||
|
||||
只适用于容器。这能防止用户通过虚幻编辑器属性窗口修改容器的元素个数。
|
||||
|
||||
但在C++代码和蓝图中依然是可以修改的。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
以TArray为例,其他同理。
|
||||
|
||||
```cpp
|
||||
UPROPERTY(EditAnywhere, Category = Array)
|
||||
TArray<int32> MyIntArray_Normal{1,2,3};
|
||||
|
||||
UPROPERTY(EditAnywhere, EditFixedSize,Category = Array)
|
||||
TArray<int32> MyIntArray_FixedSize{1,2,3};
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||
蓝图中的表现,前者可以动态再添加元素。后者不可。
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
如果有CPF_EditFixedSize,则不会添加+和清空的按钮。
|
||||
|
||||
```cpp
|
||||
void PropertyEditorHelpers::GetRequiredPropertyButtons( TSharedRef<FPropertyNode> PropertyNode, TArray<EPropertyButton::Type>& OutRequiredButtons, bool bUsingAssetPicker )
|
||||
{
|
||||
// Handle a container property.
|
||||
if( NodeProperty->IsA(FArrayProperty::StaticClass()) || NodeProperty->IsA(FSetProperty::StaticClass()) || NodeProperty->IsA(FMapProperty::StaticClass()) )
|
||||
{
|
||||
if( !(NodeProperty->PropertyFlags & CPF_EditFixedSize) )
|
||||
{
|
||||
OutRequiredButtons.Add( EPropertyButton::Add );
|
||||
OutRequiredButtons.Add( EPropertyButton::Empty );
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,10 @@
|
||||
# EditInstanceOnly
|
||||
|
||||
- **功能描述:** 只能在实例的细节面板上编辑该属性
|
||||
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../Flags/EPropertyFlags/CPF_Edit.md), [CPF_DisableEditOnTemplate](../../../Flags/EPropertyFlags/CPF_DisableEditOnTemplate.md)
|
||||
- **常用程度:** ★★★★★
|
||||
|
||||
一并参见EditAnywhere里的示例代码和效果。
|
@@ -0,0 +1,34 @@
|
||||
# Interp
|
||||
|
||||
- **功能描述:** 指定该属性值可暴露到时间轴里编辑,在平常的Timeline或UMG的动画里使用。
|
||||
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** Sequencer
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../../Flags/EPropertyFlags/CPF_Edit.md), [CPF_BlueprintVisible](../../../../Flags/EPropertyFlags/CPF_BlueprintVisible.md), [CPF_Interp](../../../../Flags/EPropertyFlags/CPF_Interp.md)
|
||||
- **常用程度:** ★★★
|
||||
|
||||
该属性可以暴露到时间轴里,一般用来编辑动画。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
```cpp
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class INSIDER_API AMyProperty_Interp :public AActor
|
||||
{
|
||||
public:
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Interp, Category = Animation)
|
||||
FVector MyInterpVector;
|
||||
};
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||
影响的是属性上的该标志
|
||||
|
||||

|
||||
|
||||
从而可以在Sequencer里对该属性添加Track
|
||||
|
||||

|
After Width: | Height: | Size: 82 KiB |
After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,40 @@
|
||||
# NoClear
|
||||
|
||||
- **功能描述:** 指定该属性的编辑选项中不出现Clear按钮,不允许置null。
|
||||
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **限制类型:** 引用类型
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_NoClear](../../../../Flags/EPropertyFlags/CPF_NoClear.md)
|
||||
- **常用程度:** ★★★
|
||||
|
||||
指定该属性的编辑选项中不出现Clear按钮。
|
||||
|
||||
作用是阻止用户在编辑器面板上将此Object引用设为null。但其实也可用在其他表示一个引用类型的结构上,比如FPrimaryAssetId,FInstancedStruct,FDataRegistryType等。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
```cpp
|
||||
UPROPERTY(EditAnywhere, Category = Object)
|
||||
class UMyClass_Default* MyObject_Normal;
|
||||
//PropertyFlags: CPF_Edit | CPF_ZeroConstructor | CPF_NoClear | CPF_NoDestructor | CPF_HasGetValueTypeHash | CPF_NativeAccessSpecifierPublic
|
||||
UPROPERTY(EditAnywhere, NoClear, Category = Object)
|
||||
class UMyClass_Default* MyObject_NoClear;
|
||||
|
||||
//构造函数赋值:
|
||||
MyObject_Normal = CreateDefaultSubobject<UMyClass_Default>("MyObject_Normal");
|
||||
MyObject_NoClear = CreateDefaultSubobject<UMyClass_Default>("MyObject_NoClear");
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
CPF_NoClear在引擎里有挺多使用。
|
||||
|
||||
```cpp
|
||||
const bool bAllowClear = !StructPropertyHandle->GetMetaDataProperty()->HasAnyPropertyFlags(CPF_NoClear);
|
||||
|
||||
```
|
After Width: | Height: | Size: 49 KiB |
@@ -0,0 +1,32 @@
|
||||
# NonTransactional
|
||||
|
||||
- **功能描述:** 对该属性的改变操作,不会被包含进编辑器的Undo/Redo命令中。
|
||||
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_NonTransactional](../../../../Flags/EPropertyFlags/CPF_NonTransactional.md)
|
||||
- **常用程度:** ★★
|
||||
|
||||
指定该属性的改变,不能在编辑器中通过Ctrl+Z来撤销或Ctrl+Y来重做。在Actor或在BP的Class Defautls都可以生效。
|
||||
|
||||
## 测试代码:
|
||||
|
||||
```jsx
|
||||
UCLASS(Blueprintable, BlueprintType)
|
||||
class INSIDER_API AMyProperty_Transaction :public AActor
|
||||
{
|
||||
public:
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite,NonTransactional,Category = Transaction)
|
||||
int32 MyInt_NonTransactional= 123;
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite,Category = Transaction)
|
||||
int32 MyInt_Transactional = 123;
|
||||
};
|
||||
```
|
||||
|
||||
## 蓝图表现:
|
||||
|
||||
在MyInt_Transactional 上可以撤销之前的输入,而MyInt_NonTransactional上的输入无法用Ctrl+Z撤销。
|
||||
|
||||

|
After Width: | Height: | Size: 41 KiB |
@@ -0,0 +1,45 @@
|
||||
# SimpleDisplay
|
||||
|
||||
- **功能描述:** 在细节面板中直接可见,不折叠到高级中。
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_SimpleDisplay](../../../../Flags/EPropertyFlags/CPF_SimpleDisplay.md)
|
||||
- **常用程度:** ★★★
|
||||
|
||||
在细节面板中直接可见,不折叠到高级中。
|
||||
|
||||
默认情况下本身就是不折叠,但可以用来覆盖掉类上的AdvancedClassDisplay的设置。具体可参见AdvancedClassDisplay的代码和效果。
|
||||
|
||||
## 示例代码:
|
||||
|
||||
```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;
|
||||
}
|
||||
```
|
||||
|
||||
## 示例效果:
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
如果有CPF_SimpleDisplay,则bAdvanced =false
|
||||
|
||||
```cpp
|
||||
void FPropertyNode::InitNode(const FPropertyNodeInitParams& InitParams)
|
||||
{
|
||||
// Property is advanced if it is marked advanced or the entire class is advanced and the property not marked as simple
|
||||
static const FName Name_AdvancedClassDisplay("AdvancedClassDisplay");
|
||||
bool bAdvanced = Property.IsValid() ? ( Property->HasAnyPropertyFlags(CPF_AdvancedDisplay) || ( !Property->HasAnyPropertyFlags( CPF_SimpleDisplay ) && Property->GetOwnerClass() && Property->GetOwnerClass()->GetBoolMetaData(Name_AdvancedClassDisplay) ) ) : false;
|
||||
|
||||
}
|
||||
```
|
After Width: | Height: | Size: 7.1 KiB |
@@ -0,0 +1,10 @@
|
||||
# VisibleAnywhere
|
||||
|
||||
- **功能描述:** 在默认值和实例细节面板均可见,但不可编辑
|
||||
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../Flags/EPropertyFlags/CPF_Edit.md), [CPF_EditConst](../../../Flags/EPropertyFlags/CPF_EditConst.md)
|
||||
- **常用程度:** ★★★★★
|
||||
|
||||
一并参见EditAnywhere里的示例代码和效果。
|
@@ -0,0 +1,9 @@
|
||||
# VisibleDefaultsOnly
|
||||
|
||||
- **功能描述:** 在默认值细节面板可见,但不可编辑
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../Flags/EPropertyFlags/CPF_Edit.md), [CPF_DisableEditOnInstance](../../../Flags/EPropertyFlags/CPF_DisableEditOnInstance.md)
|
||||
- **常用程度:** ★★★★★
|
||||
|
||||
一并参见EditAnywhere里的示例代码和效果。
|
@@ -0,0 +1,9 @@
|
||||
# VisibleInstanceOnly
|
||||
|
||||
- **功能描述:** 在实例细节面板可见,但不可编辑
|
||||
- **元数据类型:** bool
|
||||
- **引擎模块:** DetailsPanel, Editor
|
||||
- **作用机制:** 在PropertyFlags中加入[CPF_Edit](../../../Flags/EPropertyFlags/CPF_Edit.md), [CPF_DisableEditOnTemplate](../../../Flags/EPropertyFlags/CPF_DisableEditOnTemplate.md)
|
||||
- **常用程度:** ★★★★★
|
||||
|
||||
一并参见EditAnywhere里的示例代码和效果。
|