// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved. #pragma once class SContentBrowser; class FNativeClassHierarchy; class FCollectionAssetRegistryBridge; #define MAX_CONTENT_BROWSERS 4 /** * Content browser module singleton implementation class */ class FContentBrowserSingleton : public IContentBrowserSingleton { public: /** Constructor, Destructor */ FContentBrowserSingleton(); virtual ~FContentBrowserSingleton(); // IContentBrowserSingleton interface virtual TSharedRef CreateAssetPicker(const FAssetPickerConfig& AssetPickerConfig) override; virtual TSharedRef CreatePathPicker(const FPathPickerConfig& PathPickerConfig) override; virtual TSharedRef CreateCollectionPicker(const FCollectionPickerConfig& CollectionPickerConfig) override; virtual void CreateOpenAssetDialog(const FOpenAssetDialogConfig& OpenAssetConfig, const FOnAssetsChosenForOpen& OnAssetsChosenForOpen, const FOnAssetDialogCancelled& OnAssetDialogCancelled) override; virtual TArray CreateModalOpenAssetDialog(const FOpenAssetDialogConfig& InConfig) override; virtual void CreateSaveAssetDialog(const FSaveAssetDialogConfig& SaveAssetConfig, const FOnObjectPathChosenForSave& OnAssetNameChosenForSave, const FOnAssetDialogCancelled& OnAssetDialogCancelled) override; virtual FString CreateModalSaveAssetDialog(const FSaveAssetDialogConfig& SaveAssetConfig) override; virtual bool HasPrimaryContentBrowser() const override; virtual void FocusPrimaryContentBrowser(bool bFocusSearch) override; virtual void CreateNewAsset(const FString& DefaultAssetName, const FString& PackagePath, UClass* AssetClass, UFactory* Factory) override; virtual void SyncBrowserToAssets(const TArray& AssetDataList, bool bAllowLockedBrowsers = false) override; virtual void SyncBrowserToAssets(const TArray& AssetList, bool bAllowLockedBrowsers = false) override; virtual void GetSelectedAssets(TArray& SelectedAssets) override; /** Gets the content browser singleton as a FContentBrowserSingleton */ static FContentBrowserSingleton& Get(); /** Sets the current primary content browser. */ void SetPrimaryContentBrowser(const TSharedRef& NewPrimaryBrowser); /** Notifies the singleton that a browser was closed */ void ContentBrowserClosed(const TSharedRef& ClosedBrowser); TSharedRef GetNativeClassHierarchy(); private: /** Shared code to open an asset dialog window with a config */ void SharedCreateAssetDialogWindow(const TSharedRef& AssetDialog, const FSharedAssetDialogConfig& InConfig, bool bModal) const; /** * Delegate handlers **/ void OnEditorLoadSelectedAssetsIfNeeded(); /** Sets the primary content browser to the next valid browser in the list of all browsers */ void ChooseNewPrimaryBrowser(); /** Gives focus to the specified content browser */ void FocusContentBrowser(const TSharedPtr& BrowserToFocus); /** Summons a new content browser */ void SummonNewBrowser(bool bAllowLockedBrowsers = false); /** Handler for a request to spawn a new content browser tab */ TSharedRef SpawnContentBrowserTab( const FSpawnTabArgs& SpawnTabArgs, int32 BrowserIdx ); /** Handler for a request to spawn a new content browser tab */ FText GetContentBrowserTabLabel(int32 BrowserIdx); /** Returns true if this content browser is locked (can be used even when closed) */ bool IsLocked(const FName& InstanceName) const; /** Returns a localized name for the tab/menu entry with index */ static FText GetContentBrowserLabelWithIndex( int32 BrowserIdx ); public: /** The tab identifier/instance name for content browser tabs */ FName ContentBrowserTabIDs[MAX_CONTENT_BROWSERS]; private: TArray> AllContentBrowsers; TMap> BrowserToLastKnownTabManagerMap; TWeakPtr PrimaryContentBrowser; TSharedPtr NativeClassHierarchy; TSharedRef CollectionAssetRegistryBridge; /** An incrementing int32 which is used when making unique settings strings */ int32 SettingsStringID; };