예제 #1
0
        // Handles fetching rename icon or cached asset database icon
        protected override Texture GetIconForItem(TreeViewItem item)
        {
            if (item == null)
            {
                return(null);
            }

            Texture icon = null;

            if (IsCreatingNewAsset(item.id))
            {
                icon = GetCreateAssetUtility().icon;
            }

            if (icon == null)
            {
                icon = item.icon;
            }

            if (icon == null && item.id != 0)
            {
                string path = AssetDatabase.GetAssetPath(item.id);
                icon = AssetDatabase.GetCachedIcon(path);
            }

            AssetsTreeViewDataSource.FolderTreeItemBase folderItem = item as AssetsTreeViewDataSource.FolderTreeItemBase;

            if (folderItem != null && m_TreeView.data.IsExpanded(folderItem))
            {
                icon = openFolderTexture;
            }

            return(icon);
        }
        protected override Texture GetIconForItem(TreeViewItem item)
        {
            if (item != null && item.icon != null)
            {
                var icon = item.icon;
                AssetsTreeViewDataSource.FolderTreeItemBase folderItem = item as AssetsTreeViewDataSource.FolderTreeItemBase;

                if (folderItem != null && m_TreeView.data.IsExpanded(folderItem))
                {
                    icon = openFolderTexture;
                }

                return(icon);
            }

            SearchFilterTreeItem searchFilterItem = item as SearchFilterTreeItem;

            if (searchFilterItem != null)
            {
                if (IsVisibleRootNode(item))
                {
                    return(k_FavoritesIcon);
                }
                if (searchFilterItem.isFolder)
                {
                    return(k_FavoriteFolderIcon);
                }
                else
                {
                    return(k_FavoriteFilterIcon);
                }
            }
            return(base.GetIconForItem(item));
        }