Next() приватный Метод

private Next ( int expanded ) : bool
expanded int
Результат bool
Пример #1
0
        public string[] GetImplicitProjectViewSelection()
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            bool flag = false;

            string[] result;
            if (!hierarchyProperty.Next(null))
            {
                result = new string[0];
            }
            else
            {
                Hashtable            hashtable = new Hashtable();
                UnityEngine.Object[] objects   = Selection.objects;
                for (int i = 0; i < objects.Length; i++)
                {
                    UnityEngine.Object @object = objects[i];
                    hashtable.Add(@object.GetInstanceID(), null);
                }
                bool       flag2;
                List <int> oneFolderImplicitSelection = this.GetOneFolderImplicitSelection(hierarchyProperty, hashtable, false, ref flag, out flag2);
                string[]   array = new string[oneFolderImplicitSelection.Count];
                for (int j = 0; j < array.Length; j++)
                {
                    array[j] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(oneFolderImplicitSelection[j]));
                }
                result = array;
            }
            return(result);
        }
        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));
                }
            }
        }
Пример #3
0
        // Should return the items that have children from id and below
        protected override HashSet <int> GetParentsBelow(int id)
        {
            // Add all children expanded ids to hashset
            HashSet <int> parentsBelow = new HashSet <int>();

            if (!IsValidHierarchyInstanceID(id))
            {
                return(parentsBelow);
            }

            IHierarchyProperty search = new HierarchyProperty(k_HierarchyType);

            if (search.Find(id, null))
            {
                parentsBelow.Add(id);

                int depth = search.depth;
                while (search.Next(null) && search.depth > depth)
                {
                    if (search.hasChildren)
                    {
                        parentsBelow.Add(search.instanceID);
                    }
                }
            }
            return(parentsBelow);
        }
        private void ReadAssetDatabase(HierarchyType htype, TreeViewItem parent, int baseDepth)
        {
            // Read from Assets directory
            IHierarchyProperty property = new HierarchyProperty(htype, false);

            property.Reset();

            Texture2D folderIcon      = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            Texture2D emptyFolderIcon = EditorGUIUtility.FindTexture(EditorResourcesUtility.emptyFolderIconName);

            List <TreeViewItem> allFolders = new List <TreeViewItem>();

            while (property.Next(null))
            {
                if (property.isFolder)
                {
                    TreeViewItem folderItem = new TreeViewItem(property.instanceID, baseDepth + property.depth, null, property.name);
                    folderItem.icon = property.hasChildren ? folderIcon : emptyFolderIcon;
                    allFolders.Add(folderItem);
                }
            }

            // Fix references
            TreeViewUtility.SetChildParentReferences(allFolders, parent);
        }
        public string[] GetImplicitProjectViewSelection()
        {
            bool flag2;
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            bool retHasSelectionInside = false;

            if (!property.Next(null))
            {
                return(new string[0]);
            }
            Hashtable selection = new Hashtable();

            foreach (UnityEngine.Object obj2 in Selection.objects)
            {
                selection.Add(obj2.GetInstanceID(), null);
            }
            List <int> list = this.GetOneFolderImplicitSelection(property, selection, false, ref retHasSelectionInside, out flag2);

            string[] strArray2 = new string[list.Count];
            for (int i = 0; i < strArray2.Length; i++)
            {
                strArray2[i] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(list[i]));
            }
            return(strArray2);
        }
Пример #6
0
        private void FolderBrowsing(HierarchyProperty property)
        {
            List <FilterResult> list = new List <FilterResult>();

            foreach (string str in this.m_SearchFilter.folders)
            {
                int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(str);
                if (property.Find(mainAssetInstanceID, null))
                {
                    int   depth    = property.depth;
                    int[] expanded = new int[] { mainAssetInstanceID };
                    while (property.Next(expanded))
                    {
                        if (property.depth <= depth)
                        {
                            break;
                        }
                        FilterResult result = new FilterResult();
                        this.CopyPropertyData(ref result, property);
                        list.Add(result);
                        if (property.hasChildren && !property.isFolder)
                        {
                            Array.Resize <int>(ref expanded, expanded.Length + 1);
                            expanded[expanded.Length - 1] = property.instanceID;
                        }
                    }
                }
            }
            this.m_Results = list.ToArray();
        }
Пример #7
0
        void InitializeRows(HierarchyProperty property, int firstRow, int lastRow)
        {
            property.Reset();

            int[] expanded = expandedIDs.ToArray();

            // Skip items if needed
            if (firstRow > 0)
            {
                int numRowsToSkip = firstRow;
                if (!property.Skip(numRowsToSkip, expanded))
                {
                    Debug.LogError("Failed to skip " + numRowsToSkip);
                }
            }

            // Fetch visible items
            int row = firstRow;

            while (property.Next(expanded) && row <= lastRow)
            {
                var item = EnsureCreatedItem(row);
                InitTreeViewItem(item, property, property.hasChildren, property.depth);
                row++;
            }
        }
Пример #8
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();
        }
Пример #9
0
        private void FolderBrowsing(HierarchyProperty property)
        {
            List <FilteredHierarchy.FilterResult> list = new List <FilteredHierarchy.FilterResult>();

            string[] folders = this.m_SearchFilter.folders;
            for (int i = 0; i < folders.Length; i++)
            {
                string assetPath           = folders[i];
                int    mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(assetPath);
                if (property.Find(mainAssetInstanceID, null))
                {
                    int   depth = property.depth;
                    int[] array = new int[]
                    {
                        mainAssetInstanceID
                    };
                    while (property.Next(array))
                    {
                        if (property.depth <= depth)
                        {
                            break;
                        }
                        FilteredHierarchy.FilterResult item = new FilteredHierarchy.FilterResult();
                        this.CopyPropertyData(ref item, property);
                        list.Add(item);
                        if (property.hasChildren && !property.isFolder)
                        {
                            Array.Resize <int>(ref array, array.Length + 1);
                            array[array.Length - 1] = property.instanceID;
                        }
                    }
                }
            }
            this.m_Results = list.ToArray();
        }
	static IEnumerable<GameObject> SceneRoots()
	{
		var prop = new HierarchyProperty(HierarchyType.GameObjects);
		var expanded = new int[0];
		while (prop.Next(expanded)) {
			yield return prop.pptrValue as GameObject;
		}
	}
        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();
        }
Пример #12
0
 private static void ExportScene()
 {
     var prop = new HierarchyProperty(HierarchyType.GameObjects);
     var expanded = new int[0];
     while (prop.Next(expanded))
     {
         var gameObject = prop.pptrValue as GameObject;
         examineGameObject(gameObject);
     }
 }
Пример #13
0
        private HierarchyProperty GetFirst()
        {
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);

            if (property.Next(this.m_ExpandedArray))
            {
                return(property);
            }
            return(null);
        }
        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);
        }
Пример #15
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);
        }
 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;
 }
Пример #17
0
        private void SearchAllAssets(HierarchyProperty property)
        {
            int num = Mathf.Min(property.CountRemaining((int[])null), 3000);

            property.Reset();
            int length = this.m_Results.Length;

            Array.Resize <FilteredHierarchy.FilterResult>(ref this.m_Results, this.m_Results.Length + num);
            for (; property.Next((int[])null) && length < this.m_Results.Length; ++length)
            {
                this.CopyPropertyData(ref this.m_Results[length], property);
            }
        }
Пример #18
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);
            }
        }
Пример #19
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;
 }
Пример #20
0
        private void SetExpandedRecurse(int instanceID, bool expand)
        {
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);

            if (property.Find(instanceID, this.m_ExpandedArray))
            {
                this.SetExpanded(instanceID, expand);
                int depth = property.depth;
                while (property.Next(null) && (property.depth > depth))
                {
                    this.SetExpanded(property.instanceID, expand);
                }
            }
        }
Пример #21
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());
        }
Пример #22
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());
        }
        // Should return the items that have children from id and below
        protected override HashSet <int> GetParentsBelow(int id)
        {
            // Add all children expanded ids to hashset
            HashSet <int> parentsBelow = new HashSet <int>();

            if (m_Roots.Count > 1)
            {
                var assetsInstanceIDs = AssetDatabase.GetMainAssetOrInProgressProxyInstanceID("Assets");
                if (id != assetsInstanceIDs)
                {
                    // Search in created first-level root items
                    var item = m_RootsTreeViewItem.Values.FirstOrDefault(tvi => tvi.id == id && tvi.depth == 0);
                    if (item != null)
                    {
                        parentsBelow.Add(id);
                        foreach (var child in item.children)
                        {
                            if (child != null && child.hasChildren)
                            {
                                parentsBelow.UnionWith(GetParentsBelow(child.id));
                            }
                        }
                        return(parentsBelow);
                    }
                }
            }

            // Search in all roots
            foreach (var root in m_Roots)
            {
                var rootPath = root.path ?? AssetDatabase.GetAssetPath(root.instanceID);
                IHierarchyProperty search = new HierarchyProperty(rootPath);
                if (search.Find(id, null))
                {
                    parentsBelow.Add(id);

                    int depth = search.depth;
                    while (search.Next(null) && search.depth > depth)
                    {
                        if (search.hasChildren)
                        {
                            parentsBelow.Add(search.instanceID);
                        }
                    }
                    break;
                }
            }
            return(parentsBelow);
        }
        private void ReadAssetDatabase(string assetFolderRootPath, TreeViewItem parent, int baseDepth, IList <TreeViewItem> allRows)
        {
            // Read from Assets directory
            IHierarchyProperty property = new HierarchyProperty(assetFolderRootPath);

            property.Reset();

            if (!IsExpanded(parent))
            {
                if (HasSubFolders(property))
                {
                    parent.children = CreateChildListForCollapsedParent();
                }
                return;
            }

            Texture2D folderIcon = EditorGUIUtility.FindTexture(EditorResources.folderIconName);

            List <TreeViewItem> allFolders = new List <TreeViewItem>();
            var expandedIDs = m_TreeView.state.expandedIDs.ToArray();

            while (property.Next(expandedIDs))
            {
                if (property.isFolder)
                {
                    AssetsTreeViewDataSource.FolderTreeItem folderItem = new AssetsTreeViewDataSource.FolderTreeItem(property.guid, !property.hasChildren, property.GetInstanceIDIfImported(), baseDepth + property.depth, null, property.name);
                    folderItem.icon = folderIcon;
                    allFolders.Add(folderItem);
                    allRows.Add(folderItem);
                    if (!IsExpanded(folderItem))
                    {
                        if (HasSubFolders(property))
                        {
                            folderItem.children = CreateChildListForCollapsedParent();
                        }
                    }
                    else // expanded status does not get updated when deleting/moving folders. We need to check if the expanded folder still has subFolders when reading the AssetDatabase
                    {
                        if (!HasSubFolders(property))
                        {
                            SetExpanded(folderItem, false);
                        }
                    }
                }
            }

            // Fix references
            TreeViewUtility.SetChildParentReferences(allFolders, parent);
        }
Пример #25
0
        private void SearchAllAssets(HierarchyProperty property)
        {
            int num = property.CountRemaining(null);

            num = Mathf.Min(num, 3000);
            property.Reset();
            int num2 = this.m_Results.Length;

            Array.Resize <FilteredHierarchy.FilterResult>(ref this.m_Results, this.m_Results.Length + num);
            while (property.Next(null) && num2 < this.m_Results.Length)
            {
                this.CopyPropertyData(ref this.m_Results[num2], property);
                num2++;
            }
        }
Пример #26
0
        private HierarchyProperty GetFirst()
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            HierarchyProperty result;

            if (hierarchyProperty.Next(this.m_ExpandedArray))
            {
                result = hierarchyProperty;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Пример #27
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);
        }
Пример #28
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);
        }
        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);
        }
Пример #30
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));
                }
            }
        }
Пример #31
0
        private void SetExpandedRecurse(int instanceID, bool expand)
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);

            if (!hierarchyProperty.Find(instanceID, this.m_ExpandedArray))
            {
                return;
            }
            this.SetExpanded(instanceID, expand);
            int depth = hierarchyProperty.depth;

            while (hierarchyProperty.Next((int[])null) && hierarchyProperty.depth > depth)
            {
                this.SetExpanded(hierarchyProperty.instanceID, expand);
            }
        }
        private void InitializeRows(HierarchyProperty property, int firstRow, int lastRow)
        {
            property.Reset();
            int[] expanded = base.expandedIDs.ToArray();
            if (firstRow > 0 && !property.Skip(firstRow, expanded))
            {
                Debug.LogError("Failed to skip " + firstRow);
            }
            int num = firstRow;

            while (property.Next(expanded) && num <= lastRow)
            {
                GameObjectTreeViewItem item = this.EnsureCreatedItem(num);
                this.InitTreeViewItem(item, property, property.hasChildren, property.depth);
                num++;
            }
        }
 private void InitializeRows(HierarchyProperty property, int firstRow, int lastRow)
 {
     property.Reset();
     int[] array = this.expandedIDs.ToArray();
     if (firstRow > 0)
     {
         int count = firstRow;
         if (!property.Skip(count, array))
         {
             Debug.LogError((object)("Failed to skip " + (object)count));
         }
     }
     for (int row = firstRow; property.Next(array) && row <= lastRow; ++row)
     {
         this.InitTreeViewItem(this.EnsureCreatedItem(row), property, property.hasChildren, property.depth);
     }
 }
Пример #34
0
        private List <int> GetOneFolderImplicitSelection(HierarchyProperty property, Hashtable selection, bool rootSelected, ref bool retHasSelectionInside, out bool eof)
        {
            int  depth = property.depth;
            bool retHasSelectionInside1 = false;
            bool flag = false;

            eof = false;
            List <int> intList1 = new List <int>();
            List <int> intList2 = new List <int>();
            List <int> intList3 = new List <int>();

            do
            {
                if (property.depth > depth)
                {
                    intList3.AddRange((IEnumerable <int>) this.GetOneFolderImplicitSelection(property, selection, rootSelected || flag, ref retHasSelectionInside1, out eof));
                }
                if (depth == property.depth && !eof)
                {
                    if (rootSelected && !retHasSelectionInside1)
                    {
                        intList1.Add(property.instanceID);
                    }
                    if (selection.Contains((object)property.instanceID))
                    {
                        intList2.Add(property.instanceID);
                        retHasSelectionInside1 = true;
                        flag = true;
                    }
                    else
                    {
                        flag = false;
                    }
                    eof = !property.Next((int[])null);
                }
                else
                {
                    break;
                }
            }while (!eof);
            retHasSelectionInside = retHasSelectionInside | retHasSelectionInside1;
            List <int> intList4 = !rootSelected || retHasSelectionInside1 ? intList2 : intList1;

            intList4.AddRange((IEnumerable <int>)intList3);
            return(intList4);
        }
Пример #35
0
        void SearchAllAssets(HierarchyProperty property)
        {
            const int k_MaxAddCount = 3000;
            int       elements      = property.CountRemaining(null);

            elements = Mathf.Min(elements, k_MaxAddCount);
            property.Reset();

            int i = m_Results.Length;

            System.Array.Resize(ref m_Results, m_Results.Length + elements);
            while (property.Next(null) && i < m_Results.Length)
            {
                CopyPropertyData(ref m_Results[i], property);
                i++;
            }
        }
 private void ReadAssetDatabase(TreeViewItem parent, int baseDepth)
 {
     IHierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
     property.Reset();
     Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
     Texture2D textured2 = EditorGUIUtility.FindTexture(EditorResourcesUtility.emptyFolderIconName);
     List<TreeViewItem> visibleItems = new List<TreeViewItem>();
     while (property.Next(null))
     {
         if (property.isFolder)
         {
             TreeViewItem item = new TreeViewItem(property.instanceID, baseDepth + property.depth, null, property.name) {
                 icon = !property.hasChildren ? textured2 : textured
             };
             visibleItems.Add(item);
         }
     }
     TreeViewUtility.SetChildParentReferences(visibleItems, parent);
 }
 private void InitializeRows(HierarchyProperty property, int firstRow, int lastRow)
 {
   property.Reset();
   int[] array = this.expandedIDs.ToArray();
   if (firstRow > 0)
   {
     int count = firstRow;
     if (!property.Skip(count, array))
       Debug.LogError((object) ("Failed to skip " + (object) count));
   }
   for (int row = firstRow; property.Next(array) && row <= lastRow; ++row)
     this.InitTreeViewItem(this.EnsureCreatedItem(row), property, property.hasChildren, property.depth);
 }
		protected override HashSet<int> GetParentsBelow(int id)
		{
			HashSet<int> hashSet = new HashSet<int>();
			IHierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.GameObjects);
			if (hierarchyProperty.Find(id, null))
			{
				hashSet.Add(id);
				int depth = hierarchyProperty.depth;
				while (hierarchyProperty.Next(null) && hierarchyProperty.depth > depth)
				{
					if (hierarchyProperty.hasChildren)
					{
						hashSet.Add(hierarchyProperty.instanceID);
					}
				}
			}
			return hashSet;
		}
Пример #39
0
        void Rebuild()
        {
            foreach( ILayerProperty property in _Properties )
            {
                property.Dispose();
            }
            _Properties.Clear ();

            HierarchyProperty hierarychyProperty = new HierarchyProperty( HierarchyType.GameObjects );
            while( hierarychyProperty.Next( null ) )
            {
                GameObject gameObject = hierarychyProperty.pptrValue as GameObject;

                Map map = gameObject.GetComponent<Map>();
                if( map != null )
                {
                    _Properties.Add ( new MapLayerProperty( map,hierarychyProperty.colorCode ) );
                }
                else
                {
                    Nostalgia.SortingLayer sortingLayer = gameObject.GetComponent<Nostalgia.SortingLayer>();

            #if UNITY_5
                    Renderer renderer = (sortingLayer != null) ? sortingLayer.GetComponent<Renderer>(): null;
            #else
                    Renderer renderer = (sortingLayer != null) ? sortingLayer.renderer: null;
            #endif
                    if( renderer == null )
                    {
                        renderer = gameObject.GetComponent<SpriteRenderer>() as Renderer;
                    }

                    if( renderer != null )
                    {
                        _Properties.Add ( new RendererLayerProperty( renderer,hierarychyProperty.colorCode ) );
                    }
                }
            }

            Repaint();
        }
 public string[] GetImplicitProjectViewSelection()
 {
   HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
   bool retHasSelectionInside = false;
   if (!property.Next((int[]) null))
     return new string[0];
   Hashtable selection = new Hashtable();
   foreach (UnityEngine.Object @object in Selection.objects)
     selection.Add((object) @object.GetInstanceID(), (object) null);
   bool eof;
   List<int> implicitSelection = this.GetOneFolderImplicitSelection(property, selection, false, ref retHasSelectionInside, out eof);
   string[] strArray = new string[implicitSelection.Count];
   for (int index = 0; index < strArray.Length; ++index)
     strArray[index] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(implicitSelection[index]));
   return strArray;
 }
 private void SearchAllAssets(HierarchyProperty property)
 {
   int num = Mathf.Min(property.CountRemaining((int[]) null), 3000);
   property.Reset();
   int length = this.m_Results.Length;
   Array.Resize<FilteredHierarchy.FilterResult>(ref this.m_Results, this.m_Results.Length + num);
   for (; property.Next((int[]) null) && length < this.m_Results.Length; ++length)
     this.CopyPropertyData(ref this.m_Results[length], property);
 }
			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;
			}
Пример #43
0
		private List<int> GetOneFolderImplicitSelection(HierarchyProperty property, Hashtable selection, bool rootSelected, ref bool retHasSelectionInside, out bool eof)
		{
			int depth = property.depth;
			bool flag = false;
			bool flag2 = false;
			eof = false;
			List<int> list = new List<int>();
			List<int> list2 = new List<int>();
			List<int> list3 = new List<int>();
			do
			{
				if (property.depth > depth)
				{
					list3.AddRange(this.GetOneFolderImplicitSelection(property, selection, rootSelected || flag2, ref flag, out eof));
				}
				if (depth != property.depth || eof)
				{
					break;
				}
				if (rootSelected && !flag)
				{
					list.Add(property.instanceID);
				}
				if (selection.Contains(property.instanceID))
				{
					list2.Add(property.instanceID);
					flag = true;
					flag2 = true;
				}
				else
				{
					flag2 = false;
				}
				eof = !property.Next(null);
			}
			while (!eof);
			retHasSelectionInside |= flag;
			List<int> list4 = (rootSelected && !flag) ? list : list2;
			list4.AddRange(list3);
			return list4;
		}
Пример #44
0
 private void FolderBrowsing(HierarchyProperty property)
 {
     List<FilterResult> list = new List<FilterResult>();
     foreach (string str in this.m_SearchFilter.folders)
     {
         int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(str);
         if (property.Find(mainAssetInstanceID, null))
         {
             int depth = property.depth;
             int[] expanded = new int[] { mainAssetInstanceID };
             while (property.Next(expanded))
             {
                 if (property.depth <= depth)
                 {
                     break;
                 }
                 FilterResult result = new FilterResult();
                 this.CopyPropertyData(ref result, property);
                 list.Add(result);
                 if (property.hasChildren && !property.isFolder)
                 {
                     Array.Resize<int>(ref expanded, expanded.Length + 1);
                     expanded[expanded.Length - 1] = property.instanceID;
                 }
             }
         }
     }
     this.m_Results = list.ToArray();
 }
 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;
 }
Пример #46
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());
 }
Пример #47
0
        private static GameObject GetRootObject(string name)
        {
            HierarchyProperty prop = new HierarchyProperty(HierarchyType.GameObjects);
            int[] expanded = new int[0];
            while (prop.Next(expanded))
            {
                GameObject rootObject = prop.pptrValue as GameObject;

                if (rootObject != null && rootObject.name == name)
                {
                    return rootObject;
                }
            }

            return null;
        }
Пример #48
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;
	}
Пример #49
0
		private void FolderBrowsing(HierarchyProperty property)
		{
			List<FilteredHierarchy.FilterResult> list = new List<FilteredHierarchy.FilterResult>();
			string[] folders = this.m_SearchFilter.folders;
			for (int i = 0; i < folders.Length; i++)
			{
				string assetPath = folders[i];
				int mainAssetInstanceID = AssetDatabase.GetMainAssetInstanceID(assetPath);
				if (property.Find(mainAssetInstanceID, null))
				{
					int depth = property.depth;
					int[] array = new int[]
					{
						mainAssetInstanceID
					};
					while (property.Next(array))
					{
						if (property.depth <= depth)
						{
							break;
						}
						FilteredHierarchy.FilterResult item = new FilteredHierarchy.FilterResult();
						this.CopyPropertyData(ref item, property);
						list.Add(item);
						if (property.hasChildren && !property.isFolder)
						{
							Array.Resize<int>(ref array, array.Length + 1);
							array[array.Length - 1] = property.instanceID;
						}
					}
				}
			}
			this.m_Results = list.ToArray();
		}
Пример #50
0
		public string[] GetImplicitProjectViewSelection()
		{
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			bool flag = false;
			if (!hierarchyProperty.Next(null))
			{
				return new string[0];
			}
			Hashtable hashtable = new Hashtable();
			UnityEngine.Object[] objects = Selection.objects;
			for (int i = 0; i < objects.Length; i++)
			{
				UnityEngine.Object @object = objects[i];
				hashtable.Add(@object.GetInstanceID(), null);
			}
			bool flag2;
			List<int> oneFolderImplicitSelection = this.GetOneFolderImplicitSelection(hierarchyProperty, hashtable, false, ref flag, out flag2);
			string[] array = new string[oneFolderImplicitSelection.Count];
			for (int j = 0; j < array.Length; j++)
			{
				array[j] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(oneFolderImplicitSelection[j]));
			}
			return array;
		}
Пример #51
0
		private void SearchAllAssets(HierarchyProperty property)
		{
			int num = property.CountRemaining(null);
			num = Mathf.Min(num, 3000);
			property.Reset();
			int num2 = this.m_Results.Length;
			Array.Resize<FilteredHierarchy.FilterResult>(ref this.m_Results, this.m_Results.Length + num);
			while (property.Next(null) && num2 < this.m_Results.Length)
			{
				this.CopyPropertyData(ref this.m_Results[num2], property);
				num2++;
			}
		}
Пример #52
0
		private void SetExpandedRecurse(int instanceID, bool expand)
		{
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			if (hierarchyProperty.Find(instanceID, this.m_ExpandedArray))
			{
				this.SetExpanded(instanceID, expand);
				int depth = hierarchyProperty.depth;
				while (hierarchyProperty.Next(null) && hierarchyProperty.depth > depth)
				{
					this.SetExpanded(hierarchyProperty.instanceID, expand);
				}
			}
		}
			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());
			}
Пример #54
0
		private HierarchyProperty GetFirst()
		{
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			if (hierarchyProperty.Next(this.m_ExpandedArray))
			{
				return hierarchyProperty;
			}
			return null;
		}
 private void FolderBrowsing(HierarchyProperty property)
 {
   List<FilteredHierarchy.FilterResult> filterResultList = new List<FilteredHierarchy.FilterResult>();
   foreach (string folder in this.m_SearchFilter.folders)
   {
     int mainAssetInstanceId = AssetDatabase.GetMainAssetInstanceID(folder);
     if (property.Find(mainAssetInstanceId, (int[]) null))
     {
       int depth = property.depth;
       int[] array = new int[1]{ mainAssetInstanceId };
       while (property.Next(array) && property.depth > depth)
       {
         FilteredHierarchy.FilterResult result = new FilteredHierarchy.FilterResult();
         this.CopyPropertyData(ref result, property);
         filterResultList.Add(result);
         if (property.hasChildren && !property.isFolder)
         {
           Array.Resize<int>(ref array, array.Length + 1);
           array[array.Length - 1] = property.instanceID;
         }
       }
     }
   }
   this.m_Results = filterResultList.ToArray();
 }
Пример #56
0
		public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
		{
			if (ASHistoryFileView.ms_Styles == null)
			{
				ASHistoryFileView.ms_Styles = new ASHistoryFileView.Styles();
			}
			this.m_ScreenRect = theRect;
			Hashtable hashtable = new Hashtable();
			UnityEngine.Object[] objects = Selection.objects;
			for (int i = 0; i < objects.Length; i++)
			{
				UnityEngine.Object @object = objects[i];
				hashtable.Add(@object.GetInstanceID(), null);
			}
			this.m_FileViewControlID = GUIUtility.GetControlID(ASHistoryFileView.ms_FileViewHash, FocusType.Native);
			this.KeyboardGUI(parentWin);
			focused &= (GUIUtility.keyboardControl == this.m_FileViewControlID);
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			int num = hierarchyProperty.CountRemaining(this.m_ExpandedArray);
			int num2 = (!this.DeletedItemsToggle) ? 0 : this.m_DelPVstate.lv.totalRows;
			Rect viewRect = new Rect(0f, 0f, 1f, (float)(num + 2 + num2) * ASHistoryFileView.m_RowHeight + 16f);
			this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
			theRect.width = ((viewRect.height <= this.m_ScreenRect.height) ? theRect.width : (theRect.width - 18f));
			int num3 = Mathf.RoundToInt(this.m_ScrollPosition.y - 6f - ASHistoryFileView.m_RowHeight) / Mathf.RoundToInt(ASHistoryFileView.m_RowHeight);
			if (num3 > num)
			{
				num3 = num;
			}
			else
			{
				if (num3 < 0)
				{
					num3 = 0;
					this.m_ScrollPosition.y = 0f;
				}
			}
			GUIContent gUIContent = new GUIContent();
			Event current = Event.current;
			GUIStyle gUIStyle = new GUIStyle(ASHistoryFileView.ms_Styles.label);
			Texture2D image = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
			float num4 = (float)num3 * ASHistoryFileView.m_RowHeight + 3f;
			float num5 = this.m_ScreenRect.height + this.m_ScrollPosition.y;
			Rect position = new Rect(0f, num4, theRect.width, ASHistoryFileView.m_RowHeight);
			if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
			{
				this.SelType = ASHistoryFileView.SelectionType.All;
				GUIUtility.keyboardControl = this.m_FileViewControlID;
				this.ScrollTo(0f);
				parentWin.DoLocalSelectionChange();
				current.Use();
			}
			gUIContent = new GUIContent("Entire Project");
			gUIContent.image = image;
			int left = (int)this.m_BaseIndent;
			gUIStyle.padding.left = 3;
			if (Event.current.type == EventType.Repaint)
			{
				gUIStyle.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.All, focused);
			}
			num4 += ASHistoryFileView.m_RowHeight + 3f;
			hierarchyProperty.Reset();
			hierarchyProperty.Skip(num3, this.m_ExpandedArray);
			while (hierarchyProperty.Next(this.m_ExpandedArray) && num4 <= num5)
			{
				int instanceID = hierarchyProperty.instanceID;
				position = new Rect(0f, num4, theRect.width, ASHistoryFileView.m_RowHeight);
				if (Event.current.type == EventType.Repaint)
				{
					gUIContent.text = hierarchyProperty.name;
					gUIContent.image = hierarchyProperty.icon;
					left = (int)(this.m_BaseIndent + this.m_Indent * (float)hierarchyProperty.depth);
					gUIStyle.padding.left = left;
					bool on = hashtable.Contains(instanceID);
					gUIStyle.Draw(position, gUIContent, false, false, on, focused);
				}
				if (hierarchyProperty.hasChildren)
				{
					bool flag = hierarchyProperty.IsExpanded(this.m_ExpandedArray);
					GUI.changed = false;
					Rect position2 = new Rect(this.m_BaseIndent + this.m_Indent * (float)hierarchyProperty.depth - this.m_FoldoutSize, num4, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);
					flag = GUI.Toggle(position2, flag, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
					if (GUI.changed)
					{
						if (Event.current.alt)
						{
							this.SetExpandedRecurse(instanceID, flag);
						}
						else
						{
							this.SetExpanded(instanceID, flag);
						}
					}
				}
				if (current.type == EventType.MouseDown && Event.current.button == 0 && position.Contains(Event.current.mousePosition))
				{
					GUIUtility.keyboardControl = this.m_FileViewControlID;
					if (Event.current.clickCount == 2)
					{
						AssetDatabase.OpenAsset(instanceID);
						GUIUtility.ExitGUI();
					}
					else
					{
						if (position.Contains(current.mousePosition))
						{
							this.SelectionClick(hierarchyProperty);
						}
					}
					current.Use();
				}
				num4 += ASHistoryFileView.m_RowHeight;
			}
			num4 += 3f;
			this.DoDeletedItemsGUI(parentWin, theRect, gUIStyle, num4, num5, focused);
			GUI.EndScrollView();
			EventType type = current.type;
			if (type != EventType.MouseDown)
			{
				if (type == EventType.MouseUp)
				{
					if (GUIUtility.hotControl == this.m_FileViewControlID)
					{
						if (this.m_ScreenRect.Contains(current.mousePosition))
						{
							Selection.activeObject = null;
						}
						GUIUtility.hotControl = 0;
						current.Use();
					}
				}
			}
			else
			{
				if (current.button == 0 && this.m_ScreenRect.Contains(current.mousePosition))
				{
					GUIUtility.hotControl = this.m_FileViewControlID;
					current.Use();
				}
			}
			this.HandleFraming();
		}
Пример #57
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;
		}
Пример #58
0
 public string[] GetImplicitProjectViewSelection()
 {
     bool flag2;
     HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
     bool retHasSelectionInside = false;
     if (!property.Next(null))
     {
         return new string[0];
     }
     Hashtable selection = new Hashtable();
     foreach (UnityEngine.Object obj2 in Selection.objects)
     {
         selection.Add(obj2.GetInstanceID(), null);
     }
     List<int> list = this.GetOneFolderImplicitSelection(property, selection, false, ref retHasSelectionInside, out flag2);
     string[] strArray = new string[list.Count];
     for (int i = 0; i < strArray.Length; i++)
     {
         strArray[i] = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(list[i]));
     }
     return strArray;
 }
 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;
 }
Пример #60
0
        public void DoGUI(ASHistoryWindow parentWin, Rect theRect, bool focused)
        {
            if (ms_Styles == null)
            {
                ms_Styles = new Styles();
            }
            this.m_ScreenRect = theRect;
            Hashtable hashtable = new Hashtable();
            foreach (UnityEngine.Object obj2 in Selection.objects)
            {
                hashtable.Add(obj2.GetInstanceID(), null);
            }
            this.m_FileViewControlID = GUIUtility.GetControlID(ms_FileViewHash, FocusType.Native);
            this.KeyboardGUI(parentWin);
            focused &= GUIUtility.keyboardControl == this.m_FileViewControlID;
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            int num2 = property.CountRemaining(this.m_ExpandedArray);
            int num3 = !this.DeletedItemsToggle ? 0 : this.m_DelPVstate.lv.totalRows;
            Rect viewRect = new Rect(0f, 0f, 1f, (((num2 + 2) + num3) * m_RowHeight) + 16f);
            this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
            theRect.width = (viewRect.height <= this.m_ScreenRect.height) ? theRect.width : (theRect.width - 18f);
            int count = Mathf.RoundToInt((this.m_ScrollPosition.y - 6f) - m_RowHeight) / Mathf.RoundToInt(m_RowHeight);
            if (count > num2)
            {
                count = num2;
            }
            else if (count < 0)
            {
                count = 0;
                this.m_ScrollPosition.y = 0f;
            }
            float y = 0f;
            GUIContent content = new GUIContent();
            Event current = Event.current;
            GUIStyle s = new GUIStyle(ms_Styles.label);
            Texture2D textured = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            y = (count * m_RowHeight) + 3f;
            float endOffset = this.m_ScreenRect.height + this.m_ScrollPosition.y;
            Rect position = new Rect(0f, y, theRect.width, m_RowHeight);
            if ((current.type == EventType.MouseDown) && position.Contains(current.mousePosition))
            {
                this.SelType = SelectionType.All;
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.ScrollTo(0f);
                parentWin.DoLocalSelectionChange();
                current.Use();
            }
            content = new GUIContent("Entire Project") {
                image = textured
            };
            int baseIndent = (int) this.m_BaseIndent;
            s.padding.left = 3;
            if (Event.current.type == EventType.Repaint)
            {
                s.Draw(position, content, false, false, this.SelType == SelectionType.All, focused);
            }
            y += m_RowHeight + 3f;
            property.Reset();
            property.Skip(count, this.m_ExpandedArray);
            while (property.Next(this.m_ExpandedArray) && (y <= endOffset))
            {
                int instanceID = property.instanceID;
                position = new Rect(0f, y, theRect.width, m_RowHeight);
                if (Event.current.type == EventType.Repaint)
                {
                    content.text = property.name;
                    content.image = property.icon;
                    baseIndent = (int) (this.m_BaseIndent + (this.m_Indent * property.depth));
                    s.padding.left = baseIndent;
                    bool on = hashtable.Contains(instanceID);
                    s.Draw(position, content, false, false, on, focused);
                }
                if (property.hasChildren)
                {
                    bool flag2 = property.IsExpanded(this.m_ExpandedArray);
                    GUI.changed = false;
                    Rect rect3 = new Rect((this.m_BaseIndent + (this.m_Indent * property.depth)) - this.m_FoldoutSize, y, this.m_FoldoutSize, m_RowHeight);
                    flag2 = GUI.Toggle(rect3, flag2, GUIContent.none, ms_Styles.foldout);
                    if (GUI.changed)
                    {
                        if (Event.current.alt)
                        {
                            this.SetExpandedRecurse(instanceID, flag2);
                        }
                        else
                        {
                            this.SetExpanded(instanceID, flag2);
                        }
                    }
                }
                if (((current.type == EventType.MouseDown) && (Event.current.button == 0)) && position.Contains(Event.current.mousePosition))
                {
                    GUIUtility.keyboardControl = this.m_FileViewControlID;
                    if (Event.current.clickCount == 2)
                    {
                        AssetDatabase.OpenAsset(instanceID);
                        GUIUtility.ExitGUI();
                    }
                    else if (position.Contains(current.mousePosition))
                    {
                        this.SelectionClick(property);
                    }
                    current.Use();
                }
                y += m_RowHeight;
            }
            y += 3f;
            this.DoDeletedItemsGUI(parentWin, theRect, s, y, endOffset, focused);
            GUI.EndScrollView();
            switch (current.type)
            {
                case EventType.MouseDown:
                    if ((current.button == 0) && this.m_ScreenRect.Contains(current.mousePosition))
                    {
                        GUIUtility.hotControl = this.m_FileViewControlID;
                        current.Use();
                    }
                    break;

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == this.m_FileViewControlID)
                    {
                        if (this.m_ScreenRect.Contains(current.mousePosition))
                        {
                            Selection.activeObject = null;
                        }
                        GUIUtility.hotControl = 0;
                        current.Use();
                    }
                    break;
            }
            this.HandleFraming();
        }