diff --git a/Source/Integration/Integration.cpp b/Source/Integration/Integration.cpp index 44d9d40e..1740cf01 100644 --- a/Source/Integration/Integration.cpp +++ b/Source/Integration/Integration.cpp @@ -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) + 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(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 AllObjects; + GetObjectsWithPackage(Package, AllObjects); + for (UObject *Obj : AllObjects) + { + if (UBlueprint *BP = Cast(Obj)) { - FString BPDir = FPaths::ProjectDir() / TEXT("Saved") / TEXT("BlueprintExports") / BP->GetName(); - - IFileManager::Get().DeleteDirectory(*BPDir, false, true); - + FString BPDir = PkDir / BP->GetName(); TArray 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