Exemplo n.º 1
0
        public void RemoveNode(GraphViewNode node, IEnumerable <GraphViewNode> removedNodes)
        {
            if (node is IInputNode inputNode)
            {
                foreach (var edge in inputNode.Input.connections.ToList())                 // must use ToList() because internal enumerable is modified
                {
                    RemoveEdge(edge, edge.output is GraphViewOutputPort output && !removedNodes.Contains(output.Node));
                }
            }

            if (node is IOutputNode outputNode)
            {
                foreach (var output in outputNode.Outputs)
                {
                    foreach (var edge in output.connections.ToList())                     // must use ToList() because internal enumerable is modified
                    {
                        RemoveEdge(edge, false);
                    }
                }
            }

            DestroyNode(node.Data.Node);

            RemoveElement(node);
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
            }
        }