浏览代码

For final shader generation use the master node.

/main
Tim Cooper 7 年前
当前提交
1d641fec
共有 6 个文件被更改,包括 7 次插入9 次删除
  1. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialGraph.cs
  2. 4
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/LightweightPipeline/PBRMasterNode.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/IMasterNode.cs
  4. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/MasterNode.cs
  5. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
  6. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialGraph.cs


public string GetShader(string name, GenerationMode mode, out List<PropertyCollector.TextureInfo> configuredTextures)
{
PreviewMode pmode;
FloatShaderProperty outputIdProperty;
return base.GetShader(masterNode as AbstractMaterialNode, mode, name, out configuredTextures, out pmode, out outputIdProperty);
return masterNode.GetShader(mode, name, out configuredTextures);
}
public void LoadedFromDisk()

4
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/LightweightPipeline/PBRMasterNode.cs


});
}
public override string GetShader(GenerationMode mode, out List<PropertyCollector.TextureInfo> configuredTextures)
public override string GetShader(GenerationMode mode, string outputName, out List<PropertyCollector.TextureInfo> configuredTextures)
{
var activeNodeList = ListPool<INode>.Get();
NodeUtils.DepthFirstCollectNodesFromNode(activeNodeList, this);

activeNode.CollectShaderProperties(shaderProperties, mode);
var finalShader = new ShaderGenerator();
finalShader.AddShaderChunk(string.Format(@"Shader ""{0}""", name), false);
finalShader.AddShaderChunk(string.Format(@"Shader ""{0}""", outputName), false);
finalShader.AddShaderChunk("{", false);
finalShader.Indent();

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/IMasterNode.cs


public interface IMasterNode
{
SurfaceMaterialOptions options { get; }
string GetShader(GenerationMode mode, out List<PropertyCollector.TextureInfo> configuredTextures);
string GetShader(GenerationMode mode, string name, out List<PropertyCollector.TextureInfo> configuredTextures);
}
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/MasterNode.cs


}
public abstract string GetShader(GenerationMode mode, out List<PropertyCollector.TextureInfo> configuredTextures);
public abstract string GetShader(GenerationMode mode, string name, out List<PropertyCollector.TextureInfo> configuredTextures);
}
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs


if (node is IMasterNode)
{
List<PropertyCollector.TextureInfo> configuredTextures;
shaderData.shaderString = ((IMasterNode)node).GetShader(GenerationMode.Preview, out configuredTextures);
shaderData.shaderString = ((IMasterNode)node).GetShader(GenerationMode.Preview, node.name, out configuredTextures);
}
else
shaderData.shaderString = m_Graph.GetPreviewShader(node, out mode);

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


FloatShaderProperty outputIdProperty;
if (copyFromNode is MasterNode)
{
var shader = ((MasterNode)copyFromNode).GetShader(GenerationMode.ForReals, out textureInfo);
var shader = ((MasterNode)copyFromNode).GetShader(GenerationMode.ForReals, copyFromNode.name, out textureInfo);
GUIUtility.systemCopyBuffer = shader;
}
else

正在加载...
取消
保存