ultimate-unreal-engine-mcp 0.1.19 → 0.1.21
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/package.json
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
#include "HAL/FileManager.h"
|
|
34
34
|
#include "Misc/FileHelper.h"
|
|
35
35
|
#include "ImageUtils.h"
|
|
36
|
+
#include "RenderingThread.h"
|
|
36
37
|
#include "Engine/World.h"
|
|
37
38
|
#include "GameFramework/Actor.h"
|
|
38
39
|
#include "EngineUtils.h"
|
|
@@ -207,13 +208,29 @@ static FString TakeScreenshotToFile(int32 Width, int32 Height)
|
|
|
207
208
|
return FString();
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
//
|
|
211
|
+
// Enable realtime rendering so the viewport actually renders frames.
|
|
212
|
+
// Without this, the editor viewport only renders when "dirty" and
|
|
213
|
+
// ReadPixels captures a stale/blank framebuffer.
|
|
214
|
+
const bool bWasRealtime = ViewportClient->IsRealtime();
|
|
215
|
+
ViewportClient->SetRealtime(true);
|
|
216
|
+
|
|
217
|
+
// Force a full viewport redraw. Invalidate marks it dirty,
|
|
218
|
+
// then Draw executes the render pipeline synchronously.
|
|
211
219
|
ViewportClient->Viewport->Invalidate();
|
|
212
220
|
ViewportClient->Viewport->Draw();
|
|
221
|
+
FlushRenderingCommands();
|
|
213
222
|
|
|
214
223
|
// Read pixels from the viewport framebuffer.
|
|
215
224
|
TArray<FColor> Pixels;
|
|
216
|
-
|
|
225
|
+
const bool bReadOk = ViewportClient->Viewport->ReadPixels(Pixels);
|
|
226
|
+
|
|
227
|
+
// Restore previous realtime state.
|
|
228
|
+
if (!bWasRealtime)
|
|
229
|
+
{
|
|
230
|
+
ViewportClient->SetRealtime(false);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (!bReadOk)
|
|
217
234
|
{
|
|
218
235
|
return FString();
|
|
219
236
|
}
|