ue-mcp 1.4.13 → 1.4.14-beta.2

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.
Files changed (137) hide show
  1. package/README.md +5 -5
  2. package/dist/bridge/bridge-timeouts.js +4 -0
  3. package/dist/bridge/bridge-timeouts.js.map +1 -1
  4. package/dist/cli/cli-commands.js +1 -0
  5. package/dist/cli/cli-commands.js.map +1 -1
  6. package/dist/cli/doctor.js +2 -1
  7. package/dist/cli/doctor.js.map +1 -1
  8. package/dist/cli/init.js +1 -1
  9. package/dist/cli/init.js.map +1 -1
  10. package/dist/cli/projects-cli.d.ts +3 -0
  11. package/dist/cli/projects-cli.js +72 -0
  12. package/dist/cli/projects-cli.js.map +1 -0
  13. package/dist/config/user-state.d.ts +10 -0
  14. package/dist/config/user-state.js +21 -0
  15. package/dist/config/user-state.js.map +1 -1
  16. package/dist/core/env.d.ts +2 -0
  17. package/dist/core/env.js +2 -0
  18. package/dist/core/env.js.map +1 -1
  19. package/dist/core/types.d.ts +27 -0
  20. package/dist/daemon/daemon.js +44 -5
  21. package/dist/daemon/daemon.js.map +1 -1
  22. package/dist/daemon/extension-api.d.ts +8 -5
  23. package/dist/daemon-api.d.ts +2 -1
  24. package/dist/daemon-api.js +1 -0
  25. package/dist/daemon-api.js.map +1 -1
  26. package/dist/dispatch/offline.js +1 -0
  27. package/dist/dispatch/offline.js.map +1 -1
  28. package/dist/editor/dialog-guard.d.ts +12 -2
  29. package/dist/editor/dialog-guard.js +68 -2
  30. package/dist/editor/dialog-guard.js.map +1 -1
  31. package/dist/editor/editor-control.js +1 -1
  32. package/dist/editor/editor-control.js.map +1 -1
  33. package/dist/flow/write-methods.js +1 -1
  34. package/dist/flow/write-methods.js.map +1 -1
  35. package/dist/machine/projects.d.ts +85 -0
  36. package/dist/machine/projects.js +286 -0
  37. package/dist/machine/projects.js.map +1 -0
  38. package/dist/pie/script-events.d.ts +4 -1
  39. package/dist/pie/script-events.js.map +1 -1
  40. package/dist/surface/context/instructions.js +20 -0
  41. package/dist/surface/context/instructions.js.map +1 -1
  42. package/dist/tool-counts.json +12 -12
  43. package/dist/tools/asset.js +2 -1
  44. package/dist/tools/asset.js.map +1 -1
  45. package/dist/tools/editor.js +1 -1
  46. package/dist/tools/editor.js.map +1 -1
  47. package/dist/tools/epic/effects.js +11 -0
  48. package/dist/tools/epic/effects.js.map +1 -1
  49. package/dist/tools/epic/fab.generated.d.ts +6 -0
  50. package/dist/tools/epic/fab.generated.js +67 -0
  51. package/dist/tools/epic/fab.generated.js.map +1 -0
  52. package/dist/tools/epic/index.d.ts +2 -0
  53. package/dist/tools/epic/index.js +2 -0
  54. package/dist/tools/epic/index.js.map +1 -1
  55. package/dist/tools/epic/toolset-routes.js +2 -0
  56. package/dist/tools/epic/toolset-routes.js.map +1 -1
  57. package/dist/tools/epic.js +4 -4
  58. package/dist/tools/epic.js.map +1 -1
  59. package/dist/tools/fab-epic.d.ts +23 -0
  60. package/dist/tools/fab-epic.js +109 -0
  61. package/dist/tools/fab-epic.js.map +1 -0
  62. package/dist/tools/fab.js +27 -18
  63. package/dist/tools/fab.js.map +1 -1
  64. package/dist/tools/level.js +9 -2
  65. package/dist/tools/level.js.map +1 -1
  66. package/dist/tools/material.js +1 -1
  67. package/dist/tools/material.js.map +1 -1
  68. package/dist/tools/pie.js +1 -1
  69. package/dist/tools/pie.js.map +1 -1
  70. package/dist/tools/specs/asset.generated.js +92 -3
  71. package/dist/tools/specs/asset.generated.js.map +1 -1
  72. package/dist/tools/specs/fab.generated.js +143 -3
  73. package/dist/tools/specs/fab.generated.js.map +1 -1
  74. package/dist/tools/specs/level.generated.js +183 -9
  75. package/dist/tools/specs/level.generated.js.map +1 -1
  76. package/dist/tools/specs/pie.generated.js +28 -8
  77. package/dist/tools/specs/pie.generated.js.map +1 -1
  78. package/dist/tools/specs/widget.generated.js +8 -1
  79. package/dist/tools/specs/widget.generated.js.map +1 -1
  80. package/dist/ue-mcp.default.yml +522 -76
  81. package/package.json +2 -2
  82. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeServer.cpp +26 -0
  83. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.cpp +24 -0
  84. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.h +7 -0
  85. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_Mesh.cpp +483 -10
  86. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Dialog/DialogHandlers.cpp +345 -1
  87. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_AIAssistant.cpp +34 -6
  88. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.cpp +766 -0
  89. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.h +26 -0
  90. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.cpp +159 -55
  91. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.h +23 -12
  92. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.cpp +306 -0
  93. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.h +55 -0
  94. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.cpp +34 -2
  95. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.h +9 -0
  96. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Blockout.cpp +12 -8
  97. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_PerfAudit.cpp +3 -1
  98. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Refresh.cpp +479 -0
  99. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_ReplaceActors.cpp +2 -0
  100. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_WorldPartition.cpp +824 -12
  101. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Material/MaterialHandlers.cpp +95 -1
  102. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers.cpp +13 -0
  103. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/MCPPIETestScript.h +8 -3
  104. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers.cpp +2 -0
  105. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Record.cpp +6 -0
  106. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Replay.cpp +1 -0
  107. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Script.cpp +2 -2
  108. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.cpp +52 -1
  109. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.h +16 -0
  110. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.cpp +65 -1
  111. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.h +15 -0
  112. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.cpp +146 -0
  113. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.h +53 -0
  114. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.cpp +351 -14
  115. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.h +55 -6
  116. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptValidation.cpp +8 -1
  117. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.cpp +59 -0
  118. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.h +15 -2
  119. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.cpp +567 -0
  120. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.h +173 -0
  121. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/SMCPPIEStudioPanel.cpp +41 -6
  122. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers.cpp +92 -32
  123. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabDownloadTests.cpp +140 -0
  124. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabEndToEndTests.cpp +365 -0
  125. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabLibraryTests.cpp +52 -0
  126. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PCGGraphAuthoringTests.cpp +5 -2
  127. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEReplayInputLockTests.cpp +77 -0
  128. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptTests.cpp +256 -0
  129. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptValidationTests.cpp +18 -0
  130. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEUIPointerTests.cpp +246 -0
  131. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/UE_MCP_Bridge.cpp +4 -0
  132. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/UE_MCP_Bridge.Build.cs +85 -13
  133. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIEActionTrigger.cpp +48 -0
  134. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIERemoteControl.cpp +93 -0
  135. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIEActionTrigger.h +52 -0
  136. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIERemoteControl.h +54 -0
  137. package/plugin/ue_mcp_bridge/UE_MCP_Bridge.uplugin +2 -2
@@ -1,3 +1,5 @@
1
+ using System.Linq;
2
+ using EpicGames.Core;
1
3
  using UnrealBuildTool;
2
4
 
3
5
  // UBT caches this module's file list and rescans only when this file changes.
@@ -31,6 +33,11 @@ public class UE_MCP_Bridge : ModuleRules
31
33
  new string[]
32
34
  {
33
35
  "AIModule",
36
+ "HTTP",
37
+ "BuildPatchServices",
38
+ // The local server UE.MCP.Fab.EndToEnd answers the Fab library,
39
+ // distribution and CDN requests from.
40
+ "HTTPServer",
34
41
  // #889: authoring a BehaviorTree means driving UBehaviorTreeGraph
35
42
  // and its node classes, then calling UpdateAsset to compile the
36
43
  // graph into the runnable UBTCompositeNode tree. That orchestration
@@ -170,6 +177,11 @@ public class UE_MCP_Bridge : ModuleRules
170
177
  PrivateDependencyModuleNames.Add("StructUtils");
171
178
  }
172
179
 
180
+ if (Target.Version.MajorVersion == 5 && Target.Version.MinorVersion >= 8)
181
+ {
182
+ PrivateDependencyModuleNames.Add("TypedElementFramework");
183
+ }
184
+
173
185
  // pie(uat_run) validates scenario regex patterns with ICU, the engine's regex backend.
174
186
  if (Target.bCompileICU)
175
187
  {
@@ -182,20 +194,24 @@ public class UE_MCP_Bridge : ModuleRules
182
194
  PrivateDependencyModuleNames.Add("LiveCoding");
183
195
  }
184
196
 
185
- // Fab is Epic's marketplace plugin. It ships enabled by default on UE 5.8
186
- // but is absent on older engines and can be disabled, so we do not hard
187
- // depend on it: detect the plugin on disk and only then link its native
188
- // import/cache API, guarding those code paths with WITH_FAB_PLUGIN. When
189
- // absent, the Fab handlers still register and fall back to console-command
190
- // paths (login/sync/clear) or return a clean "not available" error.
197
+ // Fab is Epic's marketplace plugin. It is not part of the engine install:
198
+ // the launcher delivers it as its own catalog item ("Fab UE Plugin", app
199
+ // FabPlugin_<version>, flagged to install with the engine) into
200
+ // Engine/Plugins/Fab. An engine installed without it, a source build, or
201
+ // a project that disables it has no Fab, so we do not hard depend on it:
202
+ // detect the plugin on disk and only then link its native import/cache
203
+ // API, guarding those code paths with WITH_FAB_PLUGIN. When absent, the
204
+ // Fab handlers still register, fall back to console-command paths
205
+ // (login/sync/clear) when the module is loaded, and otherwise answer
206
+ // PLUGIN_NOT_AVAILABLE with the install step.
191
207
  // Test for the header this module actually includes, not just the
192
208
  // plugin directory: 5.4 ships a Fab plugin whose public surface is
193
209
  // FabModule.h alone, with no Importers/ or Utilities/ headers, so a
194
210
  // directory check turns WITH_FAB_PLUGIN on and the compile then fails
195
- // on the missing include.
196
- bool bFabPluginPresent = System.IO.File.Exists(System.IO.Path.Combine(
197
- EngineDirectory, "Plugins", "Fab", "Source", "Fab", "Public", "Importers", "GenericAssetImporter.h"));
198
- if (bFabPluginPresent && Target.bBuildEditor)
211
+ // on the missing include. Fab is enabled by default, so only a project
212
+ // that turns it off explicitly compiles it out.
213
+ bool bFabPluginPresent = FindFabPlugin(EngineDirectory) != null;
214
+ if (bFabPluginPresent && Target.bBuildEditor && ProjectEnables(Target, "Fab", true))
199
215
  {
200
216
  PrivateDependencyModuleNames.Add("Fab");
201
217
  PublicDefinitions.Add("WITH_FAB_PLUGIN=1");
@@ -210,7 +226,9 @@ public class UE_MCP_Bridge : ModuleRules
210
226
  // loaded, so this DLL loads whether or not a project enables the plugin.
211
227
  bool bEpicMCPPresent = System.IO.File.Exists(System.IO.Path.Combine(
212
228
  EngineDirectory, "Plugins", "Experimental", "ModelContextProtocol", "Source", "ModelContextProtocol", "Public", "IModelContextProtocolResourceProvider.h"));
213
- if (bEpicMCPPresent && Target.bBuildEditor)
229
+ // Its headers include UHT-generated ones, which exist only when the project
230
+ // being built enables the plugin; elsewhere the handlers compile out (ProjectEnables).
231
+ if (bEpicMCPPresent && Target.bBuildEditor && ProjectEnables(Target, "ModelContextProtocol"))
214
232
  {
215
233
  PrivateIncludePathModuleNames.Add("ModelContextProtocol");
216
234
  PrivateDefinitions.Add("WITH_UEMCP_EPIC_MCP=1");
@@ -228,7 +246,7 @@ public class UE_MCP_Bridge : ModuleRules
228
246
  // FToolsetRegistry::Get(), so the header is not needed there.
229
247
  bool bToolsetRegistrySubsystemHeader = System.IO.File.Exists(System.IO.Path.Combine(
230
248
  EngineDirectory, "Plugins", "Experimental", "ToolsetRegistry", "Source", "ToolsetRegistry", "Public", "ToolsetRegistry", "ToolsetRegistrySubsystem.h"));
231
- if (bToolsetRegistrySubsystemHeader && Target.bBuildEditor)
249
+ if (bToolsetRegistrySubsystemHeader && Target.bBuildEditor && ProjectEnables(Target, "ToolsetRegistry"))
232
250
  {
233
251
  PrivateIncludePathModuleNames.Add("ToolsetRegistry");
234
252
  PrivateDefinitions.Add("WITH_UEMCP_TOOLSET_REGISTRY_SUBSYSTEM=1");
@@ -244,7 +262,7 @@ public class UE_MCP_Bridge : ModuleRules
244
262
  // DLL loads whether or not a project enables the plugin.
245
263
  bool bSemanticSearchPresent = System.IO.File.Exists(System.IO.Path.Combine(
246
264
  EngineDirectory, "Plugins", "Experimental", "SemanticSearch", "Source", "SemanticSearch", "Public", "ISemanticSearchModule.h"));
247
- if (bSemanticSearchPresent && Target.bBuildEditor)
265
+ if (bSemanticSearchPresent && Target.bBuildEditor && ProjectEnables(Target, "SemanticSearch"))
248
266
  {
249
267
  PrivateIncludePathModuleNames.Add("SemanticSearch");
250
268
  PrivateDefinitions.Add("WITH_UEMCP_SEMANTIC_SEARCH=1");
@@ -270,4 +288,58 @@ public class UE_MCP_Bridge : ModuleRules
270
288
  PrivateDefinitions.Add("WITH_UEMCP_NNE=0");
271
289
  }
272
290
  }
291
+
292
+ /// <summary>
293
+ /// Whether the project being built enables an Epic plugin that is off by
294
+ /// default and whose headers this module includes. Such a plugin's
295
+ /// UHT-generated headers exist only when it is part of the build, so
296
+ /// compiling against it in a project that leaves it off fails. Read from the
297
+ /// target's own plugin lists, then the .uproject. A build with no project
298
+ /// (an engine build) counts it as on. A plugin enabled by default (Fab)
299
+ /// passes bEnabledByDefault, so only an explicit "Enabled": false turns it
300
+ /// off.
301
+ /// </summary>
302
+ private static bool ProjectEnables(ReadOnlyTargetRules Target, string Plugin, bool bEnabledByDefault = false)
303
+ {
304
+ if (Target.DisablePlugins.Contains(Plugin)) return false;
305
+ if (Target.EnablePlugins.Contains(Plugin)) return true;
306
+ if (Target.ProjectFile == null) return true;
307
+ JsonObject Project;
308
+ JsonObject[] Plugins;
309
+ if (!JsonObject.TryRead(Target.ProjectFile, out Project) || !Project.TryGetObjectArrayField("Plugins", out Plugins)) return bEnabledByDefault;
310
+ foreach (JsonObject Entry in Plugins)
311
+ {
312
+ string Name;
313
+ bool Enabled;
314
+ if (Entry.TryGetStringField("Name", out Name) && Name == Plugin) return Entry.TryGetBoolField("Enabled", out Enabled) && Enabled;
315
+ }
316
+ return bEnabledByDefault;
317
+ }
318
+
319
+ /// <summary>
320
+ /// The directory of a Fab plugin whose native import/cache headers this
321
+ /// module can compile against, or null. The launcher installs the "Fab UE
322
+ /// Plugin" item into Engine/Plugins/Fab; an older vault install or a copy
323
+ /// made by hand sits under Engine/Plugins/Marketplace instead, in a folder
324
+ /// of any name holding Fab.uplugin.
325
+ /// </summary>
326
+ private static string FindFabPlugin(string EngineDir)
327
+ {
328
+ System.Collections.Generic.List<string> Candidates = new System.Collections.Generic.List<string>();
329
+ Candidates.Add(System.IO.Path.Combine(EngineDir, "Plugins", "Fab"));
330
+ string Marketplace = System.IO.Path.Combine(EngineDir, "Plugins", "Marketplace");
331
+ if (System.IO.Directory.Exists(Marketplace))
332
+ {
333
+ Candidates.AddRange(System.IO.Directory.GetDirectories(Marketplace));
334
+ }
335
+ foreach (string Dir in Candidates)
336
+ {
337
+ if (System.IO.File.Exists(System.IO.Path.Combine(Dir, "Fab.uplugin"))
338
+ && System.IO.File.Exists(System.IO.Path.Combine(Dir, "Source", "Fab", "Public", "Importers", "GenericAssetImporter.h")))
339
+ {
340
+ return Dir;
341
+ }
342
+ }
343
+ return null;
344
+ }
273
345
  }
@@ -0,0 +1,48 @@
1
+ #include "MCPPIEActionTrigger.h"
2
+
3
+ #include "Engine/LocalPlayer.h"
4
+ #include "EnhancedInputSubsystems.h"
5
+ #include "EnhancedPlayerInput.h"
6
+ #include "InputAction.h"
7
+
8
+ namespace MCPPIE
9
+ {
10
+ FString ActionValueTypeName(const UInputAction* Action)
11
+ {
12
+ if (!Action) return FString();
13
+ switch (Action->ValueType)
14
+ {
15
+ case EInputActionValueType::Boolean: return TEXT("bool");
16
+ case EInputActionValueType::Axis1D: return TEXT("axis1d");
17
+ case EInputActionValueType::Axis2D: return TEXT("axis2d");
18
+ case EInputActionValueType::Axis3D: return TEXT("axis3d");
19
+ }
20
+ return FString();
21
+ }
22
+
23
+ bool ReadActionTriggerState(const ULocalPlayer* LocalPlayer, const UInputAction* Action,
24
+ bool& bOutTriggered, FVector& OutValue, FString& OutError)
25
+ {
26
+ bOutTriggered = false;
27
+ OutValue = FVector::ZeroVector;
28
+ if (!LocalPlayer || !Action)
29
+ {
30
+ OutError = TEXT("no local player or Input Action to watch");
31
+ return false;
32
+ }
33
+ UEnhancedInputLocalPlayerSubsystem* Subsystem = LocalPlayer->GetSubsystem<UEnhancedInputLocalPlayerSubsystem>();
34
+ const UEnhancedPlayerInput* PlayerInput = Subsystem ? Subsystem->GetPlayerInput() : nullptr;
35
+ if (!PlayerInput)
36
+ {
37
+ OutError = TEXT("the player has no Enhanced Input (no EnhancedInputLocalPlayerSubsystem or player input yet)");
38
+ return false;
39
+ }
40
+ // No instance data: nothing has mapped or injected the action yet, so it has not triggered.
41
+ if (const FInputActionInstance* Instance = PlayerInput->FindActionInstanceData(Action))
42
+ {
43
+ bOutTriggered = Instance->GetTriggerEvent() == ETriggerEvent::Triggered;
44
+ if (bOutTriggered) OutValue = Instance->GetValue().Get<FVector>();
45
+ }
46
+ return true;
47
+ }
48
+ }
@@ -12,6 +12,7 @@
12
12
  #include "GameFramework/Pawn.h"
13
13
  #include "InputAction.h"
14
14
  #include "InputActionValue.h"
15
+ #include "Misc/CoreDelegates.h"
15
16
 
16
17
  namespace
17
18
  {
@@ -68,6 +69,8 @@ void UMCPPIERemoteControl::EndPlay(const EEndPlayReason::Type EndPlayReason)
68
69
  MCPPIE::FPIEInputInjector::StopAny(Id);
69
70
  }
70
71
  OwnedTapes.Reset();
72
+ Watches.Reset();
73
+ UnbindWatchFrame();
71
74
  if (Capture.IsValid())
72
75
  {
73
76
  Capture->SetEnabled(false);
@@ -130,6 +133,18 @@ void UMCPPIERemoteControl::SendConsole(const FString& Id, const FString& Command
130
133
  ClientConsole(Id, Command);
131
134
  }
132
135
 
136
+ void UMCPPIERemoteControl::SendWatchTrigger(const FString& Id, const FSoftObjectPath& Action)
137
+ {
138
+ Results.Remove(Id);
139
+ Triggers.Remove(Id);
140
+ ClientWatchTrigger(Id, Action);
141
+ }
142
+
143
+ void UMCPPIERemoteControl::SendStopWatch(const FString& Id)
144
+ {
145
+ ClientStopWatch(Id);
146
+ }
147
+
133
148
  // ── Client-side execution ───────────────────────────────────────────────────
134
149
 
135
150
  ULocalPlayer* UMCPPIERemoteControl::ResolveOwnLocalPlayer(FString& OutError) const
@@ -272,6 +287,77 @@ void UMCPPIERemoteControl::ClientConsole_Implementation(const FString& Id, const
272
287
  Report(Id, true, true, FString());
273
288
  }
274
289
 
290
+ void UMCPPIERemoteControl::ClientWatchTrigger_Implementation(const FString& Id, const FSoftObjectPath& Action)
291
+ {
292
+ FString Error;
293
+ UInputAction* Loaded = LoadAction(Action, Error);
294
+ ULocalPlayer* LocalPlayer = Loaded ? ResolveOwnLocalPlayer(Error) : nullptr;
295
+ if (!LocalPlayer)
296
+ {
297
+ Report(Id, false, true, Error);
298
+ return;
299
+ }
300
+ Watches.RemoveAll([&Id](const FMCPPIERemoteWatch& W) { return W.Id == Id; });
301
+ FMCPPIERemoteWatch& Watch = Watches.AddDefaulted_GetRef();
302
+ Watch.Id = Id;
303
+ Watch.Path = Action;
304
+ Watch.Action = Loaded;
305
+ if (!WatchFrameHandle.IsValid())
306
+ {
307
+ WatchFrameHandle = FCoreDelegates::OnEndFrame.AddUObject(this, &UMCPPIERemoteControl::PollWatches);
308
+ }
309
+ Report(Id, true, false, FString());
310
+ }
311
+
312
+ void UMCPPIERemoteControl::ClientStopWatch_Implementation(const FString& Id)
313
+ {
314
+ Watches.RemoveAll([&Id](const FMCPPIERemoteWatch& W) { return W.Id == Id; });
315
+ if (Watches.Num() == 0) UnbindWatchFrame();
316
+ }
317
+
318
+ void UMCPPIERemoteControl::PollWatches()
319
+ {
320
+ FString Error;
321
+ ULocalPlayer* LocalPlayer = ResolveOwnLocalPlayer(Error);
322
+ for (int32 I = Watches.Num() - 1; I >= 0; --I)
323
+ {
324
+ FMCPPIERemoteWatch& Watch = Watches[I];
325
+ const UInputAction* Action = Watch.Action.Get();
326
+ if (!Action)
327
+ {
328
+ Action = Cast<UInputAction>(Watch.Path.TryLoad());
329
+ Watch.Action = Action;
330
+ }
331
+ if (!Action)
332
+ {
333
+ Report(Watch.Id, false, true, FString::Printf(TEXT("the watched Input Action '%s' no longer loads"), *Watch.Path.ToString()));
334
+ Watches.RemoveAt(I);
335
+ continue;
336
+ }
337
+ bool bTriggered = false;
338
+ FVector Value = FVector::ZeroVector;
339
+ // A player between pawns has no input to read this frame; the watch waits for it.
340
+ if (!LocalPlayer || !MCPPIE::ReadActionTriggerState(LocalPlayer, Action, bTriggered, Value, Error)) continue;
341
+ if (Watch.Gate.Feed(bTriggered))
342
+ {
343
+ UE_LOG(LogMCPPIERuntime, Log, TEXT("[PIEStudio] watch %s: %s triggered"), *Watch.Id, *Action->GetName());
344
+ ServerTriggered(Watch.Id, Value);
345
+ Report(Watch.Id, true, true, FString());
346
+ Watches.RemoveAt(I);
347
+ }
348
+ }
349
+ if (Watches.Num() == 0) UnbindWatchFrame();
350
+ }
351
+
352
+ void UMCPPIERemoteControl::UnbindWatchFrame()
353
+ {
354
+ if (WatchFrameHandle.IsValid())
355
+ {
356
+ FCoreDelegates::OnEndFrame.Remove(WatchFrameHandle);
357
+ WatchFrameHandle.Reset();
358
+ }
359
+ }
360
+
275
361
  void UMCPPIERemoteControl::HandleTapeFinished(const FString& Id)
276
362
  {
277
363
  if (OwnedTapes.Remove(Id) > 0)
@@ -289,6 +375,13 @@ void UMCPPIERemoteControl::ServerReady_Implementation(const FString& LogFile)
289
375
  UE_LOG(LogMCPPIERuntime, Log, TEXT("[PIEStudio] remote player %s is ready"), *GetNameSafe(GetOwner()));
290
376
  }
291
377
 
378
+ void UMCPPIERemoteControl::ServerTriggered_Implementation(const FString& Id, FVector Value)
379
+ {
380
+ FMCPPIERemoteTrigger& Trigger = Triggers.FindOrAdd(Id);
381
+ Trigger.Id = Id;
382
+ Trigger.Value = Value;
383
+ }
384
+
292
385
  void UMCPPIERemoteControl::ServerReport_Implementation(const FString& Id, bool bOk, bool bFinished, const FString& Error)
293
386
  {
294
387
  FMCPPIERemoteResult& Result = Results.FindOrAdd(Id);
@@ -0,0 +1,52 @@
1
+ #pragma once
2
+
3
+ #include "CoreMinimal.h"
4
+
5
+ class UInputAction;
6
+ class ULocalPlayer;
7
+
8
+ /**
9
+ * Watching for a person to fire an Enhanced Input Action, for a test script's triggered expectation (#1897).
10
+ *
11
+ * The editor watches its own player and a remote player's process watches its own, so the frame read and the
12
+ * rule for what counts as a fresh trigger live here, in the runtime module both of them load.
13
+ */
14
+ namespace MCPPIE
15
+ {
16
+ /**
17
+ * Decides which frame counts as a fresh trigger. Fed once per frame with whether the action was in its
18
+ * Triggered event that frame. A trigger counts only after a frame without one, so input that was already
19
+ * down when the watch began (a test step's own act still playing out, a key held from before) does not.
20
+ * Fires once.
21
+ */
22
+ struct FActionTriggerGate
23
+ {
24
+ bool bReleased = false;
25
+ bool bFired = false;
26
+
27
+ /** True on the one frame the gate fires. */
28
+ bool Feed(bool bTriggeredThisFrame)
29
+ {
30
+ if (bFired) return false;
31
+ if (!bTriggeredThisFrame)
32
+ {
33
+ bReleased = true;
34
+ return false;
35
+ }
36
+ if (!bReleased) return false;
37
+ bFired = true;
38
+ return true;
39
+ }
40
+ };
41
+
42
+ /** The Input Action's value type as a script reports it: bool, axis1d, axis2d or axis3d. */
43
+ UE_MCP_BRIDGERUNTIME_API FString ActionValueTypeName(const UInputAction* Action);
44
+
45
+ /**
46
+ * This frame's state of Action on LocalPlayer's Enhanced Input: whether it is in its Triggered event, and its
47
+ * value (x, y, z; a boolean is 0 or 1 in x). An action the player has no instance data for has not triggered.
48
+ * False with OutError when the player has no Enhanced Input to read.
49
+ */
50
+ UE_MCP_BRIDGERUNTIME_API bool ReadActionTriggerState(const ULocalPlayer* LocalPlayer, const UInputAction* Action,
51
+ bool& bOutTriggered, FVector& OutValue, FString& OutError);
52
+ }
@@ -4,8 +4,11 @@
4
4
  #include "Components/ActorComponent.h"
5
5
  #include "Engine/NetSerialization.h"
6
6
  #include "MCPPIEViewportCapture.h"
7
+ #include "MCPPIEActionTrigger.h"
7
8
  #include "MCPPIERemoteControl.generated.h"
8
9
 
10
+ class UInputAction;
11
+
9
12
  /** The outcome of one request a remote player ran, as the server last heard it. */
10
13
  USTRUCT()
11
14
  struct UE_MCP_BRIDGERUNTIME_API FMCPPIERemoteResult
@@ -25,6 +28,30 @@ struct UE_MCP_BRIDGERUNTIME_API FMCPPIERemoteResult
25
28
  FString Error;
26
29
  };
27
30
 
31
+ /** A fresh trigger of a watched Input Action a remote player reported. */
32
+ USTRUCT()
33
+ struct UE_MCP_BRIDGERUNTIME_API FMCPPIERemoteTrigger
34
+ {
35
+ GENERATED_BODY()
36
+
37
+ UPROPERTY()
38
+ FString Id;
39
+
40
+ /** The action's value on the frame it triggered (x, y, z; a boolean is 0 or 1 in x). */
41
+ UPROPERTY()
42
+ FVector Value = FVector::ZeroVector;
43
+ };
44
+
45
+ /** Client side: one Input Action this process watches on its own player. */
46
+ struct FMCPPIERemoteWatch
47
+ {
48
+ FString Id;
49
+ // Reloaded from Path if nothing held the asset and it was collected.
50
+ FSoftObjectPath Path;
51
+ TWeakObjectPtr<const UInputAction> Action;
52
+ MCPPIE::FActionTriggerGate Gate;
53
+ };
54
+
28
55
  /**
29
56
  * Carries PIE Studio requests to a player whose game runs in another process.
30
57
  *
@@ -64,6 +91,16 @@ public:
64
91
  void SendCapture(const FString& Id, const FString& OutputPath);
65
92
  /** The owning client turns its pawn and view to Rotation; a server teleport cannot, as the client owns its facing. */
66
93
  void SendFace(const FString& Id, const FRotator& Rotation);
94
+ /**
95
+ * The owning client watches its own player for a fresh trigger of Action (MCPPIE::FActionTriggerGate) and reports
96
+ * the first one through FindTrigger. Its result answers ok and unfinished once the watch runs, or the error.
97
+ */
98
+ void SendWatchTrigger(const FString& Id, const FSoftObjectPath& Action);
99
+ /** The owning client stops the watch, if it still runs. */
100
+ void SendStopWatch(const FString& Id);
101
+
102
+ /** Server: the trigger reported for a watch id, if any. */
103
+ const FMCPPIERemoteTrigger* FindTrigger(const FString& Id) const { return Triggers.Find(Id); }
67
104
 
68
105
  /** Most input values a single tape request may carry. */
69
106
  static constexpr int32 MaxTapeFrames = 3600;
@@ -97,6 +134,15 @@ private:
97
134
  UFUNCTION(Client, Reliable)
98
135
  void ClientFace(const FString& Id, FRotator Rotation);
99
136
 
137
+ UFUNCTION(Client, Reliable)
138
+ void ClientWatchTrigger(const FString& Id, const FSoftObjectPath& Action);
139
+
140
+ UFUNCTION(Client, Reliable)
141
+ void ClientStopWatch(const FString& Id);
142
+
143
+ UFUNCTION(Server, Reliable)
144
+ void ServerTriggered(const FString& Id, FVector Value);
145
+
100
146
  UFUNCTION(Server, Reliable)
101
147
  void ServerReady(const FString& LogFile);
102
148
 
@@ -107,11 +153,19 @@ private:
107
153
  class ULocalPlayer* ResolveOwnLocalPlayer(FString& OutError) const;
108
154
  void Report(const FString& Id, bool bOk, bool bFinished, const FString& Error);
109
155
  void HandleTapeFinished(const FString& Id);
156
+ // Client side: reads every watch once per frame while any runs.
157
+ void PollWatches();
158
+ void UnbindWatchFrame();
110
159
 
111
160
  // Server state.
112
161
  bool bClientReady = false;
113
162
  FString ClientLogFile;
114
163
  TMap<FString, FMCPPIERemoteResult> Results;
164
+ TMap<FString, FMCPPIERemoteTrigger> Triggers;
165
+
166
+ // Client state: the Input Action watches this component runs, polled at the end of every frame.
167
+ TArray<FMCPPIERemoteWatch> Watches;
168
+ FDelegateHandle WatchFrameHandle;
115
169
 
116
170
  // Client state: tapes this component started, so their completion is reported to the server.
117
171
  TSet<FString> OwnedTapes;
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "FileVersion": 3,
3
3
  "Version": 1,
4
- "VersionName": "1.4.13",
4
+ "VersionName": "1.4.14-beta.2",
5
5
  "FriendlyName": "UE MCP Bridge",
6
- "Description": "C++ WebSocket bridge for UE-MCP, providing 3602+ editor actions over the MCP protocol",
6
+ "Description": "C++ WebSocket bridge for UE-MCP, providing 3620+ editor actions over the MCP protocol",
7
7
  "Category": "Developer Tools",
8
8
  "CreatedBy": "UE-MCP",
9
9
  "CreatedByURL": "",