浏览代码

Remove unneeded event handling (handled elsewhere now)

/main
Peter Bay Bastian 7 年前
当前提交
972596ff
共有 2 个文件被更改,包括 14 次插入28 次删除
  1. 41
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  2. 1
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs

41
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


Add(content);
}
List<INode> nodesToRemove = new List<INode>();
List<IEdge> edgesToRemove = new List<IEdge>();
if (graphViewChange.elementsToRemove != null)
{
m_Graph.owner.RegisterCompleteObjectUndo("Delete");
foreach (var element in graphViewChange.elementsToRemove)
{
var nodeView = element as MaterialNodeView;
if (nodeView != null && nodeView.node != null)
nodesToRemove.Add(nodeView.node);
var edgeView = element as Edge;
if (edgeView != null)
{
var edge = edgeView.userData as IEdge;
if (edge != null)
edgesToRemove.Add(edge);
}
}
m_Graph.RemoveElements(nodesToRemove, edgesToRemove);
graphViewChange.elementsToRemove.Clear();
nodesToRemove.Clear();
edgesToRemove.Clear();
}
m_Graph.owner.RegisterCompleteObjectUndo("Connect Edge");
{
m_Graph.owner.RegisterCompleteObjectUndo("Connect Edge");
}
}
graphViewChange.edgesToCreate.Clear();
}

Edge AddEdge(IEdge edge)
{
var sourceNode = m_Graph.GetNodeFromGuid(edge.outputSlot.nodeGuid);
if (sourceNode == null)
{
Debug.LogWarning("Source node is null");
return null;
}
if (targetNode == null)
{
Debug.LogWarning("Target node is null");
return null;
}
var targetSlot = targetNode.FindInputSlot<MaterialSlot>(edge.inputSlot.slotId);
var sourceNodeView = m_GraphView.nodes.ToList().OfType<MaterialNodeView>().FirstOrDefault(x => x.node == sourceNode);

1
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialNodeView.cs


m_GraphView = graphView;
node = inNode;
persistenceKey = node.guid.ToString();
UpdateTitle();
m_ControlsContainer = new VisualElement

正在加载...
取消
保存