Beispiel #1
0
        public Tuple <PortView, PortView> RegisterPortView(Port port, bool isGraphPort)
        {
            if (!fields.Contains(port.name))
            {
                var field = port.GetField();
                body.Add(field);
                if (isGraphPort)
                {
                    field.SetEnabled(false);
                }
                fields.Add(port.name);
            }

            PortView input  = null;
            PortView output = null;

            if (port.direction.IsInput())
            {
                input = new PortView(port, PortDirections.Input, isGraphPort);
                inputs.Add(input);
            }
            if (port.direction.IsOutput())
            {
                output = new PortView(port, PortDirections.Output, isGraphPort);
                outputs.Add(output);
            }
            return(new Tuple <PortView, PortView>(input, output));
        }
Beispiel #2
0
        internal void ClickedPort(PortView view)
        {
            var port      = view.port;
            var direction = view.direction;

            if (clickedOnce)
            {
                if (clickedDirection == direction)
                {
                    return;
                }
                if (direction.IsInput())
                {
                    graph.Connect(clickedPort.Item2, port);
                }
                else
                {
                    graph.Connect(port, clickedPort.Item2);
                }
                clickedPort.Item3.ClearConnecting();
                clickedOnce = false;
            }
            else
            {
                clickedDirection = direction;
                clickedPort      = new Tuple <Guid, Port, PortView>(graph.FindNodeWithPort(port).id, port, view);
                clickedOnce      = true;
                view.StartConnecting();
            }
        }
Beispiel #3
0
 internal static void ClickedPort(PortView view)
 {
     instance.view.ClickedPort(view);
 }
Beispiel #4
0
 internal static void Disconnect(PortView view)
 {
     instance.graph.Disconnect(view.port, view.direction.IsInput());
 }