diff options
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/gdnative_builders.py | 24 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 4 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.h | 1 | ||||
-rw-r--r-- | modules/gdnative/pluginscript/pluginscript_script.h | 1 |
4 files changed, 18 insertions, 12 deletions
diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py index f9d1ed9dc5..ff18a3ae69 100644 --- a/modules/gdnative/gdnative_builders.py +++ b/modules/gdnative/gdnative_builders.py @@ -87,20 +87,20 @@ def _build_gdnative_api_struct_header(api): ret_val = [] if core['next']: ret_val += generate_core_extension_struct(core['next']) - + ret_val += [ 'typedef struct godot_gdnative_core_' + ('{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + '_api_struct {', '\tunsigned int type;', '\tgodot_gdnative_api_version version;', '\tconst godot_gdnative_api_struct *next;', ] - + for funcdef in core['api']: args = ', '.join(['%s%s' % (_spaced(t), n) for t, n in funcdef['arguments']]) ret_val.append('\t%s(*%s)(%s);' % (_spaced(funcdef['return_type']), funcdef['name'], args)) - + ret_val += ['} godot_gdnative_core_' + '{0}_{1}'.format(core['version']['major'], core['version']['minor']) + '_api_struct;', ''] - + return ret_val @@ -171,26 +171,26 @@ def _build_gdnative_api_struct_source(api): ret_val += ['};\n'] return ret_val - - + + def get_core_struct_definition(core): ret_val = [] - + if core['next']: ret_val += get_core_struct_definition(core['next']) - + ret_val += [ 'extern const godot_gdnative_core_' + ('{0}_{1}_api_struct api_{0}_{1}'.format(core['version']['major'], core['version']['minor'])) + ' = {', '\tGDNATIVE_' + core['type'] + ',', '\t{' + str(core['version']['major']) + ', ' + str(core['version']['minor']) + '},', '\t' + ('NULL' if not core['next'] else ('(const godot_gdnative_api_struct *)& api_{0}_{1}'.format(core['version']['major'], core['version']['minor']))) + ',' ] - + for funcdef in core['api']: ret_val.append('\t%s,' % funcdef['name']) - + ret_val += ['};\n'] - + return ret_val for ext in api['extensions']: @@ -204,7 +204,7 @@ def _build_gdnative_api_struct_source(api): out += ['\t(godot_gdnative_api_struct *)&api_extension_' + name + '_struct,'] out += ['};\n'] - + if api['core']['next']: out += get_core_struct_definition(api['core']['next']) diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index eb133502c4..bcaf3f346e 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -294,6 +294,10 @@ MethodInfo NativeScript::get_method_info(const StringName &p_method) const { return MethodInfo(); } +bool NativeScript::is_valid() const { + return true; +} + bool NativeScript::is_tool() const { NativeScriptDesc *script_data = get_script_desc(); diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 51370f5fbf..e6f3c06ee5 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -160,6 +160,7 @@ public: virtual MethodInfo get_method_info(const StringName &p_method) const; virtual bool is_tool() const; + virtual bool is_valid() const; virtual ScriptLanguage *get_language() const; diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h index 31c6c4d67f..3ade8ac004 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.h +++ b/modules/gdnative/pluginscript/pluginscript_script.h @@ -102,6 +102,7 @@ public: PropertyInfo get_property_info(const StringName &p_property) const; bool is_tool() const { return _tool; } + bool is_valid() const { return true; } virtual ScriptLanguage *get_language() const; |