Description

The ResavePackages commandlet can be used to batch resave assets. The ResaveClass and IncludeChildClasses options let one resave all assets of a specific parent class. The problem is that blueprint child classes that aren't loaded aren't considered.

During my tests I was only able to capture /Script/Engine classes. Custom classes derived from Engine classes or plugin classes (like GameplayAbility) are not found. The licensee shared a workaround by explicitly loading all assets in UResavePackagesCommandlet::InitializeResaveParameters() via 

TArray<UObject*> Objects;
EngineUtils::FindOrLoadAssetsByPath(TEXT("/Game/<content folder to scan>"), Objects, EngineUtils::ATL_Class);

Once assets are loaded, the previously unloaded blueprint classes are iterated by TObjectIterator<UClass>.

Steps to Reproduce

Create a C++ class derived from any UObject class so we can create BPs from it
Create a BP derived from it, and a Child BP from the BP just to add another level
Run the following commandlet in the command line:
"<ENGINE_PATH>\Engine\Binaries\Win64\UnrealEditor-Cmd.exe" "<PROJECT_PATH>\<PROJECT_NAME>.uproject" -run=ResavePackages -projectonly -unattended -IgnoreChangelist -packagefolder=/Game -resaveclass=/Script/<PROJECT_NAME>.<CREATED_CLASS_NAME> -IncludeChildClasses -SearchAllAssets
Expected Behavior: The commandlet would find the children of your custom class and resave them
Actual Behavior: The commandlet scans the entire project but will not resave any files
Added info: the same behavior can be observed on plugin classes like /Script/GameplayAbilities.GameplayAbility - the commandlet does not resave any BP derived from it

Callstack

> UnrealEditor-UnrealEd.dll!UResavePackagesCommandlet::InitializeResaveParameters(const TArray<FString,TSizedDefaultAllocator<32>> & Tokens, TArray<FString,TSizedDefaultAllocator<32>> & PackageNames) Line 562 C++
UnrealEditor-UnrealEd.dll!UResavePackagesCommandlet::Main(const FString & Params) Line 1276 C++
UnrealEditor-Cmd.exe!FEngineLoop::PreInitPostStartupScreen(const wchar_t * CmdLine) Line 4195 C++
[Inline Frame] UnrealEditor-Cmd.exe!FEngineLoop::PreInit(const wchar_t *) Line 4483 C++
[Inline Frame] UnrealEditor-Cmd.exe!EnginePreInit(const wchar_t *) Line 41 C++
UnrealEditor-Cmd.exe!GuardedMain(const wchar_t * CmdLine) Line 136 C++
UnrealEditor-Cmd.exe!GuardedMainWrapper(const wchar_t * CmdLine) Line 118 C++
UnrealEditor-Cmd.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 258 C++
UnrealEditor-Cmd.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 298 C++
[External Code]

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-231746 in the post.

0
Login to Vote

Unresolved
ComponentUE - Editor - Workflow Systems
Affects Versions5.55.4.4
CreatedNov 28, 2024
UpdatedNov 29, 2024
View Jira Issue