forked from Abdera7mane/Godot-UnixSocket
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_generator.py
More file actions
45 lines (35 loc) · 799 Bytes
/
api_generator.py
File metadata and controls
45 lines (35 loc) · 799 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!python
import json
classes = []
expose = {
"StreamPeer",
"StreamPeerExtension",
# Special cases
"Object",
"RefCounted",
"FileAccess",
"WorkerThreadPool",
"XMLParser",
"ClassDB",
}
singletons = [
{
"name": "ClassDB",
"type": "ClassDB",
},
]
api = {}
with open("godot-cpp/gdextension/extension_api.json") as file:
api = json.load(file)
iterator = iter(api["classes"])
while len(expose) > 0:
clazz = next(iterator)
class_name = clazz["name"]
if class_name in expose:
print(f"Exposed class: {class_name}")
classes.append(clazz)
expose.remove(class_name)
api["classes"] = classes
api["singletons"] = singletons
with open("custom_api.json", 'w') as file:
json.dump(api, file, indent='\t')