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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-unreal-engine-mcp",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "MCP server giving AI assistants full access to Unreal Engine 5.7 projects",
5
5
  "type": "module",
6
6
  "engines": {
@@ -27,6 +27,7 @@ public class MCPBridgeEditor : ModuleRules
27
27
  // Core engine (always present)
28
28
  "CoreUObject",
29
29
  "Engine",
30
+ "RenderCore",
30
31
  "UnrealEd",
31
32
  "EditorSubsystem",
32
33
  "Json",
@@ -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
- // Force the viewport to redraw so we capture the current frame.
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
- if (!ViewportClient->Viewport->ReadPixels(Pixels))
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
  }