public void ShowInFavoriteSearchFilters() { if (SavedSearchFilters.GetRootInstanceID() == 0) { SavedSearchFilters.AddInitializedListener(ShowInFavoriteSearchFilters); return; } SavedSearchFilters.RemoveInitializedListener(ShowInFavoriteSearchFilters); int prevInstanceID = 0; foreach (var filter in filters) { int instanceID = SavedSearchFilters.GetFilterInstanceID(filter[0], filter[1]); if (instanceID == 0) { SearchFilter searchFilter = SearchFilter.CreateSearchFilterFromString(filter[1]); if (prevInstanceID == 0) { prevInstanceID = SavedSearchFilters.AddSavedFilter(filter[0], searchFilter, 64); } else { prevInstanceID = SavedSearchFilters.AddSavedFilterAfterInstanceID(filter[0], searchFilter, 64, prevInstanceID, false); } } } SavedSearchFilters.RefreshSavedFilters(); foreach (ProjectBrowser pb in ProjectBrowser.GetAllProjectBrowsers()) { pb.Repaint(); } }
public void ShowInFavoriteSearchFilters() { if (SavedSearchFilters.GetRootInstanceID() == 0) { SavedSearchFilters.AddInitializedListener(new Action(this.ShowInFavoriteSearchFilters)); } else { SavedSearchFilters.RemoveInitializedListener(new Action(this.ShowInFavoriteSearchFilters)); int num = 0; foreach (string[] current in this.filters) { if (SavedSearchFilters.GetFilterInstanceID(current[0], current[1]) == 0) { SearchFilter filter = SearchFilter.CreateSearchFilterFromString(current[1]); if (num == 0) { num = SavedSearchFilters.AddSavedFilter(current[0], filter, 64f); } else { num = SavedSearchFilters.AddSavedFilterAfterInstanceID(current[0], filter, 64f, num, false); } } } SavedSearchFilters.RefreshSavedFilters(); foreach (ProjectBrowser current2 in ProjectBrowser.GetAllProjectBrowsers()) { current2.Repaint(); } } }
public void ShowInProjectBrowser(string filterString) { ProjectBrowser browser = ProjectBrowser.s_LastInteractedProjectBrowser; if (browser == null) { List <ProjectBrowser> browsers = ProjectBrowser.GetAllProjectBrowsers(); if (browsers != null && browsers.Count > 0) { browser = browsers.First(); } } if (!string.IsNullOrEmpty(filterString)) { if (browser == null) { browser = EditorWindow.GetWindow <ProjectBrowser>() as ProjectBrowser; ShowInFavoriteSearchFilters(); browser.RepaintImmediately(); } m_SearchFilterWasSet = true; string filterSearchString = "v:" + filterString; if (browser.IsTwoColumns()) { foreach (var filter in filters) { if (filterSearchString == filter[1]) { int instanceID = SavedSearchFilters.GetFilterInstanceID(filter[0], filterSearchString); if (instanceID > ProjectWindowUtil.k_FavoritesStartInstanceID) { browser.SetFolderSelection(new int[] { instanceID }, true); break; } } } } browser.SetSearch(filterSearchString); browser.Repaint(); browser.Focus(); } else { if (m_SearchFilterWasSet) { if (browser != null) { if (browser.IsTwoColumns()) { int instanceID = AssetDatabase.GetMainAssetInstanceID("assets"); browser.SetFolderSelection(new int[] { instanceID }, true); } browser.SetSearch(""); browser.Repaint(); } } m_SearchFilterWasSet = false; } }
public void ShowInProjectBrowser(string filterString) { ProjectBrowser projectBrowser = ProjectBrowser.s_LastInteractedProjectBrowser; if (projectBrowser == null) { List <ProjectBrowser> allProjectBrowsers = ProjectBrowser.GetAllProjectBrowsers(); if (allProjectBrowsers != null && allProjectBrowsers.Count > 0) { projectBrowser = allProjectBrowsers.First <ProjectBrowser>(); } } if (!string.IsNullOrEmpty(filterString)) { if (projectBrowser == null) { projectBrowser = EditorWindow.GetWindow <ProjectBrowser>(); base.ShowInFavoriteSearchFilters(); projectBrowser.RepaintImmediately(); } this.m_SearchFilterWasSet = true; string text = "v:" + filterString; if (projectBrowser.IsTwoColumns()) { foreach (string[] current in base.filters) { if (text == current[1]) { int filterInstanceID = SavedSearchFilters.GetFilterInstanceID(current[0], text); if (filterInstanceID > ProjectWindowUtil.k_FavoritesStartInstanceID) { projectBrowser.SetFolderSelection(new int[] { filterInstanceID }, true); break; } } } } projectBrowser.SetSearch(text); projectBrowser.Repaint(); projectBrowser.Focus(); } else { if (this.m_SearchFilterWasSet) { if (projectBrowser != null) { if (projectBrowser.IsTwoColumns()) { int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID("assets"); projectBrowser.SetFolderSelection(new int[] { mainAssetInstanceID }, true); } projectBrowser.SetSearch(""); projectBrowser.Repaint(); } } this.m_SearchFilterWasSet = false; } }