1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00

FixFormat

This commit is contained in:
Thor Brigsted 2019-10-07 09:37:01 +02:00
parent 446611531b
commit a35cd68dd7
3 changed files with 9 additions and 10 deletions

View File

@ -274,13 +274,13 @@ namespace XNodeEditor {
ShowPortContextMenu(hoveredPort);
} else if (IsHoveringNode && IsHoveringTitle(hoveredNode)) {
if (!Selection.Contains(hoveredNode)) SelectNode(hoveredNode, false);
autoConnectOutput = null;
autoConnectOutput = null;
GenericMenu menu = new GenericMenu();
NodeEditor.GetEditor(hoveredNode, this).AddContextMenuItems(menu);
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.
} else if (!IsHoveringNode) {
autoConnectOutput = null;
autoConnectOutput = null;
GenericMenu menu = new GenericMenu();
graphEditor.AddContextMenuItems(menu);
menu.DropDown(new Rect(Event.current.mousePosition, Vector2.zero));

View File

@ -127,7 +127,7 @@ namespace XNodeEditor {
for (int i = 0; i < length - 1; i++) {
Vector2 inputTangent = Vector2.left;
// 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];
float dist_ab = Vector2.Distance(point_a, point_b);
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;
inputTangent = p;
}
else {
} else {
inputTangent = Vector2.left * dist_ab * 0.01f * zoom;
}
@ -155,7 +154,7 @@ namespace XNodeEditor {
int division = Mathf.RoundToInt(.1f * dist_ab) + 3;
Vector3[] points = Handles.MakeBezierPoints(point_a, point_b, tangent_a, tangent_b, division);
// 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.DrawAAPolyLine(bezier_width, points[j], points[j + 1]);
}
@ -170,7 +169,7 @@ namespace XNodeEditor {
int line_width = 5;
// Draws the line with the coloring.
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);
Handles.color = gradient.Evaluate(j);
Handles.DrawAAPolyLine(line_width, prev_point, lerp);
@ -239,7 +238,7 @@ namespace XNodeEditor {
Color portColor = graphEditor.GetPortColor(output);
for (int k = 0; k < output.ConnectionCount; k++) {
XNode.NodePort input = output.GetConnection(k);
Gradient noodleGradient = graphEditor.GetNoodleGradient(output, input);
// Error handling

View File

@ -73,8 +73,8 @@ namespace XNodeEditor {
}
Gradient grad = new Gradient();
grad.SetKeys(
new GradientColorKey[] { new GradientColorKey(a, 0f), new GradientColorKey(b, 1f) },
new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }
new GradientColorKey[] { new GradientColorKey(a, 0f), new GradientColorKey(b, 1f) },
new GradientAlphaKey[] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(1f, 1f) }
);
return grad;
}