ultimate-unreal-engine-mcp 0.1.1 → 0.1.3
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 +1 -1
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/MCPBridgeEditor.Build.cs +60 -68
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPActorCommands.cpp +2 -2
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBlueprintHandlers.cpp +2 -2
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBlueprintWriteHandlers.cpp +21 -9
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBridgeSubsystem.cpp +110 -149
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPCollisionPhysicsCommands.cpp +3 -3
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPEditorStateCommands.cpp +1 -0
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPInputHandlers.cpp +14 -7
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPPieCommands.cpp +4 -3
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPSelectionCommands.cpp +1 -1
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPSequencerCommands.cpp +22 -44
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPViewportCommands.cpp +1 -1
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAICommands.cpp → Optional/MCPAICommands.cpp.disabled} +14 -11
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAnimationCommands.cpp → Optional/MCPAnimationCommands.cpp.disabled} +18 -11
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAudioCommands.cpp → Optional/MCPAudioCommands.cpp.disabled} +1 -1
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPChaosCommands.cpp → Optional/MCPChaosCommands.cpp.disabled} +3 -3
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPGASCommands.cpp → Optional/MCPGASCommands.cpp.disabled} +35 -15
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPImportExportCommands.cpp → Optional/MCPImportExportCommands.cpp.disabled} +13 -8
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPLiveLinkCommands.cpp → Optional/MCPLiveLinkCommands.cpp.disabled} +6 -6
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMaterialCommands.cpp → Optional/MCPMaterialCommands.cpp.disabled} +38 -29
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMotionDesignCommands.cpp → Optional/MCPMotionDesignCommands.cpp.disabled} +9 -9
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMovieRenderCommands.cpp → Optional/MCPMovieRenderCommands.cpp.disabled} +4 -9
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPNetworkingCommands.cpp → Optional/MCPNetworkingCommands.cpp.disabled} +4 -4
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPValidationCommands.cpp → Optional/MCPValidationCommands.cpp.disabled} +11 -11
- package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPWorldPartitionCommands.cpp → Optional/MCPWorldPartitionCommands.cpp.disabled} +43 -26
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAICommands.h → Optional/MCPAICommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAnimationCommands.h → Optional/MCPAnimationCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAudioCommands.h → Optional/MCPAudioCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPChaosCommands.h → Optional/MCPChaosCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPGASCommands.h → Optional/MCPGASCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPImportExportCommands.h → Optional/MCPImportExportCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPLiveLinkCommands.h → Optional/MCPLiveLinkCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMaterialCommands.h → Optional/MCPMaterialCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMotionDesignCommands.h → Optional/MCPMotionDesignCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMovieRenderCommands.h → Optional/MCPMovieRenderCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPNetworkingCommands.h → Optional/MCPNetworkingCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPValidationCommands.h → Optional/MCPValidationCommands.h.disabled} +0 -0
- /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPWorldPartitionCommands.h → Optional/MCPWorldPartitionCommands.h.disabled} +0 -0
package/package.json
CHANGED
|
@@ -1,68 +1,60 @@
|
|
|
1
|
-
// MCPBridgeEditor.Build.cs
|
|
2
|
-
// Editor module: UEditorSubsystem lifecycle, editor API handlers
|
|
3
|
-
// Depends on MCPBridgeRuntime for the TCP server.
|
|
4
|
-
// This module is guarded by WITH_EDITOR -- never ships to cooked builds.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"RemoteControl", // Phase 28 - Remote Control preset read/write
|
|
62
|
-
"MovieRenderPipelineCore", // Phase 29 - UMoviePipelineQueue, UMoviePipelineExecutorJob, config/settings types
|
|
63
|
-
"MovieRenderPipelineEditor", // Phase 29 - UMoviePipelineQueueSubsystem
|
|
64
|
-
"OnlineSubsystem", // Phase 30 - IOnlineSubsystem, IOnlineSession, FOnlineSessionSettings
|
|
65
|
-
"OnlineSubsystemUtils", // Phase 30 - Online subsystem helper utilities
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
|
1
|
+
// MCPBridgeEditor.Build.cs
|
|
2
|
+
// Editor module: UEditorSubsystem lifecycle, editor API handlers.
|
|
3
|
+
// Depends on MCPBridgeRuntime for the TCP server.
|
|
4
|
+
// This module is guarded by WITH_EDITOR -- never ships to cooked builds.
|
|
5
|
+
//
|
|
6
|
+
// Only modules that ship with every UE 5.7 binary install are linked here.
|
|
7
|
+
// Handlers for optional plugins live in the Private/Optional/ subfolder
|
|
8
|
+
// and are NOT compiled by default. To enable them, move them to Private/
|
|
9
|
+
// and add their module dependencies below.
|
|
10
|
+
|
|
11
|
+
using UnrealBuildTool;
|
|
12
|
+
|
|
13
|
+
public class MCPBridgeEditor : ModuleRules
|
|
14
|
+
{
|
|
15
|
+
public MCPBridgeEditor(ReadOnlyTargetRules Target) : base(Target)
|
|
16
|
+
{
|
|
17
|
+
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
|
18
|
+
|
|
19
|
+
PublicDependencyModuleNames.AddRange(new string[]
|
|
20
|
+
{
|
|
21
|
+
"Core",
|
|
22
|
+
"MCPBridgeRuntime",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
PrivateDependencyModuleNames.AddRange(new string[]
|
|
26
|
+
{
|
|
27
|
+
// Core engine (always present)
|
|
28
|
+
"CoreUObject",
|
|
29
|
+
"Engine",
|
|
30
|
+
"UnrealEd",
|
|
31
|
+
"EditorSubsystem",
|
|
32
|
+
"Json",
|
|
33
|
+
"SlateCore",
|
|
34
|
+
"InputCore",
|
|
35
|
+
"AssetTools",
|
|
36
|
+
"AssetRegistry",
|
|
37
|
+
"LevelEditor",
|
|
38
|
+
"PhysicsCore",
|
|
39
|
+
|
|
40
|
+
// Blueprint (always present in editor)
|
|
41
|
+
"Kismet",
|
|
42
|
+
"BlueprintGraph",
|
|
43
|
+
|
|
44
|
+
// Sequencer (always present in editor)
|
|
45
|
+
"LevelSequence",
|
|
46
|
+
"LevelSequenceEditor",
|
|
47
|
+
"MovieScene",
|
|
48
|
+
"MovieSceneTracks",
|
|
49
|
+
|
|
50
|
+
// Input (always present)
|
|
51
|
+
"EnhancedInput",
|
|
52
|
+
|
|
53
|
+
// AI (always present)
|
|
54
|
+
"AIModule",
|
|
55
|
+
"NavigationSystem",
|
|
56
|
+
"GameplayTags",
|
|
57
|
+
"GameplayTasks",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -177,10 +177,10 @@ void RegisterActorCommands(FMCPCommandRouter& Router)
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
// Find actor class by name; try exact name then A-prefixed name.
|
|
180
|
-
UClass* ActorClass =
|
|
180
|
+
UClass* ActorClass = FindFirstObject<UClass>( *ClassName);
|
|
181
181
|
if (!ActorClass)
|
|
182
182
|
{
|
|
183
|
-
ActorClass =
|
|
183
|
+
ActorClass = FindFirstObject<UClass>( *(TEXT("A") + ClassName));
|
|
184
184
|
}
|
|
185
185
|
if (!ActorClass)
|
|
186
186
|
{
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
// Blueprint APIs
|
|
14
14
|
#include "Engine/Blueprint.h"
|
|
15
|
-
#include "BlueprintEditorUtils.h"
|
|
15
|
+
#include "Kismet2/BlueprintEditorUtils.h"
|
|
16
16
|
#include "EdGraph/EdGraph.h"
|
|
17
17
|
#include "EdGraph/EdGraphNode.h"
|
|
18
18
|
#include "EdGraph/EdGraphPin.h"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
#include "AssetRegistry/AssetRegistryModule.h"
|
|
29
29
|
#include "AssetRegistry/IAssetRegistry.h"
|
|
30
30
|
#include "AssetRegistry/AssetData.h"
|
|
31
|
-
#include "Blueprint/
|
|
31
|
+
#include "Blueprint/BlueprintSupport.h"
|
|
32
32
|
|
|
33
33
|
// JSON APIs
|
|
34
34
|
#include "Dom/JsonObject.h"
|
package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBlueprintWriteHandlers.cpp
CHANGED
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
// Asset APIs
|
|
32
32
|
#include "AssetRegistry/AssetRegistryModule.h"
|
|
33
33
|
#include "UObject/Package.h"
|
|
34
|
+
#include "UObject/SavePackage.h"
|
|
34
35
|
#include "Misc/PackageName.h"
|
|
35
36
|
|
|
36
37
|
// JSON APIs
|
|
@@ -146,17 +147,17 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
|
|
|
146
147
|
|
|
147
148
|
// T-10-01: Validate the asset path is a well-formed long package name.
|
|
148
149
|
// Rejects path traversal ("../") and bare filenames.
|
|
149
|
-
|
|
150
|
+
FText ValidationError;
|
|
150
151
|
if (!FPackageName::IsValidLongPackageName(AssetPath, /*bIncludeReadOnlyRoots=*/false, &ValidationError))
|
|
151
152
|
{
|
|
152
153
|
UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] blueprint.create: Invalid asset path '%s': %s"),
|
|
153
|
-
*AssetPath, *ValidationError);
|
|
154
|
+
*AssetPath, *ValidationError.ToString());
|
|
154
155
|
SendError(SendResponse, CorrelationId, TEXT("invalid_asset_path"));
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
// Resolve the parent class by name (try short name first, then full path).
|
|
159
|
-
UClass* ParentClass =
|
|
160
|
+
UClass* ParentClass = FindFirstObject<UClass>( *ParentClassName);
|
|
160
161
|
if (!ParentClass)
|
|
161
162
|
{
|
|
162
163
|
ParentClass = LoadObject<UClass>(nullptr, *ParentClassName);
|
|
@@ -214,8 +215,10 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
|
|
|
214
215
|
// Save the package to disk so the asset persists.
|
|
215
216
|
FString FilePath = FPackageName::LongPackageNameToFilename(
|
|
216
217
|
AssetPath, FPackageName::GetAssetPackageExtension());
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
FSavePackageArgs SaveArgs;
|
|
219
|
+
SaveArgs.TopLevelFlags = RF_Standalone;
|
|
220
|
+
SaveArgs.SaveFlags = SAVE_NoError;
|
|
221
|
+
UPackage::SavePackage(Pkg, NewBP, *FilePath, SaveArgs);
|
|
219
222
|
|
|
220
223
|
// Notify the Asset Registry so the asset appears in the Content Browser.
|
|
221
224
|
FAssetRegistryModule::AssetCreated(NewBP);
|
|
@@ -288,7 +291,7 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
|
|
|
288
291
|
}
|
|
289
292
|
|
|
290
293
|
// T-10-02: Resolve node class and validate it is a non-abstract UEdGraphNode subclass.
|
|
291
|
-
UClass* NodeClass =
|
|
294
|
+
UClass* NodeClass = FindFirstObject<UClass>( *NodeType);
|
|
292
295
|
if (!NodeClass)
|
|
293
296
|
{
|
|
294
297
|
UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] blueprint.addNode: Node type '%s' not found"), *NodeType);
|
|
@@ -649,9 +652,18 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
|
|
|
649
652
|
return;
|
|
650
653
|
}
|
|
651
654
|
|
|
652
|
-
//
|
|
653
|
-
bool bSet =
|
|
654
|
-
|
|
655
|
+
// Find the variable in NewVariables and set its DefaultValue directly.
|
|
656
|
+
bool bSet = false;
|
|
657
|
+
const FName VarName(*TargetName);
|
|
658
|
+
for (FBPVariableDescription& VarDesc : BP->NewVariables)
|
|
659
|
+
{
|
|
660
|
+
if (VarDesc.VarName == VarName)
|
|
661
|
+
{
|
|
662
|
+
VarDesc.DefaultValue = DefaultValue;
|
|
663
|
+
bSet = true;
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
655
667
|
if (!bSet)
|
|
656
668
|
{
|
|
657
669
|
UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] blueprint.setDefault: Variable '%s' not found in '%s'"),
|
|
@@ -1,149 +1,110 @@
|
|
|
1
|
-
// MCPBridgeSubsystem.cpp
|
|
2
|
-
// Wires FMCPCommandRouter and FMCPTcpServer into the editor subsystem lifecycle.
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
#include "
|
|
10
|
-
#include "
|
|
11
|
-
#include "
|
|
12
|
-
#include "
|
|
13
|
-
#include "
|
|
14
|
-
#include "
|
|
15
|
-
#include "
|
|
16
|
-
#include "
|
|
17
|
-
#include "
|
|
18
|
-
#include "
|
|
19
|
-
#include "MCPSelectionCommands.h"
|
|
20
|
-
#include "MCPCollisionPhysicsCommands.h"
|
|
21
|
-
#include "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
#include "
|
|
26
|
-
#include "
|
|
27
|
-
#include "
|
|
28
|
-
#include "
|
|
29
|
-
#include "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
//
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
// Register Networking command handlers (net.replication, net.properties, net.driver, net.session).
|
|
113
|
-
RegisterNetworkingCommands(*Router);
|
|
114
|
-
|
|
115
|
-
// Create and start the TCP server.
|
|
116
|
-
TcpServer = MakeUnique<FMCPTcpServer>(*Router);
|
|
117
|
-
bServerRunning = TcpServer->Start(Port);
|
|
118
|
-
|
|
119
|
-
if (!bServerRunning)
|
|
120
|
-
{
|
|
121
|
-
UE_LOG(LogTemp, Error, TEXT("[MCPBridge] Failed to start TCP server on port %d."), Port);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
void UMCPBridgeSubsystem::Deinitialize()
|
|
126
|
-
{
|
|
127
|
-
if (TcpServer.IsValid())
|
|
128
|
-
{
|
|
129
|
-
TcpServer->Stop();
|
|
130
|
-
TcpServer.Reset();
|
|
131
|
-
}
|
|
132
|
-
if (Router.IsValid())
|
|
133
|
-
{
|
|
134
|
-
Router.Reset();
|
|
135
|
-
}
|
|
136
|
-
bServerRunning = false;
|
|
137
|
-
|
|
138
|
-
Super::Deinitialize();
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
int32 UMCPBridgeSubsystem::GetConfiguredPort() const
|
|
142
|
-
{
|
|
143
|
-
int32 Port = 55557;
|
|
144
|
-
if (GConfig)
|
|
145
|
-
{
|
|
146
|
-
GConfig->GetInt(TEXT("MCPBridge"), TEXT("Port"), Port, GEngineIni);
|
|
147
|
-
}
|
|
148
|
-
return Port;
|
|
149
|
-
}
|
|
1
|
+
// MCPBridgeSubsystem.cpp
|
|
2
|
+
// Wires FMCPCommandRouter and FMCPTcpServer into the editor subsystem lifecycle.
|
|
3
|
+
//
|
|
4
|
+
// Core handlers are always registered. Optional-plugin handlers are guarded by
|
|
5
|
+
// preprocessor defines set in Build.cs. When a plugin module is not linked,
|
|
6
|
+
// the corresponding Register*Commands() call is skipped and the TypeScript
|
|
7
|
+
// side returns "plugin_not_connected" gracefully.
|
|
8
|
+
|
|
9
|
+
#include "MCPBridgeSubsystem.h"
|
|
10
|
+
#include "MCPBlueprintHandlers.h"
|
|
11
|
+
#include "MCPActorCommands.h"
|
|
12
|
+
#include "MCPAssetCommands.h"
|
|
13
|
+
#include "MCPBlueprintWriteHandlers.h"
|
|
14
|
+
#include "MCPEditorStateCommands.h"
|
|
15
|
+
#include "MCPPieCommands.h"
|
|
16
|
+
#include "MCPViewportCommands.h"
|
|
17
|
+
#include "MCPInputHandlers.h"
|
|
18
|
+
#include "MCPSequencerCommands.h"
|
|
19
|
+
#include "MCPSelectionCommands.h"
|
|
20
|
+
#include "MCPCollisionPhysicsCommands.h"
|
|
21
|
+
#include "Misc/ConfigCacheIni.h"
|
|
22
|
+
|
|
23
|
+
// Optional module handlers — only included when their Build.cs dependencies are linked.
|
|
24
|
+
// To enable: add the module to Build.cs PrivateDependencyModuleNames and uncomment here.
|
|
25
|
+
// #include "MCPValidationCommands.h" // Requires: DataValidation
|
|
26
|
+
// #include "MCPMaterialCommands.h" // Requires: MaterialEditor
|
|
27
|
+
// #include "MCPWorldPartitionCommands.h" // Requires: WorldPartitionEditor, DataLayerEditor
|
|
28
|
+
// #include "MCPImportExportCommands.h" // Requires: InterchangeEngine, InterchangeCore, InterchangePipelines
|
|
29
|
+
// #include "MCPAudioCommands.h" // Requires: MetasoundEngine, MetasoundFrontend
|
|
30
|
+
// #include "MCPGASCommands.h" // Requires: GameplayAbilities
|
|
31
|
+
// #include "MCPChaosCommands.h" // Requires: GeometryCollectionEngine, Chaos, ChaosCloth
|
|
32
|
+
// #include "MCPLiveLinkCommands.h" // Requires: LiveLinkInterface, LiveLink
|
|
33
|
+
// #include "MCPMotionDesignCommands.h" // Requires: AvalancheTransition, RemoteControl
|
|
34
|
+
// #include "MCPMovieRenderCommands.h" // Requires: MovieRenderPipelineCore, MovieRenderPipelineEditor
|
|
35
|
+
// #include "MCPNetworkingCommands.h" // Requires: OnlineSubsystem, OnlineSubsystemUtils
|
|
36
|
+
|
|
37
|
+
void UMCPBridgeSubsystem::Initialize(FSubsystemCollectionBase& Collection)
|
|
38
|
+
{
|
|
39
|
+
Super::Initialize(Collection);
|
|
40
|
+
|
|
41
|
+
const int32 Port = GetConfiguredPort();
|
|
42
|
+
|
|
43
|
+
Router = MakeUnique<FMCPCommandRouter>();
|
|
44
|
+
|
|
45
|
+
// --- Core handlers (always available) ---
|
|
46
|
+
RegisterBlueprintHandlers(*Router);
|
|
47
|
+
RegisterBlueprintBridgeHandlers(*Router);
|
|
48
|
+
RegisterActorCommands(*Router);
|
|
49
|
+
RegisterAssetCommands(*Router);
|
|
50
|
+
RegisterBlueprintWriteHandlers(*Router);
|
|
51
|
+
RegisterEditorStateCommands(*Router);
|
|
52
|
+
RegisterPieCommands(*Router);
|
|
53
|
+
RegisterViewportCommands(*Router);
|
|
54
|
+
RegisterInputHandlers(*Router);
|
|
55
|
+
RegisterSequencerCommands(*Router);
|
|
56
|
+
RegisterSelectionCommands(*Router);
|
|
57
|
+
RegisterCollisionPhysicsCommands(*Router);
|
|
58
|
+
|
|
59
|
+
// --- Optional handlers (uncomment when plugin dependencies are enabled) ---
|
|
60
|
+
// RegisterValidationCommands(*Router);
|
|
61
|
+
// RegisterMaterialCommands(*Router);
|
|
62
|
+
// RegisterWorldPartitionCommands(*Router);
|
|
63
|
+
// RegisterImportExportCommands(*Router);
|
|
64
|
+
// RegisterAudioCommands(*Router);
|
|
65
|
+
// RegisterGASCommands(*Router);
|
|
66
|
+
// RegisterChaosCommands(*Router);
|
|
67
|
+
// RegisterLiveLinkCommands(*Router);
|
|
68
|
+
// RegisterMotionDesignCommands(*Router);
|
|
69
|
+
// RegisterMovieRenderCommands(*Router);
|
|
70
|
+
// RegisterNetworkingCommands(*Router);
|
|
71
|
+
|
|
72
|
+
// Create and start the TCP server.
|
|
73
|
+
TcpServer = MakeUnique<FMCPTcpServer>(*Router);
|
|
74
|
+
bServerRunning = TcpServer->Start(Port);
|
|
75
|
+
|
|
76
|
+
if (!bServerRunning)
|
|
77
|
+
{
|
|
78
|
+
UE_LOG(LogTemp, Error, TEXT("[MCPBridge] Failed to start TCP server on port %d."), Port);
|
|
79
|
+
}
|
|
80
|
+
else
|
|
81
|
+
{
|
|
82
|
+
UE_LOG(LogTemp, Log, TEXT("[MCPBridge] TCP server started on port %d."), Port);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
void UMCPBridgeSubsystem::Deinitialize()
|
|
87
|
+
{
|
|
88
|
+
if (TcpServer.IsValid())
|
|
89
|
+
{
|
|
90
|
+
TcpServer->Stop();
|
|
91
|
+
TcpServer.Reset();
|
|
92
|
+
}
|
|
93
|
+
if (Router.IsValid())
|
|
94
|
+
{
|
|
95
|
+
Router.Reset();
|
|
96
|
+
}
|
|
97
|
+
bServerRunning = false;
|
|
98
|
+
|
|
99
|
+
Super::Deinitialize();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
int32 UMCPBridgeSubsystem::GetConfiguredPort() const
|
|
103
|
+
{
|
|
104
|
+
int32 Port = 55557;
|
|
105
|
+
if (GConfig)
|
|
106
|
+
{
|
|
107
|
+
GConfig->GetInt(TEXT("MCPBridge"), TEXT("Port"), Port, GEngineIni);
|
|
108
|
+
}
|
|
109
|
+
return Port;
|
|
110
|
+
}
|
package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPCollisionPhysicsCommands.cpp
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
#include "EngineUtils.h"
|
|
22
22
|
#include "Components/PrimitiveComponent.h"
|
|
23
23
|
#include "Engine/EngineTypes.h"
|
|
24
|
-
#include "CollisionProfile.h"
|
|
24
|
+
#include "Engine/CollisionProfile.h"
|
|
25
25
|
#include "PhysicsEngine/BodyInstance.h"
|
|
26
26
|
#include "PhysicalMaterials/PhysicalMaterial.h"
|
|
27
27
|
#include "PhysicsEngine/PhysicsAsset.h"
|
|
@@ -118,7 +118,7 @@ static TArray<TSharedPtr<FJsonValue>> BuildCollisionResponseArray(UPrimitiveComp
|
|
|
118
118
|
if (Profile)
|
|
119
119
|
{
|
|
120
120
|
// GetChannelName returns the display name for a given channel index.
|
|
121
|
-
ChannelName = Profile->
|
|
121
|
+
ChannelName = Profile->ReturnChannelNameFromContainerIndex(static_cast<int32>(Channel)).ToString();
|
|
122
122
|
}
|
|
123
123
|
if (ChannelName.IsEmpty())
|
|
124
124
|
{
|
|
@@ -148,7 +148,7 @@ static TSharedPtr<FJsonObject> BuildCollisionData(UPrimitiveComponent* Comp)
|
|
|
148
148
|
FString ObjectTypeName;
|
|
149
149
|
if (Profile)
|
|
150
150
|
{
|
|
151
|
-
ObjectTypeName = Profile->
|
|
151
|
+
ObjectTypeName = Profile->ReturnChannelNameFromContainerIndex(static_cast<int32>(ObjCh)).ToString();
|
|
152
152
|
}
|
|
153
153
|
if (ObjectTypeName.IsEmpty())
|
|
154
154
|
{
|
|
@@ -23,6 +23,9 @@
|
|
|
23
23
|
// Asset Registry APIs
|
|
24
24
|
#include "AssetRegistry/AssetRegistryModule.h"
|
|
25
25
|
|
|
26
|
+
// Package saving
|
|
27
|
+
#include "UObject/SavePackage.h"
|
|
28
|
+
|
|
26
29
|
// UObject/Package APIs
|
|
27
30
|
#include "UObject/Package.h"
|
|
28
31
|
#include "Misc/PackageName.h"
|
|
@@ -177,11 +180,11 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
|
|
|
177
180
|
|
|
178
181
|
// T-14-01: Validate the asset path is a well-formed long package name.
|
|
179
182
|
// Rejects path traversal ("../") and bare filenames.
|
|
180
|
-
|
|
183
|
+
FText ValidationError;
|
|
181
184
|
if (!FPackageName::IsValidLongPackageName(AssetPath, /*bIncludeReadOnlyRoots=*/false, &ValidationError))
|
|
182
185
|
{
|
|
183
186
|
UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] input.createAction: Invalid asset path '%s': %s"),
|
|
184
|
-
*AssetPath, *ValidationError);
|
|
187
|
+
*AssetPath, *ValidationError.ToString());
|
|
185
188
|
SendError(SendResponse, CorrelationId, TEXT("invalid_asset_path"));
|
|
186
189
|
return;
|
|
187
190
|
}
|
|
@@ -227,8 +230,10 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
|
|
|
227
230
|
// Save the package to disk so the asset persists.
|
|
228
231
|
FString FilePath = FPackageName::LongPackageNameToFilename(
|
|
229
232
|
AssetPath, FPackageName::GetAssetPackageExtension());
|
|
230
|
-
|
|
231
|
-
|
|
233
|
+
FSavePackageArgs SaveArgs;
|
|
234
|
+
SaveArgs.TopLevelFlags = RF_Standalone;
|
|
235
|
+
SaveArgs.SaveFlags = SAVE_NoError;
|
|
236
|
+
UPackage::SavePackage(Pkg, Action, *FilePath, SaveArgs);
|
|
232
237
|
|
|
233
238
|
// Notify the Asset Registry so the asset appears in the Content Browser.
|
|
234
239
|
FAssetRegistryModule::AssetCreated(Action);
|
|
@@ -331,7 +336,7 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
|
|
|
331
336
|
|
|
332
337
|
// T-14-02: Validate that the key name resolves to a known FKey before calling MapKey.
|
|
333
338
|
// FKey constructor accepts any FName; IsValid() checks whether it is a registered key.
|
|
334
|
-
const FKey ResolvedKey(FName(*KeyName));
|
|
339
|
+
const FKey ResolvedKey = FKey(FName(*KeyName));
|
|
335
340
|
if (!ResolvedKey.IsValid())
|
|
336
341
|
{
|
|
337
342
|
UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] input.addBinding: Key '%s' is not a valid FKey"), *KeyName);
|
|
@@ -369,8 +374,10 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
|
|
|
369
374
|
UPackage* Pkg = IMC->GetPackage();
|
|
370
375
|
FString FilePath = FPackageName::LongPackageNameToFilename(
|
|
371
376
|
AssetPath, FPackageName::GetAssetPackageExtension());
|
|
372
|
-
|
|
373
|
-
|
|
377
|
+
FSavePackageArgs SaveArgs2;
|
|
378
|
+
SaveArgs2.TopLevelFlags = RF_Standalone;
|
|
379
|
+
SaveArgs2.SaveFlags = SAVE_NoError;
|
|
380
|
+
UPackage::SavePackage(Pkg, IMC, *FilePath, SaveArgs2);
|
|
374
381
|
|
|
375
382
|
TSharedPtr<FJsonObject> Data = MakeShared<FJsonObject>();
|
|
376
383
|
Data->SetBoolField(TEXT("bound"), true);
|
|
@@ -57,7 +57,7 @@ public:
|
|
|
57
57
|
// Enforce ring buffer cap: drop oldest entry when at limit (T-12-02).
|
|
58
58
|
if (GPieCapturedLogs.Num() >= GPieLogMaxLines)
|
|
59
59
|
{
|
|
60
|
-
GPieCapturedLogs.RemoveAt(0, 1,
|
|
60
|
+
GPieCapturedLogs.RemoveAt(0, 1, EAllowShrinking::No);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
GPieCapturedLogs.Add(MoveTemp(Line));
|
|
@@ -142,8 +142,9 @@ void RegisterPieCommands(FMCPCommandRouter& Router)
|
|
|
142
142
|
GPieLogDevice = MakeUnique<FMCPPieLogCapture>();
|
|
143
143
|
GLog->AddOutputDevice(GPieLogDevice.Get());
|
|
144
144
|
|
|
145
|
-
// Start PIE
|
|
146
|
-
|
|
145
|
+
// Start PIE using RequestPlaySession (UE 5.7 API).
|
|
146
|
+
FRequestPlaySessionParams Params;
|
|
147
|
+
GEditor->RequestPlaySession(Params);
|
|
147
148
|
|
|
148
149
|
TSharedPtr<FJsonObject> Data = MakeShared<FJsonObject>();
|
|
149
150
|
Data->SetBoolField(TEXT("started"), true);
|
|
@@ -585,7 +585,7 @@ void RegisterSelectionCommands(FMCPCommandRouter& Router)
|
|
|
585
585
|
else
|
|
586
586
|
{
|
|
587
587
|
// Native class name -- search loaded classes.
|
|
588
|
-
TargetClass =
|
|
588
|
+
TargetClass = FindFirstObject<UClass>( *TargetClassName);
|
|
589
589
|
if (!TargetClass)
|
|
590
590
|
{
|
|
591
591
|
// Try with the Actor suffix convention common in UE.
|