mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-21 09:46:03 +08:00
Added F2 to rename hotkey (return on mac)
This commit is contained in:
parent
69ee12169d
commit
75795c59b0
@ -255,6 +255,11 @@ namespace XNodeEditor {
|
|||||||
case EventType.KeyDown:
|
case EventType.KeyDown:
|
||||||
if (EditorGUIUtility.editingTextField) break;
|
if (EditorGUIUtility.editingTextField) break;
|
||||||
else if (e.keyCode == KeyCode.F) Home();
|
else if (e.keyCode == KeyCode.F) Home();
|
||||||
|
if (SystemInfo.operatingSystemFamily == OperatingSystemFamily.MacOSX) {
|
||||||
|
if (e.keyCode == KeyCode.Return) RenameSelectedNode();
|
||||||
|
} else {
|
||||||
|
if (e.keyCode == KeyCode.F2) RenameSelectedNode();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EventType.ValidateCommand:
|
case EventType.ValidateCommand:
|
||||||
if (e.commandName == "SoftDelete") RemoveSelectedNodes();
|
if (e.commandName == "SoftDelete") RemoveSelectedNodes();
|
||||||
@ -318,6 +323,14 @@ namespace XNodeEditor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary> Initiate a rename on the currently selected node </summary>
|
||||||
|
public void RenameSelectedNode() {
|
||||||
|
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.Node) {
|
||||||
|
XNode.Node node = Selection.activeObject as XNode.Node;
|
||||||
|
NodeEditor.GetEditor(node).InitiateRename();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary> Draw this node on top of other nodes by placing it last in the graph.nodes list </summary>
|
/// <summary> Draw this node on top of other nodes by placing it last in the graph.nodes list </summary>
|
||||||
public void MoveNodeToTop(XNode.Node node) {
|
public void MoveNodeToTop(XNode.Node node) {
|
||||||
int index;
|
int index;
|
||||||
|
|||||||
@ -112,7 +112,7 @@ namespace XNodeEditor {
|
|||||||
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.Node) {
|
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.Node) {
|
||||||
XNode.Node node = Selection.activeObject as XNode.Node;
|
XNode.Node node = Selection.activeObject as XNode.Node;
|
||||||
contextMenu.AddItem(new GUIContent("Move To Top"), false, () => MoveNodeToTop(node));
|
contextMenu.AddItem(new GUIContent("Move To Top"), false, () => MoveNodeToTop(node));
|
||||||
contextMenu.AddItem(new GUIContent("Rename"), false, NodeEditor.GetEditor(node).InitiateRename);
|
contextMenu.AddItem(new GUIContent("Rename"), false, RenameSelectedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMenu.AddItem(new GUIContent("Duplicate"), false, DublicateSelectedNodes);
|
contextMenu.AddItem(new GUIContent("Duplicate"), false, DublicateSelectedNodes);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user