private static void FindReferencesIfChanged(BaseAssetBucket bucket, AssetChanges changes, HashSet <string> changedDirectories) { // Skip if bucket is null. if (!bucket) { return; } // Skip if bucket is updated manually. if (bucket.ManualUpdate) { return; } // Skip is no source paths are in the changed directories. string[] sourcePaths = bucket.EDITOR_Sources.Where(o => o).Select(AssetDatabase.GetAssetPath).ToArray(); if (changedDirectories != null && !changedDirectories.Any(bucket.EDITOR_IsValidDirectory)) { return; } // Skip if all imported files already exist in the bucket or can't be added to the bucket. if (changes.MovedFrom.Length == 0 && changes.MovedTo.Length == 0 && changes.Deleted.Length == 0 && changes.Imported.Length < 50) { if (!changes.Imported.Any(bucket.EDITOR_IsMissing)) { return; } } FindReferences(bucket, sourcePaths); }
private static void OnAssetsChanged(AssetChanges changes) { changes.Deleted.ForEach(RemoveFileByPath); changes.MovedFrom.ForEach(RemoveFileByPath); changes.Imported.ForEach(UpdateFileByPath); changes.MovedTo.ForEach(UpdateFileByPath); // Don't need 'MovedTo' since they are included in the 'Imported' list. // changes.MovedTo.ForEach(UpdateFileByPath); RaiseUpdated(changes); }
private static void OnDatabaseChanged(AssetChanges changes) { HashSet <string> changedDirectories = new HashSet <string>(StringComparer.OrdinalIgnoreCase); changes.Imported.ForEach(f => AddPath(f, changedDirectories)); changes.Deleted.ForEach(f => AddPath(f, changedDirectories)); changes.MovedFrom.ForEach(f => AddPath(f, changedDirectories)); changes.MovedTo.ForEach(f => AddPath(f, changedDirectories)); Buckets.ForEach(b => FindReferencesIfChanged(b, changes, changedDirectories)); }
private static void RaiseUpdated(AssetChanges changes = new AssetChanges()) { Updated?.Invoke(changes); }
private void Reselect(AssetChanges changes) { s_LastInfo = null; SelectionChanged(m_SelectedObjects, true); }