diff --git a/Scripts/Editor/NodeEditorGUI.cs b/Scripts/Editor/NodeEditorGUI.cs index 51baf55..a1e8fd3 100644 --- a/Scripts/Editor/NodeEditorGUI.cs +++ b/Scripts/Editor/NodeEditorGUI.cs @@ -135,8 +135,8 @@ namespace XNodeEditor { Type type = nodeTypes[i]; //Get node context menu path - string path = graphEditor.GetNodePath(type); - if (path == null) continue; + string path = graphEditor.GetNodeMenuName(type); + if (string.IsNullOrEmpty(path)) continue; contextMenu.AddItem(new GUIContent(path), false, () => { CreateNode(type, pos); diff --git a/Scripts/Editor/NodeGraphEditor.cs b/Scripts/Editor/NodeGraphEditor.cs index 8d81a07..3f0141a 100644 --- a/Scripts/Editor/NodeGraphEditor.cs +++ b/Scripts/Editor/NodeGraphEditor.cs @@ -29,7 +29,13 @@ namespace XNodeEditor { } /// Returns context menu path. Returns null if node is not available. + [Obsolete("Use GetNodeMenuName instead")] public virtual string GetNodePath(Type type) { + return GetNodeMenuName(type); + } + + /// Returns context node menu path. Null or empty strings for hidden nodes. + public virtual string GetNodeMenuName(Type type) { //Check if type has the CreateNodeMenuAttribute XNode.Node.CreateNodeMenuAttribute attrib; if (NodeEditorUtilities.GetAttrib(type, out attrib)) // Return custom path diff --git a/Scripts/Node.cs b/Scripts/Node.cs index be3d5a7..ad2889f 100644 --- a/Scripts/Node.cs +++ b/Scripts/Node.cs @@ -240,7 +240,7 @@ namespace XNode { public class CreateNodeMenuAttribute : Attribute { public string menuName; /// Manually supply node class with a context menu path - /// Path to this node in the context menu + /// Path to this node in the context menu. Null or empty hides it. public CreateNodeMenuAttribute(string menuName) { this.menuName = menuName; }