int Add(string displayName, SearchFilter filter, float previewSize, int insertAfterInstanceID, bool addAsChild) { SearchFilter filterCopy = null; if (filter != null) { filterCopy = ObjectCopier.DeepClone(filter); } // Clear unused data before saving if (filterCopy.GetState() == SearchFilter.State.SearchingInAllAssets || filterCopy.GetState() == SearchFilter.State.SearchingInAssetsOnly || filterCopy.GetState() == SearchFilter.State.SearchingInPackagesOnly || filterCopy.GetState() == SearchFilter.State.SearchingInAssetStore) { filterCopy.folders = new string[0]; } int afterIndex = 0; // add after root index if (insertAfterInstanceID != 0) { afterIndex = IndexOf(insertAfterInstanceID); if (afterIndex == -1) { Debug.LogError("Invalid insert position"); return(0); } } int depth = m_SavedFilters[afterIndex].m_Depth + (addAsChild ? 1 : 0); SavedFilter savedFilter = new SavedFilter(displayName, filterCopy, depth, previewSize); savedFilter.m_ID = GetNextAvailableID(); if (m_SavedFilters.Count == 0) { m_SavedFilters.Add(savedFilter); } else { m_SavedFilters.Insert(afterIndex + 1, savedFilter); // insert after wanted index } // Select new Saved filter //Selection.activeInstanceID = savedFilter.m_ID; Changed(); return(savedFilter.m_ID); }
void AddResults(HierarchyProperty property) { switch (m_SearchFilter.GetState()) { case SearchFilter.State.FolderBrowsing: FolderBrowsing(property); break; case SearchFilter.State.SearchingInAllAssets: SearchAllAssets(property); break; case SearchFilter.State.SearchingInFolders: SearchInFolders(property); break; case SearchFilter.State.SearchingInAssetStore: /*do nothing*/ break; case SearchFilter.State.EmptySearchFilter: /*do nothing*/ break; default: Debug.LogError("Unhandled enum!"); break; } }
void AddResults() { switch (m_SearchFilter.GetState()) { case SearchFilter.State.FolderBrowsing: FolderBrowsing(); break; case SearchFilter.State.SearchingInAllAssets: SearchAllAssets(SearchFilter.SearchArea.AllAssets); break; case SearchFilter.State.SearchingInAssetsOnly: SearchAllAssets(SearchFilter.SearchArea.InAssetsOnly); break; case SearchFilter.State.SearchingInPackagesOnly: SearchAllAssets(SearchFilter.SearchArea.InPackagesOnly); break; case SearchFilter.State.SearchingInFolders: SearchInFolders(); break; case SearchFilter.State.EmptySearchFilter: /*do nothing*/ break; default: Debug.LogError("Unhandled enum!"); break; } }
private int Add(string displayName, SearchFilter filter, float previewSize, int insertAfterInstanceID, bool addAsChild) { SearchFilter filter2 = null; if (filter != null) { filter2 = ObjectCopier.DeepClone <SearchFilter>(filter); } if ((filter2.GetState() == SearchFilter.State.SearchingInAllAssets) || (filter2.GetState() == SearchFilter.State.SearchingInAssetStore)) { filter2.folders = new string[0]; } int index = 0; if (insertAfterInstanceID != 0) { index = this.IndexOf(insertAfterInstanceID); if (index == -1) { Debug.LogError("Invalid insert position"); return(0); } } int depth = this.m_SavedFilters[index].m_Depth + (!addAsChild ? 0 : 1); SavedFilter item = new SavedFilter(displayName, filter2, depth, previewSize) { m_ID = this.GetNextAvailableID() }; if (this.m_SavedFilters.Count == 0) { this.m_SavedFilters.Add(item); } else { this.m_SavedFilters.Insert(index + 1, item); } this.Changed(); return(item.m_ID); }
private int Add(string displayName, SearchFilter filter, float previewSize, int insertAfterInstanceID, bool addAsChild) { SearchFilter searchFilter = null; if (filter != null) { searchFilter = ObjectCopier.DeepClone <SearchFilter>(filter); } if (searchFilter.GetState() == SearchFilter.State.SearchingInAllAssets || searchFilter.GetState() == SearchFilter.State.SearchingInAssetStore) { searchFilter.folders = new string[0]; } int num = 0; int result; if (insertAfterInstanceID != 0) { num = this.IndexOf(insertAfterInstanceID); if (num == -1) { Debug.LogError("Invalid insert position"); result = 0; return(result); } } int depth = this.m_SavedFilters[num].m_Depth + ((!addAsChild) ? 0 : 1); SavedFilter savedFilter = new SavedFilter(displayName, searchFilter, depth, previewSize); savedFilter.m_ID = this.GetNextAvailableID(); if (this.m_SavedFilters.Count == 0) { this.m_SavedFilters.Add(savedFilter); } else { this.m_SavedFilters.Insert(num + 1, savedFilter); } this.Changed(); result = savedFilter.m_ID; return(result); }