public override void OnInspectorGUI() {
GUI.enabled = true;
Shader shader = base.target as Shader;
if(!SF_Tools.CanRunShaderForge()){
SF_Tools.UnityOutOfDateGUI();
return;
}
//EditorGUILayout.InspectorTitlebar( false, base.target );
if( hasShaderForgeData ) {
if( GUILayout.Button( "Open in Shader Forge" ) ) {
if(Event.current.rawType != EventType.mouseDown)
SF_Editor.Init( shader );
}
} else {
GUILayout.BeginHorizontal();
{
//GUILayout.Label(SF_Styles.IconWarningSmall,GUILayout.Width(18),GUILayout.Height(18));
GUI.color = Color.gray;
GUILayout.Label( "No Shader Forge data found!", EditorStyles.miniLabel );
GUI.color = Color.white;
}
GUILayout.EndHorizontal();
//GUILayout.Label( "Opening this will clear the shader", EditorStyles.miniLabel );
//GUI.color = new Color( 1f, 0.8f, 0.8f );
if( GUILayout.Button( new GUIContent( "Replace with Shader Forge shader", SF_Styles.IconWarningSmall, "This will erase any existing shader code" ), hasShaderForgeData ? "Button" : "MiniButton" ) ) {
if( SF_GUI.AcceptedNewShaderReplaceDialog() ) {
SF_Editor.Init( shader );
SF_Editor.instance.ps.fChecker.UpdateAvailability();
SF_Editor.instance.OnShaderModified( NodeUpdateType.Hard );
}
}
//GUI.color = Color.white;
}
if( SF_Tools.advancedInspector ) {
GUILayout.BeginHorizontal();
{
GUIStyle btnStyle = hasShaderForgeData ? "MiniButton" : "Button";
if( GUILayout.Button( "Open shader code", btnStyle ) ) {
UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal( AssetDatabase.GetAssetPath( shader ), 1 );
}
//if( GUILayout.Button( "Open compiled", btnStyle ) ) {
// OpenCompiledShader( shader );
//}
}
GUILayout.EndHorizontal();
}
DrawUnitysInspector();
}