mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
!W
This commit is contained in:
parent
cfb4d2cb54
commit
1691e4ce21
@ -148,6 +148,27 @@ namespace XNodeEditor {
|
|||||||
return NodeEditorResources.styles.nodeBody;
|
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>
|
/// <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) {
|
public virtual void AddContextMenuItems(GenericMenu menu) {
|
||||||
// Actions if only one node is selected
|
// Actions if only one node is selected
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user