vault backup: 2024-10-12 17:19:45
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
# Visible
|
||||
|
||||
- **功能描述:** 指定FRigUnit下的该属性为常量引脚,无法连接变量。
|
||||
- **使用位置:** UPROPERTY
|
||||
- **引擎模块:** RigVMStruct
|
||||
- **元数据类型:** bool
|
||||
- **限制类型:** FRigUnit中属性
|
||||
- **关联项:** [Input](../Input/Input.md)
|
||||
- **常用程度:** ★★★
|
||||
|
||||
指定FRigUnit下的该属性为常量引脚,无法连接变量。
|
||||
|
||||
Visible和Input+Constant的效果是一致的。
|
||||
|
||||
## 测试代码:
|
||||
|
||||
```cpp
|
||||
USTRUCT(meta = (DisplayName = "MyRig"))
|
||||
struct INSIDER_API FRigUnit_MyRig : public FRigUnit
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
RIGVM_METHOD()
|
||||
virtual void Execute() override;
|
||||
|
||||
public:
|
||||
UPROPERTY()
|
||||
float MyFloat_Normal;
|
||||
|
||||
UPROPERTY(meta = (Input))
|
||||
float MyFloat_Input;
|
||||
|
||||
UPROPERTY(meta = (Output))
|
||||
float MyFloat_Output;
|
||||
|
||||
UPROPERTY(meta = (Input, Output))
|
||||
float MyFloat_IO;
|
||||
|
||||
UPROPERTY(meta = (Hidden))
|
||||
float MyFloat_Hidden;
|
||||
|
||||
UPROPERTY(meta = (Visible))
|
||||
float MyFloat_Visible;
|
||||
|
||||
UPROPERTY(meta = (Input, Constant))
|
||||
float MyFloat_Constant;
|
||||
};
|
||||
```
|
||||
|
||||
## 测试效果:
|
||||
|
||||
Visible和Input+Constant的效果是一致的,也是成为一个常量。
|
||||
|
||||

|
||||
|
||||
## 原理:
|
||||
|
||||
```cpp
|
||||
UENUM(BlueprintType)
|
||||
enum class ERigVMPinDirection : uint8
|
||||
{
|
||||
Input, // A const input value
|
||||
Output, // A mutable output value
|
||||
IO, // A mutable input and output value
|
||||
Visible, // A const value that cannot be connected to
|
||||
Hidden, // A mutable hidden value (used for interal state)
|
||||
Invalid // The max value for this enum - used for guarding.
|
||||
};
|
||||
|
||||
FRigVMPinInfo::FRigVMPinInfo(FProperty* InProperty, ERigVMPinDirection InDirection, int32 InParentIndex, const uint8* InDefaultValueMemory)
|
||||
{
|
||||
bIsConstant = InProperty->HasMetaData(TEXT("Constant"));
|
||||
}
|
||||
|
||||
void URigVMController::ConfigurePinFromProperty(FProperty* InProperty, URigVMPin* InOutPin, ERigVMPinDirection InPinDirection) const
|
||||
{
|
||||
InOutPin->bIsConstant = InProperty->HasMetaData(TEXT("Constant"));
|
||||
}
|
||||
|
||||
bool URigVMPin::CanBeBoundToVariable(const FRigVMExternalVariable& InExternalVariable, const FString& InSegmentPath) const
|
||||
{
|
||||
if (bIsConstant)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user