Example #1
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 = CreateHierarchyProperty();

            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);
        }
Example #2
0
 protected override HashSet<int> GetParentsBelow(int id)
 {
   HashSet<int> intSet = new HashSet<int>();
   IHierarchyProperty hierarchyProperty = (IHierarchyProperty) new HierarchyProperty(HierarchyType.Assets);
   if (hierarchyProperty.Find(id, (int[]) null))
   {
     intSet.Add(id);
     int depth = hierarchyProperty.depth;
     while (hierarchyProperty.Next((int[]) null) && hierarchyProperty.depth > depth)
     {
       if (hierarchyProperty.hasChildren)
         intSet.Add(hierarchyProperty.instanceID);
     }
   }
   return intSet;
 }
        private void ReadAssetDatabase(TreeViewItem parent, int baseDepth)
        {
            IHierarchyProperty hierarchyProperty = (IHierarchyProperty) new HierarchyProperty(HierarchyType.Assets);

            hierarchyProperty.Reset();
            Texture2D           texture1     = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);
            Texture2D           texture2     = EditorGUIUtility.FindTexture(EditorResourcesUtility.emptyFolderIconName);
            List <TreeViewItem> visibleItems = new List <TreeViewItem>();

            while (hierarchyProperty.Next((int[])null))
            {
                if (hierarchyProperty.isFolder)
                {
                    visibleItems.Add(new TreeViewItem(hierarchyProperty.instanceID, baseDepth + hierarchyProperty.depth, (TreeViewItem)null, hierarchyProperty.name)
                    {
                        icon = !hierarchyProperty.hasChildren ? texture2 : texture1
                    });
                }
            }
            TreeViewUtility.SetChildParentReferences(visibleItems, parent);
        }
        protected override HashSet <int> GetParentsBelow(int id)
        {
            HashSet <int> intSet = new HashSet <int>();

            if (!this.IsValidHierarchyInstanceID(id))
            {
                return(intSet);
            }
            IHierarchyProperty hierarchyProperty = (IHierarchyProperty) new HierarchyProperty(HierarchyType.GameObjects);

            if (hierarchyProperty.Find(id, (int[])null))
            {
                intSet.Add(id);
                int depth = hierarchyProperty.depth;
                while (hierarchyProperty.Next((int[])null) && hierarchyProperty.depth > depth)
                {
                    if (hierarchyProperty.hasChildren)
                    {
                        intSet.Add(hierarchyProperty.instanceID);
                    }
                }
            }
            return(intSet);
        }