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,369 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Editor Tools for Unreal MCP.
|
|
3
|
+
|
|
4
|
+
This module provides tools for controlling the Unreal Editor viewport and other editor functionality.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import Dict, List, Any, Optional
|
|
9
|
+
from mcp.server.fastmcp import FastMCP, Context
|
|
10
|
+
|
|
11
|
+
# Get logger
|
|
12
|
+
logger = logging.getLogger("UnrealMCP")
|
|
13
|
+
|
|
14
|
+
def register_editor_tools(mcp: FastMCP):
|
|
15
|
+
"""Register editor tools with the MCP server."""
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
def get_actors_in_level(ctx: Context) -> List[Dict[str, Any]]:
|
|
19
|
+
"""Get a list of all actors in the current level."""
|
|
20
|
+
from unreal_mcp_server import get_unreal_connection
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
unreal = get_unreal_connection()
|
|
24
|
+
if not unreal:
|
|
25
|
+
logger.warning("Failed to connect to Unreal Engine")
|
|
26
|
+
return []
|
|
27
|
+
|
|
28
|
+
response = unreal.send_command("get_actors_in_level", {})
|
|
29
|
+
|
|
30
|
+
if not response:
|
|
31
|
+
logger.warning("No response from Unreal Engine")
|
|
32
|
+
return []
|
|
33
|
+
|
|
34
|
+
# Log the complete response for debugging
|
|
35
|
+
logger.info(f"Complete response from Unreal: {response}")
|
|
36
|
+
|
|
37
|
+
# Check response format
|
|
38
|
+
if "result" in response and "actors" in response["result"]:
|
|
39
|
+
actors = response["result"]["actors"]
|
|
40
|
+
logger.info(f"Found {len(actors)} actors in level")
|
|
41
|
+
return actors
|
|
42
|
+
elif "actors" in response:
|
|
43
|
+
actors = response["actors"]
|
|
44
|
+
logger.info(f"Found {len(actors)} actors in level")
|
|
45
|
+
return actors
|
|
46
|
+
|
|
47
|
+
logger.warning(f"Unexpected response format: {response}")
|
|
48
|
+
return []
|
|
49
|
+
|
|
50
|
+
except Exception as e:
|
|
51
|
+
logger.error(f"Error getting actors: {e}")
|
|
52
|
+
return []
|
|
53
|
+
|
|
54
|
+
@mcp.tool()
|
|
55
|
+
def find_actors_by_name(ctx: Context, pattern: str) -> List[str]:
|
|
56
|
+
"""Find actors by name pattern."""
|
|
57
|
+
from unreal_mcp_server import get_unreal_connection
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
unreal = get_unreal_connection()
|
|
61
|
+
if not unreal:
|
|
62
|
+
logger.warning("Failed to connect to Unreal Engine")
|
|
63
|
+
return []
|
|
64
|
+
|
|
65
|
+
response = unreal.send_command("find_actors_by_name", {
|
|
66
|
+
"pattern": pattern
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
if not response:
|
|
70
|
+
return []
|
|
71
|
+
|
|
72
|
+
return response.get("actors", [])
|
|
73
|
+
|
|
74
|
+
except Exception as e:
|
|
75
|
+
logger.error(f"Error finding actors: {e}")
|
|
76
|
+
return []
|
|
77
|
+
|
|
78
|
+
@mcp.tool()
|
|
79
|
+
def spawn_actor(
|
|
80
|
+
ctx: Context,
|
|
81
|
+
name: str,
|
|
82
|
+
type: str,
|
|
83
|
+
location: List[float] = [0.0, 0.0, 0.0],
|
|
84
|
+
rotation: List[float] = [0.0, 0.0, 0.0]
|
|
85
|
+
) -> Dict[str, Any]:
|
|
86
|
+
"""Create a new actor in the current level.
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
ctx: The MCP context
|
|
90
|
+
name: The name to give the new actor (must be unique)
|
|
91
|
+
type: The type of actor to create (e.g. StaticMeshActor, PointLight)
|
|
92
|
+
location: The [x, y, z] world location to spawn at
|
|
93
|
+
rotation: The [pitch, yaw, roll] rotation in degrees
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
Dict containing the created actor's properties
|
|
97
|
+
"""
|
|
98
|
+
from unreal_mcp_server import get_unreal_connection
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
unreal = get_unreal_connection()
|
|
102
|
+
if not unreal:
|
|
103
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
104
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
105
|
+
|
|
106
|
+
# Ensure all parameters are properly formatted
|
|
107
|
+
params = {
|
|
108
|
+
"name": name,
|
|
109
|
+
"type": type.upper(), # Make sure type is uppercase
|
|
110
|
+
"location": location,
|
|
111
|
+
"rotation": rotation
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Validate location and rotation formats
|
|
115
|
+
for param_name in ["location", "rotation"]:
|
|
116
|
+
param_value = params[param_name]
|
|
117
|
+
if not isinstance(param_value, list) or len(param_value) != 3:
|
|
118
|
+
logger.error(f"Invalid {param_name} format: {param_value}. Must be a list of 3 float values.")
|
|
119
|
+
return {"success": False, "message": f"Invalid {param_name} format. Must be a list of 3 float values."}
|
|
120
|
+
# Ensure all values are float
|
|
121
|
+
params[param_name] = [float(val) for val in param_value]
|
|
122
|
+
|
|
123
|
+
logger.info(f"Creating actor '{name}' of type '{type}' with params: {params}")
|
|
124
|
+
response = unreal.send_command("spawn_actor", params)
|
|
125
|
+
|
|
126
|
+
if not response:
|
|
127
|
+
logger.error("No response from Unreal Engine")
|
|
128
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
129
|
+
|
|
130
|
+
# Log the complete response for debugging
|
|
131
|
+
logger.info(f"Actor creation response: {response}")
|
|
132
|
+
|
|
133
|
+
# Handle error responses correctly
|
|
134
|
+
if response.get("status") == "error":
|
|
135
|
+
error_message = response.get("error", "Unknown error")
|
|
136
|
+
logger.error(f"Error creating actor: {error_message}")
|
|
137
|
+
return {"success": False, "message": error_message}
|
|
138
|
+
|
|
139
|
+
return response
|
|
140
|
+
|
|
141
|
+
except Exception as e:
|
|
142
|
+
error_msg = f"Error creating actor: {e}"
|
|
143
|
+
logger.error(error_msg)
|
|
144
|
+
return {"success": False, "message": error_msg}
|
|
145
|
+
|
|
146
|
+
@mcp.tool()
|
|
147
|
+
def delete_actor(ctx: Context, name: str) -> Dict[str, Any]:
|
|
148
|
+
"""Delete an actor by name."""
|
|
149
|
+
from unreal_mcp_server import get_unreal_connection
|
|
150
|
+
|
|
151
|
+
try:
|
|
152
|
+
unreal = get_unreal_connection()
|
|
153
|
+
if not unreal:
|
|
154
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
155
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
156
|
+
|
|
157
|
+
response = unreal.send_command("delete_actor", {
|
|
158
|
+
"name": name
|
|
159
|
+
})
|
|
160
|
+
return response or {}
|
|
161
|
+
|
|
162
|
+
except Exception as e:
|
|
163
|
+
logger.error(f"Error deleting actor: {e}")
|
|
164
|
+
return {}
|
|
165
|
+
|
|
166
|
+
@mcp.tool()
|
|
167
|
+
def set_actor_transform(
|
|
168
|
+
ctx: Context,
|
|
169
|
+
name: str,
|
|
170
|
+
location: List[float] = None,
|
|
171
|
+
rotation: List[float] = None,
|
|
172
|
+
scale: List[float] = None
|
|
173
|
+
) -> Dict[str, Any]:
|
|
174
|
+
"""Set the transform of an actor."""
|
|
175
|
+
from unreal_mcp_server import get_unreal_connection
|
|
176
|
+
|
|
177
|
+
try:
|
|
178
|
+
unreal = get_unreal_connection()
|
|
179
|
+
if not unreal:
|
|
180
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
181
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
182
|
+
|
|
183
|
+
params = {"name": name}
|
|
184
|
+
if location is not None:
|
|
185
|
+
params["location"] = location
|
|
186
|
+
if rotation is not None:
|
|
187
|
+
params["rotation"] = rotation
|
|
188
|
+
if scale is not None:
|
|
189
|
+
params["scale"] = scale
|
|
190
|
+
|
|
191
|
+
response = unreal.send_command("set_actor_transform", params)
|
|
192
|
+
return response or {}
|
|
193
|
+
|
|
194
|
+
except Exception as e:
|
|
195
|
+
logger.error(f"Error setting transform: {e}")
|
|
196
|
+
return {}
|
|
197
|
+
|
|
198
|
+
@mcp.tool()
|
|
199
|
+
def get_actor_properties(ctx: Context, name: str) -> Dict[str, Any]:
|
|
200
|
+
"""Get all properties of an actor."""
|
|
201
|
+
from unreal_mcp_server import get_unreal_connection
|
|
202
|
+
|
|
203
|
+
try:
|
|
204
|
+
unreal = get_unreal_connection()
|
|
205
|
+
if not unreal:
|
|
206
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
207
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
208
|
+
|
|
209
|
+
response = unreal.send_command("get_actor_properties", {
|
|
210
|
+
"name": name
|
|
211
|
+
})
|
|
212
|
+
return response or {}
|
|
213
|
+
|
|
214
|
+
except Exception as e:
|
|
215
|
+
logger.error(f"Error getting properties: {e}")
|
|
216
|
+
return {}
|
|
217
|
+
|
|
218
|
+
@mcp.tool()
|
|
219
|
+
def set_actor_property(
|
|
220
|
+
ctx: Context,
|
|
221
|
+
name: str,
|
|
222
|
+
property_name: str,
|
|
223
|
+
property_value,
|
|
224
|
+
) -> Dict[str, Any]:
|
|
225
|
+
"""
|
|
226
|
+
Set a property on an actor.
|
|
227
|
+
|
|
228
|
+
Args:
|
|
229
|
+
name: Name of the actor
|
|
230
|
+
property_name: Name of the property to set
|
|
231
|
+
property_value: Value to set the property to
|
|
232
|
+
|
|
233
|
+
Returns:
|
|
234
|
+
Dict containing response from Unreal with operation status
|
|
235
|
+
"""
|
|
236
|
+
from unreal_mcp_server import get_unreal_connection
|
|
237
|
+
|
|
238
|
+
try:
|
|
239
|
+
unreal = get_unreal_connection()
|
|
240
|
+
if not unreal:
|
|
241
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
242
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
243
|
+
|
|
244
|
+
response = unreal.send_command("set_actor_property", {
|
|
245
|
+
"name": name,
|
|
246
|
+
"property_name": property_name,
|
|
247
|
+
"property_value": property_value
|
|
248
|
+
})
|
|
249
|
+
|
|
250
|
+
if not response:
|
|
251
|
+
logger.error("No response from Unreal Engine")
|
|
252
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
253
|
+
|
|
254
|
+
logger.info(f"Set actor property response: {response}")
|
|
255
|
+
return response
|
|
256
|
+
|
|
257
|
+
except Exception as e:
|
|
258
|
+
error_msg = f"Error setting actor property: {e}"
|
|
259
|
+
logger.error(error_msg)
|
|
260
|
+
return {"success": False, "message": error_msg}
|
|
261
|
+
|
|
262
|
+
# @mcp.tool() commented out because it's buggy
|
|
263
|
+
def focus_viewport(
|
|
264
|
+
ctx: Context,
|
|
265
|
+
target: str = None,
|
|
266
|
+
location: List[float] = None,
|
|
267
|
+
distance: float = 1000.0,
|
|
268
|
+
orientation: List[float] = None
|
|
269
|
+
) -> Dict[str, Any]:
|
|
270
|
+
"""
|
|
271
|
+
Focus the viewport on a specific actor or location.
|
|
272
|
+
|
|
273
|
+
Args:
|
|
274
|
+
target: Name of the actor to focus on (if provided, location is ignored)
|
|
275
|
+
location: [X, Y, Z] coordinates to focus on (used if target is None)
|
|
276
|
+
distance: Distance from the target/location
|
|
277
|
+
orientation: Optional [Pitch, Yaw, Roll] for the viewport camera
|
|
278
|
+
|
|
279
|
+
Returns:
|
|
280
|
+
Response from Unreal Engine
|
|
281
|
+
"""
|
|
282
|
+
from unreal_mcp_server import get_unreal_connection
|
|
283
|
+
|
|
284
|
+
try:
|
|
285
|
+
unreal = get_unreal_connection()
|
|
286
|
+
if not unreal:
|
|
287
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
288
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
289
|
+
|
|
290
|
+
params = {}
|
|
291
|
+
if target:
|
|
292
|
+
params["target"] = target
|
|
293
|
+
elif location:
|
|
294
|
+
params["location"] = location
|
|
295
|
+
|
|
296
|
+
if distance:
|
|
297
|
+
params["distance"] = distance
|
|
298
|
+
|
|
299
|
+
if orientation:
|
|
300
|
+
params["orientation"] = orientation
|
|
301
|
+
|
|
302
|
+
response = unreal.send_command("focus_viewport", params)
|
|
303
|
+
return response or {}
|
|
304
|
+
|
|
305
|
+
except Exception as e:
|
|
306
|
+
logger.error(f"Error focusing viewport: {e}")
|
|
307
|
+
return {"status": "error", "message": str(e)}
|
|
308
|
+
|
|
309
|
+
@mcp.tool()
|
|
310
|
+
def spawn_blueprint_actor(
|
|
311
|
+
ctx: Context,
|
|
312
|
+
blueprint_name: str,
|
|
313
|
+
actor_name: str,
|
|
314
|
+
location: List[float] = [0.0, 0.0, 0.0],
|
|
315
|
+
rotation: List[float] = [0.0, 0.0, 0.0]
|
|
316
|
+
) -> Dict[str, Any]:
|
|
317
|
+
"""Spawn an actor from a Blueprint.
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
ctx: The MCP context
|
|
321
|
+
blueprint_name: Name of the Blueprint to spawn from
|
|
322
|
+
actor_name: Name to give the spawned actor
|
|
323
|
+
location: The [x, y, z] world location to spawn at
|
|
324
|
+
rotation: The [pitch, yaw, roll] rotation in degrees
|
|
325
|
+
|
|
326
|
+
Returns:
|
|
327
|
+
Dict containing the spawned actor's properties
|
|
328
|
+
"""
|
|
329
|
+
from unreal_mcp_server import get_unreal_connection
|
|
330
|
+
|
|
331
|
+
try:
|
|
332
|
+
unreal = get_unreal_connection()
|
|
333
|
+
if not unreal:
|
|
334
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
335
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
336
|
+
|
|
337
|
+
# Ensure all parameters are properly formatted
|
|
338
|
+
params = {
|
|
339
|
+
"blueprint_name": blueprint_name,
|
|
340
|
+
"actor_name": actor_name,
|
|
341
|
+
"location": location or [0.0, 0.0, 0.0],
|
|
342
|
+
"rotation": rotation or [0.0, 0.0, 0.0]
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
# Validate location and rotation formats
|
|
346
|
+
for param_name in ["location", "rotation"]:
|
|
347
|
+
param_value = params[param_name]
|
|
348
|
+
if not isinstance(param_value, list) or len(param_value) != 3:
|
|
349
|
+
logger.error(f"Invalid {param_name} format: {param_value}. Must be a list of 3 float values.")
|
|
350
|
+
return {"success": False, "message": f"Invalid {param_name} format. Must be a list of 3 float values."}
|
|
351
|
+
# Ensure all values are float
|
|
352
|
+
params[param_name] = [float(val) for val in param_value]
|
|
353
|
+
|
|
354
|
+
logger.info(f"Spawning blueprint actor with params: {params}")
|
|
355
|
+
response = unreal.send_command("spawn_blueprint_actor", params)
|
|
356
|
+
|
|
357
|
+
if not response:
|
|
358
|
+
logger.error("No response from Unreal Engine")
|
|
359
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
360
|
+
|
|
361
|
+
logger.info(f"Spawn blueprint actor response: {response}")
|
|
362
|
+
return response
|
|
363
|
+
|
|
364
|
+
except Exception as e:
|
|
365
|
+
error_msg = f"Error spawning blueprint actor: {e}"
|
|
366
|
+
logger.error(error_msg)
|
|
367
|
+
return {"success": False, "message": error_msg}
|
|
368
|
+
|
|
369
|
+
logger.info("Editor tools registered successfully")
|