Reset() private method

private Reset ( ) : void
return void
Example #1
0
        private void ReadAssetDatabase(string assetFolderRootPath, TreeViewItem parent, int baseDepth)
        {
            // Read from Assets directory
            IHierarchyProperty property = new HierarchyProperty(assetFolderRootPath);

            property.Reset();

            Texture2D folderIcon      = EditorGUIUtility.FindTexture(EditorResources.folderIconName);
            Texture2D emptyFolderIcon = EditorGUIUtility.FindTexture(EditorResources.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);
        }
Example #2
0
        internal void SetResults(int[] instanceIDs, string[] rootPaths)
        {
            var instanceIdSet = new HashSet <int>(instanceIDs);

            if (m_HierarchyType == HierarchyType.Assets)
            {
                var idsUnderEachRoot = new Dictionary <string, int>();
                foreach (var rootPath in rootPaths)
                {
                    if (!idsUnderEachRoot.ContainsKey(rootPath))
                    {
                        idsUnderEachRoot.Add(rootPath, 0);
                    }
                    ++idsUnderEachRoot[rootPath];
                }
                SetAssetsResults(instanceIdSet, idsUnderEachRoot);
            }
            else
            {
                HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);
                property.Reset();

                System.Array.Resize(ref m_Results, instanceIDs.Length);
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    if (property.Find(instanceIDs[i], null))
                    {
                        CopyPropertyData(ref m_Results[i], property);
                    }
                }
            }
        }
Example #3
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++;
            }
        }
Example #4
0
        private bool FrameObject(UnityEngine.Object target)
        {
            bool result;

            if (target == null)
            {
                result = false;
            }
            else
            {
                HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
                if (hierarchyProperty.Find(target.GetInstanceID(), null))
                {
                    while (hierarchyProperty.Parent())
                    {
                        this.SetExpanded(hierarchyProperty.instanceID, true);
                    }
                }
                hierarchyProperty.Reset();
                if (hierarchyProperty.Find(target.GetInstanceID(), this.m_ExpandedArray))
                {
                    this.ScrollTo(ASHistoryFileView.m_RowHeight * (float)hierarchyProperty.row + this.m_SpaceAtTheTop);
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
        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();
        }
        private HierarchyProperty CreateHierarchyProperty()
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.GameObjects);

            hierarchyProperty.Reset();
            hierarchyProperty.alphaSorted = this.IsUsingAlphaSort();
            return(hierarchyProperty);
        }
Example #7
0
        HierarchyProperty CreateHierarchyProperty()
        {
            HierarchyProperty property = new HierarchyProperty(k_HierarchyType);

            property.Reset();
            property.alphaSorted = IsUsingAlphaSort();
            return(property);
        }
        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();
        }
Example #9
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");
     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            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();
        }
Example #12
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);
        }
 public void SetResults(int[] instanceIDs)
 {
   HierarchyProperty property = new HierarchyProperty(this.m_HierarchyType);
   property.Reset();
   Array.Resize<FilteredHierarchy.FilterResult>(ref this.m_Results, instanceIDs.Length);
   for (int index = 0; index < instanceIDs.Length; ++index)
   {
     if (property.Find(instanceIDs[index], (int[]) null))
       this.CopyPropertyData(ref this.m_Results[index], property);
   }
 }
Example #14
0
        private HierarchyProperty GetLast()
        {
            HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
            int count = property.CountRemaining(this.m_ExpandedArray);

            property.Reset();
            if (property.Skip(count, this.m_ExpandedArray))
            {
                return(property);
            }
            return(null);
        }
        private void InitializeFull()
        {
            if (SceneHierarchyWindow.debug)
            {
                GameObjectTreeViewDataSource.Log("Init full (" + this.m_RowCount + ")");
            }
            HierarchyProperty hierarchyProperty = this.CreateHierarchyProperty();

            this.m_RowCount = hierarchyProperty.CountRemaining(this.m_TreeView.state.expandedIDs.ToArray());
            this.ResizeItemList(this.m_RowCount);
            hierarchyProperty.Reset();
            this.InitializeRows(hierarchyProperty, 0, this.m_RowCount - 1);
        }
Example #16
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);
            }
        }
Example #17
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());
        }
Example #18
0
        public void SetResults(int[] instanceIDs)
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(this.m_HierarchyType, false);

            hierarchyProperty.Reset();
            Array.Resize <FilteredHierarchy.FilterResult>(ref this.m_Results, instanceIDs.Length);
            for (int i = 0; i < instanceIDs.Length; i++)
            {
                if (hierarchyProperty.Find(instanceIDs[i], null))
                {
                    this.CopyPropertyData(ref this.m_Results[i], hierarchyProperty);
                }
            }
        }
Example #19
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());
        }
Example #20
0
        public void SetResults(int[] instanceIDs)
        {
            HierarchyProperty property = new HierarchyProperty(this.m_HierarchyType);

            property.Reset();
            Array.Resize <FilteredHierarchy.FilterResult>(ref this.m_Results, instanceIDs.Length);
            for (int index = 0; index < instanceIDs.Length; ++index)
            {
                if (property.Find(instanceIDs[index], (int[])null))
                {
                    this.CopyPropertyData(ref this.m_Results[index], property);
                }
            }
        }
        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);
        }
Example #22
0
        void InitializeFull()
        {
            if (SceneHierarchy.s_Debug)
            {
                Log("Init full (" + m_RowCount + ")");
            }

            HierarchyProperty property = CreateHierarchyProperty();

            m_RowCount = property.CountRemaining(m_TreeView.state.expandedIDs.ToArray());
            ResizeItemList(m_RowCount);
            property.Reset();

            InitializeRows(property, 0, m_RowCount - 1);
        }
Example #23
0
        public void SetResults(int[] instanceIDs)
        {
            HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);

            property.Reset();

            System.Array.Resize(ref m_Results, instanceIDs.Length);
            for (int i = 0; i < instanceIDs.Length; ++i)
            {
                if (property.Find(instanceIDs[i], null))
                {
                    CopyPropertyData(ref m_Results[i], property);
                }
            }
        }
Example #24
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++;
            }
        }
        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++;
            }
        }
Example #26
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 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);
     }
 }
        void SearchAllAssets(SearchFilter.SearchArea area)
        {
            const int k_MaxAddCount = 3000;

            if (m_HierarchyType == HierarchyType.Assets)
            {
                List <FilterResult> list = new List <FilterResult>();
                list.AddRange(m_Results);

                var maxAddCount = k_MaxAddCount;
                m_SearchFilter.searchArea = area;
                var enumerator = AssetDatabase.EnumerateAllAssets(m_SearchFilter);
                while (enumerator.MoveNext() && --maxAddCount >= 0)
                {
                    var result = new FilterResult();
                    CopyPropertyData(ref result, enumerator.Current);
                    list.Add(result);
                }

                m_Results = list.ToArray();
            }
            else if (m_HierarchyType == HierarchyType.GameObjects)
            {
                HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);
                property.SetSearchFilter(m_SearchFilter);

                if (m_SearchFilter.sceneHandles != null &&
                    m_SearchFilter.sceneHandles.Length > 0)
                {
                    property.SetCustomScenes(m_SearchFilter.sceneHandles);
                }

                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++;
                }
            }
        }
        public void SetResults(int[] instanceIDs)
        {
            if (m_HierarchyType == HierarchyType.Assets)
            {
                string[] rootPaths = new string[instanceIDs.Length];
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    var rootPath = "Assets";

                    var path        = AssetDatabase.GetAssetPath(instanceIDs[i]);
                    var packageInfo = PackageManager.PackageInfo.FindForAssetPath(path);
                    // Find the right rootPath if folderPath is part of a package
                    if (packageInfo != null)
                    {
                        rootPath = packageInfo.assetPath;
                    }

                    rootPaths[i] = rootPath;
                }

                System.Array.Resize(ref m_Results, instanceIDs.Length);
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    HierarchyProperty property = new HierarchyProperty(rootPaths[i], false);
                    if (property.Find(instanceIDs[i], null))
                    {
                        CopyPropertyData(ref m_Results[i], property);
                    }
                }
            }
            else
            {
                HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);
                property.Reset();

                System.Array.Resize(ref m_Results, instanceIDs.Length);
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    if (property.Find(instanceIDs[i], null))
                    {
                        CopyPropertyData(ref m_Results[i], property);
                    }
                }
            }
        }
Example #30
0
        public void SetResults(int[] instanceIDs)
        {
            if (m_HierarchyType == HierarchyType.Assets)
            {
                string[] rootPaths = new string[instanceIDs.Length];
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    var rootPath = "Assets";

                    var path           = AssetDatabase.GetAssetPath(instanceIDs[i]);
                    var pathComponents = path.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];
                    }

                    rootPaths[i] = rootPath;
                }

                System.Array.Resize(ref m_Results, instanceIDs.Length);
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    HierarchyProperty property = new HierarchyProperty(rootPaths[i], false);
                    if (property.Find(instanceIDs[i], null))
                    {
                        CopyPropertyData(ref m_Results[i], property);
                    }
                }
            }
            else
            {
                HierarchyProperty property = new HierarchyProperty(m_HierarchyType, false);
                property.Reset();

                System.Array.Resize(ref m_Results, instanceIDs.Length);
                for (int i = 0; i < instanceIDs.Length; ++i)
                {
                    if (property.Find(instanceIDs[i], null))
                    {
                        CopyPropertyData(ref m_Results[i], property);
                    }
                }
            }
        }
 private void InitializeRows(HierarchyProperty property, int firstRow, int lastRow)
 {
     property.Reset();
     int[] expanded = base.expandedIDs.ToArray();
     if (firstRow > 0)
     {
         int count = firstRow;
         if (!property.Skip(count, expanded))
         {
             Debug.LogError("Failed to skip " + count);
         }
     }
     for (int i = firstRow; property.Next(expanded) && (i <= lastRow); i++)
     {
         GameObjectTreeViewItem item = this.EnsureCreatedItem(i);
         this.InitTreeViewItem(item, property, property.hasChildren, property.depth);
     }
 }
Example #32
0
        private HierarchyProperty GetLast()
        {
            HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
            int count = hierarchyProperty.CountRemaining(this.m_ExpandedArray);

            hierarchyProperty.Reset();
            HierarchyProperty result;

            if (hierarchyProperty.Skip(count, this.m_ExpandedArray))
            {
                result = hierarchyProperty;
            }
            else
            {
                result = null;
            }
            return(result);
        }
 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 ReadAssetDatabase(TreeViewItem parent, int baseDepth)
		{
			IHierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			hierarchyProperty.Reset();
			Texture2D texture2D = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
			Texture2D texture2D2 = EditorGUIUtility.FindTexture(EditorResourcesUtility.emptyFolderIconName);
			List<TreeViewItem> list = new List<TreeViewItem>();
			while (hierarchyProperty.Next(null))
			{
				if (hierarchyProperty.isFolder)
				{
					list.Add(new TreeViewItem(hierarchyProperty.instanceID, baseDepth + hierarchyProperty.depth, null, hierarchyProperty.name)
					{
						icon = (!hierarchyProperty.hasChildren) ? texture2D2 : texture2D
					});
				}
			}
			TreeViewUtility.SetChildParentReferences(list, parent);
		}
 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 void SetResults(int[] instanceIDs)
		{
			HierarchyProperty hierarchyProperty = new HierarchyProperty(this.m_HierarchyType);
			hierarchyProperty.Reset();
			Array.Resize<FilteredHierarchy.FilterResult>(ref this.m_Results, instanceIDs.Length);
			for (int i = 0; i < instanceIDs.Length; i++)
			{
				if (hierarchyProperty.Find(instanceIDs[i], null))
				{
					this.CopyPropertyData(ref this.m_Results[i], hierarchyProperty);
				}
			}
		}
		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++;
			}
		}
 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);
 }
		private HierarchyProperty GetLast()
		{
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			int count = hierarchyProperty.CountRemaining(this.m_ExpandedArray);
			hierarchyProperty.Reset();
			if (hierarchyProperty.Skip(count, this.m_ExpandedArray))
			{
				return hierarchyProperty;
			}
			return null;
		}
 private HierarchyProperty CreateHierarchyProperty()
 {
   HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.GameObjects);
   hierarchyProperty.Reset();
   hierarchyProperty.alphaSorted = this.IsUsingAlphaSort();
   return hierarchyProperty;
 }
		private bool FrameObject(UnityEngine.Object target)
		{
			if (target == null)
			{
				return false;
			}
			HierarchyProperty hierarchyProperty = new HierarchyProperty(HierarchyType.Assets);
			if (hierarchyProperty.Find(target.GetInstanceID(), null))
			{
				while (hierarchyProperty.Parent())
				{
					this.SetExpanded(hierarchyProperty.instanceID, true);
				}
			}
			hierarchyProperty.Reset();
			if (hierarchyProperty.Find(target.GetInstanceID(), this.m_ExpandedArray))
			{
				this.ScrollTo(ASHistoryFileView.m_RowHeight * (float)hierarchyProperty.row + this.m_SpaceAtTheTop);
				return true;
			}
			return false;
		}
		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();
		}
 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();
   foreach (UnityEngine.Object @object in Selection.objects)
     hashtable.Add((object) @object.GetInstanceID(), (object) null);
   this.m_FileViewControlID = GUIUtility.GetControlID(ASHistoryFileView.ms_FileViewHash, FocusType.Native);
   this.KeyboardGUI(parentWin);
   focused &= GUIUtility.keyboardControl == this.m_FileViewControlID;
   HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
   int num1 = property.CountRemaining(this.m_ExpandedArray);
   int num2 = !this.DeletedItemsToggle ? 0 : this.m_DelPVstate.lv.totalRows;
   Rect viewRect = new Rect(0.0f, 0.0f, 1f, (float) ((double) (num1 + 2 + num2) * (double) ASHistoryFileView.m_RowHeight + 16.0));
   this.m_ScrollPosition = GUI.BeginScrollView(this.m_ScreenRect, this.m_ScrollPosition, viewRect);
   theRect.width = (double) viewRect.height <= (double) this.m_ScreenRect.height ? theRect.width : theRect.width - 18f;
   int count = Mathf.RoundToInt(this.m_ScrollPosition.y - 6f - ASHistoryFileView.m_RowHeight) / Mathf.RoundToInt(ASHistoryFileView.m_RowHeight);
   if (count > num1)
     count = num1;
   else if (count < 0)
   {
     count = 0;
     this.m_ScrollPosition.y = 0.0f;
   }
   GUIContent guiContent = new GUIContent();
   Event current = Event.current;
   GUIStyle s = new GUIStyle(ASHistoryFileView.ms_Styles.label);
   Texture2D texture = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
   float y1 = (float) ((double) count * (double) ASHistoryFileView.m_RowHeight + 3.0);
   float endOffset = this.m_ScreenRect.height + this.m_ScrollPosition.y;
   Rect position = new Rect(0.0f, y1, 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(0.0f);
     parentWin.DoLocalSelectionChange();
     current.Use();
   }
   GUIContent content = new GUIContent("Entire Project");
   content.image = (Texture) texture;
   int baseIndent = (int) this.m_BaseIndent;
   s.padding.left = 3;
   if (Event.current.type == EventType.Repaint)
     s.Draw(position, content, false, false, this.SelType == ASHistoryFileView.SelectionType.All, focused);
   float y2 = y1 + (ASHistoryFileView.m_RowHeight + 3f);
   property.Reset();
   property.Skip(count, this.m_ExpandedArray);
   while (property.Next(this.m_ExpandedArray) && (double) y2 <= (double) endOffset)
   {
     int instanceId = property.instanceID;
     position = new Rect(0.0f, y2, theRect.width, ASHistoryFileView.m_RowHeight);
     if (Event.current.type == EventType.Repaint)
     {
       content.text = property.name;
       content.image = (Texture) property.icon;
       int num3 = (int) ((double) this.m_BaseIndent + (double) this.m_Indent * (double) property.depth);
       s.padding.left = num3;
       bool on = hashtable.Contains((object) instanceId);
       s.Draw(position, content, false, false, on, focused);
     }
     if (property.hasChildren)
     {
       bool flag = property.IsExpanded(this.m_ExpandedArray);
       GUI.changed = false;
       bool expand = GUI.Toggle(new Rect(this.m_BaseIndent + this.m_Indent * (float) property.depth - this.m_FoldoutSize, y2, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight), flag, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
       if (GUI.changed)
       {
         if (Event.current.alt)
           this.SetExpandedRecurse(instanceId, expand);
         else
           this.SetExpanded(instanceId, expand);
       }
     }
     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();
     }
     y2 += ASHistoryFileView.m_RowHeight;
   }
   float offset = y2 + 3f;
   this.DoDeletedItemsGUI(parentWin, theRect, s, offset, 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;
       }
       break;
     case EventType.MouseUp:
       if (GUIUtility.hotControl == this.m_FileViewControlID)
       {
         if (this.m_ScreenRect.Contains(current.mousePosition))
           Selection.activeObject = (UnityEngine.Object) null;
         GUIUtility.hotControl = 0;
         current.Use();
         break;
       }
       break;
   }
   this.HandleFraming();
 }
Example #44
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();
        }
Example #45
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;
	}
Example #46
0
 private bool FrameObject(UnityEngine.Object target)
 {
     if (target != null)
     {
         HierarchyProperty property = new HierarchyProperty(HierarchyType.Assets);
         if (property.Find(target.GetInstanceID(), null))
         {
             while (property.Parent())
             {
                 this.SetExpanded(property.instanceID, true);
             }
         }
         property.Reset();
         if (property.Find(target.GetInstanceID(), this.m_ExpandedArray))
         {
             this.ScrollTo((m_RowHeight * property.row) + this.m_SpaceAtTheTop);
             return true;
         }
     }
     return false;
 }