flockbay 0.10.49 → 0.10.52
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 +60 -60
- package/bin/flockbay-mcp.mjs +62 -62
- package/bin/flockbay.mjs +95 -95
- package/dist/{index-r3VTdgFI.cjs → index-IntvnrmZ.cjs} +71 -14
- package/dist/{index-D8AeVbvv.mjs → index-wkeSi0iC.mjs} +70 -13
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{migratePlugin-CEvGPul8.mjs → migratePlugin-C71hAoc5.mjs} +12 -2
- package/dist/{migratePlugin-wFK-k3Wk.cjs → migratePlugin-D1XjjWFq.cjs} +12 -2
- package/dist/{runCodex-DuyuYqoB.cjs → runCodex-B7i_ICoQ.cjs} +34 -23
- package/dist/{runCodex-ZfUyhHF6.mjs → runCodex-BSx-hCu6.mjs} +34 -23
- package/dist/{runGemini-DBU1mMdp.mjs → runGemini-Dwyh7_WI.mjs} +2 -2
- package/dist/{runGemini-D7j5Y5TF.cjs → runGemini-gBKR3rdL.cjs} +2 -2
- package/dist/{types-DNr0xwSy.cjs → types-5z8UADAi.cjs} +224 -15
- package/dist/{types-BRJuZQj_.mjs → types-Bgzap7qR.mjs} +224 -16
- package/package.json +131 -131
- package/scripts/claude_local_launcher.cjs +72 -72
- package/scripts/claude_remote_launcher.cjs +15 -15
- package/scripts/claude_version_utils.cjs +445 -445
- package/scripts/ripgrep_launcher.cjs +32 -32
- package/scripts/run-with-root-env.mjs +37 -32
- package/scripts/session_hook_forwarder.cjs +49 -49
- package/scripts/test-codex-abort-history.mjs +77 -77
- package/scripts/unpack-tools.cjs +244 -244
- package/tools/licenses/difftastic-LICENSE +21 -21
- package/tools/licenses/ripgrep-LICENSE +3 -3
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -8
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -8
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +6 -6
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +183 -183
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -268
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -104
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -274
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Config/FilterPlugin.ini +8 -8
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/FlockbayMCP.uplugin +36 -36
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/FlockbayMCP.Build.cs +82 -82
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1364 -1364
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +1310 -1310
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPCommandSchema.cpp +756 -756
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPCommonUtils.cpp +1177 -1177
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPEditorCommands.cpp +2618 -2618
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPProjectCommands.cpp +71 -71
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPUMGCommands.cpp +543 -543
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/MCPServerRunnable.cpp +372 -372
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/UnrealMCPBridge.cpp +457 -457
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/UnrealMCPModule.cpp +21 -21
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPBlueprintCommands.h +35 -35
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +30 -30
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPCommandSchema.h +41 -41
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -59
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPEditorCommands.h +61 -61
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -20
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -82
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/MCPServerRunnable.h +33 -33
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/UnrealMCPBridge.h +64 -64
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/UnrealMCPModule.h +22 -22
- package/tools/unreal-mcp/upstream/Python/README.md +39 -39
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -22
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +202 -202
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +496 -496
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +193 -193
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +266 -266
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +617 -617
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +365 -365
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +389 -389
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +419 -419
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -369
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +429 -429
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +63 -63
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +332 -332
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -398
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -521
|
@@ -1,203 +1,203 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
"""
|
|
3
|
-
Test script for creating and manipulating actors in Unreal Engine via MCP.
|
|
4
|
-
|
|
5
|
-
This script demonstrates the basic actor manipulation capabilities of the MCP system:
|
|
6
|
-
- Creating actors with specific names and transforms
|
|
7
|
-
- Getting actor properties
|
|
8
|
-
- Modifying actor transforms
|
|
9
|
-
- Error handling and validation
|
|
10
|
-
"""
|
|
11
|
-
|
|
12
|
-
import sys
|
|
13
|
-
import os
|
|
14
|
-
import time
|
|
15
|
-
import socket
|
|
16
|
-
import json
|
|
17
|
-
import logging
|
|
18
|
-
from typing import Dict, Any, Optional
|
|
19
|
-
|
|
20
|
-
# Add the parent directory to the path so we can import the server module
|
|
21
|
-
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
22
|
-
|
|
23
|
-
# Set up logging
|
|
24
|
-
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
25
|
-
logger = logging.getLogger("TestCube")
|
|
26
|
-
|
|
27
|
-
def send_command(command: str, params: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
28
|
-
"""Send a command to the Unreal MCP server and get the response.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
command: The command type to send
|
|
32
|
-
params: Dictionary of parameters for the command
|
|
33
|
-
|
|
34
|
-
Returns:
|
|
35
|
-
Optional[Dict[str, Any]]: The response from the server, or None if there was an error
|
|
36
|
-
"""
|
|
37
|
-
try:
|
|
38
|
-
# Create new socket connection
|
|
39
|
-
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
40
|
-
sock.connect(("127.0.0.1", 55557))
|
|
41
|
-
|
|
42
|
-
try:
|
|
43
|
-
# Create command object
|
|
44
|
-
command_obj = {
|
|
45
|
-
"type": command,
|
|
46
|
-
"params": params
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
# Convert to JSON and send
|
|
50
|
-
command_json = json.dumps(command_obj)
|
|
51
|
-
logger.info(f"Sending command: {command_json}")
|
|
52
|
-
sock.sendall(command_json.encode('utf-8'))
|
|
53
|
-
|
|
54
|
-
# Receive response
|
|
55
|
-
chunks = []
|
|
56
|
-
while True:
|
|
57
|
-
chunk = sock.recv(4096)
|
|
58
|
-
if not chunk:
|
|
59
|
-
break
|
|
60
|
-
chunks.append(chunk)
|
|
61
|
-
|
|
62
|
-
# Try parsing to see if we have a complete response
|
|
63
|
-
try:
|
|
64
|
-
data = b''.join(chunks)
|
|
65
|
-
json.loads(data.decode('utf-8'))
|
|
66
|
-
# If we can parse it, we have the complete response
|
|
67
|
-
break
|
|
68
|
-
except json.JSONDecodeError:
|
|
69
|
-
# Not a complete JSON object yet, continue receiving
|
|
70
|
-
continue
|
|
71
|
-
|
|
72
|
-
# Parse response
|
|
73
|
-
data = b''.join(chunks)
|
|
74
|
-
response = json.loads(data.decode('utf-8'))
|
|
75
|
-
logger.info(f"Received response: {response}")
|
|
76
|
-
return response
|
|
77
|
-
|
|
78
|
-
finally:
|
|
79
|
-
# Always close the socket
|
|
80
|
-
sock.close()
|
|
81
|
-
|
|
82
|
-
except Exception as e:
|
|
83
|
-
logger.error(f"Error sending command: {e}")
|
|
84
|
-
return None
|
|
85
|
-
|
|
86
|
-
def create_test_cube(name: str, location: list[float]) -> Optional[Dict[str, Any]]:
|
|
87
|
-
"""Create a test cube actor with the specified name and location.
|
|
88
|
-
|
|
89
|
-
Args:
|
|
90
|
-
name: The name to give the cube actor
|
|
91
|
-
location: The [x, y, z] world location to spawn at
|
|
92
|
-
|
|
93
|
-
Returns:
|
|
94
|
-
Optional[Dict[str, Any]]: The response from the create command, or None if failed
|
|
95
|
-
"""
|
|
96
|
-
cube_params = {
|
|
97
|
-
"name": name,
|
|
98
|
-
"type": "StaticMeshActor",
|
|
99
|
-
"location": location,
|
|
100
|
-
"rotation": [0.0, 0.0, 0.0],
|
|
101
|
-
"scale": [1.0, 1.0, 1.0]
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
response = send_command("create_actor", cube_params)
|
|
105
|
-
if not response or response.get("status") != "success":
|
|
106
|
-
logger.error(f"Failed to create cube: {response}")
|
|
107
|
-
return None
|
|
108
|
-
|
|
109
|
-
logger.info(f"Created cube '{name}' successfully at location {location}")
|
|
110
|
-
return response
|
|
111
|
-
|
|
112
|
-
def get_actor_properties(name: str) -> Optional[Dict[str, Any]]:
|
|
113
|
-
"""Get the properties of an actor by name.
|
|
114
|
-
|
|
115
|
-
Args:
|
|
116
|
-
name: The name of the actor to get properties for
|
|
117
|
-
|
|
118
|
-
Returns:
|
|
119
|
-
Optional[Dict[str, Any]]: The actor properties, or None if not found/error
|
|
120
|
-
"""
|
|
121
|
-
response = send_command("get_actor_properties", {"name": name})
|
|
122
|
-
if not response or response.get("status") != "success":
|
|
123
|
-
logger.error(f"Failed to get properties for actor '{name}': {response}")
|
|
124
|
-
return None
|
|
125
|
-
|
|
126
|
-
logger.info(f"Got properties for actor '{name}' successfully")
|
|
127
|
-
return response
|
|
128
|
-
|
|
129
|
-
def set_actor_transform(
|
|
130
|
-
name: str,
|
|
131
|
-
location: Optional[list[float]] = None,
|
|
132
|
-
rotation: Optional[list[float]] = None,
|
|
133
|
-
scale: Optional[list[float]] = None
|
|
134
|
-
) -> Optional[Dict[str, Any]]:
|
|
135
|
-
"""Set the transform of an actor.
|
|
136
|
-
|
|
137
|
-
Args:
|
|
138
|
-
name: The name of the actor to modify
|
|
139
|
-
location: Optional new [x, y, z] location
|
|
140
|
-
rotation: Optional new [pitch, yaw, roll] rotation in degrees
|
|
141
|
-
scale: Optional new [x, y, z] scale
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
Optional[Dict[str, Any]]: The updated actor properties, or None if failed
|
|
145
|
-
"""
|
|
146
|
-
transform_params = {"name": name}
|
|
147
|
-
if location is not None:
|
|
148
|
-
transform_params["location"] = location
|
|
149
|
-
if rotation is not None:
|
|
150
|
-
transform_params["rotation"] = rotation
|
|
151
|
-
if scale is not None:
|
|
152
|
-
transform_params["scale"] = scale
|
|
153
|
-
|
|
154
|
-
response = send_command("set_actor_transform", transform_params)
|
|
155
|
-
if not response or response.get("status") != "success":
|
|
156
|
-
logger.error(f"Failed to set transform for actor '{name}': {response}")
|
|
157
|
-
return None
|
|
158
|
-
|
|
159
|
-
logger.info(f"Modified transform for actor '{name}' successfully")
|
|
160
|
-
return response
|
|
161
|
-
|
|
162
|
-
def main():
|
|
163
|
-
"""Main function to test actor creation and manipulation."""
|
|
164
|
-
try:
|
|
165
|
-
# Create first test cube
|
|
166
|
-
cube1_name = "TestCube_001"
|
|
167
|
-
cube1 = create_test_cube(cube1_name, [0.0, 0.0, 100.0])
|
|
168
|
-
if not cube1:
|
|
169
|
-
logger.error("Failed to create first test cube")
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
# Get its properties to verify creation
|
|
173
|
-
props = get_actor_properties(cube1_name)
|
|
174
|
-
if not props:
|
|
175
|
-
logger.error("Failed to verify first test cube properties")
|
|
176
|
-
return
|
|
177
|
-
|
|
178
|
-
# Modify its transform
|
|
179
|
-
result = set_actor_transform(
|
|
180
|
-
cube1_name,
|
|
181
|
-
location=[0.0, 0.0, 200.0],
|
|
182
|
-
rotation=[0.0, 45.0, 0.0],
|
|
183
|
-
scale=[2.0, 2.0, 2.0]
|
|
184
|
-
)
|
|
185
|
-
if not result:
|
|
186
|
-
logger.error("Failed to modify first test cube transform")
|
|
187
|
-
return
|
|
188
|
-
|
|
189
|
-
# Create a second test cube at a different location
|
|
190
|
-
cube2_name = "TestCube_002"
|
|
191
|
-
cube2 = create_test_cube(cube2_name, [100.0, 100.0, 100.0])
|
|
192
|
-
if not cube2:
|
|
193
|
-
logger.error("Failed to create second test cube")
|
|
194
|
-
return
|
|
195
|
-
|
|
196
|
-
logger.info("All test operations completed successfully!")
|
|
197
|
-
|
|
198
|
-
except Exception as e:
|
|
199
|
-
logger.error(f"Error in main: {e}")
|
|
200
|
-
sys.exit(1)
|
|
201
|
-
|
|
202
|
-
if __name__ == "__main__":
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
"""
|
|
3
|
+
Test script for creating and manipulating actors in Unreal Engine via MCP.
|
|
4
|
+
|
|
5
|
+
This script demonstrates the basic actor manipulation capabilities of the MCP system:
|
|
6
|
+
- Creating actors with specific names and transforms
|
|
7
|
+
- Getting actor properties
|
|
8
|
+
- Modifying actor transforms
|
|
9
|
+
- Error handling and validation
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import sys
|
|
13
|
+
import os
|
|
14
|
+
import time
|
|
15
|
+
import socket
|
|
16
|
+
import json
|
|
17
|
+
import logging
|
|
18
|
+
from typing import Dict, Any, Optional
|
|
19
|
+
|
|
20
|
+
# Add the parent directory to the path so we can import the server module
|
|
21
|
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
22
|
+
|
|
23
|
+
# Set up logging
|
|
24
|
+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
25
|
+
logger = logging.getLogger("TestCube")
|
|
26
|
+
|
|
27
|
+
def send_command(command: str, params: Dict[str, Any]) -> Optional[Dict[str, Any]]:
|
|
28
|
+
"""Send a command to the Unreal MCP server and get the response.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
command: The command type to send
|
|
32
|
+
params: Dictionary of parameters for the command
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
Optional[Dict[str, Any]]: The response from the server, or None if there was an error
|
|
36
|
+
"""
|
|
37
|
+
try:
|
|
38
|
+
# Create new socket connection
|
|
39
|
+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
40
|
+
sock.connect(("127.0.0.1", 55557))
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
# Create command object
|
|
44
|
+
command_obj = {
|
|
45
|
+
"type": command,
|
|
46
|
+
"params": params
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
# Convert to JSON and send
|
|
50
|
+
command_json = json.dumps(command_obj)
|
|
51
|
+
logger.info(f"Sending command: {command_json}")
|
|
52
|
+
sock.sendall(command_json.encode('utf-8'))
|
|
53
|
+
|
|
54
|
+
# Receive response
|
|
55
|
+
chunks = []
|
|
56
|
+
while True:
|
|
57
|
+
chunk = sock.recv(4096)
|
|
58
|
+
if not chunk:
|
|
59
|
+
break
|
|
60
|
+
chunks.append(chunk)
|
|
61
|
+
|
|
62
|
+
# Try parsing to see if we have a complete response
|
|
63
|
+
try:
|
|
64
|
+
data = b''.join(chunks)
|
|
65
|
+
json.loads(data.decode('utf-8'))
|
|
66
|
+
# If we can parse it, we have the complete response
|
|
67
|
+
break
|
|
68
|
+
except json.JSONDecodeError:
|
|
69
|
+
# Not a complete JSON object yet, continue receiving
|
|
70
|
+
continue
|
|
71
|
+
|
|
72
|
+
# Parse response
|
|
73
|
+
data = b''.join(chunks)
|
|
74
|
+
response = json.loads(data.decode('utf-8'))
|
|
75
|
+
logger.info(f"Received response: {response}")
|
|
76
|
+
return response
|
|
77
|
+
|
|
78
|
+
finally:
|
|
79
|
+
# Always close the socket
|
|
80
|
+
sock.close()
|
|
81
|
+
|
|
82
|
+
except Exception as e:
|
|
83
|
+
logger.error(f"Error sending command: {e}")
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
def create_test_cube(name: str, location: list[float]) -> Optional[Dict[str, Any]]:
|
|
87
|
+
"""Create a test cube actor with the specified name and location.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
name: The name to give the cube actor
|
|
91
|
+
location: The [x, y, z] world location to spawn at
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
Optional[Dict[str, Any]]: The response from the create command, or None if failed
|
|
95
|
+
"""
|
|
96
|
+
cube_params = {
|
|
97
|
+
"name": name,
|
|
98
|
+
"type": "StaticMeshActor",
|
|
99
|
+
"location": location,
|
|
100
|
+
"rotation": [0.0, 0.0, 0.0],
|
|
101
|
+
"scale": [1.0, 1.0, 1.0]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
response = send_command("create_actor", cube_params)
|
|
105
|
+
if not response or response.get("status") != "success":
|
|
106
|
+
logger.error(f"Failed to create cube: {response}")
|
|
107
|
+
return None
|
|
108
|
+
|
|
109
|
+
logger.info(f"Created cube '{name}' successfully at location {location}")
|
|
110
|
+
return response
|
|
111
|
+
|
|
112
|
+
def get_actor_properties(name: str) -> Optional[Dict[str, Any]]:
|
|
113
|
+
"""Get the properties of an actor by name.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
name: The name of the actor to get properties for
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
Optional[Dict[str, Any]]: The actor properties, or None if not found/error
|
|
120
|
+
"""
|
|
121
|
+
response = send_command("get_actor_properties", {"name": name})
|
|
122
|
+
if not response or response.get("status") != "success":
|
|
123
|
+
logger.error(f"Failed to get properties for actor '{name}': {response}")
|
|
124
|
+
return None
|
|
125
|
+
|
|
126
|
+
logger.info(f"Got properties for actor '{name}' successfully")
|
|
127
|
+
return response
|
|
128
|
+
|
|
129
|
+
def set_actor_transform(
|
|
130
|
+
name: str,
|
|
131
|
+
location: Optional[list[float]] = None,
|
|
132
|
+
rotation: Optional[list[float]] = None,
|
|
133
|
+
scale: Optional[list[float]] = None
|
|
134
|
+
) -> Optional[Dict[str, Any]]:
|
|
135
|
+
"""Set the transform of an actor.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
name: The name of the actor to modify
|
|
139
|
+
location: Optional new [x, y, z] location
|
|
140
|
+
rotation: Optional new [pitch, yaw, roll] rotation in degrees
|
|
141
|
+
scale: Optional new [x, y, z] scale
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
Optional[Dict[str, Any]]: The updated actor properties, or None if failed
|
|
145
|
+
"""
|
|
146
|
+
transform_params = {"name": name}
|
|
147
|
+
if location is not None:
|
|
148
|
+
transform_params["location"] = location
|
|
149
|
+
if rotation is not None:
|
|
150
|
+
transform_params["rotation"] = rotation
|
|
151
|
+
if scale is not None:
|
|
152
|
+
transform_params["scale"] = scale
|
|
153
|
+
|
|
154
|
+
response = send_command("set_actor_transform", transform_params)
|
|
155
|
+
if not response or response.get("status") != "success":
|
|
156
|
+
logger.error(f"Failed to set transform for actor '{name}': {response}")
|
|
157
|
+
return None
|
|
158
|
+
|
|
159
|
+
logger.info(f"Modified transform for actor '{name}' successfully")
|
|
160
|
+
return response
|
|
161
|
+
|
|
162
|
+
def main():
|
|
163
|
+
"""Main function to test actor creation and manipulation."""
|
|
164
|
+
try:
|
|
165
|
+
# Create first test cube
|
|
166
|
+
cube1_name = "TestCube_001"
|
|
167
|
+
cube1 = create_test_cube(cube1_name, [0.0, 0.0, 100.0])
|
|
168
|
+
if not cube1:
|
|
169
|
+
logger.error("Failed to create first test cube")
|
|
170
|
+
return
|
|
171
|
+
|
|
172
|
+
# Get its properties to verify creation
|
|
173
|
+
props = get_actor_properties(cube1_name)
|
|
174
|
+
if not props:
|
|
175
|
+
logger.error("Failed to verify first test cube properties")
|
|
176
|
+
return
|
|
177
|
+
|
|
178
|
+
# Modify its transform
|
|
179
|
+
result = set_actor_transform(
|
|
180
|
+
cube1_name,
|
|
181
|
+
location=[0.0, 0.0, 200.0],
|
|
182
|
+
rotation=[0.0, 45.0, 0.0],
|
|
183
|
+
scale=[2.0, 2.0, 2.0]
|
|
184
|
+
)
|
|
185
|
+
if not result:
|
|
186
|
+
logger.error("Failed to modify first test cube transform")
|
|
187
|
+
return
|
|
188
|
+
|
|
189
|
+
# Create a second test cube at a different location
|
|
190
|
+
cube2_name = "TestCube_002"
|
|
191
|
+
cube2 = create_test_cube(cube2_name, [100.0, 100.0, 100.0])
|
|
192
|
+
if not cube2:
|
|
193
|
+
logger.error("Failed to create second test cube")
|
|
194
|
+
return
|
|
195
|
+
|
|
196
|
+
logger.info("All test operations completed successfully!")
|
|
197
|
+
|
|
198
|
+
except Exception as e:
|
|
199
|
+
logger.error(f"Error in main: {e}")
|
|
200
|
+
sys.exit(1)
|
|
201
|
+
|
|
202
|
+
if __name__ == "__main__":
|
|
203
203
|
main()
|