Exemplo n.º 1
0
        public List <SearchTreeEntry> CreateSearchTree(SearchWindowContext context)
        {
            _results.Clear();

            _results.Add(new SearchTreeGroupEntry(new GUIContent("Create Node")));

            foreach (var nodeType in _graphType.AvailableNodes)
            {
                // we need to create a node to know what ports it have
                SNode newNode = nodeType.CreateSNode();

                // if we have _fromPort, check that we can connect it to any of the input ports in the newNode
                if (_fromPort == null ||
                    newNode.InputPorts().Any(p => _graphType.FindConnectionType(_fromPort.Type, p.Type) != null))
                {
                    var content     = new GUIContent(ObjectNames.NicifyVariableName(nodeType.Name));
                    var searchEntry = new SearchTreeEntry(content)
                    {
                        level    = 1,
                        userData = newNode
                    };

                    _results.Add(searchEntry);
                }
            }

            return(_results);
        }