public void ProcessRightClickContextMenu(Event e) { GenericMenu genericMenu = new GenericMenu(); //genericMenu.AddItem(new GUIContent("Add Node"), false, () => OnClickAddNode(e.mousePosition)); foreach (var type in BaseFuncGraphNode.InstantiableNodeTypes) { var node = FuncGraphNodeFactory.CreateNode(type, graph); genericMenu.AddItem(new GUIContent($"{node.ShortDescription}"), false, () => CreateNode(e.mousePosition, node)); } genericMenu.ShowAsContext(); }
private void DeserializeNodeData(FunctionGraphEditorNodeSerializable data, List <NodeNeedingParenting> needParenting) { BaseFuncGraphNode n = FuncGraphNodeFactory.CreateNode(Type.GetType($"{data.GraphNodeType}, {Assembly.GetAssembly(typeof(BaseFuncGraphNode)).FullName}"), graph); CreateNode(data.NodePosition, n); var newNode = nodesList[nodesList.Count - 1]; //if (data.fromIDX >= 0 && data.toIdx >= 0) //{ // //Debug.Log("Creating Node Connection from editor "); // recentChild.CreateConnection(nodeParent, nodeParent.GetConnectionPoint(data.toIdx).Idx, recentChild.GetConnectionPoint(data.fromIDX), nodeParent.GetConnectionPoint(data.toIdx)); //} newNode.DeserializeData(data.NodeValue); if (data.ParentIndex >= 0) { needParenting.Add(new NodeNeedingParenting(data, newNode)); } }