|
CARLA
|
Mounts CARLA content packs (content-only Unreal plugins cooked as DLC against a base release, wrapped with a carla-pack.json manifest) into the running process, editor or cooked game alike. More...
#include <ContentPackManager.h>
Inheritance diagram for UCarlaContentPackManager:Public Member Functions | |
| virtual void | Deinitialize () override |
| void | Discover () |
| Mount every pack found in <ProjectDir>/Packs/*/carla-pack.json, the directories listed in -carla-packs=<dir>[;<dir>] and $CARLA_PACKS, and adopt every plugin the engine already mounted at startup that carries a carla-pack.json next to its .uplugin (drop-in under Plugins/). | |
| FString | FindMapPackage (const FString &MapName) const |
| Long package name of a map declared by a mounted pack, or empty. | |
| const FCarlaContentPack * | FindPack (const FString &Name) const |
| TArray< FString > | GetPackContentDirs () const |
| Content dirs of all mounted packs, in mount order. | |
| TArray< FString > | GetPackMapNames () const |
| Map names declared by all mounted packs. | |
| const TArray< FCarlaContentPack > & | GetPacks () const |
| virtual void | Initialize (FSubsystemCollectionBase &Collection) override |
| bool | Mount (const FString &Path, FString &OutError, const FCarlaContentPack **OutPack=nullptr) |
| Mount a pack. | |
| bool | Unmount (const FString &Name, FString &OutError) |
| Unmount a pack by name. | |
Static Public Member Functions | |
| static TArray< FString > | FindPackCatalogFiles (const FString &RelativeName) |
| <ContentDir>/Config/<RelativeName> of every mounted pack where the file exists, in mount order (later packs override earlier ones by id). | |
| static UCarlaContentPackManager * | Get () |
| static FString | GetBaseReleaseStamp () |
| Base release stamp of this binary (<ProjectDir>/BaseRelease), empty in editor/dev builds. | |
| template<typename T , typename KeyFn > | |
| 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 by id), new keys are appended. | |
Public Attributes | |
| FCarlaContentPackEvent | OnPackMounted |
| FCarlaContentPackEvent | OnPackUnmounted |
Private Member Functions | |
| bool | ArePackObjectsAlive (const FCarlaContentPack &Pack, FString &OutReason) |
| Objects under "/<Pack>/" survive a garbage collection (GC only runs when something from the pack was loaded at all). | |
| bool | CheckCompatibility (const FCarlaContentPackManifest &Manifest, FString &OutError) const |
| TArray< FString > | GetDiscoveryDirs () const |
| bool | IsPackInUse (const FCarlaContentPack &Pack, FString &OutReason) const |
| The pack map or one of its levels is loaded in some world (no GC). | |
| bool | MountPaks (FCarlaContentPack &Pack, FString &OutError) |
| bool | MountPlugin (FCarlaContentPack &Pack, FString &OutError) |
| void | RegisterAssetRegistry (FCarlaContentPack &Pack) |
| void | UnmountPaks (FCarlaContentPack &Pack) |
Private Attributes | |
| bool | bDiscovered = false |
| TArray< FCarlaContentPack > | Packs |
Mounts CARLA content packs (content-only Unreal plugins cooked as DLC against a base release, wrapped with a carla-pack.json manifest) into the running process, editor or cooked game alike.
Implemented as a UEngineSubsystem: it outlives game instances and worlds, so packs survive load_world, and it exists before the first map loads. Auto-discovery runs from Initialize() in game processes (packaged binary or editor -game); FCarlaEngine::NotifyInitGame calls Discover() again as a no-op safety net so the RPC server never starts before the packs are in. The full editor and commandlets (the cooker) do not auto-mount packs.
Definition at line 60 of file ContentPackManager.h.
|
private |
Objects under "/<Pack>/" survive a garbage collection (GC only runs when something from the pack was loaded at all).
Definition at line 774 of file ContentPackManager.cpp.
References UCarlaContentPackManager_LoadedPackages(), and UCarlaContentPackManager_PackagePrefixes().
Referenced by Unmount().
|
private |
Definition at line 277 of file ContentPackManager.cpp.
References FCarlaContentPackManifest::BaseRelease, FCarlaContentPackManifest::EngineVersion, GetBaseReleaseStamp(), FCarlaContentPackManifest::Name, and FCarlaContentPackManifest::Platform.
Referenced by Mount().
|
overridevirtual |
Definition at line 62 of file ContentPackManager.cpp.
| void UCarlaContentPackManager::Discover | ( | ) |
Mount every pack found in <ProjectDir>/Packs/*/carla-pack.json, the directories listed in -carla-packs=<dir>[;<dir>] and $CARLA_PACKS, and adopt every plugin the engine already mounted at startup that carries a carla-pack.json next to its .uplugin (drop-in under Plugins/).
Idempotent; failures are logged, not fatal.
Definition at line 108 of file ContentPackManager.cpp.
References bDiscovered, CARLA_PACK_MANIFEST_NAME, FindPack(), GetBaseReleaseStamp(), GetDiscoveryDirs(), FCarlaContentPackManifest::LoadFromFile(), Mount(), and FCarlaContentPackManifest::Name.
Referenced by Initialize().
| FString UCarlaContentPackManager::FindMapPackage | ( | const FString & | MapName | ) | const |
Long package name of a map declared by a mounted pack, or empty.
Definition at line 195 of file ContentPackManager.cpp.
References Packs.
| const FCarlaContentPack * UCarlaContentPackManager::FindPack | ( | const FString & | Name | ) | const |
Definition at line 183 of file ContentPackManager.cpp.
References Packs.
Referenced by FCarlaServer::FPimpl::BindActions(), and Discover().
|
static |
<ContentDir>/Config/<RelativeName> of every mounted pack where the file exists, in mount order (later packs override earlier ones by id).
Definition at line 243 of file ContentPackManager.cpp.
References Get(), and GetPackContentDirs().
Referenced by ABlueprintActorFactory::GetDefinitions(), APropActorFactory::GetDefinitions(), AVehicleActorFactory::GetDefinitions(), and AWalkerActorFactory::GetDefinitions().
|
static |
Definition at line 38 of file ContentPackManager.cpp.
Referenced by FCarlaServer::FPimpl::BindActions(), UCarlaBlueprintRegistry::FindContentPackPropFiles(), UCarlaStatics::FindMapPath(), FindPackCatalogFiles(), UOpenDrive::FindPathToXODRFile(), UCarlaStatics::GetAllMapNames(), FNavigationMesh::Load(), and FCarlaEngine::NotifyInitGame().
|
static |
Base release stamp of this binary (<ProjectDir>/BaseRelease), empty in editor/dev builds.
Definition at line 262 of file ContentPackManager.cpp.
Referenced by CheckCompatibility(), and Discover().
|
private |
Definition at line 71 of file ContentPackManager.cpp.
Referenced by Discover().
| TArray< FString > UCarlaContentPackManager::GetPackContentDirs | ( | ) | const |
Content dirs of all mounted packs, in mount order.
Definition at line 230 of file ContentPackManager.cpp.
References Packs.
Referenced by FindPackCatalogFiles().
| TArray< FString > UCarlaContentPackManager::GetPackMapNames | ( | ) | const |
Map names declared by all mounted packs.
Definition at line 214 of file ContentPackManager.cpp.
References Packs.
|
inline |
Definition at line 88 of file ContentPackManager.h.
Referenced by FCarlaServer::FPimpl::BindActions().
|
overridevirtual |
Definition at line 47 of file ContentPackManager.cpp.
References Discover().
|
private |
The pack map or one of its levels is loaded in some world (no GC).
Definition at line 721 of file ContentPackManager.cpp.
References UCarlaContentPackManager_IsPackPackage(), and UCarlaContentPackManager_PackagePrefixes().
Referenced by Unmount().
|
inlinestatic |
Merge catalog entries: an entry whose key already exists replaces it in place (later files override by id), new keys are appended.
Definition at line 108 of file ContentPackManager.h.
References Other.
Referenced by ABlueprintActorFactory::GetDefinitions(), APropActorFactory::GetDefinitions(), AVehicleActorFactory::GetDefinitions(), and AWalkerActorFactory::GetDefinitions().
| bool UCarlaContentPackManager::Mount | ( | const FString & | Path, |
| FString & | OutError, | ||
| const FCarlaContentPack ** | OutPack = nullptr |
||
| ) |
Mount a pack.
Path is the pack directory or its carla-pack.json. On failure OutError names the reason and the pack list is unchanged (unless the pack was already known, in which case it stays unmounted).
Definition at line 525 of file ContentPackManager.cpp.
References FCarlaContentPack::bEngineMounted, FCarlaContentPack::bMounted, CARLA_PACK_MANIFEST_NAME, CheckCompatibility(), FCarlaContentPack::ContentDir, FCarlaContentPackManifest::GetMapNames(), FCarlaContentPack::GetName(), UCarlaStatics::InvalidateMapCache(), IsValid(), FCarlaContentPackManifest::LoadFromFile(), FCarlaContentPack::Manifest, FCarlaContentPackManifest::Maps, MountPaks(), MountPlugin(), FCarlaContentPackManifest::Name, OnPackMounted, FCarlaContentPack::PackDir, FCarlaContentPackManifest::PackDir, Packs, FCarlaContentPack::PluginFile, RegisterAssetRegistry(), UnmountPaks(), and FCarlaContentPackManifest::Version.
Referenced by FCarlaServer::FPimpl::BindActions(), and Discover().
|
private |
Definition at line 339 of file ContentPackManager.cpp.
References FCarlaContentPack::ContentDir, FCarlaContentPack::GetName(), FCarlaContentPack::MountedPaks, and UnmountPaks().
Referenced by Mount().
|
private |
Definition at line 418 of file ContentPackManager.cpp.
References FCarlaContentPack::ContentDir, FCarlaContentPack::GetName(), and FCarlaContentPack::PluginFile.
Referenced by Mount().
|
private |
Definition at line 483 of file ContentPackManager.cpp.
References FCarlaContentPack::GetName(), FCarlaContentPack::PackDir, and State.
Referenced by Mount().
| bool UCarlaContentPackManager::Unmount | ( | const FString & | Name, |
| FString & | OutError | ||
| ) |
Unmount a pack by name.
Refused while a world of the pack is loaded or any object under "/<Name>/" survives a garbage collection.
Definition at line 798 of file ContentPackManager.cpp.
References ArePackObjectsAlive(), FCarlaContentPack::bEngineMounted, FCarlaContentPack::bMounted, FCarlaContentPack::GetName(), UCarlaStatics::InvalidateMapCache(), IsPackInUse(), IsValid(), OnPackUnmounted, Packs, and UnmountPaks().
Referenced by FCarlaServer::FPimpl::BindActions().
|
private |
Definition at line 401 of file ContentPackManager.cpp.
References FCarlaContentPack::GetName(), and FCarlaContentPack::MountedPaks.
Referenced by Mount(), MountPaks(), and Unmount().
|
private |
Definition at line 159 of file ContentPackManager.h.
Referenced by Discover().
| FCarlaContentPackEvent UCarlaContentPackManager::OnPackMounted |
Definition at line 132 of file ContentPackManager.h.
Referenced by Mount().
| FCarlaContentPackEvent UCarlaContentPackManager::OnPackUnmounted |
Definition at line 134 of file ContentPackManager.h.
Referenced by Unmount().
|
private |
Definition at line 157 of file ContentPackManager.h.
Referenced by FindMapPackage(), FindPack(), GetPackContentDirs(), GetPackMapNames(), Mount(), and Unmount().