2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-03-14 14:13:41 -04:00
# pragma once
namespace ContentBrowserUtils
{
2015-01-29 11:47:03 -05:00
enum class ECBFolderCategory : uint8
{
GameContent ,
EngineContent ,
PluginContent ,
DeveloperContent ,
GameClasses ,
EngineClasses ,
PluginClasses ,
} ;
2014-03-14 14:13:41 -04:00
/** Loads the specified object if needed and opens the asset editor for it */
bool OpenEditorForAsset ( const FString & ObjectPath ) ;
/** Opens the asset editor for the specified asset */
bool OpenEditorForAsset ( UObject * Asset ) ;
/** Opens the asset editor for the specified assets */
bool OpenEditorForAsset ( const TArray < UObject * > & Assets ) ;
/**
2015-06-26 10:05:12 -04:00
* Makes sure the specified assets are loaded into memory .6666
2014-03-14 14:13:41 -04:00
*
* @ param ObjectPaths The paths to the objects to load .
* @ param LoadedObjects The returned list of objects that were already loaded or loaded by this method .
* @ return false if user canceled after being warned about loading very many packages .
*/
2015-02-04 05:20:48 -05:00
bool LoadAssetsIfNeeded ( const TArray < FString > & ObjectPaths , TArray < UObject * > & LoadedObjects , bool bAllowedToPromptToLoadAssets = true , bool bLoadRedirects = false ) ;
2014-03-14 14:13:41 -04:00
/**
2015-06-26 10:05:12 -04:00
* Determines the unloaded assets that need loading
2014-03-14 14:13:41 -04:00
*
* @ param ObjectPaths Paths to assets that may need to be loaded
* @ param OutUnloadedObjects List of the unloaded object paths
* @ return true if the user should be prompted to load assets
*/
2015-06-26 10:05:12 -04:00
void GetUnloadedAssets ( const TArray < FString > & ObjectPaths , TArray < FString > & OutUnloadedObjects ) ;
2014-03-14 14:13:41 -04:00
/**
* Prompts the user to load the list of unloaded objects
*
* @ param UnloadedObjects The list of unloaded objects that we should prompt for loading
* @ param true if the user allows the objects to be loaded
*/
bool PromptToLoadAssets ( const TArray < FString > & UnloadedObjects ) ;
/** Renames an asset */
void RenameAsset ( UObject * Asset , const FString & NewName , FText & ErrorMessage ) ;
/** Renames a folder */
void RenameFolder ( const FString & FolderPath , const FString & NewName , FText & ErrorMessage ) ;
2014-07-09 06:31:13 -04:00
/**
* Copies assets to a new path
* @ param Assets The assets to copy
* @ param DestPath The destination folder in which to copy the assets
*/
void CopyAssets ( const TArray < UObject * > & Assets , const FString & DestPath ) ;
2014-03-14 14:13:41 -04:00
/**
* Moves assets to a new path
*
* @ param Assets The assets to move
* @ param DestPath The destination folder in which to move the assets
* @ param SourcePath If non - empty , this will specify the base folder which will cause the move to maintain folder structure
*/
void MoveAssets ( const TArray < UObject * > & Assets , const FString & DestPath , const FString & SourcePath = FString ( ) ) ;
/** Attempts to deletes the specified assets. Returns the number of assets deleted */
int32 DeleteAssets ( const TArray < UObject * > & AssetsToDelete ) ;
/** Attempts to delete the specified folders and all assets inside them. Returns true if the operation succeeded. */
bool DeleteFolders ( const TArray < FString > & PathsToDelete ) ;
/** Gets an array of assets inside the specified folders */
void GetAssetsInPaths ( const TArray < FString > & InPaths , TArray < FAssetData > & OutAssetDataList ) ;
/** Saves all the specified packages */
bool SavePackages ( const TArray < UPackage * > & Packages ) ;
/** Prompts to save all modified packages */
bool SaveDirtyPackages ( ) ;
/** Loads all the specified packages */
TArray < UPackage * > LoadPackages ( const TArray < FString > & PackageNames ) ;
/** Displays a modeless message at the specified anchor. It is fine to specify a zero-size anchor, just use the top and left fields */
void DisplayMessage ( const FText & Message , const FSlateRect & ScreenAnchor , const TSharedRef < SWidget > & ParentContent ) ;
/** Displays a modeless message asking yes or no type question */
void DisplayConfirmationPopup ( const FText & Message , const FText & YesString , const FText & NoString , const TSharedRef < SWidget > & ParentContent , const FOnClicked & OnYesClicked , const FOnClicked & OnNoClicked = FOnClicked ( ) ) ;
/** Copies all assets in all source paths to the destination path, preserving path structure */
2015-05-13 15:42:54 -04:00
bool CopyFolders ( const TArray < FString > & InSourcePathNames , const FString & DestPath ) ;
2014-03-14 14:13:41 -04:00
/** Moves all assets in all source paths to the destination path, preserving path structure */
2015-05-13 15:42:54 -04:00
bool MoveFolders ( const TArray < FString > & InSourcePathNames , const FString & DestPath ) ;
2014-03-14 14:13:41 -04:00
/**
* A helper function for folder drag / drop which loads all assets in a path ( including sub - paths ) and returns the assets found
*
* @ param SourcePathNames The paths to the folders to drag / drop
* @ param OutSourcePathToLoadedAssets The map of source folder paths to assets found
*/
2015-05-13 15:42:54 -04:00
bool PrepareFoldersForDragDrop ( const TArray < FString > & SourcePathNames , TMap < FString , TArray < UObject * > > & OutSourcePathToLoadedAssets ) ;
2014-03-14 14:13:41 -04:00
/** Copies references to the specified assets to the clipboard */
void CopyAssetReferencesToClipboard ( const TArray < FAssetData > & AssetsToCopy ) ;
/**
* Capture active viewport to thumbnail and assigns that thumbnail to incoming assets
*
* @ param InViewport - viewport to sample from
* @ param InAssetsToAssign - assets that should receive the new thumbnail ONLY if they are assets that use GenericThumbnails
*/
void CaptureThumbnailFromViewport ( FViewport * InViewport , const TArray < FAssetData > & InAssetsToAssign ) ;
/**
* Clears custom thumbnails for the selected assets
*
* @ param InAssetsToAssign - assets that should have their thumbnail cleared
*/
void ClearCustomThumbnails ( const TArray < FAssetData > & InAssetsToAssign ) ;
/** Returns true if the specified asset that uses shared thumbnails has a thumbnail assigned to it */
bool AssetHasCustomThumbnail ( const FAssetData & AssetData ) ;
2015-01-29 11:47:03 -05:00
/** Extract the category of the given path */
ECBFolderCategory GetFolderCategory ( const FString & InPath ) ;
2014-03-14 14:13:41 -04:00
/** Returns true if the passed-in path is a engine folder */
bool IsEngineFolder ( const FString & InPath ) ;
/** Returns true if the passed-in path is a developers folder */
bool IsDevelopersFolder ( const FString & InPath ) ;
2014-07-02 13:18:43 -04:00
/** Returns true if the passed-in path is a plugin folder */
bool IsPluginFolder ( const FString & InPath ) ;
2014-03-14 14:13:41 -04:00
/** Get all the objects in a list of asset data */
void GetObjectsInAssetData ( const TArray < FAssetData > & AssetList , TArray < UObject * > & OutDroppedObjects ) ;
/** Returns true if the supplied folder name can be used as part of a package name */
bool IsValidFolderName ( const FString & FolderName , FText & Reason ) ;
/** Returns true if the path specified exists as a folder in the asset registry */
bool DoesFolderExist ( const FString & FolderPath ) ;
2015-01-16 15:39:47 -05:00
/** Check to see whether the given path is a root directory (either for asset or classes) */
bool IsRootDir ( const FString & FolderPath ) ;
/** Check to see whether the given path is a root asset directory */
2014-03-14 14:13:41 -04:00
bool IsAssetRootDir ( const FString & FolderPath ) ;
2015-01-16 15:39:47 -05:00
/** Check to see whether the given path is a root class directory */
bool IsClassRootDir ( const FString & FolderPath ) ;
/** Get the localized display name to use for the given root directory */
FText GetRootDirDisplayName ( const FString & FolderPath ) ;
/** Check to see whether the given path is rooted against a class directory */
bool IsClassPath ( const FString & InPath ) ;
2015-06-19 07:33:02 -04:00
/** Check to see whether the given path is rooted against a collection directory, optionally extracting the collection name and share type from the path */
bool IsCollectionPath ( const FString & InPath , FName * OutCollectionName = nullptr , ECollectionShareType : : Type * OutCollectionShareType = nullptr ) ;
2015-01-16 15:39:47 -05:00
/** Given an array of paths, work out how many are rooted against class roots, and how many are rooted against asset roots */
void CountPathTypes ( const TArray < FString > & InPaths , int32 & OutNumAssetPaths , int32 & OutNumClassPaths ) ;
/** Given an array of paths, work out how many are rooted against class roots, and how many are rooted against asset roots */
void CountPathTypes ( const TArray < FName > & InPaths , int32 & OutNumAssetPaths , int32 & OutNumClassPaths ) ;
/** Given an array of "asset" data, work out how many are assets, and how many are classes */
void CountItemTypes ( const TArray < FAssetData > & InItems , int32 & OutNumAssetItems , int32 & OutNumClassItems ) ;
/** Check to see whether the given path is a valid location in which to create new classes */
bool IsValidPathToCreateNewClass ( const FString & InPath ) ;
/** Check to see whether the given path is a valid location in which to create a new folder */
bool IsValidPathToCreateNewFolder ( const FString & InPath ) ;
2014-03-14 14:13:41 -04:00
/**
* Loads the color of this path from the config
*
* @ param FolderPath - The path to the folder
* @ return The color the folder should appear as , will be NULL if not customized
*/
const TSharedPtr < FLinearColor > LoadColor ( const FString & FolderPath ) ;
/**
* Saves the color of the path to the config
*
* @ param FolderPath - The path to the folder
* @ param FolderColor - The color the folder should appear as
* @ param bForceAdd - If true , force the color to be added for the path
*/
2015-01-16 15:39:47 -05:00
void SaveColor ( const FString & FolderPath , const TSharedPtr < FLinearColor > & FolderColor , bool bForceAdd = false ) ;
2014-03-14 14:13:41 -04:00
/**
* Checks to see if any folder has a custom color , optionally outputs them to a list
*
* @ param OutColors - If specified , returns all the custom colors being used
* @ return true , if custom colors are present
*/
bool HasCustomColors ( TArray < FLinearColor > * OutColors = NULL ) ;
/** Gets the default color the folder should appear as */
FLinearColor GetDefaultColor ( ) ;
/** Gets the platform specific text for the "explore" command (FPlatformProcess::ExploreFolder) */
FText GetExploreFolderText ( ) ;
2014-08-15 16:14:32 -04:00
/** Returns true if the specified path is available for object creation */
2014-09-01 13:25:23 -04:00
bool IsValidObjectPathForCreate ( const FString & ObjectPath , FText & OutErrorMessage , bool bAllowExistingAsset = false ) ;
2014-08-15 16:14:32 -04:00
2014-08-18 12:24:23 -04:00
/** Returns true if the specified folder name in the specified path is available for folder creation */
bool IsValidFolderPathForCreate ( const FString & FolderPath , const FString & NewFolderName , FText & OutErrorMessage ) ;
2014-08-26 11:11:44 -04:00
/** Checks to see whether the path is within the size restrictions for cooking */
bool IsValidPackageForCooking ( const FString & PackageName , FText & OutErrorMessage ) ;
2014-03-14 14:13:41 -04:00
}