You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
using System.IO; |
|
using UnityEditor.ProjectWindowCallback; |
|
using UnityEngine.Rendering; |
|
|
|
namespace UnityEditor.ShaderGraph |
|
{ |
|
class CreateShaderSubGraph : EndNameEditAction |
|
{ |
|
[MenuItem("Assets/Create/Shader Graph/Sub Graph", priority = CoreUtils.Sections.section1 + CoreUtils.Priorities.assetsCreateShaderMenuPriority + 1)] |
|
public static void CreateMaterialSubGraph() |
|
{ |
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, CreateInstance<CreateShaderSubGraph>(), |
|
string.Format("New Shader Sub Graph.{0}", ShaderSubGraphImporter.Extension), null, null); |
|
} |
|
|
|
public override void Action(int instanceId, string pathName, string resourceFile) |
|
{ |
|
var graph = new GraphData { isSubGraph = true }; |
|
var outputNode = new SubGraphOutputNode(); |
|
graph.AddNode(outputNode); |
|
graph.outputNode = outputNode; |
|
outputNode.AddSlot(ConcreteSlotValueType.Vector4); |
|
graph.path = "Sub Graphs"; |
|
FileUtilities.WriteShaderGraphToDisk(pathName, graph); |
|
AssetDatabase.Refresh(); |
|
} |
|
} |
|
}
|
|
|