public override void OnHeaderGUI() { if (node == null) { node = target as ActNode; } if (node.sourceAction != null) { GUILayout.Label(node.sourceAction.name.ToString(), NodeEditorResources.styles.nodeHeader, GUILayout.Height(30)); } else { inspectStuff.Show(); OdinEditorWindow.InspectObject(inspectStuff, node); //window.Repaint(); } if (node == null) { node = target as ActNode; } if (node.nodeInFilter == null || node.nodeOutFilter == null) { node.initNode(); window.Repaint(); } }
void acceptDraggedAction(Type type, MAction act) { if (dragAcceptPending) { if (Event.current.type == EventType.Repaint) { //var act = act; Convert.ChangeType(act, type); Vector2 pos = NodeEditorWindow.current.WindowToGridPosition(Event.current.mousePosition); // NewNodeGraph graph = target as NewNodeGraph; ActNode nn = CreateNode(typeof(ActNode), pos) as ActNode; nn.sourceAction = act; nn.actionType = act.GetType(); nn.nodeInFilter = nn.populateFilter(nn.nodeInFilter, act.inFilter, PortOrientation.In); // Nestedchild child = new Nestedchild(); nn.nodeOutFilter = nn.populateFilter(nn.nodeOutFilter, act.outFilter, PortOrientation.Out); // child.filter = nn.nodeOutFilter; // AssetDatabase.CreateAsset(child, "Assets/ehNode.asset"); // AssetDatabase.CreateAsset(nn.nodeOutFilter, "Assets/zefilterNode.asset"); // AssetDatabase.AddObjectToAsset(nn.nodeOutFilter, "Assets/ehNode.asset"); // AssetDatabase.SaveAssets(); // AssetDatabase.Refresh(); Debug.Log("Dragged action"); dragAcceptPending = false; a = null; draggedType = null; } } }
public static void Open(ActNode actNode) { ActNodeEditorWindow window = GetWindow <ActNodeEditorWindow>("Act Node Editor"); window.serializedObject = new SerializedObject(actNode); }