ultimate-unreal-engine-mcp 0.1.18 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-unreal-engine-mcp",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "MCP server giving AI assistants full access to Unreal Engine 5.7 projects",
5
5
  "type": "module",
6
6
  "engines": {
@@ -616,6 +616,42 @@ void RegisterActorCommands(FMCPCommandRouter& Router)
616
616
  ObjProp->SetObjectPropertyValue(ValuePtr, Asset);
617
617
  }
618
618
  }
619
+ else if (ValueType == TEXT("vector"))
620
+ {
621
+ // Parse {x, y, z} JSON object for FVector properties (e.g. RelativeLocation).
622
+ const TSharedPtr<FJsonObject>* VecObj;
623
+ if (Payload->TryGetObjectField(TEXT("value"), VecObj))
624
+ {
625
+ double X = 0.0, Y = 0.0, Z = 0.0;
626
+ (*VecObj)->TryGetNumberField(TEXT("x"), X);
627
+ (*VecObj)->TryGetNumberField(TEXT("y"), Y);
628
+ (*VecObj)->TryGetNumberField(TEXT("z"), Z);
629
+
630
+ FStructProperty* StructProp = CastField<FStructProperty>(Prop);
631
+ if (StructProp && StructProp->Struct == TBaseStructure<FVector>::Get())
632
+ {
633
+ *reinterpret_cast<FVector*>(ValuePtr) = FVector(X, Y, Z);
634
+ }
635
+ }
636
+ }
637
+ else if (ValueType == TEXT("rotator"))
638
+ {
639
+ // Parse {pitch, yaw, roll} JSON object for FRotator properties (e.g. RelativeRotation).
640
+ const TSharedPtr<FJsonObject>* RotObj;
641
+ if (Payload->TryGetObjectField(TEXT("value"), RotObj))
642
+ {
643
+ double Pitch = 0.0, Yaw = 0.0, Roll = 0.0;
644
+ (*RotObj)->TryGetNumberField(TEXT("pitch"), Pitch);
645
+ (*RotObj)->TryGetNumberField(TEXT("yaw"), Yaw);
646
+ (*RotObj)->TryGetNumberField(TEXT("roll"), Roll);
647
+
648
+ FStructProperty* StructProp = CastField<FStructProperty>(Prop);
649
+ if (StructProp && StructProp->Struct == TBaseStructure<FRotator>::Get())
650
+ {
651
+ *reinterpret_cast<FRotator*>(ValuePtr) = FRotator(Pitch, Yaw, Roll);
652
+ }
653
+ }
654
+ }
619
655
  else
620
656
  {
621
657
  SendResponse(BuildActorErrorResponse(CorrId, TEXT("unsupported_value_type")) + TEXT("\n"));
@@ -207,13 +207,28 @@ static FString TakeScreenshotToFile(int32 Width, int32 Height)
207
207
  return FString();
208
208
  }
209
209
 
210
- // Force the viewport to redraw so we capture the current frame.
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
- if (!ViewportClient->Viewport->ReadPixels(Pixels))
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
  }