浏览代码

Merge pull request #1423 from Unity-Technologies/sg/fix-for-subgraphs-inside-main-graph

Fixes for Subgraph
/main
GitHub 7 年前
当前提交
8f9bff6a
共有 3 个文件被更改,包括 16 次插入10 次删除
  1. 2
      com.unity.shadergraph/CHANGELOG.md
  2. 22
      com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs
  3. 2
      com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs

2
com.unity.shadergraph/CHANGELOG.md


- When you edit sub graph paths, the search window no longer yields a null reference exception.
- The blackboard is now within view when deserialized.
- Your system locale can no longer cause incorrect commands due to full stops being converted to commas.
- Deserialization of subgraphs now works correctly.
- Sub graphs are now suffixed with (sub), so you can tell them apart from other nodes.

22
com.unity.shadergraph/Editor/Data/Nodes/Utility/SubGraphNode.cs


[SerializeField]
private string m_SerializedSubGraph = string.Empty;
[NonSerialized]
MaterialSubGraphAsset m_SubGraph;
[Serializable]
private class SubGraphHelper
{

}
}
#if UNITY_EDITOR
[ObjectControl("")]
public MaterialSubGraphAsset subGraphAsset
{
get

var helper = new SubGraphHelper();
EditorJsonUtility.FromJsonOverwrite(m_SerializedSubGraph, helper);
return helper.subGraph;
if (m_SubGraph == null)
{
var helper = new SubGraphHelper();
EditorJsonUtility.FromJsonOverwrite(m_SerializedSubGraph, helper);
m_SubGraph = helper.subGraph;
}
return m_SubGraph;
}
set
{

var helper = new SubGraphHelper();
helper.subGraph = value;
m_SerializedSubGraph = EditorJsonUtility.ToJson(helper, true);
m_SubGraph = null;
#else
public MaterialSubGraphAsset subGraphAsset {get; set; }
#endif
public INode outputNode
{

var validNames = new List<int>();
if (referencedGraph == null)
{
RemoveSlotsNameNotMatching(validNames);
RemoveSlotsNameNotMatching(validNames, true);
return;
}

2
com.unity.shadergraph/Editor/Drawing/Views/MaterialNodeView.cs


{
var subGraphNode = node as SubGraphNode;
if (subGraphNode != null && subGraphNode.subGraphAsset != null)
title = subGraphNode.subGraphAsset.name;
title = subGraphNode.subGraphAsset.name + " (sub)";
else
title = node.name;
}

正在加载...
取消
保存