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>
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
// NextGenium 2026. Asset Usage Audit.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "AssetUsageAuditTypes.h"
|
||||
|
||||
/**
|
||||
* Collision-handling for export filenames.
|
||||
*
|
||||
* Deliberately a free function over strings with an injectable existence predicate: the rule
|
||||
* ("increment an existing index, do not append a second one") is fiddly on real asset names like
|
||||
* SM_Rock_02_v3, and it must be unit-testable without touching a filesystem or an editor.
|
||||
*/
|
||||
namespace AssetExportNaming
|
||||
{
|
||||
/** Predicate answering "does this filename already exist in the target folder". */
|
||||
using FExistsPredicate = TFunctionRef<bool(const FString& /*FileName*/)>;
|
||||
|
||||
/**
|
||||
* Split a base name into stem and trailing numeric index.
|
||||
*
|
||||
* "Foo" -> {"Foo", INDEX_NONE, 0}
|
||||
* "Foo_1" -> {"Foo", 1, 1}
|
||||
* "Foo_007" -> {"Foo", 7, 3} <- padding width preserved
|
||||
* "SM_Rock_02_v3"-> {"SM_Rock_02_v3", INDEX_NONE, 0} <- v3 is not a numeric suffix
|
||||
* "SM_Rock_02" -> {"SM_Rock", 2, 2}
|
||||
* "Foo_" -> {"Foo_", INDEX_NONE, 0} <- empty suffix is not an index
|
||||
*
|
||||
* @param BaseName Filename without extension.
|
||||
* @param OutStem Portion before the trailing _N, or the whole name when there is none.
|
||||
* @param OutIndex Parsed index, or INDEX_NONE.
|
||||
* @param OutPadWidth Digit count of the parsed index, so Foo_007 -> Foo_008 not Foo_8.
|
||||
*/
|
||||
ASSETUSAGEAUDITCORE_API void SplitTrailingIndex(const FString& BaseName, FString& OutStem, int32& OutIndex, int32& OutPadWidth);
|
||||
|
||||
/**
|
||||
* Compose a filename from stem, index and padding.
|
||||
* (Foo, INDEX_NONE, 0) -> "Foo"
|
||||
* (Foo, 1, 1) -> "Foo_1"
|
||||
* (Foo, 8, 3) -> "Foo_008"
|
||||
*/
|
||||
ASSETUSAGEAUDITCORE_API FString ComposeIndexedName(const FString& Stem, int32 Index, int32 PadWidth);
|
||||
|
||||
/**
|
||||
* Resolve a target filename under the given collision policy.
|
||||
*
|
||||
* Overwrite -> returns DesiredFileName unchanged.
|
||||
* Index -> returns the first non-colliding name, incrementing any existing trailing index.
|
||||
*
|
||||
* @param DesiredFileName Filename with extension, e.g. "SM_Rock.uasset".
|
||||
* @param Policy Overwrite or Index.
|
||||
* @param Exists Predicate over filenames (with extension) in the target folder.
|
||||
* @return Filename with extension that does not collide, or DesiredFileName under Overwrite.
|
||||
*/
|
||||
ASSETUSAGEAUDITCORE_API FString ResolveCollision(const FString& DesiredFileName, EExportCollisionPolicy Policy, FExistsPredicate Exists);
|
||||
}
|
||||
Reference in New Issue
Block a user