mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-17 20:41:40 +08:00
Added 'Move To Top' to groups & shift selecting now also selects groups inside groups
This commit is contained in:
parent
5e182fe073
commit
01c1c5f330
@ -464,6 +464,15 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Draw this group on top of other group by placing it last in the graph.groups list </summary>
|
||||||
|
public void MoveGroupToTop(XNode.NodeGroup group) {
|
||||||
|
int index;
|
||||||
|
while ((index = graph.groups.IndexOf(group)) != graph.groups.Count - 1) {
|
||||||
|
graph.groups[index] = graph.groups[index + 1];
|
||||||
|
graph.groups[index + 1] = group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Duplicate selected nodes and select the duplicates </summary>
|
/// <summary> Duplicate selected nodes and select the duplicates </summary>
|
||||||
public void DuplicateSelectedNodes() {
|
public void DuplicateSelectedNodes() {
|
||||||
UnityEngine.Object[] newNodes = new UnityEngine.Object[Selection.objects.Length];
|
UnityEngine.Object[] newNodes = new UnityEngine.Object[Selection.objects.Length];
|
||||||
|
|||||||
@ -158,11 +158,18 @@ namespace XNodeEditor {
|
|||||||
|
|
||||||
public void SelectNodesInGroup(XNode.NodeGroup group) {
|
public void SelectNodesInGroup(XNode.NodeGroup group) {
|
||||||
Rect groupRect = new Rect(group.position, group.size);
|
Rect groupRect = new Rect(group.position, group.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];
|
||||||
if (!node) continue;
|
if (!node) continue;
|
||||||
if (groupRect.Contains(node.position)) SelectNode(node, true);
|
if (groupRect.Contains(node.position)) SelectNode(node, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < graph.groups.Count; i++) {
|
||||||
|
XNode.NodeGroup otherGroup = graph.groups[i];
|
||||||
|
if (!otherGroup || group == otherGroup) continue;
|
||||||
|
if (groupRect.Contains(otherGroup.position)) SelectGroup(otherGroup, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectNodesInGroup(XNode.NodeGroup group)
|
public void DeselectNodesInGroup(XNode.NodeGroup group)
|
||||||
@ -176,6 +183,13 @@ namespace XNodeEditor {
|
|||||||
if (groupRect.Contains(node.position)) selection.Remove(node);
|
if (groupRect.Contains(node.position)) selection.Remove(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < graph.groups.Count; i++) {
|
||||||
|
XNode.NodeGroup otherGroup = graph.groups[i];
|
||||||
|
if (!otherGroup || group == otherGroup) continue;
|
||||||
|
|
||||||
|
if (groupRect.Contains(otherGroup.position)) selection.Remove(otherGroup);
|
||||||
|
}
|
||||||
|
|
||||||
Selection.objects = selection.ToArray();
|
Selection.objects = selection.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,6 +80,7 @@ namespace XNodeEditor {
|
|||||||
// Actions if only one node is selected
|
// Actions if only one node is selected
|
||||||
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.NodeGroup) {
|
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.NodeGroup) {
|
||||||
XNode.NodeGroup group = Selection.activeObject as XNode.NodeGroup;
|
XNode.NodeGroup group = Selection.activeObject as XNode.NodeGroup;
|
||||||
|
menu.AddItem(new GUIContent("Move To Top"), false, () => NodeEditorWindow.current.MoveGroupToTop(group));
|
||||||
menu.AddItem(new GUIContent("Rename"), false, NodeEditorWindow.current.RenameSelectedGroup);
|
menu.AddItem(new GUIContent("Rename"), false, NodeEditorWindow.current.RenameSelectedGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user