docs: anonymise project asset names in source comments

Measured figures are kept; only the studio-specific level and asset
names are generalised, and the Perforce rationale is reworded to
describe the class of setups rather than this one project.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-09-07 18:39:38 +07:00
parent de2d656d81
commit f6d651113a
19 changed files with 60 additions and 60 deletions
@@ -232,8 +232,8 @@ void AssetDependencyClosureSpec::Define()
It("does not follow a map that an ordinary asset merely mentions", [this]()
{
// The defect this guards against: exporting WP_Main pulled in the whole of L_MainLevel
// through BP_FirstPersonGameMode -> PDA_MenuSystemConfig, 9994 packages belonging to a
// The defect this guards against: exporting WP_Example pulled in the whole of L_Other
// through BP_GameMode -> PDA_MenuConfig, 9994 packages belonging to a
// different location. FLevelUsageResolver already refused that crossing; the closure
// did not, so the two disagreed about the same graph.
IAssetRegistry& Registry = ReadyRegistry();
@@ -176,7 +176,7 @@ BEGIN_DEFINE_SPEC(AssetUsageExporterLiveSpec,
/**
* The OFPA level with the fewest external actors.
*
* Smallest on purpose: WP_Main owns roughly 16000 external packages and copying those in a test
* Smallest on purpose: WP_Example owns roughly 16000 external packages and copying those in a test
* would move gigabytes. Search stops as soon as something small enough turns up.
*/
static FName FindSmallestOfpaLevel(int32& OutExternalCount)
@@ -254,7 +254,7 @@ void AssetUsageExporterLiveSpec::Define()
It("leaves the exported file writable even when the source is read-only", [this]()
{
// This project is Perforce-primary, so unopened files are read-only on disk and Windows
// Perforce-primary projects keep unopened files read-only, so unopened files are read-only on disk and Windows
// CopyFile carries the attribute across. A read-only export folder is useless to an
// artist and breaks the exporter's own Overwrite policy on the next run.
const FName Package = FindOrdinaryAssetPackage();
@@ -16,9 +16,9 @@ void AssetUsagePathsSpec::Define()
{
It("detects an OFPA external actor package", [this]()
{
// Real shape from this project: /Game/__ExternalActors__/Space/Maps/WP_Main/8/AB/<22 chars>
// Real shape from this project: /Game/__ExternalActors__/Space/Maps/WP_Example/8/AB/<22 chars>
TestTrue(TEXT("external actor"),
AssetUsagePaths::IsExternalPackage(FName(TEXT("/Game/__ExternalActors__/Space/Maps/WP_Main/8/AB/QWERTYUIOPASDFGHJKLZXC"))));
AssetUsagePaths::IsExternalPackage(FName(TEXT("/Game/__ExternalActors__/Space/Maps/WP_Example/8/AB/QWERTYUIOPASDFGHJKLZXC"))));
});
It("detects an external objects package", [this]()
@@ -30,13 +30,13 @@ void AssetUsagePathsSpec::Define()
It("does not flag an ordinary content package", [this]()
{
TestFalse(TEXT("ordinary asset"),
AssetUsagePaths::IsExternalPackage(FName(TEXT("/Game/Space/Art/SM_Rock"))));
AssetUsagePaths::IsExternalPackage(FName(TEXT("/Game/Art/SM_Rock"))));
});
It("does not flag a level that merely lives next to external actors", [this]()
{
TestFalse(TEXT("the level itself is not external"),
AssetUsagePaths::IsExternalPackage(FName(TEXT("/Game/Space/Maps/WP_Main"))));
AssetUsagePaths::IsExternalPackage(FName(TEXT("/Game/Maps/WP_Example"))));
});
});
@@ -123,7 +123,7 @@ void AssetUsagePathsSpec::Define()
{
const TArray<FString> Excluded;
TestFalse(TEXT("nothing excluded"),
AssetUsagePaths::IsPathExcluded(FName(TEXT("/Game/Space/Art/SM_Rock")), Excluded));
AssetUsagePaths::IsPathExcluded(FName(TEXT("/Game/Art/SM_Rock")), Excluded));
});
});
@@ -132,15 +132,15 @@ void AssetUsagePathsSpec::Define()
It("converts an asset package", [this]()
{
TestEqual(TEXT("asset"),
AssetUsagePaths::ToProjectRelativePath(FName(TEXT("/Game/Space/Art/SM_Rock")), false),
FString(TEXT("Content/Space/Art/SM_Rock.uasset")));
AssetUsagePaths::ToProjectRelativePath(FName(TEXT("/Game/Art/SM_Rock")), false),
FString(TEXT("Content/Art/SM_Rock.uasset")));
});
It("uses the umap extension for levels", [this]()
{
TestEqual(TEXT("level"),
AssetUsagePaths::ToProjectRelativePath(FName(TEXT("/Game/Space/Maps/WP_Main")), true),
FString(TEXT("Content/Space/Maps/WP_Main.umap")));
AssetUsagePaths::ToProjectRelativePath(FName(TEXT("/Game/Maps/WP_Example")), true),
FString(TEXT("Content/Maps/WP_Example.umap")));
});
It("returns empty for script and engine packages rather than inventing a path", [this]()
@@ -154,8 +154,8 @@ void AssetUsagePathsSpec::Define()
It("converts an external actor package, which is still under /Game", [this]()
{
TestEqual(TEXT("external actor"),
AssetUsagePaths::ToProjectRelativePath(FName(TEXT("/Game/__ExternalActors__/Space/Maps/WP_Main/8/AB/ABC")), false),
FString(TEXT("Content/__ExternalActors__/Space/Maps/WP_Main/8/AB/ABC.uasset")));
AssetUsagePaths::ToProjectRelativePath(FName(TEXT("/Game/__ExternalActors__/Space/Maps/WP_Example/8/AB/ABC")), false),
FString(TEXT("Content/__ExternalActors__/Space/Maps/WP_Example/8/AB/ABC.uasset")));
});
});
}
@@ -25,22 +25,22 @@ namespace
Result.Header.AppliedFilters.Add(TEXT("Types: StaticMesh"));
FAssetUsageRow& Used = Result.Rows.AddDefaulted_GetRef();
Used.PackageName = FName(TEXT("/Game/Space/Art/SM_Rock"));
Used.PackageName = FName(TEXT("/Game/Art/SM_Rock"));
Used.AssetName = FName(TEXT("SM_Rock"));
Used.ClassPath = FTopLevelAssetPath(TEXT("/Script/Engine.StaticMesh"));
Used.PathFromProjectRoot = TEXT("Content/Space/Art/SM_Rock.uasset");
Used.PathFromProjectRoot = TEXT("Content/Art/SM_Rock.uasset");
Used.Verdict = EAssetUsageVerdict::UsedOnLevel;
Used.Levels = { FName(TEXT("/Game/Space/Maps/WP_Main")), FName(TEXT("/Game/Space/Maps/L_3i_Hub")) };
Used.Levels = { FName(TEXT("/Game/Maps/WP_Example")), FName(TEXT("/Game/Maps/L_3i_Hub")) };
Used.HardReferenceCount = 3;
Used.SoftReferenceCount = 1;
Used.Provenance = EAssetUsageProvenance::HardReference | EAssetUsageProvenance::ExternalActor;
Used.Route = TEXT("WP_Main -> BP_Rock -> SM_Rock");
Used.Route = TEXT("WP_Example -> BP_Rock -> SM_Rock");
FAssetUsageRow& Unused = Result.Rows.AddDefaulted_GetRef();
Unused.PackageName = FName(TEXT("/Game/Space/Art/SM_Orphan"));
Unused.PackageName = FName(TEXT("/Game/Art/SM_Orphan"));
Unused.AssetName = FName(TEXT("SM_Orphan"));
Unused.ClassPath = FTopLevelAssetPath(TEXT("/Script/Engine.StaticMesh"));
Unused.PathFromProjectRoot = TEXT("Content/Space/Art/SM_Orphan.uasset");
Unused.PathFromProjectRoot = TEXT("Content/Art/SM_Orphan.uasset");
Unused.Verdict = EAssetUsageVerdict::Unreferenced;
return Result;
@@ -123,7 +123,7 @@ void AssetUsageReportWriterSpec::Define()
const FString Csv = FAssetUsageReportWriter::BuildCsv(Sample, Options);
TestTrue(TEXT("levels joined"),
Csv.Contains(TEXT("/Game/Space/Maps/WP_Main|/Game/Space/Maps/L_3i_Hub")));
Csv.Contains(TEXT("/Game/Maps/WP_Example|/Game/Maps/L_3i_Hub")));
});
It("carries the verdict verbatim", [this]()
@@ -45,7 +45,7 @@ void AssetUsageVerdictSpec::Define()
It("reports ReferencedFromConfigOrSource when only a text literal names it", [this]()
{
// This is the BP_FirstPersonGameMode case: no asset references it, only
// This is the BP_GameMode case: no asset references it, only
// Config/DefaultEngine.ini does. Reporting it Unreferenced would be a real defect.
const EAssetUsageVerdict Verdict = FAssetUsageAuditor::ClassifyVerdict(false, false, true, false);
@@ -126,7 +126,7 @@ void AssetUsageVerdictSpec::Define()
{
// A level depends on the whole table, so every row looks used even when none is.
FAssetUsageNode Node;
Node.PackageName = FName(TEXT("/Game/Space/Data/DT_Weapons"));
Node.PackageName = FName(TEXT("/Game/Data/DT_Weapons"));
Node.ClassPath = FTopLevelAssetPath(TEXT("/Script/Engine.DataTable"));
TestTrue(TEXT("DataTable is a blind spot"), FAssetUsageAuditor::IsRegistryBlindSpot(Node));
@@ -135,7 +135,7 @@ void AssetUsageVerdictSpec::Define()
It("does not flag an ordinary static mesh", [this]()
{
FAssetUsageNode Node;
Node.PackageName = FName(TEXT("/Game/Space/Art/SM_Rock"));
Node.PackageName = FName(TEXT("/Game/Art/SM_Rock"));
Node.ClassPath = FTopLevelAssetPath(TEXT("/Script/Engine.StaticMesh"));
TestFalse(TEXT("StaticMesh is not a blind spot"), FAssetUsageAuditor::IsRegistryBlindSpot(Node));
@@ -28,70 +28,70 @@ void IndirectReferenceScannerSpec::Define()
It("finds the GameMode from DefaultEngine.ini and strips the _C class suffix", [this]()
{
const TArray<FString> Found = Extract(
TEXT("GlobalDefaultGameMode=/Game/Space/Core/GameModes/BP_FirstPersonGameMode.BP_FirstPersonGameMode_C"));
TEXT("GlobalDefaultGameMode=/Game/Core/GameModes/BP_GameMode.BP_GameMode_C"));
TestEqual(TEXT("one hit"), Found.Num(), 1);
if (Found.Num() == 1)
{
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Space/Core/GameModes/BP_FirstPersonGameMode")));
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Core/GameModes/BP_GameMode")));
}
});
It("finds the GameInstance from MenuSystemPro", [this]()
It("finds the GameInstance from a purchased UI pack", [this]()
{
const TArray<FString> Found = Extract(
TEXT("GameInstanceClass=/Game/MenuSystemPro/Blueprints/GameFramework/BP_MenuSystemGameInstance.BP_MenuSystemGameInstance_C"));
TEXT("GameInstanceClass=/Game/a purchased UI pack/Blueprints/GameFramework/BP_MenuGameInstance.BP_MenuGameInstance_C"));
TestEqual(TEXT("one hit"), Found.Num(), 1);
if (Found.Num() == 1)
{
TestEqual(TEXT("package"), Found[0],
FString(TEXT("/Game/MenuSystemPro/Blueprints/GameFramework/BP_MenuSystemGameInstance")));
FString(TEXT("/Game/a purchased UI pack/Blueprints/GameFramework/BP_MenuGameInstance")));
}
});
It("finds a map reference with an object suffix", [this]()
{
const TArray<FString> Found = Extract(TEXT("EditorStartupMap=/Game/Space/Maps/Gyms/Gyms_Geoda.Gyms_Geoda"));
const TArray<FString> Found = Extract(TEXT("EditorStartupMap=/Game/Maps/Gyms/Gyms_Geoda.Gyms_Geoda"));
TestEqual(TEXT("one hit"), Found.Num(), 1);
if (Found.Num() == 1)
{
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Space/Maps/Gyms/Gyms_Geoda")));
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Maps/Gyms/Gyms_Geoda")));
}
});
It("finds a bare package path with no object suffix", [this]()
{
const TArray<FString> Found = Extract(TEXT("GameDefaultMap=/Game/Space/Maps/RefinedMenuMap"));
const TArray<FString> Found = Extract(TEXT("GameDefaultMap=/Game/Maps/RefinedMenuMap"));
TestEqual(TEXT("one hit"), Found.Num(), 1);
if (Found.Num() == 1)
{
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Space/Maps/RefinedMenuMap")));
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Maps/RefinedMenuMap")));
}
});
It("strips surrounding quotes and parentheses from an ini struct value", [this]()
{
const TArray<FString> Found = Extract(TEXT("+DirectoriesToAlwaysCook=(Path=\"/Game/Space/Art\")"));
const TArray<FString> Found = Extract(TEXT("+DirectoriesToAlwaysCook=(Path=\"/Game/Art\")"));
TestEqual(TEXT("one hit"), Found.Num(), 1);
if (Found.Num() == 1)
{
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Space/Art")));
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Art")));
}
});
It("handles a C++ literal wrapped in TEXT()", [this]()
{
const TArray<FString> Found = Extract(
TEXT("static const FSoftObjectPath Path(TEXT(\"/Game/Space/Art/SM_Rock\"));"));
TEXT("static const FSoftObjectPath Path(TEXT(\"/Game/Art/SM_Rock\"));"));
TestEqual(TEXT("one hit"), Found.Num(), 1);
if (Found.Num() == 1)
{
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Space/Art/SM_Rock")));
TestEqual(TEXT("package"), Found[0], FString(TEXT("/Game/Art/SM_Rock")));
}
});