ProjectDDD/Assets/Plugins/Animate UI Materials/Editor/GraphicPropertyOverrideRangeEditor.cs

34 lines
1017 B
C#

using UnityEditor;
using UnityEngine;
namespace Plugins.Animate_UI_Materials.Editor
{
using PropertyType = ShaderUtil.ShaderPropertyType;
/// <summary>
/// A special editor for Range properties
/// Retrieves the range min and max from the shader, and draws the slider field
/// In case of failure to retrieve, it will simply display a float property
/// </summary>
[CustomEditor(typeof(GraphicPropertyOverrideRange), true)]
public class GraphicPropertyOverrideRangeEditor : GraphicPropertyOverrideEditor
{
protected override void DrawValueProperty(SerializedProperty property)
{
// If in multi-edit mode, just display a float field
if (targets.Length > 1)
{
base.DrawValueProperty(property);
return;
}
Material material = GetTargetMaterial();
int propertyIndex = GetPropertyIndex();
GraphicMaterialOverrideEditor.DrawFloatPropertyAsRange(material,
propertyIndex,
property,
new GUIContent(""));
}
}
}