예제 #1
0
 public void DisconnectFromPort()
 {
     if (ParentPort != null)
     {
         ParentPort.Disconnect();
         ParentPort.DecrementReferenceCount();
     }
 }
예제 #2
0
        public virtual void Initialize(TreeGraphView graphView, NodeInfo info)
        {
            Info      = info;
            GraphView = graphView;

            title = Info.displayedName;

            //Generate parent port
            if (HasParent)
            {
                ParentPort = InstantiatePort(Orientation.Horizontal, Direction.Input, Port.Capacity.Single, typeof(bool));

                ParentPort.portName = "Parent";
                ParentPort.AddManipulator(GraphView.GetNewEdgeConnector());

                inputContainer.Add(ParentPort);
            }

            //Generate child port
            if (MaxChildCount > 0)
            {
                if (MaxChildCount == 1)
                {
                    ChildrenPort          = InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(int));
                    ChildrenPort.portName = "Child";
                }
                else
                {
                    ChildrenPort          = InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Multi, typeof(float));
                    ChildrenPort.portName = "Children";
                }

                ChildrenPort.AddManipulator(GraphView.GetNewEdgeConnector());
                outputContainer.Add(ChildrenPort);
            }

            //Generate order display
            if (HasParent)
            {
                orderLabel = new Label {
                    name = "title-label"
                };                                                             //Use the same style as the title
                orderLabel.AddToClassList("unity-text-element");
                orderLabel.AddToClassList("unity-label");

                titleContainer.Insert(1, orderLabel);                 //The first position is the title, the second is the button, so we insert the label in between
                RecalculateOrder();
            }
        }