|
|
|
|
|
|
var sourceNodeView = m_GraphView.nodes.ToList().OfType<MaterialNodeView>().FirstOrDefault(x => x.node == sourceNode); |
|
|
|
if (sourceNodeView != null) |
|
|
|
{ |
|
|
|
var sourceAnchor = sourceNodeView.outputContainer.Children().OfType<NodeAnchor>().FirstOrDefault(x => x.userData is ISlot && (x.userData as ISlot).Equals(sourceSlot)); |
|
|
|
var sourceAnchor = sourceNodeView.outputContainer.Children().OfType<Port>().FirstOrDefault(x => x.userData is ISlot && (x.userData as ISlot).Equals(sourceSlot)); |
|
|
|
var targetAnchor = targetNodeView.inputContainer.Children().OfType<NodeAnchor>().FirstOrDefault(x => x.userData is ISlot && (x.userData as ISlot).Equals(targetSlot)); |
|
|
|
var targetAnchor = targetNodeView.inputContainer.Children().OfType<Port>().FirstOrDefault(x => x.userData is ISlot && (x.userData as ISlot).Equals(targetSlot)); |
|
|
|
|
|
|
|
var edgeView = new GradientEdge |
|
|
|
{ |
|
|
|
|
|
|
edgeView.output.Connect(edgeView); |
|
|
|
edgeView.input.Connect(edgeView); |
|
|
|
m_GraphView.AddElement(edgeView); |
|
|
|
sourceNodeView.RefreshAnchors(); |
|
|
|
targetNodeView.RefreshAnchors(); |
|
|
|
sourceNodeView.RefreshPorts(); |
|
|
|
targetNodeView.RefreshPorts(); |
|
|
|
sourceNodeView.UpdatePortInputTypes(); |
|
|
|
targetNodeView.UpdatePortInputTypes(); |
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
var nodeView = nodeStack.Pop(); |
|
|
|
nodeView.UpdatePortInputTypes(); |
|
|
|
foreach (var anchorView in nodeView.outputContainer.Children().OfType<NodeAnchor>()) |
|
|
|
foreach (var anchorView in nodeView.outputContainer.Children().OfType<Port>()) |
|
|
|
{ |
|
|
|
var sourceSlot = (MaterialSlot)anchorView.userData; |
|
|
|
foreach (var edgeView in anchorView.connections.OfType<GradientEdge>()) |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
foreach (var anchorView in nodeView.inputContainer.Children().OfType<NodeAnchor>()) |
|
|
|
foreach (var anchorView in nodeView.inputContainer.Children().OfType<Port>()) |
|
|
|
{ |
|
|
|
var targetSlot = (MaterialSlot)anchorView.userData; |
|
|
|
if (targetSlot.valueType != SlotValueType.Dynamic) |
|
|
|