|
|
|
|
|
|
[SerializeField] |
|
|
|
private string m_SerializedSubGraph = string.Empty; |
|
|
|
|
|
|
|
[NonSerialized] |
|
|
|
MaterialSubGraphAsset m_SubGraph; |
|
|
|
|
|
|
|
[Serializable] |
|
|
|
private class SubGraphHelper |
|
|
|
{ |
|
|
|
|
|
|
if (string.IsNullOrEmpty(m_SerializedSubGraph)) |
|
|
|
return null; |
|
|
|
|
|
|
|
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; |
|
|
|
UpdateSlots(); |
|
|
|
|
|
|
|
Dirty(ModificationScope.Topological); |
|
|
|
|
|
|
var validNames = new List<int>(); |
|
|
|
if (referencedGraph == null) |
|
|
|
{ |
|
|
|
RemoveSlotsNameNotMatching(validNames); |
|
|
|
RemoveSlotsNameNotMatching(validNames, true); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|