/// <inheritdoc />
 /// <remarks>
 /// Variable node is able to connect to variable node socket of the same type if possible.
 /// </remarks>
 public bool Connection(NodeSocketView socket)
 {
     return(socket.NodeSocket.NodeSocketData.VariableType == Variable.VariableType &&
            (socket.Type == NodeSocketType.VariableIn || socket.Type == NodeSocketType.VariableOut) &&
            (socket.NodeSocket.NodeSocketData.IsArray ||
             (!socket.NodeSocket.NodeSocketData.IsArray && ((VariableNodeSocket)socket.NodeSocket).Connections.Count == 0)));
 }
        /// <inheritdoc />
        /// <remarks>
        /// Signal out node socket is able to connect to signal in node socket.
        /// </remarks>
        public override ConnectionView MakeConnection(NodeSocketView socket)
        {
            if (socket.Type == NodeSocketType.SignalIn && !this.ContainsConnection(this, socket))
            {
                return(new ConnectionView(this, socket));
            }

            return(null);
        }
 /// <inheritdoc />
 /// <remarks>
 /// Signal out node socket is able to connect to signal in node socket.
 /// </remarks>
 public override bool Connection(NodeSocketView socket)
 {
     if (socket.Type == NodeSocketType.SignalIn)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds the specified view of the node socket.
        /// </summary>
        /// <param name="nodeSocketView">The view of the node socket.</param>
        public void AddSocket(NodeSocketView nodeSocketView)
        {
            if (nodeSocketView.Type == NodeSocketType.SignalIn)
            {
                inSockets.Add(nodeSocketView);
            }
            else if (nodeSocketView.Type == NodeSocketType.SignalOut)
            {
                outSockets.Add(nodeSocketView);
            }
            else
            {
                variableSockets.Add(nodeSocketView);
            }

            UpdateGui();
        }
        /// <inheritdoc />
        /// <remarks>
        /// Variable node is able to connect to variable node socket of the same type if possible.
        /// </remarks>
        public ConnectionView MakeConnection(NodeSocketView socket)
        {
            if (Connection(socket))
            {
                if (socket.Type == NodeSocketType.VariableIn)
                {
                    if (!this.ContainsConnection(this, socket))
                    {
                        return(new ConnectionView(this, socket));
                    }
                }
                else if (socket.Type == NodeSocketType.VariableOut)
                {
                    if (!this.ContainsConnection(socket, this))
                    {
                        return(new ConnectionView(socket, this));
                    }
                }
            }

            return(null);
        }
 /// <inheritdoc />
 /// <remarks>
 /// Variable node socket is not able to connect to other node socket.
 /// </remarks>
 public override ConnectionView MakeConnection(NodeSocketView socket)
 {
     return(null);
 }
 /// <inheritdoc />
 /// <remarks>
 /// Variable node socket is not able to connect to other node socket.
 /// </remarks>
 public override bool Connection(NodeSocketView socket)
 {
     return(false);
 }
 /// <inheritdoc />
 public abstract ConnectionView MakeConnection(NodeSocketView socket);
 /// <inheritdoc />
 public abstract bool Connection(NodeSocketView socket);