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.
- package/README.md +5 -5
- package/dist/bridge/bridge-timeouts.js +4 -0
- package/dist/bridge/bridge-timeouts.js.map +1 -1
- package/dist/cli/cli-commands.js +1 -0
- package/dist/cli/cli-commands.js.map +1 -1
- package/dist/cli/doctor.js +2 -1
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/projects-cli.d.ts +3 -0
- package/dist/cli/projects-cli.js +72 -0
- package/dist/cli/projects-cli.js.map +1 -0
- package/dist/config/user-state.d.ts +10 -0
- package/dist/config/user-state.js +21 -0
- package/dist/config/user-state.js.map +1 -1
- package/dist/core/env.d.ts +2 -0
- package/dist/core/env.js +2 -0
- package/dist/core/env.js.map +1 -1
- package/dist/core/types.d.ts +27 -0
- package/dist/daemon/daemon.js +44 -5
- package/dist/daemon/daemon.js.map +1 -1
- package/dist/daemon/extension-api.d.ts +8 -5
- package/dist/daemon-api.d.ts +2 -1
- package/dist/daemon-api.js +1 -0
- package/dist/daemon-api.js.map +1 -1
- package/dist/dispatch/offline.js +1 -0
- package/dist/dispatch/offline.js.map +1 -1
- package/dist/editor/dialog-guard.d.ts +12 -2
- package/dist/editor/dialog-guard.js +68 -2
- package/dist/editor/dialog-guard.js.map +1 -1
- package/dist/editor/editor-control.js +1 -1
- package/dist/editor/editor-control.js.map +1 -1
- package/dist/flow/write-methods.js +1 -1
- package/dist/flow/write-methods.js.map +1 -1
- package/dist/machine/projects.d.ts +85 -0
- package/dist/machine/projects.js +286 -0
- package/dist/machine/projects.js.map +1 -0
- package/dist/pie/script-events.d.ts +4 -1
- package/dist/pie/script-events.js.map +1 -1
- package/dist/surface/context/instructions.js +20 -0
- package/dist/surface/context/instructions.js.map +1 -1
- package/dist/tool-counts.json +12 -12
- package/dist/tools/asset.js +2 -1
- package/dist/tools/asset.js.map +1 -1
- package/dist/tools/editor.js +1 -1
- package/dist/tools/editor.js.map +1 -1
- package/dist/tools/epic/effects.js +11 -0
- package/dist/tools/epic/effects.js.map +1 -1
- package/dist/tools/epic/fab.generated.d.ts +6 -0
- package/dist/tools/epic/fab.generated.js +67 -0
- package/dist/tools/epic/fab.generated.js.map +1 -0
- package/dist/tools/epic/index.d.ts +2 -0
- package/dist/tools/epic/index.js +2 -0
- package/dist/tools/epic/index.js.map +1 -1
- package/dist/tools/epic/toolset-routes.js +2 -0
- package/dist/tools/epic/toolset-routes.js.map +1 -1
- package/dist/tools/epic.js +4 -4
- package/dist/tools/epic.js.map +1 -1
- package/dist/tools/fab-epic.d.ts +23 -0
- package/dist/tools/fab-epic.js +109 -0
- package/dist/tools/fab-epic.js.map +1 -0
- package/dist/tools/fab.js +27 -18
- package/dist/tools/fab.js.map +1 -1
- package/dist/tools/level.js +9 -2
- package/dist/tools/level.js.map +1 -1
- package/dist/tools/material.js +1 -1
- package/dist/tools/material.js.map +1 -1
- package/dist/tools/pie.js +1 -1
- package/dist/tools/pie.js.map +1 -1
- package/dist/tools/specs/asset.generated.js +92 -3
- package/dist/tools/specs/asset.generated.js.map +1 -1
- package/dist/tools/specs/fab.generated.js +143 -3
- package/dist/tools/specs/fab.generated.js.map +1 -1
- package/dist/tools/specs/level.generated.js +183 -9
- package/dist/tools/specs/level.generated.js.map +1 -1
- package/dist/tools/specs/pie.generated.js +28 -8
- package/dist/tools/specs/pie.generated.js.map +1 -1
- package/dist/tools/specs/widget.generated.js +8 -1
- package/dist/tools/specs/widget.generated.js.map +1 -1
- package/dist/ue-mcp.default.yml +522 -76
- package/package.json +2 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeServer.cpp +26 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.cpp +24 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.h +7 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_Mesh.cpp +483 -10
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Dialog/DialogHandlers.cpp +345 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_AIAssistant.cpp +34 -6
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.cpp +766 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.h +26 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.cpp +159 -55
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.h +23 -12
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.cpp +306 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.h +55 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.cpp +34 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.h +9 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Blockout.cpp +12 -8
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_PerfAudit.cpp +3 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Refresh.cpp +479 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_ReplaceActors.cpp +2 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_WorldPartition.cpp +824 -12
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Material/MaterialHandlers.cpp +95 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers.cpp +13 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/MCPPIETestScript.h +8 -3
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers.cpp +2 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Record.cpp +6 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Replay.cpp +1 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Script.cpp +2 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.cpp +52 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.h +16 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.cpp +65 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.h +15 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.cpp +146 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.h +53 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.cpp +351 -14
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.h +55 -6
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptValidation.cpp +8 -1
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.cpp +59 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.h +15 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.cpp +567 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.h +173 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/SMCPPIEStudioPanel.cpp +41 -6
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers.cpp +92 -32
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabDownloadTests.cpp +140 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabEndToEndTests.cpp +365 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabLibraryTests.cpp +52 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PCGGraphAuthoringTests.cpp +5 -2
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEReplayInputLockTests.cpp +77 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptTests.cpp +256 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptValidationTests.cpp +18 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEUIPointerTests.cpp +246 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/UE_MCP_Bridge.cpp +4 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/UE_MCP_Bridge.Build.cs +85 -13
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIEActionTrigger.cpp +48 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIERemoteControl.cpp +93 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIEActionTrigger.h +52 -0
- package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIERemoteControl.h +54 -0
- package/plugin/ue_mcp_bridge/UE_MCP_Bridge.uplugin +2 -2
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
#include "Handlers/PIE/PIEFrameSampler.h"
|
|
5
5
|
#include "Handlers/PIE/PIESequenceFormat.h"
|
|
6
6
|
#include "Handlers/PIE/PIEMaxFPSPin.h"
|
|
7
|
+
#include "Handlers/PIE/PIEUIPointer.h"
|
|
7
8
|
#include "UObject/WeakObjectPtrTemplates.h"
|
|
8
9
|
|
|
9
10
|
class UWorld;
|
|
@@ -94,6 +95,10 @@ namespace MCPPIE
|
|
|
94
95
|
float ThrTrackedDefault = 0.f;
|
|
95
96
|
TMap<FString, float> TrackedThresholds;
|
|
96
97
|
bool bEject = false;
|
|
98
|
+
// Block the user's own keyboard, mouse and gamepad from the PIE game
|
|
99
|
+
// while the replay runs, so only the recording drives the player.
|
|
100
|
+
// Ignored in monitor mode, where the user plays on purpose.
|
|
101
|
+
bool bLockInput = false;
|
|
97
102
|
float TimeScale = 1.0f;
|
|
98
103
|
// Opt-in stronger reproducibility (item X2): drive the engine at a fixed
|
|
99
104
|
// delta time (1/pin_fps) during replay instead of just capping FPS. Makes
|
|
@@ -189,6 +194,9 @@ namespace MCPPIE
|
|
|
189
194
|
void OnEndFrame();
|
|
190
195
|
FReplayerFinishResult FinaliseCurrent();
|
|
191
196
|
void ExecutePendingSteps(double ElapsedMs);
|
|
197
|
+
// ui_input steps run on their own cursor and clock (real time, so a
|
|
198
|
+
// paused game still plays its menu input).
|
|
199
|
+
void ExecutePendingUISteps(double UIElapsedMs);
|
|
192
200
|
void ApplyFPSPin(UWorld* PIEWorld, int32 Hz);
|
|
193
201
|
bool UpdateStartGate(UWorld* PIEWorld, double Now, FString& OutBlocker);
|
|
194
202
|
|
|
@@ -260,6 +268,13 @@ namespace MCPPIE
|
|
|
260
268
|
TArray<FCSVRow> ReplayRows;
|
|
261
269
|
int32 NextStepIndex = 0;
|
|
262
270
|
int32 ExecutedSteps = 0;
|
|
271
|
+
// ui_input playback (#1822).
|
|
272
|
+
FPIEUIPointerPlayer UIPlayer;
|
|
273
|
+
int32 NextUIStepIndex = 0;
|
|
274
|
+
int32 UIStepErrors = 0;
|
|
275
|
+
double AttachRealTime = 0.0;
|
|
276
|
+
double UIClockStartRealMs = 0.0;
|
|
277
|
+
double UIClockStartStepMs = 0.0;
|
|
263
278
|
FString StartedAt;
|
|
264
279
|
|
|
265
280
|
// Active hold lifecycles: maps "step <i> stop time ms" -> injection id.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#include "Handlers/PIE/PIEReplayInputLock.h"
|
|
2
|
+
#include "Handlers/PIE/PIELog.h"
|
|
3
|
+
#include "Handlers/PIE/PIEUIPointer.h"
|
|
4
|
+
#include "Engine/GameViewportClient.h"
|
|
5
|
+
#include "Engine/World.h"
|
|
6
|
+
#include "Framework/Application/IInputProcessor.h"
|
|
7
|
+
#include "Framework/Application/SlateApplication.h"
|
|
8
|
+
#include "Input/Events.h"
|
|
9
|
+
#include "Widgets/SViewport.h"
|
|
10
|
+
|
|
11
|
+
namespace MCPPIE
|
|
12
|
+
{
|
|
13
|
+
bool IsReplayLockEscapeKey(const FKey& Key, bool bShift)
|
|
14
|
+
{
|
|
15
|
+
return Key == EKeys::Escape || Key == EKeys::F8 || (Key == EKeys::F1 && bShift);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
bool ShouldReplayLockBlock(const FReplayLockInputEvent& Event)
|
|
19
|
+
{
|
|
20
|
+
if (Event.bInjected) return false;
|
|
21
|
+
switch (Event.Kind)
|
|
22
|
+
{
|
|
23
|
+
case EReplayLockInput::Key:
|
|
24
|
+
if (Event.bRelease || IsReplayLockEscapeKey(Event.Key, Event.bShift)) return false;
|
|
25
|
+
if (Event.Key.IsGamepadKey()) return true;
|
|
26
|
+
// Mouse buttons follow the pointer; keyboard keys follow focus, so
|
|
27
|
+
// typing elsewhere in the editor still works.
|
|
28
|
+
return Event.Key.IsMouseButton() ? Event.bInsideViewport : Event.bViewportFocused;
|
|
29
|
+
case EReplayLockInput::Analog:
|
|
30
|
+
return Event.Key.IsGamepadKey() || Event.bViewportFocused;
|
|
31
|
+
case EReplayLockInput::MouseMove:
|
|
32
|
+
case EReplayLockInput::MouseWheel:
|
|
33
|
+
return Event.bInsideViewport;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
namespace
|
|
39
|
+
{
|
|
40
|
+
// Slate pre-processor that applies ShouldReplayLockBlock to every
|
|
41
|
+
// physical event. Registered first so nothing downstream sees a
|
|
42
|
+
// blocked event, the game viewport included.
|
|
43
|
+
class FReplayInputLockProcessor : public IInputProcessor
|
|
44
|
+
{
|
|
45
|
+
public:
|
|
46
|
+
explicit FReplayInputLockProcessor(UWorld* InWorld) : World(InWorld) {}
|
|
47
|
+
|
|
48
|
+
virtual void Tick(const float /*DeltaTime*/, FSlateApplication& /*SlateApp*/, TSharedRef<ICursor> /*Cursor*/) override {}
|
|
49
|
+
|
|
50
|
+
virtual bool HandleKeyDownEvent(FSlateApplication& /*SlateApp*/, const FKeyEvent& E) override { return BlockKey(E, false); }
|
|
51
|
+
virtual bool HandleKeyUpEvent(FSlateApplication& /*SlateApp*/, const FKeyEvent& E) override { return BlockKey(E, true); }
|
|
52
|
+
|
|
53
|
+
virtual bool HandleAnalogInputEvent(FSlateApplication& /*SlateApp*/, const FAnalogInputEvent& E) override
|
|
54
|
+
{
|
|
55
|
+
FReplayLockInputEvent Q;
|
|
56
|
+
Q.Kind = EReplayLockInput::Analog;
|
|
57
|
+
Q.Key = E.GetKey();
|
|
58
|
+
Q.bViewportFocused = IsViewportFocused();
|
|
59
|
+
return ShouldReplayLockBlock(Q);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
virtual bool HandleMouseMoveEvent(FSlateApplication& /*SlateApp*/, const FPointerEvent& E) override { return BlockPointer(E, EReplayLockInput::MouseMove, false); }
|
|
63
|
+
virtual bool HandleMouseButtonDownEvent(FSlateApplication& /*SlateApp*/, const FPointerEvent& E) override { return BlockPointer(E, EReplayLockInput::Key, false); }
|
|
64
|
+
virtual bool HandleMouseButtonUpEvent(FSlateApplication& /*SlateApp*/, const FPointerEvent& E) override { return BlockPointer(E, EReplayLockInput::Key, true); }
|
|
65
|
+
virtual bool HandleMouseButtonDoubleClickEvent(FSlateApplication& /*SlateApp*/, const FPointerEvent& E) override { return BlockPointer(E, EReplayLockInput::Key, false); }
|
|
66
|
+
virtual bool HandleMouseWheelOrGestureEvent(FSlateApplication& /*SlateApp*/, const FPointerEvent& E, const FPointerEvent* /*Gesture*/) override { return BlockPointer(E, EReplayLockInput::MouseWheel, false); }
|
|
67
|
+
|
|
68
|
+
virtual const TCHAR* GetDebugName() const override { return TEXT("UE_MCP_PIEReplayInputLock"); }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
TSharedPtr<SViewport> GetViewportWidget() const
|
|
72
|
+
{
|
|
73
|
+
UWorld* W = World.Get();
|
|
74
|
+
UGameViewportClient* GVC = W ? W->GetGameViewport() : nullptr;
|
|
75
|
+
return GVC ? GVC->GetGameViewportWidget() : nullptr;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
bool IsViewportFocused() const
|
|
79
|
+
{
|
|
80
|
+
const TSharedPtr<SViewport> Widget = GetViewportWidget();
|
|
81
|
+
return Widget.IsValid() && (Widget->HasKeyboardFocus() || Widget->HasFocusedDescendants());
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
bool IsInsideViewport(const FPointerEvent& E) const
|
|
85
|
+
{
|
|
86
|
+
FVector2D Origin, Size, Relative;
|
|
87
|
+
return GetPIEViewportRect(World.Get(), Origin, Size)
|
|
88
|
+
&& ScreenToViewportRelative(FVector2D(E.GetScreenSpacePosition()), Origin, Size, Relative);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
bool BlockKey(const FKeyEvent& E, bool bRelease) const
|
|
92
|
+
{
|
|
93
|
+
FReplayLockInputEvent Q;
|
|
94
|
+
Q.Kind = EReplayLockInput::Key;
|
|
95
|
+
Q.Key = E.GetKey();
|
|
96
|
+
Q.bRelease = bRelease;
|
|
97
|
+
Q.bShift = E.IsShiftDown();
|
|
98
|
+
Q.bViewportFocused = IsViewportFocused();
|
|
99
|
+
return ShouldReplayLockBlock(Q);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
bool BlockPointer(const FPointerEvent& E, EReplayLockInput Kind, bool bRelease) const
|
|
103
|
+
{
|
|
104
|
+
FReplayLockInputEvent Q;
|
|
105
|
+
Q.Kind = Kind;
|
|
106
|
+
Q.Key = E.GetEffectingButton();
|
|
107
|
+
Q.bRelease = bRelease;
|
|
108
|
+
Q.bShift = E.IsShiftDown();
|
|
109
|
+
Q.bInjected = FPIEUIPointerPlayer::IsInjecting();
|
|
110
|
+
Q.bInsideViewport = IsInsideViewport(E);
|
|
111
|
+
return ShouldReplayLockBlock(Q);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
TWeakObjectPtr<UWorld> World;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
TSharedPtr<FReplayInputLockProcessor> GReplayInputLock;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
namespace ReplayInputLock
|
|
121
|
+
{
|
|
122
|
+
void Start(UWorld* World)
|
|
123
|
+
{
|
|
124
|
+
if (GReplayInputLock.IsValid() || !FSlateApplication::IsInitialized()) return;
|
|
125
|
+
GReplayInputLock = MakeShared<FReplayInputLockProcessor>(World);
|
|
126
|
+
FSlateApplication::Get().RegisterInputPreProcessor(GReplayInputLock, 0);
|
|
127
|
+
UE_LOG(LogMCPPIE, Log, TEXT("[PIE-REP] Input locked: only the recording drives the player (Esc, Shift+F1 and F8 still work)"));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
void Stop()
|
|
131
|
+
{
|
|
132
|
+
if (!GReplayInputLock.IsValid()) return;
|
|
133
|
+
if (FSlateApplication::IsInitialized())
|
|
134
|
+
{
|
|
135
|
+
FSlateApplication::Get().UnregisterInputPreProcessor(GReplayInputLock);
|
|
136
|
+
}
|
|
137
|
+
GReplayInputLock.Reset();
|
|
138
|
+
UE_LOG(LogMCPPIE, Log, TEXT("[PIE-REP] Input unlocked"));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
bool IsActive()
|
|
142
|
+
{
|
|
143
|
+
return GReplayInputLock.IsValid();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "CoreMinimal.h"
|
|
4
|
+
#include "InputCoreTypes.h"
|
|
5
|
+
|
|
6
|
+
class UWorld;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Replay input lock (replay_arm / replay_run lock_input): while a replay runs,
|
|
10
|
+
* the user's own keyboard, mouse and gamepad stop reaching the PIE game, so
|
|
11
|
+
* only the recording drives the player. Recorded gameplay input is injected
|
|
12
|
+
* straight into Enhanced Input and recorded ui_input steps are marked as
|
|
13
|
+
* replayed, so neither is affected.
|
|
14
|
+
*/
|
|
15
|
+
namespace MCPPIE
|
|
16
|
+
{
|
|
17
|
+
enum class EReplayLockInput : uint8
|
|
18
|
+
{
|
|
19
|
+
Key, // keyboard key or mouse button, down or up
|
|
20
|
+
Analog, // gamepad stick or trigger
|
|
21
|
+
MouseMove,
|
|
22
|
+
MouseWheel
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// One physical input event, reduced to what the lock decides on.
|
|
26
|
+
struct FReplayLockInputEvent
|
|
27
|
+
{
|
|
28
|
+
EReplayLockInput Kind = EReplayLockInput::Key;
|
|
29
|
+
FKey Key; // Key and Analog only
|
|
30
|
+
bool bRelease = false; // a key or button coming up
|
|
31
|
+
bool bShift = false;
|
|
32
|
+
bool bInjected = false; // a replayed event, not the user's
|
|
33
|
+
bool bInsideViewport = false; // pointer position is inside the PIE viewport
|
|
34
|
+
bool bViewportFocused = false; // the PIE viewport has keyboard focus
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Keys that always get through, so the user can still leave a locked
|
|
38
|
+
// replay: Esc (stop PIE), Shift+F1 (release the mouse), F8 (eject).
|
|
39
|
+
bool IsReplayLockEscapeKey(const FKey& Key, bool bShift);
|
|
40
|
+
|
|
41
|
+
// Pure pass/block rule (unit tested). Releases always pass, so a key or
|
|
42
|
+
// button held when the lock starts is never left down.
|
|
43
|
+
bool ShouldReplayLockBlock(const FReplayLockInputEvent& Event);
|
|
44
|
+
|
|
45
|
+
namespace ReplayInputLock
|
|
46
|
+
{
|
|
47
|
+
// Start locking input aimed at World's game viewport. No-op when
|
|
48
|
+
// already active or when Slate is not initialised.
|
|
49
|
+
void Start(UWorld* World);
|
|
50
|
+
void Stop();
|
|
51
|
+
bool IsActive();
|
|
52
|
+
}
|
|
53
|
+
}
|