public GraphViewPort(GraphViewNode node, GraphViewConnector edgeListener, bool isInput) : base(Orientation.Horizontal, isInput ? Direction.Input : Direction.Output, isInput ? Capacity.Multi : Capacity.Single, null) { AddToClassList(UssClassName); Node = node; m_EdgeConnector = new EdgeConnector <Edge>(edgeListener); this.AddManipulator(m_EdgeConnector); }
private void CreateInput(GraphViewConnector nodeConnector) { Input = new GraphViewInputPort(this, nodeConnector) { tooltip = "Drag an output to here to make a connection" }; titleContainer.Insert(0, Input); }
public StartGraphViewNode(GraphNode node, GraphViewConnector nodeConnector) : base(node) { AddToClassList(StartUssClassName); title = "Start"; expanded = false; CreateOutput(nodeConnector); }
public GraphViewInputPort(GraphViewNode node, GraphViewConnector edgeListener) : base(node, edgeListener, true) { AddToClassList(UssInputClassName); tooltip = "Drag an output to this port to create a connection"; m_ConnectorText.style.marginLeft = 0; m_ConnectorText.style.marginRight = 0; }
private void CreateOutput(GraphViewConnector nodeConnector) { Data.RefreshConnections(); Output = new GraphViewOutputPort(this, Data.Connections[0], nodeConnector, null); Output.AddToClassList(StartOutputUssClassName); titleButtonContainer.Add(Output); RefreshPorts(); }
public DefaultGraphViewNode(GraphNode node, GraphViewConnector nodeConnector) : base(node) { AddToClassList(DefaultUssClassName); CreateInput(nodeConnector); CreateDeleteButton(); _rename = CreateRename(); _breakpoint = CreateBreakpoint(); _callstackBorder = CreateCallstackBorder(); _nodeConnector = nodeConnector; CreateOutputs(Outputs, nodeConnector, null); }
public GraphView(GraphViewWindow window, Graph graph) { Graph = graph; _window = window; _nodeProvider = ScriptableObject.CreateInstance <GraphViewNodeProvider>(); _nodeConnector = new GraphViewConnector(_nodeProvider); _inputs = this.Query <GraphViewInputPort>().Build(); _outputs = this.Query <GraphViewOutputPort>().Build(); AddToClassList(UssClassName); SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); SetupNodeProvider(); SetupNodes(); SetupConnections(); RegisterCallback <KeyDownEvent>(OnKeyDown); RegisterCallback <GeometryChangedEvent>(evt => ShowAll()); // Use this event because the layout isn't build right away so ShowAll won't work immediately nodeCreationRequest = OnShowCreateNode; graphViewChanged = OnGraphChanged; canPasteSerializedData = data => canPaste; serializeGraphElements = OnCopy; unserializeAndPaste = OnPaste; this.AddManipulator(new ContentDragger()); this.AddManipulator(new SelectionDragger()); this.AddManipulator(new RectangleSelector()); this.AddManipulator(new ClickSelector()); Undo.undoRedoPerformed += Rebuild; EditorApplication.playModeStateChanged += PlayStateChanged; if (Application.isPlaying) // Make sure the callback still gets set if the window was opened during play mode { PlayStateChanged(PlayModeStateChange.EnteredPlayMode); FrameChanged(null); } }
protected void CreateOutputs(List <GraphViewOutputPort> outputs, GraphViewConnector nodeConnector, SerializedProperty renameableProperty) { Data.RefreshConnections(); outputs.Clear(); renameableProperty?.serializedObject.Update(); renameableProperty = null; // TODO - figure out a better way to name connections and the like for (var i = 0; i < Data.Connections.Count; i++) { var connection = Data.Connections[i]; var nameProperty = renameableProperty?.GetArrayElementAtIndex(i); var output = new GraphViewOutputPort(this, connection, nodeConnector, nameProperty) { portName = connection.Name }; outputContainer.Add(output); outputs.Add(output); } expanded = Data.Connections.Count > 0; RefreshPorts(); }
public OutputCollectionGraphViewNode(GraphNode node, GraphViewConnector nodeConnector, OutputCollectionNodeAttribute attribute) : base(node, nodeConnector) { AddToClassList(CollectionUssClassName); _attribute = attribute; }
public GraphViewOutputPort(GraphViewNode node, GraphNode.ConnectionData connection, GraphViewConnector edgeListener, SerializedProperty nameProperty) : base(node, edgeListener, false) { AddToClassList(UssOutputClassName); Connection = connection; tooltip = "Click and drag to make a connection from this output"; m_ConnectorText.style.flexGrow = 1; m_ConnectorText.style.unityTextAlign = TextAnchor.MiddleLeft; if (nameProperty != null) { GraphViewNode.CreateEditableLabel(m_ConnectorText, nameProperty); } }