diff options
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/SCsub | 3 | ||||
-rw-r--r-- | modules/gdnative/gdnative/string.cpp | 16 | ||||
-rw-r--r-- | modules/gdnative/gdnative_api.json | 13 | ||||
-rw-r--r-- | modules/gdnative/gdnative_builders.py | 4 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/string.h | 7 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 28 | ||||
-rw-r--r-- | modules/gdnative/nativescript/nativescript.h | 3 | ||||
-rw-r--r-- | modules/gdnative/pluginscript/pluginscript_instance.h | 6 |
8 files changed, 16 insertions, 64 deletions
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index cab05549d2..0e2291c1f9 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -22,13 +22,12 @@ SConscript("pluginscript/SCsub") SConscript("videodecoder/SCsub") -from platform_methods import run_in_subprocess import gdnative_builders _, gensource = env_gdnative.CommandNoCache( ["include/gdnative_api_struct.gen.h", "gdnative_api_struct.gen.cpp"], "gdnative_api.json", - run_in_subprocess(gdnative_builders.build_gdnative_api_struct), + env.Run(gdnative_builders.build_gdnative_api_struct, "Generating GDNative API."), ) env_gdnative.add_source_files(env.modules_sources, [gensource]) diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 8b0c7474e8..26c40b625c 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -541,13 +541,7 @@ godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_f return result; } -double GDAPI godot_string_to_double(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->to_double(); -} - -godot_real GDAPI godot_string_to_float(const godot_string *p_self) { +double GDAPI godot_string_to_float(const godot_string *p_self) { const String *self = (const String *)p_self; return self->to_float(); @@ -583,8 +577,8 @@ godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_s return result; } -double GDAPI godot_string_char_to_double(const char *p_what) { - return String::to_double(p_what); +double GDAPI godot_string_char_to_float(const char *p_what) { + return String::to_float(p_what); } godot_int GDAPI godot_string_char_to_int(const char *p_what) { @@ -621,8 +615,8 @@ int64_t GDAPI godot_string_to_int64(const godot_string *p_self) { return self->to_int(); } -double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end) { - return String::to_double(p_str, r_end); +double GDAPI godot_string_unicode_char_to_float(const wchar_t *p_str, const wchar_t **r_end) { + return String::to_float(p_str, r_end); } godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice) { diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 9852928d22..8ccf44ff1a 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -4237,15 +4237,8 @@ ] }, { - "name": "godot_string_to_double", - "return_type": "double", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { "name": "godot_string_to_float", - "return_type": "godot_real", + "return_type": "double", "arguments": [ ["const godot_string *", "p_self"] ] @@ -4279,7 +4272,7 @@ ] }, { - "name": "godot_string_char_to_double", + "name": "godot_string_char_to_float", "return_type": "double", "arguments": [ ["const char *", "p_what"] @@ -4337,7 +4330,7 @@ ] }, { - "name": "godot_string_unicode_char_to_double", + "name": "godot_string_unicode_char_to_float", "return_type": "double", "arguments": [ ["const wchar_t *", "p_str"], diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py index a6f8afb85b..28e4957b2f 100644 --- a/modules/gdnative/gdnative_builders.py +++ b/modules/gdnative/gdnative_builders.py @@ -74,7 +74,7 @@ def _build_gdnative_api_struct_header(api): ret_val += [ "typedef struct godot_gdnative_core_" - + ("{0}_{1}".format(core["version"]["major"], core["version"]["minor"])) + + "{0}_{1}".format(core["version"]["major"], core["version"]["minor"]) + "_api_struct {", "\tunsigned int type;", "\tgodot_gdnative_api_version version;", @@ -185,7 +185,7 @@ def _build_gdnative_api_struct_source(api): ret_val += [ "extern const godot_gdnative_core_" - + ("{0}_{1}_api_struct api_{0}_{1}".format(core["version"]["major"], core["version"]["minor"])) + + "{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"]) + "},", diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index dfd4fcab89..d89383dc1b 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -145,14 +145,13 @@ godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string); godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars); -double GDAPI godot_string_to_double(const godot_string *p_self); -godot_real GDAPI godot_string_to_float(const godot_string *p_self); +double GDAPI godot_string_to_float(const godot_string *p_self); godot_int GDAPI godot_string_to_int(const godot_string *p_self); godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self); godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self); godot_string GDAPI godot_string_capitalize(const godot_string *p_self); -double GDAPI godot_string_char_to_double(const char *p_what); +double GDAPI godot_string_char_to_float(const char *p_what); godot_int GDAPI godot_string_char_to_int(const char *p_what); int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str); godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len); @@ -160,7 +159,7 @@ int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_le int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self); int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self); int64_t GDAPI godot_string_to_int64(const godot_string *p_self); -double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end); +double GDAPI godot_string_unicode_char_to_float(const wchar_t *p_str, const wchar_t **r_end); godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter); godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice); diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 94aa2125c2..632f4e5fee 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -991,7 +991,8 @@ void NativeScriptInstance::notification(int p_notification) { Variant value = p_notification; const Variant *args[1] = { &value }; - call_multilevel("_notification", args, 1); + Callable::CallError error; + call("_notification", args, 1, error); } String NativeScriptInstance::to_string(bool *r_valid) { @@ -1087,31 +1088,6 @@ ScriptLanguage *NativeScriptInstance::get_language() { return NativeScriptLanguage::get_singleton(); } -void NativeScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { - NativeScriptDesc *script_data = GET_SCRIPT_DESC(); - - while (script_data) { - Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.find(p_method); - if (E) { - godot_variant res = E->get().method.method((godot_object *)owner, - E->get().method.method_data, - userdata, - p_argcount, - (godot_variant **)p_args); - godot_variant_destroy(&res); - } - script_data = script_data->base_data; - } -} - -void NativeScriptInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { - NativeScriptDesc *script_data = GET_SCRIPT_DESC(); - - if (script_data) { - _ml_call_reversed(script_data, p_method, p_args, p_argcount); - } -} - NativeScriptInstance::~NativeScriptInstance() { NativeScriptDesc *script_data = GET_SCRIPT_DESC(); diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index e709ce2337..145bf7dcb6 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -231,9 +231,6 @@ public: virtual ScriptLanguage *get_language(); - virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount); - virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount); - virtual void refcount_incremented(); virtual bool refcount_decremented(); diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h index 6309b6fde3..690d1a0432 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.h +++ b/modules/gdnative/pluginscript/pluginscript_instance.h @@ -62,12 +62,6 @@ public: virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); - // Rely on default implementations provided by ScriptInstance for the moment. - // Note that multilevel call could be removed in 3.0 release, so stay tuned - // (see https://godotengine.org/qa/9244/can-override-the-_ready-and-_process-functions-child-classes) - //virtual void call_multilevel(const StringName& p_method,const Variant** p_args,int p_argcount); - //virtual void call_multilevel_reversed(const StringName& p_method,const Variant** p_args,int p_argcount); - virtual void notification(int p_notification); virtual Ref<Script> get_script() const; |