flockbay 0.10.15
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 +56 -0
- package/bin/flockbay-mcp.mjs +56 -0
- package/bin/flockbay.mjs +78 -0
- package/dist/codex/flockbayMcpStdioBridge.cjs +383 -0
- package/dist/codex/flockbayMcpStdioBridge.d.cts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.d.mts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.mjs +381 -0
- package/dist/flockbayScreenshotGate-DJX3Is5d.mjs +136 -0
- package/dist/flockbayScreenshotGate-DkxU24cR.cjs +138 -0
- package/dist/index--o4BPz5o.cjs +10311 -0
- package/dist/index-CUp3juDS.mjs +10268 -0
- package/dist/index.cjs +43 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +40 -0
- package/dist/lib.cjs +33 -0
- package/dist/lib.d.cts +957 -0
- package/dist/lib.d.mts +957 -0
- package/dist/lib.mjs +23 -0
- package/dist/runCodex-D3eT-TvB.cjs +3449 -0
- package/dist/runCodex-o6PCbHQ7.mjs +3446 -0
- package/dist/runGemini-Bt0oEj_g.mjs +3183 -0
- package/dist/runGemini-CBxZp6I7.cjs +3185 -0
- package/dist/types-C-jnUdn_.cjs +4498 -0
- package/dist/types-DGd6ea2Z.mjs +4450 -0
- package/kits/kit.open_world/kit.json +59 -0
- package/package.json +130 -0
- package/scripts/claude_local_launcher.cjs +73 -0
- package/scripts/claude_remote_launcher.cjs +16 -0
- package/scripts/claude_version_utils.cjs +391 -0
- package/scripts/ripgrep_launcher.cjs +33 -0
- package/scripts/session_hook_forwarder.cjs +49 -0
- package/scripts/test-codex-abort-history.mjs +77 -0
- package/scripts/unpack-tools.cjs +222 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +7 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +184 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Config/FilterPlugin.ini +8 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1160 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +924 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommonUtils.cpp +709 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPEditorCommands.cpp +896 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPProjectCommands.cpp +72 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPUMGCommands.cpp +544 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/MCPServerRunnable.cpp +321 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPBridge.cpp +419 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPModule.cpp +21 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintCommands.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +27 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPEditorCommands.h +40 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/MCPServerRunnable.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPBridge.h +64 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPModule.h +22 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/UnrealMCP.Build.cs +78 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/UnrealMCP.uplugin +36 -0
- package/tools/unreal-mcp/upstream/Python/README.md +40 -0
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -0
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +203 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +497 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +194 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +267 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +618 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +366 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +390 -0
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +420 -0
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -0
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +430 -0
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +64 -0
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +333 -0
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -0
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Blueprint Tools for Unreal MCP.
|
|
3
|
+
|
|
4
|
+
This module provides tools for creating and manipulating Blueprint assets in Unreal Engine.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import Dict, List, Any
|
|
9
|
+
from mcp.server.fastmcp import FastMCP, Context
|
|
10
|
+
|
|
11
|
+
# Get logger
|
|
12
|
+
logger = logging.getLogger("UnrealMCP")
|
|
13
|
+
|
|
14
|
+
def register_blueprint_tools(mcp: FastMCP):
|
|
15
|
+
"""Register Blueprint tools with the MCP server."""
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
def create_blueprint(
|
|
19
|
+
ctx: Context,
|
|
20
|
+
name: str,
|
|
21
|
+
parent_class: str
|
|
22
|
+
) -> Dict[str, Any]:
|
|
23
|
+
"""Create a new Blueprint class."""
|
|
24
|
+
# Import inside function to avoid circular imports
|
|
25
|
+
from unreal_mcp_server import get_unreal_connection
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
unreal = get_unreal_connection()
|
|
29
|
+
if not unreal:
|
|
30
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
31
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
32
|
+
|
|
33
|
+
response = unreal.send_command("create_blueprint", {
|
|
34
|
+
"name": name,
|
|
35
|
+
"parent_class": parent_class
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
if not response:
|
|
39
|
+
logger.error("No response from Unreal Engine")
|
|
40
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
41
|
+
|
|
42
|
+
logger.info(f"Blueprint creation response: {response}")
|
|
43
|
+
return response or {}
|
|
44
|
+
|
|
45
|
+
except Exception as e:
|
|
46
|
+
error_msg = f"Error creating blueprint: {e}"
|
|
47
|
+
logger.error(error_msg)
|
|
48
|
+
return {"success": False, "message": error_msg}
|
|
49
|
+
|
|
50
|
+
@mcp.tool()
|
|
51
|
+
def add_component_to_blueprint(
|
|
52
|
+
ctx: Context,
|
|
53
|
+
blueprint_name: str,
|
|
54
|
+
component_type: str,
|
|
55
|
+
component_name: str,
|
|
56
|
+
location: List[float] = [],
|
|
57
|
+
rotation: List[float] = [],
|
|
58
|
+
scale: List[float] = [],
|
|
59
|
+
component_properties: Dict[str, Any] = {}
|
|
60
|
+
) -> Dict[str, Any]:
|
|
61
|
+
"""
|
|
62
|
+
Add a component to a Blueprint.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
blueprint_name: Name of the target Blueprint
|
|
66
|
+
component_type: Type of component to add (use component class name without U prefix)
|
|
67
|
+
component_name: Name for the new component
|
|
68
|
+
location: [X, Y, Z] coordinates for component's position
|
|
69
|
+
rotation: [Pitch, Yaw, Roll] values for component's rotation
|
|
70
|
+
scale: [X, Y, Z] values for component's scale
|
|
71
|
+
component_properties: Additional properties to set on the component
|
|
72
|
+
|
|
73
|
+
Returns:
|
|
74
|
+
Information about the added component
|
|
75
|
+
"""
|
|
76
|
+
from unreal_mcp_server import get_unreal_connection
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
# Ensure all parameters are properly formatted
|
|
80
|
+
params = {
|
|
81
|
+
"blueprint_name": blueprint_name,
|
|
82
|
+
"component_type": component_type,
|
|
83
|
+
"component_name": component_name,
|
|
84
|
+
"location": location or [0.0, 0.0, 0.0],
|
|
85
|
+
"rotation": rotation or [0.0, 0.0, 0.0],
|
|
86
|
+
"scale": scale or [1.0, 1.0, 1.0]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Add component_properties if provided
|
|
90
|
+
if component_properties and len(component_properties) > 0:
|
|
91
|
+
params["component_properties"] = component_properties
|
|
92
|
+
|
|
93
|
+
# Validate location, rotation, and scale formats
|
|
94
|
+
for param_name in ["location", "rotation", "scale"]:
|
|
95
|
+
param_value = params[param_name]
|
|
96
|
+
if not isinstance(param_value, list) or len(param_value) != 3:
|
|
97
|
+
logger.error(f"Invalid {param_name} format: {param_value}. Must be a list of 3 float values.")
|
|
98
|
+
return {"success": False, "message": f"Invalid {param_name} format. Must be a list of 3 float values."}
|
|
99
|
+
# Ensure all values are float
|
|
100
|
+
params[param_name] = [float(val) for val in param_value]
|
|
101
|
+
|
|
102
|
+
unreal = get_unreal_connection()
|
|
103
|
+
if not unreal:
|
|
104
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
105
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
106
|
+
|
|
107
|
+
logger.info(f"Adding component to blueprint with params: {params}")
|
|
108
|
+
response = unreal.send_command("add_component_to_blueprint", params)
|
|
109
|
+
|
|
110
|
+
if not response:
|
|
111
|
+
logger.error("No response from Unreal Engine")
|
|
112
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
113
|
+
|
|
114
|
+
logger.info(f"Component addition response: {response}")
|
|
115
|
+
return response
|
|
116
|
+
|
|
117
|
+
except Exception as e:
|
|
118
|
+
error_msg = f"Error adding component to blueprint: {e}"
|
|
119
|
+
logger.error(error_msg)
|
|
120
|
+
return {"success": False, "message": error_msg}
|
|
121
|
+
|
|
122
|
+
@mcp.tool()
|
|
123
|
+
def set_static_mesh_properties(
|
|
124
|
+
ctx: Context,
|
|
125
|
+
blueprint_name: str,
|
|
126
|
+
component_name: str,
|
|
127
|
+
static_mesh: str = "/Engine/BasicShapes/Cube.Cube"
|
|
128
|
+
) -> Dict[str, Any]:
|
|
129
|
+
"""
|
|
130
|
+
Set static mesh properties on a StaticMeshComponent.
|
|
131
|
+
|
|
132
|
+
Args:
|
|
133
|
+
blueprint_name: Name of the target Blueprint
|
|
134
|
+
component_name: Name of the StaticMeshComponent
|
|
135
|
+
static_mesh: Path to the static mesh asset (e.g., "/Engine/BasicShapes/Cube.Cube")
|
|
136
|
+
|
|
137
|
+
Returns:
|
|
138
|
+
Response indicating success or failure
|
|
139
|
+
"""
|
|
140
|
+
from unreal_mcp_server import get_unreal_connection
|
|
141
|
+
|
|
142
|
+
try:
|
|
143
|
+
unreal = get_unreal_connection()
|
|
144
|
+
if not unreal:
|
|
145
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
146
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
147
|
+
|
|
148
|
+
params = {
|
|
149
|
+
"blueprint_name": blueprint_name,
|
|
150
|
+
"component_name": component_name,
|
|
151
|
+
"static_mesh": static_mesh
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
logger.info(f"Setting static mesh properties with params: {params}")
|
|
155
|
+
response = unreal.send_command("set_static_mesh_properties", params)
|
|
156
|
+
|
|
157
|
+
if not response:
|
|
158
|
+
logger.error("No response from Unreal Engine")
|
|
159
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
160
|
+
|
|
161
|
+
logger.info(f"Set static mesh properties response: {response}")
|
|
162
|
+
return response
|
|
163
|
+
|
|
164
|
+
except Exception as e:
|
|
165
|
+
error_msg = f"Error setting static mesh properties: {e}"
|
|
166
|
+
logger.error(error_msg)
|
|
167
|
+
return {"success": False, "message": error_msg}
|
|
168
|
+
|
|
169
|
+
@mcp.tool()
|
|
170
|
+
def set_component_property(
|
|
171
|
+
ctx: Context,
|
|
172
|
+
blueprint_name: str,
|
|
173
|
+
component_name: str,
|
|
174
|
+
property_name: str,
|
|
175
|
+
property_value,
|
|
176
|
+
) -> Dict[str, Any]:
|
|
177
|
+
"""Set a property on a component in a Blueprint."""
|
|
178
|
+
from unreal_mcp_server import get_unreal_connection
|
|
179
|
+
|
|
180
|
+
try:
|
|
181
|
+
unreal = get_unreal_connection()
|
|
182
|
+
if not unreal:
|
|
183
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
184
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
185
|
+
|
|
186
|
+
params = {
|
|
187
|
+
"blueprint_name": blueprint_name,
|
|
188
|
+
"component_name": component_name,
|
|
189
|
+
"property_name": property_name,
|
|
190
|
+
"property_value": property_value
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
logger.info(f"Setting component property with params: {params}")
|
|
194
|
+
response = unreal.send_command("set_component_property", params)
|
|
195
|
+
|
|
196
|
+
if not response:
|
|
197
|
+
logger.error("No response from Unreal Engine")
|
|
198
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
199
|
+
|
|
200
|
+
logger.info(f"Set component property response: {response}")
|
|
201
|
+
return response
|
|
202
|
+
|
|
203
|
+
except Exception as e:
|
|
204
|
+
error_msg = f"Error setting component property: {e}"
|
|
205
|
+
logger.error(error_msg)
|
|
206
|
+
return {"success": False, "message": error_msg}
|
|
207
|
+
|
|
208
|
+
@mcp.tool()
|
|
209
|
+
def set_physics_properties(
|
|
210
|
+
ctx: Context,
|
|
211
|
+
blueprint_name: str,
|
|
212
|
+
component_name: str,
|
|
213
|
+
simulate_physics: bool = True,
|
|
214
|
+
gravity_enabled: bool = True,
|
|
215
|
+
mass: float = 1.0,
|
|
216
|
+
linear_damping: float = 0.01,
|
|
217
|
+
angular_damping: float = 0.0
|
|
218
|
+
) -> Dict[str, Any]:
|
|
219
|
+
"""Set physics properties on a component."""
|
|
220
|
+
from unreal_mcp_server import get_unreal_connection
|
|
221
|
+
|
|
222
|
+
try:
|
|
223
|
+
unreal = get_unreal_connection()
|
|
224
|
+
if not unreal:
|
|
225
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
226
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
227
|
+
|
|
228
|
+
params = {
|
|
229
|
+
"blueprint_name": blueprint_name,
|
|
230
|
+
"component_name": component_name,
|
|
231
|
+
"simulate_physics": simulate_physics,
|
|
232
|
+
"gravity_enabled": gravity_enabled,
|
|
233
|
+
"mass": float(mass),
|
|
234
|
+
"linear_damping": float(linear_damping),
|
|
235
|
+
"angular_damping": float(angular_damping)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
logger.info(f"Setting physics properties with params: {params}")
|
|
239
|
+
response = unreal.send_command("set_physics_properties", params)
|
|
240
|
+
|
|
241
|
+
if not response:
|
|
242
|
+
logger.error("No response from Unreal Engine")
|
|
243
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
244
|
+
|
|
245
|
+
logger.info(f"Set physics properties response: {response}")
|
|
246
|
+
return response
|
|
247
|
+
|
|
248
|
+
except Exception as e:
|
|
249
|
+
error_msg = f"Error setting physics properties: {e}"
|
|
250
|
+
logger.error(error_msg)
|
|
251
|
+
return {"success": False, "message": error_msg}
|
|
252
|
+
|
|
253
|
+
@mcp.tool()
|
|
254
|
+
def compile_blueprint(
|
|
255
|
+
ctx: Context,
|
|
256
|
+
blueprint_name: str
|
|
257
|
+
) -> Dict[str, Any]:
|
|
258
|
+
"""Compile a Blueprint."""
|
|
259
|
+
from unreal_mcp_server import get_unreal_connection
|
|
260
|
+
|
|
261
|
+
try:
|
|
262
|
+
unreal = get_unreal_connection()
|
|
263
|
+
if not unreal:
|
|
264
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
265
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
266
|
+
|
|
267
|
+
params = {
|
|
268
|
+
"blueprint_name": blueprint_name
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
logger.info(f"Compiling blueprint: {blueprint_name}")
|
|
272
|
+
response = unreal.send_command("compile_blueprint", params)
|
|
273
|
+
|
|
274
|
+
if not response:
|
|
275
|
+
logger.error("No response from Unreal Engine")
|
|
276
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
277
|
+
|
|
278
|
+
logger.info(f"Compile blueprint response: {response}")
|
|
279
|
+
return response
|
|
280
|
+
|
|
281
|
+
except Exception as e:
|
|
282
|
+
error_msg = f"Error compiling blueprint: {e}"
|
|
283
|
+
logger.error(error_msg)
|
|
284
|
+
return {"success": False, "message": error_msg}
|
|
285
|
+
|
|
286
|
+
@mcp.tool()
|
|
287
|
+
def set_blueprint_property(
|
|
288
|
+
ctx: Context,
|
|
289
|
+
blueprint_name: str,
|
|
290
|
+
property_name: str,
|
|
291
|
+
property_value
|
|
292
|
+
) -> Dict[str, Any]:
|
|
293
|
+
"""
|
|
294
|
+
Set a property on a Blueprint class default object.
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
blueprint_name: Name of the target Blueprint
|
|
298
|
+
property_name: Name of the property to set
|
|
299
|
+
property_value: Value to set the property to
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
Response indicating success or failure
|
|
303
|
+
"""
|
|
304
|
+
from unreal_mcp_server import get_unreal_connection
|
|
305
|
+
|
|
306
|
+
try:
|
|
307
|
+
unreal = get_unreal_connection()
|
|
308
|
+
if not unreal:
|
|
309
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
310
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
311
|
+
|
|
312
|
+
params = {
|
|
313
|
+
"blueprint_name": blueprint_name,
|
|
314
|
+
"property_name": property_name,
|
|
315
|
+
"property_value": property_value
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
logger.info(f"Setting blueprint property with params: {params}")
|
|
319
|
+
response = unreal.send_command("set_blueprint_property", params)
|
|
320
|
+
|
|
321
|
+
if not response:
|
|
322
|
+
logger.error("No response from Unreal Engine")
|
|
323
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
324
|
+
|
|
325
|
+
logger.info(f"Set blueprint property response: {response}")
|
|
326
|
+
return response
|
|
327
|
+
|
|
328
|
+
except Exception as e:
|
|
329
|
+
error_msg = f"Error setting blueprint property: {e}"
|
|
330
|
+
logger.error(error_msg)
|
|
331
|
+
return {"success": False, "message": error_msg}
|
|
332
|
+
|
|
333
|
+
# @mcp.tool() commented out, just use set_component_property instead
|
|
334
|
+
def set_pawn_properties(
|
|
335
|
+
ctx: Context,
|
|
336
|
+
blueprint_name: str,
|
|
337
|
+
auto_possess_player: str = "",
|
|
338
|
+
use_controller_rotation_yaw: bool = None,
|
|
339
|
+
use_controller_rotation_pitch: bool = None,
|
|
340
|
+
use_controller_rotation_roll: bool = None,
|
|
341
|
+
can_be_damaged: bool = None
|
|
342
|
+
) -> Dict[str, Any]:
|
|
343
|
+
"""
|
|
344
|
+
Set common Pawn properties on a Blueprint.
|
|
345
|
+
This is a utility function that sets multiple pawn-related properties at once.
|
|
346
|
+
|
|
347
|
+
Args:
|
|
348
|
+
blueprint_name: Name of the target Blueprint (must be a Pawn or Character)
|
|
349
|
+
auto_possess_player: Auto possess player setting (None, "Disabled", "Player0", "Player1", etc.)
|
|
350
|
+
use_controller_rotation_yaw: Whether the pawn should use the controller's yaw rotation
|
|
351
|
+
use_controller_rotation_pitch: Whether the pawn should use the controller's pitch rotation
|
|
352
|
+
use_controller_rotation_roll: Whether the pawn should use the controller's roll rotation
|
|
353
|
+
can_be_damaged: Whether the pawn can be damaged
|
|
354
|
+
|
|
355
|
+
Returns:
|
|
356
|
+
Response indicating success or failure with detailed results for each property
|
|
357
|
+
"""
|
|
358
|
+
from unreal_mcp_server import get_unreal_connection
|
|
359
|
+
|
|
360
|
+
try:
|
|
361
|
+
unreal = get_unreal_connection()
|
|
362
|
+
if not unreal:
|
|
363
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
364
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
365
|
+
|
|
366
|
+
# Define the properties to set
|
|
367
|
+
properties = {}
|
|
368
|
+
if auto_possess_player and auto_possess_player != "":
|
|
369
|
+
properties["auto_possess_player"] = auto_possess_player
|
|
370
|
+
|
|
371
|
+
# Only include boolean properties if they were explicitly set
|
|
372
|
+
if use_controller_rotation_yaw is not None:
|
|
373
|
+
properties["bUseControllerRotationYaw"] = use_controller_rotation_yaw
|
|
374
|
+
if use_controller_rotation_pitch is not None:
|
|
375
|
+
properties["bUseControllerRotationPitch"] = use_controller_rotation_pitch
|
|
376
|
+
if use_controller_rotation_roll is not None:
|
|
377
|
+
properties["bUseControllerRotationRoll"] = use_controller_rotation_roll
|
|
378
|
+
if can_be_damaged is not None:
|
|
379
|
+
properties["bCanBeDamaged"] = can_be_damaged
|
|
380
|
+
|
|
381
|
+
if not properties:
|
|
382
|
+
logger.warning("No properties specified to set")
|
|
383
|
+
return {"success": True, "message": "No properties specified to set", "results": {}}
|
|
384
|
+
|
|
385
|
+
# Set each property using the generic set_blueprint_property function
|
|
386
|
+
results = {}
|
|
387
|
+
overall_success = True
|
|
388
|
+
|
|
389
|
+
for prop_name, prop_value in properties.items():
|
|
390
|
+
params = {
|
|
391
|
+
"blueprint_name": blueprint_name,
|
|
392
|
+
"property_name": prop_name,
|
|
393
|
+
"property_value": prop_value
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
logger.info(f"Setting pawn property {prop_name} to {prop_value}")
|
|
397
|
+
response = unreal.send_command("set_blueprint_property", params)
|
|
398
|
+
|
|
399
|
+
if not response:
|
|
400
|
+
logger.error(f"No response from Unreal Engine for property {prop_name}")
|
|
401
|
+
results[prop_name] = {"success": False, "message": "No response from Unreal Engine"}
|
|
402
|
+
overall_success = False
|
|
403
|
+
continue
|
|
404
|
+
|
|
405
|
+
results[prop_name] = response
|
|
406
|
+
if not response.get("success", False):
|
|
407
|
+
overall_success = False
|
|
408
|
+
|
|
409
|
+
return {
|
|
410
|
+
"success": overall_success,
|
|
411
|
+
"message": "Pawn properties set" if overall_success else "Some pawn properties failed to set",
|
|
412
|
+
"results": results
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
except Exception as e:
|
|
416
|
+
error_msg = f"Error setting pawn properties: {e}"
|
|
417
|
+
logger.error(error_msg)
|
|
418
|
+
return {"success": False, "message": error_msg}
|
|
419
|
+
|
|
420
|
+
logger.info("Blueprint tools registered successfully")
|