1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Fixed some coding conventions errors

This commit is contained in:
Jeroen van de Haterd 2019-01-11 15:07:10 +01:00
parent 76dcbb94c6
commit 0020bf87e3
4 changed files with 6 additions and 16 deletions

View File

@ -23,8 +23,8 @@ namespace XNodeEditor {
[NonSerialized] private XNode.NodePort draggedOutputTarget = null; [NonSerialized] private XNode.NodePort draggedOutputTarget = null;
[NonSerialized] private List<Vector2> draggedOutputReroutes = new List<Vector2>(); [NonSerialized] private List<Vector2> draggedOutputReroutes = new List<Vector2>();
[NonSerialized] private XNode.NodeGraphComment hoveredComment = null; [NonSerialized] private XNode.NodeGraphComment hoveredComment = null;
[NonSerialized] private bool deselectingComment = false;
[NonSerialized] private XNode.NodeGraphComment resizingComment = null; [NonSerialized] private XNode.NodeGraphComment resizingComment = null;
private bool deselectingComment = false;
public enum NodeGraphCommentSide { Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, TopLeft } public enum NodeGraphCommentSide { Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, TopLeft }
public static NodeGraphCommentSide resizingCommentSide; public static NodeGraphCommentSide resizingCommentSide;
private RerouteReference hoveredReroute = new RerouteReference(); private RerouteReference hoveredReroute = new RerouteReference();
@ -402,8 +402,7 @@ namespace XNodeEditor {
XNode.Node node = Selection.objects[i] as XNode.Node; XNode.Node node = Selection.objects[i] as XNode.Node;
dragOffset[i] = node.position - WindowToGridPosition(current.mousePosition); dragOffset[i] = node.position - WindowToGridPosition(current.mousePosition);
} }
else if (Selection.objects[i] is XNode.NodeGraphComment) else if (Selection.objects[i] is XNode.NodeGraphComment) {
{
XNode.NodeGraphComment comment = Selection.objects[i] as XNode.NodeGraphComment; XNode.NodeGraphComment comment = Selection.objects[i] as XNode.NodeGraphComment;
dragOffset[i] = comment.position - WindowToGridPosition(current.mousePosition); dragOffset[i] = comment.position - WindowToGridPosition(current.mousePosition);
} }
@ -450,10 +449,8 @@ namespace XNodeEditor {
} }
/// <summary> Initiate a rename on the currently selected comment </summary> /// <summary> Initiate a rename on the currently selected comment </summary>
public void RenameSelectedComment() public void RenameSelectedComment() {
{ if (Selection.objects.Length == 1 && Selection.activeObject is XNode.NodeGraphComment) {
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.NodeGraphComment)
{
renamingComment = Selection.activeObject as XNode.NodeGraphComment; renamingComment = Selection.activeObject as XNode.NodeGraphComment;
} }
} }

View File

@ -26,8 +26,7 @@ namespace XNodeEditor {
Controls(); Controls();
if (e.type == EventType.Layout) if (e.type == EventType.Layout) {
{
selectionCache = new List<UnityEngine.Object>(Selection.objects); selectionCache = new List<UnityEngine.Object>(Selection.objects);
} }
@ -500,8 +499,7 @@ namespace XNodeEditor {
renamingComment = null; renamingComment = null;
renamingStarted = false; renamingStarted = false;
} }
} } else {
else {
// Selection changed, so stop renaming. // Selection changed, so stop renaming.
GUILayout.Label(comment.comment, NodeEditorResources.styles.commentHeader, GUILayout.Height(26)); GUILayout.Label(comment.comment, NodeEditorResources.styles.commentHeader, GUILayout.Height(26));
renamingComment = null; renamingComment = null;
@ -587,7 +585,6 @@ namespace XNodeEditor {
if (!resizeAreaClicked) hoveredComment = comment; if (!resizeAreaClicked) hoveredComment = comment;
} }
} }
//If dragging a selection box, add nodes inside to selection //If dragging a selection box, add nodes inside to selection
if (currentActivity == NodeActivity.DragGrid) { if (currentActivity == NodeActivity.DragGrid) {
if (windowRect.Overlaps(selectionBox)) preSelection.Add(comment); if (windowRect.Overlaps(selectionBox)) preSelection.Add(comment);

View File

@ -161,7 +161,6 @@ namespace XNodeEditor {
for (int i = 0; i < graph.nodes.Count; i++) { for (int i = 0; i < graph.nodes.Count; i++) {
XNode.Node node = graph.nodes[i]; XNode.Node node = graph.nodes[i];
if (!node) continue; if (!node) continue;
if (commentRect.Contains(node.position)) SelectNode(node, true); if (commentRect.Contains(node.position)) SelectNode(node, true);
} }
} }
@ -169,8 +168,6 @@ namespace XNodeEditor {
public void DeselectNodesInComment(XNode.NodeGraphComment comment) public void DeselectNodesInComment(XNode.NodeGraphComment comment)
{ {
List<Object> selection = new List<Object>(Selection.objects); List<Object> selection = new List<Object>(Selection.objects);
Rect commentRect = new Rect(comment.position, comment.size); Rect commentRect = new Rect(comment.position, comment.size);
for (int i = 0; i < graph.nodes.Count; i++) { for (int i = 0; i < graph.nodes.Count; i++) {
XNode.Node node = graph.nodes[i]; XNode.Node node = graph.nodes[i];

View File

@ -61,7 +61,6 @@ namespace XNode {
NodeGraphComment comment = ScriptableObject.CreateInstance<NodeGraphComment>(); NodeGraphComment comment = ScriptableObject.CreateInstance<NodeGraphComment>();
comment.graph = this; comment.graph = this;
comments.Add(comment); comments.Add(comment);
return comment; return comment;
} }