changed GDNative API json format
This commit is contained in:
parent
486ec499f3
commit
70866bbafd
|
@ -23,7 +23,8 @@ def _build_gdnative_api_struct_header(api):
|
|||
'\textern const godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct;'
|
||||
]
|
||||
|
||||
for name in api['extensions']:
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
gdnative_api_init_macro.append(
|
||||
'\textern const godot_gdnative_ext_{0}_api_struct *_gdnative_wrapper_{0}_api_struct;'.format(name))
|
||||
|
||||
|
@ -31,9 +32,10 @@ def _build_gdnative_api_struct_header(api):
|
|||
gdnative_api_init_macro.append('\tfor (unsigned int i = 0; i < _gdnative_wrapper_api_struct->num_extensions; i++) { ')
|
||||
gdnative_api_init_macro.append('\t\tswitch (_gdnative_wrapper_api_struct->extensions[i]->type) {')
|
||||
|
||||
for name in api['extensions']:
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
gdnative_api_init_macro.append(
|
||||
'\t\t\tcase GDNATIVE_EXT_%s:' % api['extensions'][name]['type'])
|
||||
'\t\t\tcase GDNATIVE_EXT_%s:' % ext['type'])
|
||||
gdnative_api_init_macro.append(
|
||||
'\t\t\t\t_gdnative_wrapper_{0}_api_struct = (godot_gdnative_ext_{0}_api_struct *)'
|
||||
' _gdnative_wrapper_api_struct->extensions[i];'.format(name))
|
||||
|
@ -61,8 +63,8 @@ def _build_gdnative_api_struct_header(api):
|
|||
'\tGDNATIVE_' + api['core']['type'] + ','
|
||||
]
|
||||
|
||||
for name in api['extensions']:
|
||||
out += ['\tGDNATIVE_EXT_' + api['extensions'][name]['type'] + ',']
|
||||
for ext in api['extensions']:
|
||||
out += ['\tGDNATIVE_EXT_' + ext['type'] + ',']
|
||||
|
||||
out += ['};', '']
|
||||
|
||||
|
@ -88,8 +90,9 @@ def _build_gdnative_api_struct_header(api):
|
|||
return ret_val
|
||||
|
||||
|
||||
for name in api['extensions']:
|
||||
out += generate_extension_struct(name, api['extensions'][name], False)
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
out += generate_extension_struct(name, ext, False)
|
||||
|
||||
out += [
|
||||
'typedef struct godot_gdnative_core_api_struct {',
|
||||
|
@ -151,12 +154,14 @@ def _build_gdnative_api_struct_source(api):
|
|||
|
||||
return ret_val
|
||||
|
||||
for name in api['extensions']:
|
||||
out += get_extension_struct_definition(name, api['extensions'][name], False)
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
out += get_extension_struct_definition(name, ext, False)
|
||||
|
||||
out += ['', 'const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {']
|
||||
|
||||
for name in api['extensions']:
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,']
|
||||
|
||||
out += ['};\n']
|
||||
|
@ -214,7 +219,8 @@ def _build_gdnative_wrapper_code(api):
|
|||
'godot_gdnative_core_api_struct *_gdnative_wrapper_api_struct = 0;',
|
||||
]
|
||||
|
||||
for name in api['extensions']:
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
out.append('godot_gdnative_ext_' + name + '_api_struct *_gdnative_wrapper_' + name + '_api_struct = 0;')
|
||||
|
||||
out += ['']
|
||||
|
@ -232,8 +238,9 @@ def _build_gdnative_wrapper_code(api):
|
|||
out.append('}')
|
||||
out.append('')
|
||||
|
||||
for name in api['extensions']:
|
||||
for funcdef in api['extensions'][name]['api']:
|
||||
for ext in api['extensions']:
|
||||
name = ext['name']
|
||||
for funcdef in ext['api']:
|
||||
args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']])
|
||||
out.append('%s%s(%s) {' % (_spaced(funcdef['return_type']), funcdef['name'], args))
|
||||
|
||||
|
@ -267,7 +274,7 @@ def build_gdnative_wrapper_code(target, source, env):
|
|||
|
||||
|
||||
if ARGUMENTS.get('gdnative_wrapper', False):
|
||||
#build wrapper code
|
||||
#build wrapper code
|
||||
gensource, = gdn_env.Command('gdnative_wrapper_code.gen.cpp', 'gdnative_api.json', build_gdnative_wrapper_code)
|
||||
|
||||
gd_wrapper_env = env.Clone()
|
||||
|
|
|
@ -5756,8 +5756,9 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"extensions": {
|
||||
"nativescript": {
|
||||
"extensions": [
|
||||
{
|
||||
"name": "nativescript",
|
||||
"type": "NATIVESCRIPT",
|
||||
"version": {
|
||||
"major": 1,
|
||||
|
@ -5942,7 +5943,8 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"pluginscript": {
|
||||
{
|
||||
"name": "pluginscript",
|
||||
"type": "PLUGINSCRIPT",
|
||||
"version": {
|
||||
"major": 1,
|
||||
|
@ -5959,7 +5961,8 @@
|
|||
}
|
||||
]
|
||||
},
|
||||
"arvr": {
|
||||
{
|
||||
"name": "arvr",
|
||||
"type": "ARVR",
|
||||
"version": {
|
||||
"major": 1,
|
||||
|
@ -6055,5 +6058,5 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue