Closed baroquedub closed 2 years ago
I've worked it out so will answer my own question.
You need to include an if statement that checks for the NodeMenuName being "Group"
So in the case of the MathGraph this: ` public override string GetNodeMenuName(System.Type type) {
if (type.Namespace == "XNode.Examples.MathNodes") {
return base.GetNodeMenuName(type).Replace("X Node/Examples/Math Nodes/", "");
} else return null;
}`
becomes: ` public override string GetNodeMenuName(System.Type type) {
string nodeMenuName = base.GetNodeMenuName(type);
if (type.Namespace == "XNode.Examples.MathNodes") {
return nodeMenuName.Replace("X Node/Examples/Math Nodes/", "");
} else if(nodeMenuName == "Group"){
return nodeMenuName;
} else return null;
}`
I've been struggling to work out why 'Group' doesn't appear as a left-click option in a project which used the xNode Examples branch as a starting point (although xNodeGroups is installed). However on a new, blank xNode project everything works as expected.
I've narrowed down the issue to the existence of an Editor script for the graph. For example, in the MathGraph example, if I delete the file MathGraphEditor.cs (which makes the right-click menu less long) I then get the 'Group' option. With it there it doesn't appear.
Is it possible to add some CustomNodeGraphEditor code which would allow the Groups option to appear?