浏览代码

[Shader Graph] Rearrange project structure.

/main
Tim Cooper 9 年前
当前提交
3a90f6f2
共有 14 个文件被更改,包括 50 次插入14 次删除
  1. 7
      UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraphGUI.cs
  2. 25
      UnityProject/Assets/UnityShaderEditor/Editor/Source/Util/ShaderGenerator.cs
  3. 9
      UnityProject/Assets/UnityShaderEditor.meta
  4. 9
      UnityProject/Assets/UnityShaderEditor/Editor/Source.meta
  5. 9
      UnityProject/Assets/UnityShaderEditor/Editor/Templates.meta
  6. 5
      UnityProject/Assets/MaterialGraph.meta
  7. 0
      /UnityProject/Assets/UnityShaderEditor/Editor/Templates
  8. 0
      /UnityProject/Assets/UnityShaderEditor/Editor.meta
  9. 0
      /UnityProject/Assets/UnityShaderEditor/Graphs.meta
  10. 0
      /UnityProject/Assets/UnityShaderEditor/Graphs
  11. 0
      /UnityProject/Assets/UnityShaderEditor/Editor/Source

7
UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraphGUI.cs


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);
ShaderGenerator.GenerateSurfaceShader (graph);
}
GUILayout.EndArea ();
}

25
UnityProject/Assets/UnityShaderEditor/Editor/Source/Util/ShaderGenerator.cs


return sb.ToString();
}
private static string GetTemplatePath(string templateName)
{
var path = new List<string>
{
Application.dataPath,
"UnityShaderEditor",
"Editor",
"Templates"
};
string result = path[0];
for (int i = 1; i < path.Count; i++)
result = Path.Combine(result, path[i]);
result = Path.Combine(result, templateName);
return result;
}
public static string GeneratePreviewShader(BaseMaterialNode node, out PreviewMode generatedShaderMode)
{
// figure out what kind of preview we want!

generatedShaderMode = PreviewMode.Preview3D;
}
string templateLocation = Path.Combine (Application.dataPath, Path.Combine ("MaterialGraph", generationMode == GenerationMode.Preview2D ? "2DPreview.template" : "3DPreview.template"));
string templateLocation = GetTemplatePath(generationMode == GenerationMode.Preview2D ? "2DPreview.template" : "3DPreview.template");
if (!File.Exists (templateLocation))
return null;

public static void GenerateSurfaceShader(MaterialGraph graph)
{
string templateLocation = Path.Combine(Application.dataPath, Path.Combine("MaterialGraph", "shader.template"));
if (!File.Exists(templateLocation))
var templateLocation = GetTemplatePath("shader.template");
if (!File.Exists(templateLocation))
return;
var templateText = File.ReadAllText(templateLocation);

9
UnityProject/Assets/UnityShaderEditor.meta


fileFormatVersion: 2
guid: b100142c357c2d745b9707d6e2f987fd
folderAsset: yes
timeCreated: 1444200922
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
UnityProject/Assets/UnityShaderEditor/Editor/Source.meta


fileFormatVersion: 2
guid: 8d2fc2addcfb5f841815ae19a0e7455a
folderAsset: yes
timeCreated: 1444201033
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

9
UnityProject/Assets/UnityShaderEditor/Editor/Templates.meta


fileFormatVersion: 2
guid: 52f964a4069524b47bd98441cad69cd3
folderAsset: yes
timeCreated: 1444201081
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

5
UnityProject/Assets/MaterialGraph.meta


fileFormatVersion: 2
guid: b3a6e625f54bd884a818ed4c3a17f60d
folderAsset: yes
DefaultImporter:
userData:

/UnityProject/Assets/MaterialGraph → /UnityProject/Assets/UnityShaderEditor/Editor/Templates

/UnityProject/Assets/Editor.meta → /UnityProject/Assets/UnityShaderEditor/Editor.meta

/UnityProject/Assets/Graphs.meta → /UnityProject/Assets/UnityShaderEditor/Graphs.meta

/UnityProject/Assets/Graphs → /UnityProject/Assets/UnityShaderEditor/Graphs

/UnityProject/Assets/Editor/Material → /UnityProject/Assets/UnityShaderEditor/Editor/Source

正在加载...
取消
保存