Description

hThe use case of the licensee is that he used FindInBlueprints inside the Editor to find a particular text contained in BPs and later used that listing to recompile the BPs using the CompileAllBlueprintsCommandlet -AllowList.
He noticed that not all BPs found by FindInBlueprints were showing in the commandlet. He pointed out that the UWorld/umap files were not being considered by the commandlet because the assets are cast to UBlueprint, what does not work on Levels because they contain BP, but are not BPs.
The proposed fix is:
There are two blocks of changes in CompileAllBlueprintsCommandlet.cpp. The first is in BuildBlueprintAssetList(). Line 185,

AssetRegistryModule.Get().GetAssetsByClass(BlueprintBaseClassName, BlueprintAssetList, true);
is replaced by

FARFilter Filter;
Filter.ClassPaths.Add(BlueprintBaseClassName);
Filter.ClassPaths.Add(UWorld::StaticClass()->GetClassPathName());
Filter.bRecursiveClasses = true;
AssetRegistryModule.Get().GetAssets(Filter, BlueprintAssetList);
This adds worlds to the BlueprintAssetList. BlueprintBaseClassName can be overridden using a command line parameter. I suppose some kind of override functionality would be desired in the production version.

The second change is in BuildBlueprints(). Line 152,

UBlueprint* LoadedBlueprint = Cast<UBlueprint>(StaticLoadObject(Asset.GetClass(), /Outer=/nullptr, *AssetPath,nullptr, LOAD_NoWarn | LOAD_DisableCompileOnLoad));
is replaced by

UObject* LoadedObject = StaticLoadObject(Asset.GetClass(), /Outer =/nullptr, *AssetPath,nullptr, LOAD_NoWarn | LOAD_DisableCompileOnLoad);
UBlueprint* LoadedBlueprint = Cast<UBlueprint>(LoadedObject);
if (LoadedBlueprint == nullptr)
{
UWorld* LoadedWorld = Cast<UWorld>(LoadedObject);
if ((LoadedWorld != nullptr) && (LoadedWorld->PersistentLevel != nullptr))

{ LoadedBlueprint = Cast<UBlueprint>((UObject*)LoadedWorld->PersistentLevel->GetLevelScriptBlueprint(true)); }

}
This looks for a level blueprint if the asset is a world.

Steps to Reproduce

The original use case of the licensee is that he used FindInBlueprints inside the Editor to find a particular text contained in BPs
On an empty project, create a new level, give it a name and save
Create some BPs just to verify that they show in the CompliteAllBlueprints log
Save everything
Use the commandlet CompileAllBlueprints in the command line: <ProjectFolder>...\UE_5.3\Engine\Binaries\Win64\UnrealEditor-Cmd.exe <ProjectFolder>\<ProjectName>.uproject -run=CompileAllBlueprints
Check the logs, all BPs are listed, but not the Level
Expected Behavior: since UWorlds contain BP logic, they should also be captured and compiled by CompileAllBlueprints
Actual Behavior: Levels are ignored and will not be recompiled

Callstack

> UnrealEditor-UnrealEd.dll!UCompileAllBlueprintsCommandlet::Main(const FString & Params) Line 33 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-234741 in the post.

0
Login to Vote

Unresolved
ComponentUE - Gameplay - Blueprint
Affects Versions5.3
Target Fix5.6
CreatedDec 16, 2024
UpdatedDec 20, 2024
View Jira Issue