using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.Rendering;
// Include material common properties names
using static UnityEngine.Rendering.HighDefinition.HDMaterialProperties;
namespace UnityEditor.Rendering.HighDefinition
{
///
/// The UI block that represents common properties for unlit Shader Graphs.
///
public class UnlitShaderGraphGUI : HDShaderGUI
{
const SurfaceOptionUIBlock.Features surfaceOptionFeatures = SurfaceOptionUIBlock.Features.Unlit;
MaterialUIBlockList m_UIBlocks = new MaterialUIBlockList
{
new SurfaceOptionUIBlock(MaterialUIBlock.ExpandableBit.Base, features: surfaceOptionFeatures),
new TessellationOptionsUIBlock(MaterialUIBlock.ExpandableBit.Tessellation),
new ShaderGraphUIBlock(MaterialUIBlock.ExpandableBit.ShaderGraph, ShaderGraphUIBlock.Features.Unlit),
new AdvancedOptionsUIBlock(MaterialUIBlock.ExpandableBit.Advance, ~AdvancedOptionsUIBlock.Features.SpecularOcclusion)
};
/// List of UI Blocks used to render the material inspector.
protected MaterialUIBlockList uiBlocks => m_UIBlocks;
///
/// Implement your custom GUI in this function. To display a UI similar to HDRP shaders, use a MaterialUIBlockList.
///
/// The current material editor.
/// The list of properties the material has.
protected override void OnMaterialGUI(MaterialEditor materialEditor, MaterialProperty[] props)
{
m_UIBlocks.OnGUI(materialEditor, props);
}
///
/// Sets up the keywords and passes for the current selected material.
///
/// The selected material.
public override void ValidateMaterial(Material material) => ShaderGraphAPI.ValidateUnlitMaterial(material);
}
}