using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Rendering.HighDefinition; namespace UnityEditor.Rendering.HighDefinition { /// /// The UI block that represents surface inputs for unlit materials. /// public class UnlitSurfaceInputsUIBlock : MaterialUIBlock { internal class Styles { public const string header = "Surface Inputs"; public static GUIContent colorText = new GUIContent("Color", " Albedo (RGB) and Transparency (A)."); } ExpandableBit m_ExpandableBit; MaterialProperty color = null; const string kColor = "_UnlitColor"; MaterialProperty colorMap = null; const string kColorMap = "_UnlitColorMap"; /// /// Constructs an UnlitSurfaceInputsUIBlock based on the parameters. /// /// Bit index used to store the foldout state. public UnlitSurfaceInputsUIBlock(ExpandableBit expandableBit) { m_ExpandableBit = expandableBit; } /// /// Loads the material properties for the block. /// public override void LoadMaterialProperties() { color = FindProperty(kColor); colorMap = FindProperty(kColorMap); } /// /// Renders the properties in the block. /// public override void OnGUI() { using (var header = new MaterialHeaderScope(Styles.header, (uint)m_ExpandableBit, materialEditor)) { if (header.expanded) DrawSurfaceInputsGUI(); } } void DrawSurfaceInputsGUI() { materialEditor.TexturePropertySingleLine(Styles.colorText, colorMap, color); materialEditor.TextureScaleOffsetProperty(colorMap); } } }