/// <summary> Add a dynamic, serialized port to this node. </summary>
        /// <seealso cref="AddInstanceInput"/>
        /// <seealso cref="AddInstanceOutput"/>
        private NodePort AddInstancePort(Type type, NodePort.IO direction, ConnectionType connectionType = ConnectionType.Multiple, string fieldName = null)
        {
            if (fieldName == null)
            {
                fieldName = "instanceInput_0";
                int i = 0;
                while (HasPort(fieldName))
                {
                    fieldName = "instanceInput_" + (++i);
                }
            }
            else if (HasPort(fieldName))
            {
                Debug.LogWarning("Port '" + fieldName + "' already exists in " + name, this);
                return(ports[fieldName]);
            }
            NodePort port = new NodePort(fieldName, type, direction, connectionType, this);

            ports.Add(fieldName, port);
            return(port);
        }
示例#2
0
        /// <summary> Add a dynamic, serialized port to this node. </summary>
        /// <seealso cref="AddDynamicInput"/>
        /// <seealso cref="AddDynamicOutput"/>
        private NodePort AddDynamicPort(Type type, NodePort.IO direction, Node.ConnectionType connectionType = Node.ConnectionType.Multiple, Node.TypeConstraint typeConstraint = TypeConstraint.None, string fieldName = null)
        {
            int i = 0;

            if (fieldName == null)
            {
                fieldName = "dynamicInput_0";
                while (HasPort(fieldName))
                {
                    fieldName = "dynamicInput_" + (++i);
                }
            }
            else if (HasPort(fieldName))
            {
                Debug.LogWarning("Port '" + fieldName + "' already exists in " + name, this);
                return(ports[fieldName]);
            }
            NodePort port = new NodePort(fieldName, type, direction, connectionType, typeConstraint, this, i);

            Debug.Log("NEw node at " + i);
            ports.Add(fieldName, port);
            return(port);
        }