// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once /** * Tree map for displaying the size of assets */ class SSizeMap : public SCompoundWidget { public: SLATE_BEGIN_ARGS( SSizeMap ) {} SLATE_END_ARGS() /** Default constructor for SSizeMap */ SSizeMap(); /** Destructor for SSizeMap */ ~SSizeMap(); /** * Construct the widget * * @param InArgs A declaration from which to construct the widget */ void Construct( const FArguments& InArgs ); /** Sets the assets to view at the root of the size map. This will rebuild the map. */ void SetRootAssetPackageNames( const TArray& NewRootAssetPackageNames ); protected: /** Called after the initial asset registry scan finishes */ void OnInitialAssetRegistrySearchComplete(); /** Recursively discovers and loads dependent assets, building up a tree map node hierarchy */ void GatherDependenciesRecursively( class FAssetRegistryModule& AssetRegistryModule, TSharedPtr& AssetThumbnailPool, TMap>& VisitedAssetPackageNames, const TArray& AssetPackageNames, const TSharedPtr& ParentTreeMapNode, TSharedPtr& SharedRootNode, int32& NumAssetsWhichFailedToLoad ); /** After the node tree is built up, this function is called to generate nice labels for the nodes and to do a final clean-up pass on the tree */ void FinalizeNodesRecursively( TSharedPtr& Node, const TSharedPtr& SharedRootNode, int32& TotalAssetCount, SIZE_T& TotalSize, bool& bAnyUnknownSizes ); /** Refreshes the display */ void RefreshMap(); /** Called when the user double-clicks on an asset in the tree */ void OnTreeMapNodeDoubleClicked( class FTreeMapNodeData& TreeMapNodeData ); protected: /** Our tree map widget */ TSharedPtr TreeMapWidget; /** The assets we were asked to look at */ TArray RootAssetPackageNames; /** Our tree map source data */ TSharedPtr RootTreeMapNode; /** Thumbnail pool */ TSharedPtr AssetThumbnailPool; /** This struct will contain size map-specific payload data that we'll associate with tree map nodes using a hash table */ struct FNodeSizeMapData { /** How big the asset is */ SIZE_T AssetSize; /** Whether it has a known size or not */ bool bHasKnownSize; /** Data from the asset registry about this asset */ FAssetData AssetData; }; /** Maps a tree node to our size map-specific user data for that node */ typedef TMap, FNodeSizeMapData> FNodeSizeMapDataMap; FNodeSizeMapDataMap NodeSizeMapDataMap; };