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 "EdGraph/EdGraph.h"
#include "BlueprintExporter.h" #include "BlueprintExporter.h"
#include "Misc/FileHelper.h" #include "Misc/FileHelper.h"
#include "Exporters/Exporter.h"
#include "UnrealExporter.h"
#endif #endif
IMPLEMENT_PRIMARY_GAME_MODULE(FlxIntegrationModuleImpl, Integration, "Integration"); IMPLEMENT_PRIMARY_GAME_MODULE(FlxIntegrationModuleImpl, Integration, "Integration");
@@ -41,17 +43,32 @@ void FlxIntegrationModuleImpl::OnAssetSaved(const FString& PackageFilename, UPac
{ {
if (!Package) return; if (!Package) return;
ForEachObjectWithPackage(Package, [&](UObject* Object) FString PkDir = FPaths::ProjectDir() / TEXT("Saved") / TEXT("BlueprintExports") / FPaths::GetBaseFilename(PackageFilename);
IFileManager::Get().DeleteDirectory(*PkDir, false, true);
// Export the whole package in both formats for comparison.
{ {
if (UBlueprint* BP = Cast<UBlueprint>(Object)) 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 = FPaths::ProjectDir() / TEXT("Saved") / TEXT("BlueprintExports") / BP->GetName(); FString BPDir = PkDir / BP->GetName();
IFileManager::Get().DeleteDirectory(*BPDir, false, true);
TArray<UEdGraph*> AllGraphs; TArray<UEdGraph*> AllGraphs;
BP->GetAllGraphs(AllGraphs); BP->GetAllGraphs(AllGraphs);
for (UEdGraph* Graph : AllGraphs) for (UEdGraph* Graph : AllGraphs)
{ {
FlxBlueprintExporter Exporter(Graph); FlxBlueprintExporter Exporter(Graph);
@@ -63,7 +80,6 @@ void FlxIntegrationModuleImpl::OnAssetSaved(const FString& PackageFilename, UPac
UE_LOG(LogLuprexIntegration, Warning, TEXT("Blueprint export: %s"), *FilePath); UE_LOG(LogLuprexIntegration, Warning, TEXT("Blueprint export: %s"), *FilePath);
} }
} }
return true; }
});
} }
#endif #endif