浏览代码

[shader graph]Simplify creation of pixel master node.

/main
Tim Cooper 9 年前
当前提交
2b12d0bf
共有 4 个文件被更改,包括 1 次插入32 次删除
  1. 2
      UnityProject/Assets/UnityShaderEditor/Editor/Source/BaseMaterialGraph.cs
  2. 3
      UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraph.cs
  3. 1
      UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialSubGraph.cs
  4. 27
      UnityProject/Assets/UnityShaderEditor/Editor/Source/PixelGraph.cs

2
UnityProject/Assets/UnityShaderEditor/Editor/Source/BaseMaterialGraph.cs


public abstract class BaseMaterialGraph : Graph
{
public abstract BaseMaterialNode masterNode { get; }
private PreviewRenderUtility m_PreviewUtility;
public PreviewRenderUtility previewUtility

3
UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraph.cs


m_Shader.hideFlags = HideFlags.HideInHierarchy;
}
AssetDatabase.AddObjectToAsset(m_Shader, this);
m_PixelGraph.AddMasterNodeToAsset();
public UnityEngine.Material GetMaterial()
public Material GetMaterial()
{
if (m_PixelGraph == null)
return null;

1
UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialSubGraph.cs


public SubGraphOutputsNode outputsNode { get { return m_OutputsNode; } }
public override BaseMaterialNode masterNode { get { return outputsNode; } }
protected override void RecacheActiveNodes()
{
}

27
UnityProject/Assets/UnityShaderEditor/Editor/Source/PixelGraph.cs


public PreviewState previewState { get; set; }
public override BaseMaterialNode masterNode
{
get { return pixelMasterNode; }
}
public override void OnEnable()
{
base.OnEnable();
if (m_PixelMasterNode == null)
m_PixelMasterNode = nodes.FirstOrDefault(x => x.GetType() == typeof (PixelShaderNode)) as PixelShaderNode;
if (m_PixelMasterNode == null)
{
m_PixelMasterNode = CreateInstance<PixelShaderNode>();
m_PixelMasterNode.hideFlags = HideFlags.HideInHierarchy;
m_PixelMasterNode.Init();
m_PixelMasterNode.position = new Rect(700, m_PixelMasterNode.position.y, m_PixelMasterNode.position.width, m_PixelMasterNode.position.height);
AddMasterNodeNoAddToAsset(m_PixelMasterNode);
}
}
public PixelShaderNode pixelMasterNode
{
get

}
pixelMasterNode.GenerateNodeCode(shaderBody, genMode);
}
public void AddMasterNodeToAsset()
{
AssetDatabase.AddObjectToAsset(pixelMasterNode, this);
}
protected override void RecacheActiveNodes()

正在加载...
取消
保存