浏览代码

Make properties into concrete nodes when copied if the propery value is not in the blackboard in the target graph

/main
Jens Holm 7 年前
当前提交
af05fcf1
共有 1 个文件被更改,包括 29 次插入1 次删除
  1. 30
      com.unity.shadergraph/Editor/Data/Graphs/AbstractMaterialGraph.cs

30
com.unity.shadergraph/Editor/Data/Graphs/AbstractMaterialGraph.cs


internal void PasteGraph(CopyPasteGraph graphToPaste, List<INode> remappedNodes, List<IEdge> remappedEdges)
{
var nodeGuidMap = new Dictionary<Guid, Guid>();
var nodesToPaste = new List<INode>();
{
// If the pasted node is a property node, convert it into a concrete node
// if the associated property does not exist.
if (node is PropertyNode)
{
PropertyNode propertyNode = (PropertyNode)node;
// If the property is not in the current graph, do check if the
// property can be made into a concrete node.
if (!m_Properties.Select(x => x.guid).Contains(propertyNode.propertyGuid))
{
// If the property is in the serialized paste graph, make the property node into a property node.
var pastedGraphMetaProperties = graphToPaste.metaProperties.Where(x => x.guid == propertyNode.propertyGuid);
if (pastedGraphMetaProperties.Any())
{
INode concreteNode = pastedGraphMetaProperties.FirstOrDefault().ToConcreteNode();
concreteNode.drawState = node.drawState;
nodesToPaste.Add(concreteNode);
continue;
}
}
}
nodesToPaste.Add(node);
}
var nodeGuidMap = new Dictionary<Guid, Guid>();
foreach (var node in nodesToPaste)
{
var oldGuid = node.guid;
var newGuid = node.RewriteGuid();

正在加载...
取消
保存