|
|
|
|
|
|
[NonSerialized] |
|
|
|
HashSet<IShaderProperty> m_Properties = new HashSet<IShaderProperty>(); |
|
|
|
|
|
|
|
// The meta properties are properties that are not copied into the tatget graph
|
|
|
|
// but sent along to allow property nodes to still hvae the data from the original
|
|
|
|
// property present.
|
|
|
|
[NonSerialized] |
|
|
|
HashSet<IShaderProperty> m_MetaProperties = new HashSet<IShaderProperty>(); |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
List<SerializationHelper.JSONSerializedElement> m_SerializableNodes = new List<SerializationHelper.JSONSerializedElement>(); |
|
|
|
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
List<SerializationHelper.JSONSerializedElement> m_SerilaizeableProperties = new List<SerializationHelper.JSONSerializedElement>(); |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
List<SerializationHelper.JSONSerializedElement> m_SerializableMetaProperties = new List<SerializationHelper.JSONSerializedElement>(); |
|
|
|
public CopyPasteGraph(IEnumerable<INode> nodes, IEnumerable<IEdge> edges, IEnumerable<IShaderProperty> properties) |
|
|
|
public CopyPasteGraph(IEnumerable<INode> nodes, IEnumerable<IEdge> edges, IEnumerable<IShaderProperty> properties, IEnumerable<IShaderProperty> metaProperties) |
|
|
|
{ |
|
|
|
foreach (var node in nodes) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
foreach (var property in properties) |
|
|
|
AddProperty(property); |
|
|
|
|
|
|
|
foreach (var metaProperty in metaProperties) |
|
|
|
AddMetaProperty(metaProperty); |
|
|
|
} |
|
|
|
|
|
|
|
public void AddNode(INode node) |
|
|
|
|
|
|
m_Properties.Add(property); |
|
|
|
} |
|
|
|
|
|
|
|
public void AddMetaProperty(IShaderProperty metaProperty) |
|
|
|
{ |
|
|
|
m_MetaProperties.Add(metaProperty); |
|
|
|
} |
|
|
|
|
|
|
|
public IEnumerable<T> GetNodes<T>() where T : INode |
|
|
|
{ |
|
|
|
return m_Nodes.OfType<T>(); |
|
|
|
|
|
|
get { return m_Properties; } |
|
|
|
} |
|
|
|
|
|
|
|
public IEnumerable<IShaderProperty> metaProperties |
|
|
|
{ |
|
|
|
get { return m_MetaProperties; } |
|
|
|
} |
|
|
|
|
|
|
|
m_SerializableMetaProperties = SerializationHelper.Serialize<IShaderProperty>(m_MetaProperties); |
|
|
|
} |
|
|
|
|
|
|
|
public void OnAfterDeserialize() |
|
|
|
|
|
|
foreach (var property in properties) |
|
|
|
m_Properties.Add(property); |
|
|
|
m_SerilaizeableProperties = null; |
|
|
|
|
|
|
|
var metaProperties = SerializationHelper.Deserialize<IShaderProperty>(m_SerializableMetaProperties, GraphUtil.GetLegacyTypeRemapping()); |
|
|
|
m_MetaProperties.Clear(); |
|
|
|
foreach (var metaProperty in metaProperties) |
|
|
|
{ |
|
|
|
m_MetaProperties.Add(metaProperty); |
|
|
|
} |
|
|
|
m_SerializableMetaProperties = null; |
|
|
|
} |
|
|
|
|
|
|
|
internal static CopyPasteGraph FromJson(string copyBuffer) |
|
|
|