示例#1
0
    /// <summary>
    /// Returns all node IDs that can automatically connect to the specified port.
    /// If port is null, all node IDs are returned.
    /// </summary>
    public static List <string> getCompatibleNodes(Port port)
    {
        if (port == null)
        {
            return(NodeTypes.nodes.Keys.ToList());
        }
        List <string> compatibleNodes = new List <string> ();

        foreach (NodeTypeData nodeData in NodeTypes.nodes.Values)
        {         // Iterate over all nodes to check compability of any of their connection ports
            if (PortManager.GetPortDeclarations(nodeData.typeID).Any(
                    (PortDeclaration portDecl) => portDecl.portInfo.IsCompatibleWith(port)))
            {
                compatibleNodes.Add(nodeData.typeID);
            }
        }
        return(compatibleNodes);
    }