SetSearchFilter() private method

private SetSearchFilter ( SearchFilter filter ) : void
filter SearchFilter
return void
Ejemplo n.º 1
0
        private static IEnumerator <T> FindInFolders <T>(SearchFilter searchFilter, Func <HierarchyProperty,  T> selector)
        {
            foreach (string folderPath in searchFilter.folders)
            {
                var folderInstanceID = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(folderPath);
                var rootPath         = "Assets";

                var pathComponents = folderPath.Split('/');
                // Find the right rootPath if folderPath is part of a package
                if (pathComponents.Length > 1 && pathComponents[0] == UnityEditor.PackageManager.Folders.GetPackagesMountPoint())
                {
                    rootPath = pathComponents[0] + "/" + pathComponents[1];
                }

                // Set empty filter to ensure we search all assets to find folder
                var property = new HierarchyProperty(rootPath);
                property.SetSearchFilter(new SearchFilter());
                if (property.Find(folderInstanceID, null))
                {
                    // Set filter after we found the folder
                    property.SetSearchFilter(searchFilter);
                    int   folderDepth = property.depth;
                    int[] expanded    = null; // enter all children of folder
                    while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                    {
                        yield return(selector(property));
                    }
                }
                else
                {
                    Debug.LogWarning("AssetDatabase.FindAssets: Folder not found: '" + folderPath + "'");
                }
            }
        }
Ejemplo n.º 2
0
        private void SearchInFolders(HierarchyProperty property)
        {
            List <FilteredHierarchy.FilterResult> list = new List <FilteredHierarchy.FilterResult>();

            string[] baseFolders = ProjectWindowUtil.GetBaseFolders(this.m_SearchFilter.folders);
            string[] array       = baseFolders;
            for (int i = 0; i < array.Length; i++)
            {
                string assetPath = array[i];
                property.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(assetPath);
                if (property.Find(mainAssetInstanceID, null))
                {
                    property.SetSearchFilter(this.m_SearchFilter);
                    int   depth    = property.depth;
                    int[] expanded = null;
                    while (property.NextWithDepthCheck(expanded, depth + 1))
                    {
                        FilteredHierarchy.FilterResult item = new FilteredHierarchy.FilterResult();
                        this.CopyPropertyData(ref item, property);
                        list.Add(item);
                    }
                }
            }
            this.m_Results = list.ToArray();
        }
Ejemplo n.º 3
0
        private static string[] SearchInFolders(SearchFilter searchFilter)
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            List <string>     stringList        = new List <string>();

            foreach (string folder in searchFilter.folders)
            {
                hierarchyProperty.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceId = AssetDatabase.GetMainAssetInstanceID(folder);
                if (hierarchyProperty.Find(mainAssetInstanceId, (int[])null))
                {
                    hierarchyProperty.SetSearchFilter(searchFilter);
                    int   depth    = hierarchyProperty.depth;
                    int[] expanded = (int[])null;
                    while (hierarchyProperty.NextWithDepthCheck(expanded, depth + 1))
                    {
                        stringList.Add(hierarchyProperty.guid);
                    }
                }
                else
                {
                    Debug.LogWarning((object)("AssetDatabase.FindAssets: Folder not found: '" + folder + "'"));
                }
            }
            return(stringList.ToArray());
        }
Ejemplo n.º 4
0
        private static string[] SearchInFolders(SearchFilter searchFilter)
        {
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            List <string>     list     = new List <string>();

            foreach (string str in searchFilter.folders)
            {
                property.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceID = GetMainAssetInstanceID(str);
                if (property.Find(mainAssetInstanceID, null))
                {
                    property.SetSearchFilter(searchFilter);
                    int   depth    = property.depth;
                    int[] expanded = null;
                    while (property.NextWithDepthCheck(expanded, depth + 1))
                    {
                        list.Add(property.guid);
                    }
                }
                else
                {
                    Debug.LogWarning("AssetDatabase.FindAssets: Folder not found: '" + str + "'");
                }
            }
            return(list.ToArray());
        }
Ejemplo n.º 5
0
        void SearchInFolders(HierarchyProperty property)
        {
            List <FilterResult> list = new List <FilterResult>();

            string[] baseFolders = ProjectWindowUtil.GetBaseFolders(m_SearchFilter.folders);

            foreach (string folderPath in baseFolders)
            {
                // Ensure we do not have a filter when finding folder
                property.SetSearchFilter(new SearchFilter());

                int folderInstanceID = AssetDatabase.GetMainAssetInstanceID(folderPath);
                if (property.Find(folderInstanceID, null))
                {
                    // Set filter after we found the folder
                    property.SetSearchFilter(m_SearchFilter);
                    int   folderDepth = property.depth;
                    int[] expanded    = null; // enter all children of folder
                    while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                    {
                        FilterResult result = new FilterResult();
                        CopyPropertyData(ref result, property);
                        list.Add(result);
                    }
                }
            }
            m_Results = list.ToArray();
        }
Ejemplo n.º 6
0
        private static string[] SearchInFolders(SearchFilter searchFilter)
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            List <string>     list = new List <string>();

            string[] folders = searchFilter.folders;
            for (int i = 0; i < folders.Length; i++)
            {
                string text = folders[i];
                hierarchyProperty.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(text);
                if (hierarchyProperty.Find(mainAssetInstanceID, null))
                {
                    hierarchyProperty.SetSearchFilter(searchFilter);
                    int   depth    = hierarchyProperty.depth;
                    int[] expanded = null;
                    while (hierarchyProperty.NextWithDepthCheck(expanded, depth + 1))
                    {
                        list.Add(hierarchyProperty.guid);
                    }
                }
                else
                {
                    Debug.LogWarning("AssetDatabase.FindAssets: Folder not found: '" + text + "'");
                }
            }
            return(list.ToArray());
        }
Ejemplo n.º 7
0
        private static string[] SearchInFolders(SearchFilter searchFilter)
        {
            var property = new HierarchyProperty(HierarchyType.Assets);
            var guids    = new List <string>();

            foreach (string folderPath in searchFilter.folders)
            {
                // Set empty filter to ensure we search all assets to find folder
                property.SetSearchFilter(new SearchFilter());
                int folderInstanceID = GetMainAssetInstanceID(folderPath);
                if (property.Find(folderInstanceID, null))
                {
                    // Set filter after we found the folder
                    property.SetSearchFilter(searchFilter);
                    int   folderDepth = property.depth;
                    int[] expanded    = null; // enter all children of folder
                    while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                    {
                        guids.Add(property.guid);
                    }
                }
                else
                {
                    Debug.LogWarning("AssetDatabase.FindAssets: Folder not found: '" + folderPath + "'");
                }
            }
            return(guids.ToArray());
        }
        private static IEnumerator <T> FindInFolders <T>(SearchFilter searchFilter, Func <HierarchyProperty,  T> selector)
        {
            var folders = new List <string>();

            folders.AddRange(searchFilter.folders);
            if (folders.Remove(PackageManager.Folders.GetPackagesMountPoint()))
            {
                var packages = PackageManager.Packages.GetAll();
                foreach (var package in packages)
                {
                    if (package.source == PackageManager.PackageSource.BuiltIn)
                    {
                        continue;
                    }

                    if (!folders.Contains(package.assetPath))
                    {
                        folders.Add(package.assetPath);
                    }
                }
            }

            foreach (string folderPath in folders)
            {
                var folderInstanceID = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(folderPath);
                var rootPath         = "Assets";

                // Find the right rootPath if folderPath is part of a package
                var packageInfo = PackageManager.Packages.GetForAssetPath(folderPath);
                if (packageInfo != null)
                {
                    rootPath = packageInfo.assetPath;
                }

                // Set empty filter to ensure we search all assets to find folder
                var property = new HierarchyProperty(rootPath);
                property.SetSearchFilter(new SearchFilter());
                if (property.Find(folderInstanceID, null))
                {
                    // Set filter after we found the folder
                    property.SetSearchFilter(searchFilter);
                    int   folderDepth = property.depth;
                    int[] expanded    = null; // enter all children of folder
                    while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                    {
                        yield return(selector(property));
                    }
                }
                else
                {
                    Debug.LogWarning("AssetDatabase.FindAssets: Folder not found: '" + folderPath + "'");
                }
            }
        }
Ejemplo n.º 9
0
        private static IEnumerator <T> FindInFolders <T>(SearchFilter searchFilter, Func <HierarchyProperty,  T> selector)
        {
            var folders = new List <string>();

            folders.AddRange(searchFilter.folders);
            if (folders.Remove(PackageManager.Folders.GetPackagesPath()))
            {
                var packages = PackageManagerUtilityInternal.GetAllVisiblePackages(searchFilter.skipHidden);
                foreach (var package in packages)
                {
                    if (!folders.Contains(package.assetPath))
                    {
                        folders.Add(package.assetPath);
                    }
                }
            }

            foreach (var folderPath in folders)
            {
                var sanitizedFolderPath = folderPath.ConvertSeparatorsToUnity().TrimTrailingSlashes();
                var folderInstanceID    = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(sanitizedFolderPath);
                var rootPath            = "Assets";

                // Find the right rootPath if folderPath is part of a package
                var packageInfo = PackageManager.PackageInfo.FindForAssetPath(sanitizedFolderPath);
                if (packageInfo != null)
                {
                    rootPath = packageInfo.assetPath;
                    if (searchFilter.skipHidden && !PackageManagerUtilityInternal.IsPathInVisiblePackage(rootPath))
                    {
                        continue;
                    }
                }

                // Set empty filter to ensure we search all assets to find folder
                var property = new HierarchyProperty(rootPath);
                property.SetSearchFilter(new SearchFilter());
                if (property.Find(folderInstanceID, null))
                {
                    // Set filter after we found the folder
                    property.SetSearchFilter(searchFilter);
                    int   folderDepth = property.depth;
                    int[] expanded    = null; // enter all children of folder
                    while (property.NextWithDepthCheck(expanded, folderDepth + 1))
                    {
                        yield return(selector(property));
                    }
                }
                else
                {
                    Debug.LogWarning("AssetDatabase.FindAssets: Folder not found: '" + sanitizedFolderPath + "'");
                }
            }
        }
        static void SetFilter(HierarchyProperty hierarchy, string filter)
        {
            SearchFilter search = new SearchFilter();

            SearchUtility.ParseSearchString(filter, search);
            hierarchy.SetSearchFilter(search);
        }
Ejemplo n.º 11
0
        private static IEnumerator <T> FindEverywhere <T>(SearchFilter searchFilter, Func <HierarchyProperty, T> selector)
        {
            var rootPaths = new List <string>();

            if (searchFilter.searchArea == SearchFilter.SearchArea.AllAssets ||
                searchFilter.searchArea == SearchFilter.SearchArea.InAssetsOnly)
            {
                rootPaths.Add("Assets");
            }
            if (searchFilter.searchArea == SearchFilter.SearchArea.AllAssets ||
                searchFilter.searchArea == SearchFilter.SearchArea.InPackagesOnly)
            {
                var packages = PackageManagerUtilityInternal.GetAllVisiblePackages();
                foreach (var package in packages)
                {
                    rootPaths.Add(package.assetPath);
                }
            }
            foreach (var rootPath in rootPaths)
            {
                var property = new HierarchyProperty(rootPath);
                property.SetSearchFilter(searchFilter);
                while (property.Next(null))
                {
                    yield return(selector(property));
                }
            }
        }
Ejemplo n.º 12
0
        void FolderBrowsing()
        {
            // We are not concerned with assets being added multiple times as we only show the contents
            // of each selected folder. This is an issue when searching recursively into child folders.
            List <FilterResult> list = new List <FilterResult>();

            foreach (string folderPath in m_SearchFilter.folders)
            {
                int folderInstanceID       = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(folderPath);
                HierarchyProperty property = new HierarchyProperty(folderPath);
                property.SetSearchFilter(m_SearchFilter);

                int   folderDepth = property.depth;
                int[] expanded    = { folderInstanceID };
                while (property.Next(expanded))
                {
                    if (property.depth <= folderDepth)
                    {
                        break; // current property is outside folder
                    }
                    FilterResult result = new FilterResult();
                    CopyPropertyData(ref result, property);
                    list.Add(result);

                    // Fetch sub assets by expanding the main asset (ignore folders)
                    if (property.hasChildren && !property.isFolder)
                    {
                        System.Array.Resize(ref expanded, expanded.Length + 1);
                        expanded[expanded.Length - 1] = property.instanceID;
                    }
                }
            }
            m_Results = list.ToArray();
        }
        private static IEnumerator <T> FindEverywhere <T>(SearchFilter searchFilter, Func <HierarchyProperty, T> selector)
        {
            var rootPaths = new List <string>();

            rootPaths.Add("Assets");
            var packages = PackageManager.Packages.GetAll();

            foreach (var package in packages)
            {
                if (package.source == PackageManager.PackageSource.BuiltIn)
                {
                    continue;
                }

                rootPaths.Add(package.assetPath);
            }
            foreach (var rootPath in rootPaths)
            {
                var property = new HierarchyProperty(rootPath);
                property.SetSearchFilter(searchFilter);
                while (property.Next(null))
                {
                    yield return(selector(property));
                }
            }
        }
Ejemplo n.º 14
0
            public override void FetchData()
            {
                int depth = -1;

                base.m_RootItem = new TreeViewItem(0x3c34eb12, depth, null, "InvisibleRoot");
                base.expandedIDs.Add(base.m_RootItem.id);
                HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
                SearchFilter      filter   = new SearchFilter();

                filter.classNames = new string[] { "AudioMixerController" };
                property.SetSearchFilter(filter);
                List <AudioMixerController> list = new List <AudioMixerController>();

                while (property.Next(null))
                {
                    AudioMixerController pptrValue = property.pptrValue as AudioMixerController;
                    bool flag = AudioMixerController.CheckForCyclicReferences(this.ignoreThisController, pptrValue.outputAudioMixerGroup);
                    if (((pptrValue != null) && (pptrValue != this.ignoreThisController)) && !flag)
                    {
                        list.Add(pptrValue);
                    }
                }
                List <TreeViewItem> list2 = new List <TreeViewItem> {
                    new TreeViewItem(0, 0, base.m_RootItem, AudioMixerGroupSelector.s_NoneText)
                };

                foreach (AudioMixerController controller2 in list)
                {
                    list2.Add(this.BuildSubTree(controller2));
                }
                base.m_RootItem.children = list2;
                this.SetExpandedIDs(base.expandedIDs.ToArray());
            }
        public override void FetchData()
        {
            Profiler.BeginSample("SceneHierarchyWindow.FetchData");
            int               depth            = 0;
            double            timeSinceStartup = EditorApplication.timeSinceStartup;
            HierarchyProperty property         = new HierarchyProperty(HierarchyType.GameObjects);

            property.Reset();
            property.alphaSorted = this.IsUsingAlphaSort();
            if (this.m_RootInstanceID != 0)
            {
                bool   flag        = property.Find(this.m_RootInstanceID, null);
                string displayName = !flag ? "RootOfSceneHierarchy" : property.name;
                base.m_RootItem = new GameObjectTreeViewItem(this.m_RootInstanceID, depth, null, displayName);
                if (!flag)
                {
                    Debug.LogError("Root gameobject with id " + this.m_RootInstanceID + " not found!!");
                }
            }
            else
            {
                base.m_RootItem = new GameObjectTreeViewItem(this.m_RootInstanceID, depth, null, "RootOfSceneHierarchy");
            }
            if (!base.showRootNode)
            {
                this.SetExpanded(base.m_RootItem, true);
            }
            bool hasSearchString = !string.IsNullOrEmpty(this.m_SearchString);

            if (hasSearchString)
            {
                property.SetSearchFilter(this.m_SearchString, this.m_SearchMode);
            }
            base.m_VisibleRows = this.CalcVisibleItems(property, hasSearchString);
            this.m_NeedsChildParentReferenceSetup = true;
            base.m_NeedRefreshVisibleFolders      = false;
            if ((this.sortingState.sortingObject != null) && this.sortingState.implementsCompare)
            {
                this.SortVisibleRows();
            }
            double num3 = EditorApplication.timeSinceStartup;
            double num4 = num3 - timeSinceStartup;
            double num5 = num3 - this.m_LastFetchTime;

            if ((num5 > 0.1) && (num4 > 0.05))
            {
                this.m_DelayedFetches++;
            }
            else
            {
                this.m_DelayedFetches = 0;
            }
            this.m_LastFetchTime = timeSinceStartup;
            base.m_TreeView.SetSelection(Selection.instanceIDs, false);
            if (SceneHierarchyWindow.s_Debug)
            {
                Debug.Log(string.Concat(new object[] { "Fetch time: ", num4 * 1000.0, " ms, alphaSort = ", this.IsUsingAlphaSort() }));
            }
            Profiler.EndSample();
        }
        public override void FetchData()
        {
            Profiler.BeginSample("SceneHierarchyWindow.FetchData");
            this.m_RowsPartiallyInitialized = false;
            double            timeSinceStartup  = EditorApplication.timeSinceStartup;
            HierarchyProperty hierarchyProperty = this.CreateHierarchyProperty();

            if (this.m_RootInstanceID != 0 && !hierarchyProperty.Find(this.m_RootInstanceID, null))
            {
                Debug.LogError("Root gameobject with id " + this.m_RootInstanceID + " not found!!");
                this.m_RootInstanceID = 0;
                hierarchyProperty.Reset();
            }
            this.CreateRootItem(hierarchyProperty);
            this.m_NeedRefreshVisibleFolders      = false;
            this.m_NeedsChildParentReferenceSetup = true;
            bool flag  = this.m_RootInstanceID != 0;
            bool flag2 = !string.IsNullOrEmpty(this.m_SearchString);

            if (flag2 || flag)
            {
                if (flag2)
                {
                    hierarchyProperty.SetSearchFilter(this.m_SearchString, this.m_SearchMode);
                }
                this.InitializeProgressivly(hierarchyProperty, flag, flag2);
            }
            else
            {
                this.InitializeMinimal();
            }
            double timeSinceStartup2 = EditorApplication.timeSinceStartup;
            double num  = timeSinceStartup2 - timeSinceStartup;
            double num2 = timeSinceStartup2 - this.m_LastFetchTime;

            if (num2 > 0.1 && num > 0.05)
            {
                this.m_DelayedFetches++;
            }
            else
            {
                this.m_DelayedFetches = 0;
            }
            this.m_LastFetchTime = timeSinceStartup;
            this.m_TreeView.SetSelection(Selection.instanceIDs, false);
            this.CreateSceneHeaderItems();
            if (SceneHierarchyWindow.s_Debug)
            {
                Debug.Log(string.Concat(new object[]
                {
                    "Fetch time: ",
                    num * 1000.0,
                    " ms, alphaSort = ",
                    this.IsUsingAlphaSort()
                }));
            }
            Profiler.EndSample();
        }
        void FolderBrowsing()
        {
            // We are not concerned with assets being added multiple times as we only show the contents
            // of each selected folder. This is an issue when searching recursively into child folders.
            List <FilterResult> list = new List <FilterResult>();
            HierarchyProperty   property;

            foreach (string folderPath in m_SearchFilter.folders)
            {
                if (folderPath == PackageManager.Folders.GetPackagesPath())
                {
                    var packages = PackageManagerUtilityInternal.GetAllVisiblePackages(m_SearchFilter.skipHidden);
                    foreach (var package in packages)
                    {
                        var packageFolderInstanceId = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(package.assetPath);
                        property = new HierarchyProperty(package.assetPath);
                        if (property.Find(packageFolderInstanceId, null))
                        {
                            FilterResult result = new FilterResult();
                            CopyPropertyData(ref result, property);
                            result.name = !string.IsNullOrEmpty(package.displayName) ? package.displayName : package.name;
                            list.Add(result);
                        }
                    }
                    continue;
                }

                if (m_SearchFilter.skipHidden && !PackageManagerUtilityInternal.IsPathInVisiblePackage(folderPath))
                {
                    continue;
                }

                int folderInstanceID = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID(folderPath);
                property = new HierarchyProperty(folderPath);
                property.SetSearchFilter(m_SearchFilter);

                int   folderDepth = property.depth;
                int[] expanded    = { folderInstanceID };
                while (property.Next(expanded))
                {
                    if (property.depth <= folderDepth)
                    {
                        break; // current property is outside folder
                    }
                    FilterResult result = new FilterResult();
                    CopyPropertyData(ref result, property);
                    list.Add(result);

                    // Fetch sub assets by expanding the main asset (ignore folders)
                    if (property.hasChildren && !property.isFolder)
                    {
                        System.Array.Resize(ref expanded, expanded.Length + 1);
                        expanded[expanded.Length - 1] = property.instanceID;
                    }
                }
            }
            m_Results = list.ToArray();
        }
Ejemplo n.º 18
0
        public override void FetchData()
        {
            Profiler.BeginSample("SceneHierarchyWindow.FetchData");
            this.m_RowsPartiallyInitialized = false;
            double            timeSinceStartup = EditorApplication.timeSinceStartup;
            HierarchyProperty property         = this.CreateHierarchyProperty();

            if ((this.m_RootInstanceID != 0) && !property.Find(this.m_RootInstanceID, null))
            {
                Debug.LogError("Root gameobject with id " + this.m_RootInstanceID + " not found!!");
                this.m_RootInstanceID = 0;
                property.Reset();
            }
            this.CreateRootItem(property);
            base.m_NeedRefreshVisibleFolders      = false;
            this.m_NeedsChildParentReferenceSetup = true;
            bool subTreeWanted = this.m_RootInstanceID != 0;
            bool isSearching   = !string.IsNullOrEmpty(this.m_SearchString);
            bool flag4         = (this.sortingState.sortingObject != null) && this.sortingState.implementsCompare;

            if ((isSearching || flag4) || subTreeWanted)
            {
                if (isSearching)
                {
                    property.SetSearchFilter(this.m_SearchString, this.m_SearchMode);
                }
                this.InitializeProgressivly(property, subTreeWanted, isSearching);
                if (flag4)
                {
                    this.SortVisibleRows();
                }
            }
            else
            {
                this.InitializeMinimal();
            }
            double num2 = EditorApplication.timeSinceStartup;
            double num3 = num2 - timeSinceStartup;
            double num4 = num2 - this.m_LastFetchTime;

            if ((num4 > 0.1) && (num3 > 0.05))
            {
                this.m_DelayedFetches++;
            }
            else
            {
                this.m_DelayedFetches = 0;
            }
            this.m_LastFetchTime = timeSinceStartup;
            base.m_TreeView.SetSelection(Selection.instanceIDs, false);
            this.CreateSceneHeaderItems();
            if (SceneHierarchyWindow.s_Debug)
            {
                Debug.Log(string.Concat(new object[] { "Fetch time: ", num3 * 1000.0, " ms, alphaSort = ", this.IsUsingAlphaSort() }));
            }
            Profiler.EndSample();
        }
        public override void FetchData()
        {
            Profiler.BeginSample("SceneHierarchyWindow.FetchData");
            this.m_RowsPartiallyInitialized = false;
            double            timeSinceStartup1 = EditorApplication.timeSinceStartup;
            HierarchyProperty hierarchyProperty = this.CreateHierarchyProperty();

            if (this.m_RootInstanceID != 0 && !hierarchyProperty.Find(this.m_RootInstanceID, (int[])null))
            {
                Debug.LogError((object)("Root gameobject with id " + (object)this.m_RootInstanceID + " not found!!"));
                this.m_RootInstanceID = 0;
                hierarchyProperty.Reset();
            }
            this.CreateRootItem(hierarchyProperty);
            this.m_NeedRefreshVisibleFolders      = false;
            this.m_NeedsChildParentReferenceSetup = true;
            bool subTreeWanted = this.m_RootInstanceID != 0;
            bool isSearching   = !string.IsNullOrEmpty(this.m_SearchString);
            bool flag          = this.sortingState.sortingObject != null && this.sortingState.implementsCompare;

            if (isSearching || flag || subTreeWanted)
            {
                if (isSearching)
                {
                    hierarchyProperty.SetSearchFilter(this.m_SearchString, this.m_SearchMode);
                }
                this.InitializeProgressivly(hierarchyProperty, subTreeWanted, isSearching);
                if (flag)
                {
                    this.SortVisibleRows();
                }
            }
            else
            {
                this.InitializeMinimal();
            }
            double timeSinceStartup2 = EditorApplication.timeSinceStartup;
            double num = timeSinceStartup2 - timeSinceStartup1;

            if (timeSinceStartup2 - this.m_LastFetchTime > 0.1 && num > 0.05)
            {
                ++this.m_DelayedFetches;
            }
            else
            {
                this.m_DelayedFetches = 0;
            }
            this.m_LastFetchTime = timeSinceStartup1;
            this.m_TreeView.SetSelection(Selection.instanceIDs, false);
            this.CreateSceneHeaderItems();
            if (SceneHierarchyWindow.s_Debug)
            {
                Debug.Log((object)("Fetch time: " + (object)(num * 1000.0) + " ms, alphaSort = " + (object)this.IsUsingAlphaSort()));
            }
            Profiler.EndSample();
        }
        static bool AnyTargetMaterialHasChildren(string[] targetPaths)
        {
            GUID[] guids = targetPaths.Select(path => AssetDatabase.GUIDFromAssetPath(path)).ToArray();

            Func <string, bool> HasChildrenInPath = (string rootPath) => {
                var property = new HierarchyProperty(rootPath, false);
                property.SetSearchFilter(new SearchFilter {
                    classNames = new string[] { "Material" }, searchArea = SearchFilter.SearchArea.AllAssets
                });
                while (property.Next(null))
                {
                    GUID parent;
                    var  child = InternalEditorUtility.GetLoadedObjectFromInstanceID(property.GetInstanceIDIfImported()) as Material;
                    if (child)
                    {
                        if (AssetDatabase.IsForeignAsset(child))
                        {
                            continue;
                        }
                        parent = AssetDatabase.GUIDFromAssetPath(AssetDatabase.GetAssetPath(child.parent));
                    }
                    else
                    {
                        var path = AssetDatabase.GUIDToAssetPath(property.guid);
                        if (!path.EndsWith(".mat", StringComparison.OrdinalIgnoreCase))
                        {
                            continue;
                        }
                        parent = EditorMaterialUtility.GetMaterialParentFromFile(path);
                    }

                    for (int i = 0; i < guids.Length; i++)
                    {
                        if (guids[i] == parent)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            };

            if (HasChildrenInPath("Assets"))
            {
                return(true);
            }
            foreach (var package in PackageManagerUtilityInternal.GetAllVisiblePackages(false))
            {
                if (package.source == PackageManager.PackageSource.Local && HasChildrenInPath(package.assetPath))
                {
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 21
0
        private static void ShowAssetsPopupMenu <T>(Rect buttonRect, string typeName, SerializedProperty serializedProperty, string fileExtension, string defaultFieldName) where T : UnityEngine.Object, new()
        {
            GenericMenu genericMenu = new GenericMenu();
            int         num         = (!(serializedProperty.objectReferenceValue != null)) ? 0 : serializedProperty.objectReferenceValue.GetInstanceID();

            genericMenu.AddItem(new GUIContent(defaultFieldName), num == 0, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
            {
                0,
                serializedProperty
            });
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            SearchFilter      searchFilter      = new SearchFilter
            {
                classNames = new string[]
                {
                    typeName
                }
            };

            hierarchyProperty.SetSearchFilter(searchFilter);
            hierarchyProperty.Reset();
            while (hierarchyProperty.Next(null))
            {
                genericMenu.AddItem(new GUIContent(hierarchyProperty.name), hierarchyProperty.instanceID == num, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
                {
                    hierarchyProperty.instanceID,
                    serializedProperty
                });
            }
            int num2 = BaseObjectTools.StringToClassID(typeName);

            if (num2 > 0)
            {
                BuiltinResource[] builtinResourceList = EditorGUIUtility.GetBuiltinResourceList(num2);
                BuiltinResource[] array = builtinResourceList;
                for (int i = 0; i < array.Length; i++)
                {
                    BuiltinResource builtinResource = array[i];
                    genericMenu.AddItem(new GUIContent(builtinResource.m_Name), builtinResource.m_InstanceID == num, new GenericMenu.MenuFunction2(AssetPopupBackend.AssetPopupMenuCallback), new object[]
                    {
                        builtinResource.m_InstanceID,
                        serializedProperty
                    });
                }
            }
            genericMenu.AddSeparator(string.Empty);
            genericMenu.AddItem(new GUIContent("Create New..."), false, delegate
            {
                T t = Activator.CreateInstance <T>();
                ProjectWindowUtil.CreateAsset(t, "New " + typeName + "." + fileExtension);
                serializedProperty.objectReferenceValue = t;
                serializedProperty.m_SerializedObject.ApplyModifiedProperties();
            });
            genericMenu.DropDown(buttonRect);
        }
Ejemplo n.º 22
0
 public void ResultsChanged()
 {
     this.m_Results = new FilterResult[0];
     if (this.m_SearchFilter.GetState() != SearchFilter.State.EmptySearchFilter)
     {
         HierarchyProperty property = new HierarchyProperty(this.m_HierarchyType);
         property.SetSearchFilter(this.m_SearchFilter);
         this.AddResults(property);
         if (this.m_SearchFilter.IsSearching())
         {
             if (< > f__am$cache5 == null)
             {
 private static List<UnityEngine.Object> FindAssetsOfType(string[] classNames)
 {
   HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
   hierarchyProperty.SetSearchFilter(new SearchFilter()
   {
     classNames = classNames
   });
   List<UnityEngine.Object> objectList = new List<UnityEngine.Object>();
   while (hierarchyProperty.Next((int[]) null))
     objectList.Add(hierarchyProperty.pptrValue);
   return objectList;
 }
Ejemplo n.º 24
0
        private static string[] SearchAllAssets(SearchFilter searchFilter)
        {
            var property = new HierarchyProperty(HierarchyType.Assets);

            property.SetSearchFilter(searchFilter);
            property.Reset();
            var guids = new List <string>();

            while (property.Next(null))
            {
                guids.Add(property.guid);
            }
            return(guids.ToArray());
        }
Ejemplo n.º 25
0
        public void ResultsChanged()
        {
            m_Results = new FilterResult[0];
            if (m_SearchFilter.GetState() != SearchFilter.State.EmptySearchFilter)
            {
                HierarchyProperty hierarchyProperty = new HierarchyProperty(m_HierarchyType, false);
                hierarchyProperty.SetSearchFilter(m_SearchFilter);
                AddResults(hierarchyProperty);

                // When filtering on folder we use the order we get from BaseHiearchyProperty.cpp (to keep indented children under parent) otherwise we sort
                if (m_SearchFilter.IsSearching())
                {
                    System.Array.Sort(m_Results, (result1, result2) => EditorUtility.NaturalCompare(result1.name, result2.name));
                }

                if (foldersFirst)
                {
                    for (int nonFolderPos = 0; nonFolderPos < m_Results.Length; ++nonFolderPos)
                    {
                        if (m_Results[nonFolderPos].isFolder)
                        {
                            continue;
                        }

                        for (int folderPos = nonFolderPos + 1; folderPos < m_Results.Length; ++folderPos)
                        {
                            if (!m_Results[folderPos].isFolder)
                            {
                                continue;
                            }

                            FilterResult folder = m_Results[folderPos];
                            int          length = folderPos - nonFolderPos;
                            System.Array.Copy(m_Results, nonFolderPos, m_Results, nonFolderPos + 1, length);
                            m_Results[nonFolderPos] = folder;
                            break;
                        }
                    }
                }
            }
            else
            {
                // Reset visible flags if filter string is empty (see BaseHiearchyProperty::SetSearchFilter)
                if (m_HierarchyType == HierarchyType.GameObjects)
                {
                    HierarchyProperty gameObjects = new HierarchyProperty(HierarchyType.GameObjects, false);
                    gameObjects.SetSearchFilter(m_SearchFilter);
                }
            }
        }
Ejemplo n.º 26
0
        private void SearchInFolders(HierarchyProperty property)
        {
            List <FilteredHierarchy.FilterResult> filterResultList = new List <FilteredHierarchy.FilterResult>();

            foreach (string baseFolder in ProjectWindowUtil.GetBaseFolders(this.m_SearchFilter.folders))
            {
                property.SetSearchFilter(new SearchFilter());
                int mainAssetInstanceId = AssetDatabase.GetMainAssetInstanceID(baseFolder);
                if (property.Find(mainAssetInstanceId, (int[])null))
                {
                    property.SetSearchFilter(this.m_SearchFilter);
                    int   depth    = property.depth;
                    int[] expanded = (int[])null;
                    while (property.NextWithDepthCheck(expanded, depth + 1))
                    {
                        FilteredHierarchy.FilterResult result = new FilteredHierarchy.FilterResult();
                        this.CopyPropertyData(ref result, property);
                        filterResultList.Add(result);
                    }
                }
            }
            this.m_Results = filterResultList.ToArray();
        }
Ejemplo n.º 27
0
 private static List<UnityEngine.Object> FindAssetsOfType(string[] classNames)
 {
     HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
     SearchFilter filter = new SearchFilter {
         classNames = classNames
     };
     property.SetSearchFilter(filter);
     List<UnityEngine.Object> list = new List<UnityEngine.Object>();
     while (property.Next(null))
     {
         list.Add(property.pptrValue);
     }
     return list;
 }
Ejemplo n.º 28
0
        private static string[] SearchAllAssets(SearchFilter searchFilter)
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);

            hierarchyProperty.SetSearchFilter(searchFilter);
            hierarchyProperty.Reset();
            List <string> list = new List <string>();

            while (hierarchyProperty.Next(null))
            {
                list.Add(hierarchyProperty.guid);
            }
            return(list.ToArray());
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Update the scene blackboard's instance ids.
        /// </summary>
        static void UpdateSceneInstanceIDs () {
            // The HierarchyProperty is an undocumented class very uesfull to get all GameObjects in the scene or assets in the project
            var hierarchyProperty = new HierarchyProperty (HierarchyType.GameObjects);
            // Search for Blackboards
            hierarchyProperty.SetSearchFilter("internalblackboard", (int)SearchableEditorWindow.SearchModeHierarchyWindow.Type);
            // Reset the list of game Object instance ids
            s_SceneInstanceIDs.Clear();

            // Go through all objects
            while (hierarchyProperty.Next(null)) {
                // Populate the GameObject instanceID list
                s_SceneInstanceIDs.Add(hierarchyProperty.instanceID);
            }
        }
Ejemplo n.º 30
0
        static List <UnityEngine.Object> FindAssetsOfType(string[] classNames)
        {
            var prop = new HierarchyProperty(HierarchyType.Assets);

            prop.SetSearchFilter(new SearchFilter()
            {
                classNames = classNames
            });
            var objs = new List <UnityEngine.Object>();

            while (prop.Next(null))
            {
                objs.Add(prop.pptrValue);
            }
            return(objs);
        }
Ejemplo n.º 31
0
        private static IEnumerator <T> FindEverywhere <T>(SearchFilter searchFilter, Func <HierarchyProperty, T> selector)
        {
            var rootPaths = new List <string>();

            rootPaths.Add("Assets");
            rootPaths.AddRange(UnityEditor.PackageManager.Folders.GetPackagesPaths());
            foreach (var rootPath in rootPaths)
            {
                var property = new HierarchyProperty(rootPath);
                property.SetSearchFilter(searchFilter);
                while (property.Next(null))
                {
                    yield return(selector(property));
                }
            }
        }
        private static List <UnityEngine.Object> FindAssetsOfType(string[] classNames)
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);

            hierarchyProperty.SetSearchFilter(new SearchFilter
            {
                classNames = classNames
            });
            List <UnityEngine.Object> list = new List <UnityEngine.Object>();

            while (hierarchyProperty.Next(null))
            {
                list.Add(hierarchyProperty.pptrValue);
            }
            return(list);
        }
Ejemplo n.º 33
0
        private static List <Object> FindAssetsOfType(string[] classNames)
        {
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            SearchFilter      filter   = new SearchFilter {
                classNames = classNames
            };

            property.SetSearchFilter(filter);
            List <Object> list = new List <Object>();

            while (property.Next(null))
            {
                list.Add(property.pptrValue);
            }
            return(list);
        }
Ejemplo n.º 34
0
 public void ResultsChanged()
 {
     this.m_Results = new FilterResult[0];
     if (this.m_SearchFilter.GetState() != SearchFilter.State.EmptySearchFilter)
     {
         HierarchyProperty property = new HierarchyProperty(this.m_HierarchyType);
         property.SetSearchFilter(this.m_SearchFilter);
         this.AddResults(property);
         if (this.m_SearchFilter.IsSearching())
         {
             if (<>f__am$cache5 == null)
             {
Ejemplo n.º 35
0
	public static List<string> FindAllTextAssets()
	{
		var hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
		hierarchyProperty.SetSearchFilter("t:TextAsset", 0);
		hierarchyProperty.Reset();
		List<string> list = new List<string>();
		while (hierarchyProperty.Next(null))
			list.Add(hierarchyProperty.guid);
		return list;
	}
Ejemplo n.º 36
0
 public override void FetchData()
 {
     int depth = -1;
     base.m_RootItem = new TreeViewItem(0x3c34eb12, depth, null, "InvisibleRoot");
     base.expandedIDs.Add(base.m_RootItem.id);
     HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
     SearchFilter filter = new SearchFilter();
     filter.classNames = new string[] { "AudioMixerController" };
     property.SetSearchFilter(filter);
     List<AudioMixerController> list = new List<AudioMixerController>();
     while (property.Next(null))
     {
         AudioMixerController pptrValue = property.pptrValue as AudioMixerController;
         bool flag = AudioMixerController.CheckForCyclicReferences(this.ignoreThisController, pptrValue.outputAudioMixerGroup);
         if (((pptrValue != null) && (pptrValue != this.ignoreThisController)) && !flag)
         {
             list.Add(pptrValue);
         }
     }
     List<TreeViewItem> list2 = new List<TreeViewItem> {
         new TreeViewItem(0, 0, base.m_RootItem, AudioMixerGroupSelector.s_NoneText)
     };
     foreach (AudioMixerController controller2 in list)
     {
         list2.Add(this.BuildSubTree(controller2));
     }
     base.m_RootItem.children = list2;
     this.SetExpandedIDs(base.expandedIDs.ToArray());
 }
 private void SearchInFolders(HierarchyProperty property)
 {
   List<FilteredHierarchy.FilterResult> filterResultList = new List<FilteredHierarchy.FilterResult>();
   foreach (string baseFolder in ProjectWindowUtil.GetBaseFolders(this.m_SearchFilter.folders))
   {
     property.SetSearchFilter(new SearchFilter());
     int mainAssetInstanceId = AssetDatabase.GetMainAssetInstanceID(baseFolder);
     if (property.Find(mainAssetInstanceId, (int[]) null))
     {
       property.SetSearchFilter(this.m_SearchFilter);
       int depth = property.depth;
       int[] expanded = (int[]) null;
       while (property.NextWithDepthCheck(expanded, depth + 1))
       {
         FilteredHierarchy.FilterResult result = new FilteredHierarchy.FilterResult();
         this.CopyPropertyData(ref result, property);
         filterResultList.Add(result);
       }
     }
   }
   this.m_Results = filterResultList.ToArray();
 }
 public void ResultsChanged()
 {
   this.m_Results = new FilteredHierarchy.FilterResult[0];
   if (this.m_SearchFilter.GetState() != SearchFilter.State.EmptySearchFilter)
   {
     HierarchyProperty property = new HierarchyProperty(this.m_HierarchyType);
     property.SetSearchFilter(this.m_SearchFilter);
     this.AddResults(property);
     if (this.m_SearchFilter.IsSearching())
       Array.Sort<FilteredHierarchy.FilterResult>(this.m_Results, (Comparison<FilteredHierarchy.FilterResult>) ((result1, result2) => EditorUtility.NaturalCompare(result1.name, result2.name)));
     if (!this.foldersFirst)
       return;
     for (int sourceIndex = 0; sourceIndex < this.m_Results.Length; ++sourceIndex)
     {
       if (!this.m_Results[sourceIndex].isFolder)
       {
         for (int index = sourceIndex + 1; index < this.m_Results.Length; ++index)
         {
           if (this.m_Results[index].isFolder)
           {
             FilteredHierarchy.FilterResult result = this.m_Results[index];
             int length = index - sourceIndex;
             Array.Copy((Array) this.m_Results, sourceIndex, (Array) this.m_Results, sourceIndex + 1, length);
             this.m_Results[sourceIndex] = result;
             break;
           }
         }
       }
     }
   }
   else
   {
     if (this.m_HierarchyType != HierarchyType.GameObjects)
       return;
     new HierarchyProperty(HierarchyType.GameObjects).SetSearchFilter(this.m_SearchFilter);
   }
 }
			public override void FetchData()
			{
				int depth = -1;
				this.m_RootItem = new TreeViewItem(1010101010, depth, null, "InvisibleRoot");
				base.expandedIDs.Add(this.m_RootItem.id);
				HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
				hierarchyProperty.SetSearchFilter(new SearchFilter
				{
					classNames = new string[]
					{
						"AudioMixerController"
					}
				});
				List<AudioMixerController> list = new List<AudioMixerController>();
				while (hierarchyProperty.Next(null))
				{
					AudioMixerController audioMixerController = hierarchyProperty.pptrValue as AudioMixerController;
					bool flag = AudioMixerController.CheckForCyclicReferences(this.ignoreThisController, audioMixerController.outputAudioMixerGroup);
					if (audioMixerController && audioMixerController != this.ignoreThisController && !flag)
					{
						list.Add(audioMixerController);
					}
				}
				List<TreeViewItem> list2 = new List<TreeViewItem>();
				list2.Add(new TreeViewItem(0, 0, this.m_RootItem, AudioMixerGroupSelector.s_NoneText));
				foreach (AudioMixerController current in list)
				{
					list2.Add(this.BuildSubTree(current));
				}
				this.m_RootItem.children = list2;
				this.SetExpandedIDs(base.expandedIDs.ToArray());
			}
Ejemplo n.º 40
0
	static void SeeAssetsInPrefab(Object prefab,string asset){
		GameObject obj = GameObject.Instantiate (prefab) as GameObject;
		obj.transform.parent = Parent;
		HierarchyProperty h = new HierarchyProperty(HierarchyType.Assets);
		h.SetSearchFilter ("x",0);

	}
			public override void FetchData()
			{
				int depth = -1;
				this.m_RootItem = new TreeViewItem(1010101010, depth, null, "InvisibleRoot");
				this.SetExpanded(this.m_RootItem.id, true);
				List<int> allowedInstanceIDs = ObjectSelector.get.allowedInstanceIDs;
				HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
				hierarchyProperty.SetSearchFilter(new SearchFilter
				{
					classNames = new string[]
					{
						"AudioMixerController"
					}
				});
				List<AudioMixerController> list = new List<AudioMixerController>();
				while (hierarchyProperty.Next(null))
				{
					AudioMixerController audioMixerController = hierarchyProperty.pptrValue as AudioMixerController;
					if (this.ShouldShowController(audioMixerController, allowedInstanceIDs))
					{
						list.Add(audioMixerController);
					}
				}
				List<TreeViewItem> list2 = new List<TreeViewItem>();
				list2.Add(new TreeViewItem(TreeViewForAudioMixerGroup.kNoneItemID, 0, this.m_RootItem, TreeViewForAudioMixerGroup.s_NoneText));
				foreach (AudioMixerController current in list)
				{
					list2.Add(this.BuildSubTree(current));
				}
				this.m_RootItem.children = list2;
				if (list.Count == 1)
				{
					this.m_TreeView.data.SetExpandedWithChildren(this.m_RootItem, true);
				}
				this.m_NeedRefreshVisibleFolders = true;
			}
 private static List<AudioMixerController> FindAllAudioMixerControllers()
 {
   List<AudioMixerController> audioMixerControllerList = new List<AudioMixerController>();
   HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
   hierarchyProperty.SetSearchFilter(new SearchFilter()
   {
     classNames = new string[1]
     {
       "AudioMixerController"
     }
   });
   while (hierarchyProperty.Next((int[]) null))
   {
     AudioMixerController pptrValue = hierarchyProperty.pptrValue as AudioMixerController;
     if ((bool) ((UnityEngine.Object) pptrValue))
       audioMixerControllerList.Add(pptrValue);
   }
   return audioMixerControllerList;
 }
 public override void FetchData()
 {
     int depth = -1;
     base.m_RootItem = new TreeViewItem(0x3c34eb12, depth, null, "InvisibleRoot");
     this.SetExpanded(base.m_RootItem.id, true);
     List<int> allowedInstanceIDs = ObjectSelector.get.allowedInstanceIDs;
     HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
     SearchFilter filter = new SearchFilter();
     filter.classNames = new string[] { "AudioMixerController" };
     property.SetSearchFilter(filter);
     List<AudioMixerController> list2 = new List<AudioMixerController>();
     while (property.Next(null))
     {
         AudioMixerController pptrValue = property.pptrValue as AudioMixerController;
         if (this.ShouldShowController(pptrValue, allowedInstanceIDs))
         {
             list2.Add(pptrValue);
         }
     }
     List<TreeViewItem> list3 = new List<TreeViewItem> {
         new TreeViewItem(TreeViewForAudioMixerGroup.kNoneItemID, 0, base.m_RootItem, TreeViewForAudioMixerGroup.s_NoneText)
     };
     foreach (AudioMixerController controller2 in list2)
     {
         list3.Add(this.BuildSubTree(controller2));
     }
     base.m_RootItem.children = list3;
     if (list2.Count == 1)
     {
         base.m_TreeView.data.SetExpandedWithChildren(base.m_RootItem, true);
     }
     base.m_NeedRefreshVisibleFolders = true;
 }
Ejemplo n.º 44
0
		public void ResultsChanged()
		{
			this.m_Results = new FilteredHierarchy.FilterResult[0];
			if (this.m_SearchFilter.GetState() != SearchFilter.State.EmptySearchFilter)
			{
				HierarchyProperty hierarchyProperty = new HierarchyProperty(this.m_HierarchyType);
				hierarchyProperty.SetSearchFilter(this.m_SearchFilter);
				this.AddResults(hierarchyProperty);
				if (this.m_SearchFilter.IsSearching())
				{
					Array.Sort<FilteredHierarchy.FilterResult>(this.m_Results, (FilteredHierarchy.FilterResult result1, FilteredHierarchy.FilterResult result2) => EditorUtility.NaturalCompare(result1.name, result2.name));
				}
				if (this.foldersFirst)
				{
					for (int i = 0; i < this.m_Results.Length; i++)
					{
						if (!this.m_Results[i].isFolder)
						{
							for (int j = i + 1; j < this.m_Results.Length; j++)
							{
								if (this.m_Results[j].isFolder)
								{
									FilteredHierarchy.FilterResult filterResult = this.m_Results[j];
									int length = j - i;
									Array.Copy(this.m_Results, i, this.m_Results, i + 1, length);
									this.m_Results[i] = filterResult;
									break;
								}
							}
						}
					}
				}
			}
			else
			{
				if (this.m_HierarchyType == HierarchyType.GameObjects)
				{
					HierarchyProperty hierarchyProperty2 = new HierarchyProperty(HierarchyType.GameObjects);
					hierarchyProperty2.SetSearchFilter(this.m_SearchFilter);
				}
			}
		}
		public override void FetchData()
		{
			Profiler.BeginSample("SceneHierarchyWindow.FetchData");
			int depth = 0;
			double timeSinceStartup = EditorApplication.timeSinceStartup;
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.GameObjects);
			hierarchyProperty.Reset();
			hierarchyProperty.alphaSorted = this.IsUsingAlphaSort();
			if (this.m_RootInstanceID != 0)
			{
				bool flag = hierarchyProperty.Find(this.m_RootInstanceID, null);
				string displayName = (!flag) ? "RootOfSceneHierarchy" : hierarchyProperty.name;
				this.m_RootItem = new GameObjectTreeViewItem(this.m_RootInstanceID, depth, null, displayName);
				if (!flag)
				{
					Debug.LogError("Root gameobject with id " + this.m_RootInstanceID + " not found!!");
				}
			}
			else
			{
				this.m_RootItem = new GameObjectTreeViewItem(this.m_RootInstanceID, depth, null, "RootOfSceneHierarchy");
			}
			if (!base.showRootNode)
			{
				this.SetExpanded(this.m_RootItem, true);
			}
			bool flag2 = !string.IsNullOrEmpty(this.m_SearchString);
			if (flag2)
			{
				hierarchyProperty.SetSearchFilter(this.m_SearchString, this.m_SearchMode);
			}
			this.m_VisibleRows = this.CalcVisibleItems(hierarchyProperty, flag2);
			this.m_NeedsChildParentReferenceSetup = true;
			this.m_NeedRefreshVisibleFolders = false;
			if (this.sortingState.sortingObject != null && this.sortingState.implementsCompare)
			{
				this.SortVisibleRows();
			}
			double timeSinceStartup2 = EditorApplication.timeSinceStartup;
			double num = timeSinceStartup2 - timeSinceStartup;
			double num2 = timeSinceStartup2 - this.m_LastFetchTime;
			if (num2 > 0.1 && num > 0.05)
			{
				this.m_DelayedFetches++;
			}
			else
			{
				this.m_DelayedFetches = 0;
			}
			this.m_LastFetchTime = timeSinceStartup;
			this.m_TreeView.SetSelection(Selection.instanceIDs, false);
			if (SceneHierarchyWindow.s_Debug)
			{
				Debug.Log(string.Concat(new object[]
				{
					"Fetch time: ",
					num * 1000.0,
					" ms, alphaSort = ",
					this.IsUsingAlphaSort()
				}));
			}
			Profiler.EndSample();
		}
 public override void FetchData()
 {
   this.m_RootItem = new TreeViewItem(1010101010, -1, (TreeViewItem) null, "InvisibleRoot");
   this.SetExpanded(this.m_RootItem.id, true);
   List<int> allowedInstanceIds = ObjectSelector.get.allowedInstanceIDs;
   HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
   hierarchyProperty.SetSearchFilter(new SearchFilter()
   {
     classNames = new string[1]
     {
       "AudioMixerController"
     }
   });
   List<AudioMixerController> audioMixerControllerList = new List<AudioMixerController>();
   while (hierarchyProperty.Next((int[]) null))
   {
     AudioMixerController pptrValue = hierarchyProperty.pptrValue as AudioMixerController;
     if (this.ShouldShowController(pptrValue, allowedInstanceIds))
       audioMixerControllerList.Add(pptrValue);
   }
   List<TreeViewItem> treeViewItemList = new List<TreeViewItem>();
   treeViewItemList.Add(new TreeViewItem(TreeViewForAudioMixerGroup.kNoneItemID, 0, this.m_RootItem, TreeViewForAudioMixerGroup.s_NoneText));
   using (List<AudioMixerController>.Enumerator enumerator = audioMixerControllerList.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       AudioMixerController current = enumerator.Current;
       treeViewItemList.Add(this.BuildSubTree(current));
     }
   }
   this.m_RootItem.children = treeViewItemList;
   if (audioMixerControllerList.Count == 1)
     this.m_TreeView.data.SetExpandedWithChildren(this.m_RootItem, true);
   this.m_NeedRefreshVisibleFolders = true;
 }
Ejemplo n.º 47
0
		private void SearchInFolders(HierarchyProperty property)
		{
			List<FilteredHierarchy.FilterResult> list = new List<FilteredHierarchy.FilterResult>();
			string[] baseFolders = ProjectWindowUtil.GetBaseFolders(this.m_SearchFilter.folders);
			string[] array = baseFolders;
			for (int i = 0; i < array.Length; i++)
			{
				string assetPath = array[i];
				property.SetSearchFilter(new SearchFilter());
				int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(assetPath);
				if (property.Find(mainAssetInstanceID, null))
				{
					property.SetSearchFilter(this.m_SearchFilter);
					int depth = property.depth;
					int[] expanded = null;
					while (property.NextWithDepthCheck(expanded, depth + 1))
					{
						FilteredHierarchy.FilterResult item = new FilteredHierarchy.FilterResult();
						this.CopyPropertyData(ref item, property);
						list.Add(item);
					}
				}
			}
			this.m_Results = list.ToArray();
		}
Ejemplo n.º 48
0
		private static List<AudioMixerController> FindAllAudioMixerControllers()
		{
			List<AudioMixerController> list = new List<AudioMixerController>();
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			hierarchyProperty.SetSearchFilter(new SearchFilter
			{
				classNames = new string[]
				{
					"AudioMixerController"
				}
			});
			while (hierarchyProperty.Next(null))
			{
				AudioMixerController audioMixerController = hierarchyProperty.pptrValue as AudioMixerController;
				if (audioMixerController)
				{
					list.Add(audioMixerController);
				}
			}
			return list;
		}