mirror of
https://github.com/Siccity/xNode.git
synced 2026-03-26 22:49:02 +08:00
Added utility function that returns a prettified name for node type, also removed postfix 'Node' if it exists.
This commit is contained in:
parent
0553dc8894
commit
4fe5995c3d
@ -133,6 +133,15 @@ namespace XNodeEditor {
|
||||
} else return type.ToString();
|
||||
}
|
||||
|
||||
/// <summary> Returns the default name for the node type. </summary>
|
||||
public static string NodeDefaultName(Type type) {
|
||||
string typeName = type.Name;
|
||||
// Automatically remove redundant 'Node' postfix
|
||||
if (typeName.EndsWith("Node")) typeName = typeName.Substring(0, typeName.LastIndexOf("Node"));
|
||||
typeName = UnityEditor.ObjectNames.NicifyVariableName(typeName);
|
||||
return typeName;
|
||||
}
|
||||
|
||||
/// <summary>Creates a new C# Class.</summary>
|
||||
[MenuItem("Assets/Create/xNode/Node C# Script", false, 89)]
|
||||
private static void CreateNode() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user