using System; using System.Text; using UnityEngine; namespace UnityEditor.ShaderGraph { [Serializable] public class FloatShaderProperty : AbstractShaderProperty { public FloatShaderProperty() { displayName = "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() { name = referenceName, propType = PropertyType.Float, floatValue = value }; } } }