ultimate-unreal-engine-mcp 0.1.19 → 0.1.20
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
|
@@ -207,13 +207,28 @@ static FString TakeScreenshotToFile(int32 Width, int32 Height)
|
|
|
207
207
|
return FString();
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
//
|
|
210
|
+
// Enable realtime rendering so the viewport actually renders frames.
|
|
211
|
+
// Without this, the editor viewport only renders when "dirty" and
|
|
212
|
+
// ReadPixels captures a stale/blank framebuffer.
|
|
213
|
+
const bool bWasRealtime = ViewportClient->IsRealtime();
|
|
214
|
+
ViewportClient->SetRealtime(true);
|
|
215
|
+
|
|
216
|
+
// Force a full viewport redraw. Invalidate marks it dirty,
|
|
217
|
+
// then Draw executes the render pipeline synchronously.
|
|
211
218
|
ViewportClient->Viewport->Invalidate();
|
|
212
219
|
ViewportClient->Viewport->Draw();
|
|
213
220
|
|
|
214
221
|
// Read pixels from the viewport framebuffer.
|
|
215
222
|
TArray<FColor> Pixels;
|
|
216
|
-
|
|
223
|
+
const bool bReadOk = ViewportClient->Viewport->ReadPixels(Pixels);
|
|
224
|
+
|
|
225
|
+
// Restore previous realtime state.
|
|
226
|
+
if (!bWasRealtime)
|
|
227
|
+
{
|
|
228
|
+
ViewportClient->SetRealtime(false);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (!bReadOk)
|
|
217
232
|
{
|
|
218
233
|
return FString();
|
|
219
234
|
}
|