コード例 #1
0
ファイル: Node.cs プロジェクト: tmorgner/xNode
        /// <summary> Return input value for a specified port. Returns fallback value if no ports are connected </summary>
        /// <param name="fieldName">Field name of requested input port</param>
        /// <param name="fallback">If no ports are connected, this value will be returned</param>
        public T GetInputValue <T>(string fieldName, T fallback = default(T))
        {
            NodePort port = GetPort(fieldName);

            if (port != null && port.IsConnected)
            {
                return(port.GetInputValue <T>());
            }
            else
            {
                return(fallback);
            }
        }