Exporter now exports ascii package dump as well.
This commit is contained in:
@@ -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);
|
||||||
if (UBlueprint* BP = Cast<UBlueprint>(Object))
|
|
||||||
{
|
|
||||||
FString BPDir = FPaths::ProjectDir() / TEXT("Saved") / TEXT("BlueprintExports") / BP->GetName();
|
|
||||||
|
|
||||||
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;
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user