11#include <util/ue-header-guard-begin.h>
12#include "CoreMinimal.h"
13#include "Subsystems/EngineSubsystem.h"
14#include <util/ue-header-guard-end.h>
16#include "ContentPackManager.generated.h"
68 virtual void Initialize(FSubsystemCollectionBase &Collection)
override;
86 bool Unmount(
const FString &Name, FString &OutError);
93 FString FindMapPackage(
const FString &MapName)
const;
96 TArray<FString> GetPackMapNames()
const;
99 TArray<FString> GetPackContentDirs()
const;
103 static TArray<FString> FindPackCatalogFiles(
const FString &RelativeName);
107 template <
typename T,
typename KeyFn>
108 static void MergeCatalog(TArray<T> &Into,
const TArray<T> &From, KeyFn Key)
110 for (
const T &Entry : From)
112 const FString EntryKey = Key(Entry);
113 const int32 Existing = Into.IndexOfByPredicate([&](
const T &
Other)
115 return Key(
Other).Equals(EntryKey, ESearchCase::IgnoreCase);
117 if (Existing != INDEX_NONE)
119 Into[Existing] = Entry;
130 static FString GetBaseReleaseStamp();
DECLARE_MULTICAST_DELEGATE_OneParam(FCarlaContentPackEvent, const FCarlaContentPack &)
Mounts CARLA content packs (content-only Unreal plugins cooked as DLC against a base release,...
bool MountPlugin(FCarlaContentPack &Pack, FString &OutError)
virtual void Initialize(FSubsystemCollectionBase &Collection) override
const TArray< FCarlaContentPack > & GetPacks() const
static void MergeCatalog(TArray< T > &Into, const TArray< T > &From, KeyFn Key)
Merge catalog entries: an entry whose key already exists replaces it in place (later files override b...
bool ArePackObjectsAlive(const FCarlaContentPack &Pack, FString &OutReason)
Objects under "/<Pack>/" survive a garbage collection (GC only runs when something from the pack was ...
bool Unmount(const FString &Name, FString &OutError)
Unmount a pack by name.
static UCarlaContentPackManager * Get()
virtual void Deinitialize() override
bool MountPaks(FCarlaContentPack &Pack, FString &OutError)
TArray< FCarlaContentPack > Packs
bool Mount(const FString &Path, FString &OutError, const FCarlaContentPack **OutPack=nullptr)
Mount a pack.
void UnmountPaks(FCarlaContentPack &Pack)
FCarlaContentPackEvent OnPackMounted
void RegisterAssetRegistry(FCarlaContentPack &Pack)
bool CheckCompatibility(const FCarlaContentPackManifest &Manifest, FString &OutError) const
void Discover()
Mount every pack found in <ProjectDir>/Packs/*/carla-pack.json, the directories listed in -carla-pac...
TArray< FString > GetDiscoveryDirs() const
FCarlaContentPackEvent OnPackUnmounted
bool IsPackInUse(const FCarlaContentPack &Pack, FString &OutReason) const
The pack map or one of its levels is loaded in some world (no GC).
A content pack known to the manager (discovered or mounted explicitly).
FString ContentDir
Absolute path of the plugin content dir (<PackDir>/Content), the filesystem side of the "/<Name>/" mo...
FString PluginFile
Absolute path of <PackDir>/<Name>.uplugin.
bool bEngineMounted
True when the plugin was mounted by the engine at startup (a pack dropped under Plugins/ with a ....
const FString & GetName() const
FString PackDir
Absolute pack directory (contains carla-pack.json and <Name>.uplugin).
FCarlaContentPackManifest Manifest
TArray< FString > MountedPaks
Pak files mounted for this pack (cooked builds only).