ExtContentBrowserSettings.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. // Copyright 2017-2021 marynate. All Rights Reserved.
  2. #pragma once
  3. #include "CoreMinimal.h"
  4. #include "UObject/ObjectMacros.h"
  5. #include "UObject/Object.h"
  6. #include "ExtContentBrowserSettings.generated.h"
  7. /**
  8. * Implements external content browser settings. These are global not per-project
  9. */
  10. UCLASS(config=EditorSettings)
  11. class UExtContentBrowserSettings : public UObject
  12. {
  13. GENERATED_UCLASS_BODY()
  14. public:
  15. /** The number of objects to load at once in the Content Browser before displaying a warning about loading many assets */
  16. UPROPERTY(EditAnywhere, config, Category=ContentBrowser, meta=(DisplayName = "Assets to Load at Once Before Warning", ClampMin = "1"))
  17. int32 NumObjectsToLoadBeforeWarning;
  18. /** Whether the Content Browser should open the Sources Panel by default */
  19. UPROPERTY(EditAnywhere, config, Category = ContentBrowser)
  20. bool bOpenSourcesPanelByDefault;
  21. /** Whether to display folders in the asset view of the content browser. Note that this implies 'Show Only Assets in Selected Folders'. */
  22. UPROPERTY(config)
  23. bool DisplayFolders;
  24. /** Whether to empty display folders in the asset view of the content browser. */
  25. UPROPERTY(config)
  26. bool DisplayEmptyFolders;
  27. /** Whether to display tooltip in the asset view. */
  28. UPROPERTY(config)
  29. bool DisplayAssetTooltip;
  30. /** Whether to empty engine version as asset thumbnail overlay */
  31. UPROPERTY(config)
  32. bool DisplayEngineVersionOverlay;
  33. /** Whether to display asset validation result as overlay. */
  34. UPROPERTY(config)
  35. bool DisplayValidationStatusOverlay;
  36. /** Whether to empty content type as asset thumbnail overlay */
  37. UPROPERTY(config)
  38. bool DisplayContentTypeOverlay;
  39. /** Whether to show invalid assets in the asset view of the content browser. */
  40. UPROPERTY(config)
  41. bool DisplayInvalidAssets;
  42. /** Whether to display toolbar button. */
  43. UPROPERTY(config)
  44. bool DisplayToolbarButton;
  45. /** Whether search and filter assets recursively. */
  46. UPROPERTY(config)
  47. bool SearchAndFilterRecursively;
  48. /** Whether use straight or spline connect line between nodes in dependency viewer. */
  49. UPROPERTY(config)
  50. bool UseStraightLineInDependencyViewer;
  51. /** Whether to show dependency viewer under asset view or on the right of asset view. */
  52. UPROPERTY(config)
  53. bool ShowDependencyViewerUnderAssetView;
  54. /** The number of objects to keep in the Content Browser Recently Opened filter */
  55. UPROPERTY(EditAnywhere, config, Category = ContentBrowser, meta = (DisplayName = "Number of Assets to Keep in the Recently Opened Filter", ClampMin = "1", ClampMax = "30"))
  56. int32 NumObjectsInRecentList;
  57. /** Whether the Content Browser should open the Sources Panel by default */
  58. UPROPERTY(EditAnywhere, config, Category = ContentBrowser)
  59. bool bShowFullCollectionNameInToolTip;
  60. //////////////////////////
  61. // Cache Setting
  62. UPROPERTY(EditAnywhere, config, Category = CacheDB)
  63. bool bCacheMode;
  64. UPROPERTY(EditAnywhere, config, Category = CacheDB)
  65. FLinearColor CacheModeBorderColor;
  66. /** If caching is enabled then it will save cache on close. */
  67. UPROPERTY(EditAnywhere, config, Category = CacheDB)
  68. bool bAutoSaveCacheOnExit;
  69. UPROPERTY(EditAnywhere, config, Category = CacheDB)
  70. bool bAutoSaveCacheOnSwitchToCacheMode;
  71. /** If caching is enabled then it will save cache on close. */
  72. UPROPERTY(EditAnywhere, config, Category = CacheDB)
  73. bool bKeepCachedAssetsWhenRootRemoved;
  74. UPROPERTY(EditAnywhere, config, Category = CacheDB)
  75. bool bShowCacheStatusBarInLiveMode;
  76. /** The number of objects to load at once in the Content Browser before displaying a warning about loading many assets */
  77. UPROPERTY(EditAnywhere, config, Category = CacheDB, meta = (DisplayName = "Cache Database File Path"))
  78. FFilePath CacheFilePath;
  79. //////////////////////////
  80. // Thumbnail Settings
  81. UPROPERTY(EditAnywhere, config, Category = ThumbnailPool)
  82. bool bUseThumbnailPool;
  83. UPROPERTY(EditAnywhere, config, Category = ThumbnailPool)
  84. int32 NumThumbnailsInPool;
  85. //////////////////////////
  86. // Import Settings
  87. UPROPERTY(config)
  88. bool bSkipImportIfAnyDependencyMissing;
  89. UPROPERTY(config)
  90. bool bImportIgnoreSoftReferencesError;
  91. UPROPERTY(config)
  92. bool bImportOverwriteExistingFiles;
  93. UPROPERTY(config)
  94. bool bRollbackImportIfFailed;
  95. UPROPERTY(config)
  96. bool bImportSyncAssetsInContentBrowser;
  97. UPROPERTY(config)
  98. bool bImportSyncExistingAssets;
  99. UPROPERTY(config)
  100. bool bLoadAssetAfterImport;
  101. UPROPERTY(config)
  102. bool bAddImportedAssetsToCollection;
  103. UPROPERTY(config)
  104. bool bUniqueCollectionNameForEachImportSession;
  105. UPROPERTY(config)
  106. FName DefaultImportedUAssetCollectionName;
  107. UPROPERTY(config)
  108. bool bImportToPluginFolder;
  109. UPROPERTY(config)
  110. bool bWarnBeforeImportToPluginFolder;
  111. UPROPERTY(config)
  112. FName ImportToPluginName;
  113. UPROPERTY(config)
  114. bool bImportFolderColor;
  115. UPROPERTY(config)
  116. bool bOverrideExistingFolderColor;
  117. //////////////////////////
  118. // Export Settings
  119. UPROPERTY(config)
  120. bool bSkipExportIfAnyDependencyMissing;
  121. UPROPERTY(config)
  122. bool bExportIgnoreSoftReferencesError;
  123. UPROPERTY(config)
  124. bool bExportOverwriteExistingFiles;
  125. UPROPERTY(config)
  126. bool bRollbackExportIfFailed;
  127. UPROPERTY(config)
  128. bool bOpenFolderAfterExport;
  129. //////////////////////////
  130. // Folder Tree Settings
  131. UPROPERTY(config)
  132. bool bIgnoreFoldersStartWithDot;
  133. UPROPERTY(config)
  134. bool bIgnoreCommonNonContentFolders;
  135. TArray<FString> CommonNonContentFolders;
  136. UPROPERTY(config)
  137. bool bIgnoreExternalContentFolders;
  138. TArray<FString> ExternalContentFolders;
  139. UPROPERTY(config)
  140. bool bIgnoreMoreFolders;
  141. UPROPERTY(config)
  142. TArray<FString> IgnoreFolders;
  143. public:
  144. /** Reset all setting to factory default */
  145. void Reset();
  146. /** Sets whether we are allowed to display the engine folder or not, optional flag for setting override instead */
  147. void SetDisplayEngineFolder( bool bInDisplayEngineFolder, bool bOverride = false )
  148. {
  149. bOverride ? OverrideDisplayEngineFolder = bInDisplayEngineFolder : DisplayEngineFolder = bInDisplayEngineFolder;
  150. }
  151. /** Gets whether we are allowed to display the engine folder or not, optional flag ignoring the override */
  152. bool GetDisplayEngineFolder( bool bExcludeOverride = false ) const
  153. {
  154. return ( ( bExcludeOverride ? false : OverrideDisplayEngineFolder ) || DisplayEngineFolder );
  155. }
  156. /** Sets whether we are allowed to display the developers folder or not, optional flag for setting override instead */
  157. void SetDisplayDevelopersFolder( bool bInDisplayDevelopersFolder, bool bOverride = false )
  158. {
  159. bOverride ? OverrideDisplayDevelopersFolder = bInDisplayDevelopersFolder : DisplayDevelopersFolder = bInDisplayDevelopersFolder;
  160. }
  161. /** Gets whether we are allowed to display the developers folder or not, optional flag ignoring the override */
  162. bool GetDisplayDevelopersFolder( bool bExcludeOverride = false ) const
  163. {
  164. return ( ( bExcludeOverride ? false : OverrideDisplayDevelopersFolder ) || DisplayDevelopersFolder );
  165. }
  166. /** Sets whether we are allowed to display the L10N folder (contains localized assets) or not */
  167. void SetDisplayL10NFolder(bool bInDisplayL10NFolder)
  168. {
  169. DisplayL10NFolder = bInDisplayL10NFolder;
  170. }
  171. /** Gets whether we are allowed to display the L10N folder (contains localized assets) or not */
  172. bool GetDisplayL10NFolder() const
  173. {
  174. return DisplayL10NFolder;
  175. }
  176. /** Sets whether we are allowed to display the plugin folders or not, optional flag for setting override instead */
  177. void SetDisplayPluginFolders( bool bInDisplayPluginFolders, bool bOverride = false )
  178. {
  179. bOverride ? OverrideDisplayPluginFolders = bInDisplayPluginFolders : DisplayPluginFolders = bInDisplayPluginFolders;
  180. }
  181. /** Gets whether we are allowed to display the plugin folders or not, optional flag ignoring the override */
  182. bool GetDisplayPluginFolders( bool bExcludeOverride = false ) const
  183. {
  184. return ( ( bExcludeOverride ? false : OverrideDisplayPluginFolders ) || DisplayPluginFolders );
  185. }
  186. /** Sets whether we are allowed to display collection folders or not */
  187. void SetDisplayCollections(bool bInDisplayCollections)
  188. {
  189. DisplayCollections = bInDisplayCollections;
  190. }
  191. /** Gets whether we are allowed to display the collection folders or not*/
  192. bool GetDisplayCollections() const
  193. {
  194. return DisplayCollections;
  195. }
  196. /** Sets whether we are allowed to display favorite folders or not */
  197. void SetDisplayFavorites(bool bInDisplayFavorites)
  198. {
  199. DisplayFavorites = bInDisplayFavorites;
  200. }
  201. /** Gets whether we are allowed to display the favorite folders or not*/
  202. bool GetDisplayFavorites() const
  203. {
  204. return DisplayFavorites;
  205. }
  206. /** Sets whether we are allowed to display C++ folders or not */
  207. void SetDisplayCppFolders(bool bDisplay)
  208. {
  209. DisplayCppFolders = bDisplay;
  210. }
  211. /** Gets whether we are allowed to display the C++ folders or not*/
  212. bool GetDisplayCppFolders() const
  213. {
  214. return DisplayCppFolders;
  215. }
  216. /** Sets whether text searches should also search in asset class names */
  217. void SetIncludeClassNames(bool bInclude)
  218. {
  219. IncludeClassNames = bInclude;
  220. }
  221. /** Gets whether text searches should also search in asset class names */
  222. bool GetIncludeClassNames() const
  223. {
  224. return IncludeClassNames;
  225. }
  226. /** Sets whether text searches should also search asset paths (instead of asset name only) */
  227. void SetIncludeAssetPaths(bool bInclude)
  228. {
  229. IncludeAssetPaths = bInclude;
  230. }
  231. /** Gets whether text searches should also search asset paths (instead of asset name only) */
  232. bool GetIncludeAssetPaths() const
  233. {
  234. return IncludeAssetPaths;
  235. }
  236. /** Sets whether text searches should also search for collection names */
  237. void SetIncludeCollectionNames(bool bInclude)
  238. {
  239. IncludeCollectionNames = bInclude;
  240. }
  241. /** Gets whether text searches should also search for collection names */
  242. bool GetIncludeCollectionNames() const
  243. {
  244. return IncludeCollectionNames;
  245. }
  246. /**
  247. * Returns an event delegate that is executed when a setting has changed.
  248. *
  249. * @return The delegate.
  250. */
  251. DECLARE_EVENT_OneParam(UExtContentBrowserSettings, FSettingChangedEvent, FName /*PropertyName*/);
  252. static FSettingChangedEvent& OnSettingChanged( ) { return SettingChangedEvent; }
  253. void ResetCacheSettings();
  254. void ResetThumbnailPoolSettings();
  255. /** Reset Import Settings to default */
  256. void ResetImportSettings();
  257. /** Reset Import Settings to default */
  258. void ResetExportSettings();
  259. void ResetViewSettings();
  260. protected:
  261. // UObject overrides
  262. virtual void PostEditChangeProperty( struct FPropertyChangedEvent& PropertyChangedEvent ) override;
  263. private:
  264. /** Whether to display the engine folder in the assets view of the content browser. */
  265. UPROPERTY(config)
  266. bool DisplayEngineFolder;
  267. /** If true, overrides the DisplayEngine setting */
  268. bool OverrideDisplayEngineFolder;
  269. /** Whether to display the developers folder in the path view of the content browser */
  270. UPROPERTY(config)
  271. bool DisplayDevelopersFolder;
  272. UPROPERTY(config)
  273. bool DisplayL10NFolder;
  274. /** If true, overrides the DisplayDev setting */
  275. bool OverrideDisplayDevelopersFolder;
  276. /** List of plugin folders to display in the content browser. */
  277. UPROPERTY(config)
  278. bool DisplayPluginFolders;
  279. /** Temporary override for the DisplayPluginFolders setting */
  280. bool OverrideDisplayPluginFolders;
  281. UPROPERTY(config)
  282. bool DisplayCollections;
  283. UPROPERTY(config)
  284. bool DisplayFavorites;
  285. UPROPERTY(config)
  286. bool DisplayCppFolders;
  287. UPROPERTY(config)
  288. bool IncludeClassNames;
  289. UPROPERTY(config)
  290. bool IncludeAssetPaths;
  291. UPROPERTY(config)
  292. bool IncludeCollectionNames;
  293. // Holds an event delegate that is executed when a setting has changed.
  294. static FSettingChangedEvent SettingChangedEvent;
  295. };