mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
FixFormat
This commit is contained in:
parent
446611531b
commit
a35cd68dd7
@ -274,13 +274,13 @@ namespace XNodeEditor {
|
|||||||
ShowPortContextMenu(hoveredPort);
|
ShowPortContextMenu(hoveredPort);
|
||||||
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
|
||||||
if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, false);
|
if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, false);
|
||||||
autoConnectOutput = null;
|
autoConnectOutput = null;
|
||||||
GenericMenu menu = new GenericMenu();
|
GenericMenu menu = new GenericMenu();
|
||||||
NodeEditor.GetEditor(hoveredNode, this).AddContextMenuItems(menu);
|
NodeEditor.GetEditor(hoveredNode, this).AddContextMenuItems(menu);
|
||||||
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
|
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
|
||||||
e.Use(); // Fixes copy/paste context menu appearing in Unity 5.6.6f2 - doesn't occur in 2018.3.2f1 Probably needs to be used in other places.
|
e.Use(); // Fixes copy/paste context menu appearing in Unity 5.6.6f2 - doesn't occur in 2018.3.2f1 Probably needs to be used in other places.
|
||||||
} else if (!IsHoveringNode) {
|
} else if (!IsHoveringNode) {
|
||||||
autoConnectOutput = null;
|
autoConnectOutput = null;
|
||||||
GenericMenu menu = new GenericMenu();
|
GenericMenu menu = new GenericMenu();
|
||||||
graphEditor.AddContextMenuItems(menu);
|
graphEditor.AddContextMenuItems(menu);
|
||||||
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
|
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));
|
||||||
|
|||||||
@ -127,7 +127,7 @@ namespace XNodeEditor {
|
|||||||
for (int i = 0; i < length - 1; i++) {
|
for (int i = 0; i < length - 1; i++) {
|
||||||
Vector2 inputTangent = Vector2.left;
|
Vector2 inputTangent = Vector2.left;
|
||||||
// Cached most variables that repeat themselves here to avoid so many indexer calls :p
|
// Cached most variables that repeat themselves here to avoid so many indexer calls :p
|
||||||
Vector2 point_a = windowPoints[i];
|
Vector2 point_a = windowPoints[i];
|
||||||
Vector2 point_b = windowPoints[i + 1];
|
Vector2 point_b = windowPoints[i + 1];
|
||||||
float dist_ab = Vector2.Distance(point_a, point_b);
|
float dist_ab = Vector2.Distance(point_a, point_b);
|
||||||
if (i == 0) outputTangent = Vector2.right * dist_ab * 0.01f * zoom;
|
if (i == 0) outputTangent = Vector2.right * dist_ab * 0.01f * zoom;
|
||||||
@ -142,8 +142,7 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
p = new Vector2(-p.y, p.x) * Mathf.Sign(side) * tangentLength;
|
p = new Vector2(-p.y, p.x) * Mathf.Sign(side) * tangentLength;
|
||||||
inputTangent = p;
|
inputTangent = p;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
inputTangent = Vector2.left * dist_ab * 0.01f * zoom;
|
inputTangent = Vector2.left * dist_ab * 0.01f * zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +154,7 @@ namespace XNodeEditor {
|
|||||||
int division = Mathf.RoundToInt(.1f * dist_ab) + 3;
|
int division = Mathf.RoundToInt(.1f * dist_ab) + 3;
|
||||||
Vector3[] points = Handles.MakeBezierPoints(point_a, point_b, tangent_a, tangent_b, division);
|
Vector3[] points = Handles.MakeBezierPoints(point_a, point_b, tangent_a, tangent_b, division);
|
||||||
// Coloring and bezier drawing.
|
// Coloring and bezier drawing.
|
||||||
for (int j = 0; j < points.Length - 1; j++) {
|
for (int j = 0; j < points.Length - 1; j++) {
|
||||||
Handles.color = gradient.Evaluate((j + 1f) / (points.Length));
|
Handles.color = gradient.Evaluate((j + 1f) / (points.Length));
|
||||||
Handles.DrawAAPolyLine(bezier_width, points[j], points[j + 1]);
|
Handles.DrawAAPolyLine(bezier_width, points[j], points[j + 1]);
|
||||||
}
|
}
|
||||||
@ -170,7 +169,7 @@ namespace XNodeEditor {
|
|||||||
int line_width = 5;
|
int line_width = 5;
|
||||||
// Draws the line with the coloring.
|
// Draws the line with the coloring.
|
||||||
Vector2 prev_point = point_a;
|
Vector2 prev_point = point_a;
|
||||||
for (float j = 0; j < 1; j += 10f / Vector2.Distance(point_a, point_b)) {
|
for (float j = 0; j < 1; j += 10f / Vector2.Distance(point_a, point_b)) {
|
||||||
Vector2 lerp = Vector2.Lerp(point_a, point_b, j);
|
Vector2 lerp = Vector2.Lerp(point_a, point_b, j);
|
||||||
Handles.color = gradient.Evaluate(j);
|
Handles.color = gradient.Evaluate(j);
|
||||||
Handles.DrawAAPolyLine(line_width, prev_point, lerp);
|
Handles.DrawAAPolyLine(line_width, prev_point, lerp);
|
||||||
@ -239,7 +238,7 @@ namespace XNodeEditor {
|
|||||||
Color portColor = graphEditor.GetPortColor(output);
|
Color portColor = graphEditor.GetPortColor(output);
|
||||||
for (int k = 0; k < output.ConnectionCount; k++) {
|
for (int k = 0; k < output.ConnectionCount; k++) {
|
||||||
XNode.NodePort input = output.GetConnection(k);
|
XNode.NodePort input = output.GetConnection(k);
|
||||||
|
|
||||||
Gradient noodleGradient = graphEditor.GetNoodleGradient(output, input);
|
Gradient noodleGradient = graphEditor.GetNoodleGradient(output, input);
|
||||||
|
|
||||||
// Error handling
|
// Error handling
|
||||||
|
|||||||
@ -73,8 +73,8 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
Gradient grad = new Gradient();
|
Gradient grad = new Gradient();
|
||||||
grad.SetKeys(
|
grad.SetKeys(
|
||||||
new GradientColorKey[] { new GradientColorKey(a, 0f), new GradientColorKey(b, 1f) },
|
new GradientColorKey[] { new GradientColorKey(a, 0f), new GradientColorKey(b, 1f) },
|
||||||
new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }
|
new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }
|
||||||
);
|
);
|
||||||
return grad;
|
return grad;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user