您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

60 行
1.9 KiB

using System;
using System.Text;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Serializable]
public class FloatShaderProperty : AbstractShaderProperty<float>
{
public override PropertyType propertyType
{
get { return PropertyType.Float; }
}
public override Vector4 defaultValue
{
get { return new Vector4(value, value, value, value);}
}
public override string GetPropertyBlockString()
{
var result = new StringBuilder();
// if (m_FloatType == FloatPropertyChunk.FloatType.Toggle)
// result.Append("[Toggle]");
// else if (m_FloatType == FloatPropertyChunk.FloatType.PowerSlider)
// result.Append("[PowerSlider(" + m_rangeValues.z + ")]");
result.Append(referenceName);
result.Append("(\"");
result.Append(displayName);
//if (m_FloatType == FloatPropertyChunk.FloatType.Float || m_FloatType == FloatPropertyChunk.FloatType.Toggle)
//{
result.Append("\", Float) = ");
/* }
else if (m_FloatType == FloatPropertyChunk.FloatType.Range || m_FloatType == FloatPropertyChunk.FloatType.PowerSlider)
{
result.Append("\", Range(");
result.Append(m_rangeValues.x + ", " + m_rangeValues.y);
result.Append(")) = ");
}*/
result.Append(value);
return result.ToString();
}
public override string GetPropertyDeclarationString()
{
return "float " + referenceName + ";";
}
public override PreviewProperty GetPreviewMaterialProperty()
{
return new PreviewProperty()
{
m_Name = referenceName,
m_PropType = PropertyType.Float,
m_Float = value
};
}
}
}