mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-04 14:24:54 +08:00
Renamed GetNodePath to GetNodeMenuName (consistency)
Empty menuNames now skips, just like null does
This commit is contained in:
parent
97ec4bbf42
commit
61ca00ce31
@ -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);
|
||||
|
||||
@ -29,7 +29,13 @@ namespace XNodeEditor {
|
||||
}
|
||||
|
||||
/// <summary> Returns context menu path. Returns null if node is not available. </summary>
|
||||
[Obsolete("Use GetNodeMenuName instead")]
|
||||
public virtual string GetNodePath(Type type) {
|
||||
return GetNodeMenuName(type);
|
||||
}
|
||||
|
||||
/// <summary> Returns context node menu path. Null or empty strings for hidden nodes. </summary>
|
||||
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
|
||||
|
||||
@ -240,7 +240,7 @@ namespace XNode {
|
||||
public class CreateNodeMenuAttribute : Attribute {
|
||||
public string menuName;
|
||||
/// <summary> Manually supply node class with a context menu path </summary>
|
||||
/// <param name="menuName"> Path to this node in the context menu </param>
|
||||
/// <param name="menuName"> Path to this node in the context menu. Null or empty hides it. </param>
|
||||
public CreateNodeMenuAttribute(string menuName) {
|
||||
this.menuName = menuName;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user