浏览代码

Merge pull request #210 from Unity-Technologies/shadergraph-creation-workflow

Moved the create shader graphs in under Create -> Shader -> PBR shade…
/main
GitHub 7 年前
当前提交
ea1b4595
共有 6 个文件被更改,包括 58 次插入24 次删除
  1. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderSubGraph.cs
  2. 23
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreatePBRShaderGraph.cs
  3. 23
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateUnlitShaderGraph.cs
  4. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateUnlitShaderGraph.cs.meta
  5. 23
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderGraph.cs
  6. 0
      /MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreatePBRShaderGraph.cs.meta

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderSubGraph.cs


{
public class CreateShaderSubGraph : EndNameEditAction
{
[MenuItem("Assets/Create/Shader Sub Graph", false, 208)]
[MenuItem("Assets/Create/Shader/Sub Graph", false, 208)]
public static void CreateMaterialSubGraph()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateShaderSubGraph>(),

23
MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreatePBRShaderGraph.cs


using System.IO;
using UnityEditor.ProjectWindowCallback;
namespace UnityEditor.ShaderGraph
{
public class CreatePBRShaderGraph : EndNameEditAction
{
[MenuItem("Assets/Create/Shader/PBR Graph", false, 208)]
public static void CreateMaterialGraph()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreatePBRShaderGraph>(),
"New Shader Graph.ShaderGraph", null, null);
}
public override void Action(int instanceId, string pathName, string resourceFile)
{
var graph = new MaterialGraph();
graph.AddNode(new PBRMasterNode());
File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph));
AssetDatabase.Refresh();
}
}
}

23
MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateUnlitShaderGraph.cs


using System.IO;
using UnityEditor.ProjectWindowCallback;
namespace UnityEditor.ShaderGraph
{
public class CreateUnlitShaderGraph : EndNameEditAction
{
[MenuItem("Assets/Create/Shader/Unlit Graph", false, 208)]
public static void CreateMaterialGraph()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateUnlitShaderGraph>(),
"New Shader Graph.ShaderGraph", null, null);
}
public override void Action(int instanceId, string pathName, string resourceFile)
{
var graph = new MaterialGraph();
graph.AddNode(new UnlitMasterNode());
File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph));
AssetDatabase.Refresh();
}
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateUnlitShaderGraph.cs.meta


fileFormatVersion: 2
guid: 5f2488f286c4e264ba7984f8889461cc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

23
MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderGraph.cs


using System.IO;
using UnityEditor.ProjectWindowCallback;
namespace UnityEditor.ShaderGraph
{
public class CreateShaderGraph : EndNameEditAction
{
[MenuItem("Assets/Create/Shader Graph", false, 208)]
public static void CreateMaterialGraph()
{
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateShaderGraph>(),
"New Shader Graph.ShaderGraph", null, null);
}
public override void Action(int instanceId, string pathName, string resourceFile)
{
var graph = new MaterialGraph();
graph.AddNode(new PBRMasterNode());
File.WriteAllText(pathName, EditorJsonUtility.ToJson(graph));
AssetDatabase.Refresh();
}
}
}

/MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreateShaderGraph.cs.meta → /MaterialGraphProject/Assets/UnityShaderEditor/Editor/AssetCallbacks/CreatePBRShaderGraph.cs.meta

正在加载...
取消
保存