Exporter now exports ascii package dump as well.

This commit is contained in:
2026-03-05 16:41:09 -05:00
parent 7bbc39a5dd
commit 9cc1cb502b

View File

@@ -14,6 +14,8 @@
#include "EdGraph/EdGraph.h"
#include "BlueprintExporter.h"
#include "Misc/FileHelper.h"
#include "Exporters/Exporter.h"
#include "UnrealExporter.h"
#endif
IMPLEMENT_PRIMARY_GAME_MODULE(FlxIntegrationModuleImpl, Integration, "Integration");
@@ -41,17 +43,32 @@ void FlxIntegrationModuleImpl::OnAssetSaved(const FString& PackageFilename, UPac
{
if (!Package) return;
ForEachObjectWithPackage(Package, [&](UObject* Object)
{
if (UBlueprint* BP = Cast<UBlueprint>(Object))
{
FString BPDir = FPaths::ProjectDir() / TEXT("Saved") / TEXT("BlueprintExports") / BP->GetName();
FString PkDir = FPaths::ProjectDir() / TEXT("Saved") / TEXT("BlueprintExports") / FPaths::GetBaseFilename(PackageFilename);
IFileManager::Get().DeleteDirectory(*PkDir, false, true);
IFileManager::Get().DeleteDirectory(*BPDir, false, true);
// Export the whole package in both formats for comparison.
{
FStringOutputDevice Archive;
const FExportObjectInnerContext InnerContext;
UExporter::ExportToOutputDevice(&InnerContext, Package, nullptr, Archive, TEXT("copy"), 0);
FFileHelper::SaveStringToFile(Archive, *(PkDir / TEXT("COPY_DUMP.txt")));
}
{
FStringOutputDevice Archive;
const FExportObjectInnerContext InnerContext;
UExporter::ExportToOutputDevice(&InnerContext, Package, nullptr, Archive, TEXT("t3d"), 0);
FFileHelper::SaveStringToFile(Archive, *(PkDir / TEXT("T3D_DUMP.txt")));
}
TArray<UObject*> AllObjects;
GetObjectsWithPackage(Package, AllObjects);
for (UObject *Obj : AllObjects)
{
if (UBlueprint *BP = Cast<UBlueprint>(Obj))
{
FString BPDir = PkDir / BP->GetName();
TArray<UEdGraph*> AllGraphs;
BP->GetAllGraphs(AllGraphs);
for (UEdGraph* Graph : AllGraphs)
{
FlxBlueprintExporter Exporter(Graph);
@@ -63,7 +80,6 @@ void FlxIntegrationModuleImpl::OnAssetSaved(const FString& PackageFilename, UPac
UE_LOG(LogLuprexIntegration, Warning, TEXT("Blueprint export: %s"), *FilePath);
}
}
return true;
});
}
}
#endif