public static SearchFilter GetFilter(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); if (savedFilter != null && savedFilter.m_Filter != null) { return(ObjectCopier.DeepClone <SearchFilter>(savedFilter.m_Filter)); } return((SearchFilter)null); }
public static SearchFilter GetFilter(int instanceID) { SavedFilter sf = instance.Find(instanceID); if (sf != null && sf.m_Filter != null) { return(ObjectCopier.DeepClone(sf.m_Filter)); } return(null); }
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); }
public static SearchFilter GetFilter(int instanceID) { SavedFilter savedFilter = ScriptableSingleton <SavedSearchFilters> .instance.Find(instanceID); SearchFilter result; if (savedFilter != null && savedFilter.m_Filter != null) { result = ObjectCopier.DeepClone <SearchFilter>(savedFilter.m_Filter); } else { result = null; } return(result); }
private void UpdateFilter(int instanceID, SearchFilter filter, float previewSize) { SavedFilter savedFilter = this.Find(instanceID); if (savedFilter != null) { if (filter != null) { SearchFilter searchFilter = ObjectCopier.DeepClone <SearchFilter>(filter); savedFilter.m_Filter = searchFilter; } savedFilter.m_PreviewSize = previewSize; this.Changed(); } else { Debug.LogError((object)("Could not find saved filter " + (object)instanceID + " " + ScriptableSingleton <SavedSearchFilters> .instance.ToString())); } }
private void UpdateFilter(int instanceID, SearchFilter filter, float previewSize) { SavedFilter filter2 = this.Find(instanceID); if (filter2 != null) { SearchFilter filter3 = null; if (filter != null) { filter3 = ObjectCopier.DeepClone <SearchFilter>(filter); filter2.m_Filter = filter3; } filter2.m_PreviewSize = previewSize; this.Changed(); } else { Debug.LogError(string.Concat(new object[] { "Could not find saved filter ", instanceID, " ", ScriptableSingleton <SavedSearchFilters> .instance.ToString() })); } }
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); }
void UpdateFilter(int instanceID, SearchFilter filter, float previewSize) { SavedFilter savedFilter = Find(instanceID); if (savedFilter != null) { SearchFilter copiedFilter = null; if (filter != null) { copiedFilter = ObjectCopier.DeepClone(filter); savedFilter.m_Filter = copiedFilter; } savedFilter.m_PreviewSize = previewSize; Changed(); } else { Debug.LogError("Could not find saved filter " + instanceID + " " + instance); } }
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); }