1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-04 22:34:54 +08:00

Renamed GetNodePath to GetNodeMenuName (consistency)

Empty menuNames now skips, just like null does
This commit is contained in:
Thor Brigsted 2018-05-13 12:18:16 +02:00
parent 97ec4bbf42
commit 61ca00ce31
3 changed files with 9 additions and 3 deletions

View File

@ -135,8 +135,8 @@ namespace XNodeEditor {
Type type = nodeTypes[i]; Type type = nodeTypes[i];
//Get node context menu path //Get node context menu path
string path = graphEditor.GetNodePath(type); string path = graphEditor.GetNodeMenuName(type);
if (path == null) continue; if (string.IsNullOrEmpty(path)) continue;
contextMenu.AddItem(new GUIContent(path), false, () => { contextMenu.AddItem(new GUIContent(path), false, () => {
CreateNode(type, pos); CreateNode(type, pos);

View File

@ -29,7 +29,13 @@ namespace XNodeEditor {
} }
/// <summary> Returns context menu path. Returns null if node is not available. </summary> /// <summary> Returns context menu path. Returns null if node is not available. </summary>
[Obsolete("Use GetNodeMenuName instead")]
public virtual string GetNodePath(Type type) { 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 //Check if type has the CreateNodeMenuAttribute
XNode.Node.CreateNodeMenuAttribute attrib; XNode.Node.CreateNodeMenuAttribute attrib;
if (NodeEditorUtilities.GetAttrib(type, out attrib)) // Return custom path if (NodeEditorUtilities.GetAttrib(type, out attrib)) // Return custom path

View File

@ -240,7 +240,7 @@ namespace XNode {
public class CreateNodeMenuAttribute : Attribute { public class CreateNodeMenuAttribute : Attribute {
public string menuName; public string menuName;
/// <summary> Manually supply node class with a context menu path </summary> /// <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) { public CreateNodeMenuAttribute(string menuName) {
this.menuName = menuName; this.menuName = menuName;
} }