Ejemplo n.º 1
0
        public bool SetNewFilter(SearchFilter newFilter)
        {
            bool result = false;

            if (newFilter.m_NameFilter != this.m_NameFilter)
            {
                this.m_NameFilter = newFilter.m_NameFilter;
                result            = true;
            }
            if (newFilter.m_ClassNames != this.m_ClassNames)
            {
                this.m_ClassNames = newFilter.m_ClassNames;
                result            = true;
            }
            if (newFilter.m_Folders != this.m_Folders)
            {
                this.m_Folders = newFilter.m_Folders;
                result         = true;
            }
            if (newFilter.m_VersionControlStates != this.m_VersionControlStates)
            {
                this.m_VersionControlStates = newFilter.m_VersionControlStates;
                result = true;
            }
            if (newFilter.m_SoftLockControlStates != this.m_SoftLockControlStates)
            {
                this.m_SoftLockControlStates = newFilter.m_SoftLockControlStates;
                result = true;
            }
            if (newFilter.m_AssetLabels != this.m_AssetLabels)
            {
                this.m_AssetLabels = newFilter.m_AssetLabels;
                result             = true;
            }
            if (newFilter.m_AssetBundleNames != this.m_AssetBundleNames)
            {
                this.m_AssetBundleNames = newFilter.m_AssetBundleNames;
                result = true;
            }
            if (newFilter.m_ReferencingInstanceIDs != this.m_ReferencingInstanceIDs)
            {
                this.m_ReferencingInstanceIDs = newFilter.m_ReferencingInstanceIDs;
                result = true;
            }
            if (newFilter.m_ScenePaths != this.m_ScenePaths)
            {
                this.m_ScenePaths = newFilter.m_ScenePaths;
                result            = true;
            }
            if (newFilter.m_SearchArea != this.m_SearchArea)
            {
                this.m_SearchArea = newFilter.m_SearchArea;
                result            = true;
            }
            this.m_ShowAllHits = newFilter.m_ShowAllHits;
            return(result);
        }
Ejemplo n.º 2
0
        public bool SetNewFilter(SearchFilter newFilter)
        {
            bool result = false;

            if (newFilter.m_NameFilter != this.m_NameFilter)
            {
                this.m_NameFilter = newFilter.m_NameFilter;
                result            = true;
            }
            if (newFilter.m_ClassNames != this.m_ClassNames)
            {
                this.m_ClassNames = newFilter.m_ClassNames;
                result            = true;
            }
            if (newFilter.m_Folders != this.m_Folders)
            {
                this.m_Folders = newFilter.m_Folders;
                result         = true;
            }
            if (UnityConnect.instance.userInfo.whitelisted && Collab.instance.collabInfo.whitelisted)
            {
                if (newFilter.m_VersionControlStates != this.m_VersionControlStates)
                {
                    this.m_VersionControlStates = newFilter.m_VersionControlStates;
                    result = true;
                }
            }
            if (newFilter.m_AssetLabels != this.m_AssetLabels)
            {
                this.m_AssetLabels = newFilter.m_AssetLabels;
                result             = true;
            }
            if (newFilter.m_AssetBundleNames != this.m_AssetBundleNames)
            {
                this.m_AssetBundleNames = newFilter.m_AssetBundleNames;
                result = true;
            }
            if (newFilter.m_ReferencingInstanceIDs != this.m_ReferencingInstanceIDs)
            {
                this.m_ReferencingInstanceIDs = newFilter.m_ReferencingInstanceIDs;
                result = true;
            }
            if (newFilter.m_ScenePaths != this.m_ScenePaths)
            {
                this.m_ScenePaths = newFilter.m_ScenePaths;
                result            = true;
            }
            if (newFilter.m_SearchArea != this.m_SearchArea)
            {
                this.m_SearchArea = newFilter.m_SearchArea;
                result            = true;
            }
            this.m_ShowAllHits = newFilter.m_ShowAllHits;
            return(result);
        }
        void SearchAllAssets(SearchFilter.SearchArea area)
        {
            const int k_MaxAddCount = 3000;

            if (m_HierarchyType == HierarchyType.Assets)
            {
                List <FilterResult> list = new List <FilterResult>();
                list.AddRange(m_Results);

                var maxAddCount = k_MaxAddCount;
                m_SearchFilter.searchArea = area;
                var enumerator = AssetDatabase.EnumerateAllAssets(m_SearchFilter);
                while (enumerator.MoveNext() && --maxAddCount >= 0)
                {
                    var result = new FilterResult();
                    CopyPropertyData(ref result, enumerator.Current);
                    list.Add(result);
                }

                m_Results = list.ToArray();
            }
            else if (m_HierarchyType == HierarchyType.GameObjects)
            {
                HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);
                property.SetSearchFilter(m_SearchFilter);

                if (m_SearchFilter.sceneHandles != null &&
                    m_SearchFilter.sceneHandles.Length > 0)
                {
                    property.SetCustomScenes(m_SearchFilter.sceneHandles);
                }

                int elements = property.CountRemaining(null);
                elements = Mathf.Min(elements, k_MaxAddCount);
                property.Reset();

                int i = m_Results.Length;
                System.Array.Resize(ref m_Results, m_Results.Length + elements);
                while (property.Next(null) && i < m_Results.Length)
                {
                    CopyPropertyData(ref m_Results[i], property);
                    i++;
                }
            }
        }
Ejemplo n.º 4
0
        public bool SetNewFilter(SearchFilter newFilter)
        {
            bool flag = false;

            if (newFilter.m_NameFilter != this.m_NameFilter)
            {
                this.m_NameFilter = newFilter.m_NameFilter;
                flag = true;
            }
            if (newFilter.m_ClassNames != this.m_ClassNames)
            {
                this.m_ClassNames = newFilter.m_ClassNames;
                flag = true;
            }
            if (newFilter.m_Folders != this.m_Folders)
            {
                this.m_Folders = newFilter.m_Folders;
                flag           = true;
            }
            if (newFilter.m_AssetLabels != this.m_AssetLabels)
            {
                this.m_AssetLabels = newFilter.m_AssetLabels;
                flag = true;
            }
            if (newFilter.m_AssetBundleNames != this.m_AssetBundleNames)
            {
                this.m_AssetBundleNames = newFilter.m_AssetBundleNames;
                flag = true;
            }
            if (newFilter.m_ReferencingInstanceIDs != this.m_ReferencingInstanceIDs)
            {
                this.m_ReferencingInstanceIDs = newFilter.m_ReferencingInstanceIDs;
                flag = true;
            }
            if (newFilter.m_SearchArea != this.m_SearchArea)
            {
                this.m_SearchArea = newFilter.m_SearchArea;
                flag = true;
            }
            this.m_ShowAllHits = newFilter.m_ShowAllHits;
            return(flag);
        }
Ejemplo n.º 5
0
 private void SearchButtonClickedCallback(ExposablePopupMenu.ItemData itemClicked)
 {
   if (itemClicked.m_On)
     return;
   this.SetSearchViewState((ProjectBrowser.SearchViewState) itemClicked.m_UserData);
   if (this.m_SearchFilter.searchArea != SearchFilter.SearchArea.AllAssets && this.m_SearchFilter.searchArea != SearchFilter.SearchArea.SelectedFolders)
     return;
   this.m_LastLocalAssetsSearchArea = this.m_SearchFilter.searchArea;
 }
Ejemplo n.º 6
0
        void SearchAllAssets(SearchFilter.SearchArea area)
        {
            if (m_HierarchyType == HierarchyType.Assets)
            {
                List <FilterResult> list = new List <FilterResult>();
                list.AddRange(m_Results);

                var maxAddCount = maxSearchAddCount;
                m_SearchFilter.searchArea = area;
                var enumerator = AssetDatabase.EnumerateAllAssets(m_SearchFilter);
                while (enumerator.MoveNext() && --maxAddCount >= 0)
                {
                    var result = new FilterResult();
                    CopyPropertyData(ref result, enumerator.Current);
                    list.Add(result);
                }

                m_Results = list.ToArray();
            }
            else if (m_HierarchyType == HierarchyType.GameObjects)
            {
                HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);
                m_SearchSessionHandler.BeginSession(() =>
                {
                    return(new SearchService.HierarchySearchContext
                    {
                        filter = m_SearchFilter,
                        rootProperty = property,
                        requiredTypeNames = m_SearchFilter.classNames,
                        requiredTypes = searchFilter.classNames.Select(name => TypeCache.GetTypesDerivedFrom <Object>().FirstOrDefault(t => name == t.FullName || name == t.Name))
                    });
                });

                var searchQuery   = m_SearchFilter.originalText;
                var searchContext = (SearchService.HierarchySearchContext)m_SearchSessionHandler.context;
                m_SearchSessionHandler.BeginSearch(searchQuery);

                if (m_SearchFilter.sceneHandles != null &&
                    m_SearchFilter.sceneHandles.Length > 0)
                {
                    property.SetCustomScenes(m_SearchFilter.sceneHandles);
                }

                var newResults = new List <FilterResult>();
                while (property.Next(null))
                {
                    if (!SearchService.Scene.Filter(searchQuery, property, searchContext))
                    {
                        continue;
                    }
                    FilterResult newResult = new FilterResult();
                    CopyPropertyData(ref newResult, property);
                    newResults.Add(newResult);
                }
                int elements = newResults.Count;
                elements = Mathf.Min(elements, maxSearchAddCount);

                int i = m_Results.Length;
                System.Array.Resize(ref m_Results, m_Results.Length + elements);
                for (var j = 0; j < elements && i < m_Results.Length; ++j, ++i)
                {
                    m_Results[i] = newResults[j];
                }

                m_SearchSessionHandler.EndSearch();
            }
        }
Ejemplo n.º 7
0
		private void SearchButtonClickedCallback(ExposablePopupMenu.ItemData itemClicked)
		{
			if (!itemClicked.m_On)
			{
				this.SetSearchViewState((ProjectBrowser.SearchViewState)((int)itemClicked.m_UserData));
				if (this.m_SearchFilter.searchArea == SearchFilter.SearchArea.AllAssets || this.m_SearchFilter.searchArea == SearchFilter.SearchArea.SelectedFolders)
				{
					this.m_LastLocalAssetsSearchArea = this.m_SearchFilter.searchArea;
				}
				Analytics.Event("ProjectBrowser", "UserChangedSearchArea", this.m_SearchFilter.searchArea.ToString(), 1);
			}
		}