// "show fixed function shader" button
private static void ShowFixedFunctionShaderButton(Shader s)
{
var hasFF = ShaderUtil.HasFixedFunctionShaders(s);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PrefixLabel("Fixed function", EditorStyles.miniButton);
if (hasFF)
{
// check if this is a built-in shader (has no importer);
// we can't show generated code in that case
var builtinShader = (AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(s)) == null);
if (!builtinShader)
{
if (GUILayout.Button(Styles.showFF, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
{
ShaderUtil.OpenGeneratedFixedFunctionShader(s);
GUIUtility.ExitGUI();
}
}
else
{
// See comment below why this is a button.
GUILayout.Button(Styles.builtinShader, GUI.skin.label);
}
}
else
{
// Note: PrefixLabel is sometimes buggy if followed by a non-control (like Label).
// We just want to show a label here, but have to pretend it's a button so it is treated like
// a control.
GUILayout.Button(Styles.no, GUI.skin.label);
}
EditorGUILayout.EndHorizontal();
}