-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_client.py
More file actions
25 lines (21 loc) · 900 Bytes
/
test_client.py
File metadata and controls
25 lines (21 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import json
import sys
def send_request(tool_name, args):
request = {
'tool_name': tool_name,
'args': args
}
sys.stdout.write(json.dumps(request) + '\n')
sys.stdout.flush()
response_line = sys.stdin.readline()
return json.loads(response_line)
if __name__ == '__main__':
# Example: Load a scene
# response = send_request('load_scene', {'scene_path': 'D:/My Lybrary/Scenes/deviant.duf'})
# print(f"Load scene response: {response}")
# Example: Render a scene
response = send_request('render_scene', {'output_path': 'C:/Users/knoss/Desktop/rendered_scene.png', 'width': 800, 'height': 600})
print(f"Render scene response: {response}")
# Example: Set a pose
# response = send_request('set_pose', {'figure_name': 'Genesis 8 Female', 'pose_file': 'D:/My Lybrary/Poses/some_pose.duf'})
# print(f"Set pose response: {response}")