Files
UnrealEngineUWP/Engine/Source/Editor/SizeMap/SSizeMap.h
Mike Fricker 403a84fcfa Asset Size Mapper tool
- New "Size Map" feature that shows the resource size for selected assets in Content Browser
- Select assets in Content Browser, right click and choose "Size Map..." to show sizes for those assets
- Select actors and press Alt+Shift+M to show sizes of assets used by those actors
- Select assets in Reference Viewer, right click and choose "Size Map..." to show sizes for those assets
- Also added a new "Tree Map" general purpose Slate widget (STreeMap)

[CL 2521609 by Mike Fricker in Main branch]
2015-04-22 15:58:21 -04:00

84 lines
2.6 KiB
C++

// 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<FName>& 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<class FAssetThumbnailPool>& AssetThumbnailPool, TMap<FName, TSharedPtr<class FTreeMapNodeData>>& VisitedAssetPackageNames, const TArray<FName>& AssetPackageNames, const TSharedPtr<FTreeMapNodeData>& ParentTreeMapNode, TSharedPtr<FTreeMapNodeData>& 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<FTreeMapNodeData>& Node, const TSharedPtr<FTreeMapNodeData>& 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<class STreeMap> TreeMapWidget;
/** The assets we were asked to look at */
TArray<FName> RootAssetPackageNames;
/** Our tree map source data */
TSharedPtr<class FTreeMapNodeData> RootTreeMapNode;
/** Thumbnail pool */
TSharedPtr<class FAssetThumbnailPool> 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<TSharedRef<FTreeMapNodeData>, FNodeSizeMapData> FNodeSizeMapDataMap;
FNodeSizeMapDataMap NodeSizeMapDataMap;
};