您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

64 行
1.7 KiB

using System.IO;
using UnityEngine;
using System.Linq;
namespace UnityEditor.Graphs.Material
{
class MaterialGraphGUI : BaseMaterialGraphGUI
{
enum SelectedOptions
{
properties,
options
}
private PixelGraph GetGraph() {return graph as PixelGraph;}
public MaterialGraph materialGraph;
private SelectedOptions m_SelectedGUI = SelectedOptions.properties;
private static void DrawSpacer()
{
var spacerLine = GUILayoutUtility.GetRect(GUIContent.none,
GUIStyle.none,
GUILayout.ExpandWidth(true),
GUILayout.Height(1));
var oldBgColor = GUI.backgroundColor;
if (EditorGUIUtility.isProSkin)
GUI.backgroundColor = oldBgColor * 0.7058f;
else
GUI.backgroundColor = Color.black;
//if (Event.current.type == EventType.Repaint)
// EditorGUIUtility.whiteTextureStyle.Draw(spacerLine, GUIContent.none, false, false, false, false);
GUI.backgroundColor = oldBgColor;
}
public void RenderOptions (Rect rect, MaterialGraph graph)
{
GUILayout.BeginArea (rect);
m_SelectedGUI = (SelectedOptions)EditorGUILayout.EnumPopup ("Options?", m_SelectedGUI);
DrawSpacer ();
if (m_SelectedGUI == SelectedOptions.properties)
graph.materialProperties.DoGUI(GetGraph().nodes);
else if (m_SelectedGUI == SelectedOptions.options)
graph.materialOptions.DoGUI ();
GUILayout.FlexibleSpace ();
if (GUILayout.Button ("Output Shader :)"))
{
var templateLocation = Path.Combine( Application.dataPath,
Path.Combine ("MaterialGraph",
"Shader.template"));
if (File.Exists(templateLocation))
ShaderGenerator.GenerateSurfaceShader (graph);
}
GUILayout.EndArea ();
}
}
}