Files
AssetUsageAudit/Source/AssetUsageAuditEditor/Private/AssetUsageAuditSettings.cpp
T
MagentaDolphin b7f5343a73 feat: asset usage audit plugin
Editor tool for the LA and 3D departments: which assets each level uses,
which are used nowhere, and export of a chosen set.

Three modules. AssetUsageAuditCore holds the whole analysis and links no
UI and no editor-only asset pipeline, so it stays runnable from a
commandlet; AssetUsageAuditEditor holds the Slate panel and everything
that needs UnrealEd or AssetTools; AssetUsageAuditTests holds 152 specs.

Load-bearing decisions, each of which produces a wrong answer if undone:

- Dependency queries are always Package + NoRequirements, never Hard. The
  map-to-external-actor edges the OFPA gatherer emits carry Game|Build
  without Hard, so a Hard query drops all 16117 external actor packages
  in this project. There is deliberately no Hard constant in the code.
- Crossing into another map is allowed only from a level or its external
  actor package. Without that rule WP_Main reported 18136 assets, of
  which 9994 belonged to L_MainLevel, reached through the GameMode.
- The verdict has five states, never a bool. The registry cannot see
  FMOD events, DataTable rows or string-built paths; those are Unknown,
  and the tool never proposes a deletion.
- Copying .uasset files does not preserve references - they are stored as
  full package paths. Only the Migrate layout produces something Unreal
  can open; the others write a manifest so the graph can be rebuilt.

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-09-03 17:07:59 +07:00

48 lines
1.6 KiB
C++

// NextGenium 2026. Asset Usage Audit.
#include "AssetUsageAuditSettings.h"
#include "Misc/App.h"
#include "Misc/Paths.h"
UAssetUsageAuditSettings::UAssetUsageAuditSettings()
{
// Bought content packs. Measured on this project: roughly two thirds of the 80k assets are
// third-party, so leaving these in makes the first run unreadable for an artist looking for
// their own content.
//
// Deliberately NOT excluded, despite being a bought pack: Content/MenuSystemPro. It supplies
// BP_MenuSystemGameInstance, which DefaultEngine.ini names as the project's GameInstance.
// Excluding it would hide a load-bearing asset from every report.
ExcludedPackagePaths = {
TEXT("Content/3rdParty"),
TEXT("Content/StarterContent"),
TEXT("Content/StarterBundle"),
TEXT("Content/Megascans"),
TEXT("Content/MSPresets")
};
}
const UAssetUsageAuditSettings* UAssetUsageAuditSettings::Get()
{
return GetDefault<UAssetUsageAuditSettings>();
}
FString UAssetUsageAuditSettings::GetResolvedExportDirectory() const
{
if (!DefaultExportDirectory.IsEmpty())
{
return DefaultExportDirectory;
}
return FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::ProjectSavedDir(), TEXT("AssetUsageAudit")));
}
FName UAssetUsageAuditSettings::GetCategoryName() const
{
// House convention, matching ConventionKeeper: project tools group under the project's own
// name in Project Settings rather than scattering across Plugins.
// GetProjectName already returns const TCHAR*; dereferencing it would pass a single character.
return FName(FApp::GetProjectName());
}