Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
BlenderEndpoints.c
Go to the documentation of this file.
1class RestAPIHelper<JsonApiStruct T > {
2
3 static T Get (BlenderRestAPI connection, string endpoint) {
4 string response;
5 bool status = connection.Get(endpoint, response);
6
7 if (status)
8 {
9 auto struct = new T();
10 struct.RegAll();
11 struct.ExpandFromRAW(response);
12 return struct;
13 }
14
15 return null;
16 }
17}
18
19//--------------------------------------------------------------
20
21class GetObjectsResult : JsonApiStruct
22{
23 ref array<string> content = {};
24}
25
26array<string> GetObjects(notnull const BlenderRestAPI connection)
27{
28 auto result = RestAPIHelper<GetObjectsResult>.Get(connection, "/get_objects");
29
30 if (result)
31 {
32 return result.content;
33 }
34
35 return null;
36}
37
38//--------------------------------------------------------------
39
41{
42 vector location;
43 vector rotation;
44 vector scale;
45}
46
47GetTransformResult GetTransform(notnull const BlenderRestAPI connection, string object_name)
49 string endpoint = string.Format("/get_transform?name=%1", object_name);
50 auto result = RestAPIHelper<GetTransformResult>.Get(connection, endpoint);
51
52 if (result)
53 {
54 return result;
55 }
56
57 return null;
58}
59
60//--------------------------------------------------------------
61
62bool OpenBlendFile(notnull const BlenderRestAPI connection, string blend_file)
63{
64 string endpoint = string.Format("/open_blend_file?path=%1", blend_file);
65 return connection.Get(endpoint);
66}
67
68//--------------------------------------------------------------
GetTransformResult JsonApiStruct GetTransform(notnull const BlenderRestAPI connection, string object_name)
array< string > GetObjects(notnull const BlenderRestAPI connection)
class RestAPIHelper< JsonApiStruct T > content
bool OpenBlendFile(notnull const BlenderRestAPI connection, string blend_file)
class SCR_MapHelperT< Class T, Class U > T
base classes for filtering in server browser
proto T Get(int n)