initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
|
@ -0,0 +1,214 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor.AddressableAssets.Build.Layout;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal abstract class BuildReportHelperAsset
|
||||
{
|
||||
public abstract BuildLayout.ExplicitAsset ImmediateReferencingAsset { get; set; }
|
||||
public abstract SortedDictionary<string, BuildLayout.ExplicitAsset> GUIDToReferencingAssets { get; set; }
|
||||
}
|
||||
|
||||
internal class BuildReportHelperExplicitAsset : BuildReportHelperAsset
|
||||
{
|
||||
public override BuildLayout.ExplicitAsset ImmediateReferencingAsset { get; set; }
|
||||
public override SortedDictionary<string, BuildLayout.ExplicitAsset> GUIDToReferencingAssets { get; set; }
|
||||
|
||||
public BuildLayout.ExplicitAsset Asset;
|
||||
public SortedDictionary<string, BuildReportHelperExplicitAssetDependency> GUIDToInternalReferencedExplicitAssets;
|
||||
public SortedDictionary<string, BuildReportHelperImplicitAssetDependency> GUIDToInternalReferencedOtherAssets;
|
||||
public SortedDictionary<string, BuildReportHelperAssetDependency> GUIDToExternallyReferencedAssets;
|
||||
|
||||
public BuildReportHelperExplicitAsset(BuildLayout.ExplicitAsset asset, BuildLayout.ExplicitAsset referencingAsset, SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset> duplicateAssets)
|
||||
{
|
||||
Asset = asset;
|
||||
ImmediateReferencingAsset = referencingAsset;
|
||||
|
||||
GUIDToInternalReferencedExplicitAssets = new SortedDictionary<string, BuildReportHelperExplicitAssetDependency>();
|
||||
GUIDToInternalReferencedOtherAssets = new SortedDictionary<string, BuildReportHelperImplicitAssetDependency>();
|
||||
GUIDToExternallyReferencedAssets = new SortedDictionary<string, BuildReportHelperAssetDependency>();
|
||||
|
||||
GenerateFlatListOfReferencedAssets(Asset, Asset, GUIDToInternalReferencedExplicitAssets, GUIDToInternalReferencedOtherAssets, GUIDToExternallyReferencedAssets, duplicateAssets);
|
||||
GUIDToReferencingAssets = BuildReportUtility.GetReferencingAssets(Asset);
|
||||
}
|
||||
|
||||
void GenerateFlatListOfReferencedAssets(BuildLayout.ExplicitAsset asset, BuildLayout.ExplicitAsset mainAsset,
|
||||
SortedDictionary<string, BuildReportHelperExplicitAssetDependency> internalReferencedExplicitAssets,
|
||||
SortedDictionary<string, BuildReportHelperImplicitAssetDependency> internalReferencedOtherAssets,
|
||||
SortedDictionary<string, BuildReportHelperAssetDependency> externallyReferencedAssets,
|
||||
SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset> duplicateAssets)
|
||||
{
|
||||
foreach (BuildLayout.ExplicitAsset explicitDep in asset.InternalReferencedExplicitAssets)
|
||||
{
|
||||
if (asset.Bundle == mainAsset.Bundle && !internalReferencedExplicitAssets.ContainsKey(explicitDep.Guid))
|
||||
internalReferencedExplicitAssets.TryAdd(explicitDep.Guid, new BuildReportHelperExplicitAssetDependency(explicitDep, asset));
|
||||
else if (asset.Bundle != mainAsset.Bundle && !externallyReferencedAssets.ContainsKey(explicitDep.Guid))
|
||||
externallyReferencedAssets.TryAdd(explicitDep.Guid, new BuildReportHelperExplicitAssetDependency(explicitDep, asset));
|
||||
GenerateFlatListOfReferencedAssets(explicitDep, mainAsset, internalReferencedExplicitAssets, internalReferencedOtherAssets, externallyReferencedAssets, duplicateAssets);
|
||||
}
|
||||
|
||||
foreach (BuildLayout.DataFromOtherAsset implicitDep in asset.InternalReferencedOtherAssets)
|
||||
{
|
||||
if (asset.Bundle == mainAsset.Bundle && !internalReferencedOtherAssets.ContainsKey(implicitDep.AssetGuid))
|
||||
{
|
||||
if (duplicateAssets.ContainsKey(implicitDep.AssetGuid))
|
||||
internalReferencedOtherAssets.TryAdd(implicitDep.AssetGuid, new BuildReportHelperImplicitAssetDependency(duplicateAssets[implicitDep.AssetGuid], asset));
|
||||
else
|
||||
internalReferencedOtherAssets.TryAdd(implicitDep.AssetGuid, new BuildReportHelperImplicitAssetDependency(implicitDep, asset));
|
||||
}
|
||||
else if (asset.Bundle != mainAsset.Bundle && !externallyReferencedAssets.ContainsKey(implicitDep.AssetGuid))
|
||||
{
|
||||
if (duplicateAssets.ContainsKey(implicitDep.AssetGuid))
|
||||
externallyReferencedAssets.TryAdd(implicitDep.AssetGuid, new BuildReportHelperImplicitAssetDependency(duplicateAssets[implicitDep.AssetGuid], asset));
|
||||
else
|
||||
externallyReferencedAssets.TryAdd(implicitDep.AssetGuid, new BuildReportHelperImplicitAssetDependency(implicitDep, asset));
|
||||
}
|
||||
}
|
||||
|
||||
foreach (BuildLayout.ExplicitAsset explicitDep in asset.ExternallyReferencedAssets)
|
||||
{
|
||||
if (!externallyReferencedAssets.ContainsKey(explicitDep.Guid))
|
||||
externallyReferencedAssets.TryAdd(explicitDep.Guid, new BuildReportHelperExplicitAssetDependency(explicitDep, asset));
|
||||
GenerateFlatListOfReferencedAssets(explicitDep, mainAsset, internalReferencedExplicitAssets, internalReferencedOtherAssets, externallyReferencedAssets, duplicateAssets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class BuildReportHelperAssetDependency
|
||||
{
|
||||
public abstract BuildLayout.ExplicitAsset ImmediateReferencingAsset { get; set; }
|
||||
public abstract SortedDictionary<string, BuildLayout.ExplicitAsset> GUIDToReferencingAssets { get; set; }
|
||||
}
|
||||
|
||||
internal class BuildReportHelperExplicitAssetDependency : BuildReportHelperAssetDependency
|
||||
{
|
||||
public BuildLayout.ExplicitAsset Asset { get; set; }
|
||||
public override BuildLayout.ExplicitAsset ImmediateReferencingAsset { get; set; }
|
||||
public override SortedDictionary<string, BuildLayout.ExplicitAsset> GUIDToReferencingAssets { get; set; }
|
||||
|
||||
public BuildReportHelperExplicitAssetDependency(BuildLayout.ExplicitAsset asset, BuildLayout.ExplicitAsset referencingAsset)
|
||||
{
|
||||
Asset = asset;
|
||||
ImmediateReferencingAsset = referencingAsset;
|
||||
GUIDToReferencingAssets = BuildReportUtility.GetReferencingAssets(Asset);
|
||||
}
|
||||
}
|
||||
|
||||
internal class BuildReportHelperImplicitAssetDependency : BuildReportHelperAssetDependency
|
||||
{
|
||||
public BuildLayout.DataFromOtherAsset Asset { get; set; }
|
||||
public override BuildLayout.ExplicitAsset ImmediateReferencingAsset { get; set; }
|
||||
public override SortedDictionary<string, BuildLayout.ExplicitAsset> GUIDToReferencingAssets { get; set; }
|
||||
|
||||
public List<BuildLayout.Bundle> Bundles { get; set; }
|
||||
|
||||
public BuildReportHelperImplicitAssetDependency(BuildLayout.DataFromOtherAsset asset, BuildLayout.ExplicitAsset immediateReferencingAsset)
|
||||
{
|
||||
Asset = asset;
|
||||
ImmediateReferencingAsset = immediateReferencingAsset;
|
||||
Bundles = new List<BuildLayout.Bundle>() { asset.File.Bundle };
|
||||
GUIDToReferencingAssets = new SortedDictionary<string, BuildLayout.ExplicitAsset>();
|
||||
foreach (BuildLayout.ExplicitAsset referencingAsset in asset.ReferencingAssets)
|
||||
{
|
||||
GUIDToReferencingAssets.TryAdd(referencingAsset.Guid, referencingAsset);
|
||||
}
|
||||
}
|
||||
|
||||
public BuildReportHelperImplicitAssetDependency(BuildReportHelperDuplicateImplicitAsset duplicateAsset, BuildLayout.ExplicitAsset immediateReferencingAsset)
|
||||
{
|
||||
Asset = duplicateAsset.Asset;
|
||||
ImmediateReferencingAsset = immediateReferencingAsset;
|
||||
Bundles = duplicateAsset.Bundles;
|
||||
GUIDToReferencingAssets = duplicateAsset.GUIDToReferencingAssets;
|
||||
}
|
||||
}
|
||||
|
||||
internal class BuildReportHelperDuplicateImplicitAsset : BuildReportHelperAsset
|
||||
{
|
||||
public override BuildLayout.ExplicitAsset ImmediateReferencingAsset { get; set; }
|
||||
|
||||
public List<BuildLayout.Bundle> Bundles { get; set; }
|
||||
|
||||
public BuildLayout.DataFromOtherAsset Asset;
|
||||
|
||||
public override SortedDictionary<string, BuildLayout.ExplicitAsset> GUIDToReferencingAssets { get; set; }
|
||||
|
||||
public BuildReportHelperDuplicateImplicitAsset(BuildLayout.DataFromOtherAsset asset, BuildLayout.AssetDuplicationData assetDupData)
|
||||
{
|
||||
Asset = asset;
|
||||
Bundles = new List<BuildLayout.Bundle>();
|
||||
GUIDToReferencingAssets = new SortedDictionary<string, BuildLayout.ExplicitAsset>();
|
||||
|
||||
foreach (BuildLayout.File bundleFile in assetDupData.DuplicatedObjects.SelectMany(o => o.IncludedInBundleFiles))
|
||||
{
|
||||
Bundles.Add(bundleFile.Bundle);
|
||||
foreach (BuildLayout.ExplicitAsset explicitAsset in bundleFile.Assets)
|
||||
{
|
||||
foreach (BuildLayout.DataFromOtherAsset otherAsset in explicitAsset.InternalReferencedOtherAssets)
|
||||
{
|
||||
if (otherAsset.AssetGuid == asset.AssetGuid)
|
||||
{
|
||||
GUIDToReferencingAssets.TryAdd(explicitAsset.Guid, explicitAsset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class BuildReportHelperConsumer : IBuildReportConsumer
|
||||
{
|
||||
SortedDictionary<string, BuildLayout.DataFromOtherAsset> m_GUIDToImplicitAssets;
|
||||
SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset> m_GUIDToDuplicateAssets;
|
||||
|
||||
internal SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset> GUIDToDuplicateAssets => m_GUIDToDuplicateAssets;
|
||||
|
||||
public void Consume(BuildLayout buildReport)
|
||||
{
|
||||
m_GUIDToImplicitAssets = GetGUIDToImplicitAssets(buildReport);
|
||||
m_GUIDToDuplicateAssets = GetGUIDToDuplicateAssets(buildReport, m_GUIDToImplicitAssets);
|
||||
}
|
||||
SortedDictionary<string, BuildLayout.DataFromOtherAsset> GetGUIDToImplicitAssets(BuildLayout report)
|
||||
{
|
||||
var guidToImplicitAssets = new SortedDictionary<string, BuildLayout.DataFromOtherAsset>();
|
||||
var allInstancesOfImplicitAssets = BuildLayoutHelpers.EnumerateBundles(report).SelectMany(b => b.Files).SelectMany(f => f.Assets).SelectMany(a => a.InternalReferencedOtherAssets);
|
||||
|
||||
foreach (BuildLayout.DataFromOtherAsset asset in allInstancesOfImplicitAssets)
|
||||
{
|
||||
if (!guidToImplicitAssets.ContainsKey(asset.AssetGuid))
|
||||
{
|
||||
guidToImplicitAssets.TryAdd(asset.AssetGuid, asset);
|
||||
}
|
||||
}
|
||||
return guidToImplicitAssets;
|
||||
}
|
||||
|
||||
SortedDictionary<string, BuildReportHelperExplicitAsset> GetGUIDToExplicitAssets(BuildLayout report, SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset> duplicateAssets)
|
||||
{
|
||||
var guidToExplicitAssets = new SortedDictionary<string, BuildReportHelperExplicitAsset>();
|
||||
foreach (BuildLayout.ExplicitAsset asset in BuildLayoutHelpers.EnumerateAssets(report))
|
||||
{
|
||||
var helperAsset = new BuildReportHelperExplicitAsset(asset, null, duplicateAssets);
|
||||
guidToExplicitAssets.TryAdd(asset.Guid, helperAsset);
|
||||
}
|
||||
return guidToExplicitAssets;
|
||||
}
|
||||
|
||||
SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset> GetGUIDToDuplicateAssets(BuildLayout report, SortedDictionary<string, BuildLayout.DataFromOtherAsset> guidToImplicitAssets)
|
||||
{
|
||||
var duplicateAssets = new SortedDictionary<string, BuildReportHelperDuplicateImplicitAsset>();
|
||||
foreach (BuildLayout.AssetDuplicationData dupData in report.DuplicatedAssets)
|
||||
{
|
||||
var helperDupAsset = new BuildReportHelperDuplicateImplicitAsset(guidToImplicitAssets[dupData.AssetGuid], dupData);
|
||||
duplicateAssets.TryAdd(dupData.AssetGuid, helperDupAsset);
|
||||
}
|
||||
return duplicateAssets;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ae16f41d6e6003e4f851a51e3b852bdd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,479 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEditor;
|
||||
using UnityEditor.AddressableAssets.Build.Layout;
|
||||
using UnityEditor.AddressableAssets.Diagnostics;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
[assembly: InternalsVisibleTo("Unity.Addressables.Editor.Tests")]
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal static class BuildReportUtility
|
||||
{
|
||||
public static readonly string MainToolbar = nameof(MainToolbar);
|
||||
public static readonly string MainToolbarCollapseLeftPaneButton = nameof(MainToolbarCollapseLeftPaneButton);
|
||||
public static readonly string MainToolbarCollapseRightPaneButton = nameof(MainToolbarCollapseRightPaneButton);
|
||||
public static readonly string MainToolbarAddReportButton = nameof(MainToolbarAddReportButton);
|
||||
public static readonly string MainToolbarCollapseLeftPaneButtonIcon = nameof(MainToolbarCollapseLeftPaneButtonIcon);
|
||||
public static readonly string MainToolbarCollapseRightPaneButtonIcon = nameof(MainToolbarCollapseRightPaneButtonIcon);
|
||||
public static readonly string MainToolbarAddReportButtonIcon = nameof(MainToolbarAddReportButtonIcon);
|
||||
public static readonly string SearchField = nameof(SearchField);
|
||||
|
||||
public static readonly string ReportsListItemContainerRighthandElements = nameof(ReportsListItemContainerRighthandElements);
|
||||
public static readonly string ReportsListItemContainerLefthandElements = nameof(ReportsListItemContainerLefthandElements);
|
||||
|
||||
public static readonly string MainContainer = nameof(MainToolbar);
|
||||
|
||||
public static readonly string ReportsList = nameof(ReportsList);
|
||||
public static readonly string ReportsListItemBuildStatus = nameof(ReportsListItemBuildStatus);
|
||||
public static readonly string ReportsListItemBuildPlatform = nameof(ReportsListItemBuildPlatform);
|
||||
public static readonly string ReportsListItemBuildTimestamp = nameof(ReportsListItemBuildTimestamp);
|
||||
public static readonly string ReportsListItemBuildDuration = nameof(ReportsListItemBuildDuration);
|
||||
|
||||
|
||||
public static readonly string MainPanel = nameof(MainPanel);
|
||||
public static readonly string DetailsPanel = nameof(DetailsPanel);
|
||||
|
||||
public static readonly string DetailsUses = nameof(DetailsUses);
|
||||
public static readonly string DetailsUsedBy = nameof(DetailsUsedBy);
|
||||
|
||||
public static readonly string BundleContainsAssetsPane = nameof(BundleContainsAssetsPane);
|
||||
public static readonly string AssetsDetailsView = nameof(AssetsDetailsView);
|
||||
public static readonly string LeftMiddlePaneSplitter = nameof(LeftMiddlePaneSplitter);
|
||||
public static readonly string MiddleRightPaneSplitter = nameof(MiddleRightPaneSplitter);
|
||||
|
||||
public static readonly string ContentViewTypeDropdown = nameof(ContentViewTypeDropdown);
|
||||
|
||||
public static readonly string ContentView = nameof(ContentView);
|
||||
public static readonly string ContentViewColumns = nameof(ContentViewColumns);
|
||||
|
||||
// Bundle view
|
||||
public static readonly string BundlesContentView = nameof(BundlesContentView);
|
||||
public static readonly string BundlesContentViewColBundleName = nameof(BundlesContentViewColBundleName);
|
||||
public static readonly string BundlesContentViewColRefsTo = nameof(BundlesContentViewColRefsTo);
|
||||
public static readonly string BundlesContentViewColRefsBy = nameof(BundlesContentViewColRefsBy);
|
||||
public static readonly string BundlesContentViewColSizePlusRefs = nameof(BundlesContentViewColSizePlusRefs);
|
||||
public static readonly string BundlesContentViewColSizeUncompressed = nameof(BundlesContentViewColSizeUncompressed);
|
||||
public static readonly string BundlesContentViewBundleSize = nameof(BundlesContentViewBundleSize);
|
||||
|
||||
|
||||
// Asset view
|
||||
public static readonly string AssetsContentView = nameof(AssetsContentView);
|
||||
public static readonly string AssetsContentViewColAssetName = nameof(AssetsContentViewColAssetName);
|
||||
public static readonly string AssetsContentViewColSizePlusRefs = nameof(AssetsContentViewColSizePlusRefs);
|
||||
public static readonly string AssetsContentViewColSizeUncompressed = nameof(AssetsContentViewColSizeUncompressed);
|
||||
public static readonly string AssetsContentViewColBundleSize = nameof(AssetsContentViewColBundleSize);
|
||||
public static readonly string AssetsContentViewColRefsTo = nameof(AssetsContentViewColRefsTo);
|
||||
public static readonly string AssetsContentViewColRefsBy = nameof(AssetsContentViewColRefsBy);
|
||||
// Labels view
|
||||
public static readonly string LabelsContentView = nameof(LabelsContentView);
|
||||
public static readonly string LabelsContentViewColLabelName = nameof(LabelsContentViewColLabelName);
|
||||
public static readonly string LabelsContentViewColSizePlusRefs = nameof(LabelsContentViewColSizePlusRefs);
|
||||
public static readonly string LabelsContentViewColSizeUncompressed = nameof(LabelsContentViewColSizeUncompressed);
|
||||
public static readonly string LabelsContentViewColSizeBundle = nameof(LabelsContentViewColSizeBundle);
|
||||
public static readonly string LabelsContentViewColRefsTo = nameof(LabelsContentViewColRefsTo);
|
||||
public static readonly string LabelsContentViewColRefsBy = nameof(LabelsContentViewColRefsBy);
|
||||
|
||||
// Groups view
|
||||
public static readonly string GroupsContentView = nameof(GroupsContentView);
|
||||
public static readonly string GroupsContentViewColGroupName = nameof(GroupsContentViewColGroupName);
|
||||
public static readonly string GroupsContentViewColSizePlusRefs = nameof(GroupsContentViewColSizePlusRefs);
|
||||
public static readonly string GroupsContentViewColSizeUncompressed = nameof(GroupsContentViewColSizeUncompressed);
|
||||
public static readonly string GroupsContentViewColBundleSize = nameof(GroupsContentViewColBundleSize);
|
||||
public static readonly string GroupsContentViewColRefsTo = nameof(GroupsContentViewColRefsTo);
|
||||
public static readonly string GroupsContentViewColRefsBy = nameof(GroupsContentViewColRefsBy);
|
||||
|
||||
// Duplicated Assets view
|
||||
public static readonly string DuplicatedAssetsContentView = nameof(DuplicatedAssetsContentView);
|
||||
public static readonly string DuplicatedAssetsContentViewColAssetName = nameof(DuplicatedAssetsContentViewColAssetName);
|
||||
public static readonly string DuplicatedAssetsContentViewColSize = nameof(DuplicatedAssetsContentViewColSize);
|
||||
public static readonly string DuplicatedAssetsContentViewSpaceSaved = nameof(DuplicatedAssetsContentViewSpaceSaved);
|
||||
public static readonly string DuplicatedAssetsContentViewDuplicationCount = nameof(DuplicatedAssetsContentViewDuplicationCount);
|
||||
|
||||
// Inefficient Bundles view
|
||||
public static readonly string InefficientBundlesContentView = nameof(InefficientBundlesContentView);
|
||||
public static readonly string InefficientBundlesContentViewBundleName = nameof(InefficientBundlesContentViewBundleName);
|
||||
public static readonly string InefficientBundlesContentViewGroup = nameof(InefficientBundlesContentViewGroup);
|
||||
public static readonly string InefficientBundlesContentViewSize = nameof(InefficientBundlesContentViewSize);
|
||||
public static readonly string InefficientBundlesContentViewSizeWDeps = nameof(InefficientBundlesContentViewSizeWDeps);
|
||||
public static readonly string InefficientBundlesContentViewNumOfDeps = nameof(InefficientBundlesContentViewNumOfDeps);
|
||||
public static readonly string InefficientBundlesContentViewNumOfParents = nameof(InefficientBundlesContentViewNumOfParents);
|
||||
public static readonly string InefficientBundlesContentViewEfficiency = nameof(InefficientBundlesContentViewEfficiency);
|
||||
|
||||
// Cell stylesheets
|
||||
public static readonly string TreeViewImplicitAsset = nameof(TreeViewImplicitAsset);
|
||||
public static readonly string TreeViewDuplicatedAsset = nameof(TreeViewDuplicatedAsset);
|
||||
public static readonly string TreeViewElement = nameof(TreeViewElement);
|
||||
public static readonly string TreeViewAssetHeader = nameof(TreeViewAssetHeader);
|
||||
public static readonly string TreeViewHeader = nameof(TreeViewHeader);
|
||||
public static readonly string TreeViewIconElement = nameof(TreeViewIconElement);
|
||||
public static readonly string TreeViewItemIcon = nameof(TreeViewItemIcon);
|
||||
public static readonly string TreeViewItemNoIcon = "NoIcon";
|
||||
public static readonly string TreeViewItemName = nameof(TreeViewItemName);
|
||||
public static readonly string TreeViewItemFilePath = UxmlFilesPath + "TreeViewItem.uxml";
|
||||
public static readonly string TreeViewNavigableItem = nameof(TreeViewNavigableItem);
|
||||
public static readonly string TreeViewNavigableItemButton = nameof(TreeViewNavigableItemButton);
|
||||
public static readonly string TreeViewNavigableItemName = nameof(TreeViewNavigableItemName);
|
||||
public static readonly string TreeViewNavigableItemStatus = nameof(TreeViewNavigableItemStatus);
|
||||
public static readonly string TreeViewNavigableItemStatusWarning = "Warning";
|
||||
public static readonly string TreeViewNavigableItemFilePath = UxmlFilesPath + "TreeViewNavigableItem.uxml";
|
||||
public static readonly string DetailsPanelSummaryNavigableItem = UxmlFilesPath + "DetailsPanelSummaryNavigableItem.uxml";
|
||||
public static readonly string DetailsPanelSummaryNavigableBundle = UxmlFilesPath + "DetailsPanelSummaryNavigableBundle.uxml";
|
||||
public static readonly string DrillableListViewItemPath = UxmlFilesPath + "DrillableListViewItem.uxml";
|
||||
|
||||
// Summary Foldouts
|
||||
public static readonly string SummaryTabBuildFilesFoldout = nameof(SummaryTabBuildFilesFoldout);
|
||||
public static readonly string SummaryTabBundlesUpdatedCount = nameof(SummaryTabBundlesUpdatedCount);
|
||||
public static readonly string SummaryTabBundlesUpdatedSize = nameof(SummaryTabBundlesUpdatedSize);
|
||||
public static readonly string SummaryTabBundlesUnchangedCount = nameof(SummaryTabBundlesUnchangedCount);
|
||||
public static readonly string SummaryTabBundlesUnchangedSize = nameof(SummaryTabBundlesUnchangedSize);
|
||||
public static readonly string SummaryTabBundlesPlayerPlatform = nameof(SummaryTabBundlesPlayerPlatform);
|
||||
public static readonly string SummaryTabBundlesPlayerSize = nameof(SummaryTabBundlesPlayerSize);
|
||||
|
||||
public static readonly string SummaryTabTotalSizeFoldout = nameof(SummaryTabTotalSizeFoldout);
|
||||
public const string SummaryTabLabelElementNameFormat = "SummaryTabLabel_{0}";
|
||||
public const string SummaryTabSizeElementNameFormat = "SummaryTabSize_{0}";
|
||||
public const string SummaryTabScene = "Scene";
|
||||
public const string SummaryTabScriptableObject = "ScriptableObject";
|
||||
public const string SummaryTabPrefab = "Prefab";
|
||||
public const string SummaryTabMaterial = "Material";
|
||||
public const string SummaryTabShader = "Shader";
|
||||
public const string SummaryTabTexture = "Texture";
|
||||
public const string SummaryTabMesh = "Mesh";
|
||||
public const string SummaryTabAnimation = "Animation";
|
||||
public const string SummaryTabAudio = "Audio";
|
||||
public const string SummaryTabVideo = "Video";
|
||||
public const string SummaryTabOther = "Other";
|
||||
public const string SummaryTabTotal = "Total";
|
||||
public const string SummaryTabBundles = "BundlesCompressed";
|
||||
|
||||
public static readonly string SummaryTabDuplicatedAssetsFoldout = nameof(SummaryTabDuplicatedAssetsFoldout);
|
||||
public static readonly string SummaryTabInefficientBundlesFoldout = nameof(SummaryTabInefficientBundlesFoldout);
|
||||
public static readonly string SummaryTabDuplicatedAssetsIndentedRow = nameof(SummaryTabDuplicatedAssetsIndentedRow);
|
||||
public static readonly string SummaryTabInefficientBundlesIndentedRow = nameof(SummaryTabInefficientBundlesIndentedRow);
|
||||
public static readonly string SummaryTabIndentedRows = nameof(SummaryTabIndentedRows);
|
||||
public static readonly string SummaryTabIssuesFoldout = nameof(SummaryTabIssuesFoldout);
|
||||
public static readonly string SummaryTabIssuesIcon = nameof(SummaryTabIssuesIcon);
|
||||
|
||||
public const string SummaryTabUssPath = StyleSheetsPath + "SummaryTab.uss";
|
||||
public const string SummaryTabDarkUssPath = StyleSheetsPath + "SummaryTabDark.uss";
|
||||
public const string SummaryTabLightUssPath = StyleSheetsPath + "SummaryTabLight.uss";
|
||||
|
||||
public const string SummaryTabCardDarkUssPath = StyleSheetsPath + "SummaryTabCardDark.uss";
|
||||
public const string SummaryTabCardLightUssPath = StyleSheetsPath + "SummaryTabCardLight.uss";
|
||||
|
||||
public static readonly string BuildPerformanceReportButton = nameof(BuildPerformanceReportButton);
|
||||
public static readonly string BuildFilesContentViewButton = nameof(BuildFilesContentViewButton);
|
||||
public static readonly string DuplicatedAssetsContentViewButton = nameof(DuplicatedAssetsContentViewButton);
|
||||
public static readonly string InefficientBundlesContentViewButton = nameof(InefficientBundlesContentViewButton);
|
||||
|
||||
// Details panel
|
||||
public static readonly string DetailsSummaryPane = nameof(DetailsSummaryPane);
|
||||
public static readonly string DetailsContents = nameof(DetailsContents);
|
||||
public static readonly string DetailsContentsList = nameof(DetailsContentsList);
|
||||
public static readonly string DetailsContentsTreeView = nameof(DetailsContentsTreeView);
|
||||
public static readonly string DetailsPanelSummaryAsset = nameof(DetailsPanelSummaryAsset);
|
||||
public static readonly string DetailsPanelSummaryBundle = nameof(DetailsPanelSummaryBundle);
|
||||
public static readonly string DetailsPanelSummaryLabel = nameof(DetailsPanelSummaryLabel);
|
||||
public static readonly string DetailsPanelSummaryGroup = nameof(DetailsPanelSummaryGroup);
|
||||
|
||||
public static readonly string DetailsContentsTreeViewBreadcrumb = nameof(DetailsContentsTreeViewBreadcrumb);
|
||||
|
||||
public static readonly string DetailsPanelSummaryBundleName = nameof(DetailsPanelSummaryBundleName);
|
||||
public static readonly string DetailsPanelSummaryBundleUncompressedSize = nameof(DetailsPanelSummaryBundleUncompressedSize);
|
||||
public static readonly string DetailsPanelSummaryBundleSizeWDeps = nameof(DetailsPanelSummaryBundleSizeWDeps);
|
||||
public static readonly string DetailsPanelSummaryBundleCompressionType = nameof(DetailsPanelSummaryBundleCompressionType);
|
||||
public static readonly string DetailsPanelSummaryBundle_GroupsContainer = nameof(DetailsPanelSummaryBundle_GroupsContainer);
|
||||
public static readonly string DetailsPanelSummaryBundleBuildTime = nameof(DetailsPanelSummaryBundleBuildTime);
|
||||
public static readonly string DetailsPanelSummaryBundleLoadPath = nameof(DetailsPanelSummaryBundleLoadPath);
|
||||
|
||||
public static readonly string DetailsPanelSummaryAssetField = nameof(DetailsPanelSummaryAssetField);
|
||||
public static readonly string DetailsPanelSummaryAssetUncompressedSize = nameof(DetailsPanelSummaryAssetUncompressedSize);
|
||||
public static readonly string DetailsPanelSummaryAssetSizeWDeps = nameof(DetailsPanelSummaryAssetSizeWDeps);
|
||||
public static readonly string DetailsPanelSummaryAsset_BundlesContainer = nameof(DetailsPanelSummaryAsset_BundlesContainer);
|
||||
public static readonly string DetailsPanelSummaryAsset_GroupsContainer = nameof(DetailsPanelSummaryAsset_GroupsContainer);
|
||||
public static readonly string DetailsPanelSummaryAsset_LabelsContainer = nameof(DetailsPanelSummaryAsset_LabelsContainer);
|
||||
|
||||
public static readonly string DetailsPanelSummaryNavigableItemName = nameof(DetailsPanelSummaryNavigableItemName);
|
||||
public static readonly string DetailsPanelSummaryNavigableItemButton = nameof(DetailsPanelSummaryNavigableItemButton);
|
||||
public static readonly string DetailsPanelSummaryNavigableBundleName = nameof(DetailsPanelSummaryNavigableBundleName);
|
||||
public static readonly string DetailsPanelSummaryNavigableBundleItemButton = nameof(DetailsPanelSummaryNavigableBundleItemButton);
|
||||
public static readonly string DetailsPanelSummaryNavigableBundleLoadPath = nameof(DetailsPanelSummaryNavigableBundleLoadPath);
|
||||
|
||||
public static readonly string DetailsContentViewColumn1 = nameof(DetailsContentViewColumn1);
|
||||
public static readonly string DetailsContentViewColumn2 = nameof(DetailsContentViewColumn2);
|
||||
public static readonly string BreadcrumbToolbar = nameof(BreadcrumbToolbar);
|
||||
public static readonly string BreadcrumbToolbarName = nameof(BreadcrumbToolbarName);
|
||||
public static readonly string BreadcrumbToolbarBackButton = nameof(BreadcrumbToolbarBackButton);
|
||||
public static readonly string BreadcrumbToolbarIcon = nameof(BreadcrumbToolbarIcon);
|
||||
public static readonly string DrillableListViewButton = nameof(DrillableListViewButton);
|
||||
public static readonly string DrillableListViewItemName = nameof(DrillableListViewItemName);
|
||||
public static readonly string DrillableListViewItemIcon = nameof(DrillableListViewItemIcon);
|
||||
|
||||
// Ribbon
|
||||
public static readonly string TabsRibbon = nameof(TabsRibbon);
|
||||
public static readonly string SummaryTab = nameof(SummaryTab);
|
||||
public static readonly string ContentTab = nameof(ContentTab);
|
||||
public static readonly string PotentialIssuesTab = nameof(PotentialIssuesTab);
|
||||
public static readonly string PotentialIssuesTabButton = nameof(PotentialIssuesTabButton);
|
||||
public static readonly string PotentialIssuesDropdown = nameof(PotentialIssuesDropdown);
|
||||
public static readonly string ReferencedByTab = nameof(ReferencedByTab);
|
||||
public static readonly string ReferencesToTab = nameof(ReferencesToTab);
|
||||
|
||||
public static readonly string DetailsViewDarkPath = StyleSheetsPath + "DetailsViewDark.uss";
|
||||
public static readonly string DetailsViewLightPath = StyleSheetsPath + "DetailsViewLight.uss";
|
||||
|
||||
public const string UIToolKitAssetsPath = "Packages/com.unity.addressables/Editor/BuildReportVisualizer/UIToolKitAssets/";
|
||||
public const string UxmlFilesPath = UIToolKitAssetsPath + "UXML/";
|
||||
public const string StyleSheetsPath = UIToolKitAssetsPath + "StyleSheets/";
|
||||
|
||||
public const string MainToolbarButtonsUssPath = StyleSheetsPath + "MainToolbarButtons.uss";
|
||||
public const string MainToolbarButtonsDarkUssPath = StyleSheetsPath + "MainToolbarButtonsDark.uss";
|
||||
public const string MainToolbarButtonsLightUssPath = StyleSheetsPath + "MainToolbarButtonsLight.uss";
|
||||
public const string SideBarDark = "Packages/com.unity.addressables/Editor/BuildReportVisualizer/BuildReport Resources/Icons/Button_LeftPanel_DarkTheme@2x.png";
|
||||
public const string SideBarLight = "Packages/com.unity.addressables/Editor/BuildReportVisualizer/BuildReport Resources/Icons/Button_LeftPanel_LightTheme@2x.png";
|
||||
|
||||
|
||||
internal static string GetAssetBundleIconPath()
|
||||
{
|
||||
return EditorGUIUtility.isProSkin ? AddressableIconNames.AssetBundleIconDark : AddressableIconNames.AssetBundleIconLight;
|
||||
}
|
||||
|
||||
internal static string GetForwardIconPath()
|
||||
{
|
||||
return EditorGUIUtility.isProSkin ? AddressableIconNames.ForwardIconDark : AddressableIconNames.ForwardIconLight;
|
||||
}
|
||||
|
||||
internal static string GetHelpIconPath()
|
||||
{
|
||||
return AddressableIconNames.HelpIcon;
|
||||
}
|
||||
|
||||
internal static string GetBackIconPath()
|
||||
{
|
||||
return EditorGUIUtility.isProSkin ? AddressableIconNames.BackIconDark : AddressableIconNames.BackIconLight;
|
||||
}
|
||||
|
||||
internal static string GetDetailsViewStylesheetPath()
|
||||
{
|
||||
return EditorGUIUtility.isProSkin ? BuildReportUtility.DetailsViewDarkPath : BuildReportUtility.DetailsViewLightPath;
|
||||
}
|
||||
|
||||
public static Texture GetIcon(string path)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
return AssetDatabase.GetCachedIcon(path);
|
||||
else
|
||||
return EditorGUIUtility.FindTexture(path);
|
||||
}
|
||||
|
||||
public static void SwitchClasses(this VisualElement element, string classToAdd, string classToRemove)
|
||||
{
|
||||
if (!element.ClassListContains(classToAdd))
|
||||
element.AddToClassList(classToAdd);
|
||||
element.RemoveFromClassList(classToRemove);
|
||||
}
|
||||
|
||||
public static void SwitchVisibility(VisualElement first, VisualElement second, bool showFirst = true)
|
||||
{
|
||||
SetVisibility(first, showFirst);
|
||||
SetVisibility(second, !showFirst);
|
||||
}
|
||||
|
||||
public static void SetVisibility(VisualElement element, bool visible)
|
||||
{
|
||||
SetElementDisplay(element, visible);
|
||||
}
|
||||
|
||||
public static void SetElementDisplay(VisualElement element, bool value)
|
||||
{
|
||||
if (element == null)
|
||||
return;
|
||||
|
||||
element.style.display = value ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
element.style.visibility = value ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
||||
public static VisualElement Clone(this VisualTreeAsset tree, VisualElement target = null, string styleSheetPath = null, Dictionary<string, VisualElement> slots = null)
|
||||
{
|
||||
var ret = tree.CloneTree();
|
||||
if (!string.IsNullOrEmpty(styleSheetPath))
|
||||
ret.styleSheets.Add(AssetDatabase.LoadAssetAtPath<StyleSheet>(styleSheetPath));
|
||||
if (target != null)
|
||||
target.Add(ret);
|
||||
ret.style.flexGrow = 1f;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static string GetIconClassName(BuildTarget target)
|
||||
{
|
||||
string iconClassName;
|
||||
switch (target)
|
||||
{
|
||||
case BuildTarget.Android:
|
||||
iconClassName = BuildTarget.Android.ToString();
|
||||
break;
|
||||
case BuildTarget.StandaloneOSX:
|
||||
iconClassName = BuildTarget.StandaloneOSX.ToString();
|
||||
break;
|
||||
case BuildTarget.StandaloneWindows:
|
||||
case BuildTarget.StandaloneWindows64:
|
||||
iconClassName = BuildTarget.StandaloneWindows.ToString();
|
||||
break;
|
||||
case BuildTarget.iOS:
|
||||
iconClassName = BuildTarget.iOS.ToString();
|
||||
break;
|
||||
case BuildTarget.StandaloneLinux64:
|
||||
iconClassName = BuildTarget.StandaloneLinux64.ToString();
|
||||
break;
|
||||
case BuildTarget.WebGL:
|
||||
iconClassName = BuildTarget.WebGL.ToString();
|
||||
break;
|
||||
case BuildTarget.WSAPlayer:
|
||||
iconClassName = BuildTarget.WSAPlayer.ToString();
|
||||
break;
|
||||
case BuildTarget.PS4:
|
||||
case BuildTarget.PS5:
|
||||
iconClassName = BuildTarget.PS4.ToString();
|
||||
break;
|
||||
case BuildTarget.XboxOne:
|
||||
case BuildTarget.GameCoreXboxOne:
|
||||
case BuildTarget.GameCoreXboxSeries:
|
||||
iconClassName = BuildTarget.XboxOne.ToString();
|
||||
break;
|
||||
case BuildTarget.tvOS:
|
||||
iconClassName = BuildTarget.tvOS.ToString();
|
||||
break;
|
||||
case BuildTarget.Switch:
|
||||
iconClassName = BuildTarget.Switch.ToString();
|
||||
break;
|
||||
#if !UNITY_2022_2_OR_NEWER
|
||||
case BuildTarget.Lumin:
|
||||
iconClassName = BuildTarget.Lumin.ToString();
|
||||
break;
|
||||
# endif
|
||||
default:
|
||||
iconClassName = "NoIcon";
|
||||
break;
|
||||
}
|
||||
return iconClassName;
|
||||
}
|
||||
public static string GetDenominatedBytesString(ulong bytes)
|
||||
{
|
||||
if (bytes < 1024)
|
||||
return $"{bytes} B";
|
||||
|
||||
int dec = 0;
|
||||
ulong kbytes = bytes / 1024;
|
||||
if (kbytes < 1024)
|
||||
{
|
||||
dec = Mathf.FloorToInt(((bytes % 1024) / 1024f) * 100);
|
||||
return $"{kbytes}.{Mathf.FloorToInt(dec)} KB";
|
||||
}
|
||||
ulong mbytes = kbytes / 1024;
|
||||
if (mbytes < 1024)
|
||||
{
|
||||
dec = Mathf.FloorToInt(((kbytes % 1024) / 1024f) * 100);
|
||||
return $"{mbytes}.{Mathf.FloorToInt(dec)} MB";
|
||||
}
|
||||
|
||||
ulong gbytes = mbytes / 1024;
|
||||
dec = Mathf.FloorToInt(((mbytes % 1024) / 1024f) * 100);
|
||||
return $"{gbytes}.{Mathf.FloorToInt(dec)} GB";
|
||||
}
|
||||
|
||||
internal static string GetDeliminatedList(char delimChar, List<string> lst)
|
||||
{
|
||||
string itemsStr = string.Empty;
|
||||
for (int i = 0; i < lst.Count; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
itemsStr += $"{delimChar} ";
|
||||
itemsStr += lst[i];
|
||||
}
|
||||
return itemsStr;
|
||||
}
|
||||
|
||||
internal static class TimeAgo
|
||||
{
|
||||
const int k_Second = 1;
|
||||
const int k_Minute = 60 * k_Second;
|
||||
const int k_Hour = 60 * k_Minute;
|
||||
const int k_Day = 24 * k_Hour;
|
||||
const int k_Month = 30 * k_Day;
|
||||
public static string GetString(DateTime dateTime)
|
||||
{
|
||||
var ts = new TimeSpan(DateTime.UtcNow.Ticks - dateTime.ToUniversalTime().Ticks);
|
||||
double delta = Math.Abs(ts.TotalSeconds);
|
||||
if (delta < 1 * k_Minute)
|
||||
return "Just now";
|
||||
if (delta < 2 * k_Minute)
|
||||
return "a minute ago";
|
||||
if (delta < 45 * k_Minute)
|
||||
return ts.Minutes + " minutes ago";
|
||||
if (delta < 90 * k_Minute)
|
||||
return "an hour ago";
|
||||
if (delta < 24 * k_Hour)
|
||||
return ts.Hours + " hours ago";
|
||||
if (delta < 48 * k_Hour)
|
||||
return "yesterday";
|
||||
if (delta < 30 * k_Day)
|
||||
return ts.Days + " days ago";
|
||||
if (delta < 12 * k_Month)
|
||||
{
|
||||
int months = Convert.ToInt32(Math.Floor((double)ts.Days / 30));
|
||||
return months <= 1 ? "a month ago" : months + " months ago";
|
||||
}
|
||||
int years = Convert.ToInt32(Math.Floor((double)ts.Days / 365));
|
||||
return years <= 1 ? "one year ago" : years + " years ago";
|
||||
}
|
||||
}
|
||||
|
||||
internal static SortedDictionary<string, BuildLayout.ExplicitAsset> GetReferencingAssets(BuildLayout.ExplicitAsset asset)
|
||||
{
|
||||
var dependenciesOfAsset = new SortedDictionary<string, BuildLayout.ExplicitAsset>();
|
||||
if (asset.Bundle == null)
|
||||
return dependenciesOfAsset;
|
||||
|
||||
IEnumerable<BuildLayout.ExplicitAsset> assetsOfDependentBundles = asset.Bundle.DependentBundles.SelectMany(b => b.DependentBundles).SelectMany(f => f.Files).SelectMany(a => a.Assets);
|
||||
foreach (BuildLayout.ExplicitAsset assetOfDependentBundle in assetsOfDependentBundles)
|
||||
{
|
||||
if (assetOfDependentBundle.ExternallyReferencedAssets.Find(x => x.AddressableName == asset.AddressableName) != null)
|
||||
{
|
||||
dependenciesOfAsset.TryAdd(assetOfDependentBundle.Guid, assetOfDependentBundle);
|
||||
}
|
||||
}
|
||||
return dependenciesOfAsset;
|
||||
}
|
||||
|
||||
public static Button CreateButton(string text, Action action)
|
||||
{
|
||||
Button button = new Button(action);
|
||||
button.text = text;
|
||||
return button;
|
||||
}
|
||||
|
||||
internal static Hash128 ComputeDataHash(string parentLabelName, string subLabelName = "")
|
||||
{
|
||||
Hash128 hash = Hash128.Compute(parentLabelName);
|
||||
hash.Append(subLabelName);
|
||||
return hash;
|
||||
}
|
||||
|
||||
internal static VisualElement GetSeparatingLine()
|
||||
{
|
||||
VisualElement line = new VisualElement();
|
||||
line.style.width = new Length(100f, LengthUnit.Percent);
|
||||
line.style.height = new Length(1f, LengthUnit.Pixel);
|
||||
line.style.backgroundColor = new StyleColor(new Color(63f, 63f, 63f, 0.3f));
|
||||
return line;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 803b8b87581e2c546ba00dfeeafc29ca
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal class DetailsListItem
|
||||
{
|
||||
public string Text;
|
||||
public string ImagePath;
|
||||
public string ButtonImagePath;
|
||||
public Action DrillDownEvent;
|
||||
public FontStyle StyleForText;
|
||||
public bool CanUseContextMenu;
|
||||
|
||||
public DetailsListItem(string text, string pathForImage, Action drillDownEvent, string buttonImagePath, FontStyle style = FontStyle.Normal)
|
||||
{
|
||||
Text = text;
|
||||
StyleForText = style;
|
||||
ImagePath = pathForImage;
|
||||
DrillDownEvent = drillDownEvent;
|
||||
ButtonImagePath = buttonImagePath;
|
||||
CanUseContextMenu = true;
|
||||
}
|
||||
|
||||
// Alternate Constructor used for items that will not have a context menu or buttons, e.g. the "other assets" drillable items
|
||||
public DetailsListItem(string text, string pathForImage)
|
||||
{
|
||||
Text = text;
|
||||
StyleForText = FontStyle.Normal;
|
||||
ImagePath = pathForImage;
|
||||
DrillDownEvent = null;
|
||||
ButtonImagePath = null;
|
||||
CanUseContextMenu = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3cb0ad02e20d62441a7d1825b5b20dec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal static class DetailsStack
|
||||
{
|
||||
public static int Count => m_Stack.Count;
|
||||
public static Action<DetailsContents> OnPop;
|
||||
public static Action<DetailsContents> OnPush;
|
||||
static Stack<DetailsContents> m_Stack = new Stack<DetailsContents>();
|
||||
|
||||
public static void Push(DetailsContents item)
|
||||
{
|
||||
m_Stack.Push(item);
|
||||
OnPush(item);
|
||||
}
|
||||
|
||||
public static void Pop()
|
||||
{
|
||||
if (m_Stack.Count == 0)
|
||||
return;
|
||||
|
||||
DetailsContents item = m_Stack.Pop();
|
||||
OnPop(item);
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
m_Stack.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d9bc52aced9c3294b84eddb71b6f9891
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal class DetailsSummaryBuilder
|
||||
{
|
||||
List<VisualElement> m_Containers;
|
||||
|
||||
public DetailsSummaryBuilder()
|
||||
{
|
||||
m_Containers = new List<VisualElement>();
|
||||
}
|
||||
|
||||
public DetailsSummaryBuilder With(VisualElement element)
|
||||
{
|
||||
m_Containers.Add(element);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DetailsSummaryBuilder With(Texture icon, string value)
|
||||
{
|
||||
VisualElement container = new VisualElement();
|
||||
container.style.height = new Length(35f, LengthUnit.Pixel);
|
||||
container.style.flexDirection = FlexDirection.Row;
|
||||
container.style.paddingTop = new Length(10f, LengthUnit.Pixel);
|
||||
container.style.paddingBottom = new Length(5f, LengthUnit.Pixel);
|
||||
|
||||
Label label = new Label();
|
||||
Image iconElement = new Image();
|
||||
iconElement.image = icon;
|
||||
iconElement.style.width = iconElement.style.height = 16;
|
||||
iconElement.style.minWidth = iconElement.style.minHeight = 16;
|
||||
|
||||
container.Add(iconElement);
|
||||
container.Add(label);
|
||||
|
||||
label.text = value;
|
||||
label.style.width = new Length(95f, LengthUnit.Percent);
|
||||
label.style.maxWidth = new Length(95f, LengthUnit.Percent);
|
||||
label.style.height = 16;
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
label.style.textOverflow = TextOverflow.Ellipsis;
|
||||
label.style.overflow = Overflow.Hidden;
|
||||
RegisterCopyTextToClipboardCallback(label);
|
||||
|
||||
m_Containers.Add(container);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DetailsSummaryBuilder With(string value)
|
||||
{
|
||||
VisualElement container = new VisualElement();
|
||||
container.style.height = new Length(20f, LengthUnit.Pixel);
|
||||
container.style.flexDirection = FlexDirection.Row;
|
||||
|
||||
Label label = new Label();
|
||||
|
||||
container.Add(label);
|
||||
|
||||
label.text = value;
|
||||
label.style.width = new Length(100f, LengthUnit.Percent);
|
||||
label.style.maxWidth = new Length(100f, LengthUnit.Percent);
|
||||
label.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
label.style.textOverflow = TextOverflow.Ellipsis;
|
||||
label.style.overflow = Overflow.Hidden;
|
||||
label.style.paddingBottom = new StyleLength(2f);
|
||||
RegisterCopyTextToClipboardCallback(label);
|
||||
|
||||
m_Containers.Add(container);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public DetailsSummaryBuilder With(string title, string value)
|
||||
{
|
||||
VisualElement container = new VisualElement();
|
||||
container.style.height = new Length(20f, LengthUnit.Pixel);
|
||||
container.style.flexDirection = FlexDirection.Row;
|
||||
|
||||
Label lhs = new Label();
|
||||
Label rhs = new Label();
|
||||
|
||||
container.Add(lhs);
|
||||
container.Add(rhs);
|
||||
|
||||
lhs.text = title;
|
||||
lhs.style.width = new Length(50f, LengthUnit.Percent);
|
||||
lhs.style.maxWidth = new Length(50f, LengthUnit.Percent);
|
||||
lhs.style.unityTextAlign = TextAnchor.MiddleLeft;
|
||||
|
||||
rhs.text = value;
|
||||
rhs.style.width = new Length(50f, LengthUnit.Percent);
|
||||
rhs.style.maxWidth = new Length(50f, LengthUnit.Percent);
|
||||
rhs.style.unityTextAlign = TextAnchor.MiddleRight;
|
||||
rhs.style.textOverflow = TextOverflow.Ellipsis;
|
||||
rhs.style.overflow = Overflow.Hidden;
|
||||
RegisterCopyTextToClipboardCallback(rhs);
|
||||
|
||||
m_Containers.Add(container);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public VisualElement Build()
|
||||
{
|
||||
var masterContainer = new VisualElement();
|
||||
|
||||
foreach (var element in m_Containers)
|
||||
{
|
||||
masterContainer.Add(element);
|
||||
masterContainer.Add(BuildReportUtility.GetSeparatingLine());
|
||||
}
|
||||
|
||||
return masterContainer;
|
||||
}
|
||||
|
||||
void RegisterCopyTextToClipboardCallback(Label element)
|
||||
{
|
||||
element.RegisterCallback<ContextClickEvent>((args) =>
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Copy"), false, () =>
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = element.text;
|
||||
});
|
||||
|
||||
menu.ShowAsContext();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f26930fb33b669841b9cb185014ac881
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,151 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.AddressableAssets.GUI;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal class PotentialIssuesCard
|
||||
{
|
||||
VisualElement m_Container;
|
||||
|
||||
public PotentialIssuesCard(string text, Action viewButtonAction)
|
||||
{
|
||||
m_Container = new VisualElement();
|
||||
m_Container.style.width = m_Container.style.maxWidth = new Length(246f, LengthUnit.Pixel);
|
||||
m_Container.style.height = m_Container.style.maxHeight = new Length(140f, LengthUnit.Pixel);
|
||||
m_Container.style.backgroundColor = AddressablesGUIUtility.HeaderNormalColor;
|
||||
m_Container.style.flexDirection = FlexDirection.Row;
|
||||
|
||||
Image icon = new Image();
|
||||
icon.image = BuildReportUtility.GetIcon("console.warnicon");
|
||||
icon.style.width = icon.style.height = new Length(24f, LengthUnit.Pixel);
|
||||
icon.style.paddingLeft = icon.style.paddingTop = new Length(6f, LengthUnit.Pixel);
|
||||
|
||||
VisualElement textAndButton = new VisualElement();
|
||||
textAndButton.style.width = new Length(80f, LengthUnit.Percent);
|
||||
textAndButton.style.flexDirection = FlexDirection.Column;
|
||||
|
||||
TextElement textAsset = new TextElement();
|
||||
textAsset.text = text;
|
||||
textAsset.style.paddingBottom = new Length(12f, LengthUnit.Pixel);
|
||||
textAsset.style.paddingTop = textAsset.style.paddingLeft = new Length(12f, LengthUnit.Pixel);
|
||||
textAsset.style.paddingRight = new Length(2f, LengthUnit.Pixel);
|
||||
textAndButton.Add(textAsset);
|
||||
|
||||
Button viewButton = new Button(viewButtonAction);
|
||||
viewButton.style.maxWidth = new Length(50f, LengthUnit.Pixel);
|
||||
viewButton.text = "View";
|
||||
viewButton.style.paddingBottom = new Length(2f, LengthUnit.Pixel);
|
||||
textAndButton.Add(viewButton);
|
||||
|
||||
m_Container.Add(icon);
|
||||
m_Container.Add(textAndButton);
|
||||
}
|
||||
|
||||
public VisualElement Get()
|
||||
{
|
||||
return m_Container;
|
||||
}
|
||||
}
|
||||
|
||||
internal class SummaryRowBuilder
|
||||
{
|
||||
Foldout m_Container;
|
||||
VisualElement m_TabRows;
|
||||
public SummaryRowBuilder(string title)
|
||||
{
|
||||
m_Container = new Foldout();
|
||||
m_Container.AddToClassList("SummaryTabBox");
|
||||
m_Container.text = title;
|
||||
|
||||
m_TabRows = new VisualElement();
|
||||
m_TabRows.AddToClassList("SummaryTabRows");
|
||||
|
||||
m_Container.Add(m_TabRows);
|
||||
}
|
||||
|
||||
public SummaryRowBuilder With(string label, string value, FontStyle style = FontStyle.Normal)
|
||||
{
|
||||
VisualElement container = new VisualElement();
|
||||
var line = BuildReportUtility.GetSeparatingLine();
|
||||
line.style.width = new Length(100f, LengthUnit.Percent);
|
||||
container.Add(line);
|
||||
|
||||
VisualElement tabRow = new VisualElement();
|
||||
tabRow.AddToClassList("SummaryTabRow");
|
||||
tabRow.style.width = new Length(100f, LengthUnit.Percent);
|
||||
|
||||
Label lhs = new Label();
|
||||
lhs.text = label;
|
||||
lhs.style.flexWrap = Wrap.NoWrap;
|
||||
lhs.style.unityFontStyleAndWeight = style;
|
||||
lhs.style.paddingTop = new Length(2f, LengthUnit.Pixel);
|
||||
|
||||
Label rhs = new Label();
|
||||
rhs.text = value;
|
||||
rhs.style.justifyContent = Justify.FlexEnd;
|
||||
rhs.style.maxWidth = new Length(80f, LengthUnit.Percent);
|
||||
rhs.style.maxHeight = new Length(20f, LengthUnit.Pixel);
|
||||
lhs.style.minHeight = new Length(20f, LengthUnit.Pixel);
|
||||
rhs.style.textOverflow = TextOverflow.Ellipsis;
|
||||
rhs.style.flexWrap = Wrap.NoWrap;
|
||||
rhs.style.paddingTop = new Length(2f, LengthUnit.Pixel);
|
||||
RegisterCopyTextToClipboardCallback(rhs);
|
||||
|
||||
tabRow.Add(lhs);
|
||||
tabRow.Add(rhs);
|
||||
|
||||
container.Add(tabRow);
|
||||
m_TabRows.Add(container);
|
||||
m_TabRows.style.minHeight = new Length(m_TabRows.childCount * 24f, LengthUnit.Pixel);
|
||||
m_TabRows.style.maxHeight = new Length(m_TabRows.childCount * 24f, LengthUnit.Pixel);
|
||||
m_Container.style.maxHeight = new Length((m_TabRows.childCount * 25f) + 15f, LengthUnit.Pixel);
|
||||
m_Container.style.minHeight = new Length((m_TabRows.childCount * 25f) + 15f, LengthUnit.Pixel);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public SummaryRowBuilder With(params PotentialIssuesCard[] cards)
|
||||
{
|
||||
VisualElement container = new VisualElement();
|
||||
container.style.paddingBottom = new Length(4f, LengthUnit.Pixel);
|
||||
|
||||
VisualElement tabRow = new VisualElement();
|
||||
tabRow.AddToClassList("SummaryTabRow");
|
||||
|
||||
foreach(var card in cards)
|
||||
tabRow.Add(card.Get());
|
||||
|
||||
container.Add(tabRow);
|
||||
m_TabRows.Add(container);
|
||||
m_Container.style.minHeight = new Length(180f, LengthUnit.Pixel);
|
||||
m_Container.style.maxHeight = new Length(180f, LengthUnit.Pixel);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public Foldout Build()
|
||||
{
|
||||
return m_Container;
|
||||
}
|
||||
|
||||
void RegisterCopyTextToClipboardCallback(Label element)
|
||||
{
|
||||
element.RegisterCallback<ContextClickEvent>((args) =>
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Copy"), false, () =>
|
||||
{
|
||||
GUIUtility.systemCopyBuffer = element.text;
|
||||
});
|
||||
|
||||
menu.ShowAsContext();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c988d689398659d4789c4677ea64b373
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
#if UNITY_2022_2_OR_NEWER
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace UnityEditor.AddressableAssets.BuildReportVisualizer
|
||||
{
|
||||
internal class TreeBuilder
|
||||
{
|
||||
MultiColumnTreeView m_TreeView;
|
||||
|
||||
public TreeBuilder()
|
||||
{
|
||||
m_TreeView = new MultiColumnTreeView();
|
||||
m_TreeView.viewDataKey = $"tree-view-{GUID.Generate()}";
|
||||
m_TreeView.fixedItemHeight = 30f;
|
||||
m_TreeView.sortingEnabled = true;
|
||||
m_TreeView.autoExpand = false;
|
||||
m_TreeView.showAlternatingRowBackgrounds = AlternatingRowBackground.ContentOnly;
|
||||
m_TreeView.showBorder = true;
|
||||
}
|
||||
|
||||
public TreeBuilder With(ContentViewColumnData column)
|
||||
{
|
||||
AddColumn(column);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TreeBuilder With(ContentViewColumnData[] columns)
|
||||
{
|
||||
foreach (var column in columns)
|
||||
AddColumn(column);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
void AddColumn(ContentViewColumnData column)
|
||||
{
|
||||
Column newColumn = new Column();
|
||||
if (column.Name.Contains("Name"))
|
||||
{
|
||||
newColumn.minWidth = new Length(150f, LengthUnit.Pixel);
|
||||
newColumn.width = Length.Auto();
|
||||
}
|
||||
else if (column.Name.Contains("Refs"))
|
||||
{
|
||||
newColumn.minWidth = new Length(60f, LengthUnit.Pixel);
|
||||
newColumn.width = new Length(60f, LengthUnit.Pixel);
|
||||
}
|
||||
else
|
||||
newColumn.minWidth = new Length(80f, LengthUnit.Pixel);
|
||||
newColumn.name = column.Name;
|
||||
newColumn.title = column.Title;
|
||||
newColumn.stretchable = true;
|
||||
newColumn.resizable = true;
|
||||
m_TreeView.columns.Add(newColumn);
|
||||
newColumn.makeCell = () => new Label();
|
||||
newColumn.bindCell = column.BindCellCallback;
|
||||
}
|
||||
|
||||
public TreeBuilder With(Action<IEnumerable<object>> onSelectionCallback)
|
||||
{
|
||||
m_TreeView.selectionChanged += onSelectionCallback;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MultiColumnTreeView Build()
|
||||
{
|
||||
m_TreeView.Rebuild();
|
||||
return m_TreeView;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fc794266b6cadee45af8b7d164281fcd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Add table
Add a link
Reference in a new issue