ue-mcp 1.0.44 → 1.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tool-counts.json
CHANGED
package/package.json
CHANGED
|
@@ -22,6 +22,9 @@
|
|
|
22
22
|
#include "GameFramework/Pawn.h"
|
|
23
23
|
#include "GameFramework/SpectatorPawn.h"
|
|
24
24
|
#include "Engine/DebugCameraController.h"
|
|
25
|
+
#include "Engine/GameViewportClient.h"
|
|
26
|
+
#include "ImageUtils.h"
|
|
27
|
+
#include "Async/Async.h"
|
|
25
28
|
|
|
26
29
|
namespace UEMCPPIE
|
|
27
30
|
{
|
|
@@ -597,9 +600,26 @@ namespace UEMCPPIE
|
|
|
597
600
|
const uint64 FrameIdx = static_cast<uint64>(FramesCompared);
|
|
598
601
|
if ((FrameIdx % static_cast<uint64>(Pending.CaptureFrameEvery)) == 0)
|
|
599
602
|
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
+
UGameViewportClient* VC = PIEWorld->GetGameViewport();
|
|
604
|
+
FViewport* Viewport = VC ? VC->Viewport : nullptr;
|
|
605
|
+
if (Viewport)
|
|
606
|
+
{
|
|
607
|
+
TArray<FColor> Pixels;
|
|
608
|
+
if (Viewport->ReadPixels(Pixels))
|
|
609
|
+
{
|
|
610
|
+
const int32 W = Viewport->GetSizeXY().X;
|
|
611
|
+
const int32 H = Viewport->GetSizeXY().Y;
|
|
612
|
+
const FString FullPath = CaptureDir / FString::Printf(TEXT("frame_%05llu.png"), FrameIdx);
|
|
613
|
+
AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask,
|
|
614
|
+
[Pixels = MoveTemp(Pixels), W, H, FullPath]()
|
|
615
|
+
{
|
|
616
|
+
TArray64<uint8> PNG;
|
|
617
|
+
FImageUtils::PNGCompressImageArray(W, H, Pixels, PNG);
|
|
618
|
+
FFileHelper::SaveArrayToFile(PNG, *FullPath);
|
|
619
|
+
});
|
|
620
|
+
FramesCaptured++;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
603
623
|
}
|
|
604
624
|
}
|
|
605
625
|
|