|
|
|
|
|
|
DrawEdge(painter); |
|
|
|
} |
|
|
|
|
|
|
|
private NodeAnchorPresenter m_OutputPresenter; |
|
|
|
private NodeAnchorPresenter m_InputPresenter; |
|
|
|
private GraphElement m_LeftAnchor; |
|
|
|
private GraphElement m_RightAnchor; |
|
|
|
|
|
|
|
protected void GetFromToPoints(ref Vector2 from, ref Vector2 to) |
|
|
|
{ |
|
|
|
var edgePresenter = GetPresenter<EdgePresenter>(); |
|
|
|
|
|
|
|
|
|
|
if (outputPresenter != null) |
|
|
|
{ |
|
|
|
if (outputPresenter != m_OutputPresenter) |
|
|
|
{ |
|
|
|
m_LeftAnchor = parent.allElements.OfType<NodeAnchor>().First(e => e.GetPresenter<NodeAnchorPresenter>() == outputPresenter); |
|
|
|
m_OutputPresenter = outputPresenter; |
|
|
|
} |
|
|
|
if (m_LeftAnchor != null) |
|
|
|
GraphElement leftAnchor = parent.allElements.OfType<NodeAnchor>().First(e => e.GetPresenter<NodeAnchorPresenter>() == outputPresenter); |
|
|
|
if (leftAnchor != null) |
|
|
|
from = m_LeftAnchor.GetGlobalCenter(); |
|
|
|
from = leftAnchor.GetGlobalCenter(); |
|
|
|
from = globalTransform.inverse.MultiplyPoint3x4(from); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
if (inputPresenter != null) |
|
|
|
{ |
|
|
|
if (inputPresenter != m_InputPresenter) |
|
|
|
{ |
|
|
|
m_RightAnchor = parent.allElements.OfType<NodeAnchor>().First(e => e.GetPresenter<NodeAnchorPresenter>() == inputPresenter); |
|
|
|
m_InputPresenter = inputPresenter; |
|
|
|
} |
|
|
|
if (m_RightAnchor != null) |
|
|
|
GraphElement rightAnchor = parent.allElements.OfType<NodeAnchor>().First(e => e.GetPresenter<NodeAnchorPresenter>() == inputPresenter); |
|
|
|
if (rightAnchor != null) |
|
|
|
to = m_RightAnchor.GetGlobalCenter(); |
|
|
|
to = rightAnchor.GetGlobalCenter(); |
|
|
|
to = globalTransform.inverse.MultiplyPoint3x4(to); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
Vector3[] points, tangents; |
|
|
|
GetTangents(orientation, from, to, out points, out tangents); |
|
|
|
Handles.DrawBezier(points[0], points[1], tangents[0], tangents[1], edgeColor, null, 2f); |
|
|
|
|
|
|
|
|
|
|
|
// little widget on the middle of the edge
|
|
|
|
// I'll leave this in here for later, might come in handy, but for now it doesn't do anything
|
|
|
|
// Vector3[] allPoints = Handles.MakeBezierPoints(points[0], points[1], tangents[0], tangents[1], 20);
|
|
|
|