您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
52 行
1.4 KiB
52 行
1.4 KiB
using System;
|
|
using System.Text;
|
|
using UnityEditor.Graphing;
|
|
using UnityEditor.ShaderGraph.Drawing.Controls;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[Serializable]
|
|
class BooleanShaderProperty : AbstractShaderProperty<bool>
|
|
{
|
|
public BooleanShaderProperty()
|
|
{
|
|
displayName = "Boolean";
|
|
}
|
|
|
|
public override PropertyType propertyType => PropertyType.Boolean;
|
|
|
|
public override bool isBatchable => true;
|
|
public override bool isExposable => true;
|
|
public override bool isRenamable => true;
|
|
|
|
public override string GetPropertyBlockString()
|
|
{
|
|
return $"{hideTagString}[ToggleUI]{referenceName}(\"{displayName}\", Float) = {(value == true ? 1 : 0)}";
|
|
}
|
|
|
|
public override AbstractMaterialNode ToConcreteNode()
|
|
{
|
|
return new BooleanNode { value = new ToggleData(value) };
|
|
}
|
|
|
|
public override PreviewProperty GetPreviewMaterialProperty()
|
|
{
|
|
return new PreviewProperty(propertyType)
|
|
{
|
|
name = referenceName,
|
|
booleanValue = value
|
|
};
|
|
}
|
|
|
|
public override ShaderInput Copy()
|
|
{
|
|
return new BooleanShaderProperty()
|
|
{
|
|
displayName = displayName,
|
|
hidden = hidden,
|
|
value = value
|
|
};
|
|
}
|
|
}
|
|
}
|