1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-03-26 22:49:02 +08:00
This commit is contained in:
Icarus 2019-11-26 17:45:34 +08:00
parent cfb4d2cb54
commit 1691e4ce21

View File

@ -148,6 +148,27 @@ namespace XNodeEditor {
return NodeEditorResources.styles.nodeBody;
}
/// <summary> Add items for the context menu when right-clicking this node. Override to add custom menu items. </summary>
public virtual void AddContextMenuItems(MenuPopupWindow menu) {
// Actions if only one node is selected
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.Node) {
XNode.Node node = Selection.activeObject as XNode.Node;
menu.AddItem("Move To Top", () => NodeEditorWindow.current.MoveNodeToTop(node));
menu.AddItem("Rename", NodeEditorWindow.current.RenameSelectedNode);
}
// Add actions to any number of selected nodes
menu.AddItem("Copy", NodeEditorWindow.current.CopySelectedNodes);
menu.AddItem("Duplicate", NodeEditorWindow.current.DuplicateSelectedNodes);
menu.AddItem("Remove", NodeEditorWindow.current.RemoveSelectedNodes);
// Custom sctions if only one node is selected
if (Selection.objects.Length == 1 && Selection.activeObject is XNode.Node) {
XNode.Node node = Selection.activeObject as XNode.Node;
menu.AddCustomContextMenuItems(node);
}
}
/// <summary> Add items for the context menu when right-clicking this node. Override to add custom menu items. </summary>
public virtual void AddContextMenuItems(GenericMenu menu) {
// Actions if only one node is selected