feat: import assets from an external folder

Reverse direction of the export: read a folder of .uasset files, recover
each one's original package path, and bring the chosen ones back.

Recovering the path is the hard part - a reference inside a .uasset names
its target by full package path, so a file only works when restored to
where it came from. Four sources are tried and the one used is shown per
row: our manifest, the package header, the folder structure, or nothing.

The package header carries the name on this project's assets, measured,
so a flat export without a manifest still restores correctly. The engine
notes the field is not always written, hence the chain rather than one
check.

Import refuses to destroy work: existing assets are skipped unless
overwrite is explicitly on, and a package loaded in the editor is never
replaced.

Also verifies Migrate on real data for the first time - asset and its
dependency land at the correct package paths.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
2026-09-03 17:39:58 +07:00
parent 2c82680a42
commit 569ec56a19
11 changed files with 2032 additions and 0 deletions
@@ -5,6 +5,7 @@
#include "AssetUsageAuditSettings.h"
#include "AssetUsageAuditor.h"
#include "AssetUsageReportWriter.h"
#include "SAssetImportDialog.h"
#include "SAssetUsageAuditPanel.h"
#include "AssetRegistry/AssetRegistryModule.h"
#include "AssetRegistry/IAssetRegistry.h"
@@ -90,6 +91,18 @@ void FAssetUsageAuditEditorModule::RegisterMenus()
{
FGlobalTabmanager::Get()->TryInvokeTab(FAssetUsageAuditEditorModule::PanelTabId);
})));
// Import sits beside the audit rather than inside its panel: it is the reverse direction and
// needs no audit result, so requiring a sweep first would be pure ceremony.
Section.AddMenuEntry(
TEXT("ImportAssetsFromFolder"),
LOCTEXT("OpenImport", "Import Assets from Folder..."),
LOCTEXT("OpenImportTip", "Read a folder of exported .uasset files and bring the chosen ones back into this project."),
FSlateIcon(FAppStyle::GetAppStyleSetName(), "Icons.Import"),
FUIAction(FExecuteAction::CreateLambda([]()
{
ShowAssetImportDialog();
})));
}
void FAssetUsageAuditEditorModule::RegisterConsoleCommands()