private void CopyIsExpanded(HashSet <HierarchyEntry> src, HashSet <HierarchyEntry> dest) { foreach (var entry in src) { HierarchyEntry newEntry = null; if ((newEntry = dest.FirstOrDefault(e => e.Transform == entry.Transform)) != null) { newEntry.IsExpanded = entry.IsExpanded; CopyIsExpanded(entry.Children, newEntry.Children); } } }
private HashSet <HierarchyEntry> Flatten(HierarchyEntry root) { var flattened = new HashSet <HierarchyEntry>() { root }; var children = root.Children; if (children != null) { foreach (var child in children) { flattened.UnionWith(Flatten(child)); } } return(flattened); }
public void RefreshGameObjectList() { var newEntries = new HashSet <HierarchyEntry>(); foreach (var transform in FindObjectsOfType <Transform>()) { if (transform.parent == null) { var entry = new HierarchyEntry(transform); newEntries.Add(entry); } } CopyIsExpanded(inspectorEntries, newEntries); inspectorEntries = newEntries; if (isSearching) { RefreshSearchList(); } }
private bool EntryOrChildrenContain(HierarchyEntry entry, string text) { string toSearch = text.ToLower(); if (entry.Transform == null) { return(false); } if (entry.Transform.name.ToLower().Contains(toSearch)) { return(true); } foreach (var child in entry.Children) { if (EntryOrChildrenContain(child, text)) { return(true); } } return(false); }
private HashSet<HierarchyEntry> Flatten(HierarchyEntry root) { var flattened = new HashSet<HierarchyEntry>() { root }; var children = root.Children; if (children != null) { foreach (var child in children) { flattened.UnionWith(Flatten(child)); } } return flattened; }
private bool EntryOrChildrenContain(HierarchyEntry entry, string text) { string toSearch = text.ToLower(); if (entry.Transform == null) return false; if (entry.Transform.name.ToLower().Contains(toSearch)) return true; foreach (var child in entry.Children) { if (EntryOrChildrenContain(child, text)) return true; } return false; }
public void RefreshGameObjectList() { var newEntries = new HashSet<HierarchyEntry>(); foreach (var transform in FindObjectsOfType<Transform>()) { if (transform.parent == null) { var entry = new HierarchyEntry(transform); newEntries.Add(entry); } } CopyIsExpanded(inspectorEntries, newEntries); inspectorEntries = newEntries; if (isSearching) { RefreshSearchList(); } }