diff options
Diffstat (limited to 'modules/gdnative')
118 files changed, 10579 insertions, 18500 deletions
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub index 0e2291c1f9..45354ce692 100644 --- a/modules/gdnative/SCsub +++ b/modules/gdnative/SCsub @@ -20,6 +20,7 @@ SConscript("net/SCsub") SConscript("xr/SCsub") SConscript("pluginscript/SCsub") SConscript("videodecoder/SCsub") +SConscript("text/SCsub") import gdnative_builders @@ -30,5 +31,3 @@ _, gensource = env_gdnative.CommandNoCache( env.Run(gdnative_builders.build_gdnative_api_struct, "Generating GDNative API."), ) env_gdnative.add_source_files(env.modules_sources, [gensource]) - -env.use_ptrcall = True diff --git a/modules/gdnative/android/android_gdn.cpp b/modules/gdnative/android/android_gdn.cpp index bc39be1813..fe3b3e7e12 100644 --- a/modules/gdnative/android/android_gdn.cpp +++ b/modules/gdnative/android/android_gdn.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -48,7 +48,7 @@ extern "C" { JNIEnv *GDAPI godot_android_get_env() { #ifdef __ANDROID__ - return ThreadAndroid::get_env(); + return get_jni_env(); #else return nullptr; #endif diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py index 7603e7d69d..fa985501b5 100644 --- a/modules/gdnative/config.py +++ b/modules/gdnative/config.py @@ -3,12 +3,11 @@ def can_build(env, platform): def configure(env): - env.use_ptrcall = True + pass def get_doc_classes(): return [ - "XRInterfaceGDNative", "GDNative", "GDNativeLibrary", "MultiplayerPeerGDNative", diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml index 44d9e32ed8..e4c5d34a2c 100644 --- a/modules/gdnative/doc_classes/GDNative.xml +++ b/modules/gdnative/doc_classes/GDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="GDNative" inherits="Reference" version="4.0"> +<class name="GDNative" inherits="RefCounted" version="4.0"> <brief_description> </brief_description> <description> @@ -8,26 +8,20 @@ </tutorials> <methods> <method name="call_native"> - <return type="Variant"> - </return> - <argument index="0" name="calling_type" type="StringName"> - </argument> - <argument index="1" name="procedure_name" type="StringName"> - </argument> - <argument index="2" name="arguments" type="Array"> - </argument> + <return type="Variant" /> + <argument index="0" name="calling_type" type="StringName" /> + <argument index="1" name="procedure_name" type="StringName" /> + <argument index="2" name="arguments" type="Array" /> <description> </description> </method> <method name="initialize"> - <return type="bool"> - </return> + <return type="bool" /> <description> </description> </method> <method name="terminate"> - <return type="bool"> - </return> + <return type="bool" /> <description> </description> </method> diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml index 05cda05f9f..94eae3cd06 100644 --- a/modules/gdnative/doc_classes/GDNativeLibrary.xml +++ b/modules/gdnative/doc_classes/GDNativeLibrary.xml @@ -4,7 +4,7 @@ An external library containing functions or script classes to use in Godot. </brief_description> <description> - A GDNative library can implement [NativeScript]s, global functions to call with the [GDNative] class, or low-level engine extensions through interfaces such as [XRInterfaceGDNative]. The library must be compiled for each platform and architecture that the project will run on. + A GDNative library can implement [NativeScript]s, global functions to call with the [GDNative] class, or low-level engine extensions through interfaces such as XRInterfaceGDNative. The library must be compiled for each platform and architecture that the project will run on. </description> <tutorials> <link title="GDNative C example">https://docs.godotengine.org/en/latest/tutorials/plugins/gdnative/gdnative-c-example.html</link> @@ -12,15 +12,13 @@ </tutorials> <methods> <method name="get_current_dependencies" qualifiers="const"> - <return type="PackedStringArray"> - </return> + <return type="PackedStringArray" /> <description> Returns paths to all dependency libraries for the current platform and architecture. </description> </method> <method name="get_current_library_path" qualifiers="const"> - <return type="String"> - </return> + <return type="String" /> <description> Returns the path to the dynamic library file for the current platform and architecture. </description> diff --git a/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml b/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml index 9f33d32e81..b88f5e7e1e 100644 --- a/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml +++ b/modules/gdnative/doc_classes/MultiplayerPeerGDNative.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="MultiplayerPeerGDNative" inherits="NetworkedMultiplayerPeer" version="4.0"> +<class name="MultiplayerPeerGDNative" inherits="MultiplayerPeer" version="4.0"> <brief_description> </brief_description> <description> diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml index f2e9cac6dc..397d12a3a9 100644 --- a/modules/gdnative/doc_classes/NativeScript.xml +++ b/modules/gdnative/doc_classes/NativeScript.xml @@ -8,42 +8,34 @@ </tutorials> <methods> <method name="get_class_documentation" qualifiers="const"> - <return type="String"> - </return> + <return type="String" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_class_documentation[/code]. </description> </method> <method name="get_method_documentation" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="method" type="StringName"> - </argument> + <return type="String" /> + <argument index="0" name="method" type="StringName" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_method_documentation[/code]. </description> </method> <method name="get_property_documentation" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="path" type="StringName"> - </argument> + <return type="String" /> + <argument index="0" name="path" type="StringName" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_property_documentation[/code]. </description> </method> <method name="get_signal_documentation" qualifiers="const"> - <return type="String"> - </return> - <argument index="0" name="signal_name" type="StringName"> - </argument> + <return type="String" /> + <argument index="0" name="signal_name" type="StringName" /> <description> Returns the documentation string that was previously set with [code]godot_nativescript_set_signal_documentation[/code]. </description> </method> <method name="new" qualifiers="vararg"> - <return type="Variant"> - </return> + <return type="Variant" /> <description> Constructs a new object of the base type with a script of this type already attached. [i]Note[/i]: Any arguments passed to this function will be ignored and not passed to the native constructor function. This will change with in a future API extension. diff --git a/modules/gdnative/doc_classes/PluginScript.xml b/modules/gdnative/doc_classes/PluginScript.xml index 9616101090..8e28187482 100644 --- a/modules/gdnative/doc_classes/PluginScript.xml +++ b/modules/gdnative/doc_classes/PluginScript.xml @@ -8,8 +8,7 @@ </tutorials> <methods> <method name="new" qualifiers="vararg"> - <return type="Variant"> - </return> + <return type="Variant" /> <description> Returns a new instance of the script. </description> diff --git a/modules/gdnative/doc_classes/VideoStreamGDNative.xml b/modules/gdnative/doc_classes/VideoStreamGDNative.xml index 153988bad8..8b1a3210df 100644 --- a/modules/gdnative/doc_classes/VideoStreamGDNative.xml +++ b/modules/gdnative/doc_classes/VideoStreamGDNative.xml @@ -11,17 +11,14 @@ </tutorials> <methods> <method name="get_file"> - <return type="String"> - </return> + <return type="String" /> <description> Returns the video file handled by this [VideoStreamGDNative]. </description> </method> <method name="set_file"> - <return type="void"> - </return> - <argument index="0" name="file" type="String"> - </argument> + <return type="void" /> + <argument index="0" name="file" type="String" /> <description> Sets the video file that this [VideoStreamGDNative] resource handles. The supported extensions depend on the GDNative plugins used to expose video formats. </description> diff --git a/modules/gdnative/doc_classes/XRInterfaceGDNative.xml b/modules/gdnative/doc_classes/XRInterfaceGDNative.xml deleted file mode 100644 index 13de815793..0000000000 --- a/modules/gdnative/doc_classes/XRInterfaceGDNative.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<class name="XRInterfaceGDNative" inherits="XRInterface" version="4.0"> - <brief_description> - GDNative wrapper for an XR interface. - </brief_description> - <description> - This is a wrapper class for GDNative implementations of the XR interface. To use a GDNative XR interface, simply instantiate this object and set your GDNative library containing the XR interface implementation. - </description> - <tutorials> - </tutorials> - <methods> - </methods> - <constants> - </constants> -</class> diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp index bb2da70c3a..9445fac1c6 100644 --- a/modules/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,11 +30,12 @@ #include "gdnative.h" -#include "core/global_constants.h" +#include "core/config/project_settings.h" +#include "core/core_constants.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" -#include "core/os/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" #include "scene/main/scene_tree.h" @@ -51,7 +52,7 @@ extern const godot_gdnative_core_api_struct api_struct; Map<String, Vector<Ref<GDNative>>> GDNativeLibrary::loaded_libraries; GDNativeLibrary::GDNativeLibrary() { - config_file.instance(); + config_file.instantiate(); symbol_prefix = default_symbol_prefix; load_once = default_load_once; @@ -110,6 +111,16 @@ bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_property) const return false; } +void GDNativeLibrary::reset_state() { + config_file.instantiate(); + current_library_path = ""; + current_dependencies.clear(); + symbol_prefix = default_symbol_prefix; + load_once = default_load_once; + singleton = default_singleton; + reloadable = default_reloadable; +} + void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { // set entries List<String> entry_key_list; @@ -118,9 +129,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { config_file->get_section_keys("entry", &entry_key_list); } - for (List<String>::Element *E = entry_key_list.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_key_list) { PropertyInfo prop; prop.type = Variant::STRING; @@ -136,9 +145,7 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { config_file->get_section_keys("dependencies", &dependency_key_list); } - for (List<String>::Element *E = dependency_key_list.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : dependency_key_list) { PropertyInfo prop; prop.type = Variant::STRING; @@ -149,6 +156,8 @@ void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { } void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) { + ERR_FAIL_COND(p_config_file.is_null()); + set_singleton(p_config_file->get_value("general", "singleton", default_singleton)); set_load_once(p_config_file->get_value("general", "load_once", default_load_once)); set_symbol_prefix(p_config_file->get_value("general", "symbol_prefix", default_symbol_prefix)); @@ -162,9 +171,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) { p_config_file->get_section_keys("entry", &entry_keys); } - for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -194,9 +201,7 @@ void GDNativeLibrary::set_config_file(Ref<ConfigFile> p_config_file) { p_config_file->get_section_keys("dependencies", &dependency_keys); } - for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : dependency_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -239,7 +244,7 @@ void GDNativeLibrary::_bind_methods() { ClassDB::bind_method(D_METHOD("set_symbol_prefix", "symbol_prefix"), &GDNativeLibrary::set_symbol_prefix); ClassDB::bind_method(D_METHOD("set_reloadable", "reloadable"), &GDNativeLibrary::set_reloadable); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "config_file", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile", 0), "set_config_file", "get_config_file"); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "config_file", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile", PROPERTY_USAGE_NONE), "set_config_file", "get_config_file"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "load_once"), "set_load_once", "should_load_once"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "singleton"), "set_singleton", "is_singleton"); @@ -286,7 +291,7 @@ bool GDNative::initialize() { } String lib_path = library->get_current_library_path(); - if (lib_path.empty()) { + if (lib_path.is_empty()) { ERR_PRINT("No library set for this platform"); return false; } @@ -323,9 +328,18 @@ bool GDNative::initialize() { // On OSX the exported libraries are located under the Frameworks directory. // So we need to replace the library path. String path = ProjectSettings::get_singleton()->globalize_path(lib_path); - if (!FileAccess::exists(path)) { + DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + + if (!da->file_exists(path) && !da->dir_exists(path)) { path = OS::get_singleton()->get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(lib_path.get_file()); } + + if (da->dir_exists(path)) { // Target library is a ".framework", add library base name to the path. + path = path.plus_file(path.get_file().get_basename()); + } + + memdelete(da); + #else String path = ProjectSettings::get_singleton()->globalize_path(lib_path); #endif @@ -508,9 +522,9 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_ return result; } -RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { +RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { Ref<GDNativeLibrary> lib; - lib.instance(); + lib.instantiate(); Ref<ConfigFile> config = lib->get_config_file(); diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h index 6d26c2141d..0cc6487ea4 100644 --- a/modules/gdnative/gdnative.h +++ b/modules/gdnative/gdnative.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,10 +31,10 @@ #ifndef GDNATIVE_H #define GDNATIVE_H +#include "core/io/resource.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/os/thread_safe.h" -#include "core/resource.h" #include "gdnative/gdnative.h" #include "gdnative_api_struct.gen.h" @@ -63,6 +63,8 @@ class GDNativeLibrary : public Resource { bool reloadable; public: + virtual void reset_state() override; + GDNativeLibrary(); ~GDNativeLibrary(); @@ -136,8 +138,8 @@ struct GDNativeCallRegistry { Vector<StringName> get_native_call_types(); }; -class GDNative : public Reference { - GDCLASS(GDNative, Reference); +class GDNative : public RefCounted { + GDCLASS(GDNative, RefCounted); Ref<GDNativeLibrary> library; @@ -166,7 +168,7 @@ public: class GDNativeLibraryResourceLoader : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); + virtual RES load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp index d5970e8004..c42b874b4b 100644 --- a/modules/gdnative/gdnative/aabb.cpp +++ b/modules/gdnative/gdnative/aabb.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,195 +31,19 @@ #include "gdnative/aabb.h" #include "core/math/aabb.h" -#include "core/variant.h" + +static_assert(sizeof(godot_aabb) == sizeof(AABB), "AABB size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_aabb) == sizeof(AABB), "AABB size mismatch"); - -void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) { - const Vector3 *pos = (const Vector3 *)p_pos; - const Vector3 *size = (const Vector3 *)p_size; - AABB *dest = (AABB *)r_dest; - *dest = AABB(*pos, *size); -} - -godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self) { - godot_vector3 raw_ret; - const AABB *self = (const AABB *)p_self; - Vector3 *ret = (Vector3 *)&raw_ret; - *ret = self->position; - return raw_ret; -} - -void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v) { - AABB *self = (AABB *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - self->position = *v; -} - -godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self) { - godot_vector3 raw_ret; - const AABB *self = (const AABB *)p_self; - Vector3 *ret = (Vector3 *)&raw_ret; - *ret = self->size; - return raw_ret; -} - -void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v) { - AABB *self = (AABB *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - self->size = *v; -} - -godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self) { - godot_string ret; - const AABB *self = (const AABB *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_aabb GDAPI godot_aabb_abs(const godot_aabb *p_self) { - godot_aabb dest; - const AABB *self = (const AABB *)p_self; - *((AABB *)&dest) = self->abs(); - return dest; -} - -godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->get_area(); -} - -godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->has_no_area(); -} - -godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->has_no_surface(); -} - -godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with) { - const AABB *self = (const AABB *)p_self; - const AABB *with = (const AABB *)p_with; - return self->intersects(*with); -} - -godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with) { - const AABB *self = (const AABB *)p_self; - const AABB *with = (const AABB *)p_with; - return self->encloses(*with); -} - -godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with) { - godot_aabb dest; - const AABB *self = (const AABB *)p_self; - const AABB *with = (const AABB *)p_with; - *((AABB *)&dest) = self->merge(*with); - return dest; -} - -godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with) { - godot_aabb dest; - const AABB *self = (const AABB *)p_self; - const AABB *with = (const AABB *)p_with; - *((AABB *)&dest) = self->intersection(*with); - return dest; -} - -godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane) { - const AABB *self = (const AABB *)p_self; - const Plane *plane = (const Plane *)p_plane; - return self->intersects_plane(*plane); -} - -godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) { - const AABB *self = (const AABB *)p_self; - const Vector3 *from = (const Vector3 *)p_from; - const Vector3 *to = (const Vector3 *)p_to; - return self->intersects_segment(*from, *to); -} - -godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point) { - const AABB *self = (const AABB *)p_self; - const Vector3 *point = (const Vector3 *)p_point; - return self->has_point(*point); -} - -godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir) { - godot_vector3 dest; - const AABB *self = (const AABB *)p_self; - const Vector3 *dir = (const Vector3 *)p_dir; - *((Vector3 *)&dest) = self->get_support(*dir); - return dest; -} - -godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self) { - godot_vector3 dest; - const AABB *self = (const AABB *)p_self; - *((Vector3 *)&dest) = self->get_longest_axis(); - return dest; -} - -godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->get_longest_axis_index(); -} - -godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->get_longest_axis_size(); -} - -godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self) { - godot_vector3 dest; - const AABB *self = (const AABB *)p_self; - *((Vector3 *)&dest) = self->get_shortest_axis(); - return dest; -} - -godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->get_shortest_axis_index(); -} - -godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self) { - const AABB *self = (const AABB *)p_self; - return self->get_shortest_axis_size(); -} - -godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point) { - godot_aabb dest; - const AABB *self = (const AABB *)p_self; - const Vector3 *to_point = (const Vector3 *)p_to_point; - *((AABB *)&dest) = self->expand(*to_point); - return dest; -} - -godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by) { - godot_aabb dest; - const AABB *self = (const AABB *)p_self; - - *((AABB *)&dest) = self->grow(p_by); - return dest; -} - -godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx) { - godot_vector3 dest; - const AABB *self = (const AABB *)p_self; - - *((Vector3 *)&dest) = self->get_endpoint(p_idx); - return dest; +void GDAPI godot_aabb_new(godot_aabb *p_self) { + memnew_placement(p_self, AABB); } -godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b) { - const AABB *self = (const AABB *)p_self; - const AABB *b = (const AABB *)p_b; - return *self == *b; +void GDAPI godot_aabb_new_copy(godot_aabb *r_dest, const godot_aabb *p_src) { + memnew_placement(r_dest, AABB(*(AABB *)p_src)); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp index 59953f5182..76e131dc06 100644 --- a/modules/gdnative/gdnative/array.cpp +++ b/modules/gdnative/gdnative/array.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,358 +30,35 @@ #include "gdnative/array.h" -#include "core/array.h" #include "core/os/memory.h" +#include "core/variant/array.h" -#include "core/color.h" - -#include "core/variant.h" +static_assert(sizeof(godot_array) == sizeof(Array), "Array size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_array) == sizeof(Array), "Array size mismatch"); - -void GDAPI godot_array_new(godot_array *r_dest) { - Array *dest = (Array *)r_dest; - memnew_placement(dest, Array); +void GDAPI godot_array_new(godot_array *p_self) { + memnew_placement(p_self, Array); } void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) { - Array *dest = (Array *)r_dest; - const Array *src = (const Array *)p_src; - memnew_placement(dest, Array(*src)); -} - -void GDAPI godot_array_new_packed_color_array(godot_array *r_dest, const godot_packed_color_array *p_pca) { - Array *dest = (Array *)r_dest; - Vector<Color> *pca = (Vector<Color> *)p_pca; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_vector3_array(godot_array *r_dest, const godot_packed_vector3_array *p_pv3a) { - Array *dest = (Array *)r_dest; - Vector<Vector3> *pca = (Vector<Vector3> *)p_pv3a; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_vector2_array(godot_array *r_dest, const godot_packed_vector2_array *p_pv2a) { - Array *dest = (Array *)r_dest; - Vector<Vector2> *pca = (Vector<Vector2> *)p_pv2a; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_string_array(godot_array *r_dest, const godot_packed_string_array *p_psa) { - Array *dest = (Array *)r_dest; - Vector<String> *pca = (Vector<String> *)p_psa; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_float32_array(godot_array *r_dest, const godot_packed_float32_array *p_pra) { - Array *dest = (Array *)r_dest; - Vector<float> *pca = (Vector<float> *)p_pra; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_float64_array(godot_array *r_dest, const godot_packed_float64_array *p_pra) { - Array *dest = (Array *)r_dest; - Vector<double> *pca = (Vector<double> *)p_pra; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_int32_array(godot_array *r_dest, const godot_packed_int32_array *p_pia) { - Array *dest = (Array *)r_dest; - Vector<int32_t> *pca = (Vector<int32_t> *)p_pia; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_int64_array(godot_array *r_dest, const godot_packed_int64_array *p_pia) { - Array *dest = (Array *)r_dest; - Vector<int64_t> *pca = (Vector<int64_t> *)p_pia; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_new_packed_byte_array(godot_array *r_dest, const godot_packed_byte_array *p_pba) { - Array *dest = (Array *)r_dest; - Vector<uint8_t> *pca = (Vector<uint8_t> *)p_pba; - memnew_placement(dest, Array); - dest->resize(pca->size()); - - for (int i = 0; i < dest->size(); i++) { - Variant v = pca->operator[](i); - dest->operator[](i) = v; - } -} - -void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value) { - Array *self = (Array *)p_self; - Variant *val = (Variant *)p_value; - self->operator[](p_idx) = *val; -} - -godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx) { - godot_variant raw_dest; - Variant *dest = (Variant *)&raw_dest; - const Array *self = (const Array *)p_self; - memnew_placement(dest, Variant(self->operator[](p_idx))); - return raw_dest; -} - -godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx) { - Array *self = (Array *)p_self; - return (godot_variant *)&self->operator[](p_idx); -} - -const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx) { - const Array *self = (const Array *)p_self; - return (const godot_variant *)&self->operator[](p_idx); -} - -void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value) { - Array *self = (Array *)p_self; - Variant *val = (Variant *)p_value; - self->append(*val); -} - -void GDAPI godot_array_clear(godot_array *p_self) { - Array *self = (Array *)p_self; - self->clear(); -} - -godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value) { - const Array *self = (const Array *)p_self; - const Variant *val = (const Variant *)p_value; - return self->count(*val); -} - -godot_bool GDAPI godot_array_empty(const godot_array *p_self) { - const Array *self = (const Array *)p_self; - return self->empty(); -} - -void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value) { - Array *self = (Array *)p_self; - const Variant *val = (const Variant *)p_value; - self->erase(*val); -} - -godot_variant GDAPI godot_array_front(const godot_array *p_self) { - const Array *self = (const Array *)p_self; - godot_variant v; - Variant *val = (Variant *)&v; - memnew_placement(val, Variant); - *val = self->front(); - return v; -} - -godot_variant GDAPI godot_array_back(const godot_array *p_self) { - const Array *self = (const Array *)p_self; - godot_variant v; - Variant *val = (Variant *)&v; - memnew_placement(val, Variant); - *val = self->back(); - return v; -} - -godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) { - const Array *self = (const Array *)p_self; - const Variant *val = (const Variant *)p_what; - return self->find(*val, p_from); -} - -godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what) { - const Array *self = (const Array *)p_self; - const Variant *val = (const Variant *)p_what; - return self->find_last(*val); -} - -godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value) { - const Array *self = (const Array *)p_self; - const Variant *val = (const Variant *)p_value; - return self->has(*val); -} - -godot_int GDAPI godot_array_hash(const godot_array *p_self) { - const Array *self = (const Array *)p_self; - return self->hash(); -} - -void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value) { - Array *self = (Array *)p_self; - const Variant *val = (const Variant *)p_value; - self->insert(p_pos, *val); -} - -void GDAPI godot_array_invert(godot_array *p_self) { - Array *self = (Array *)p_self; - self->invert(); -} - -godot_variant GDAPI godot_array_pop_back(godot_array *p_self) { - Array *self = (Array *)p_self; - godot_variant v; - Variant *val = (Variant *)&v; - memnew_placement(val, Variant); - *val = self->pop_back(); - return v; -} - -godot_variant GDAPI godot_array_pop_front(godot_array *p_self) { - Array *self = (Array *)p_self; - godot_variant v; - Variant *val = (Variant *)&v; - memnew_placement(val, Variant); - *val = self->pop_front(); - return v; -} - -void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value) { - Array *self = (Array *)p_self; - const Variant *val = (const Variant *)p_value; - self->push_back(*val); -} - -void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value) { - Array *self = (Array *)p_self; - const Variant *val = (const Variant *)p_value; - self->push_front(*val); -} - -void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx) { - Array *self = (Array *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size) { - Array *self = (Array *)p_self; - self->resize(p_size); -} - -godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) { - const Array *self = (const Array *)p_self; - const Variant *val = (const Variant *)p_what; - return self->rfind(*val, p_from); -} - -godot_int GDAPI godot_array_size(const godot_array *p_self) { - const Array *self = (const Array *)p_self; - return self->size(); -} - -void GDAPI godot_array_sort(godot_array *p_self) { - Array *self = (Array *)p_self; - self->sort(); -} - -void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func) { - Array *self = (Array *)p_self; - const String *func = (const String *)p_func; - self->sort_custom((Object *)p_obj, *func); -} - -godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before) { - Array *self = (Array *)p_self; - return self->bsearch(*(const Variant *)p_value, p_before); -} - -godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before) { - Array *self = (Array *)p_self; - const String *func = (const String *)p_func; - return self->bsearch_custom(*(const Variant *)p_value, (Object *)p_obj, *func, p_before); + memnew_placement(r_dest, Array(*(Array *)p_src)); } void GDAPI godot_array_destroy(godot_array *p_self) { ((Array *)p_self)->~Array(); } -godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_bool p_deep) { - const Array *self = (const Array *)p_self; - godot_array res; - Array *val = (Array *)&res; - memnew_placement(val, Array); - *val = self->duplicate(p_deep); - return res; -} - -godot_array GDAPI godot_array_slice(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep) { - const Array *self = (const Array *)p_self; - godot_array res; - Array *val = (Array *)&res; - memnew_placement(val, Array); - *val = self->slice(p_begin, p_end, p_step, p_deep); - return res; -} - -godot_variant GDAPI godot_array_max(const godot_array *p_self) { - const Array *self = (const Array *)p_self; - godot_variant v; - Variant *val = (Variant *)&v; - memnew_placement(val, Variant); - *val = self->max(); - return v; +godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, godot_int p_index) { + Array *self = (Array *)p_self; + return (godot_variant *)&self->operator[](p_index); } -godot_variant GDAPI godot_array_min(const godot_array *p_self) { +const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, godot_int p_index) { const Array *self = (const Array *)p_self; - godot_variant v; - Variant *val = (Variant *)&v; - memnew_placement(val, Variant); - *val = self->min(); - return v; -} - -void GDAPI godot_array_shuffle(godot_array *p_self) { - Array *self = (Array *)p_self; - self->shuffle(); + return (const godot_variant *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp index 990fd3795d..4641f0bacc 100644 --- a/modules/gdnative/gdnative/basis.cpp +++ b/modules/gdnative/gdnative/basis.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,266 +31,29 @@ #include "gdnative/basis.h" #include "core/math/basis.h" -#include "core/variant.h" + +static_assert(sizeof(godot_basis) == sizeof(Basis), "Basis size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_basis) == sizeof(Basis), "Basis size mismatch"); - -void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis) { - const Vector3 *x_axis = (const Vector3 *)p_x_axis; - const Vector3 *y_axis = (const Vector3 *)p_y_axis; - const Vector3 *z_axis = (const Vector3 *)p_z_axis; - Basis *dest = (Basis *)r_dest; - *dest = Basis(*x_axis, *y_axis, *z_axis); +void GDAPI godot_basis_new(godot_basis *p_self) { + memnew_placement(p_self, Basis); } -void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi) { - const Vector3 *axis = (const Vector3 *)p_axis; - Basis *dest = (Basis *)r_dest; - *dest = Basis(*axis, p_phi); +void GDAPI godot_basis_new_copy(godot_basis *r_dest, const godot_basis *p_src) { + memnew_placement(r_dest, Basis(*(Basis *)p_src)); } -void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler) { - const Vector3 *euler = (const Vector3 *)p_euler; - Basis *dest = (Basis *)r_dest; - *dest = Basis(*euler); -} - -godot_string GDAPI godot_basis_as_string(const godot_basis *p_self) { - godot_string ret; - const Basis *self = (const Basis *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self) { - godot_basis dest; - const Basis *self = (const Basis *)p_self; - *((Basis *)&dest) = self->inverse(); - return dest; -} - -godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self) { - godot_basis dest; - const Basis *self = (const Basis *)p_self; - *((Basis *)&dest) = self->transposed(); - return dest; -} - -godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self) { - godot_basis dest; - const Basis *self = (const Basis *)p_self; - *((Basis *)&dest) = self->orthonormalized(); - return dest; -} - -godot_real GDAPI godot_basis_determinant(const godot_basis *p_self) { - const Basis *self = (const Basis *)p_self; - return self->determinant(); -} - -godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi) { - godot_basis dest; - const Basis *self = (const Basis *)p_self; - const Vector3 *axis = (const Vector3 *)p_axis; - *((Basis *)&dest) = self->rotated(*axis, p_phi); - return dest; -} - -godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale) { - godot_basis dest; - const Basis *self = (const Basis *)p_self; - const Vector3 *scale = (const Vector3 *)p_scale; - *((Basis *)&dest) = self->scaled(*scale); - return dest; -} - -godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self) { - godot_vector3 dest; - const Basis *self = (const Basis *)p_self; - *((Vector3 *)&dest) = self->get_scale(); - return dest; -} - -godot_quat GDAPI godot_basis_get_quat(const godot_basis *p_self) { - godot_quat dest; - const Basis *self = (const Basis *)p_self; - *((Quat *)&dest) = self->get_quat(); - return dest; -} - -void GDAPI godot_basis_set_quat(godot_basis *p_self, const godot_quat *p_quat) { - Basis *self = (Basis *)p_self; - const Quat *quat = (const Quat *)p_quat; - self->set_quat(*quat); -} - -void GDAPI godot_basis_set_axis_angle_scale(godot_basis *p_self, const godot_vector3 *p_axis, godot_real p_phi, const godot_vector3 *p_scale) { - Basis *self = (Basis *)p_self; - const Vector3 *axis = (const Vector3 *)p_axis; - const Vector3 *scale = (const Vector3 *)p_scale; - self->set_axis_angle_scale(*axis, p_phi, *scale); -} - -void GDAPI godot_basis_set_euler_scale(godot_basis *p_self, const godot_vector3 *p_euler, const godot_vector3 *p_scale) { - Basis *self = (Basis *)p_self; - const Vector3 *euler = (const Vector3 *)p_euler; - const Vector3 *scale = (const Vector3 *)p_scale; - self->set_euler_scale(*euler, *scale); -} - -void GDAPI godot_basis_set_quat_scale(godot_basis *p_self, const godot_quat *p_quat, const godot_vector3 *p_scale) { +godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index) { Basis *self = (Basis *)p_self; - const Quat *quat = (const Quat *)p_quat; - const Vector3 *scale = (const Vector3 *)p_scale; - self->set_quat_scale(*quat, *scale); -} - -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self) { - godot_vector3 dest; - const Basis *self = (const Basis *)p_self; - *((Vector3 *)&dest) = self->get_euler(); - return dest; -} - -godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with) { - const Basis *self = (const Basis *)p_self; - const Vector3 *with = (const Vector3 *)p_with; - return self->tdotx(*with); -} - -godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with) { - const Basis *self = (const Basis *)p_self; - const Vector3 *with = (const Vector3 *)p_with; - return self->tdoty(*with); -} - -godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with) { - const Basis *self = (const Basis *)p_self; - const Vector3 *with = (const Vector3 *)p_with; - return self->tdotz(*with); -} - -godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v) { - godot_vector3 dest; - const Basis *self = (const Basis *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - *((Vector3 *)&dest) = self->xform(*v); - return dest; -} - -godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v) { - godot_vector3 dest; - const Basis *self = (const Basis *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - *((Vector3 *)&dest) = self->xform_inv(*v); - return dest; -} - -godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self) { - const Basis *self = (const Basis *)p_self; - return self->get_orthogonal_index(); -} - -void GDAPI godot_basis_new(godot_basis *r_dest) { - Basis *dest = (Basis *)r_dest; - *dest = Basis(); -} - -void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler) { - Basis *dest = (Basis *)r_dest; - const Quat *euler = (const Quat *)p_euler; - *dest = Basis(*euler); -} - -// p_elements is a pointer to an array of 3 (!!) vector3 -void GDAPI godot_basis_get_elements(const godot_basis *p_self, godot_vector3 *p_elements) { - const Basis *self = (const Basis *)p_self; - Vector3 *elements = (Vector3 *)p_elements; - elements[0] = self->elements[0]; - elements[1] = self->elements[1]; - elements[2] = self->elements[2]; -} - -godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis) { - godot_vector3 dest; - Vector3 *d = (Vector3 *)&dest; - const Basis *self = (const Basis *)p_self; - *d = self->get_axis(p_axis); - return dest; -} - -void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value) { - Basis *self = (Basis *)p_self; - const Vector3 *value = (const Vector3 *)p_value; - self->set_axis(p_axis, *value); -} - -godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row) { - godot_vector3 dest; - Vector3 *d = (Vector3 *)&dest; - const Basis *self = (const Basis *)p_self; - *d = self->get_row(p_row); - return dest; -} - -void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value) { - Basis *self = (Basis *)p_self; - const Vector3 *value = (const Vector3 *)p_value; - self->set_row(p_row, *value); -} - -godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b) { - const Basis *self = (const Basis *)p_self; - const Basis *b = (const Basis *)p_b; - return *self == *b; -} - -godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b) { - godot_basis raw_dest; - Basis *dest = (Basis *)&raw_dest; - const Basis *self = (const Basis *)p_self; - const Basis *b = (const Basis *)p_b; - *dest = *self + *b; - return raw_dest; -} - -godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b) { - godot_basis raw_dest; - Basis *dest = (Basis *)&raw_dest; - const Basis *self = (const Basis *)p_self; - const Basis *b = (const Basis *)p_b; - *dest = *self - *b; - return raw_dest; -} - -godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b) { - godot_basis raw_dest; - Basis *dest = (Basis *)&raw_dest; - const Basis *self = (const Basis *)p_self; - const Basis *b = (const Basis *)p_b; - *dest = *self * *b; - return raw_dest; -} - -godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b) { - godot_basis raw_dest; - Basis *dest = (Basis *)&raw_dest; - const Basis *self = (const Basis *)p_self; - *dest = *self * p_b; - return raw_dest; + return (godot_vector3 *)&self->operator[](p_index); } -godot_basis GDAPI godot_basis_slerp(const godot_basis *p_self, const godot_basis *p_b, const godot_real p_t) { - godot_basis raw_dest; - Basis *dest = (Basis *)&raw_dest; +const godot_vector3 GDAPI *godot_basis_operator_index_const(const godot_basis *p_self, godot_int p_index) { const Basis *self = (const Basis *)p_self; - const Basis *b = (const Basis *)p_b; - *dest = self->slerp(*b, p_t); - return raw_dest; + return (const godot_vector3 *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/callable.cpp b/modules/gdnative/gdnative/callable.cpp index 868b324227..85274e5e22 100644 --- a/modules/gdnative/gdnative/callable.cpp +++ b/modules/gdnative/gdnative/callable.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,36 +30,21 @@ #include "gdnative/callable.h" -#include "core/callable.h" -#include "core/resource.h" -#include "core/variant.h" +#include "core/variant/callable.h" +#include "core/variant/variant.h" + +static_assert(sizeof(godot_callable) == sizeof(Callable), "Callable size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_callable) == sizeof(Callable), "Callable size mismatch"); -static_assert(sizeof(godot_signal) == sizeof(Signal), "Signal size mismatch"); - -// Callable - -void GDAPI godot_callable_new_with_object(godot_callable *r_dest, const godot_object *p_object, const godot_string_name *p_method) { - Callable *dest = (Callable *)r_dest; - const Object *object = (const Object *)p_object; - const StringName *method = (const StringName *)p_method; - memnew_placement(dest, Callable(object, *method)); -} - -void GDAPI godot_callable_new_with_object_id(godot_callable *r_dest, uint64_t p_objectid, const godot_string_name *p_method) { - Callable *dest = (Callable *)r_dest; - const StringName *method = (const StringName *)p_method; - memnew_placement(dest, Callable(ObjectID(p_objectid), *method)); +void GDAPI godot_callable_new(godot_callable *p_self) { + memnew_placement(p_self, Callable); } void GDAPI godot_callable_new_copy(godot_callable *r_dest, const godot_callable *p_src) { - Callable *dest = (Callable *)r_dest; - const Callable *src = (const Callable *)p_src; - memnew_placement(dest, Callable(*src)); + memnew_placement(r_dest, Callable(*(Callable *)p_src)); } void GDAPI godot_callable_destroy(godot_callable *p_self) { @@ -67,186 +52,6 @@ void GDAPI godot_callable_destroy(godot_callable *p_self) { self->~Callable(); } -godot_int GDAPI godot_callable_call(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount, godot_variant *r_return_value) { - const Callable *self = (const Callable *)p_self; - const Variant **arguments = (const Variant **)p_arguments; - Variant *return_value = (Variant *)r_return_value; - Variant ret; - Callable::CallError err; - self->call(arguments, p_argcount, ret, err); - if (return_value) - (*return_value) = ret; - return (godot_int)err.error; -} - -void GDAPI godot_callable_call_deferred(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount) { - const Callable *self = (const Callable *)p_self; - const Variant **arguments = (const Variant **)p_arguments; - self->call_deferred(arguments, p_argcount); -} - -godot_bool GDAPI godot_callable_is_null(const godot_callable *p_self) { - const Callable *self = (const Callable *)p_self; - return self->is_null(); -} - -godot_bool GDAPI godot_callable_is_custom(const godot_callable *p_self) { - const Callable *self = (const Callable *)p_self; - return self->is_custom(); -} - -godot_bool GDAPI godot_callable_is_standard(const godot_callable *p_self) { - const Callable *self = (const Callable *)p_self; - return self->is_standard(); -} - -godot_object GDAPI *godot_callable_get_object(const godot_callable *p_self) { - const Callable *self = (const Callable *)p_self; - return (godot_object *)self->get_object(); -} - -uint64_t GDAPI godot_callable_get_object_id(const godot_callable *p_self) { - const Callable *self = (const Callable *)p_self; - return (uint64_t)self->get_object_id(); -} - -godot_string_name GDAPI godot_callable_get_method(const godot_callable *p_self) { - godot_string_name raw_dest; - const Callable *self = (const Callable *)p_self; - StringName *dest = (StringName *)&raw_dest; - memnew_placement(dest, StringName(self->get_method())); - return raw_dest; -} - -uint32_t GDAPI godot_callable_hash(const godot_callable *p_self) { - const Callable *self = (const Callable *)p_self; - return self->hash(); -} - -godot_string GDAPI godot_callable_as_string(const godot_callable *p_self) { - godot_string ret; - const Callable *self = (const Callable *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_bool GDAPI godot_callable_operator_equal(const godot_callable *p_self, const godot_callable *p_other) { - const Callable *self = (const Callable *)p_self; - const Callable *other = (const Callable *)p_other; - return *self == *other; -} - -godot_bool GDAPI godot_callable_operator_less(const godot_callable *p_self, const godot_callable *p_other) { - const Callable *self = (const Callable *)p_self; - const Callable *other = (const Callable *)p_other; - return *self < *other; -} - -// Signal - -void GDAPI godot_signal_new_with_object(godot_signal *r_dest, const godot_object *p_object, const godot_string_name *p_name) { - Signal *dest = (Signal *)r_dest; - const Object *object = (const Object *)p_object; - const StringName *name = (const StringName *)p_name; - memnew_placement(dest, Signal(object, *name)); -} - -void GDAPI godot_signal_new_with_object_id(godot_signal *r_dest, uint64_t p_objectid, const godot_string_name *p_name) { - Signal *dest = (Signal *)r_dest; - const StringName *name = (const StringName *)p_name; - memnew_placement(dest, Signal(ObjectID(p_objectid), *name)); -} - -void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src) { - Signal *dest = (Signal *)r_dest; - const Signal *src = (const Signal *)p_src; - memnew_placement(dest, Signal(*src)); -} - -void GDAPI godot_signal_destroy(godot_signal *p_self) { - Signal *self = (Signal *)p_self; - self->~Signal(); -} - -godot_int GDAPI godot_signal_emit(const godot_signal *p_self, const godot_variant **p_arguments, godot_int p_argcount) { - const Signal *self = (const Signal *)p_self; - const Variant **arguments = (const Variant **)p_arguments; - return (godot_int)self->emit(arguments, p_argcount); -} - -godot_int GDAPI godot_signal_connect(godot_signal *p_self, const godot_callable *p_callable, const godot_array *p_binds, uint32_t p_flags) { - Signal *self = (Signal *)p_self; - const Callable *callable = (const Callable *)p_callable; - const Array *binds_ar = (const Array *)p_binds; - Vector<Variant> binds; - for (int i = 0; i < binds_ar->size(); i++) { - binds.push_back(binds_ar->get(i)); - } - return (godot_int)self->connect(*callable, binds, p_flags); -} - -void GDAPI godot_signal_disconnect(godot_signal *p_self, const godot_callable *p_callable) { - Signal *self = (Signal *)p_self; - const Callable *callable = (const Callable *)p_callable; - self->disconnect(*callable); -} - -godot_bool GDAPI godot_signal_is_null(const godot_signal *p_self) { - const Signal *self = (const Signal *)p_self; - return self->is_null(); -} - -godot_bool GDAPI godot_signal_is_connected(const godot_signal *p_self, const godot_callable *p_callable) { - const Signal *self = (const Signal *)p_self; - const Callable *callable = (const Callable *)p_callable; - return self->is_connected(*callable); -} - -godot_array GDAPI godot_signal_get_connections(const godot_signal *p_self) { - godot_array raw_dest; - const Signal *self = (const Signal *)p_self; - Array *dest = (Array *)&raw_dest; - memnew_placement(dest, Array(self->get_connections())); - return raw_dest; -} - -godot_object GDAPI *godot_signal_get_object(const godot_signal *p_self) { - const Signal *self = (const Signal *)p_self; - return (godot_object *)self->get_object(); -} - -uint64_t GDAPI godot_signal_get_object_id(const godot_signal *p_self) { - const Signal *self = (const Signal *)p_self; - return (uint64_t)self->get_object_id(); -} - -godot_string_name GDAPI godot_signal_get_name(const godot_signal *p_self) { - godot_string_name raw_dest; - const Signal *self = (const Signal *)p_self; - StringName *dest = (StringName *)&raw_dest; - memnew_placement(dest, StringName(self->get_name())); - return raw_dest; -} - -godot_string GDAPI godot_signal_as_string(const godot_signal *p_self) { - godot_string ret; - const Signal *self = (const Signal *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_bool GDAPI godot_signal_operator_equal(const godot_signal *p_self, const godot_signal *p_other) { - const Signal *self = (const Signal *)p_self; - const Signal *other = (const Signal *)p_other; - return *self == *other; -} - -godot_bool GDAPI godot_signal_operator_less(const godot_signal *p_self, const godot_signal *p_other) { - const Signal *self = (const Signal *)p_self; - const Signal *other = (const Signal *)p_other; - return *self < *other; -} - #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp index c75e74daba..502f89c027 100644 --- a/modules/gdnative/gdnative/color.cpp +++ b/modules/gdnative/gdnative/color.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,186 +30,30 @@ #include "gdnative/color.h" -#include "core/color.h" -#include "core/variant.h" +#include "core/math/color.h" + +static_assert(sizeof(godot_color) == sizeof(Color), "Color size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_color) == sizeof(Color), "Color size mismatch"); - -void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a) { - Color *dest = (Color *)r_dest; - *dest = Color(p_r, p_g, p_b, p_a); -} - -void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b) { - Color *dest = (Color *)r_dest; - *dest = Color(p_r, p_g, p_b); -} - -godot_real godot_color_get_r(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->r; -} - -void godot_color_set_r(godot_color *p_self, const godot_real val) { - Color *self = (Color *)p_self; - self->r = val; -} - -godot_real godot_color_get_g(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->g; -} - -void godot_color_set_g(godot_color *p_self, const godot_real val) { - Color *self = (Color *)p_self; - self->g = val; -} - -godot_real godot_color_get_b(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->b; -} - -void godot_color_set_b(godot_color *p_self, const godot_real val) { - Color *self = (Color *)p_self; - self->b = val; +void GDAPI godot_color_new(godot_color *p_self) { + memnew_placement(p_self, Color); } -godot_real godot_color_get_a(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->a; +void GDAPI godot_color_new_copy(godot_color *r_dest, const godot_color *p_src) { + memnew_placement(r_dest, Color(*(Color *)p_src)); } -void godot_color_set_a(godot_color *p_self, const godot_real val) { +float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index) { Color *self = (Color *)p_self; - self->a = val; -} - -godot_real godot_color_get_h(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->get_h(); -} - -godot_real godot_color_get_s(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->get_s(); -} - -godot_real godot_color_get_v(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->get_v(); -} - -godot_string GDAPI godot_color_as_string(const godot_color *p_self) { - godot_string ret; - const Color *self = (const Color *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->to_rgba32(); -} - -godot_int GDAPI godot_color_to_abgr32(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->to_abgr32(); -} - -godot_int GDAPI godot_color_to_abgr64(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->to_abgr64(); -} - -godot_int GDAPI godot_color_to_argb64(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->to_argb64(); -} - -godot_int GDAPI godot_color_to_rgba64(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->to_rgba64(); -} - -godot_int GDAPI godot_color_to_argb32(const godot_color *p_self) { - const Color *self = (const Color *)p_self; - return self->to_argb32(); -} - -godot_color GDAPI godot_color_inverted(const godot_color *p_self) { - godot_color dest; - const Color *self = (const Color *)p_self; - *((Color *)&dest) = self->inverted(); - return dest; -} - -godot_color GDAPI godot_color_contrasted(const godot_color *p_self) { - godot_color dest; - const Color *self = (const Color *)p_self; - *((Color *)&dest) = self->contrasted(); - return dest; -} - -godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t) { - godot_color dest; - const Color *self = (const Color *)p_self; - const Color *b = (const Color *)p_b; - *((Color *)&dest) = self->lerp(*b, p_t); - return dest; -} - -godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over) { - godot_color dest; - const Color *self = (const Color *)p_self; - const Color *over = (const Color *)p_over; - *((Color *)&dest) = self->blend(*over); - return dest; -} - -godot_color GDAPI godot_color_darkened(const godot_color *p_self, const godot_real p_amount) { - godot_color dest; - const Color *self = (const Color *)p_self; - *((Color *)&dest) = self->darkened(p_amount); - return dest; -} - -godot_color GDAPI godot_color_from_hsv(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a) { - godot_color dest; - const Color *self = (const Color *)p_self; - *((Color *)&dest) = self->from_hsv(p_h, p_s, p_v, p_a); - return dest; -} - -godot_color GDAPI godot_color_lightened(const godot_color *p_self, const godot_real p_amount) { - godot_color dest; - const Color *self = (const Color *)p_self; - *((Color *)&dest) = self->lightened(p_amount); - return dest; -} - -godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha) { - godot_string dest; - const Color *self = (const Color *)p_self; - - memnew_placement(&dest, String(self->to_html(p_with_alpha))); - return dest; -} - -godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b) { - const Color *self = (const Color *)p_self; - const Color *b = (const Color *)p_b; - return *self == *b; + return (float *)&self->operator[](p_index); } -godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b) { +const float GDAPI *godot_color_operator_index_const(const godot_color *p_self, godot_int p_index) { const Color *self = (const Color *)p_self; - const Color *b = (const Color *)p_b; - return *self < *b; + return (const float *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp index a126974815..2bfad6e695 100644 --- a/modules/gdnative/gdnative/dictionary.cpp +++ b/modules/gdnative/gdnative/dictionary.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,26 +30,21 @@ #include "gdnative/dictionary.h" -#include "core/variant.h" -// core/variant.h before to avoid compile errors with MSVC -#include "core/dictionary.h" -#include "core/io/json.h" +#include "core/variant/dictionary.h" +#include "core/variant/variant.h" + +static_assert(sizeof(godot_dictionary) == sizeof(Dictionary), "Dictionary size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_dictionary) == sizeof(Dictionary), "Dictionary size mismatch"); - -void GDAPI godot_dictionary_new(godot_dictionary *r_dest) { - Dictionary *dest = (Dictionary *)r_dest; - memnew_placement(dest, Dictionary); +void GDAPI godot_dictionary_new(godot_dictionary *p_self) { + memnew_placement(p_self, Dictionary); } void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src) { - Dictionary *dest = (Dictionary *)r_dest; - const Dictionary *src = (const Dictionary *)p_src; - memnew_placement(dest, Dictionary(*src)); + memnew_placement(r_dest, Dictionary(*(Dictionary *)p_src)); } void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) { @@ -57,133 +52,14 @@ void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) { self->~Dictionary(); } -godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep) { - const Dictionary *self = (const Dictionary *)p_self; - godot_dictionary res; - Dictionary *val = (Dictionary *)&res; - memnew_placement(val, Dictionary); - *val = self->duplicate(p_deep); - return res; -} - -godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self) { - const Dictionary *self = (const Dictionary *)p_self; - return self->size(); -} - -godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self) { - const Dictionary *self = (const Dictionary *)p_self; - return self->empty(); -} - -void GDAPI godot_dictionary_clear(godot_dictionary *p_self) { - Dictionary *self = (Dictionary *)p_self; - self->clear(); -} - -godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key) { - const Dictionary *self = (const Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - return self->has(*key); -} - -godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys) { - const Dictionary *self = (const Dictionary *)p_self; - const Array *keys = (const Array *)p_keys; - return self->has_all(*keys); -} - -void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key) { - Dictionary *self = (Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - self->erase(*key); -} - -godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self) { - const Dictionary *self = (const Dictionary *)p_self; - return self->hash(); -} - -godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self) { - godot_array dest; - const Dictionary *self = (const Dictionary *)p_self; - memnew_placement(&dest, Array(self->keys())); - return dest; -} - -godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) { - godot_array dest; - const Dictionary *self = (const Dictionary *)p_self; - memnew_placement(&dest, Array(self->values())); - return dest; -} - -godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key) { - godot_variant raw_dest; - Variant *dest = (Variant *)&raw_dest; - const Dictionary *self = (const Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - memnew_placement(dest, Variant(self->operator[](*key))); - return raw_dest; -} - -void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value) { - Dictionary *self = (Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - const Variant *value = (const Variant *)p_value; - self->operator[](*key) = *value; -} - godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) { Dictionary *self = (Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - return (godot_variant *)&self->operator[](*key); + return (godot_variant *)&self->operator[](*((const Variant *)p_key)); } const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key) { const Dictionary *self = (const Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - return (const godot_variant *)&self->operator[](*key); -} - -godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key) { - Dictionary *self = (Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - return (godot_variant *)self->next(key); -} - -godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) { - const Dictionary *self = (const Dictionary *)p_self; - const Dictionary *b = (const Dictionary *)p_b; - return *self == *b; -} - -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self) { - godot_string raw_dest; - String *dest = (String *)&raw_dest; - const Dictionary *self = (const Dictionary *)p_self; - memnew_placement(dest, String(JSON::print(Variant(*self)))); - return raw_dest; -} - -// GDNative core 1.1 - -godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key) { - Dictionary *self = (Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - return self->erase(*key); -} - -godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default) { - const Dictionary *self = (const Dictionary *)p_self; - const Variant *key = (const Variant *)p_key; - const Variant *def = (const Variant *)p_default; - - godot_variant raw_dest; - Variant *dest = (Variant *)&raw_dest; - memnew_placement(dest, Variant(self->get(*key, *def))); - - return raw_dest; + return (const godot_variant *)&self->operator[](*((const Variant *)p_key)); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp index e94190b07b..b84ce2d192 100644 --- a/modules/gdnative/gdnative/gdnative.cpp +++ b/modules/gdnative/gdnative/gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,12 +30,12 @@ #include "gdnative/gdnative.h" -#include "core/class_db.h" -#include "core/engine.h" -#include "core/error_macros.h" -#include "core/global_constants.h" +#include "core/config/engine.h" +#include "core/core_constants.h" +#include "core/error/error_macros.h" +#include "core/object/class_db.h" #include "core/os/os.h" -#include "core/variant.h" +#include "core/variant/variant.h" #include "modules/gdnative/gdnative.h" @@ -99,12 +99,12 @@ godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classnam godot_dictionary GDAPI godot_get_global_constants() { godot_dictionary constants; - godot_dictionary_new(&constants); + memnew_placement(&constants, Dictionary); Dictionary *p_constants = (Dictionary *)&constants; - const int constants_count = GlobalConstants::get_global_constant_count(); + const int constants_count = CoreConstants::get_global_constant_count(); for (int i = 0; i < constants_count; ++i) { - const char *name = GlobalConstants::get_global_constant_name(i); - int value = GlobalConstants::get_global_constant_value(i); + const char *name = CoreConstants::get_global_constant_name(i); + int value = CoreConstants::get_global_constant_value(i); (*p_constants)[name] = value; } return constants; @@ -127,16 +127,15 @@ void GDAPI godot_free(void *p_ptr) { memfree(p_ptr); } +// Helper print functions. void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line) { _err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_ERROR); } - void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line) { _err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_WARNING); } - -void GDAPI godot_print(const godot_string *p_message) { - print_line(*(String *)p_message); +void GDAPI godot_print_script_error(const char *p_description, const char *p_function, const char *p_file, int p_line) { + _err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_SCRIPT); } void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have) { diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp index 88ed650ebe..57d67b9abb 100644 --- a/modules/gdnative/gdnative/node_path.cpp +++ b/modules/gdnative/gdnative/node_path.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,25 +30,20 @@ #include "gdnative/node_path.h" -#include "core/node_path.h" -#include "core/variant.h" +#include "core/string/node_path.h" + +static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch"); - -void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from) { - NodePath *dest = (NodePath *)r_dest; - const String *from = (const String *)p_from; - memnew_placement(dest, NodePath(*from)); +void GDAPI godot_node_path_new(godot_node_path *p_self) { + memnew_placement(p_self, NodePath); } void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) { - NodePath *dest = (NodePath *)r_dest; - const NodePath *src = (const NodePath *)p_src; - memnew_placement(dest, NodePath(*src)); + memnew_placement(r_dest, NodePath(*(NodePath *)p_src)); } void GDAPI godot_node_path_destroy(godot_node_path *p_self) { @@ -56,71 +51,6 @@ void GDAPI godot_node_path_destroy(godot_node_path *p_self) { self->~NodePath(); } -godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self) { - godot_string ret; - const NodePath *self = (const NodePath *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self) { - const NodePath *self = (const NodePath *)p_self; - return self->is_absolute(); -} - -godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self) { - const NodePath *self = (const NodePath *)p_self; - return self->get_name_count(); -} - -godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx) { - godot_string dest; - const NodePath *self = (const NodePath *)p_self; - - memnew_placement(&dest, String(self->get_name(p_idx))); - return dest; -} - -godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self) { - const NodePath *self = (const NodePath *)p_self; - return self->get_subname_count(); -} - -godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx) { - godot_string dest; - const NodePath *self = (const NodePath *)p_self; - - memnew_placement(&dest, String(self->get_subname(p_idx))); - return dest; -} - -godot_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self) { - godot_string dest; - const NodePath *self = (const NodePath *)p_self; - memnew_placement(&dest, String(self->get_concatenated_subnames())); - return dest; -} - -godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self) { - const NodePath *self = (const NodePath *)p_self; - return self->is_empty(); -} - -godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b) { - const NodePath *self = (const NodePath *)p_self; - const NodePath *b = (const NodePath *)p_b; - return *self == *b; -} - -godot_node_path godot_node_path_get_as_property_path(const godot_node_path *p_self) { - const NodePath *self = (const NodePath *)p_self; - godot_node_path res; - NodePath *val = (NodePath *)&res; - memnew_placement(val, NodePath); - *val = self->get_as_property_path(); - return res; -} - #ifdef __cplusplus } #endif diff --git a/modules/gdnative/gdnative/packed_arrays.cpp b/modules/gdnative/gdnative/packed_arrays.cpp index de93c1d9b3..f03c94aeb8 100644 --- a/modules/gdnative/gdnative/packed_arrays.cpp +++ b/modules/gdnative/gdnative/packed_arrays.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,997 +30,289 @@ #include "gdnative/packed_arrays.h" -#include "core/array.h" +#include "core/variant/variant.h" -#include "core/variant.h" - -#include "core/color.h" #include "core/math/vector2.h" -#include "core/math/vector3.h" +#include "core/math/vector3i.h" + +static_assert(sizeof(godot_packed_byte_array) == sizeof(PackedByteArray), "PackedByteArray size mismatch"); +static_assert(sizeof(godot_packed_int32_array) == sizeof(PackedInt32Array), "PackedInt32Array size mismatch"); +static_assert(sizeof(godot_packed_int64_array) == sizeof(PackedInt64Array), "PackedInt64Array size mismatch"); +static_assert(sizeof(godot_packed_float32_array) == sizeof(PackedFloat32Array), "PackedFloat32Array size mismatch"); +static_assert(sizeof(godot_packed_float64_array) == sizeof(PackedFloat64Array), "PackedFloat64Array size mismatch"); +static_assert(sizeof(godot_packed_string_array) == sizeof(PackedStringArray), "PackedStringArray size mismatch"); +static_assert(sizeof(godot_packed_vector2_array) == sizeof(PackedVector2Array), "PackedVector2Array size mismatch"); +static_assert(sizeof(godot_packed_vector2i_array) == sizeof(Vector<Vector2i>), "Vector<Vector2i> size mismatch"); +static_assert(sizeof(godot_packed_vector3_array) == sizeof(PackedVector3Array), "PackedVector3Array size mismatch"); +static_assert(sizeof(godot_packed_vector3i_array) == sizeof(Vector<Vector3i>), "Vector<Vector3i> size mismatch"); +static_assert(sizeof(godot_packed_color_array) == sizeof(PackedColorArray), "PackedColorArray size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_packed_byte_array) == sizeof(Vector<uint8_t>), "Vector<uint8_t> size mismatch"); -static_assert(sizeof(godot_packed_int32_array) == sizeof(Vector<int32_t>), "Vector<int32_t> size mismatch"); -static_assert(sizeof(godot_packed_int64_array) == sizeof(Vector<int64_t>), "Vector<int64_t> size mismatch"); -static_assert(sizeof(godot_packed_float32_array) == sizeof(Vector<float>), "Vector<float> size mismatch"); -static_assert(sizeof(godot_packed_float64_array) == sizeof(Vector<double>), "Vector<double> size mismatch"); -static_assert(sizeof(godot_packed_string_array) == sizeof(Vector<String>), "Vector<String> size mismatch"); -static_assert(sizeof(godot_packed_vector2_array) == sizeof(Vector<Vector2>), "Vector<Vector2> size mismatch"); -static_assert(sizeof(godot_packed_vector3_array) == sizeof(Vector<Vector3>), "Vector<Vector3> size mismatch"); -static_assert(sizeof(godot_packed_color_array) == sizeof(Vector<Color>), "Vector<Color> size mismatch"); - -#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) - // byte -void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *r_dest) { - Vector<uint8_t> *dest = (Vector<uint8_t> *)r_dest; - memnew_placement(dest, Vector<uint8_t>); +void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *p_self) { + memnew_placement(p_self, PackedByteArray); } void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src) { - Vector<uint8_t> *dest = (Vector<uint8_t> *)r_dest; - const Vector<uint8_t> *src = (const Vector<uint8_t> *)p_src; - memnew_placement(dest, Vector<uint8_t>(*src)); + memnew_placement(r_dest, PackedByteArray(*(PackedByteArray *)p_src)); } -void GDAPI godot_packed_byte_array_new_with_array(godot_packed_byte_array *r_dest, const godot_array *p_a) { - Vector<uint8_t> *dest = (Vector<uint8_t> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<uint8_t>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const uint8_t GDAPI *godot_packed_byte_array_ptr(const godot_packed_byte_array *p_self) { - const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; - return self->ptr(); -} - -uint8_t GDAPI *godot_packed_byte_array_ptrw(godot_packed_byte_array *p_self) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - return self->ptrw(); -} - -void GDAPI godot_packed_byte_array_append(godot_packed_byte_array *p_self, const uint8_t p_data) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_byte_array_append_array(godot_packed_byte_array *p_self, const godot_packed_byte_array *p_array) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - Vector<uint8_t> *array = (Vector<uint8_t> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_byte_array_insert(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - return (godot_error)self->insert(p_idx, p_data); -} - -godot_bool GDAPI godot_packed_byte_array_has(godot_packed_byte_array *p_self, const uint8_t p_value) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - return (godot_bool)self->has(p_value); -} - -void GDAPI godot_packed_byte_array_sort(godot_packed_byte_array *p_self) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_byte_array_invert(godot_packed_byte_array *p_self) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_byte_array_push_back(godot_packed_byte_array *p_self, const uint8_t p_data) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_byte_array_remove(godot_packed_byte_array *p_self, const godot_int p_idx) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_byte_array_resize(godot_packed_byte_array *p_self, const godot_int p_size) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_byte_array_set(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { - Vector<uint8_t> *self = (Vector<uint8_t> *)p_self; - self->set(p_idx, p_data); -} - -uint8_t GDAPI godot_packed_byte_array_get(const godot_packed_byte_array *p_self, const godot_int p_idx) { - const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; - return self->get(p_idx); +void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) { + ((PackedByteArray *)p_self)->~PackedByteArray(); } -godot_int GDAPI godot_packed_byte_array_size(const godot_packed_byte_array *p_self) { - const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; - return self->size(); +uint8_t GDAPI *godot_packed_byte_array_operator_index(godot_packed_byte_array *p_self, godot_int p_index) { + PackedByteArray *self = (PackedByteArray *)p_self; + return (uint8_t *)&self->operator[](p_index); } -godot_bool GDAPI godot_packed_byte_array_empty(const godot_packed_byte_array *p_self) { - const Vector<uint8_t> *self = (const Vector<uint8_t> *)p_self; - return self->empty(); -} - -void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) { - ((Vector<uint8_t> *)p_self)->~Vector(); +const uint8_t GDAPI *godot_packed_byte_array_operator_index_const(const godot_packed_byte_array *p_self, godot_int p_index) { + const PackedByteArray *self = (const PackedByteArray *)p_self; + return (const uint8_t *)&self->operator[](p_index); } // int32 -void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *r_dest) { - Vector<int32_t> *dest = (Vector<int32_t> *)r_dest; - memnew_placement(dest, Vector<int32_t>); +void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *p_self) { + memnew_placement(p_self, PackedInt32Array); } void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src) { - Vector<int32_t> *dest = (Vector<int32_t> *)r_dest; - const Vector<int32_t> *src = (const Vector<int32_t> *)p_src; - memnew_placement(dest, Vector<int32_t>(*src)); -} - -void GDAPI godot_packed_int32_array_new_with_array(godot_packed_int32_array *r_dest, const godot_array *p_a) { - Vector<int32_t> *dest = (Vector<int32_t> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<int32_t>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const int32_t GDAPI *godot_packed_int32_array_ptr(const godot_packed_int32_array *p_self) { - const Vector<int32_t> *self = (const Vector<int32_t> *)p_self; - return self->ptr(); -} - -int32_t GDAPI *godot_packed_int32_array_ptrw(godot_packed_int32_array *p_self) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - return self->ptrw(); -} - -void GDAPI godot_packed_int32_array_append(godot_packed_int32_array *p_self, const int32_t p_data) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_int32_array_append_array(godot_packed_int32_array *p_self, const godot_packed_int32_array *p_array) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - Vector<int32_t> *array = (Vector<int32_t> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_int32_array_insert(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - return (godot_error)self->insert(p_idx, p_data); -} - -godot_bool GDAPI godot_packed_int32_array_has(godot_packed_int32_array *p_self, const int32_t p_value) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - return (godot_bool)self->has(p_value); + memnew_placement(r_dest, PackedInt32Array(*(PackedInt32Array *)p_src)); } -void GDAPI godot_packed_int32_array_sort(godot_packed_int32_array *p_self) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_int32_array_invert(godot_packed_int32_array *p_self) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_int32_array_push_back(godot_packed_int32_array *p_self, const int32_t p_data) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_int32_array_remove(godot_packed_int32_array *p_self, const godot_int p_idx) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_int32_array_resize(godot_packed_int32_array *p_self, const godot_int p_size) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_int32_array_set(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data) { - Vector<int32_t> *self = (Vector<int32_t> *)p_self; - self->set(p_idx, p_data); -} - -int32_t GDAPI godot_packed_int32_array_get(const godot_packed_int32_array *p_self, const godot_int p_idx) { - const Vector<int32_t> *self = (const Vector<int32_t> *)p_self; - return self->get(p_idx); -} - -godot_int GDAPI godot_packed_int32_array_size(const godot_packed_int32_array *p_self) { - const Vector<int32_t> *self = (const Vector<int32_t> *)p_self; - return self->size(); +void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self) { + ((PackedInt32Array *)p_self)->~PackedInt32Array(); } -godot_bool GDAPI godot_packed_int32_array_empty(const godot_packed_int32_array *p_self) { - const Vector<int32_t> *self = (const Vector<int32_t> *)p_self; - return self->empty(); +int32_t GDAPI *godot_packed_int32_array_operator_index(godot_packed_int32_array *p_self, godot_int p_index) { + PackedInt32Array *self = (PackedInt32Array *)p_self; + return (int32_t *)&self->operator[](p_index); } -void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self) { - ((Vector<int32_t> *)p_self)->~Vector(); +const int32_t GDAPI *godot_packed_int32_array_operator_index_const(const godot_packed_int32_array *p_self, godot_int p_index) { + const PackedInt32Array *self = (const PackedInt32Array *)p_self; + return (const int32_t *)&self->operator[](p_index); } // int64 -void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *r_dest) { - Vector<int64_t> *dest = (Vector<int64_t> *)r_dest; - memnew_placement(dest, Vector<int64_t>); +void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *p_self) { + memnew_placement(p_self, PackedInt64Array); } void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src) { - Vector<int64_t> *dest = (Vector<int64_t> *)r_dest; - const Vector<int64_t> *src = (const Vector<int64_t> *)p_src; - memnew_placement(dest, Vector<int64_t>(*src)); + memnew_placement(r_dest, PackedInt64Array(*(PackedInt64Array *)p_src)); } -void GDAPI godot_packed_int64_array_new_with_array(godot_packed_int64_array *r_dest, const godot_array *p_a) { - Vector<int64_t> *dest = (Vector<int64_t> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<int64_t>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const int64_t GDAPI *godot_packed_int64_array_ptr(const godot_packed_int64_array *p_self) { - const Vector<int64_t> *self = (const Vector<int64_t> *)p_self; - return self->ptr(); -} - -int64_t GDAPI *godot_packed_int64_array_ptrw(godot_packed_int64_array *p_self) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - return self->ptrw(); -} - -void GDAPI godot_packed_int64_array_append(godot_packed_int64_array *p_self, const int64_t p_data) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_int64_array_append_array(godot_packed_int64_array *p_self, const godot_packed_int64_array *p_array) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - Vector<int64_t> *array = (Vector<int64_t> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_int64_array_insert(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - return (godot_error)self->insert(p_idx, p_data); -} - -godot_bool GDAPI godot_packed_int64_array_has(godot_packed_int64_array *p_self, const int64_t p_value) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - return (godot_bool)self->has(p_value); -} - -void GDAPI godot_packed_int64_array_sort(godot_packed_int64_array *p_self) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_int64_array_invert(godot_packed_int64_array *p_self) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_int64_array_push_back(godot_packed_int64_array *p_self, const int64_t p_data) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_int64_array_remove(godot_packed_int64_array *p_self, const godot_int p_idx) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_int64_array_resize(godot_packed_int64_array *p_self, const godot_int p_size) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_int64_array_set(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data) { - Vector<int64_t> *self = (Vector<int64_t> *)p_self; - self->set(p_idx, p_data); -} - -int64_t GDAPI godot_packed_int64_array_get(const godot_packed_int64_array *p_self, const godot_int p_idx) { - const Vector<int64_t> *self = (const Vector<int64_t> *)p_self; - return self->get(p_idx); -} - -godot_int GDAPI godot_packed_int64_array_size(const godot_packed_int64_array *p_self) { - const Vector<int64_t> *self = (const Vector<int64_t> *)p_self; - return self->size(); +void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self) { + ((PackedInt64Array *)p_self)->~PackedInt64Array(); } -godot_bool GDAPI godot_packed_int64_array_empty(const godot_packed_int64_array *p_self) { - const Vector<int64_t> *self = (const Vector<int64_t> *)p_self; - return self->empty(); +int64_t GDAPI *godot_packed_int64_array_operator_index(godot_packed_int64_array *p_self, godot_int p_index) { + PackedInt64Array *self = (PackedInt64Array *)p_self; + return (int64_t *)&self->operator[](p_index); } -void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self) { - ((Vector<int64_t> *)p_self)->~Vector(); +const int64_t GDAPI *godot_packed_int64_array_operator_index_const(const godot_packed_int64_array *p_self, godot_int p_index) { + const PackedInt64Array *self = (const PackedInt64Array *)p_self; + return (const int64_t *)&self->operator[](p_index); } // float32 -void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *r_dest) { - Vector<float> *dest = (Vector<float> *)r_dest; - memnew_placement(dest, Vector<float>); +void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *p_self) { + memnew_placement(p_self, PackedFloat32Array); } void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src) { - Vector<float> *dest = (Vector<float> *)r_dest; - const Vector<float> *src = (const Vector<float> *)p_src; - memnew_placement(dest, Vector<float>(*src)); + memnew_placement(r_dest, PackedFloat32Array(*(PackedFloat32Array *)p_src)); } -void GDAPI godot_packed_float32_array_new_with_array(godot_packed_float32_array *r_dest, const godot_array *p_a) { - Vector<float> *dest = (Vector<float> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<float>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const float GDAPI *godot_packed_float32_array_ptr(const godot_packed_float32_array *p_self) { - const Vector<float> *self = (const Vector<float> *)p_self; - return self->ptr(); -} - -float GDAPI *godot_packed_float32_array_ptrw(godot_packed_float32_array *p_self) { - Vector<float> *self = (Vector<float> *)p_self; - return self->ptrw(); -} - -void GDAPI godot_packed_float32_array_append(godot_packed_float32_array *p_self, const float p_data) { - Vector<float> *self = (Vector<float> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_float32_array_append_array(godot_packed_float32_array *p_self, const godot_packed_float32_array *p_array) { - Vector<float> *self = (Vector<float> *)p_self; - Vector<float> *array = (Vector<float> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_float32_array_insert(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data) { - Vector<float> *self = (Vector<float> *)p_self; - return (godot_error)self->insert(p_idx, p_data); -} - -godot_bool GDAPI godot_packed_float32_array_has(godot_packed_float32_array *p_self, const float p_value) { - Vector<float> *self = (Vector<float> *)p_self; - return (godot_bool)self->has(p_value); -} - -void GDAPI godot_packed_float32_array_sort(godot_packed_float32_array *p_self) { - Vector<float> *self = (Vector<float> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_float32_array_invert(godot_packed_float32_array *p_self) { - Vector<float> *self = (Vector<float> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_float32_array_push_back(godot_packed_float32_array *p_self, const float p_data) { - Vector<float> *self = (Vector<float> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_float32_array_remove(godot_packed_float32_array *p_self, const godot_int p_idx) { - Vector<float> *self = (Vector<float> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_float32_array_resize(godot_packed_float32_array *p_self, const godot_int p_size) { - Vector<float> *self = (Vector<float> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_float32_array_set(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data) { - Vector<float> *self = (Vector<float> *)p_self; - self->set(p_idx, p_data); -} - -float GDAPI godot_packed_float32_array_get(const godot_packed_float32_array *p_self, const godot_int p_idx) { - const Vector<float> *self = (const Vector<float> *)p_self; - return self->get(p_idx); -} - -godot_int GDAPI godot_packed_float32_array_size(const godot_packed_float32_array *p_self) { - const Vector<float> *self = (const Vector<float> *)p_self; - return self->size(); +void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self) { + ((PackedFloat32Array *)p_self)->~PackedFloat32Array(); } -godot_bool GDAPI godot_packed_float32_array_empty(const godot_packed_float32_array *p_self) { - const Vector<float> *self = (const Vector<float> *)p_self; - return self->empty(); +float GDAPI *godot_packed_float32_array_operator_index(godot_packed_float32_array *p_self, godot_int p_index) { + PackedFloat32Array *self = (PackedFloat32Array *)p_self; + return (float *)&self->operator[](p_index); } -void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self) { - ((Vector<float> *)p_self)->~Vector(); +const float GDAPI *godot_packed_float32_array_operator_index_const(const godot_packed_float32_array *p_self, godot_int p_index) { + const PackedFloat32Array *self = (const PackedFloat32Array *)p_self; + return (const float *)&self->operator[](p_index); } // float64 -void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *r_dest) { - Vector<double> *dest = (Vector<double> *)r_dest; - memnew_placement(dest, Vector<double>); +void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *p_self) { + memnew_placement(p_self, PackedFloat64Array); } void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src) { - Vector<double> *dest = (Vector<double> *)r_dest; - const Vector<double> *src = (const Vector<double> *)p_src; - memnew_placement(dest, Vector<double>(*src)); -} - -void GDAPI godot_packed_float64_array_new_with_array(godot_packed_float64_array *r_dest, const godot_array *p_a) { - Vector<double> *dest = (Vector<double> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<double>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } + memnew_placement(r_dest, PackedFloat64Array(*(PackedFloat64Array *)p_src)); } -const double GDAPI *godot_packed_float64_array_ptr(const godot_packed_float64_array *p_self) { - const Vector<double> *self = (const Vector<double> *)p_self; - return self->ptr(); -} - -double GDAPI *godot_packed_float64_array_ptrw(godot_packed_float64_array *p_self) { - Vector<double> *self = (Vector<double> *)p_self; - return self->ptrw(); -} - -void GDAPI godot_packed_float64_array_append(godot_packed_float64_array *p_self, const double p_data) { - Vector<double> *self = (Vector<double> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_float64_array_append_array(godot_packed_float64_array *p_self, const godot_packed_float64_array *p_array) { - Vector<double> *self = (Vector<double> *)p_self; - Vector<double> *array = (Vector<double> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_float64_array_insert(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data) { - Vector<double> *self = (Vector<double> *)p_self; - return (godot_error)self->insert(p_idx, p_data); -} - -godot_bool GDAPI godot_packed_float64_array_has(godot_packed_float64_array *p_self, const double p_value) { - Vector<double> *self = (Vector<double> *)p_self; - return (godot_bool)self->has(p_value); -} - -void GDAPI godot_packed_float64_array_sort(godot_packed_float64_array *p_self) { - Vector<double> *self = (Vector<double> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_float64_array_invert(godot_packed_float64_array *p_self) { - Vector<double> *self = (Vector<double> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_float64_array_push_back(godot_packed_float64_array *p_self, const double p_data) { - Vector<double> *self = (Vector<double> *)p_self; - self->push_back(p_data); -} - -void GDAPI godot_packed_float64_array_remove(godot_packed_float64_array *p_self, const godot_int p_idx) { - Vector<double> *self = (Vector<double> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_float64_array_resize(godot_packed_float64_array *p_self, const godot_int p_size) { - Vector<double> *self = (Vector<double> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_float64_array_set(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data) { - Vector<double> *self = (Vector<double> *)p_self; - self->set(p_idx, p_data); -} - -double GDAPI godot_packed_float64_array_get(const godot_packed_float64_array *p_self, const godot_int p_idx) { - const Vector<double> *self = (const Vector<double> *)p_self; - return self->get(p_idx); -} - -godot_int GDAPI godot_packed_float64_array_size(const godot_packed_float64_array *p_self) { - const Vector<double> *self = (const Vector<double> *)p_self; - return self->size(); +void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self) { + ((PackedFloat64Array *)p_self)->~PackedFloat64Array(); } -godot_bool GDAPI godot_packed_float64_array_empty(const godot_packed_float64_array *p_self) { - const Vector<double> *self = (const Vector<double> *)p_self; - return self->empty(); +double GDAPI *godot_packed_float64_array_operator_index(godot_packed_float64_array *p_self, godot_int p_index) { + PackedFloat64Array *self = (PackedFloat64Array *)p_self; + return (double *)&self->operator[](p_index); } -void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self) { - ((Vector<double> *)p_self)->~Vector(); +const double GDAPI *godot_packed_float64_array_operator_index_const(const godot_packed_float64_array *p_self, godot_int p_index) { + const PackedFloat64Array *self = (const PackedFloat64Array *)p_self; + return (const double *)&self->operator[](p_index); } // string -void GDAPI godot_packed_string_array_new(godot_packed_string_array *r_dest) { - Vector<String> *dest = (Vector<String> *)r_dest; - memnew_placement(dest, Vector<String>); +void GDAPI godot_packed_string_array_new(godot_packed_string_array *p_self) { + memnew_placement(p_self, PackedStringArray); } void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src) { - Vector<String> *dest = (Vector<String> *)r_dest; - const Vector<String> *src = (const Vector<String> *)p_src; - memnew_placement(dest, Vector<String>(*src)); -} - -void GDAPI godot_packed_string_array_new_with_array(godot_packed_string_array *r_dest, const godot_array *p_a) { - Vector<String> *dest = (Vector<String> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<String>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const godot_string GDAPI *godot_packed_string_array_ptr(const godot_packed_string_array *p_self) { - const Vector<String> *self = (const Vector<String> *)p_self; - return (const godot_string *)self->ptr(); + memnew_placement(r_dest, PackedStringArray(*(PackedStringArray *)p_src)); } -godot_string GDAPI *godot_packed_string_array_ptrw(godot_packed_string_array *p_self) { - Vector<String> *self = (Vector<String> *)p_self; - return (godot_string *)self->ptrw(); -} - -void GDAPI godot_packed_string_array_append(godot_packed_string_array *p_self, const godot_string *p_data) { - Vector<String> *self = (Vector<String> *)p_self; - String &s = *(String *)p_data; - self->push_back(s); -} - -void GDAPI godot_packed_string_array_append_array(godot_packed_string_array *p_self, const godot_packed_string_array *p_array) { - Vector<String> *self = (Vector<String> *)p_self; - Vector<String> *array = (Vector<String> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_string_array_insert(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { - Vector<String> *self = (Vector<String> *)p_self; - String &s = *(String *)p_data; - return (godot_error)self->insert(p_idx, s); -} - -godot_bool GDAPI godot_packed_string_array_has(godot_packed_string_array *p_self, const godot_string *p_value) { - Vector<String> *self = (Vector<String> *)p_self; - String &s = *(String *)p_value; - return (godot_bool)self->has(s); -} - -void GDAPI godot_packed_string_array_sort(godot_packed_string_array *p_self) { - Vector<String> *self = (Vector<String> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_string_array_invert(godot_packed_string_array *p_self) { - Vector<String> *self = (Vector<String> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_string_array_push_back(godot_packed_string_array *p_self, const godot_string *p_data) { - Vector<String> *self = (Vector<String> *)p_self; - String &s = *(String *)p_data; - self->push_back(s); -} - -void GDAPI godot_packed_string_array_remove(godot_packed_string_array *p_self, const godot_int p_idx) { - Vector<String> *self = (Vector<String> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_string_array_resize(godot_packed_string_array *p_self, const godot_int p_size) { - Vector<String> *self = (Vector<String> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_string_array_set(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { - Vector<String> *self = (Vector<String> *)p_self; - String &s = *(String *)p_data; - self->set(p_idx, s); -} - -godot_string GDAPI godot_packed_string_array_get(const godot_packed_string_array *p_self, const godot_int p_idx) { - const Vector<String> *self = (const Vector<String> *)p_self; - godot_string str; - String *s = (String *)&str; - memnew_placement(s, String); - *s = self->get(p_idx); - return str; -} - -godot_int GDAPI godot_packed_string_array_size(const godot_packed_string_array *p_self) { - const Vector<String> *self = (const Vector<String> *)p_self; - return self->size(); +void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self) { + ((PackedStringArray *)p_self)->~PackedStringArray(); } -godot_bool GDAPI godot_packed_string_array_empty(const godot_packed_string_array *p_self) { - const Vector<String> *self = (const Vector<String> *)p_self; - return self->empty(); +godot_string GDAPI *godot_packed_string_array_operator_index(godot_packed_string_array *p_self, godot_int p_index) { + PackedStringArray *self = (PackedStringArray *)p_self; + return (godot_string *)&self->operator[](p_index); } -void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self) { - ((Vector<String> *)p_self)->~Vector(); +const godot_string GDAPI *godot_packed_string_array_operator_index_const(const godot_packed_string_array *p_self, godot_int p_index) { + const PackedStringArray *self = (const PackedStringArray *)p_self; + return (const godot_string *)&self->operator[](p_index); } // vector2 -void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *r_dest) { - Vector<Vector2> *dest = (Vector<Vector2> *)r_dest; - memnew_placement(dest, Vector<Vector2>); +void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *p_self) { + memnew_placement(p_self, PackedVector2Array); } void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src) { - Vector<Vector2> *dest = (Vector<Vector2> *)r_dest; - const Vector<Vector2> *src = (const Vector<Vector2> *)p_src; - memnew_placement(dest, Vector<Vector2>(*src)); -} - -void GDAPI godot_packed_vector2_array_new_with_array(godot_packed_vector2_array *r_dest, const godot_array *p_a) { - Vector<Vector2> *dest = (Vector<Vector2> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<Vector2>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const godot_vector2 GDAPI *godot_packed_vector2_array_ptr(const godot_packed_vector2_array *p_self) { - const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; - return (const godot_vector2 *)self->ptr(); -} - -godot_vector2 GDAPI *godot_packed_vector2_array_ptrw(godot_packed_vector2_array *p_self) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - return (godot_vector2 *)self->ptrw(); -} - -void GDAPI godot_packed_vector2_array_append(godot_packed_vector2_array *p_self, const godot_vector2 *p_data) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - Vector2 &s = *(Vector2 *)p_data; - self->push_back(s); -} - -void GDAPI godot_packed_vector2_array_append_array(godot_packed_vector2_array *p_self, const godot_packed_vector2_array *p_array) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - Vector<Vector2> *array = (Vector<Vector2> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_vector2_array_insert(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - Vector2 &s = *(Vector2 *)p_data; - return (godot_error)self->insert(p_idx, s); -} - -godot_bool GDAPI godot_packed_vector2_array_has(godot_packed_vector2_array *p_self, const godot_vector2 *p_value) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - Vector2 &v = *(Vector2 *)p_value; - return (godot_bool)self->has(v); + memnew_placement(r_dest, PackedVector2Array(*(PackedVector2Array *)p_src)); } -void GDAPI godot_packed_vector2_array_sort(godot_packed_vector2_array *p_self) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_vector2_array_invert(godot_packed_vector2_array *p_self) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - self->invert(); +void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self) { + ((PackedVector2Array *)p_self)->~PackedVector2Array(); } -void GDAPI godot_packed_vector2_array_push_back(godot_packed_vector2_array *p_self, const godot_vector2 *p_data) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - Vector2 &s = *(Vector2 *)p_data; - self->push_back(s); +godot_vector2 GDAPI *godot_packed_vector2_array_operator_index(godot_packed_vector2_array *p_self, godot_int p_index) { + PackedVector2Array *self = (PackedVector2Array *)p_self; + return (godot_vector2 *)&self->operator[](p_index); } -void GDAPI godot_packed_vector2_array_remove(godot_packed_vector2_array *p_self, const godot_int p_idx) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - self->remove(p_idx); +const godot_vector2 GDAPI *godot_packed_vector2_array_operator_index_const(const godot_packed_vector2_array *p_self, godot_int p_index) { + const PackedVector2Array *self = (const PackedVector2Array *)p_self; + return (const godot_vector2 *)&self->operator[](p_index); } -void GDAPI godot_packed_vector2_array_resize(godot_packed_vector2_array *p_self, const godot_int p_size) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - self->resize(p_size); -} +// vector2i -void GDAPI godot_packed_vector2_array_set(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { - Vector<Vector2> *self = (Vector<Vector2> *)p_self; - Vector2 &s = *(Vector2 *)p_data; - self->set(p_idx, s); +void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self) { + memnew_placement(p_self, Vector<Vector2i>); } -godot_vector2 GDAPI godot_packed_vector2_array_get(const godot_packed_vector2_array *p_self, const godot_int p_idx) { - const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; - godot_vector2 v; - Vector2 *s = (Vector2 *)&v; - *s = self->get(p_idx); - return v; +void GDAPI godot_packed_vector2i_array_new_copy(godot_packed_vector2i_array *r_dest, const godot_packed_vector2i_array *p_src) { + memnew_placement(r_dest, Vector<Vector2i>(*(Vector<Vector2i> *)p_src)); } -godot_int GDAPI godot_packed_vector2_array_size(const godot_packed_vector2_array *p_self) { - const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; - return self->size(); +void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_self) { + ((Vector<Vector2i> *)p_self)->~Vector(); } -godot_bool GDAPI godot_packed_vector2_array_empty(const godot_packed_vector2_array *p_self) { - const Vector<Vector2> *self = (const Vector<Vector2> *)p_self; - return self->empty(); +godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index(godot_packed_vector2i_array *p_self, godot_int p_index) { + Vector<Vector2i> *self = (Vector<Vector2i> *)p_self; + return (godot_vector2i *)&self->operator[](p_index); } -void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self) { - ((Vector<Vector2> *)p_self)->~Vector(); +const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(const godot_packed_vector2i_array *p_self, godot_int p_index) { + const Vector<Vector2i> *self = (const Vector<Vector2i> *)p_self; + return (const godot_vector2i *)&self->operator[](p_index); } // vector3 -void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *r_dest) { - Vector<Vector3> *dest = (Vector<Vector3> *)r_dest; - memnew_placement(dest, Vector<Vector3>); +void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *p_self) { + memnew_placement(p_self, PackedVector3Array); } void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src) { - Vector<Vector3> *dest = (Vector<Vector3> *)r_dest; - const Vector<Vector3> *src = (const Vector<Vector3> *)p_src; - memnew_placement(dest, Vector<Vector3>(*src)); -} - -void GDAPI godot_packed_vector3_array_new_with_array(godot_packed_vector3_array *r_dest, const godot_array *p_a) { - Vector<Vector3> *dest = (Vector<Vector3> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<Vector3>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } + memnew_placement(r_dest, PackedVector3Array(*(PackedVector3Array *)p_src)); } -const godot_vector3 GDAPI *godot_packed_vector3_array_ptr(const godot_packed_vector3_array *p_self) { - const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; - return (const godot_vector3 *)self->ptr(); -} - -godot_vector3 GDAPI *godot_packed_vector3_array_ptrw(godot_packed_vector3_array *p_self) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - return (godot_vector3 *)self->ptrw(); -} - -void GDAPI godot_packed_vector3_array_append(godot_packed_vector3_array *p_self, const godot_vector3 *p_data) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - Vector3 &s = *(Vector3 *)p_data; - self->push_back(s); -} - -void GDAPI godot_packed_vector3_array_append_array(godot_packed_vector3_array *p_self, const godot_packed_vector3_array *p_array) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - Vector<Vector3> *array = (Vector<Vector3> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_vector3_array_insert(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - Vector3 &s = *(Vector3 *)p_data; - return (godot_error)self->insert(p_idx, s); -} - -godot_bool GDAPI godot_packed_vector3_array_has(godot_packed_vector3_array *p_self, const godot_vector3 *p_value) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - Vector3 &v = *(Vector3 *)p_value; - return (godot_bool)self->has(v); -} - -void GDAPI godot_packed_vector3_array_sort(godot_packed_vector3_array *p_self) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - self->sort(); +void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self) { + ((PackedVector3Array *)p_self)->~PackedVector3Array(); } -void GDAPI godot_packed_vector3_array_invert(godot_packed_vector3_array *p_self) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - self->invert(); +godot_vector3 GDAPI *godot_packed_vector3_array_operator_index(godot_packed_vector3_array *p_self, godot_int p_index) { + PackedVector3Array *self = (PackedVector3Array *)p_self; + return (godot_vector3 *)&self->operator[](p_index); } -void GDAPI godot_packed_vector3_array_push_back(godot_packed_vector3_array *p_self, const godot_vector3 *p_data) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - Vector3 &s = *(Vector3 *)p_data; - self->push_back(s); +const godot_vector3 GDAPI *godot_packed_vector3_array_operator_index_const(const godot_packed_vector3_array *p_self, godot_int p_index) { + const PackedVector3Array *self = (const PackedVector3Array *)p_self; + return (const godot_vector3 *)&self->operator[](p_index); } -void GDAPI godot_packed_vector3_array_remove(godot_packed_vector3_array *p_self, const godot_int p_idx) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - self->remove(p_idx); -} +// vector3i -void GDAPI godot_packed_vector3_array_resize(godot_packed_vector3_array *p_self, const godot_int p_size) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - self->resize(p_size); +void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self) { + memnew_placement(p_self, Vector<Vector3i>); } -void GDAPI godot_packed_vector3_array_set(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { - Vector<Vector3> *self = (Vector<Vector3> *)p_self; - Vector3 &s = *(Vector3 *)p_data; - self->set(p_idx, s); +void GDAPI godot_packed_vector3i_array_new_copy(godot_packed_vector3i_array *r_dest, const godot_packed_vector3i_array *p_src) { + memnew_placement(r_dest, Vector<Vector3i>(*(Vector<Vector3i> *)p_src)); } -godot_vector3 GDAPI godot_packed_vector3_array_get(const godot_packed_vector3_array *p_self, const godot_int p_idx) { - const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; - godot_vector3 v; - Vector3 *s = (Vector3 *)&v; - *s = self->get(p_idx); - return v; +void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_self) { + ((Vector<Vector3i> *)p_self)->~Vector(); } -godot_int GDAPI godot_packed_vector3_array_size(const godot_packed_vector3_array *p_self) { - const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; - return self->size(); +godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index(godot_packed_vector3i_array *p_self, godot_int p_index) { + Vector<Vector3i> *self = (Vector<Vector3i> *)p_self; + return (godot_vector3i *)&self->operator[](p_index); } -godot_bool GDAPI godot_packed_vector3_array_empty(const godot_packed_vector3_array *p_self) { - const Vector<Vector3> *self = (const Vector<Vector3> *)p_self; - return self->empty(); -} - -void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self) { - ((Vector<Vector3> *)p_self)->~Vector(); +const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(const godot_packed_vector3i_array *p_self, godot_int p_index) { + const Vector<Vector3i> *self = (const Vector<Vector3i> *)p_self; + return (const godot_vector3i *)&self->operator[](p_index); } // color -void GDAPI godot_packed_color_array_new(godot_packed_color_array *r_dest) { - Vector<Color> *dest = (Vector<Color> *)r_dest; - memnew_placement(dest, Vector<Color>); +void GDAPI godot_packed_color_array_new(godot_packed_color_array *p_self) { + memnew_placement(p_self, PackedColorArray); } void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src) { - Vector<Color> *dest = (Vector<Color> *)r_dest; - const Vector<Color> *src = (const Vector<Color> *)p_src; - memnew_placement(dest, Vector<Color>(*src)); -} - -void GDAPI godot_packed_color_array_new_with_array(godot_packed_color_array *r_dest, const godot_array *p_a) { - Vector<Color> *dest = (Vector<Color> *)r_dest; - Array *a = (Array *)p_a; - memnew_placement(dest, Vector<Color>); - - dest->resize(a->size()); - for (int i = 0; i < a->size(); i++) { - dest->set(i, (*a)[i]); - } -} - -const godot_color GDAPI *godot_packed_color_array_ptr(const godot_packed_color_array *p_self) { - const Vector<Color> *self = (const Vector<Color> *)p_self; - return (const godot_color *)self->ptr(); -} - -godot_color GDAPI *godot_packed_color_array_ptrw(godot_packed_color_array *p_self) { - Vector<Color> *self = (Vector<Color> *)p_self; - return (godot_color *)self->ptrw(); -} - -void GDAPI godot_packed_color_array_append(godot_packed_color_array *p_self, const godot_color *p_data) { - Vector<Color> *self = (Vector<Color> *)p_self; - Color &s = *(Color *)p_data; - self->push_back(s); -} - -void GDAPI godot_packed_color_array_append_array(godot_packed_color_array *p_self, const godot_packed_color_array *p_array) { - Vector<Color> *self = (Vector<Color> *)p_self; - Vector<Color> *array = (Vector<Color> *)p_array; - self->append_array(*array); -} - -godot_error GDAPI godot_packed_color_array_insert(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { - Vector<Color> *self = (Vector<Color> *)p_self; - Color &s = *(Color *)p_data; - return (godot_error)self->insert(p_idx, s); -} - -godot_bool GDAPI godot_packed_color_array_has(godot_packed_color_array *p_self, const godot_color *p_value) { - Vector<Color> *self = (Vector<Color> *)p_self; - Color &c = *(Color *)p_value; - return (godot_bool)self->has(c); + memnew_placement(r_dest, PackedColorArray(*(PackedColorArray *)p_src)); } -void GDAPI godot_packed_color_array_sort(godot_packed_color_array *p_self) { - Vector<Color> *self = (Vector<Color> *)p_self; - self->sort(); -} - -void GDAPI godot_packed_color_array_invert(godot_packed_color_array *p_self) { - Vector<Color> *self = (Vector<Color> *)p_self; - self->invert(); -} - -void GDAPI godot_packed_color_array_push_back(godot_packed_color_array *p_self, const godot_color *p_data) { - Vector<Color> *self = (Vector<Color> *)p_self; - Color &s = *(Color *)p_data; - self->push_back(s); -} - -void GDAPI godot_packed_color_array_remove(godot_packed_color_array *p_self, const godot_int p_idx) { - Vector<Color> *self = (Vector<Color> *)p_self; - self->remove(p_idx); -} - -void GDAPI godot_packed_color_array_resize(godot_packed_color_array *p_self, const godot_int p_size) { - Vector<Color> *self = (Vector<Color> *)p_self; - self->resize(p_size); -} - -void GDAPI godot_packed_color_array_set(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { - Vector<Color> *self = (Vector<Color> *)p_self; - Color &s = *(Color *)p_data; - self->set(p_idx, s); -} - -godot_color GDAPI godot_packed_color_array_get(const godot_packed_color_array *p_self, const godot_int p_idx) { - const Vector<Color> *self = (const Vector<Color> *)p_self; - godot_color v; - Color *s = (Color *)&v; - *s = self->get(p_idx); - return v; -} - -godot_int GDAPI godot_packed_color_array_size(const godot_packed_color_array *p_self) { - const Vector<Color> *self = (const Vector<Color> *)p_self; - return self->size(); +void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self) { + ((PackedColorArray *)p_self)->~PackedColorArray(); } -godot_bool GDAPI godot_packed_color_array_empty(const godot_packed_color_array *p_self) { - const Vector<Color> *self = (const Vector<Color> *)p_self; - return self->empty(); +godot_color GDAPI *godot_packed_color_array_operator_index(godot_packed_color_array *p_self, godot_int p_index) { + PackedColorArray *self = (PackedColorArray *)p_self; + return (godot_color *)&self->operator[](p_index); } -void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self) { - ((Vector<Color> *)p_self)->~Vector(); +const godot_color GDAPI *godot_packed_color_array_operator_index_const(const godot_packed_color_array *p_self, godot_int p_index) { + const PackedColorArray *self = (const PackedColorArray *)p_self; + return (const godot_color *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp index d4ed8d00f4..8b8e84e3c1 100644 --- a/modules/gdnative/gdnative/plane.cpp +++ b/modules/gdnative/gdnative/plane.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,139 +31,19 @@ #include "gdnative/plane.h" #include "core/math/plane.h" -#include "core/variant.h" + +static_assert(sizeof(godot_plane) == sizeof(Plane), "Plane size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_plane) == sizeof(Plane), "Plane size mismatch"); - -void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d) { - Plane *dest = (Plane *)r_dest; - *dest = Plane(p_a, p_b, p_c, p_d); -} - -void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3) { - const Vector3 *v1 = (const Vector3 *)p_v1; - const Vector3 *v2 = (const Vector3 *)p_v2; - const Vector3 *v3 = (const Vector3 *)p_v3; - Plane *dest = (Plane *)r_dest; - *dest = Plane(*v1, *v2, *v3); -} - -void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d) { - const Vector3 *normal = (const Vector3 *)p_normal; - Plane *dest = (Plane *)r_dest; - *dest = Plane(*normal, p_d); -} - -godot_string GDAPI godot_plane_as_string(const godot_plane *p_self) { - godot_string ret; - const Plane *self = (const Plane *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self) { - godot_plane dest; - const Plane *self = (const Plane *)p_self; - *((Plane *)&dest) = self->normalized(); - return dest; -} - -godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self) { - godot_vector3 dest; - const Plane *self = (const Plane *)p_self; - *((Vector3 *)&dest) = self->center(); - return dest; -} - -godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point) { - const Plane *self = (const Plane *)p_self; - const Vector3 *point = (const Vector3 *)p_point; - return self->is_point_over(*point); -} - -godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point) { - const Plane *self = (const Plane *)p_self; - const Vector3 *point = (const Vector3 *)p_point; - return self->distance_to(*point); -} - -godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon) { - const Plane *self = (const Plane *)p_self; - const Vector3 *point = (const Vector3 *)p_point; - return self->has_point(*point, p_epsilon); -} - -godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point) { - godot_vector3 dest; - const Plane *self = (const Plane *)p_self; - const Vector3 *point = (const Vector3 *)p_point; - *((Vector3 *)&dest) = self->project(*point); - return dest; -} - -godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c) { - const Plane *self = (const Plane *)p_self; - const Plane *b = (const Plane *)p_b; - const Plane *c = (const Plane *)p_c; - Vector3 *dest = (Vector3 *)r_dest; - return self->intersect_3(*b, *c, dest); -} - -godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir) { - const Plane *self = (const Plane *)p_self; - const Vector3 *from = (const Vector3 *)p_from; - const Vector3 *dir = (const Vector3 *)p_dir; - Vector3 *dest = (Vector3 *)r_dest; - return self->intersects_ray(*from, *dir, dest); -} - -godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end) { - const Plane *self = (const Plane *)p_self; - const Vector3 *begin = (const Vector3 *)p_begin; - const Vector3 *end = (const Vector3 *)p_end; - Vector3 *dest = (Vector3 *)r_dest; - return self->intersects_segment(*begin, *end, dest); -} - -godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self) { - godot_plane raw_dest; - Plane *dest = (Plane *)&raw_dest; - const Plane *self = (const Plane *)p_self; - *dest = -(*self); - return raw_dest; -} - -godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b) { - const Plane *self = (const Plane *)p_self; - const Plane *b = (const Plane *)p_b; - return *self == *b; -} - -void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal) { - Plane *self = (Plane *)p_self; - const Vector3 *normal = (const Vector3 *)p_normal; - self->set_normal(*normal); -} - -godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self) { - const Plane *self = (const Plane *)p_self; - const Vector3 normal = self->get_normal(); - godot_vector3 *v3 = (godot_vector3 *)&normal; - return *v3; -} - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_self) { - const Plane *self = (const Plane *)p_self; - return self->d; +void GDAPI godot_plane_new(godot_plane *p_self) { + memnew_placement(p_self, Plane); } -void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d) { - Plane *self = (Plane *)p_self; - self->d = p_d; +void GDAPI godot_plane_new_copy(godot_plane *r_dest, const godot_plane *p_src) { + memnew_placement(r_dest, Plane(*(Plane *)p_src)); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quat.cpp deleted file mode 100644 index de6308ad2a..0000000000 --- a/modules/gdnative/gdnative/quat.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/*************************************************************************/ -/* quat.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "gdnative/quat.h" - -#include "core/math/quat.h" -#include "core/variant.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static_assert(sizeof(godot_quat) == sizeof(Quat), "Quat size mismatch"); - -void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w) { - Quat *dest = (Quat *)r_dest; - *dest = Quat(p_x, p_y, p_z, p_w); -} - -void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle) { - const Vector3 *axis = (const Vector3 *)p_axis; - Quat *dest = (Quat *)r_dest; - *dest = Quat(*axis, p_angle); -} - -void GDAPI godot_quat_new_with_basis(godot_quat *r_dest, const godot_basis *p_basis) { - const Basis *basis = (const Basis *)p_basis; - Quat *dest = (Quat *)r_dest; - *dest = Quat(*basis); -} - -void GDAPI godot_quat_new_with_euler(godot_quat *r_dest, const godot_vector3 *p_euler) { - const Vector3 *euler = (const Vector3 *)p_euler; - Quat *dest = (Quat *)r_dest; - *dest = Quat(*euler); -} - -godot_real GDAPI godot_quat_get_x(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->x; -} - -void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val) { - Quat *self = (Quat *)p_self; - self->x = val; -} - -godot_real GDAPI godot_quat_get_y(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->y; -} - -void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val) { - Quat *self = (Quat *)p_self; - self->y = val; -} - -godot_real GDAPI godot_quat_get_z(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->z; -} - -void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val) { - Quat *self = (Quat *)p_self; - self->z = val; -} - -godot_real GDAPI godot_quat_get_w(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->w; -} - -void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val) { - Quat *self = (Quat *)p_self; - self->w = val; -} - -godot_string GDAPI godot_quat_as_string(const godot_quat *p_self) { - godot_string ret; - const Quat *self = (const Quat *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_real GDAPI godot_quat_length(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->length(); -} - -godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->length_squared(); -} - -godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self) { - godot_quat dest; - const Quat *self = (const Quat *)p_self; - *((Quat *)&dest) = self->normalized(); - return dest; -} - -godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self) { - const Quat *self = (const Quat *)p_self; - return self->is_normalized(); -} - -godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self) { - godot_quat dest; - const Quat *self = (const Quat *)p_self; - *((Quat *)&dest) = self->inverse(); - return dest; -} - -godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b) { - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - return self->dot(*b); -} - -godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v) { - godot_vector3 dest; - const Quat *self = (const Quat *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - *((Vector3 *)&dest) = self->xform(*v); - return dest; -} - -godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) { - godot_quat dest; - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - *((Quat *)&dest) = self->slerp(*b, p_t); - return dest; -} - -godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t) { - godot_quat dest; - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - *((Quat *)&dest) = self->slerpni(*b, p_t); - return dest; -} - -godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t) { - godot_quat dest; - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - const Quat *pre_a = (const Quat *)p_pre_a; - const Quat *post_b = (const Quat *)p_post_b; - *((Quat *)&dest) = self->cubic_slerp(*b, *pre_a, *post_b, p_t); - return dest; -} - -godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b) { - godot_quat raw_dest; - Quat *dest = (Quat *)&raw_dest; - const Quat *self = (const Quat *)p_self; - *dest = *self * p_b; - return raw_dest; -} - -godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b) { - godot_quat raw_dest; - Quat *dest = (Quat *)&raw_dest; - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - *dest = *self + *b; - return raw_dest; -} - -godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b) { - godot_quat raw_dest; - Quat *dest = (Quat *)&raw_dest; - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - *dest = *self - *b; - return raw_dest; -} - -godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b) { - godot_quat raw_dest; - Quat *dest = (Quat *)&raw_dest; - const Quat *self = (const Quat *)p_self; - *dest = *self / p_b; - return raw_dest; -} - -godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b) { - const Quat *self = (const Quat *)p_self; - const Quat *b = (const Quat *)p_b; - return *self == *b; -} - -godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self) { - godot_quat raw_dest; - Quat *dest = (Quat *)&raw_dest; - const Quat *self = (const Quat *)p_self; - *dest = -(*self); - return raw_dest; -} - -void GDAPI godot_quat_set_axis_angle(godot_quat *p_self, const godot_vector3 *p_axis, const godot_real p_angle) { - Quat *self = (Quat *)p_self; - const Vector3 *axis = (const Vector3 *)p_axis; - self->set_axis_angle(*axis, p_angle); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/quaternion.cpp b/modules/gdnative/gdnative/quaternion.cpp new file mode 100644 index 0000000000..62bcbbd382 --- /dev/null +++ b/modules/gdnative/gdnative/quaternion.cpp @@ -0,0 +1,61 @@ +/*************************************************************************/ +/* quaternion.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "gdnative/quaternion.h" + +#include "core/math/quaternion.h" + +static_assert(sizeof(godot_quaternion) == sizeof(Quaternion), "Quaternion size mismatch"); + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_quaternion_new(godot_quaternion *p_self) { + memnew_placement(p_self, Quaternion); +} + +void GDAPI godot_quaternion_new_copy(godot_quaternion *r_dest, const godot_quaternion *p_src) { + memnew_placement(r_dest, Quaternion(*(Quaternion *)p_src)); +} + +godot_real_t GDAPI *godot_quaternion_operator_index(godot_quaternion *p_self, godot_int p_index) { + Quaternion *self = (Quaternion *)p_self; + return (godot_real_t *)&self->operator[](p_index); +} + +const godot_real_t GDAPI *godot_quaternion_operator_index_const(const godot_quaternion *p_self, godot_int p_index) { + const Quaternion *self = (const Quaternion *)p_self; + return (const godot_real_t *)&self->operator[](p_index); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/gdnative/rect2.cpp b/modules/gdnative/gdnative/rect2.cpp index 516f4d75ce..a196a63188 100644 --- a/modules/gdnative/gdnative/rect2.cpp +++ b/modules/gdnative/gdnative/rect2.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,300 +30,29 @@ #include "gdnative/rect2.h" -#include "core/math/transform_2d.h" -#include "core/variant.h" - -#ifdef __cplusplus -extern "C" { -#endif +#include "core/math/rect2.h" static_assert(sizeof(godot_rect2) == sizeof(Rect2), "Rect2 size mismatch"); static_assert(sizeof(godot_rect2i) == sizeof(Rect2i), "Rect2i size mismatch"); -// Rect2 - -void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) { - const Vector2 *position = (const Vector2 *)p_pos; - const Vector2 *size = (const Vector2 *)p_size; - Rect2 *dest = (Rect2 *)r_dest; - *dest = Rect2(*position, *size); -} - -void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height) { - Rect2 *dest = (Rect2 *)r_dest; - *dest = Rect2(p_x, p_y, p_width, p_height); -} - -godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self) { - godot_string ret; - const Rect2 *self = (const Rect2 *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_rect2i GDAPI godot_rect2_as_rect2i(const godot_rect2 *p_self) { - godot_rect2i dest; - const Rect2 *self = (const Rect2 *)p_self; - *((Rect2i *)&dest) = Rect2i(*self); - return dest; -} - -godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self) { - const Rect2 *self = (const Rect2 *)p_self; - return self->get_area(); -} - -godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b) { - const Rect2 *self = (const Rect2 *)p_self; - const Rect2 *b = (const Rect2 *)p_b; - return self->intersects(*b); -} - -godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b) { - const Rect2 *self = (const Rect2 *)p_self; - const Rect2 *b = (const Rect2 *)p_b; - return self->encloses(*b); -} - -godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self) { - const Rect2 *self = (const Rect2 *)p_self; - return self->has_no_area(); -} - -godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - const Rect2 *b = (const Rect2 *)p_b; - *((Rect2 *)&dest) = self->clip(*b); - return dest; -} - -godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - const Rect2 *b = (const Rect2 *)p_b; - *((Rect2 *)&dest) = self->merge(*b); - return dest; -} - -godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point) { - const Rect2 *self = (const Rect2 *)p_self; - const Vector2 *point = (const Vector2 *)p_point; - return self->has_point(*point); -} - -godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - - *((Rect2 *)&dest) = self->grow(p_by); - return dest; -} - -godot_rect2 GDAPI godot_rect2_grow_individual(const godot_rect2 *p_self, const godot_real p_left, const godot_real p_top, const godot_real p_right, const godot_real p_bottom) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - *((Rect2 *)&dest) = self->grow_individual(p_left, p_top, p_right, p_bottom); - return dest; -} - -godot_rect2 GDAPI godot_rect2_grow_margin(const godot_rect2 *p_self, const godot_int p_margin, const godot_real p_by) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - *((Rect2 *)&dest) = self->grow_margin((Margin)p_margin, p_by); - return dest; -} - -godot_rect2 GDAPI godot_rect2_abs(const godot_rect2 *p_self) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - *((Rect2 *)&dest) = self->abs(); - return dest; -} - -godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to) { - godot_rect2 dest; - const Rect2 *self = (const Rect2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - *((Rect2 *)&dest) = self->expand(*to); - return dest; -} - -godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b) { - const Rect2 *self = (const Rect2 *)p_self; - const Rect2 *b = (const Rect2 *)p_b; - return *self == *b; -} - -godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self) { - godot_vector2 dest; - Vector2 *d = (Vector2 *)&dest; - const Rect2 *self = (const Rect2 *)p_self; - *d = self->get_position(); - return dest; -} - -godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self) { - godot_vector2 dest; - Vector2 *d = (Vector2 *)&dest; - const Rect2 *self = (const Rect2 *)p_self; - *d = self->get_size(); - return dest; -} - -void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos) { - Rect2 *self = (Rect2 *)p_self; - const Vector2 *position = (const Vector2 *)p_pos; - self->set_position(*position); -} - -void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size) { - Rect2 *self = (Rect2 *)p_self; - const Vector2 *size = (const Vector2 *)p_size; - self->set_size(*size); -} - -// Rect2i - -void GDAPI godot_rect2i_new_with_position_and_size(godot_rect2i *r_dest, const godot_vector2i *p_pos, const godot_vector2i *p_size) { - const Vector2i *position = (const Vector2i *)p_pos; - const Vector2i *size = (const Vector2i *)p_size; - Rect2i *dest = (Rect2i *)r_dest; - *dest = Rect2i(*position, *size); -} - -void GDAPI godot_rect2i_new(godot_rect2i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_width, const godot_int p_height) { - Rect2i *dest = (Rect2i *)r_dest; - *dest = Rect2i(p_x, p_y, p_width, p_height); -} - -godot_string GDAPI godot_rect2i_as_string(const godot_rect2i *p_self) { - godot_string ret; - const Rect2i *self = (const Rect2i *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_rect2 GDAPI godot_rect2i_as_rect2(const godot_rect2i *p_self) { - godot_rect2 dest; - const Rect2i *self = (const Rect2i *)p_self; - *((Rect2 *)&dest) = Rect2(*self); - return dest; -} - -godot_int GDAPI godot_rect2i_get_area(const godot_rect2i *p_self) { - const Rect2i *self = (const Rect2i *)p_self; - return self->get_area(); -} - -godot_bool GDAPI godot_rect2i_intersects(const godot_rect2i *p_self, const godot_rect2i *p_b) { - const Rect2i *self = (const Rect2i *)p_self; - const Rect2i *b = (const Rect2i *)p_b; - return self->intersects(*b); -} - -godot_bool GDAPI godot_rect2i_encloses(const godot_rect2i *p_self, const godot_rect2i *p_b) { - const Rect2i *self = (const Rect2i *)p_self; - const Rect2i *b = (const Rect2i *)p_b; - return self->encloses(*b); -} - -godot_bool GDAPI godot_rect2i_has_no_area(const godot_rect2i *p_self) { - const Rect2i *self = (const Rect2i *)p_self; - return self->has_no_area(); -} - -godot_rect2i GDAPI godot_rect2i_clip(const godot_rect2i *p_self, const godot_rect2i *p_b) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - const Rect2i *b = (const Rect2i *)p_b; - *((Rect2i *)&dest) = self->clip(*b); - return dest; -} - -godot_rect2i GDAPI godot_rect2i_merge(const godot_rect2i *p_self, const godot_rect2i *p_b) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - const Rect2i *b = (const Rect2i *)p_b; - *((Rect2i *)&dest) = self->merge(*b); - return dest; -} - -godot_bool GDAPI godot_rect2i_has_point(const godot_rect2i *p_self, const godot_vector2i *p_point) { - const Rect2i *self = (const Rect2i *)p_self; - const Vector2i *point = (const Vector2i *)p_point; - return self->has_point(*point); -} - -godot_rect2i GDAPI godot_rect2i_grow(const godot_rect2i *p_self, const godot_int p_by) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - - *((Rect2i *)&dest) = self->grow(p_by); - return dest; -} - -godot_rect2i GDAPI godot_rect2i_grow_individual(const godot_rect2i *p_self, const godot_int p_left, const godot_int p_top, const godot_int p_right, const godot_int p_bottom) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - *((Rect2i *)&dest) = self->grow_individual(p_left, p_top, p_right, p_bottom); - return dest; -} - -godot_rect2i GDAPI godot_rect2i_grow_margin(const godot_rect2i *p_self, const godot_int p_margin, const godot_int p_by) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - *((Rect2i *)&dest) = self->grow_margin((Margin)p_margin, p_by); - return dest; -} - -godot_rect2i GDAPI godot_rect2i_abs(const godot_rect2i *p_self) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - *((Rect2i *)&dest) = self->abs(); - return dest; -} - -godot_rect2i GDAPI godot_rect2i_expand(const godot_rect2i *p_self, const godot_vector2i *p_to) { - godot_rect2i dest; - const Rect2i *self = (const Rect2i *)p_self; - const Vector2i *to = (const Vector2i *)p_to; - *((Rect2i *)&dest) = self->expand(*to); - return dest; -} - -godot_bool GDAPI godot_rect2i_operator_equal(const godot_rect2i *p_self, const godot_rect2i *p_b) { - const Rect2i *self = (const Rect2i *)p_self; - const Rect2i *b = (const Rect2i *)p_b; - return *self == *b; -} +#ifdef __cplusplus +extern "C" { +#endif -godot_vector2i GDAPI godot_rect2i_get_position(const godot_rect2i *p_self) { - godot_vector2i dest; - Vector2i *d = (Vector2i *)&dest; - const Rect2i *self = (const Rect2i *)p_self; - *d = self->get_position(); - return dest; +void GDAPI godot_rect2_new(godot_rect2 *p_self) { + memnew_placement(p_self, Rect2); } -godot_vector2i GDAPI godot_rect2i_get_size(const godot_rect2i *p_self) { - godot_vector2i dest; - Vector2i *d = (Vector2i *)&dest; - const Rect2i *self = (const Rect2i *)p_self; - *d = self->get_size(); - return dest; +void GDAPI godot_rect2_new_copy(godot_rect2 *r_dest, const godot_rect2 *p_src) { + memnew_placement(r_dest, Rect2(*(Rect2 *)p_src)); } -void GDAPI godot_rect2i_set_position(godot_rect2i *p_self, const godot_vector2i *p_pos) { - Rect2i *self = (Rect2i *)p_self; - const Vector2i *position = (const Vector2i *)p_pos; - self->set_position(*position); +void GDAPI godot_rect2i_new(godot_rect2i *p_self) { + memnew_placement(p_self, Rect2i); } -void GDAPI godot_rect2i_set_size(godot_rect2i *p_self, const godot_vector2i *p_size) { - Rect2i *self = (Rect2i *)p_self; - const Vector2i *size = (const Vector2i *)p_size; - self->set_size(*size); +void GDAPI godot_rect2i_new_copy(godot_rect2i *r_dest, const godot_rect2i *p_src) { + memnew_placement(r_dest, Rect2i(*(Rect2i *)p_src)); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp index d7a63f33a7..f8599afcf9 100644 --- a/modules/gdnative/gdnative/rid.cpp +++ b/modules/gdnative/gdnative/rid.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,45 +30,21 @@ #include "gdnative/rid.h" -#include "core/resource.h" -#include "core/rid.h" -#include "core/variant.h" +#include "core/os/memory.h" +#include "core/templates/rid.h" + +static_assert(sizeof(godot_rid) == sizeof(RID), "RID size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_rid) == sizeof(RID), "RID size mismatch"); - -void GDAPI godot_rid_new(godot_rid *r_dest) { - RID *dest = (RID *)r_dest; - memnew_placement(dest, RID); -} - -godot_int GDAPI godot_rid_get_id(const godot_rid *p_self) { - const RID *self = (const RID *)p_self; - return self->get_id(); -} - -void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from) { - const Resource *res_from = Object::cast_to<Resource>((Object *)p_from); - godot_rid_new(r_dest); - if (res_from) { - RID *dest = (RID *)r_dest; - *dest = RID(res_from->get_rid()); - } -} - -godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b) { - const RID *self = (const RID *)p_self; - const RID *b = (const RID *)p_b; - return *self == *b; +void GDAPI godot_rid_new(godot_rid *p_self) { + memnew_placement(p_self, RID); } -godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b) { - const RID *self = (const RID *)p_self; - const RID *b = (const RID *)p_b; - return *self < *b; +void GDAPI godot_rid_new_copy(godot_rid *r_dest, const godot_rid *p_src) { + memnew_placement(r_dest, RID(*(RID *)p_src)); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/signal.cpp b/modules/gdnative/gdnative/signal.cpp new file mode 100644 index 0000000000..5963c0e6c6 --- /dev/null +++ b/modules/gdnative/gdnative/signal.cpp @@ -0,0 +1,57 @@ +/*************************************************************************/ +/* signal.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "gdnative/signal.h" + +#include "core/variant/callable.h" +#include "core/variant/variant.h" + +static_assert(sizeof(godot_signal) == sizeof(Signal), "Signal size mismatch"); + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_signal_new(godot_signal *p_self) { + memnew_placement(p_self, Signal); +} + +void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src) { + memnew_placement(r_dest, Signal(*(Signal *)p_src)); +} + +void GDAPI godot_signal_destroy(godot_signal *p_self) { + Signal *self = (Signal *)p_self; + self->~Signal(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp index 1fa19f4ff5..1ad1ea8bdf 100644 --- a/modules/gdnative/gdnative/string.cpp +++ b/modules/gdnative/gdnative/string.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,67 +30,22 @@ #include "gdnative/string.h" -#include "core/string_name.h" -#include "core/ustring.h" -#include "core/variant.h" +#include "core/string/ustring.h" -#include <string.h> +static_assert(sizeof(godot_string) == sizeof(String), "String size mismatch"); +static_assert(sizeof(godot_char_type) == sizeof(char32_t), "char32_t size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_char16_string) == sizeof(Char16String), "Char16String size mismatch"); -static_assert(sizeof(godot_char_string) == sizeof(CharString), "CharString size mismatch"); -static_assert(sizeof(godot_string) == sizeof(String), "String size mismatch"); -static_assert(sizeof(godot_char_type) == sizeof(char32_t), "char32_t size mismatch"); - -godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs) { - const CharString *cs = (const CharString *)p_cs; - - return cs->length(); -} - -const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs) { - const CharString *cs = (const CharString *)p_cs; - - return cs->get_data(); -} - -void GDAPI godot_char_string_destroy(godot_char_string *p_cs) { - CharString *cs = (CharString *)p_cs; - - cs->~CharString(); -} - -godot_int GDAPI godot_char16_string_length(const godot_char16_string *p_cs) { - const Char16String *cs = (const Char16String *)p_cs; - - return cs->length(); -} - -const char16_t GDAPI *godot_char16_string_get_data(const godot_char16_string *p_cs) { - const Char16String *cs = (const Char16String *)p_cs; - - return cs->get_data(); -} - -void GDAPI godot_char16_string_destroy(godot_char16_string *p_cs) { - Char16String *cs = (Char16String *)p_cs; - - cs->~Char16String(); -} - void GDAPI godot_string_new(godot_string *r_dest) { String *dest = (String *)r_dest; memnew_placement(dest, String); } void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src) { - String *dest = (String *)r_dest; - const String *src = (const String *)p_src; - memnew_placement(dest, String); - *dest = String(*src); + memnew_placement(r_dest, String(*(String *)p_src)); } void GDAPI godot_string_new_with_latin1_chars(godot_string *r_dest, const char *p_contents) { @@ -167,1204 +122,48 @@ void GDAPI godot_string_new_with_wide_chars_and_len(godot_string *r_dest, const } } -const godot_char_type GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) { +const char GDAPI *godot_string_to_latin1_chars(const godot_string *p_self) { String *self = (String *)p_self; - return &(self->operator[](p_idx)); + return self->ascii(true).get_data(); } -godot_char_type GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx) { - const String *self = (const String *)p_self; - return self->operator[](p_idx); -} - -const godot_char_type GDAPI *godot_string_get_data(const godot_string *p_self) { - const String *self = (const String *)p_self; - return self->get_data(); -} - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b) { - const String *self = (const String *)p_self; - const String *b = (const String *)p_b; - return *self == *b; -} - -godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b) { - const String *self = (const String *)p_self; - const String *b = (const String *)p_b; - return *self < *b; -} - -godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b) { - godot_string ret; - const String *self = (const String *)p_self; - const String *b = (const String *)p_b; - memnew_placement(&ret, String(*self + *b)); - return ret; -} - -void GDAPI godot_string_destroy(godot_string *p_self) { +const char GDAPI *godot_string_to_utf8_chars(const godot_string *p_self) { String *self = (String *)p_self; - self->~String(); -} - -/* Standard size stuff */ - -godot_int GDAPI godot_string_length(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->length(); -} - -/* Helpers */ - -signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str) { - const String *self = (const String *)p_self; - const String *str = (const String *)p_str; - - return self->casecmp_to(*str); -} - -signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str) { - const String *self = (const String *)p_self; - const String *str = (const String *)p_str; - - return self->nocasecmp_to(*str); -} - -signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str) { - const String *self = (const String *)p_self; - const String *str = (const String *)p_str; - - return self->naturalnocasecmp_to(*str); -} - -godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string) { - const String *self = (const String *)p_self; - const String *string = (const String *)p_string; - - return self->begins_with(*string); -} - -godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array) { - const String *self = (const String *)p_self; - - return self->begins_with(p_char_array); -} - -godot_packed_string_array GDAPI godot_string_bigrams(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->bigrams())); - return ret; -}; - -godot_string GDAPI godot_string_chr(godot_char_type p_character) { - godot_string result; - memnew_placement(&result, String(String::chr(p_character))); - - return result; -} - -godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string) { - const String *self = (const String *)p_self; - const String *string = (const String *)p_string; - - return self->ends_with(*string); -} - -godot_bool GDAPI godot_string_ends_with_char_array(const godot_string *p_self, const char *p_char_array) { - const String *self = (const String *)p_self; - - return self->ends_with(p_char_array); -} - -godot_int GDAPI godot_string_count(const godot_string *p_self, const godot_string *p_what, godot_int p_from, godot_int p_to) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->count(*what, p_from, p_to); -} - -godot_int GDAPI godot_string_countn(const godot_string *p_self, const godot_string *p_what, godot_int p_from, godot_int p_to) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->countn(*what, p_from, p_to); -} - -godot_int GDAPI godot_string_find(const godot_string *p_self, const godot_string *p_what) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->find(*what); -} - -godot_int GDAPI godot_string_find_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->find(*what, p_from); -} - -godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_packed_string_array *p_keys) { - const String *self = (const String *)p_self; - const Vector<String> *keys = (const Vector<String> *)p_keys; - return self->findmk(*keys); -} - -godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_packed_string_array *p_keys, godot_int p_from) { - const String *self = (const String *)p_self; - const Vector<String> *keys = (const Vector<String> *)p_keys; - return self->findmk(*keys, p_from); -} - -godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_packed_string_array *p_keys, godot_int p_from, godot_int *r_key) { - const String *self = (const String *)p_self; - const Vector<String> *keys = (const Vector<String> *)p_keys; - int key; - int ret = self->findmk(*keys, p_from, &key); - if (r_key) { - *r_key = key; - } - return ret; -} - -godot_int GDAPI godot_string_findn(const godot_string *p_self, const godot_string *p_what) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->findn(*what); -} - -godot_int GDAPI godot_string_findn_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->findn(*what, p_from); -} - -godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values) { - const String *self = (const String *)p_self; - const Variant *values = (const Variant *)p_values; - godot_string result; - memnew_placement(&result, String(self->format(*values))); - - return result; -} - -godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder) { - const String *self = (const String *)p_self; - const Variant *values = (const Variant *)p_values; - String placeholder = String(p_placeholder); - godot_string result; - memnew_placement(&result, String(self->format(*values, placeholder))); - - return result; -} - -godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len) { - godot_string result; - memnew_placement(&result, String(String::hex_encode_buffer(p_buffer, p_len))); - - return result; -} - -godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, const godot_string *p_string) { - const String *self = (const String *)p_self; - const String *content = (const String *)p_string; - godot_string result; - memnew_placement(&result, String(self->insert(p_at_pos, *content))); - - return result; -} - -godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_numeric(); -} - -godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string) { - const String *self = (const String *)p_self; - const String *string = (const String *)p_string; - - return self->is_subsequence_of(*string); -} - -godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string) { - const String *self = (const String *)p_self; - const String *string = (const String *)p_string; - - return self->is_subsequence_ofi(*string); -} - -godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->lpad(p_min_length))); - - return result; -} - -godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) { - const String *self = (const String *)p_self; - const String *character = (const String *)p_character; - godot_string result; - memnew_placement(&result, String(self->lpad(p_min_length, *character))); - - return result; -} - -godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard) { - const String *self = (const String *)p_self; - const String *wildcard = (const String *)p_wildcard; - - return self->match(*wildcard); -} - -godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard) { - const String *self = (const String *)p_self; - const String *wildcard = (const String *)p_wildcard; - - return self->matchn(*wildcard); -} - -godot_string GDAPI godot_string_md5(const uint8_t *p_md5) { - godot_string result; - memnew_placement(&result, String(String::md5(p_md5))); - - return result; -} - -godot_string GDAPI godot_string_num(double p_num) { - godot_string result; - memnew_placement(&result, String(String::num(p_num))); - - return result; -} - -godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base) { - godot_string result; - memnew_placement(&result, String(String::num_int64(p_num, p_base))); - - return result; -} - -godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex) { - godot_string result; - memnew_placement(&result, String(String::num_int64(p_num, p_base, true))); - - return result; -} - -godot_string GDAPI godot_string_num_real(double p_num) { - godot_string result; - memnew_placement(&result, String(String::num_real(p_num))); - - return result; -} - -godot_string GDAPI godot_string_num_scientific(double p_num) { - godot_string result; - memnew_placement(&result, String(String::num_scientific(p_num))); - - return result; -} - -godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals) { - godot_string result; - memnew_placement(&result, String(String::num(p_num, p_decimals))); - - return result; -} - -godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->pad_decimals(p_digits))); - - return result; -} - -godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->pad_zeros(p_digits))); - - return result; -} - -godot_string GDAPI godot_string_replace(const godot_string *p_self, const godot_string *p_key, const godot_string *p_with) { - const String *self = (const String *)p_self; - const String *key = (const String *)p_key; - const String *with = (const String *)p_with; - godot_string result; - memnew_placement(&result, String(self->replace(*key, *with))); - - return result; -} - -godot_string GDAPI godot_string_replacen(const godot_string *p_self, const godot_string *p_key, const godot_string *p_with) { - const String *self = (const String *)p_self; - const String *key = (const String *)p_key; - const String *with = (const String *)p_with; - godot_string result; - memnew_placement(&result, String(self->replacen(*key, *with))); - - return result; -} - -godot_int GDAPI godot_string_rfind(const godot_string *p_self, const godot_string *p_what) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->rfind(*what); -} - -godot_int GDAPI godot_string_rfindn(const godot_string *p_self, const godot_string *p_what) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->rfindn(*what); -} - -godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->rfind(*what, p_from); -} - -godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from) { - const String *self = (const String *)p_self; - const String *what = (const String *)p_what; - - return self->rfindn(*what, p_from); -} - -godot_string GDAPI godot_string_replace_first(const godot_string *p_self, const godot_string *p_key, const godot_string *p_with) { - const String *self = (const String *)p_self; - const String *key = (const String *)p_key; - const String *with = (const String *)p_with; - godot_string result; - memnew_placement(&result, String(self->replace_first(*key, *with))); - - return result; -} - -godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->rpad(p_min_length))); - - return result; -} - -godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character) { - const String *self = (const String *)p_self; - const String *character = (const String *)p_character; - godot_string result; - memnew_placement(&result, String(self->rpad(p_min_length, *character))); - - return result; -} - -godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string) { - const String *self = (const String *)p_self; - const String *string = (const String *)p_string; - - return self->similarity(*string); -} - -godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error) { - const String *self = (const String *)p_self; - const Array *values = (const Array *)p_values; - - godot_string result; - String return_value = self->sprintf(*values, p_error); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->substr(p_from, p_chars))); - - return result; -} - -godot_int GDAPI godot_string_to_int(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->to_int(); -} - -double GDAPI godot_string_to_float(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->to_float(); -} - -godot_string GDAPI godot_string_capitalize(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->capitalize())); - - return result; -} - -godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->camelcase_to_underscore(false))); - - return result; -} - -godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->camelcase_to_underscore())); - - return result; -} - -double GDAPI godot_string_char_to_float(const char *p_what) { - return String::to_float(p_what); -} - -double GDAPI godot_string_wchar_to_float(const wchar_t *p_str, const wchar_t **r_end) { - return String::to_float(p_str, r_end); -} - -godot_int GDAPI godot_string_char_to_int(const char *p_what) { - return String::to_int(p_what); -} - -godot_int GDAPI godot_string_wchar_to_int(const wchar_t *p_str) { - return String::to_int(p_str); -} - -godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len) { - return String::to_int(p_what, p_len); -} - -godot_int GDAPI godot_string_wchar_to_int_with_len(const wchar_t *p_str, int p_len) { - return String::to_int(p_str, p_len); -} - -godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->hex_to_int(false); -} - -godot_int GDAPI godot_string_hex_to_int_with_prefix(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->hex_to_int(); -} - -godot_string GDAPI godot_string_get_slice(const godot_string *p_self, const godot_string *p_splitter, godot_int p_slice) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - godot_string result; - memnew_placement(&result, String(self->get_slice(*splitter, p_slice))); - - return result; -} - -godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, godot_char_type p_splitter, godot_int p_slice) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->get_slicec(p_splitter, p_slice))); - - return result; -} - -godot_packed_string_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->split(*splitter, false))); - return ret; -} - -godot_packed_string_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->split(*splitter, true))); - return ret; -} - -godot_packed_string_array GDAPI godot_string_split_with_maxsplit(const godot_string *p_self, const godot_string *p_splitter, const godot_bool p_allow_empty, const godot_int p_maxsplit) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->split(*splitter, p_allow_empty, p_maxsplit))); - return ret; -} - -godot_packed_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->rsplit(*splitter, false))); - return ret; -} - -godot_packed_string_array GDAPI godot_string_rsplit_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->rsplit(*splitter, true))); - return ret; -} - -godot_packed_string_array GDAPI godot_string_rsplit_with_maxsplit(const godot_string *p_self, const godot_string *p_splitter, const godot_bool p_allow_empty, const godot_int p_maxsplit) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->rsplit(*splitter, p_allow_empty, p_maxsplit))); - return ret; + return self->utf8().get_data(); } -godot_packed_float32_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_float32_array ret; - memnew_placement(&ret, Vector<float>(self->split_floats(*splitter, false))); - return ret; -} - -godot_packed_float32_array GDAPI godot_string_split_floats_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_float32_array ret; - memnew_placement(&ret, Vector<float>(self->split_floats(*splitter, true))); - return ret; -} - -godot_packed_float32_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_packed_string_array *p_splitters) { - const String *self = (const String *)p_self; - const Vector<String> *splitters = (const Vector<String> *)p_splitters; - - godot_packed_float32_array ret; - memnew_placement(&ret, Vector<float>(self->split_floats_mk(*splitters, false))); - return ret; -} - -godot_packed_float32_array GDAPI godot_string_split_floats_mk_allow_empty(const godot_string *p_self, const godot_packed_string_array *p_splitters) { - const String *self = (const String *)p_self; - const Vector<String> *splitters = (const Vector<String> *)p_splitters; - - godot_packed_float32_array ret; - memnew_placement(&ret, Vector<float>(self->split_floats_mk(*splitters, true))); - return ret; -} - -godot_packed_int32_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_int32_array ret; - memnew_placement(&ret, Vector<int>(self->split_ints(*splitter, false))); - return ret; -} - -godot_packed_int32_array GDAPI godot_string_split_ints_allow_empty(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - godot_packed_int32_array ret; - memnew_placement(&ret, Vector<int>(self->split_ints(*splitter, true))); - return ret; -} - -godot_packed_int32_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_packed_string_array *p_splitters) { - const String *self = (const String *)p_self; - const Vector<String> *splitters = (const Vector<String> *)p_splitters; - - godot_packed_int32_array ret; - memnew_placement(&ret, Vector<int>(self->split_ints_mk(*splitters, false))); - return ret; -} - -godot_packed_int32_array GDAPI godot_string_split_ints_mk_allow_empty(const godot_string *p_self, const godot_packed_string_array *p_splitters) { - const String *self = (const String *)p_self; - const Vector<String> *splitters = (const Vector<String> *)p_splitters; - - godot_packed_int32_array ret; - memnew_placement(&ret, Vector<int>(self->split_ints_mk(*splitters, true))); - return ret; -} - -godot_packed_string_array GDAPI godot_string_split_spaces(const godot_string *p_self) { - const String *self = (const String *)p_self; - - godot_packed_string_array ret; - memnew_placement(&ret, Vector<String>(self->split_spaces())); - return ret; -} - -godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, const godot_string *p_splitter) { - const String *self = (const String *)p_self; - const String *splitter = (const String *)p_splitter; - - return self->get_slice_count(*splitter); -} - -godot_char_type GDAPI godot_string_char_lowercase(godot_char_type p_char) { - return String::char_lowercase(p_char); -} - -godot_char_type GDAPI godot_string_char_uppercase(godot_char_type p_char) { - return String::char_uppercase(p_char); -} - -godot_string GDAPI godot_string_to_lower(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->to_lower())); - - return result; -} - -godot_string GDAPI godot_string_to_upper(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->to_upper())); - - return result; -} - -godot_string GDAPI godot_string_get_basename(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->get_basename())); - - return result; -} - -godot_string GDAPI godot_string_get_extension(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->get_extension())); - - return result; -} - -godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->left(p_pos))); - - return result; -} - -godot_char_type GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx) { - const String *self = (const String *)p_self; - - return self->ord_at(p_idx); -} - -godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file) { - const String *self = (const String *)p_self; - const String *file = (const String *)p_file; - godot_string result; - memnew_placement(&result, String(self->plus_file(*file))); - - return result; -} - -godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->right(p_pos))); - - return result; -} - -godot_string GDAPI godot_string_repeat(const godot_string *p_self, godot_int p_count) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->repeat(p_count))); - - return result; -} - -godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->strip_edges(p_left, p_right))); - - return result; -} - -godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->strip_escapes())); - - return result; -} - -void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars) { - String *self = (String *)p_self; - - return self->erase(p_pos, p_chars); -} - -godot_char_string GDAPI godot_string_ascii(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_char_string result; - - memnew_placement(&result, CharString(self->ascii())); - - return result; -} - -godot_char_string GDAPI godot_string_latin1(const godot_string *p_self) { - const String *self = (const String *)p_self; - - godot_char_string result; - - memnew_placement(&result, CharString(self->ascii(true))); - - return result; -} - -godot_char_string GDAPI godot_string_utf8(const godot_string *p_self) { - const String *self = (const String *)p_self; - - godot_char_string result; - - memnew_placement(&result, CharString(self->utf8())); - - return result; -} - -godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8) { +const char16_t GDAPI *godot_string_to_utf16_chars(const godot_string *p_self) { String *self = (String *)p_self; - - return self->parse_utf8(p_utf8); + return self->utf16().get_data(); } -godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len) { +const char32_t GDAPI *godot_string_to_utf32_chars(const godot_string *p_self) { String *self = (String *)p_self; - - return self->parse_utf8(p_utf8, p_len); -} - -godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8) { - godot_string result; - memnew_placement(&result, String(String::utf8(p_utf8))); - - return result; -} - -godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len) { - godot_string result; - memnew_placement(&result, String(String::utf8(p_utf8, p_len))); - - return result; -} - -godot_char16_string GDAPI godot_string_utf16(const godot_string *p_self) { - const String *self = (const String *)p_self; - - godot_char16_string result; - - memnew_placement(&result, Char16String(self->utf16())); - - return result; + return self->get_data(); } -godot_bool GDAPI godot_string_parse_utf16(godot_string *p_self, const char16_t *p_utf16) { +const wchar_t GDAPI *godot_string_to_wide_chars(const godot_string *p_self) { String *self = (String *)p_self; - - return self->parse_utf16(p_utf16); + if (sizeof(wchar_t) == 2) { + return (const wchar_t *)self->utf16().get_data(); + } else { + return (const wchar_t *)self->get_data(); + } } -godot_bool GDAPI godot_string_parse_utf16_with_len(godot_string *p_self, const char16_t *p_utf16, godot_int p_len) { +char32_t GDAPI *godot_string_operator_index(godot_string *p_self, godot_int p_index) { String *self = (String *)p_self; - - return self->parse_utf16(p_utf16, p_len); -} - -godot_string GDAPI godot_string_chars_to_utf16(const char16_t *p_utf16) { - godot_string result; - memnew_placement(&result, String(String::utf16(p_utf16))); - - return result; -} - -godot_string GDAPI godot_string_chars_to_utf16_with_len(const char16_t *p_utf16, godot_int p_len) { - godot_string result; - memnew_placement(&result, String(String::utf16(p_utf16, p_len))); - - return result; -} - -uint32_t GDAPI godot_string_hash(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->hash(); + return self->ptrw(); } -uint64_t GDAPI godot_string_hash64(const godot_string *p_self) { +const char32_t GDAPI *godot_string_operator_index_const(const godot_string *p_self, godot_int p_index) { const String *self = (const String *)p_self; - - return self->hash64(); -} - -uint32_t GDAPI godot_string_hash_chars(const char *p_cstr) { - return String::hash(p_cstr); -} - -uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len) { - return String::hash(p_cstr, p_len); + return self->ptr(); } -uint32_t GDAPI godot_string_hash_wide_chars(const wchar_t *p_str) { - return String::hash(p_str); -} - -uint32_t GDAPI godot_string_hash_wide_chars_with_len(const wchar_t *p_str, godot_int p_len) { - return String::hash(p_str, p_len); -} - -godot_packed_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_packed_byte_array result; - memnew_placement(&result, PackedByteArray(self->md5_buffer())); - return result; -} - -godot_string GDAPI godot_string_md5_text(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->md5_text())); - - return result; -} - -godot_packed_byte_array GDAPI godot_string_sha1_buffer(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_packed_byte_array result; - memnew_placement(&result, PackedByteArray(self->sha1_buffer())); - return result; -} - -godot_string GDAPI godot_string_sha1_text(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->sha1_text())); - - return result; -} - -godot_packed_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_packed_byte_array result; - memnew_placement(&result, PackedByteArray(self->sha256_buffer())); - return result; -} - -godot_string GDAPI godot_string_sha256_text(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - memnew_placement(&result, String(self->sha256_text())); - - return result; -} - -godot_bool godot_string_empty(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->empty(); -} - -// path functions -godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->get_base_dir(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_get_file(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->get_file(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_humanize_size(size_t p_size) { - godot_string result; - String return_value = String::humanize_size(p_size); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_abs_path(); -} - -godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_rel_path(); -} - -godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_resource_file(); -} - -godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path) { - const String *self = (const String *)p_self; - String *path = (String *)p_path; - godot_string result; - String return_value = self->path_to(*path); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path) { - const String *self = (const String *)p_self; - String *path = (String *)p_path; - godot_string result; - String return_value = self->path_to_file(*path); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_simplify_path(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->simplify_path(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_c_escape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->c_escape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->c_escape_multiline(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_c_unescape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->c_unescape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_http_escape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->http_escape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_http_unescape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->http_unescape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_json_escape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->json_escape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_xml_escape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->xml_escape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->xml_escape(true); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->xml_unescape(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_percent_decode(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->percent_decode(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_percent_encode(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->percent_encode(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_join(const godot_string *p_self, const godot_packed_string_array *p_parts) { - const String *self = (const String *)p_self; - const Vector<String> *parts = (const Vector<String> *)p_parts; - godot_string result; - String return_value = self->join(*parts); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_bool GDAPI godot_string_is_valid_filename(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_valid_filename(); -} - -godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_valid_float(); -} - -godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix) { - const String *self = (const String *)p_self; - - return self->is_valid_hex_number(p_with_prefix); -} - -godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_valid_html_color(); -} - -godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_valid_identifier(); -} - -godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_valid_integer(); -} - -godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self) { - const String *self = (const String *)p_self; - - return self->is_valid_ip_address(); -} - -godot_string GDAPI godot_string_dedent(const godot_string *p_self) { - const String *self = (const String *)p_self; - godot_string result; - String return_value = self->dedent(); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_trim_prefix(const godot_string *p_self, const godot_string *p_prefix) { - const String *self = (const String *)p_self; - String *prefix = (String *)p_prefix; - godot_string result; - String return_value = self->trim_prefix(*prefix); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_trim_suffix(const godot_string *p_self, const godot_string *p_suffix) { - const String *self = (const String *)p_self; - String *suffix = (String *)p_suffix; - godot_string result; - String return_value = self->trim_suffix(*suffix); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_lstrip(const godot_string *p_self, const godot_string *p_chars) { - const String *self = (const String *)p_self; - String *chars = (String *)p_chars; - godot_string result; - String return_value = self->lstrip(*chars); - memnew_placement(&result, String(return_value)); - - return result; -} - -godot_string GDAPI godot_string_rstrip(const godot_string *p_self, const godot_string *p_chars) { - const String *self = (const String *)p_self; - String *chars = (String *)p_chars; - godot_string result; - String return_value = self->rstrip(*chars); - memnew_placement(&result, String(return_value)); - - return result; +void GDAPI godot_string_destroy(godot_string *p_self) { + String *self = (String *)p_self; + self->~String(); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp index 7bbaaeeaa0..bd8f69674e 100644 --- a/modules/gdnative/gdnative/string_name.cpp +++ b/modules/gdnative/gdnative/string_name.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,55 +30,26 @@ #include "gdnative/string_name.h" -#include "core/string_name.h" -#include "core/ustring.h" +#include "core/string/string_name.h" -#include <string.h> +static_assert(sizeof(godot_string_name) == sizeof(StringName), "StringName size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_string_name) == sizeof(StringName), "StringName size mismatch"); - -void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name) { +void GDAPI godot_string_name_new(godot_string_name *r_dest) { StringName *dest = (StringName *)r_dest; - const String *name = (const String *)p_name; - memnew_placement(dest, StringName(*name)); + memnew_placement(dest, StringName); } -void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name) { - StringName *dest = (StringName *)r_dest; - memnew_placement(dest, StringName(p_name)); +void GDAPI godot_string_name_new_copy(godot_string_name *r_dest, const godot_string_name *p_src) { + memnew_placement(r_dest, StringName(*(StringName *)p_src)); } -godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self) { - godot_string ret; - const StringName *self = (const StringName *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self) { - const StringName *self = (const StringName *)p_self; - return self->hash(); -} - -const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self) { - const StringName *self = (const StringName *)p_self; - return self->data_unique_pointer(); -} - -godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other) { - const StringName *self = (const StringName *)p_self; - const StringName *other = (const StringName *)p_other; - return self == other; -} - -godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other) { - const StringName *self = (const StringName *)p_self; - const StringName *other = (const StringName *)p_other; - return self < other; +void GDAPI godot_string_name_new_with_latin1_chars(godot_string_name *r_dest, const char *p_contents) { + StringName *dest = (StringName *)r_dest; + memnew_placement(dest, StringName(p_contents)); } void GDAPI godot_string_name_destroy(godot_string_name *p_self) { diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp deleted file mode 100644 index d19de93e9b..0000000000 --- a/modules/gdnative/gdnative/transform.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/*************************************************************************/ -/* transform.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "gdnative/transform.h" - -#include "core/math/transform.h" -#include "core/variant.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static_assert(sizeof(godot_transform) == sizeof(Transform), "Transform size mismatch"); - -void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin) { - const Vector3 *x_axis = (const Vector3 *)p_x_axis; - const Vector3 *y_axis = (const Vector3 *)p_y_axis; - const Vector3 *z_axis = (const Vector3 *)p_z_axis; - const Vector3 *origin = (const Vector3 *)p_origin; - Transform *dest = (Transform *)r_dest; - dest->basis.set_axis(0, *x_axis); - dest->basis.set_axis(1, *y_axis); - dest->basis.set_axis(2, *z_axis); - dest->origin = *origin; -} - -void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin) { - const Basis *basis = (const Basis *)p_basis; - const Vector3 *origin = (const Vector3 *)p_origin; - Transform *dest = (Transform *)r_dest; - *dest = Transform(*basis, *origin); -} - -void GDAPI godot_transform_new_with_quat(godot_transform *r_dest, const godot_quat *p_quat) { - const Quat *quat = (const Quat *)p_quat; - Transform *dest = (Transform *)r_dest; - *dest = Transform(*quat); -} - -godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self) { - godot_basis dest; - const Transform *self = (const Transform *)p_self; - *((Basis *)&dest) = self->basis; - return dest; -} - -void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v) { - Transform *self = (Transform *)p_self; - const Basis *v = (const Basis *)p_v; - self->basis = *v; -} - -godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self) { - godot_vector3 dest; - const Transform *self = (const Transform *)p_self; - *((Vector3 *)&dest) = self->origin; - return dest; -} - -void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v) { - Transform *self = (Transform *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - self->origin = *v; -} - -godot_string GDAPI godot_transform_as_string(const godot_transform *p_self) { - godot_string ret; - const Transform *self = (const Transform *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - *((Transform *)&dest) = self->inverse(); - return dest; -} - -godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - *((Transform *)&dest) = self->affine_inverse(); - return dest; -} - -godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - *((Transform *)&dest) = self->orthonormalized(); - return dest; -} - -godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - const Vector3 *axis = (const Vector3 *)p_axis; - *((Transform *)&dest) = self->rotated(*axis, p_phi); - return dest; -} - -godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - const Vector3 *scale = (const Vector3 *)p_scale; - *((Transform *)&dest) = self->scaled(*scale); - return dest; -} - -godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - const Vector3 *ofs = (const Vector3 *)p_ofs; - *((Transform *)&dest) = self->translated(*ofs); - return dest; -} - -godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up) { - godot_transform dest; - const Transform *self = (const Transform *)p_self; - const Vector3 *target = (const Vector3 *)p_target; - const Vector3 *up = (const Vector3 *)p_up; - *((Transform *)&dest) = self->looking_at(*target, *up); - return dest; -} - -godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v) { - godot_plane raw_dest; - Plane *dest = (Plane *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const Plane *v = (const Plane *)p_v; - *dest = self->xform(*v); - return raw_dest; -} - -godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v) { - godot_plane raw_dest; - Plane *dest = (Plane *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const Plane *v = (const Plane *)p_v; - *dest = self->xform_inv(*v); - return raw_dest; -} - -void GDAPI godot_transform_new_identity(godot_transform *r_dest) { - Transform *dest = (Transform *)r_dest; - *dest = Transform(); -} - -godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b) { - const Transform *self = (const Transform *)p_self; - const Transform *b = (const Transform *)p_b; - return *self == *b; -} - -godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b) { - godot_transform raw_dest; - Transform *dest = (Transform *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const Transform *b = (const Transform *)p_b; - *dest = *self * *b; - return raw_dest; -} - -godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - *dest = self->xform(*v); - return raw_dest; -} - -godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const Vector3 *v = (const Vector3 *)p_v; - *dest = self->xform_inv(*v); - return raw_dest; -} - -godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v) { - godot_aabb raw_dest; - AABB *dest = (AABB *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const AABB *v = (const AABB *)p_v; - *dest = self->xform(*v); - return raw_dest; -} - -godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v) { - godot_aabb raw_dest; - AABB *dest = (AABB *)&raw_dest; - const Transform *self = (const Transform *)p_self; - const AABB *v = (const AABB *)p_v; - *dest = self->xform_inv(*v); - return raw_dest; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp index c0f7878eb0..2864818831 100644 --- a/modules/gdnative/gdnative/transform2d.cpp +++ b/modules/gdnative/gdnative/transform2d.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,179 +31,29 @@ #include "gdnative/transform2d.h" #include "core/math/transform_2d.h" -#include "core/variant.h" + +static_assert(sizeof(godot_transform2d) == sizeof(Transform2D), "Transform2D size mismatch"); #ifdef __cplusplus extern "C" { #endif -static_assert(sizeof(godot_transform2d) == sizeof(Transform2D), "Transform2D size mismatch"); - -void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos) { - const Vector2 *pos = (const Vector2 *)p_pos; - Transform2D *dest = (Transform2D *)r_dest; - *dest = Transform2D(p_rot, *pos); -} - -void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin) { - const Vector2 *x_axis = (const Vector2 *)p_x_axis; - const Vector2 *y_axis = (const Vector2 *)p_y_axis; - const Vector2 *origin = (const Vector2 *)p_origin; - Transform2D *dest = (Transform2D *)r_dest; - *dest = Transform2D(x_axis->x, x_axis->y, y_axis->x, y_axis->y, origin->x, origin->y); -} - -godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self) { - godot_string ret; - const Transform2D *self = (const Transform2D *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - *((Transform2D *)&dest) = self->inverse(); - return dest; -} - -godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - *((Transform2D *)&dest) = self->affine_inverse(); - return dest; -} - -godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self) { - const Transform2D *self = (const Transform2D *)p_self; - return self->get_rotation(); -} - -godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self) { - godot_vector2 dest; - const Transform2D *self = (const Transform2D *)p_self; - *((Vector2 *)&dest) = self->get_origin(); - return dest; +void GDAPI godot_transform2d_new(godot_transform2d *p_self) { + memnew_placement(p_self, Transform2D); } -godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self) { - godot_vector2 dest; - const Transform2D *self = (const Transform2D *)p_self; - *((Vector2 *)&dest) = self->get_scale(); - return dest; +void GDAPI godot_transform2d_new_copy(godot_transform2d *r_dest, const godot_transform2d *p_src) { + memnew_placement(r_dest, Transform2D(*(Transform2D *)p_src)); } -godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - *((Transform2D *)&dest) = self->orthonormalized(); - return dest; -} - -godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - - *((Transform2D *)&dest) = self->rotated(p_phi); - return dest; -} - -godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - const Vector2 *scale = (const Vector2 *)p_scale; - *((Transform2D *)&dest) = self->scaled(*scale); - return dest; -} - -godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - const Vector2 *offset = (const Vector2 *)p_offset; - *((Transform2D *)&dest) = self->translated(*offset); - return dest; -} - -godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Transform2D *self = (const Transform2D *)p_self; - const Vector2 *v = (const Vector2 *)p_v; - *dest = self->xform(*v); - return raw_dest; -} - -godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Transform2D *self = (const Transform2D *)p_self; - const Vector2 *v = (const Vector2 *)p_v; - *dest = self->xform_inv(*v); - return raw_dest; -} - -godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Transform2D *self = (const Transform2D *)p_self; - const Vector2 *v = (const Vector2 *)p_v; - *dest = self->basis_xform(*v); - return raw_dest; -} - -godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Transform2D *self = (const Transform2D *)p_self; - const Vector2 *v = (const Vector2 *)p_v; - *dest = self->basis_xform_inv(*v); - return raw_dest; -} - -godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c) { - godot_transform2d dest; - const Transform2D *self = (const Transform2D *)p_self; - const Transform2D *m = (const Transform2D *)p_m; - *((Transform2D *)&dest) = self->interpolate_with(*m, p_c); - return dest; -} - -godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b) { - const Transform2D *self = (const Transform2D *)p_self; - const Transform2D *b = (const Transform2D *)p_b; - return *self == *b; -} - -godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b) { - godot_transform2d raw_dest; - Transform2D *dest = (Transform2D *)&raw_dest; - const Transform2D *self = (const Transform2D *)p_self; - const Transform2D *b = (const Transform2D *)p_b; - *dest = *self * *b; - return raw_dest; -} - -void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest) { - Transform2D *dest = (Transform2D *)r_dest; - *dest = Transform2D(); -} - -godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v) { - godot_rect2 raw_dest; - Rect2 *dest = (Rect2 *)&raw_dest; - const Transform2D *self = (const Transform2D *)p_self; - const Rect2 *v = (const Rect2 *)p_v; - *dest = self->xform(*v); - return raw_dest; +godot_vector2 GDAPI *godot_transform2d_operator_index(godot_transform2d *p_self, godot_int p_index) { + Transform2D *self = (Transform2D *)p_self; + return (godot_vector2 *)&self->operator[](p_index); } -godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v) { - godot_rect2 raw_dest; - Rect2 *dest = (Rect2 *)&raw_dest; +const godot_vector2 GDAPI *godot_transform2d_operator_index_const(const godot_transform2d *p_self, godot_int p_index) { const Transform2D *self = (const Transform2D *)p_self; - const Rect2 *v = (const Rect2 *)p_v; - *dest = self->xform_inv(*v); - return raw_dest; + return (const godot_vector2 *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/transform_3d.cpp b/modules/gdnative/gdnative/transform_3d.cpp new file mode 100644 index 0000000000..8bd2a68d63 --- /dev/null +++ b/modules/gdnative/gdnative/transform_3d.cpp @@ -0,0 +1,51 @@ +/*************************************************************************/ +/* transform_3d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "gdnative/transform_3d.h" + +#include "core/math/transform_3d.h" + +static_assert(sizeof(godot_transform3d) == sizeof(Transform3D), "Transform3D size mismatch"); + +#ifdef __cplusplus +extern "C" { +#endif + +void GDAPI godot_transform3d_new(godot_transform3d *p_self) { + memnew_placement(p_self, Transform3D); +} + +void GDAPI godot_transform3d_new_copy(godot_transform3d *r_dest, const godot_transform3d *p_src) { + memnew_placement(r_dest, Transform3D(*(Transform3D *)p_src)); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index dac4feb0e5..ec9aaa0a55 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,8 +30,8 @@ #include "gdnative/variant.h" -#include "core/reference.h" -#include "core/variant.h" +#include "core/object/ref_counted.h" +#include "core/variant/variant.h" #ifdef __cplusplus extern "C" { @@ -48,23 +48,16 @@ static_assert(sizeof(godot_variant) == sizeof(Variant), "Variant size mismatch") #pragma GCC optimize("-O0") #endif -#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr) - #if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \ (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1)) #pragma GCC pop_options #endif -// Constructors - -godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - return (godot_variant_type)self->get_type(); -} +// Memory void GDAPI godot_variant_new_copy(godot_variant *p_dest, const godot_variant *p_src) { Variant *dest = (Variant *)p_dest; - Variant *src = (Variant *)p_src; + const Variant *src = (const Variant *)p_src; memnew_placement(dest, Variant(*src)); } @@ -75,222 +68,217 @@ void GDAPI godot_variant_new_nil(godot_variant *r_dest) { void GDAPI godot_variant_new_bool(godot_variant *r_dest, const godot_bool p_b) { Variant *dest = (Variant *)r_dest; - memnew_placement_custom(dest, Variant, Variant(p_b)); + memnew_placement(dest, Variant(p_b)); } -void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i) { +void GDAPI godot_variant_new_int(godot_variant *r_dest, const godot_int p_i) { Variant *dest = (Variant *)r_dest; - memnew_placement_custom(dest, Variant, Variant(p_i)); + memnew_placement(dest, Variant(p_i)); } -void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i) { +void GDAPI godot_variant_new_float(godot_variant *r_dest, const godot_float p_r) { Variant *dest = (Variant *)r_dest; - memnew_placement_custom(dest, Variant, Variant(p_i)); -} - -void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r) { - Variant *dest = (Variant *)r_dest; - memnew_placement_custom(dest, Variant, Variant(p_r)); + memnew_placement(dest, Variant(p_r)); } void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s) { Variant *dest = (Variant *)r_dest; - String *s = (String *)p_s; - memnew_placement_custom(dest, Variant, Variant(*s)); + const String *s = (const String *)p_s; + memnew_placement(dest, Variant(*s)); } void GDAPI godot_variant_new_string_name(godot_variant *r_dest, const godot_string_name *p_s) { Variant *dest = (Variant *)r_dest; - StringName *s = (StringName *)p_s; - memnew_placement_custom(dest, Variant, Variant(*s)); + const StringName *s = (const StringName *)p_s; + memnew_placement(dest, Variant(*s)); } void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2) { Variant *dest = (Variant *)r_dest; - Vector2 *v2 = (Vector2 *)p_v2; - memnew_placement_custom(dest, Variant, Variant(*v2)); + const Vector2 *v2 = (const Vector2 *)p_v2; + memnew_placement(dest, Variant(*v2)); } void GDAPI godot_variant_new_vector2i(godot_variant *r_dest, const godot_vector2i *p_v2) { Variant *dest = (Variant *)r_dest; - Vector2i *v2 = (Vector2i *)p_v2; - memnew_placement_custom(dest, Variant, Variant(*v2)); + const Vector2i *v2 = (const Vector2i *)p_v2; + memnew_placement(dest, Variant(*v2)); } void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2) { Variant *dest = (Variant *)r_dest; - Rect2 *rect2 = (Rect2 *)p_rect2; - memnew_placement_custom(dest, Variant, Variant(*rect2)); + const Rect2 *rect2 = (const Rect2 *)p_rect2; + memnew_placement(dest, Variant(*rect2)); } void GDAPI godot_variant_new_rect2i(godot_variant *r_dest, const godot_rect2i *p_rect2) { Variant *dest = (Variant *)r_dest; - Rect2i *rect2 = (Rect2i *)p_rect2; - memnew_placement_custom(dest, Variant, Variant(*rect2)); + const Rect2i *rect2 = (const Rect2i *)p_rect2; + memnew_placement(dest, Variant(*rect2)); } void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3) { Variant *dest = (Variant *)r_dest; - Vector3 *v3 = (Vector3 *)p_v3; - memnew_placement_custom(dest, Variant, Variant(*v3)); + const Vector3 *v3 = (const Vector3 *)p_v3; + memnew_placement(dest, Variant(*v3)); } void GDAPI godot_variant_new_vector3i(godot_variant *r_dest, const godot_vector3i *p_v3) { Variant *dest = (Variant *)r_dest; - Vector3i *v3 = (Vector3i *)p_v3; - memnew_placement_custom(dest, Variant, Variant(*v3)); + const Vector3i *v3 = (const Vector3i *)p_v3; + memnew_placement(dest, Variant(*v3)); } void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d) { Variant *dest = (Variant *)r_dest; - Transform2D *t2d = (Transform2D *)p_t2d; - memnew_placement_custom(dest, Variant, Variant(*t2d)); + const Transform2D *t2d = (const Transform2D *)p_t2d; + memnew_placement(dest, Variant(*t2d)); } void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane) { Variant *dest = (Variant *)r_dest; - Plane *plane = (Plane *)p_plane; - memnew_placement_custom(dest, Variant, Variant(*plane)); + const Plane *plane = (const Plane *)p_plane; + memnew_placement(dest, Variant(*plane)); } -void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat) { +void GDAPI godot_variant_new_quaternion(godot_variant *r_dest, const godot_quaternion *p_quaternion) { Variant *dest = (Variant *)r_dest; - Quat *quat = (Quat *)p_quat; - memnew_placement_custom(dest, Variant, Variant(*quat)); + const Quaternion *quaternion = (const Quaternion *)p_quaternion; + memnew_placement(dest, Variant(*quaternion)); } void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) { Variant *dest = (Variant *)r_dest; - AABB *aabb = (AABB *)p_aabb; - memnew_placement_custom(dest, Variant, Variant(*aabb)); + const AABB *aabb = (const AABB *)p_aabb; + memnew_placement(dest, Variant(*aabb)); } void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) { Variant *dest = (Variant *)r_dest; - Basis *basis = (Basis *)p_basis; - memnew_placement_custom(dest, Variant, Variant(*basis)); + const Basis *basis = (const Basis *)p_basis; + memnew_placement(dest, Variant(*basis)); } -void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans) { +void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans) { Variant *dest = (Variant *)r_dest; - Transform *trans = (Transform *)p_trans; - memnew_placement_custom(dest, Variant, Variant(*trans)); + const Transform3D *trans = (const Transform3D *)p_trans; + memnew_placement(dest, Variant(*trans)); } void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color) { Variant *dest = (Variant *)r_dest; - Color *color = (Color *)p_color; - memnew_placement_custom(dest, Variant, Variant(*color)); + const Color *color = (const Color *)p_color; + memnew_placement(dest, Variant(*color)); } void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np) { Variant *dest = (Variant *)r_dest; - NodePath *np = (NodePath *)p_np; - memnew_placement_custom(dest, Variant, Variant(*np)); + const NodePath *np = (const NodePath *)p_np; + memnew_placement(dest, Variant(*np)); } void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid) { Variant *dest = (Variant *)r_dest; - RID *rid = (RID *)p_rid; - memnew_placement_custom(dest, Variant, Variant(*rid)); + const RID *rid = (const RID *)p_rid; + memnew_placement(dest, Variant(*rid)); } void GDAPI godot_variant_new_callable(godot_variant *r_dest, const godot_callable *p_cb) { Variant *dest = (Variant *)r_dest; - Callable *cb = (Callable *)p_cb; - memnew_placement_custom(dest, Variant, Variant(*cb)); + const Callable *cb = (const Callable *)p_cb; + memnew_placement(dest, Variant(*cb)); } void GDAPI godot_variant_new_signal(godot_variant *r_dest, const godot_signal *p_signal) { Variant *dest = (Variant *)r_dest; - Signal *signal = (Signal *)p_signal; - memnew_placement_custom(dest, Variant, Variant(*signal)); + const Signal *signal = (const Signal *)p_signal; + memnew_placement(dest, Variant(*signal)); } void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj) { Variant *dest = (Variant *)r_dest; - Object *obj = (Object *)p_obj; - Reference *reference = Object::cast_to<Reference>(obj); + const Object *obj = (const Object *)p_obj; + const RefCounted *ref_counted = Object::cast_to<RefCounted>(obj); REF ref; - if (reference) { - ref = REF(reference); + if (ref_counted) { + ref = REF(ref_counted); } if (!ref.is_null()) { - memnew_placement_custom(dest, Variant, Variant(ref)); + memnew_placement(dest, Variant(ref)); } else { #if defined(DEBUG_METHODS_ENABLED) - if (reference) { - ERR_PRINT("Reference object has 0 refcount in godot_variant_new_object - you lost it somewhere."); + if (ref_counted) { + ERR_PRINT("RefCounted object has 0 refcount in godot_variant_new_object - you lost it somewhere."); } #endif - memnew_placement_custom(dest, Variant, Variant(obj)); + memnew_placement(dest, Variant(obj)); } } void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict) { Variant *dest = (Variant *)r_dest; - Dictionary *dict = (Dictionary *)p_dict; - memnew_placement_custom(dest, Variant, Variant(*dict)); + const Dictionary *dict = (const Dictionary *)p_dict; + memnew_placement(dest, Variant(*dict)); } void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr) { Variant *dest = (Variant *)r_dest; - Array *arr = (Array *)p_arr; - memnew_placement_custom(dest, Variant, Variant(*arr)); + const Array *arr = (const Array *)p_arr; + memnew_placement(dest, Variant(*arr)); } void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godot_packed_byte_array *p_pba) { Variant *dest = (Variant *)r_dest; - PackedByteArray *pba = (PackedByteArray *)p_pba; - memnew_placement_custom(dest, Variant, Variant(*pba)); + const PackedByteArray *pba = (const PackedByteArray *)p_pba; + memnew_placement(dest, Variant(*pba)); } void GDAPI godot_variant_new_packed_int32_array(godot_variant *r_dest, const godot_packed_int32_array *p_pia) { Variant *dest = (Variant *)r_dest; - PackedInt32Array *pia = (PackedInt32Array *)p_pia; - memnew_placement_custom(dest, Variant, Variant(*pia)); + const PackedInt32Array *pia = (const PackedInt32Array *)p_pia; + memnew_placement(dest, Variant(*pia)); } void GDAPI godot_variant_new_packed_int64_array(godot_variant *r_dest, const godot_packed_int64_array *p_pia) { Variant *dest = (Variant *)r_dest; - PackedInt64Array *pia = (PackedInt64Array *)p_pia; - memnew_placement_custom(dest, Variant, Variant(*pia)); + const PackedInt64Array *pia = (const PackedInt64Array *)p_pia; + memnew_placement(dest, Variant(*pia)); } void GDAPI godot_variant_new_packed_float32_array(godot_variant *r_dest, const godot_packed_float32_array *p_pra) { Variant *dest = (Variant *)r_dest; - PackedFloat32Array *pra = (PackedFloat32Array *)p_pra; - memnew_placement_custom(dest, Variant, Variant(*pra)); + const PackedFloat32Array *pra = (const PackedFloat32Array *)p_pra; + memnew_placement(dest, Variant(*pra)); } void GDAPI godot_variant_new_packed_float64_array(godot_variant *r_dest, const godot_packed_float64_array *p_pra) { Variant *dest = (Variant *)r_dest; - PackedFloat64Array *pra = (PackedFloat64Array *)p_pra; - memnew_placement_custom(dest, Variant, Variant(*pra)); + const PackedFloat64Array *pra = (const PackedFloat64Array *)p_pra; + memnew_placement(dest, Variant(*pra)); } void GDAPI godot_variant_new_packed_string_array(godot_variant *r_dest, const godot_packed_string_array *p_psa) { Variant *dest = (Variant *)r_dest; - PackedStringArray *psa = (PackedStringArray *)p_psa; - memnew_placement_custom(dest, Variant, Variant(*psa)); + const PackedStringArray *psa = (const PackedStringArray *)p_psa; + memnew_placement(dest, Variant(*psa)); } void GDAPI godot_variant_new_packed_vector2_array(godot_variant *r_dest, const godot_packed_vector2_array *p_pv2a) { Variant *dest = (Variant *)r_dest; - PackedVector2Array *pv2a = (PackedVector2Array *)p_pv2a; - memnew_placement_custom(dest, Variant, Variant(*pv2a)); + const PackedVector2Array *pv2a = (const PackedVector2Array *)p_pv2a; + memnew_placement(dest, Variant(*pv2a)); } void GDAPI godot_variant_new_packed_vector3_array(godot_variant *r_dest, const godot_packed_vector3_array *p_pv3a) { Variant *dest = (Variant *)r_dest; - PackedVector3Array *pv3a = (PackedVector3Array *)p_pv3a; - memnew_placement_custom(dest, Variant, Variant(*pv3a)); + const PackedVector3Array *pv3a = (const PackedVector3Array *)p_pv3a; + memnew_placement(dest, Variant(*pv3a)); } void GDAPI godot_variant_new_packed_color_array(godot_variant *r_dest, const godot_packed_color_array *p_pca) { Variant *dest = (Variant *)r_dest; - PackedColorArray *pca = (PackedColorArray *)p_pca; - memnew_placement_custom(dest, Variant, Variant(*pca)); + const PackedColorArray *pca = (const PackedColorArray *)p_pca; + memnew_placement(dest, Variant(*pca)); } godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self) { @@ -298,17 +286,12 @@ godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self) { return self->operator bool(); } -uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - return self->operator uint64_t(); -} - -int64_t GDAPI godot_variant_as_int(const godot_variant *p_self) { +godot_int GDAPI godot_variant_as_int(const godot_variant *p_self) { const Variant *self = (const Variant *)p_self; return self->operator int64_t(); } -double GDAPI godot_variant_as_real(const godot_variant *p_self) { +godot_float GDAPI godot_variant_as_float(const godot_variant *p_self) { const Variant *self = (const Variant *)p_self; return self->operator double(); } @@ -393,10 +376,10 @@ godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self) { return raw_dest; } -godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) { - godot_quat raw_dest; +godot_quaternion GDAPI godot_variant_as_quaternion(const godot_variant *p_self) { + godot_quaternion raw_dest; const Variant *self = (const Variant *)p_self; - Quat *dest = (Quat *)&raw_dest; + Quaternion *dest = (Quaternion *)&raw_dest; *dest = *self; return raw_dest; } @@ -417,10 +400,10 @@ godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) { return raw_dest; } -godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self) { - godot_transform raw_dest; +godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self) { + godot_transform3d raw_dest; const Variant *self = (const Variant *)p_self; - Transform *dest = (Transform *)&raw_dest; + Transform3D *dest = (Transform3D *)&raw_dest; *dest = *self; return raw_dest; } @@ -569,45 +552,204 @@ godot_packed_color_array GDAPI godot_variant_as_packed_color_array(const godot_v return raw_dest; } -godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error) { +void GDAPI godot_variant_destroy(godot_variant *p_self) { Variant *self = (Variant *)p_self; - String *method = (String *)p_method; + self->~Variant(); +} + +// Dynamic interaction. + +void GDAPI godot_variant_call(godot_variant *p_self, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant *self = (Variant *)p_self; + const StringName *method = (const StringName *)p_method; const Variant **args = (const Variant **)p_args; - godot_variant raw_dest; - Variant *dest = (Variant *)&raw_dest; + Variant ret; Callable::CallError error; - memnew_placement_custom(dest, Variant, Variant(self->call(*method, args, p_argcount, error))); + self->call(*method, args, p_argcount, ret, error); + memnew_placement(r_return, Variant(ret)); + if (r_error) { r_error->error = (godot_variant_call_error_error)error.error; r_error->argument = error.argument; r_error->expected = (godot_variant_type)error.expected; } - return raw_dest; } -godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method) { +void GDAPI godot_variant_call_with_cstring(godot_variant *p_self, const char *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant *self = (Variant *)p_self; + const StringName method(p_method); + const Variant **args = (const Variant **)p_args; + Variant ret; + Callable::CallError error; + self->call(method, args, p_argcount, ret, error); + memnew_placement(r_return, Variant(ret)); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +void GDAPI godot_variant_call_static(godot_variant_type p_type, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant::Type type = (Variant::Type)p_type; + const StringName *method = (const StringName *)p_method; + const Variant **args = (const Variant **)p_args; + Variant ret; + Callable::CallError error; + Variant::call_static(type, *method, args, p_argcount, ret, error); + memnew_placement(r_return, Variant(ret)); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +void GDAPI godot_variant_call_static_with_cstring(godot_variant_type p_type, const char *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant *r_return, godot_variant_call_error *r_error) { + Variant::Type type = (Variant::Type)p_type; + const StringName method(p_method); + const Variant **args = (const Variant **)p_args; + Variant ret; + Callable::CallError error; + Variant::call_static(type, method, args, p_argcount, ret, error); + memnew_placement(r_return, Variant(ret)); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_return, bool *r_valid) { + Variant::Operator op = (Variant::Operator)p_op; + const Variant *a = (const Variant *)p_a; + const Variant *b = (const Variant *)p_b; + Variant *ret = (Variant *)r_return; + Variant::evaluate(op, *a, *b, *ret, *r_valid); +} + +void GDAPI godot_variant_set(godot_variant *p_self, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid) { + Variant *self = (Variant *)p_self; + const Variant *key = (const Variant *)p_key; + const Variant *value = (const Variant *)p_value; + + self->set(*key, *value, r_valid); +} + +void GDAPI godot_variant_set_named(godot_variant *p_self, const godot_string_name *p_key, const godot_variant *p_value, bool *r_valid) { + Variant *self = (Variant *)p_self; + const StringName *key = (const StringName *)p_key; + const Variant *value = (const Variant *)p_value; + + self->set_named(*key, *value, *r_valid); +} + +void GDAPI godot_variant_set_named_with_cstring(godot_variant *p_self, const char *p_key, const godot_variant *p_value, bool *r_valid) { + Variant *self = (Variant *)p_self; + const StringName key(p_key); + const Variant *value = (const Variant *)p_value; + + self->set_named(key, *value, *r_valid); +} + +void GDAPI godot_variant_set_keyed(godot_variant *p_self, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid) { + Variant *self = (Variant *)p_self; + const Variant *key = (const Variant *)p_key; + const Variant *value = (const Variant *)p_value; + + self->set_keyed(*key, *value, *r_valid); +} + +void GDAPI godot_variant_set_indexed(godot_variant *p_self, godot_int p_index, const godot_variant *p_value, bool *r_valid, bool *r_oob) { + Variant *self = (Variant *)p_self; + const Variant *value = (const Variant *)p_value; + + self->set_indexed(p_index, value, *r_valid, *r_oob); +} + +godot_variant GDAPI godot_variant_get(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid) { const Variant *self = (const Variant *)p_self; - const String *method = (const String *)p_method; - return self->has_method(*method); + const Variant *key = (const Variant *)p_key; + Variant ret; + + ret = self->get(*key, r_valid); + godot_variant result; + memnew_placement(&result, Variant(ret)); + return result; } -godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other) { +godot_variant GDAPI godot_variant_get_named(const godot_variant *p_self, const godot_string_name *p_key, bool *r_valid) { const Variant *self = (const Variant *)p_self; - const Variant *other = (const Variant *)p_other; - return self->operator==(*other); + const StringName *key = (const StringName *)p_key; + Variant ret; + + ret = self->get_named(*key, *r_valid); + godot_variant result; + memnew_placement(&result, Variant(ret)); + return result; } -godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other) { +godot_variant GDAPI godot_variant_get_named_with_cstring(const godot_variant *p_self, const char *p_key, bool *r_valid) { const Variant *self = (const Variant *)p_self; - const Variant *other = (const Variant *)p_other; - return self->operator<(*other); + const StringName *key = (const StringName *)p_key; + Variant ret; + + ret = self->get_named(*key, *r_valid); + godot_variant result; + memnew_placement(&result, Variant(ret)); + return result; } -uint32_t GDAPI godot_variant_hash(const godot_variant *p_self) { +godot_variant GDAPI godot_variant_get_keyed(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid) { const Variant *self = (const Variant *)p_self; - return self->hash(); + const Variant *key = (const Variant *)p_key; + Variant ret; + + ret = self->get_keyed(*key, *r_valid); + godot_variant result; + memnew_placement(&result, Variant(ret)); + return result; +} + +godot_variant GDAPI godot_variant_get_indexed(const godot_variant *p_self, godot_int p_index, bool *r_valid, bool *r_oob) { + const Variant *self = (const Variant *)p_self; + Variant ret; + + ret = self->get_indexed(p_index, *r_valid, *r_oob); + godot_variant result; + memnew_placement(&result, Variant(ret)); + return result; } +/// Iteration. +bool GDAPI godot_variant_iter_init(const godot_variant *p_self, godot_variant *r_iter, bool *r_valid) { + const Variant *self = (const Variant *)p_self; + Variant *iter = (Variant *)r_iter; + + return self->iter_init(*iter, *r_valid); +} + +bool GDAPI godot_variant_iter_next(const godot_variant *p_self, godot_variant *r_iter, bool *r_valid) { + const Variant *self = (const Variant *)p_self; + Variant *iter = (Variant *)r_iter; + + return self->iter_next(*iter, *r_valid); +} + +godot_variant GDAPI godot_variant_iter_get(const godot_variant *p_self, godot_variant *r_iter, bool *r_valid) { + const Variant *self = (const Variant *)p_self; + Variant *iter = (Variant *)r_iter; + + Variant result = self->iter_next(*iter, *r_valid); + godot_variant ret; + memnew_placement(&ret, Variant(result)); + return ret; +} + +/// Variant functions. godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other) { const Variant *self = (const Variant *)p_self; const Variant *other = (const Variant *)p_other; @@ -619,27 +761,511 @@ godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self) { return self->booleanize(); } -void GDAPI godot_variant_destroy(godot_variant *p_self) { - Variant *self = (Variant *)p_self; - self->~Variant(); +void GDAPI godot_variant_blend(const godot_variant *p_a, const godot_variant *p_b, float p_c, godot_variant *r_dst) { + const Variant *a = (const Variant *)p_a; + const Variant *b = (const Variant *)p_b; + Variant *dst = (Variant *)r_dst; + Variant::blend(*a, *b, p_c, *dst); } -// GDNative core 1.1 +void GDAPI godot_variant_interpolate(const godot_variant *p_a, const godot_variant *p_b, float p_c, godot_variant *r_dst) { + const Variant *a = (const Variant *)p_a; + const Variant *b = (const Variant *)p_b; + Variant *dst = (Variant *)r_dst; + Variant::interpolate(*a, *b, p_c, *dst); +} -godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_op) { - Variant::Operator op = (Variant::Operator)p_op; - godot_string raw_dest; - String *dest = (String *)&raw_dest; - memnew_placement(dest, String(Variant::get_operator_name(op))); // operator = is overloaded by String - return raw_dest; +godot_variant GDAPI godot_variant_duplicate(const godot_variant *p_self, godot_bool p_deep) { + const Variant *self = (const Variant *)p_self; + Variant result = self->duplicate(p_deep); + godot_variant ret; + memnew_placement(&ret, Variant(result)); + return ret; } -void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid) { - Variant::Operator op = (Variant::Operator)p_op; - const Variant *a = (const Variant *)p_a; - const Variant *b = (const Variant *)p_b; +godot_string GDAPI godot_variant_stringify(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + String result = *self; + godot_string ret; + memnew_placement(&ret, String(result)); + return ret; +} + +// Discovery API + +/// Operators +godot_validated_operator_evaluator GDAPI godot_variant_get_validated_operator_evaluator(godot_variant_operator p_operator, godot_variant_type p_type_a, godot_variant_type p_type_b) { + return (godot_validated_operator_evaluator)Variant::get_validated_operator_evaluator((Variant::Operator)p_operator, (Variant::Type)p_type_a, (Variant::Type)p_type_b); +} + +godot_ptr_operator_evaluator GDAPI godot_variant_get_ptr_operator_evaluator(godot_variant_operator p_operator, godot_variant_type p_type_a, godot_variant_type p_type_b) { + return (godot_ptr_operator_evaluator)Variant::get_ptr_operator_evaluator((Variant::Operator)p_operator, (Variant::Type)p_type_a, (Variant::Type)p_type_b); +} + +godot_variant_type GDAPI godot_variant_get_operator_return_type(godot_variant_operator p_operator, godot_variant_type p_type_a, godot_variant_type p_type_b) { + return (godot_variant_type)Variant::get_operator_return_type((Variant::Operator)p_operator, (Variant::Type)p_type_a, (Variant::Type)p_type_b); +} + +godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_operator) { + String op_name = Variant::get_operator_name((Variant::Operator)p_operator); + godot_string ret; + memnew_placement(&ret, String(op_name)); + return ret; +} + +/// Built-in Methods + +bool GDAPI godot_variant_has_builtin_method(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::has_builtin_method((Variant::Type)p_type, *((const StringName *)p_method)); +} + +bool GDAPI godot_variant_has_builtin_method_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::has_builtin_method((Variant::Type)p_type, StringName(p_method)); +} + +godot_validated_builtin_method GDAPI godot_variant_get_validated_builtin_method(godot_variant_type p_type, const godot_string_name *p_method) { + return (godot_validated_builtin_method)Variant::get_validated_builtin_method((Variant::Type)p_type, *((const StringName *)p_method)); +} + +godot_validated_builtin_method GDAPI godot_variant_get_validated_builtin_method_with_cstring(godot_variant_type p_type, const char *p_method) { + return (godot_validated_builtin_method)Variant::get_validated_builtin_method((Variant::Type)p_type, StringName(p_method)); +} + +godot_ptr_builtin_method GDAPI godot_variant_get_ptr_builtin_method(godot_variant_type p_type, const godot_string_name *p_method) { + return (godot_ptr_builtin_method)Variant::get_ptr_builtin_method((Variant::Type)p_type, *((const StringName *)p_method)); +} + +godot_ptr_builtin_method GDAPI godot_variant_get_ptr_builtin_method_with_cstring(godot_variant_type p_type, const char *p_method) { + return (godot_ptr_builtin_method)Variant::get_ptr_builtin_method((Variant::Type)p_type, StringName(p_method)); +} + +int GDAPI godot_variant_get_builtin_method_argument_count(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::get_builtin_method_argument_count((Variant::Type)p_type, *((const StringName *)p_method)); +} + +int GDAPI godot_variant_get_builtin_method_argument_count_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::get_builtin_method_argument_count((Variant::Type)p_type, StringName(p_method)); +} + +godot_variant_type GDAPI godot_variant_get_builtin_method_argument_type(godot_variant_type p_type, const godot_string_name *p_method, int p_argument) { + return (godot_variant_type)Variant::get_builtin_method_argument_type((Variant::Type)p_type, *((const StringName *)p_method), p_argument); +} + +godot_variant_type GDAPI godot_variant_get_builtin_method_argument_type_with_cstring(godot_variant_type p_type, const char *p_method, int p_argument) { + return (godot_variant_type)Variant::get_builtin_method_argument_type((Variant::Type)p_type, StringName(p_method), p_argument); +} + +godot_string GDAPI godot_variant_get_builtin_method_argument_name(godot_variant_type p_type, const godot_string_name *p_method, int p_argument) { + String name = Variant::get_builtin_method_argument_name((Variant::Type)p_type, *((const StringName *)p_method), p_argument); + return *(godot_string *)&name; +} + +godot_string GDAPI godot_variant_get_builtin_method_argument_name_with_cstring(godot_variant_type p_type, const char *p_method, int p_argument) { + String name = Variant::get_builtin_method_argument_name((Variant::Type)p_type, StringName(p_method), p_argument); + return *(godot_string *)&name; +} + +bool GDAPI godot_variant_has_builtin_method_return_value(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::has_builtin_method_return_value((Variant::Type)p_type, *((const StringName *)p_method)); +} + +bool GDAPI godot_variant_has_builtin_method_return_value_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::has_builtin_method_return_value((Variant::Type)p_type, StringName(p_method)); +} + +godot_variant_type GDAPI godot_variant_get_builtin_method_return_type(godot_variant_type p_type, const godot_string_name *p_method) { + return (godot_variant_type)Variant::get_builtin_method_return_type((Variant::Type)p_type, *((const StringName *)p_method)); +} + +godot_variant_type GDAPI godot_variant_get_builtin_method_return_type_with_cstring(godot_variant_type p_type, const char *p_method) { + return (godot_variant_type)Variant::get_builtin_method_return_type((Variant::Type)p_type, StringName(p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_const(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::is_builtin_method_const((Variant::Type)p_type, *((const StringName *)p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_const_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::is_builtin_method_const((Variant::Type)p_type, StringName(p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_static(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::is_builtin_method_static((Variant::Type)p_type, *((const StringName *)p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_static_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::is_builtin_method_static((Variant::Type)p_type, StringName(p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_vararg(godot_variant_type p_type, const godot_string_name *p_method) { + return Variant::is_builtin_method_vararg((Variant::Type)p_type, *((const StringName *)p_method)); +} + +bool GDAPI godot_variant_is_builtin_method_vararg_with_cstring(godot_variant_type p_type, const char *p_method) { + return Variant::is_builtin_method_vararg((Variant::Type)p_type, StringName(p_method)); +} + +int GDAPI godot_variant_get_builtin_method_count(godot_variant_type p_type) { + return Variant::get_builtin_method_count((Variant::Type)p_type); +} + +void GDAPI godot_variant_get_builtin_method_list(godot_variant_type p_type, godot_string_name *r_list) { + List<StringName> list; + Variant::get_builtin_method_list((Variant::Type)p_type, &list); + int i = 0; + for (const StringName &E : list) { + memnew_placement(&r_list[i], StringName(E)); + } +} + +/// Constructors + +int GDAPI godot_variant_get_constructor_count(godot_variant_type p_type) { + return Variant::get_constructor_count((Variant::Type)p_type); +} + +godot_validated_constructor GDAPI godot_variant_get_validated_constructor(godot_variant_type p_type, int p_constructor) { + return (godot_validated_constructor)Variant::get_validated_constructor((Variant::Type)p_type, p_constructor); +} + +godot_ptr_constructor GDAPI godot_variant_get_ptr_constructor(godot_variant_type p_type, int p_constructor) { + return (godot_ptr_constructor)Variant::get_ptr_constructor((Variant::Type)p_type, p_constructor); +} + +int GDAPI godot_variant_get_constructor_argument_count(godot_variant_type p_type, int p_constructor) { + return Variant::get_constructor_argument_count((Variant::Type)p_type, p_constructor); +} + +godot_variant_type GDAPI godot_variant_get_constructor_argument_type(godot_variant_type p_type, int p_constructor, int p_argument) { + return (godot_variant_type)Variant::get_constructor_argument_type((Variant::Type)p_type, p_constructor, p_argument); +} + +godot_string GDAPI godot_variant_get_constructor_argument_name(godot_variant_type p_type, int p_constructor, int p_argument) { + String name = Variant::get_constructor_argument_name((Variant::Type)p_type, p_constructor, p_argument); + godot_string ret; + memnew_placement(&ret, String(name)); + return ret; +} + +void GDAPI godot_variant_construct(godot_variant_type p_type, godot_variant *p_base, const godot_variant **p_args, int p_argcount, godot_variant_call_error *r_error) { + Variant::construct((Variant::Type)p_type, *((Variant *)p_base), (const Variant **)p_args, p_argcount, *((Callable::CallError *)r_error)); +} + +/// Properties. +godot_variant_type GDAPI godot_variant_get_member_type(godot_variant_type p_type, const godot_string_name *p_member) { + return (godot_variant_type)Variant::get_member_type((Variant::Type)p_type, *((const StringName *)p_member)); +} + +godot_variant_type GDAPI godot_variant_get_member_type_with_cstring(godot_variant_type p_type, const char *p_member) { + return (godot_variant_type)Variant::get_member_type((Variant::Type)p_type, StringName(p_member)); +} + +int GDAPI godot_variant_get_member_count(godot_variant_type p_type) { + return Variant::get_member_count((Variant::Type)p_type); +} + +void GDAPI godot_variant_get_member_list(godot_variant_type p_type, godot_string_name *r_list) { + List<StringName> members; + Variant::get_member_list((Variant::Type)p_type, &members); + int i = 0; + for (const StringName &E : members) { + memnew_placement(&r_list[i++], StringName(E)); + } +} + +godot_validated_setter GDAPI godot_variant_get_validated_setter(godot_variant_type p_type, const godot_string_name *p_member) { + return (godot_validated_setter)Variant::get_member_validated_setter((Variant::Type)p_type, *((const StringName *)p_member)); +} + +godot_validated_setter GDAPI godot_variant_get_validated_setter_with_cstring(godot_variant_type p_type, const char *p_member) { + return (godot_validated_setter)Variant::get_member_validated_setter((Variant::Type)p_type, StringName(p_member)); +} + +godot_validated_getter GDAPI godot_variant_get_validated_getter(godot_variant_type p_type, const godot_string_name *p_member) { + return (godot_validated_getter)Variant::get_member_validated_getter((Variant::Type)p_type, *((const StringName *)p_member)); +} + +godot_validated_getter GDAPI godot_variant_get_validated_getter_with_cstring(godot_variant_type p_type, const char *p_member) { + return (godot_validated_getter)Variant::get_member_validated_getter((Variant::Type)p_type, StringName(p_member)); +} + +godot_ptr_setter GDAPI godot_variant_get_ptr_setter(godot_variant_type p_type, const godot_string_name *p_member) { + return (godot_ptr_setter)Variant::get_member_ptr_setter((Variant::Type)p_type, *((const StringName *)p_member)); +} + +godot_ptr_setter GDAPI godot_variant_get_ptr_setter_with_cstring(godot_variant_type p_type, const char *p_member) { + return (godot_ptr_setter)Variant::get_member_ptr_setter((Variant::Type)p_type, StringName(p_member)); +} + +godot_ptr_getter GDAPI godot_variant_get_ptr_getter(godot_variant_type p_type, const godot_string_name *p_member) { + return (godot_ptr_getter)Variant::get_member_ptr_getter((Variant::Type)p_type, *((const StringName *)p_member)); +} + +godot_ptr_getter GDAPI godot_variant_get_ptr_getter_with_cstring(godot_variant_type p_type, const char *p_member) { + return (godot_ptr_getter)Variant::get_member_ptr_getter((Variant::Type)p_type, StringName(p_member)); +} + +/// Indexing. +bool GDAPI godot_variant_has_indexing(godot_variant_type p_type) { + return Variant::has_indexing((Variant::Type)p_type); +} + +godot_variant_type GDAPI godot_variant_get_indexed_element_type(godot_variant_type p_type) { + return (godot_variant_type)Variant::get_indexed_element_type((Variant::Type)p_type); +} + +godot_validated_indexed_setter GDAPI godot_variant_get_validated_indexed_setter(godot_variant_type p_type) { + return (godot_validated_indexed_setter)Variant::get_member_validated_indexed_setter((Variant::Type)p_type); +} + +godot_validated_indexed_getter GDAPI godot_variant_get_validated_indexed_getter(godot_variant_type p_type) { + return (godot_validated_indexed_getter)Variant::get_member_validated_indexed_getter((Variant::Type)p_type); +} + +godot_ptr_indexed_setter GDAPI godot_variant_get_ptr_indexed_setter(godot_variant_type p_type) { + return (godot_ptr_indexed_setter)Variant::get_member_ptr_indexed_setter((Variant::Type)p_type); +} + +godot_ptr_indexed_getter GDAPI godot_variant_get_ptr_indexed_getter(godot_variant_type p_type) { + return (godot_ptr_indexed_getter)Variant::get_member_ptr_indexed_getter((Variant::Type)p_type); +} + +uint64_t GDAPI godot_variant_get_indexed_size(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return self->get_indexed_size(); +} + +/// Keying. +bool GDAPI godot_variant_is_keyed(godot_variant_type p_type) { + return Variant::is_keyed((Variant::Type)p_type); +} + +godot_validated_keyed_setter GDAPI godot_variant_get_validated_keyed_setter(godot_variant_type p_type) { + return (godot_validated_keyed_setter)Variant::get_member_validated_keyed_setter((Variant::Type)p_type); +} + +godot_validated_keyed_getter GDAPI godot_variant_get_validated_keyed_getter(godot_variant_type p_type) { + return (godot_validated_keyed_getter)Variant::get_member_validated_keyed_getter((Variant::Type)p_type); +} + +godot_validated_keyed_checker GDAPI godot_variant_get_validated_keyed_checker(godot_variant_type p_type) { + return (godot_validated_keyed_checker)Variant::get_member_validated_keyed_checker((Variant::Type)p_type); +} + +godot_ptr_keyed_setter GDAPI godot_variant_get_ptr_keyed_setter(godot_variant_type p_type) { + return (godot_ptr_keyed_setter)Variant::get_member_ptr_keyed_setter((Variant::Type)p_type); +} + +godot_ptr_keyed_getter GDAPI godot_variant_get_ptr_keyed_getter(godot_variant_type p_type) { + return (godot_ptr_keyed_getter)Variant::get_member_ptr_keyed_getter((Variant::Type)p_type); +} + +godot_ptr_keyed_checker GDAPI godot_variant_get_ptr_keyed_checker(godot_variant_type p_type) { + return (godot_ptr_keyed_checker)Variant::get_member_ptr_keyed_checker((Variant::Type)p_type); +} + +/// Constants. +int GDAPI godot_variant_get_constants_count(godot_variant_type p_type) { + return Variant::get_constants_count_for_type((Variant::Type)p_type); +} + +void GDAPI godot_variant_get_constants_list(godot_variant_type p_type, godot_string_name *r_list) { + List<StringName> constants; + int i = 0; + Variant::get_constants_for_type((Variant::Type)p_type, &constants); + for (const StringName &E : constants) { + memnew_placement(&r_list[i++], StringName(E)); + } +} + +bool GDAPI godot_variant_has_constant(godot_variant_type p_type, const godot_string_name *p_constant) { + return Variant::has_constant((Variant::Type)p_type, *((const StringName *)p_constant)); +} + +bool GDAPI godot_variant_has_constant_with_cstring(godot_variant_type p_type, const char *p_constant) { + return Variant::has_constant((Variant::Type)p_type, StringName(p_constant)); +} + +godot_variant GDAPI godot_variant_get_constant_value(godot_variant_type p_type, const godot_string_name *p_constant) { + Variant constant = Variant::get_constant_value((Variant::Type)p_type, *((const StringName *)p_constant)); + godot_variant ret; + memnew_placement(&ret, Variant(constant)); + return ret; +} + +godot_variant GDAPI godot_variant_get_constant_value_with_cstring(godot_variant_type p_type, const char *p_constant) { + Variant constant = Variant::get_constant_value((Variant::Type)p_type, StringName(p_constant)); + godot_variant ret; + memnew_placement(&ret, Variant(constant)); + return ret; +} + +/// Utilities. +bool GDAPI godot_variant_has_utility_function(const godot_string_name *p_function) { + return Variant::has_utility_function(*((const StringName *)p_function)); +} + +bool GDAPI godot_variant_has_utility_function_with_cstring(const char *p_function) { + return Variant::has_utility_function(StringName(p_function)); +} + +void GDAPI godot_variant_call_utility_function(const godot_string_name *p_function, godot_variant *r_ret, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error) { + const StringName *function = (const StringName *)p_function; Variant *ret = (Variant *)r_ret; - Variant::evaluate(op, *a, *b, *ret, *r_valid); + const Variant **args = (const Variant **)p_args; + Callable::CallError error; + + Variant::call_utility_function(*function, ret, args, p_argument_count, error); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +void GDAPI godot_variant_call_utility_function_with_cstring(const char *p_function, godot_variant *r_ret, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error) { + Variant *ret = (Variant *)r_ret; + const Variant **args = (const Variant **)p_args; + Callable::CallError error; + + Variant::call_utility_function(StringName(p_function), ret, args, p_argument_count, error); + + if (r_error) { + r_error->error = (godot_variant_call_error_error)error.error; + r_error->argument = error.argument; + r_error->expected = (godot_variant_type)error.expected; + } +} + +godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function(const godot_string_name *p_function) { + return (godot_ptr_utility_function)Variant::get_ptr_utility_function(*((const StringName *)p_function)); +} + +godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function_with_cstring(const char *p_function) { + return (godot_ptr_utility_function)Variant::get_ptr_utility_function(StringName(p_function)); +} + +godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function(const godot_string_name *p_function) { + return (godot_validated_utility_function)Variant::get_validated_utility_function(*((const StringName *)p_function)); +} + +godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function_with_cstring(const char *p_function) { + return (godot_validated_utility_function)Variant::get_validated_utility_function(StringName(p_function)); +} + +godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type(const godot_string_name *p_function) { + return (godot_variant_utility_function_type)Variant::get_utility_function_type(*((const StringName *)p_function)); +} + +godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type_with_cstring(const char *p_function) { + return (godot_variant_utility_function_type)Variant::get_utility_function_type(StringName(p_function)); +} + +int GDAPI godot_variant_get_utility_function_argument_count(const godot_string_name *p_function) { + return Variant::get_utility_function_argument_count(*((const StringName *)p_function)); +} + +int GDAPI godot_variant_get_utility_function_argument_count_with_cstring(const char *p_function) { + return Variant::get_utility_function_argument_count(StringName(p_function)); +} + +godot_variant_type GDAPI godot_variant_get_utility_function_argument_type(const godot_string_name *p_function, int p_argument) { + return (godot_variant_type)Variant::get_utility_function_argument_type(*((const StringName *)p_function), p_argument); +} + +godot_variant_type GDAPI godot_variant_get_utility_function_argument_type_with_cstring(const char *p_function, int p_argument) { + return (godot_variant_type)Variant::get_utility_function_argument_type(StringName(p_function), p_argument); +} + +godot_string GDAPI godot_variant_get_utility_function_argument_name(const godot_string_name *p_function, int p_argument) { + String argument_name = Variant::get_utility_function_argument_name(*((const StringName *)p_function), p_argument); + godot_string ret; + memnew_placement(&ret, String(argument_name)); + return ret; +} + +godot_string GDAPI godot_variant_get_utility_function_argument_name_with_cstring(const char *p_function, int p_argument) { + String argument_name = Variant::get_utility_function_argument_name(StringName(p_function), p_argument); + godot_string ret; + memnew_placement(&ret, String(argument_name)); + return ret; +} + +bool GDAPI godot_variant_has_utility_function_return_value(const godot_string_name *p_function) { + return Variant::has_utility_function_return_value(*((const StringName *)p_function)); +} + +bool GDAPI godot_variant_has_utility_function_return_value_with_cstring(const char *p_function) { + return Variant::has_utility_function_return_value(StringName(p_function)); +} + +godot_variant_type GDAPI godot_variant_get_utility_function_return_type(const godot_string_name *p_function) { + return (godot_variant_type)Variant::get_utility_function_return_type(*((const StringName *)p_function)); +} + +godot_variant_type GDAPI godot_variant_get_utility_function_return_type_with_cstring(const char *p_function) { + return (godot_variant_type)Variant::get_utility_function_return_type(StringName(p_function)); +} + +bool GDAPI godot_variant_is_utility_function_vararg(const godot_string_name *p_function) { + return Variant::is_utility_function_vararg(*((const StringName *)p_function)); +} + +bool GDAPI godot_variant_is_utility_function_vararg_with_cstring(const char *p_function) { + return Variant::is_utility_function_vararg(StringName(p_function)); +} + +int GDAPI godot_variant_get_utility_function_count() { + return Variant::get_utility_function_count(); +} + +void GDAPI godot_variant_get_utility_function_list(godot_string_name *r_functions) { + List<StringName> functions; + godot_string_name *func = r_functions; + Variant::get_utility_function_list(&functions); + + for (const StringName &E : functions) { + memnew_placement(func++, StringName(E)); + } +} + +// Introspection. + +godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) { + const Variant *self = (const Variant *)p_self; + return (godot_variant_type)self->get_type(); +} + +bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string_name *p_method) { + const Variant *self = (const Variant *)p_self; + const StringName *method = (const StringName *)p_method; + return self->has_method(*method); +} + +bool GDAPI godot_variant_has_member(godot_variant_type p_type, const godot_string_name *p_member) { + return Variant::has_member((Variant::Type)p_type, *((const StringName *)p_member)); +} + +bool GDAPI godot_variant_has_key(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid) { + const Variant *self = (const Variant *)p_self; + const Variant *key = (const Variant *)p_key; + return self->has_key(*key, *r_valid); +} + +godot_string GDAPI godot_variant_get_type_name(godot_variant_type p_type) { + String name = Variant::get_type_name((Variant::Type)p_type); + godot_string ret; + memnew_placement(&ret, String(name)); + return ret; +} + +bool GDAPI godot_variant_can_convert(godot_variant_type p_from, godot_variant_type p_to) { + return Variant::can_convert((Variant::Type)p_from, (Variant::Type)p_to); +} + +bool GDAPI godot_variant_can_convert_strict(godot_variant_type p_from, godot_variant_type p_to) { + return Variant::can_convert_strict((Variant::Type)p_from, (Variant::Type)p_to); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp index 1ee716df86..6a01a7ad59 100644 --- a/modules/gdnative/gdnative/vector2.cpp +++ b/modules/gdnative/gdnative/vector2.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,430 +31,48 @@ #include "gdnative/vector2.h" #include "core/math/vector2.h" -#include "core/variant.h" - -#ifdef __cplusplus -extern "C" { -#endif static_assert(sizeof(godot_vector2) == sizeof(Vector2), "Vector2 size mismatch"); static_assert(sizeof(godot_vector2i) == sizeof(Vector2i), "Vector2i size mismatch"); -// Vector2 - -void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y) { - Vector2 *dest = (Vector2 *)r_dest; - *dest = Vector2(p_x, p_y); -} - -godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self) { - godot_string ret; - const Vector2 *self = (const Vector2 *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_vector2i GDAPI godot_vector2_as_vector2i(const godot_vector2 *p_self) { - godot_vector2i dest; - const Vector2 *self = (const Vector2 *)p_self; - *((Vector2i *)&dest) = Vector2i(*self); - return dest; -} - -godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - *((Vector2 *)&dest) = self->normalized(); - return dest; -} - -godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self) { - const Vector2 *self = (const Vector2 *)p_self; - return self->length(); -} - -godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self) { - const Vector2 *self = (const Vector2 *)p_self; - return self->angle(); -} - -godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self) { - const Vector2 *self = (const Vector2 *)p_self; - return self->length_squared(); -} - -godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self) { - const Vector2 *self = (const Vector2 *)p_self; - return self->is_normalized(); -} - -godot_vector2 GDAPI godot_vector2_direction_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - *((Vector2 *)&dest) = self->direction_to(*to); - return dest; -} - -godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - return self->distance_to(*to); -} - -godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - return self->distance_squared_to(*to); -} - -godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - return self->angle_to(*to); -} - -godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - return self->angle_to_point(*to); -} - -godot_vector2 GDAPI godot_vector2_lerp(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - *((Vector2 *)&dest) = self->lerp(*b, p_t); - return dest; -} - -godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - const Vector2 *pre_a = (const Vector2 *)p_pre_a; - const Vector2 *post_b = (const Vector2 *)p_post_b; - *((Vector2 *)&dest) = self->cubic_interpolate(*b, *pre_a, *post_b, p_t); - return dest; -} - -godot_vector2 GDAPI godot_vector2_move_toward(const godot_vector2 *p_self, const godot_vector2 *p_to, const godot_real p_delta) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *to = (const Vector2 *)p_to; - *((Vector2 *)&dest) = self->move_toward(*to, p_delta); - return dest; -} - -godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - - *((Vector2 *)&dest) = self->rotated(p_phi); - return dest; -} - -godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - *((Vector2 *)&dest) = self->tangent(); - return dest; -} - -godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - *((Vector2 *)&dest) = self->floor(); - return dest; -} - -godot_vector2 GDAPI godot_vector2_sign(const godot_vector2 *p_self) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - *((Vector2 *)&dest) = self->sign(); - return dest; -} - -godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *by = (const Vector2 *)p_by; - *((Vector2 *)&dest) = self->snapped(*by); - return dest; -} - -godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self) { - const Vector2 *self = (const Vector2 *)p_self; - return self->aspect(); -} - -godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *with = (const Vector2 *)p_with; - return self->dot(*with); -} - -godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *n = (const Vector2 *)p_n; - *((Vector2 *)&dest) = self->slide(*n); - return dest; -} - -godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *n = (const Vector2 *)p_n; - *((Vector2 *)&dest) = self->bounce(*n); - return dest; -} - -godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *n = (const Vector2 *)p_n; - *((Vector2 *)&dest) = self->reflect(*n); - return dest; -} - -godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - *((Vector2 *)&dest) = self->abs(); - return dest; -} - -godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length) { - godot_vector2 dest; - const Vector2 *self = (const Vector2 *)p_self; - - *((Vector2 *)&dest) = self->clamped(p_length); - return dest; -} - -godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - *dest = *self + *b; - return raw_dest; -} - -godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - *dest = *self - *b; - return raw_dest; -} - -godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - *dest = *self * *b; - return raw_dest; -} - -godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - *dest = *self * p_b; - return raw_dest; -} - -godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - *dest = *self / *b; - return raw_dest; -} - -godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - *dest = *self / p_b; - return raw_dest; -} +#ifdef __cplusplus +extern "C" { +#endif -godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - return *self == *b; +void GDAPI godot_vector2_new(godot_vector2 *p_self) { + memnew_placement(p_self, Vector2); } -godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b) { - const Vector2 *self = (const Vector2 *)p_self; - const Vector2 *b = (const Vector2 *)p_b; - return *self < *b; +void GDAPI godot_vector2_new_copy(godot_vector2 *r_dest, const godot_vector2 *p_src) { + memnew_placement(r_dest, Vector2(*(Vector2 *)p_src)); } -godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self) { - godot_vector2 raw_dest; - Vector2 *dest = (Vector2 *)&raw_dest; - const Vector2 *self = (const Vector2 *)p_self; - *dest = -(*self); - return raw_dest; +void GDAPI godot_vector2i_new(godot_vector2i *p_self) { + memnew_placement(p_self, Vector2i); } -void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x) { - Vector2 *self = (Vector2 *)p_self; - self->x = p_x; +void GDAPI godot_vector2i_new_copy(godot_vector2i *r_dest, const godot_vector2i *p_src) { + memnew_placement(r_dest, Vector2i(*(Vector2i *)p_src)); } -void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y) { +godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index) { Vector2 *self = (Vector2 *)p_self; - self->y = p_y; + return (godot_real_t *)&self->operator[](p_index); } -godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self) { +const godot_real_t GDAPI *godot_vector2_operator_index_const(const godot_vector2 *p_self, godot_int p_index) { const Vector2 *self = (const Vector2 *)p_self; - return self->x; -} - -godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self) { - const Vector2 *self = (const Vector2 *)p_self; - return self->y; -} - -// Vector2i - -void GDAPI godot_vector2i_new(godot_vector2i *r_dest, const godot_int p_x, const godot_int p_y) { - Vector2i *dest = (Vector2i *)r_dest; - *dest = Vector2i(p_x, p_y); -} - -godot_string GDAPI godot_vector2i_as_string(const godot_vector2i *p_self) { - godot_string ret; - const Vector2i *self = (const Vector2i *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_vector2 GDAPI godot_vector2i_as_vector2(const godot_vector2i *p_self) { - godot_vector2 dest; - const Vector2i *self = (const Vector2i *)p_self; - *((Vector2 *)&dest) = Vector2(*self); - return dest; + return (const godot_real_t *)&self->operator[](p_index); } -godot_real GDAPI godot_vector2i_aspect(const godot_vector2i *p_self) { - const Vector2i *self = (const Vector2i *)p_self; - return self->aspect(); -} - -godot_vector2i GDAPI godot_vector2i_abs(const godot_vector2i *p_self) { - godot_vector2i dest; - const Vector2i *self = (const Vector2i *)p_self; - *((Vector2i *)&dest) = self->abs(); - return dest; -} - -godot_vector2i GDAPI godot_vector2i_sign(const godot_vector2i *p_self) { - godot_vector2i dest; - const Vector2i *self = (const Vector2i *)p_self; - *((Vector2i *)&dest) = self->sign(); - return dest; -} - -godot_vector2i GDAPI godot_vector2i_operator_add(const godot_vector2i *p_self, const godot_vector2i *p_b) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - const Vector2i *b = (const Vector2i *)p_b; - *dest = *self + *b; - return raw_dest; -} - -godot_vector2i GDAPI godot_vector2i_operator_subtract(const godot_vector2i *p_self, const godot_vector2i *p_b) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - const Vector2i *b = (const Vector2i *)p_b; - *dest = *self - *b; - return raw_dest; -} - -godot_vector2i GDAPI godot_vector2i_operator_multiply_vector(const godot_vector2i *p_self, const godot_vector2i *p_b) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - const Vector2i *b = (const Vector2i *)p_b; - *dest = *self * *b; - return raw_dest; -} - -godot_vector2i GDAPI godot_vector2i_operator_multiply_scalar(const godot_vector2i *p_self, const godot_int p_b) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - *dest = *self * p_b; - return raw_dest; -} - -godot_vector2i GDAPI godot_vector2i_operator_divide_vector(const godot_vector2i *p_self, const godot_vector2i *p_b) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - const Vector2i *b = (const Vector2i *)p_b; - *dest = *self / *b; - return raw_dest; -} - -godot_vector2i GDAPI godot_vector2i_operator_divide_scalar(const godot_vector2i *p_self, const godot_int p_b) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - *dest = *self / p_b; - return raw_dest; -} - -godot_bool GDAPI godot_vector2i_operator_equal(const godot_vector2i *p_self, const godot_vector2i *p_b) { - const Vector2i *self = (const Vector2i *)p_self; - const Vector2i *b = (const Vector2i *)p_b; - return *self == *b; -} - -godot_bool GDAPI godot_vector2i_operator_less(const godot_vector2i *p_self, const godot_vector2i *p_b) { - const Vector2i *self = (const Vector2i *)p_self; - const Vector2i *b = (const Vector2i *)p_b; - return *self < *b; -} - -godot_vector2i GDAPI godot_vector2i_operator_neg(const godot_vector2i *p_self) { - godot_vector2i raw_dest; - Vector2i *dest = (Vector2i *)&raw_dest; - const Vector2i *self = (const Vector2i *)p_self; - *dest = -(*self); - return raw_dest; -} - -void GDAPI godot_vector2i_set_x(godot_vector2i *p_self, const godot_int p_x) { - Vector2i *self = (Vector2i *)p_self; - self->x = p_x; -} - -void GDAPI godot_vector2i_set_y(godot_vector2i *p_self, const godot_int p_y) { +int32_t GDAPI *godot_vector2i_operator_index(godot_vector2i *p_self, godot_int p_index) { Vector2i *self = (Vector2i *)p_self; - self->y = p_y; -} - -godot_int GDAPI godot_vector2i_get_x(const godot_vector2i *p_self) { - const Vector2i *self = (const Vector2i *)p_self; - return self->x; + return (int32_t *)&self->operator[](p_index); } -godot_int GDAPI godot_vector2i_get_y(const godot_vector2i *p_self) { +const int32_t GDAPI *godot_vector2i_operator_index_const(const godot_vector2i *p_self, godot_int p_index) { const Vector2i *self = (const Vector2i *)p_self; - return self->y; + return (const int32_t *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp index 32cad30c17..fb426c8ac4 100644 --- a/modules/gdnative/gdnative/vector3.cpp +++ b/modules/gdnative/gdnative/vector3.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,433 +30,49 @@ #include "gdnative/vector3.h" -#include "core/variant.h" -#include "core/vector.h" - -#ifdef __cplusplus -extern "C" { -#endif +#include "core/math/vector3.h" static_assert(sizeof(godot_vector3) == sizeof(Vector3), "Vector3 size mismatch"); static_assert(sizeof(godot_vector3i) == sizeof(Vector3i), "Vector3i size mismatch"); -// Vector3 - -void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z) { - Vector3 *dest = (Vector3 *)r_dest; - *dest = Vector3(p_x, p_y, p_z); -} - -godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self) { - godot_string ret; - const Vector3 *self = (const Vector3 *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_vector3i GDAPI godot_vector3_as_vector3i(const godot_vector3 *p_self) { - godot_vector3i dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3i *)&dest) = Vector3i(*self); - return dest; -} - -godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self) { - const Vector3 *self = (const Vector3 *)p_self; - return self->min_axis(); -} - -godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self) { - const Vector3 *self = (const Vector3 *)p_self; - return self->max_axis(); -} - -godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self) { - const Vector3 *self = (const Vector3 *)p_self; - return self->length(); -} - -godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self) { - const Vector3 *self = (const Vector3 *)p_self; - return self->length_squared(); -} - -godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self) { - const Vector3 *self = (const Vector3 *)p_self; - return self->is_normalized(); -} - -godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3 *)&dest) = self->normalized(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3 *)&dest) = self->inverse(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_vector3 *p_by) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *snap_axis = (const Vector3 *)p_by; - - *((Vector3 *)&dest) = self->snapped(*snap_axis); - return dest; -} - -godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *axis = (const Vector3 *)p_axis; - *((Vector3 *)&dest) = self->rotated(*axis, p_phi); - return dest; -} - -godot_vector3 GDAPI godot_vector3_lerp(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *((Vector3 *)&dest) = self->lerp(*b, p_t); - return dest; -} - -godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - const Vector3 *pre_a = (const Vector3 *)p_pre_a; - const Vector3 *post_b = (const Vector3 *)p_post_b; - *((Vector3 *)&dest) = self->cubic_interpolate(*b, *pre_a, *post_b, p_t); - return dest; -} - -godot_vector3 GDAPI godot_vector3_move_toward(const godot_vector3 *p_self, const godot_vector3 *p_to, const godot_real p_delta) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *to = (const Vector3 *)p_to; - *((Vector3 *)&dest) = self->move_toward(*to, p_delta); - return dest; -} - -godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b) { - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - return self->dot(*b); -} - -godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *((Vector3 *)&dest) = self->cross(*b); - return dest; -} - -godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b) { - godot_basis dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *((Basis *)&dest) = self->outer(*b); - return dest; -} - -godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self) { - godot_basis dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Basis *)&dest) = self->to_diagonal_matrix(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3 *)&dest) = self->abs(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_sign(const godot_vector3 *p_self) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3 *)&dest) = self->sign(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3 *)&dest) = self->floor(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - *((Vector3 *)&dest) = self->ceil(); - return dest; -} - -godot_vector3 GDAPI godot_vector3_direction_to(const godot_vector3 *p_self, const godot_vector3 *p_to) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *to = (const Vector3 *)p_to; - *((Vector3 *)&dest) = self->direction_to(*to); - return dest; -} - -godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b) { - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - return self->distance_to(*b); -} - -godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b) { - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - return self->distance_squared_to(*b); -} - -godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to) { - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *to = (const Vector3 *)p_to; - return self->angle_to(*to); -} - -godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *n = (const Vector3 *)p_n; - *((Vector3 *)&dest) = self->slide(*n); - return dest; -} - -godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *n = (const Vector3 *)p_n; - *((Vector3 *)&dest) = self->bounce(*n); - return dest; -} - -godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n) { - godot_vector3 dest; - const Vector3 *self = (const Vector3 *)p_self; - const Vector3 *n = (const Vector3 *)p_n; - *((Vector3 *)&dest) = self->reflect(*n); - return dest; -} - -godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - Vector3 *self = (Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *dest = *self + *b; - return raw_dest; -} - -godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - Vector3 *self = (Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *dest = *self - *b; - return raw_dest; -} - -godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - Vector3 *self = (Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *dest = *self * *b; - return raw_dest; -} - -godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - Vector3 *self = (Vector3 *)p_self; - *dest = *self * p_b; - return raw_dest; -} - -godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - Vector3 *self = (Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - *dest = *self / *b; - return raw_dest; -} +#ifdef __cplusplus +extern "C" { +#endif -godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - Vector3 *self = (Vector3 *)p_self; - *dest = *self / p_b; - return raw_dest; +void GDAPI godot_vector3_new(godot_vector3 *p_self) { + memnew_placement(p_self, Vector3); } -godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b) { - Vector3 *self = (Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - return *self == *b; +void GDAPI godot_vector3_new_copy(godot_vector3 *r_dest, const godot_vector3 *p_src) { + memnew_placement(r_dest, Vector3(*(Vector3 *)p_src)); } -godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b) { - Vector3 *self = (Vector3 *)p_self; - const Vector3 *b = (const Vector3 *)p_b; - return *self < *b; +void GDAPI godot_vector3i_new(godot_vector3i *p_self) { + memnew_placement(p_self, Vector3i); } -godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self) { - godot_vector3 raw_dest; - Vector3 *dest = (Vector3 *)&raw_dest; - const Vector3 *self = (const Vector3 *)p_self; - *dest = -(*self); - return raw_dest; +void GDAPI godot_vector3i_new_copy(godot_vector3i *r_dest, const godot_vector3i *p_src) { + memnew_placement(r_dest, Vector3i(*(Vector3i *)p_src)); } -void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val) { +godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index) { Vector3 *self = (Vector3 *)p_self; - self->set_axis(p_axis, p_val); + return (godot_real_t *)&self->operator[](p_index); } -godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis) { +const godot_real_t GDAPI *godot_vector3_operator_index_const(const godot_vector3 *p_self, godot_int p_index) { const Vector3 *self = (const Vector3 *)p_self; - return self->get_axis(p_axis); -} - -// Vector3i - -void GDAPI godot_vector3i_new(godot_vector3i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_z) { - Vector3i *dest = (Vector3i *)r_dest; - *dest = Vector3i(p_x, p_y, p_z); -} - -godot_string GDAPI godot_vector3i_as_string(const godot_vector3i *p_self) { - godot_string ret; - const Vector3i *self = (const Vector3i *)p_self; - memnew_placement(&ret, String(*self)); - return ret; -} - -godot_vector3 GDAPI godot_vector3i_as_vector3(const godot_vector3i *p_self) { - godot_vector3 dest; - const Vector3i *self = (const Vector3i *)p_self; - *((Vector3 *)&dest) = Vector3(*self); - return dest; -} - -godot_int GDAPI godot_vector3i_min_axis(const godot_vector3i *p_self) { - const Vector3i *self = (const Vector3i *)p_self; - return self->min_axis(); -} - -godot_int GDAPI godot_vector3i_max_axis(const godot_vector3i *p_self) { - const Vector3i *self = (const Vector3i *)p_self; - return self->max_axis(); -} - -godot_vector3i GDAPI godot_vector3i_abs(const godot_vector3i *p_self) { - godot_vector3i dest; - const Vector3i *self = (const Vector3i *)p_self; - *((Vector3i *)&dest) = self->abs(); - return dest; -} - -godot_vector3i GDAPI godot_vector3i_sign(const godot_vector3i *p_self) { - godot_vector3i dest; - const Vector3i *self = (const Vector3i *)p_self; - *((Vector3i *)&dest) = self->sign(); - return dest; -} - -godot_vector3i GDAPI godot_vector3i_operator_add(const godot_vector3i *p_self, const godot_vector3i *p_b) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - Vector3i *self = (Vector3i *)p_self; - const Vector3i *b = (const Vector3i *)p_b; - *dest = *self + *b; - return raw_dest; -} - -godot_vector3i GDAPI godot_vector3i_operator_subtract(const godot_vector3i *p_self, const godot_vector3i *p_b) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - Vector3i *self = (Vector3i *)p_self; - const Vector3i *b = (const Vector3i *)p_b; - *dest = *self - *b; - return raw_dest; -} - -godot_vector3i GDAPI godot_vector3i_operator_multiply_vector(const godot_vector3i *p_self, const godot_vector3i *p_b) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - Vector3i *self = (Vector3i *)p_self; - const Vector3i *b = (const Vector3i *)p_b; - *dest = *self * *b; - return raw_dest; -} - -godot_vector3i GDAPI godot_vector3i_operator_multiply_scalar(const godot_vector3i *p_self, const godot_int p_b) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - Vector3i *self = (Vector3i *)p_self; - *dest = *self * p_b; - return raw_dest; -} - -godot_vector3i GDAPI godot_vector3i_operator_divide_vector(const godot_vector3i *p_self, const godot_vector3i *p_b) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - Vector3i *self = (Vector3i *)p_self; - const Vector3i *b = (const Vector3i *)p_b; - *dest = *self / *b; - return raw_dest; -} - -godot_vector3i GDAPI godot_vector3i_operator_divide_scalar(const godot_vector3i *p_self, const godot_int p_b) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - Vector3i *self = (Vector3i *)p_self; - *dest = *self / p_b; - return raw_dest; -} - -godot_bool GDAPI godot_vector3i_operator_equal(const godot_vector3i *p_self, const godot_vector3i *p_b) { - Vector3i *self = (Vector3i *)p_self; - const Vector3i *b = (const Vector3i *)p_b; - return *self == *b; -} - -godot_bool GDAPI godot_vector3i_operator_less(const godot_vector3i *p_self, const godot_vector3i *p_b) { - Vector3i *self = (Vector3i *)p_self; - const Vector3i *b = (const Vector3i *)p_b; - return *self < *b; -} - -godot_vector3i GDAPI godot_vector3i_operator_neg(const godot_vector3i *p_self) { - godot_vector3i raw_dest; - Vector3i *dest = (Vector3i *)&raw_dest; - const Vector3i *self = (const Vector3i *)p_self; - *dest = -(*self); - return raw_dest; + return (const godot_real_t *)&self->operator[](p_index); } -void GDAPI godot_vector3i_set_axis(godot_vector3i *p_self, const godot_vector3_axis p_axis, const godot_int p_val) { +int32_t GDAPI *godot_vector3i_operator_index(godot_vector3i *p_self, godot_int p_index) { Vector3i *self = (Vector3i *)p_self; - self->set_axis(p_axis, p_val); + return (int32_t *)&self->operator[](p_index); } -godot_int GDAPI godot_vector3i_get_axis(const godot_vector3i *p_self, const godot_vector3_axis p_axis) { +const int32_t GDAPI *godot_vector3i_operator_index_const(const godot_vector3i *p_self, godot_int p_index) { const Vector3i *self = (const Vector3i *)p_self; - return self->get_axis(p_axis); + return (const int32_t *)&self->operator[](p_index); } #ifdef __cplusplus diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json index 82bfbd23de..66d2dc267d 100644 --- a/modules/gdnative/gdnative_api.json +++ b/modules/gdnative/gdnative_api.json @@ -1,7627 +1,5682 @@ { - "core": { - "type": "CORE", - "version": { - "major": 4, - "minor": 0 - }, - "next": null, - "api": [ - { - "name": "godot_aabb_new", - "return_type": "void", - "arguments": [ - ["godot_aabb *", "r_dest"], - ["const godot_vector3 *", "p_pos"], - ["const godot_vector3 *", "p_size"] - ] - }, - { - "name": "godot_aabb_get_position", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_set_position", - "return_type": "void", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_aabb_get_size", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_set_size", - "return_type": "void", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_aabb_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_abs", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_get_area", - "return_type": "godot_real", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_has_no_area", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_has_no_surface", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_intersects", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_aabb *", "p_with"] - ] - }, - { - "name": "godot_aabb_encloses", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_aabb *", "p_with"] - ] - }, - { - "name": "godot_aabb_merge", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_aabb *", "p_with"] - ] - }, - { - "name": "godot_aabb_intersection", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_aabb *", "p_with"] - ] - }, - { - "name": "godot_aabb_intersects_plane", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_plane *", "p_plane"] - ] - }, - { - "name": "godot_aabb_intersects_segment", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_vector3 *", "p_from"], - ["const godot_vector3 *", "p_to"] - ] - }, - { - "name": "godot_aabb_has_point", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_vector3 *", "p_point"] - ] - }, - { - "name": "godot_aabb_get_support", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_vector3 *", "p_dir"] - ] - }, - { - "name": "godot_aabb_get_longest_axis", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_get_longest_axis_index", - "return_type": "godot_int", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_get_longest_axis_size", - "return_type": "godot_real", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_get_shortest_axis", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_get_shortest_axis_index", - "return_type": "godot_int", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_get_shortest_axis_size", - "return_type": "godot_real", - "arguments": [ - ["const godot_aabb *", "p_self"] - ] - }, - { - "name": "godot_aabb_expand", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_vector3 *", "p_to_point"] - ] - }, - { - "name": "godot_aabb_grow", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_real", "p_by"] - ] - }, - { - "name": "godot_aabb_get_endpoint", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_aabb_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_aabb *", "p_self"], - ["const godot_aabb *", "p_b"] - ] - }, - { - "name": "godot_array_new", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"] - ] - }, - { - "name": "godot_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_array *", "p_src"] - ] - }, - { - "name": "godot_array_new_packed_color_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_color_array *", "p_pca"] - ] - }, - { - "name": "godot_array_new_packed_vector3_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_vector3_array *", "p_pv3a"] - ] - }, - { - "name": "godot_array_new_packed_vector2_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_vector2_array *", "p_pv2a"] - ] - }, - { - "name": "godot_array_new_packed_string_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_string_array *", "p_psa"] - ] - }, - { - "name": "godot_array_new_packed_float32_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_float32_array *", "p_pra"] - ] - }, - { - "name": "godot_array_new_packed_float64_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_float64_array *", "p_pra"] - ] - }, - { - "name": "godot_array_new_packed_int32_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_int32_array *", "p_pia"] - ] - }, - { - "name": "godot_array_new_packed_int64_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_int64_array *", "p_pia"] - ] - }, - { - "name": "godot_array_new_packed_byte_array", - "return_type": "void", - "arguments": [ - ["godot_array *", "r_dest"], - ["const godot_packed_byte_array *", "p_pba"] - ] - }, - { - "name": "godot_array_set", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_get", - "return_type": "godot_variant", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_array_operator_index", - "return_type": "godot_variant *", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_array_operator_index_const", - "return_type": "const godot_variant *", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_array_append", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_clear", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_count", - "return_type": "godot_int", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_duplicate", - "return_type": "godot_array", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_bool", "p_deep"] - ] - }, - { - "name": "godot_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_erase", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_front", - "return_type": "godot_variant", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_back", - "return_type": "godot_variant", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_find", - "return_type": "godot_int", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_variant *", "p_what"], - ["const godot_int", "p_from"] - ] - }, - { - "name": "godot_array_find_last", - "return_type": "godot_int", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_variant *", "p_what"] - ] - }, - { - "name": "godot_array_has", - "return_type": "godot_bool", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_hash", - "return_type": "godot_int", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_insert", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_int", "p_pos"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_invert", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_max", - "return_type": "godot_variant", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_min", - "return_type": "godot_variant", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_pop_back", - "return_type": "godot_variant", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_pop_front", - "return_type": "godot_variant", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_push_front", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_array_remove", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_array_resize", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_array_rfind", - "return_type": "godot_int", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_variant *", "p_what"], - ["const godot_int", "p_from"] - ] - }, - { - "name": "godot_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_shuffle", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_slice", - "return_type": "godot_array", - "arguments": [ - ["const godot_array *", "p_self"], - ["const godot_int", "p_begin"], - ["const godot_int", "p_end"], - ["const godot_int", "p_step"], - ["const godot_bool", "p_deep"] - ] - }, - { - "name": "godot_array_sort", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_array_sort_custom", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"], - ["godot_object *", "p_obj"], - ["const godot_string *", "p_func"] - ] - }, - { - "name": "godot_array_bsearch", - "return_type": "godot_int", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_variant *", "p_value"], - ["const godot_bool", "p_before"] - ] - }, - { - "name": "godot_array_bsearch_custom", - "return_type": "godot_int", - "arguments": [ - ["godot_array *", "p_self"], - ["const godot_variant *", "p_value"], - ["godot_object *", "p_obj"], - ["const godot_string *", "p_func"], - ["const godot_bool", "p_before"] - ] - }, - { - "name": "godot_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_array *", "p_self"] - ] - }, - { - "name": "godot_basis_new_with_rows", - "return_type": "void", - "arguments": [ - ["godot_basis *", "r_dest"], - ["const godot_vector3 *", "p_x_axis"], - ["const godot_vector3 *", "p_y_axis"], - ["const godot_vector3 *", "p_z_axis"] - ] - }, - { - "name": "godot_basis_new_with_axis_and_angle", - "return_type": "void", - "arguments": [ - ["godot_basis *", "r_dest"], - ["const godot_vector3 *", "p_axis"], - ["const godot_real", "p_phi"] - ] - }, - { - "name": "godot_basis_new_with_euler", - "return_type": "void", - "arguments": [ - ["godot_basis *", "r_dest"], - ["const godot_vector3 *", "p_euler"] - ] - }, - { - "name": "godot_basis_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_inverse", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_transposed", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_orthonormalized", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_determinant", - "return_type": "godot_real", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_rotated", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_axis"], - ["const godot_real", "p_phi"] - ] - }, - { - "name": "godot_basis_scaled", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_scale"] - ] - }, - { - "name": "godot_basis_get_scale", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_get_euler", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_tdotx", - "return_type": "godot_real", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_with"] - ] - }, - { - "name": "godot_basis_tdoty", - "return_type": "godot_real", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_with"] - ] - }, - { - "name": "godot_basis_tdotz", - "return_type": "godot_real", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_with"] - ] - }, - { - "name": "godot_basis_xform", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_basis_xform_inv", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_basis_get_orthogonal_index", - "return_type": "godot_int", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_new", - "return_type": "void", - "arguments": [ - ["godot_basis *", "r_dest"] - ] - }, - { - "name": "godot_basis_new_with_euler_quat", - "return_type": "void", - "arguments": [ - ["godot_basis *", "r_dest"], - ["const godot_quat *", "p_euler"] - ] - }, - { - "name": "godot_basis_get_elements", - "return_type": "void", - "arguments": [ - ["const godot_basis *", "p_self"], - ["godot_vector3 *", "p_elements"] - ] - }, - { - "name": "godot_basis_get_axis", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_int", "p_axis"] - ] - }, - { - "name": "godot_basis_set_axis", - "return_type": "void", - "arguments": [ - ["godot_basis *", "p_self"], - ["const godot_int", "p_axis"], - ["const godot_vector3 *", "p_value"] - ] - }, - { - "name": "godot_basis_get_row", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_int", "p_row"] - ] - }, - { - "name": "godot_basis_set_row", - "return_type": "void", - "arguments": [ - ["godot_basis *", "p_self"], - ["const godot_int", "p_row"], - ["const godot_vector3 *", "p_value"] - ] - }, - { - "name": "godot_basis_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_basis *", "p_b"] - ] - }, - { - "name": "godot_basis_operator_add", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_basis *", "p_b"] - ] - }, - { - "name": "godot_basis_operator_subtract", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_basis *", "p_b"] - ] - }, - { - "name": "godot_basis_operator_multiply_vector", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_basis *", "p_b"] - ] - }, - { - "name": "godot_basis_operator_multiply_scalar", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_basis_slerp", - "return_type": "godot_basis", - "arguments": [ - ["const godot_basis *", "p_self"], - ["const godot_basis *", "p_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_basis_get_quat", - "return_type": "godot_quat", - "arguments": [ - ["const godot_basis *", "p_self"] - ] - }, - { - "name": "godot_basis_set_quat", - "return_type": "void", - "arguments": [ - ["godot_basis *", "p_self"], - ["const godot_quat *", "p_quat"] - ] - }, - { - "name": "godot_basis_set_axis_angle_scale", - "return_type": "void", - "arguments": [ - ["godot_basis *", "p_self"], - ["const godot_vector3 *", "p_axis"], - ["godot_real", "p_phi"], - ["const godot_vector3 *", "p_scale"] - ] - }, - { - "name": "godot_basis_set_euler_scale", - "return_type": "void", - "arguments": [ - ["godot_basis *", "p_self"], - ["const godot_vector3 *", "p_euler"], - ["const godot_vector3 *", "p_scale"] - ] - }, - { - "name": "godot_basis_set_quat_scale", - "return_type": "void", - "arguments": [ - ["godot_basis *", "p_self"], - ["const godot_quat *", "p_quat"], - ["const godot_vector3 *", "p_scale"] - ] - }, - { - "name": "godot_callable_new_with_object", - "return_type": "void", - "arguments": [ - ["godot_callable *", "r_dest"], - ["const godot_object *", "p_object"], - ["const godot_string_name *", "p_method"] - ] - }, - { - "name": "godot_callable_new_with_object_id", - "return_type": "void", - "arguments": [ - ["godot_callable *", "r_dest"], - ["uint64_t", "p_objectid"], - ["const godot_string_name *", "p_method"] - ] - }, - { - "name": "godot_callable_new_copy", - "return_type": "void", - "arguments": [ - ["godot_callable *", "r_dest"], - ["const godot_callable *", "p_src"] - ] - }, - { - "name": "godot_callable_destroy", - "return_type": "void", - "arguments": [ - ["godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_call", - "return_type": "godot_int", - "arguments": [ - ["const godot_callable *", "p_self"], - ["const godot_variant **", "p_arguments"], - ["godot_int", "p_argcount"], - ["godot_variant *", "r_return_value"] - ] - }, - { - "name": "godot_callable_call_deferred", - "return_type": "void", - "arguments": [ - ["const godot_callable *", "p_self"], - ["const godot_variant **", "p_arguments"], - ["godot_int", "p_argcount"] - ] - }, - { - "name": "godot_callable_is_null", - "return_type": "godot_bool", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_is_custom", - "return_type": "godot_bool", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_is_standard", - "return_type": "godot_bool", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_get_object", - "return_type": "godot_object *", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_get_object_id", - "return_type": "uint64_t", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_get_method", - "return_type": "godot_string_name", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_hash", - "return_type": "uint32_t", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_callable *", "p_self"] - ] - }, - { - "name": "godot_callable_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_callable *", "p_self"], - ["const godot_callable *", "p_other"] - ] - }, - { - "name": "godot_callable_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_callable *", "p_self"], - ["const godot_callable *", "p_other"] - ] - }, - { - "name": "godot_signal_new_with_object", - "return_type": "void", - "arguments": [ - ["godot_signal *", "r_dest"], - ["const godot_object *", "p_object"], - ["const godot_string_name *", "p_method"] - ] - }, - { - "name": "godot_signal_new_with_object_id", - "return_type": "void", - "arguments": [ - ["godot_signal *", "r_dest"], - ["uint64_t", "p_objectid"], - ["const godot_string_name *", "p_method"] - ] - }, - { - "name": "godot_signal_new_copy", - "return_type": "void", - "arguments": [ - ["godot_signal *", "r_dest"], - ["const godot_signal *", "p_src"] - ] - }, - { - "name": "godot_signal_destroy", - "return_type": "void", - "arguments": [ - ["godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_emit", - "return_type": "godot_int", - "arguments": [ - ["const godot_signal *", "p_self"], - ["const godot_variant **", "p_arguments"], - ["godot_int", "p_argcount"] - ] - }, - { - "name": "godot_signal_connect", - "return_type": "godot_int", - "arguments": [ - ["godot_signal *", "p_self"], - ["const godot_callable *", "p_callable"], - ["const godot_array *", "p_binds"], - ["uint32_t", "p_flags"] - ] - }, - { - "name": "godot_signal_disconnect", - "return_type": "void", - "arguments": [ - ["godot_signal *", "p_self"], - ["const godot_callable *", "p_callable"] - ] - }, - { - "name": "godot_signal_is_null", - "return_type": "godot_bool", - "arguments": [ - ["const godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_is_connected", - "return_type": "godot_bool", - "arguments": [ - ["const godot_signal *", "p_self"], - ["const godot_callable *", "p_callable"] - ] - }, - { - "name": "godot_signal_get_connections", - "return_type": "godot_array", - "arguments": [ - ["const godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_get_object", - "return_type": "godot_object *", - "arguments": [ - ["const godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_get_object_id", - "return_type": "uint64_t", - "arguments": [ - ["const godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_get_name", - "return_type": "godot_string_name", - "arguments": [ - ["const godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_signal *", "p_self"] - ] - }, - { - "name": "godot_signal_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_signal *", "p_self"], - ["const godot_signal *", "p_other"] - ] - }, - { - "name": "godot_signal_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_signal *", "p_self"], - ["const godot_signal *", "p_other"] - ] - }, - { - "name": "godot_color_new_rgba", - "return_type": "void", - "arguments": [ - ["godot_color *", "r_dest"], - ["const godot_real", "p_r"], - ["const godot_real", "p_g"], - ["const godot_real", "p_b"], - ["const godot_real", "p_a"] - ] - }, - { - "name": "godot_color_new_rgb", - "return_type": "void", - "arguments": [ - ["godot_color *", "r_dest"], - ["const godot_real", "p_r"], - ["const godot_real", "p_g"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_color_get_r", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_set_r", - "return_type": "void", - "arguments": [ - ["godot_color *", "p_self"], - ["const godot_real", "r"] - ] - }, - { - "name": "godot_color_get_g", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_set_g", - "return_type": "void", - "arguments": [ - ["godot_color *", "p_self"], - ["const godot_real", "g"] - ] - }, - { - "name": "godot_color_get_b", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_set_b", - "return_type": "void", - "arguments": [ - ["godot_color *", "p_self"], - ["const godot_real", "b"] - ] - }, - { - "name": "godot_color_get_a", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_set_a", - "return_type": "void", - "arguments": [ - ["godot_color *", "p_self"], - ["const godot_real", "a"] - ] - }, - { - "name": "godot_color_get_h", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_get_s", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_get_v", - "return_type": "godot_real", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_to_rgba32", - "return_type": "godot_int", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_to_argb32", - "return_type": "godot_int", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_inverted", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_contrasted", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_lerp", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_color *", "p_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_color_blend", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_color *", "p_over"] - ] - }, - { - "name": "godot_color_to_html", - "return_type": "godot_string", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_bool", "p_with_alpha"] - ] - }, - { - "name": "godot_color_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_color *", "p_b"] - ] - }, - { - "name": "godot_color_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_color *", "p_b"] - ] - }, - { - "name": "godot_color_to_abgr32", - "return_type": "godot_int", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_to_abgr64", - "return_type": "godot_int", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_to_argb64", - "return_type": "godot_int", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_to_rgba64", - "return_type": "godot_int", - "arguments": [ - ["const godot_color *", "p_self"] - ] - }, - { - "name": "godot_color_darkened", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_real", "p_amount"] - ] - }, - { - "name": "godot_color_from_hsv", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_real", "p_h"], - ["const godot_real", "p_s"], - ["const godot_real", "p_v"], - ["const godot_real", "p_a"] - ] - }, - { - "name": "godot_color_lightened", - "return_type": "godot_color", - "arguments": [ - ["const godot_color *", "p_self"], - ["const godot_real", "p_amount"] - ] - }, - { - "name": "godot_dictionary_new", - "return_type": "void", - "arguments": [ - ["godot_dictionary *", "r_dest"] - ] - }, - { - "name": "godot_dictionary_new_copy", - "return_type": "void", - "arguments": [ - ["godot_dictionary *", "r_dest"], - ["const godot_dictionary *", "p_src"] - ] - }, - { - "name": "godot_dictionary_destroy", - "return_type": "void", - "arguments": [ - ["godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_clear", - "return_type": "void", - "arguments": [ - ["godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_has", - "return_type": "godot_bool", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_dictionary_has_all", - "return_type": "godot_bool", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_array *", "p_keys"] - ] - }, - { - "name": "godot_dictionary_erase", - "return_type": "void", - "arguments": [ - ["godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_dictionary_hash", - "return_type": "godot_int", - "arguments": [ - ["const godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_keys", - "return_type": "godot_array", - "arguments": [ - ["const godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_values", - "return_type": "godot_array", - "arguments": [ - ["const godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_get", - "return_type": "godot_variant", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_dictionary_set", - "return_type": "void", - "arguments": [ - ["godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"], - ["const godot_variant *", "p_value"] - ] - }, - { - "name": "godot_dictionary_operator_index", - "return_type": "godot_variant *", - "arguments": [ - ["godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_dictionary_operator_index_const", - "return_type": "const godot_variant *", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_dictionary_next", - "return_type": "godot_variant *", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_dictionary_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_dictionary *", "p_b"] - ] - }, - { - "name": "godot_dictionary_to_json", - "return_type": "godot_string", - "arguments": [ - ["const godot_dictionary *", "p_self"] - ] - }, - { - "name": "godot_dictionary_duplicate", - "return_type": "godot_dictionary", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_bool", "p_deep"] - ] - }, - { - "name": "godot_dictionary_get_with_default", - "return_type": "godot_variant", - "arguments": [ - ["const godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"], - ["const godot_variant *", "p_default"] - ] - }, - { - "name": "godot_dictionary_erase_with_return", - "return_type": "bool", - "arguments": [ - ["godot_dictionary *", "p_self"], - ["const godot_variant *", "p_key"] - ] - }, - { - "name": "godot_node_path_new", - "return_type": "void", - "arguments": [ - ["godot_node_path *", "r_dest"], - ["const godot_string *", "p_from"] - ] - }, - { - "name": "godot_node_path_new_copy", - "return_type": "void", - "arguments": [ - ["godot_node_path *", "r_dest"], - ["const godot_node_path *", "p_src"] - ] - }, - { - "name": "godot_node_path_destroy", - "return_type": "void", - "arguments": [ - ["godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_is_absolute", - "return_type": "godot_bool", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_get_name_count", - "return_type": "godot_int", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_get_name", - "return_type": "godot_string", - "arguments": [ - ["const godot_node_path *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_node_path_get_subname_count", - "return_type": "godot_int", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_get_subname", - "return_type": "godot_string", - "arguments": [ - ["const godot_node_path *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_node_path_get_concatenated_subnames", - "return_type": "godot_string", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_is_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_node_path_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_node_path *", "p_self"], - ["const godot_node_path *", "p_b"] - ] - }, - { - "name": "godot_node_path_get_as_property_path", - "return_type": "godot_node_path", - "arguments": [ - ["const godot_node_path *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_byte_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "r_dest"], - ["const godot_packed_byte_array *", "p_src"] - ] - }, - { - "name": "godot_packed_byte_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_byte_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const uint8_t", "p_data"] - ] - }, - { - "name": "godot_packed_byte_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const godot_packed_byte_array *", "p_array"] - ] - }, - { - "name": "godot_packed_byte_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const uint8_t", "p_data"] - ] - }, - { - "name": "godot_packed_byte_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const uint8_t", "p_value"] - ] - }, - { - "name": "godot_packed_byte_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const uint8_t", "p_data"] - ] - }, - { - "name": "godot_packed_byte_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_byte_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_byte_array_ptr", - "return_type": "const uint8_t *", - "arguments": [ - ["const godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_ptrw", - "return_type": "uint8_t *", - "arguments": [ - ["godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const uint8_t", "p_data"] - ] - }, - { - "name": "godot_packed_byte_array_get", - "return_type": "uint8_t", - "arguments": [ - ["const godot_packed_byte_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_byte_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_byte_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_byte_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_int32_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "r_dest"], - ["const godot_packed_int32_array *", "p_src"] - ] - }, - { - "name": "godot_packed_int32_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_int32_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const int32_t", "p_data"] - ] - }, - { - "name": "godot_packed_int32_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const godot_packed_int32_array *", "p_array"] - ] - }, - { - "name": "godot_packed_int32_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const int32_t", "p_data"] - ] - }, - { - "name": "godot_packed_int32_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const int32_t", "p_value"] - ] - }, - { - "name": "godot_packed_int32_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const int32_t", "p_data"] - ] - }, - { - "name": "godot_packed_int32_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_int32_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_int32_array_ptr", - "return_type": "const int32_t *", - "arguments": [ - ["const godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_ptrw", - "return_type": "int32_t *", - "arguments": [ - ["godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const int32_t", "p_data"] - ] - }, - { - "name": "godot_packed_int32_array_get", - "return_type": "int32_t", - "arguments": [ - ["const godot_packed_int32_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_int32_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int32_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_int32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_int64_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "r_dest"], - ["const godot_packed_int64_array *", "p_src"] - ] - }, - { - "name": "godot_packed_int64_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_int64_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const int64_t", "p_data"] - ] - }, - { - "name": "godot_packed_int64_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const godot_packed_int64_array *", "p_array"] - ] - }, - { - "name": "godot_packed_int64_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const int64_t", "p_data"] - ] - }, - { - "name": "godot_packed_int64_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const int64_t", "p_value"] - ] - }, - { - "name": "godot_packed_int64_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const int64_t", "p_data"] - ] - }, - { - "name": "godot_packed_int64_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_int64_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_int64_array_ptr", - "return_type": "const int64_t *", - "arguments": [ - ["const godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_ptrw", - "return_type": "int64_t *", - "arguments": [ - ["godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const int64_t", "p_data"] - ] - }, - { - "name": "godot_packed_int64_array_get", - "return_type": "int64_t", - "arguments": [ - ["const godot_packed_int64_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_int64_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_int64_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_int64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_float32_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "r_dest"], - ["const godot_packed_float32_array *", "p_src"] - ] - }, - { - "name": "godot_packed_float32_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_float32_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const float", "p_data"] - ] - }, - { - "name": "godot_packed_float32_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const godot_packed_float32_array *", "p_array"] - ] - }, - { - "name": "godot_packed_float32_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const float", "p_data"] - ] - }, - { - "name": "godot_packed_float32_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const float", "p_value"] - ] - }, - { - "name": "godot_packed_float32_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const float", "p_data"] - ] - }, - { - "name": "godot_packed_float32_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_float32_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_float32_array_ptr", - "return_type": "const float *", - "arguments": [ - ["const godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_ptrw", - "return_type": "float *", - "arguments": [ - ["godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const float", "p_data"] - ] - }, - { - "name": "godot_packed_float32_array_get", - "return_type": "float", - "arguments": [ - ["const godot_packed_float32_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_float32_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float32_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_float32_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_float64_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "r_dest"], - ["const godot_packed_float64_array *", "p_src"] - ] - }, - { - "name": "godot_packed_float64_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_float64_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const double", "p_data"] - ] - }, - { - "name": "godot_packed_float64_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const godot_packed_float64_array *", "p_array"] - ] - }, - { - "name": "godot_packed_float64_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const double", "p_data"] - ] - }, - { - "name": "godot_packed_float64_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const double", "p_value"] - ] - }, - { - "name": "godot_packed_float64_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const double", "p_data"] - ] - }, - { - "name": "godot_packed_float64_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_float64_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_float64_array_ptr", - "return_type": "const double *", - "arguments": [ - ["const godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_ptrw", - "return_type": "double *", - "arguments": [ - ["godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const double", "p_data"] - ] - }, - { - "name": "godot_packed_float64_array_get", - "return_type": "double", - "arguments": [ - ["const godot_packed_float64_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_float64_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_float64_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_float64_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_string_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "r_dest"], - ["const godot_packed_string_array *", "p_src"] - ] - }, - { - "name": "godot_packed_string_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_string_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_string *", "p_data"] - ] - }, - { - "name": "godot_packed_string_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_packed_string_array *", "p_array"] - ] - }, - { - "name": "godot_packed_string_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_string *", "p_data"] - ] - }, - { - "name": "godot_packed_string_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_string *", "p_value"] - ] - }, - { - "name": "godot_packed_string_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_string *", "p_data"] - ] - }, - { - "name": "godot_packed_string_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_string_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_string_array_ptr", - "return_type": "const godot_string *", - "arguments": [ - ["const godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_ptrw", - "return_type": "godot_string *", - "arguments": [ - ["godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_string *", "p_data"] - ] - }, - { - "name": "godot_packed_string_array_get", - "return_type": "godot_string", - "arguments": [ - ["const godot_packed_string_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_string_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_string_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_string_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_vector2_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "r_dest"], - ["const godot_packed_vector2_array *", "p_src"] - ] - }, - { - "name": "godot_packed_vector2_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_vector2_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_vector2 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector2_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_packed_vector2_array *", "p_array"] - ] - }, - { - "name": "godot_packed_vector2_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_vector2 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector2_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_vector2 *", "p_value"] - ] - }, - { - "name": "godot_packed_vector2_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_vector2 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector2_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_vector2_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_vector2_array_ptr", - "return_type": "const godot_vector2 *", - "arguments": [ - ["const godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_ptrw", - "return_type": "godot_vector2 *", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_vector2 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector2_array_get", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_packed_vector2_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_vector2_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector2_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_vector2_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_vector3_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "r_dest"], - ["const godot_packed_vector3_array *", "p_src"] - ] - }, - { - "name": "godot_packed_vector3_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_vector3_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_vector3 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector3_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_packed_vector3_array *", "p_array"] - ] - }, - { - "name": "godot_packed_vector3_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_vector3 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector3_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_vector3 *", "p_value"] - ] - }, - { - "name": "godot_packed_vector3_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_vector3 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector3_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_vector3_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_vector3_array_ptr", - "return_type": "const godot_vector3 *", - "arguments": [ - ["const godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_ptrw", - "return_type": "godot_vector3 *", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_vector3 *", "p_data"] - ] - }, - { - "name": "godot_packed_vector3_array_get", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_packed_vector3_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_vector3_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_vector3_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_vector3_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_new", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "r_dest"] - ] - }, - { - "name": "godot_packed_color_array_new_copy", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "r_dest"], - ["const godot_packed_color_array *", "p_src"] - ] - }, - { - "name": "godot_packed_color_array_new_with_array", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "r_dest"], - ["const godot_array *", "p_a"] - ] - }, - { - "name": "godot_packed_color_array_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_append", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_color *", "p_data"] - ] - }, - { - "name": "godot_packed_color_array_append_array", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_packed_color_array *", "p_array"] - ] - }, - { - "name": "godot_packed_color_array_insert", - "return_type": "godot_error", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_color *", "p_data"] - ] - }, - { - "name": "godot_packed_color_array_has", - "return_type": "godot_bool", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_color *", "p_value"] - ] - }, - { - "name": "godot_packed_color_array_sort", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_invert", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_push_back", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_color *", "p_data"] - ] - }, - { - "name": "godot_packed_color_array_remove", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_color_array_resize", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_int", "p_size"] - ] - }, - { - "name": "godot_packed_color_array_ptr", - "return_type": "const godot_color *", - "arguments": [ - ["const godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_ptrw", - "return_type": "godot_color *", - "arguments": [ - ["godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_set", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"], - ["const godot_int", "p_idx"], - ["const godot_color *", "p_data"] - ] - }, - { - "name": "godot_packed_color_array_get", - "return_type": "godot_color", - "arguments": [ - ["const godot_packed_color_array *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_packed_color_array_size", - "return_type": "godot_int", - "arguments": [ - ["const godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_packed_color_array_destroy", - "return_type": "void", - "arguments": [ - ["godot_packed_color_array *", "p_self"] - ] - }, - { - "name": "godot_plane_new_with_reals", - "return_type": "void", - "arguments": [ - ["godot_plane *", "r_dest"], - ["const godot_real", "p_a"], - ["const godot_real", "p_b"], - ["const godot_real", "p_c"], - ["const godot_real", "p_d"] - ] - }, - { - "name": "godot_plane_new_with_vectors", - "return_type": "void", - "arguments": [ - ["godot_plane *", "r_dest"], - ["const godot_vector3 *", "p_v1"], - ["const godot_vector3 *", "p_v2"], - ["const godot_vector3 *", "p_v3"] - ] - }, - { - "name": "godot_plane_new_with_normal", - "return_type": "void", - "arguments": [ - ["godot_plane *", "r_dest"], - ["const godot_vector3 *", "p_normal"], - ["const godot_real", "p_d"] - ] - }, - { - "name": "godot_plane_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_plane *", "p_self"] - ] - }, - { - "name": "godot_plane_normalized", - "return_type": "godot_plane", - "arguments": [ - ["const godot_plane *", "p_self"] - ] - }, - { - "name": "godot_plane_center", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_plane *", "p_self"] - ] - }, - { - "name": "godot_plane_is_point_over", - "return_type": "godot_bool", - "arguments": [ - ["const godot_plane *", "p_self"], - ["const godot_vector3 *", "p_point"] - ] - }, - { - "name": "godot_plane_distance_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_plane *", "p_self"], - ["const godot_vector3 *", "p_point"] - ] - }, - { - "name": "godot_plane_has_point", - "return_type": "godot_bool", - "arguments": [ - ["const godot_plane *", "p_self"], - ["const godot_vector3 *", "p_point"], - ["const godot_real", "p_epsilon"] - ] - }, - { - "name": "godot_plane_project", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_plane *", "p_self"], - ["const godot_vector3 *", "p_point"] - ] - }, - { - "name": "godot_plane_intersect_3", - "return_type": "godot_bool", - "arguments": [ - ["const godot_plane *", "p_self"], - ["godot_vector3 *", "r_dest"], - ["const godot_plane *", "p_b"], - ["const godot_plane *", "p_c"] - ] - }, - { - "name": "godot_plane_intersects_ray", - "return_type": "godot_bool", - "arguments": [ - ["const godot_plane *", "p_self"], - ["godot_vector3 *", "r_dest"], - ["const godot_vector3 *", "p_from"], - ["const godot_vector3 *", "p_dir"] - ] - }, - { - "name": "godot_plane_intersects_segment", - "return_type": "godot_bool", - "arguments": [ - ["const godot_plane *", "p_self"], - ["godot_vector3 *", "r_dest"], - ["const godot_vector3 *", "p_begin"], - ["const godot_vector3 *", "p_end"] - ] - }, - { - "name": "godot_plane_operator_neg", - "return_type": "godot_plane", - "arguments": [ - ["const godot_plane *", "p_self"] - ] - }, - { - "name": "godot_plane_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_plane *", "p_self"], - ["const godot_plane *", "p_b"] - ] - }, - { - "name": "godot_plane_set_normal", - "return_type": "void", - "arguments": [ - ["godot_plane *", "p_self"], - ["const godot_vector3 *", "p_normal"] - ] - }, - { - "name": "godot_plane_get_normal", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_plane *", "p_self"] - ] - }, - { - "name": "godot_plane_get_d", - "return_type": "godot_real", - "arguments": [ - ["const godot_plane *", "p_self"] - ] - }, - { - "name": "godot_plane_set_d", - "return_type": "void", - "arguments": [ - ["godot_plane *", "p_self"], - ["const godot_real", "p_d"] - ] - }, - { - "name": "godot_quat_new", - "return_type": "void", - "arguments": [ - ["godot_quat *", "r_dest"], - ["const godot_real", "p_x"], - ["const godot_real", "p_y"], - ["const godot_real", "p_z"], - ["const godot_real", "p_w"] - ] - }, - { - "name": "godot_quat_new_with_axis_angle", - "return_type": "void", - "arguments": [ - ["godot_quat *", "r_dest"], - ["const godot_vector3 *", "p_axis"], - ["const godot_real", "p_angle"] - ] - }, - { - "name": "godot_quat_new_with_basis", - "return_type": "void", - "arguments": [ - ["godot_quat *", "r_dest"], - ["const godot_basis *", "p_basis"] - ] - }, - { - "name": "godot_quat_new_with_euler", - "return_type": "void", - "arguments": [ - ["godot_quat *", "r_dest"], - ["const godot_vector3 *", "p_euler"] - ] - }, - { - "name": "godot_quat_get_x", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_set_x", - "return_type": "void", - "arguments": [ - ["godot_quat *", "p_self"], - ["const godot_real", "val"] - ] - }, - { - "name": "godot_quat_get_y", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_set_y", - "return_type": "void", - "arguments": [ - ["godot_quat *", "p_self"], - ["const godot_real", "val"] - ] - }, - { - "name": "godot_quat_get_z", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_set_z", - "return_type": "void", - "arguments": [ - ["godot_quat *", "p_self"], - ["const godot_real", "val"] - ] - }, - { - "name": "godot_quat_get_w", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_set_w", - "return_type": "void", - "arguments": [ - ["godot_quat *", "p_self"], - ["const godot_real", "val"] - ] - }, - { - "name": "godot_quat_set_axis_angle", - "return_type": "void", - "arguments": [ - ["godot_quat *", "p_self"], - ["const godot_vector3 *", "p_axis"], - ["const godot_real", "p_angle"] - ] - }, - { - "name": "godot_quat_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_length", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_length_squared", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_normalized", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_is_normalized", - "return_type": "godot_bool", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_inverse", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_quat_dot", - "return_type": "godot_real", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"] - ] - }, - { - "name": "godot_quat_xform", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_quat_slerp", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_quat_slerpni", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_quat_cubic_slerp", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"], - ["const godot_quat *", "p_pre_a"], - ["const godot_quat *", "p_post_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_quat_operator_multiply", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_quat_operator_add", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"] - ] - }, - { - "name": "godot_quat_operator_subtract", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"] - ] - }, - { - "name": "godot_quat_operator_divide", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_quat_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_quat *", "p_self"], - ["const godot_quat *", "p_b"] - ] - }, - { - "name": "godot_quat_operator_neg", - "return_type": "godot_quat", - "arguments": [ - ["const godot_quat *", "p_self"] - ] - }, - { - "name": "godot_rect2_new_with_position_and_size", - "return_type": "void", - "arguments": [ - ["godot_rect2 *", "r_dest"], - ["const godot_vector2 *", "p_pos"], - ["const godot_vector2 *", "p_size"] - ] - }, - { - "name": "godot_rect2_new", - "return_type": "void", - "arguments": [ - ["godot_rect2 *", "r_dest"], - ["const godot_real", "p_x"], - ["const godot_real", "p_y"], - ["const godot_real", "p_width"], - ["const godot_real", "p_height"] - ] - }, - { - "name": "godot_rect2_as_rect2i", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_get_area", - "return_type": "godot_real", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_grow_individual", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_real", "p_left"], - ["const godot_real", "p_top"], - ["const godot_real", "p_right"], - ["const godot_real", "p_bottom"] - ] - }, - { - "name": "godot_rect2_grow_margin", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_int", "p_margin"], - ["const godot_real", "p_by"] - ] - }, - { - "name": "godot_rect2_abs", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_intersects", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_rect2 *", "p_b"] - ] - }, - { - "name": "godot_rect2_encloses", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_rect2 *", "p_b"] - ] - }, - { - "name": "godot_rect2_has_no_area", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_clip", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_rect2 *", "p_b"] - ] - }, - { - "name": "godot_rect2_merge", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_rect2 *", "p_b"] - ] - }, - { - "name": "godot_rect2_has_point", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_vector2 *", "p_point"] - ] - }, - { - "name": "godot_rect2_grow", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_real", "p_by"] - ] - }, - { - "name": "godot_rect2_expand", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_vector2 *", "p_to"] - ] - }, - { - "name": "godot_rect2_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2 *", "p_self"], - ["const godot_rect2 *", "p_b"] - ] - }, - { - "name": "godot_rect2_get_position", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_get_size", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_rect2 *", "p_self"] - ] - }, - { - "name": "godot_rect2_set_position", - "return_type": "void", - "arguments": [ - ["godot_rect2 *", "p_self"], - ["const godot_vector2 *", "p_pos"] - ] - }, - { - "name": "godot_rect2_set_size", - "return_type": "void", - "arguments": [ - ["godot_rect2 *", "p_self"], - ["const godot_vector2 *", "p_size"] - ] - }, - { - "name": "godot_rect2i_new_with_position_and_size", - "return_type": "void", - "arguments": [ - ["godot_rect2i *", "r_dest"], - ["const godot_vector2i *", "p_pos"], - ["const godot_vector2i *", "p_size"] - ] - }, - { - "name": "godot_rect2i_new", - "return_type": "void", - "arguments": [ - ["godot_rect2i *", "r_dest"], - ["const godot_int", "p_x"], - ["const godot_int", "p_y"], - ["const godot_int", "p_width"], - ["const godot_int", "p_height"] - ] - }, - { - "name": "godot_rect2i_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_as_rect2", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_get_area", - "return_type": "godot_int", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_intersects", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_rect2i *", "p_b"] - ] - }, - { - "name": "godot_rect2i_encloses", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_rect2i *", "p_b"] - ] - }, - { - "name": "godot_rect2i_has_no_area", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_clip", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_rect2i *", "p_b"] - ] - }, - { - "name": "godot_rect2i_merge", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_rect2i *", "p_b"] - ] - }, - { - "name": "godot_rect2i_has_point", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_vector2i *", "p_point"] - ] - }, - { - "name": "godot_rect2i_grow", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_int", "p_by"] - ] - }, - { - "name": "godot_rect2i_grow_individual", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_int", "p_left"], - ["const godot_int", "p_top"], - ["const godot_int", "p_right"], - ["const godot_int", "p_bottom"] - ] - }, - { - "name": "godot_rect2i_grow_margin", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_int", "p_margin"], - ["const godot_int", "p_by"] - ] - }, - { - "name": "godot_rect2i_abs", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_expand", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_vector2i *", "p_to"] - ] - }, - { - "name": "godot_rect2i_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rect2i *", "p_self"], - ["const godot_rect2i *", "p_b"] - ] - }, - { - "name": "godot_rect2i_get_position", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_get_size", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_rect2i *", "p_self"] - ] - }, - { - "name": "godot_rect2i_set_position", - "return_type": "void", - "arguments": [ - ["godot_rect2i *", "p_self"], - ["const godot_vector2i *", "p_pos"] - ] - }, - { - "name": "godot_rect2i_set_size", - "return_type": "void", - "arguments": [ - ["godot_rect2i *", "p_self"], - ["const godot_vector2i *", "p_size"] - ] - }, - { - "name": "godot_rid_new", - "return_type": "void", - "arguments": [ - ["godot_rid *", "r_dest"] - ] - }, - { - "name": "godot_rid_get_id", - "return_type": "godot_int", - "arguments": [ - ["const godot_rid *", "p_self"] - ] - }, - { - "name": "godot_rid_new_with_resource", - "return_type": "void", - "arguments": [ - ["godot_rid *", "r_dest"], - ["const godot_object *", "p_from"] - ] - }, - { - "name": "godot_rid_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rid *", "p_self"], - ["const godot_rid *", "p_b"] - ] - }, - { - "name": "godot_rid_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_rid *", "p_self"], - ["const godot_rid *", "p_b"] - ] - }, - { - "name": "godot_char_string_length", - "return_type": "godot_int", - "arguments": [ - ["const godot_char_string *", "p_cs"] - ] - }, - { - "name": "godot_char_string_get_data", - "return_type": "const char *", - "arguments": [ - ["const godot_char_string *", "p_cs"] - ] - }, - { - "name": "godot_char_string_destroy", - "return_type": "void", - "arguments": [ - ["godot_char_string *", "p_cs"] - ] - }, - { - "name": "godot_char16_string_length", - "return_type": "godot_int", - "arguments": [ - ["const godot_char16_string *", "p_cs"] - ] - }, - { - "name": "godot_char16_string_get_data", - "return_type": "const char16_t *", - "arguments": [ - ["const godot_char16_string *", "p_cs"] - ] - }, - { - "name": "godot_char16_string_destroy", - "return_type": "void", - "arguments": [ - ["godot_char16_string *", "p_cs"] - ] - }, - { - "name": "godot_string_new", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"] - ] - }, - { - "name": "godot_string_new_copy", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const godot_string *", "p_src"] - ] - }, - { - "name": "godot_string_new_with_latin1_chars", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char *", "p_contents"] - ] - }, - { - "name": "godot_string_new_with_utf8_chars", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char *", "p_contents"] - ] - }, - { - "name": "godot_string_new_with_utf16_chars", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char16_t *", "p_contents"] - ] - }, - { - "name": "godot_string_new_with_utf32_chars", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char32_t *", "p_contents"] - ] - }, - { - "name": "godot_string_new_with_wide_chars", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const wchar_t *", "p_contents"] - ] - }, - { - "name": "godot_string_new_with_latin1_chars_and_len", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char *", "p_contents"], - ["const int", "p_size"] - ] - }, - { - "name": "godot_string_new_with_utf8_chars_and_len", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char *", "p_contents"], - ["const int", "p_size"] - ] - }, - { - "name": "godot_string_new_with_utf16_chars_and_len", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char16_t *", "p_contents"], - ["const int", "p_size"] - ] - }, - { - "name": "godot_string_new_with_utf32_chars_and_len", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const char32_t *", "p_contents"], - ["const int", "p_size"] - ] - }, - { - "name": "godot_string_new_with_wide_chars_and_len", - "return_type": "void", - "arguments": [ - ["godot_string *", "r_dest"], - ["const wchar_t *", "p_contents"], - ["const int", "p_size"] - ] - }, - { - "name": "godot_string_operator_index", - "return_type": "const godot_char_type *", - "arguments": [ - ["godot_string *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_string_operator_index_const", - "return_type": "godot_char_type", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_int", "p_idx"] - ] - }, - { - "name": "godot_string_get_data", - "return_type": "const godot_char_type *", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_b"] - ] - }, - { - "name": "godot_string_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_b"] - ] - }, - { - "name": "godot_string_operator_plus", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_b"] - ] - }, - { - "name": "godot_string_count", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"], - ["godot_int", "p_from"], - ["godot_int", "p_to"] - ] - }, - { - "name": "godot_string_countn", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"], - ["godot_int", "p_from"], - ["godot_int", "p_to"] - ] - }, - { - "name": "godot_string_dedent", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_length", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_casecmp_to", - "return_type": "signed char", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_str"] - ] - }, - { - "name": "godot_string_nocasecmp_to", - "return_type": "signed char", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_str"] - ] - }, - { - "name": "godot_string_naturalnocasecmp_to", - "return_type": "signed char", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_str"] - ] - }, - { - "name": "godot_string_begins_with", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_string"] - ] - }, - { - "name": "godot_string_begins_with_char_array", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const char *", "p_char_array"] - ] - }, - { - "name": "godot_string_bigrams", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_chr", - "return_type": "godot_string", - "arguments": [ - ["godot_char_type", "p_character"] - ] - }, - { - "name": "godot_string_ends_with", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_string"] - ] - }, - { - "name": "godot_string_ends_with_char_array", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const char *", "p_char_array"] - ] - }, - { - "name": "godot_string_find", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"] - ] - }, - { - "name": "godot_string_find_from", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"], - ["godot_int", "p_from"] - ] - }, - { - "name": "godot_string_findmk", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_keys"] - ] - }, - { - "name": "godot_string_findmk_from", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_keys"], - ["godot_int", "p_from"] - ] - }, - { - "name": "godot_string_findmk_from_in_place", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_keys"], - ["godot_int", "p_from"], - ["godot_int *", "r_key"] - ] - }, - { - "name": "godot_string_findn", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"] - ] - }, - { - "name": "godot_string_findn_from", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"], - ["godot_int", "p_from"] - ] - }, - { - "name": "godot_string_format", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_variant *", "p_values"] - ] - }, - { - "name": "godot_string_format_with_custom_placeholder", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_variant *", "p_values"], - ["const char *", "p_placeholder"] - ] - }, - { - "name": "godot_string_hex_encode_buffer", - "return_type": "godot_string", - "arguments": [ - ["const uint8_t *", "p_buffer"], - ["godot_int", "p_len"] - ] - }, - { - "name": "godot_string_insert", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_at_pos"], - ["const godot_string *", "p_string"] - ] - }, - { - "name": "godot_string_is_numeric", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_subsequence_of", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_string"] - ] - }, - { - "name": "godot_string_is_subsequence_ofi", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_string"] - ] - }, - { - "name": "godot_string_lpad", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_min_length"] - ] - }, - { - "name": "godot_string_lpad_with_custom_character", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_min_length"], - ["const godot_string *", "p_character"] - ] - }, - { - "name": "godot_string_match", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_wildcard"] - ] - }, - { - "name": "godot_string_matchn", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_wildcard"] - ] - }, - { - "name": "godot_string_md5", - "return_type": "godot_string", - "arguments": [ - ["const uint8_t *", "p_md5"] - ] - }, - { - "name": "godot_string_num", - "return_type": "godot_string", - "arguments": [ - ["double", "p_num"] - ] - }, - { - "name": "godot_string_num_int64", - "return_type": "godot_string", - "arguments": [ - ["int64_t", "p_num"], - ["godot_int", "p_base"] - ] - }, - { - "name": "godot_string_num_int64_capitalized", - "return_type": "godot_string", - "arguments": [ - ["int64_t", "p_num"], - ["godot_int", "p_base"], - ["godot_bool", "p_capitalize_hex"] - ] - }, - { - "name": "godot_string_num_real", - "return_type": "godot_string", - "arguments": [ - ["double", "p_num"] - ] - }, - { - "name": "godot_string_num_scientific", - "return_type": "godot_string", - "arguments": [ - ["double", "p_num"] - ] - }, - { - "name": "godot_string_num_with_decimals", - "return_type": "godot_string", - "arguments": [ - ["double", "p_num"], - ["godot_int", "p_decimals"] - ] - }, - { - "name": "godot_string_pad_decimals", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_digits"] - ] - }, - { - "name": "godot_string_pad_zeros", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_digits"] - ] - }, - { - "name": "godot_string_replace_first", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_key"], - ["const godot_string *", "p_with"] - ] - }, - { - "name": "godot_string_replace", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_key"], - ["const godot_string *", "p_with"] - ] - }, - { - "name": "godot_string_replacen", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_key"], - ["const godot_string *", "p_with"] - ] - }, - { - "name": "godot_string_rfind", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"] - ] - }, - { - "name": "godot_string_rfindn", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"] - ] - }, - { - "name": "godot_string_rfind_from", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"], - ["godot_int", "p_from"] - ] - }, - { - "name": "godot_string_rfindn_from", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_what"], - ["godot_int", "p_from"] - ] - }, - { - "name": "godot_string_rpad", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_min_length"] - ] - }, - { - "name": "godot_string_rpad_with_custom_character", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_min_length"], - ["const godot_string *", "p_character"] - ] - }, - { - "name": "godot_string_similarity", - "return_type": "godot_real", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_string"] - ] - }, - { - "name": "godot_string_sprintf", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_array *", "p_values"], - ["godot_bool *", "p_error"] - ] - }, - { - "name": "godot_string_substr", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_from"], - ["godot_int", "p_chars"] - ] - }, - { - "name": "godot_string_to_int", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_to_float", - "return_type": "double", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_camelcase_to_underscore", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_camelcase_to_underscore_lowercased", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_capitalize", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_char_to_float", - "return_type": "double", - "arguments": [ - ["const char *", "p_what"] - ] - }, - { - "name": "godot_string_wchar_to_float", - "return_type": "double", - "arguments": [ - ["const wchar_t *", "p_str"], - ["const wchar_t **", "r_end"] - ] - }, - { - "name": "godot_string_char_to_int", - "return_type": "godot_int", - "arguments": [ - ["const char *", "p_what"] - ] - }, - { - "name": "godot_string_wchar_to_int", - "return_type": "godot_int", - "arguments": [ - ["const wchar_t *", "p_str"] - ] - }, - { - "name": "godot_string_char_to_int_with_len", - "return_type": "godot_int", - "arguments": [ - ["const char *", "p_what"], - ["godot_int", "p_len"] - ] - }, - { - "name": "godot_string_wchar_to_int_with_len", - "return_type": "godot_int", - "arguments": [ - ["const wchar_t *", "p_str"], - ["int", "p_len"] - ] - }, - { - "name": "godot_string_hex_to_int", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_hex_to_int_with_prefix", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_get_slice_count", - "return_type": "godot_int", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_get_slice", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"], - ["godot_int", "p_slice"] - ] - }, - { - "name": "godot_string_get_slicec", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_char_type", "p_splitter"], - ["godot_int", "p_slice"] - ] - }, - { - "name": "godot_string_split", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_split_allow_empty", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_split_with_maxsplit", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"], - ["const godot_bool", "p_allow_empty"], - ["const godot_int", "p_maxsplit"] - ] - }, - { - "name": "godot_string_rsplit", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_rsplit_allow_empty", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_rsplit_with_maxsplit", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"], - ["const godot_bool", "p_allow_empty"], - ["const godot_int", "p_maxsplit"] - ] - }, - { - "name": "godot_string_split_floats", - "return_type": "godot_packed_float32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_split_floats_allow_empty", - "return_type": "godot_packed_float32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_split_floats_mk", - "return_type": "godot_packed_float32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_splitters"] - ] - }, - { - "name": "godot_string_split_floats_mk_allow_empty", - "return_type": "godot_packed_float32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_splitters"] - ] - }, - { - "name": "godot_string_split_ints", - "return_type": "godot_packed_int32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_split_ints_allow_empty", - "return_type": "godot_packed_int32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_splitter"] - ] - }, - { - "name": "godot_string_split_ints_mk", - "return_type": "godot_packed_int32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_splitters"] - ] - }, - { - "name": "godot_string_split_ints_mk_allow_empty", - "return_type": "godot_packed_int32_array", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_splitters"] - ] - }, - { - "name": "godot_string_split_spaces", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_lstrip", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_chars"] - ] - }, - { - "name": "godot_string_rstrip", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_chars"] - ] - }, - { - "name": "godot_string_trim_prefix", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_prefix"] - ] - }, - { - "name": "godot_string_trim_suffix", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_suffix"] - ] - }, - { - "name": "godot_string_char_lowercase", - "return_type": "godot_char_type", - "arguments": [ - ["godot_char_type", "p_char"] - ] - }, - { - "name": "godot_string_char_uppercase", - "return_type": "godot_char_type", - "arguments": [ - ["godot_char_type", "p_char"] - ] - }, - { - "name": "godot_string_to_lower", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_to_upper", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_get_basename", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_get_extension", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_left", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_pos"] - ] - }, - { - "name": "godot_string_ord_at", - "return_type": "godot_char_type", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_idx"] - ] - }, - { - "name": "godot_string_plus_file", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_file"] - ] - }, - { - "name": "godot_string_right", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_pos"] - ] - }, - { - "name": "godot_string_repeat", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_int", "p_count"] - ] - }, - { - "name": "godot_string_strip_edges", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_bool", "p_left"], - ["godot_bool", "p_right"] - ] - }, - { - "name": "godot_string_strip_escapes", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_erase", - "return_type": "void", - "arguments": [ - ["godot_string *", "p_self"], - ["godot_int", "p_pos"], - ["godot_int", "p_chars"] - ] - }, - { - "name": "godot_string_ascii", - "return_type": "godot_char_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_latin1", - "return_type": "godot_char_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_utf8", - "return_type": "godot_char_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_parse_utf8", - "return_type": "godot_bool", - "arguments": [ - ["godot_string *", "p_self"], - ["const char *", "p_utf8"] - ] - }, - { - "name": "godot_string_parse_utf8_with_len", - "return_type": "godot_bool", - "arguments": [ - ["godot_string *", "p_self"], - ["const char *", "p_utf8"], - ["godot_int", "p_len"] - ] - }, - { - "name": "godot_string_utf16", - "return_type": "godot_char16_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_parse_utf16", - "return_type": "godot_bool", - "arguments": [ - ["godot_string *", "p_self"], - ["const char16_t *", "p_utf16"] - ] - }, - { - "name": "godot_string_parse_utf16_with_len", - "return_type": "godot_bool", - "arguments": [ - ["godot_string *", "p_self"], - ["const char16_t *", "p_utf16"], - ["godot_int", "p_len"] - ] - }, - { - "name": "godot_string_hash", - "return_type": "uint32_t", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_hash64", - "return_type": "uint64_t", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_hash_chars", - "return_type": "uint32_t", - "arguments": [ - ["const char *", "p_cstr"] - ] - }, - { - "name": "godot_string_hash_chars_with_len", - "return_type": "uint32_t", - "arguments": [ - ["const char *", "p_cstr"], - ["godot_int", "p_len"] - ] - }, - { - "name": "godot_string_hash_wide_chars", - "return_type": "uint32_t", - "arguments": [ - ["const wchar_t *", "p_str"] - ] - }, - { - "name": "godot_string_hash_wide_chars_with_len", - "return_type": "uint32_t", - "arguments": [ - ["const wchar_t *", "p_str"], - ["godot_int", "p_len"] - ] - }, - { - "name": "godot_string_md5_buffer", - "return_type": "godot_packed_byte_array", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_md5_text", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_sha1_buffer", - "return_type": "godot_packed_byte_array", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_sha1_text", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_sha256_buffer", - "return_type": "godot_packed_byte_array", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_sha256_text", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_empty", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_get_base_dir", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_get_file", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_humanize_size", - "return_type": "godot_string", - "arguments": [ - ["size_t", "p_size"] - ] - }, - { - "name": "godot_string_is_abs_path", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_rel_path", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_resource_file", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_path_to", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_path"] - ] - }, - { - "name": "godot_string_path_to_file", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_string *", "p_path"] - ] - }, - { - "name": "godot_string_simplify_path", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_c_escape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_c_escape_multiline", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_c_unescape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_http_escape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_http_unescape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_json_escape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_xml_escape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_xml_escape_with_quotes", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_xml_unescape", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_percent_decode", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_percent_encode", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_join", - "return_type": "godot_string", - "arguments": [ - ["const godot_string *", "p_self"], - ["const godot_packed_string_array *", "p_parts"] - ] - }, - { - "name": "godot_string_is_valid_filename", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_valid_float", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_valid_hex_number", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"], - ["godot_bool", "p_with_prefix"] - ] - }, - { - "name": "godot_string_is_valid_html_color", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_valid_identifier", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_valid_integer", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_is_valid_ip_address", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_destroy", - "return_type": "void", - "arguments": [ - ["godot_string *", "p_self"] - ] - }, - { - "name": "godot_string_name_new", - "return_type": "void", - "arguments": [ - ["godot_string_name *", "r_dest"], - ["const godot_string *", "p_name"] - ] - }, - { - "name": "godot_string_name_new_data", - "return_type": "void", - "arguments": [ - ["godot_string_name *", "r_dest"], - ["const char *", "p_name"] - ] - }, - { - "name": "godot_string_name_get_name", - "return_type": "godot_string", - "arguments": [ - ["const godot_string_name *", "p_self"] - ] - }, - { - "name": "godot_string_name_get_hash", - "return_type": "uint32_t", - "arguments": [ - ["const godot_string_name *", "p_self"] - ] - }, - { - "name": "godot_string_name_get_data_unique_pointer", - "return_type": "const void *", - "arguments": [ - ["const godot_string_name *", "p_self"] - ] - }, - { - "name": "godot_string_name_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string_name *", "p_self"], - ["const godot_string_name *", "p_other"] - ] - }, - { - "name": "godot_string_name_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_string_name *", "p_self"], - ["const godot_string_name *", "p_other"] - ] - }, - { - "name": "godot_string_name_destroy", - "return_type": "void", - "arguments": [ - ["godot_string_name *", "p_self"] - ] - }, - { - "name": "godot_transform_new_with_axis_origin", - "return_type": "void", - "arguments": [ - ["godot_transform *", "r_dest"], - ["const godot_vector3 *", "p_x_axis"], - ["const godot_vector3 *", "p_y_axis"], - ["const godot_vector3 *", "p_z_axis"], - ["const godot_vector3 *", "p_origin"] - ] - }, - { - "name": "godot_transform_new_with_quat", - "return_type": "void", - "arguments": [ - ["godot_transform *", "r_dest"], - ["const godot_quat *", "p_quat"] - ] - }, - { - "name": "godot_transform_new", - "return_type": "void", - "arguments": [ - ["godot_transform *", "r_dest"], - ["const godot_basis *", "p_basis"], - ["const godot_vector3 *", "p_origin"] - ] - }, - { - "name": "godot_transform_get_basis", - "return_type": "godot_basis", - "arguments": [ - ["const godot_transform *", "p_self"] - ] - }, - { - "name": "godot_transform_set_basis", - "return_type": "void", - "arguments": [ - ["godot_transform *", "p_self"], - ["const godot_basis *", "p_v"] - ] - }, - { - "name": "godot_transform_get_origin", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_transform *", "p_self"] - ] - }, - { - "name": "godot_transform_set_origin", - "return_type": "void", - "arguments": [ - ["godot_transform *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_transform_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_transform *", "p_self"] - ] - }, - { - "name": "godot_transform_inverse", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"] - ] - }, - { - "name": "godot_transform_affine_inverse", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"] - ] - }, - { - "name": "godot_transform_orthonormalized", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"] - ] - }, - { - "name": "godot_transform_rotated", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_vector3 *", "p_axis"], - ["const godot_real", "p_phi"] - ] - }, - { - "name": "godot_transform_scaled", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_vector3 *", "p_scale"] - ] - }, - { - "name": "godot_transform_translated", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_vector3 *", "p_ofs"] - ] - }, - { - "name": "godot_transform_looking_at", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_vector3 *", "p_target"], - ["const godot_vector3 *", "p_up"] - ] - }, - { - "name": "godot_transform_xform_plane", - "return_type": "godot_plane", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_plane *", "p_v"] - ] - }, - { - "name": "godot_transform_xform_inv_plane", - "return_type": "godot_plane", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_plane *", "p_v"] - ] - }, - { - "name": "godot_transform_new_identity", - "return_type": "void", - "arguments": [ - ["godot_transform *", "r_dest"] - ] - }, - { - "name": "godot_transform_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_transform *", "p_b"] - ] - }, - { - "name": "godot_transform_operator_multiply", - "return_type": "godot_transform", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_transform *", "p_b"] - ] - }, - { - "name": "godot_transform_xform_vector3", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_transform_xform_inv_vector3", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_vector3 *", "p_v"] - ] - }, - { - "name": "godot_transform_xform_aabb", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_aabb *", "p_v"] - ] - }, - { - "name": "godot_transform_xform_inv_aabb", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_transform *", "p_self"], - ["const godot_aabb *", "p_v"] - ] - }, - { - "name": "godot_transform2d_new", - "return_type": "void", - "arguments": [ - ["godot_transform2d *", "r_dest"], - ["const godot_real", "p_rot"], - ["const godot_vector2 *", "p_pos"] - ] - }, - { - "name": "godot_transform2d_new_axis_origin", - "return_type": "void", - "arguments": [ - ["godot_transform2d *", "r_dest"], - ["const godot_vector2 *", "p_x_axis"], - ["const godot_vector2 *", "p_y_axis"], - ["const godot_vector2 *", "p_origin"] - ] - }, - { - "name": "godot_transform2d_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_inverse", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_affine_inverse", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_get_rotation", - "return_type": "godot_real", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_get_origin", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_get_scale", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_orthonormalized", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"] - ] - }, - { - "name": "godot_transform2d_rotated", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_real", "p_phi"] - ] - }, - { - "name": "godot_transform2d_scaled", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_vector2 *", "p_scale"] - ] - }, - { - "name": "godot_transform2d_translated", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_vector2 *", "p_offset"] - ] - }, - { - "name": "godot_transform2d_xform_vector2", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_vector2 *", "p_v"] - ] - }, - { - "name": "godot_transform2d_xform_inv_vector2", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_vector2 *", "p_v"] - ] - }, - { - "name": "godot_transform2d_basis_xform_vector2", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_vector2 *", "p_v"] - ] - }, - { - "name": "godot_transform2d_basis_xform_inv_vector2", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_vector2 *", "p_v"] - ] - }, - { - "name": "godot_transform2d_interpolate_with", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_transform2d *", "p_m"], - ["const godot_real", "p_c"] - ] - }, - { - "name": "godot_transform2d_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_transform2d *", "p_b"] - ] - }, - { - "name": "godot_transform2d_operator_multiply", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_transform2d *", "p_b"] - ] - }, - { - "name": "godot_transform2d_new_identity", - "return_type": "void", - "arguments": [ - ["godot_transform2d *", "r_dest"] - ] - }, - { - "name": "godot_transform2d_xform_rect2", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_rect2 *", "p_v"] - ] - }, - { - "name": "godot_transform2d_xform_inv_rect2", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_transform2d *", "p_self"], - ["const godot_rect2 *", "p_v"] - ] - }, - { - "name": "godot_variant_get_type", - "return_type": "godot_variant_type", - "arguments": [ - ["const godot_variant *", "p_v"] - ] - }, - { - "name": "godot_variant_new_copy", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_variant *", "p_src"] - ] - }, - { - "name": "godot_variant_new_nil", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"] - ] - }, - { - "name": "godot_variant_new_bool", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_bool", "p_b"] - ] - }, - { - "name": "godot_variant_new_uint", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const uint64_t", "p_i"] - ] - }, - { - "name": "godot_variant_new_int", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const int64_t", "p_i"] - ] - }, - { - "name": "godot_variant_new_real", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const double", "p_r"] - ] - }, - { - "name": "godot_variant_new_string", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_string *", "p_s"] - ] - }, - { - "name": "godot_variant_new_string_name", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_string_name *", "p_s"] - ] - }, - { - "name": "godot_variant_new_vector2", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_vector2 *", "p_v2"] - ] - }, - { - "name": "godot_variant_new_vector2i", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_vector2i *", "p_v2"] - ] - }, - { - "name": "godot_variant_new_rect2", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_rect2 *", "p_rect2"] - ] - }, - { - "name": "godot_variant_new_rect2i", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_rect2i *", "p_rect2"] - ] - }, - { - "name": "godot_variant_new_vector3", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_vector3 *", "p_v3"] - ] - }, - { - "name": "godot_variant_new_vector3i", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_vector3i *", "p_v3"] - ] - }, - { - "name": "godot_variant_new_transform2d", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_transform2d *", "p_t2d"] - ] - }, - { - "name": "godot_variant_new_plane", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_plane *", "p_plane"] - ] - }, - { - "name": "godot_variant_new_quat", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_quat *", "p_quat"] - ] - }, - { - "name": "godot_variant_new_aabb", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_aabb *", "p_aabb"] - ] - }, - { - "name": "godot_variant_new_basis", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_basis *", "p_basis"] - ] - }, - { - "name": "godot_variant_new_transform", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_transform *", "p_trans"] - ] - }, - { - "name": "godot_variant_new_color", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_color *", "p_color"] - ] - }, - { - "name": "godot_variant_new_node_path", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_node_path *", "p_np"] - ] - }, - { - "name": "godot_variant_new_rid", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_rid *", "p_rid"] - ] - }, - { - "name": "godot_variant_new_object", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_object *", "p_obj"] - ] - }, - { - "name": "godot_variant_new_callable", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_callable *", "p_cb"] - ] - }, - { - "name": "godot_variant_new_signal", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_signal *", "p_signal"] - ] - }, - { - "name": "godot_variant_new_dictionary", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_dictionary *", "p_dict"] - ] - }, - { - "name": "godot_variant_new_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_array *", "p_arr"] - ] - }, - { - "name": "godot_variant_new_packed_byte_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_byte_array *", "p_pba"] - ] - }, - { - "name": "godot_variant_new_packed_int32_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_int32_array *", "p_pia"] - ] - }, - { - "name": "godot_variant_new_packed_int64_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_int64_array *", "p_pia"] - ] - }, - { - "name": "godot_variant_new_packed_float32_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_float32_array *", "p_pra"] - ] - }, - { - "name": "godot_variant_new_packed_float64_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_float64_array *", "p_pra"] - ] - }, - { - "name": "godot_variant_new_packed_string_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_string_array *", "p_psa"] - ] - }, - { - "name": "godot_variant_new_packed_vector2_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_vector2_array *", "p_pv2a"] - ] - }, - { - "name": "godot_variant_new_packed_vector3_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_vector3_array *", "p_pv3a"] - ] - }, - { - "name": "godot_variant_new_packed_color_array", - "return_type": "void", - "arguments": [ - ["godot_variant *", "r_dest"], - ["const godot_packed_color_array *", "p_pca"] - ] - }, - { - "name": "godot_variant_as_bool", - "return_type": "godot_bool", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_uint", - "return_type": "uint64_t", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_int", - "return_type": "int64_t", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_real", - "return_type": "double", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_string_name", - "return_type": "godot_string_name", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_vector2", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_vector2i", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_rect2", - "return_type": "godot_rect2", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_rect2i", - "return_type": "godot_rect2i", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_vector3", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_vector3i", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_transform2d", - "return_type": "godot_transform2d", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_plane", - "return_type": "godot_plane", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_quat", - "return_type": "godot_quat", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_aabb", - "return_type": "godot_aabb", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_basis", - "return_type": "godot_basis", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_transform", - "return_type": "godot_transform", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_color", - "return_type": "godot_color", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_node_path", - "return_type": "godot_node_path", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_rid", - "return_type": "godot_rid", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_object", - "return_type": "godot_object *", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_callable", - "return_type": "godot_callable", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_signal", - "return_type": "godot_signal", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_dictionary", - "return_type": "godot_dictionary", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_array", - "return_type": "godot_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_byte_array", - "return_type": "godot_packed_byte_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_int32_array", - "return_type": "godot_packed_int32_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_int64_array", - "return_type": "godot_packed_int64_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_float32_array", - "return_type": "godot_packed_float32_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_float64_array", - "return_type": "godot_packed_float64_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_string_array", - "return_type": "godot_packed_string_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_vector2_array", - "return_type": "godot_packed_vector2_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_vector3_array", - "return_type": "godot_packed_vector3_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_as_packed_color_array", - "return_type": "godot_packed_color_array", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_call", - "return_type": "godot_variant", - "arguments": [ - ["godot_variant *", "p_self"], - ["const godot_string *", "p_method"], - ["const godot_variant **", "p_args"], - ["const godot_int", "p_argcount"], - ["godot_variant_call_error *", "r_error"] - ] - }, - { - "name": "godot_variant_has_method", - "return_type": "godot_bool", - "arguments": [ - ["const godot_variant *", "p_self"], - ["const godot_string *", "p_method"] - ] - }, - { - "name": "godot_variant_hash", - "return_type": "uint32_t", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_variant *", "p_self"], - ["const godot_variant *", "p_other"] - ] - }, - { - "name": "godot_variant_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_variant *", "p_self"], - ["const godot_variant *", "p_other"] - ] - }, - { - "name": "godot_variant_get_operator_name", - "return_type": "godot_string", - "arguments": [ - ["godot_variant_operator", "p_op"] - ] - }, - { - "name": "godot_variant_evaluate", - "return_type": "void", - "arguments": [ - ["godot_variant_operator", "p_op"], - ["const godot_variant *", "p_a"], - ["const godot_variant *", "p_b"], - ["godot_variant *", "r_ret"], - ["godot_bool *", "r_valid"] - ] - }, - { - "name": "godot_variant_hash_compare", - "return_type": "godot_bool", - "arguments": [ - ["const godot_variant *", "p_self"], - ["const godot_variant *", "p_other"] - ] - }, - { - "name": "godot_variant_booleanize", - "return_type": "godot_bool", - "arguments": [ - ["const godot_variant *", "p_self"] - ] - }, - { - "name": "godot_variant_destroy", - "return_type": "void", - "arguments": [ - ["godot_variant *", "p_self"] - ] - }, - { - "name": "godot_vector2_as_vector2i", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_sign", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_move_toward", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_to"], - ["const godot_real", "p_delta"] - ] - }, - { - "name": "godot_vector2_direction_to", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_to"] - ] - }, - { - "name": "godot_vector2_new", - "return_type": "void", - "arguments": [ - ["godot_vector2 *", "r_dest"], - ["const godot_real", "p_x"], - ["const godot_real", "p_y"] - ] - }, - { - "name": "godot_vector2_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_normalized", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_length", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_angle", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_length_squared", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_is_normalized", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_distance_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_to"] - ] - }, - { - "name": "godot_vector2_distance_squared_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_to"] - ] - }, - { - "name": "godot_vector2_angle_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_to"] - ] - }, - { - "name": "godot_vector2_angle_to_point", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_to"] - ] - }, - { - "name": "godot_vector2_lerp", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_vector2_cubic_interpolate", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"], - ["const godot_vector2 *", "p_pre_a"], - ["const godot_vector2 *", "p_post_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_vector2_rotated", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_real", "p_phi"] - ] - }, - { - "name": "godot_vector2_tangent", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_floor", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_snapped", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_by"] - ] - }, - { - "name": "godot_vector2_aspect", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_dot", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_with"] - ] - }, - { - "name": "godot_vector2_slide", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_n"] - ] - }, - { - "name": "godot_vector2_bounce", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_n"] - ] - }, - { - "name": "godot_vector2_reflect", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_n"] - ] - }, - { - "name": "godot_vector2_abs", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_clamped", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_real", "p_length"] - ] - }, - { - "name": "godot_vector2_operator_add", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_subtract", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_multiply_vector", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_multiply_scalar", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_divide_vector", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_divide_scalar", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector2 *", "p_self"], - ["const godot_vector2 *", "p_b"] - ] - }, - { - "name": "godot_vector2_operator_neg", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_set_x", - "return_type": "void", - "arguments": [ - ["godot_vector2 *", "p_self"], - ["const godot_real", "p_x"] - ] - }, - { - "name": "godot_vector2_set_y", - "return_type": "void", - "arguments": [ - ["godot_vector2 *", "p_self"], - ["const godot_real", "p_y"] - ] - }, - { - "name": "godot_vector2_get_x", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2_get_y", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2 *", "p_self"] - ] - }, - { - "name": "godot_vector2i_new", - "return_type": "void", - "arguments": [ - ["godot_vector2i *", "r_dest"], - ["const godot_int", "p_x"], - ["const godot_int", "p_y"] - ] - }, - { - "name": "godot_vector2i_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_as_vector2", - "return_type": "godot_vector2", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_aspect", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_abs", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_sign", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_operator_add", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_vector2i *", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_subtract", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_vector2i *", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_multiply_vector", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_vector2i *", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_multiply_scalar", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_int", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_divide_vector", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_vector2i *", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_divide_scalar", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_int", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_vector2i *", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector2i *", "p_self"], - ["const godot_vector2i *", "p_b"] - ] - }, - { - "name": "godot_vector2i_operator_neg", - "return_type": "godot_vector2i", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_set_x", - "return_type": "void", - "arguments": [ - ["godot_vector2i *", "p_self"], - ["const godot_int", "p_x"] - ] - }, - { - "name": "godot_vector2i_set_y", - "return_type": "void", - "arguments": [ - ["godot_vector2i *", "p_self"], - ["const godot_int", "p_y"] - ] - }, - { - "name": "godot_vector2i_get_x", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector2i_get_y", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector2i *", "p_self"] - ] - }, - { - "name": "godot_vector3_as_vector3i", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_sign", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_move_toward", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_to"], - ["const godot_real", "p_delta"] - ] - }, - { - "name": "godot_vector3_direction_to", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_to"] - ] - }, - { - "name": "godot_vector3_new", - "return_type": "void", - "arguments": [ - ["godot_vector3 *", "r_dest"], - ["const godot_real", "p_x"], - ["const godot_real", "p_y"], - ["const godot_real", "p_z"] - ] - }, - { - "name": "godot_vector3_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_min_axis", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_max_axis", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_length", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_length_squared", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_is_normalized", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_normalized", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_inverse", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_snapped", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_by"] - ] - }, - { - "name": "godot_vector3_rotated", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_axis"], - ["const godot_real", "p_phi"] - ] - }, - { - "name": "godot_vector3_lerp", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_vector3_cubic_interpolate", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"], - ["const godot_vector3 *", "p_pre_a"], - ["const godot_vector3 *", "p_post_b"], - ["const godot_real", "p_t"] - ] - }, - { - "name": "godot_vector3_dot", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_cross", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_outer", - "return_type": "godot_basis", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_to_diagonal_matrix", - "return_type": "godot_basis", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_abs", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_floor", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_ceil", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_distance_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_distance_squared_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_angle_to", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_to"] - ] - }, - { - "name": "godot_vector3_slide", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_n"] - ] - }, - { - "name": "godot_vector3_bounce", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_n"] - ] - }, - { - "name": "godot_vector3_reflect", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_n"] - ] - }, - { - "name": "godot_vector3_operator_add", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_subtract", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_multiply_vector", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_multiply_scalar", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_divide_vector", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_divide_scalar", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_real", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3 *", "p_b"] - ] - }, - { - "name": "godot_vector3_operator_neg", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3 *", "p_self"] - ] - }, - { - "name": "godot_vector3_set_axis", - "return_type": "void", - "arguments": [ - ["godot_vector3 *", "p_self"], - ["const godot_vector3_axis", "p_axis"], - ["const godot_real", "p_val"] - ] - }, - { - "name": "godot_vector3_get_axis", - "return_type": "godot_real", - "arguments": [ - ["const godot_vector3 *", "p_self"], - ["const godot_vector3_axis", "p_axis"] - ] - }, - { - "name": "godot_vector3i_new", - "return_type": "void", - "arguments": [ - ["godot_vector3i *", "r_dest"], - ["const godot_int", "p_x"], - ["const godot_int", "p_y"], - ["const godot_int", "p_z"] - ] - }, - { - "name": "godot_vector3i_as_string", - "return_type": "godot_string", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_as_vector3", - "return_type": "godot_vector3", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_min_axis", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_max_axis", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_abs", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_sign", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_operator_add", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3i *", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_subtract", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3i *", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_multiply_vector", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3i *", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_multiply_scalar", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_int", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_divide_vector", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3i *", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_divide_scalar", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_int", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_equal", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3i *", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_less", - "return_type": "godot_bool", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3i *", "p_b"] - ] - }, - { - "name": "godot_vector3i_operator_neg", - "return_type": "godot_vector3i", - "arguments": [ - ["const godot_vector3i *", "p_self"] - ] - }, - { - "name": "godot_vector3i_set_axis", - "return_type": "void", - "arguments": [ - ["godot_vector3i *", "p_self"], - ["const godot_vector3_axis", "p_axis"], - ["const godot_int", "p_val"] - ] - }, - { - "name": "godot_vector3i_get_axis", - "return_type": "godot_int", - "arguments": [ - ["const godot_vector3i *", "p_self"], - ["const godot_vector3_axis", "p_axis"] - ] - }, - { - "name": "godot_global_get_singleton", - "return_type": "godot_object *", - "arguments": [ - ["char *", "p_name"] - ] - }, - { - "name": "godot_get_class_tag", - "return_type": "void *", - "arguments": [ - ["const godot_string_name *", "p_class"] - ] - }, - { - "name": "godot_object_cast_to", - "return_type": "godot_object *", - "arguments": [ - ["const godot_object *", "p_object"], - ["void *", "p_class_tag"] - ] - }, - { - "name": "godot_object_get_instance_id", - "return_type": "uint64_t", - "arguments": [ - ["const godot_object *", "p_object"] - ] - }, - { - "name": "godot_instance_from_id", - "return_type": "godot_object *", - "arguments": [ - ["uint64_t", "p_instance_id"] - ] - }, - { - "name": "godot_object_destroy", - "return_type": "void", - "arguments": [ - ["godot_object *", "p_o"] - ] - }, - { - "name": "godot_method_bind_get_method", - "return_type": "godot_method_bind *", - "arguments": [ - ["const char *", "p_classname"], - ["const char *", "p_methodname"] - ] - }, - { - "name": "godot_method_bind_ptrcall", - "return_type": "void", - "arguments": [ - ["godot_method_bind *", "p_method_bind"], - ["godot_object *", "p_instance"], - ["const void **", "p_args"], - ["void *", "p_ret"] - ] - }, - { - "name": "godot_method_bind_call", - "return_type": "godot_variant", - "arguments": [ - ["godot_method_bind *", "p_method_bind"], - ["godot_object *", "p_instance"], - ["const godot_variant **", "p_args"], - ["const int", "p_arg_count"], - ["godot_variant_call_error *", "p_call_error"] - ] - }, - { - "name": "godot_get_class_constructor", - "return_type": "godot_class_constructor", - "arguments": [ - ["const char *", "p_classname"] - ] - }, - { - "name": "godot_get_global_constants", - "return_type": "godot_dictionary", - "arguments": [ - ] - }, - { - "name": "godot_register_native_call_type", - "return_type": "void", - "arguments": [ - ["const char *", "call_type"], - ["native_call_cb", "p_callback"] - ] - }, - { - "name": "godot_alloc", - "return_type": "void *", - "arguments": [ - ["int", "p_bytes"] - ] - }, - { - "name": "godot_realloc", - "return_type": "void *", - "arguments": [ - ["void *", "p_ptr"], - ["int", "p_bytes"] - ] - }, - { - "name": "godot_free", - "return_type": "void", - "arguments": [ - ["void *", "p_ptr"] - ] - }, - { - "name": "godot_print_error", - "return_type": "void", - "arguments": [ - ["const char *", "p_description"], - ["const char *", "p_function"], - ["const char *", "p_file"], - ["int", "p_line"] - ] - }, - { - "name": "godot_print_warning", - "return_type": "void", - "arguments": [ - ["const char *", "p_description"], - ["const char *", "p_function"], - ["const char *", "p_file"], - ["int", "p_line"] - ] - }, - { - "name": "godot_print", - "return_type": "void", - "arguments": [ - ["const godot_string *", "p_message"] - ] - } - ] - }, - "extensions": [ - { - "name": "nativescript", - "type": "NATIVESCRIPT", - "version": { - "major": 4, - "minor": 0 - }, - "next": null, - "api": [ - { - "name": "godot_nativescript_register_class", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_base"], - ["godot_nativescript_instance_create_func", "p_create_func"], - ["godot_nativescript_instance_destroy_func", "p_destroy_func"] - ] - }, - { - "name": "godot_nativescript_register_tool_class", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_base"], - ["godot_nativescript_instance_create_func", "p_create_func"], - ["godot_nativescript_instance_destroy_func", "p_destroy_func"] - ] - }, - { - "name": "godot_nativescript_register_method", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_function_name"], - ["godot_nativescript_method_attributes", "p_attr"], - ["godot_nativescript_instance_method", "p_method"] - ] - }, - { - "name": "godot_nativescript_set_method_argument_information", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_function_name"], - ["int", "p_num_args"], - ["const godot_nativescript_method_argument *", "p_args"] - ] - }, - { - "name": "godot_nativescript_register_property", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_path"], - ["godot_nativescript_property_attributes *", "p_attr"], - ["godot_nativescript_property_set_func", "p_set_func"], - ["godot_nativescript_property_get_func", "p_get_func"] - ] - }, - { - "name": "godot_nativescript_register_signal", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const godot_nativescript_signal *", "p_signal"] - ] - }, - { - "name": "godot_nativescript_get_userdata", - "return_type": "void *", - "arguments": [ - ["godot_object *", "p_instance"] - ] - }, - { - "name": "godot_nativescript_set_class_documentation", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["godot_string", "p_documentation"] - ] - }, - { - "name": "godot_nativescript_set_method_documentation", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_function_name"], - ["godot_string", "p_documentation"] - ] - }, - { - "name": "godot_nativescript_set_property_documentation", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_path"], - ["godot_string", "p_documentation"] - ] - }, - { - "name": "godot_nativescript_set_signal_documentation", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const char *", "p_signal_name"], - ["godot_string", "p_documentation"] - ] - }, - { - "name": "godot_nativescript_set_global_type_tag", - "return_type": "void", - "arguments": [ - ["int", "p_idx"], - ["const char *", "p_name"], - ["const void *", "p_type_tag"] - ] - }, - { - "name": "godot_nativescript_get_global_type_tag", - "return_type": "const void *", - "arguments": [ - ["int", "p_idx"], - ["const char *", "p_name"] - ] - }, - { - "name": "godot_nativescript_set_type_tag", - "return_type": "void", - "arguments": [ - ["void *", "p_gdnative_handle"], - ["const char *", "p_name"], - ["const void *", "p_type_tag"] - ] - }, - { - "name": "godot_nativescript_get_type_tag", - "return_type": "const void *", - "arguments": [ - ["const godot_object *", "p_object"] - ] - }, - { - "name": "godot_nativescript_register_instance_binding_data_functions", - "return_type": "int", - "arguments": [ - ["godot_nativescript_instance_binding_functions", "p_binding_functions"] - ] - }, - { - "name": "godot_nativescript_unregister_instance_binding_data_functions", - "return_type": "void", - "arguments": [ - ["int", "p_idx"] - ] - }, - { - "name": "godot_nativescript_get_instance_binding_data", - "return_type": "void *", - "arguments": [ - ["int", "p_idx"], - ["godot_object *", "p_object"] - ] - }, - { - "name": "godot_nativescript_profiling_add_data", - "return_type": "void", - "arguments": [ - ["const char *", "p_signature"], - ["uint64_t", "p_line"] - ] - } - ] - }, - { - "name": "pluginscript", - "type": "PLUGINSCRIPT", - "version": { - "major": 1, - "minor": 0 - }, - "next": null, - "api": [ - { - "name": "godot_pluginscript_register_language", - "return_type": "void", - "arguments": [ - ["const godot_pluginscript_language_desc *", "language_desc"] - ] - } - ] - }, - { - "name": "android", - "type": "ANDROID", - "version": { - "major": 1, - "minor": 1 - }, - "next": null, - "api": [ - { - "name": "godot_android_get_env", - "return_type": "JNIEnv*", - "arguments": [ - ] - }, - { - "name": "godot_android_get_activity", - "return_type": "jobject", - "arguments": [ - ] - }, - { - "name": "godot_android_get_surface", - "return_type": "jobject", - "arguments": [ - ] - }, - { - "name": "godot_android_is_activity_resumed", - "return_type": "bool", - "arguments": [ - ] - } - ] - }, - { - "name": "xr", - "type": "XR", - "version": { - "major": 1, - "minor": 1 - }, - "next": null, - "api": [ - { - "name": "godot_xr_register_interface", - "return_type": "void", - "arguments": [ - ["const godot_xr_interface_gdnative *", "p_interface"] - ] - }, - { - "name": "godot_xr_get_worldscale", - "return_type": "godot_real", - "arguments": [] - }, - { - "name": "godot_xr_get_reference_frame", - "return_type": "godot_transform", - "arguments": [] - }, - { - "name": "godot_xr_blit", - "return_type": "void", - "arguments": [ - ["godot_int", "p_eye"], - ["godot_rid *", "p_render_target"], - ["godot_rect2 *", "p_screen_rect"] - ] - }, - { - "name": "godot_xr_get_texid", - "return_type": "godot_int", - "arguments": [ - ["godot_rid *", "p_render_target"] - ] - }, - { - "name": "godot_xr_add_controller", - "return_type": "godot_int", - "arguments": [ - ["char *", "p_device_name"], - ["godot_int", "p_hand"], - ["godot_bool", "p_tracks_orientation"], - ["godot_bool", "p_tracks_position"] - ] - }, - { - "name": "godot_xr_remove_controller", - "return_type": "void", - "arguments": [ - ["godot_int", "p_controller_id"] - ] - }, - { - "name": "godot_xr_set_controller_transform", - "return_type": "void", - "arguments": [ - ["godot_int", "p_controller_id"], - ["godot_transform *", "p_transform"], - ["godot_bool", "p_tracks_orientation"], - ["godot_bool", "p_tracks_position"] - ] - }, - { - "name": "godot_xr_set_controller_button", - "return_type": "void", - "arguments": [ - ["godot_int", "p_controller_id"], - ["godot_int", "p_button"], - ["godot_bool", "p_is_pressed"] - ] - }, - { - "name": "godot_xr_set_controller_axis", - "return_type": "void", - "arguments": [ - ["godot_int", "p_controller_id"], - ["godot_int", "p_exis"], - ["godot_real", "p_value"], - ["godot_bool", "p_can_be_negative"] - ] - }, - { - "name": "godot_xr_get_controller_rumble", - "return_type": "godot_real", - "arguments": [ - ["godot_int", "p_controller_id"] - ] - } - ] - }, - { - "name": "videodecoder", - "type": "VIDEODECODER", - "version": { - "major": 0, - "minor": 1 - }, - "next": null, - "api": [ - { - "name": "godot_videodecoder_file_read", - "return_type": "godot_int", - "arguments": [ - ["void *", "file_ptr"], - ["uint8_t *", "buf"], - ["int", "buf_size"] - ] - }, - { - "name": "godot_videodecoder_file_seek", - "return_type": "int64_t", - "arguments": [ - [ "void *", "file_ptr"], - ["int64_t", "pos"], - ["int", "whence"] - ] - }, - { - "name": "godot_videodecoder_register_decoder", - "return_type": "void", - "arguments": [ - ["const godot_videodecoder_interface_gdnative *", "p_interface"] - ] - } - ] - }, - { - "name": "net", - "type": "NET", - "version": { - "major": 4, - "minor": 0 - }, - "next": null, - "api": [ - { - "name": "godot_net_bind_stream_peer", - "return_type": "void", - "arguments": [ - ["godot_object *", "p_obj"], - ["const godot_net_stream_peer *", "p_interface"] - ] - }, - { - "name": "godot_net_bind_packet_peer", - "return_type": "void", - "arguments": [ - ["godot_object *", "p_obj"], - ["const godot_net_packet_peer *", "p_interface"] - ] - }, - { - "name": "godot_net_bind_multiplayer_peer", - "return_type": "void", - "arguments": [ - ["godot_object *", "p_obj"], - ["const godot_net_multiplayer_peer *", "p_interface"] - ] - }, - { - "name": "godot_net_set_webrtc_library", - "return_type": "godot_error", - "arguments": [ - ["const godot_net_webrtc_library *", "p_library"] - ] - }, - { - "name": "godot_net_bind_webrtc_peer_connection", - "return_type": "void", - "arguments": [ - ["godot_object *", "p_obj"], - ["const godot_net_webrtc_peer_connection *", "p_interface"] - ] - }, - { - "name": "godot_net_bind_webrtc_data_channel", - "return_type": "void", - "arguments": [ - ["godot_object *", "p_obj"], - ["const godot_net_webrtc_data_channel *", "p_interface"] - ] - } - ] - } - ] + "core": { + "type": "CORE", + "version": { + "major": 4, + "minor": 0 + }, + "next": null, + "api": [ + { + "name": "godot_object_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_object *", + "p_o" + ] + ] + }, + { + "name": "godot_global_get_singleton", + "return_type": "godot_object *", + "arguments": [ + [ + "char *", + "p_name" + ] + ] + }, + { + "name": "godot_method_bind_get_method", + "return_type": "godot_method_bind *", + "arguments": [ + [ + "const char *", + "p_classname" + ], + [ + "const char *", + "p_methodname" + ] + ] + }, + { + "name": "godot_method_bind_ptrcall", + "return_type": "void", + "arguments": [ + [ + "godot_method_bind *", + "p_method_bind" + ], + [ + "godot_object *", + "p_instance" + ], + [ + "const void **", + "p_args" + ], + [ + "void *", + "p_ret" + ] + ] + }, + { + "name": "godot_method_bind_call", + "return_type": "godot_variant", + "arguments": [ + [ + "godot_method_bind *", + "p_method_bind" + ], + [ + "godot_object *", + "p_instance" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "const int", + "p_arg_count" + ], + [ + "godot_variant_call_error *", + "p_call_error" + ] + ] + }, + { + "name": "godot_get_class_constructor", + "return_type": "godot_class_constructor", + "arguments": [ + [ + "const char *", + "p_classname" + ] + ] + }, + { + "name": "godot_get_global_constants", + "return_type": "godot_dictionary", + "arguments": [] + }, + { + "name": "godot_register_native_call_type", + "return_type": "void", + "arguments": [ + [ + "const char *", + "call_type" + ], + [ + "native_call_cb", + "p_callback" + ] + ] + }, + { + "name": "godot_alloc", + "return_type": "void *", + "arguments": [ + [ + "int", + "p_bytes" + ] + ] + }, + { + "name": "godot_realloc", + "return_type": "void *", + "arguments": [ + [ + "void *", + "p_ptr" + ], + [ + "int", + "p_bytes" + ] + ] + }, + { + "name": "godot_free", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_ptr" + ] + ] + }, + { + "name": "godot_print_error", + "return_type": "void", + "arguments": [ + [ + "const char *", + "p_description" + ], + [ + "const char *", + "p_function" + ], + [ + "const char *", + "p_file" + ], + [ + "int", + "p_line" + ] + ] + }, + { + "name": "godot_print_warning", + "return_type": "void", + "arguments": [ + [ + "const char *", + "p_description" + ], + [ + "const char *", + "p_function" + ], + [ + "const char *", + "p_file" + ], + [ + "int", + "p_line" + ] + ] + }, + { + "name": "godot_print_script_error", + "return_type": "void", + "arguments": [ + [ + "const char *", + "p_description" + ], + [ + "const char *", + "p_function" + ], + [ + "const char *", + "p_file" + ], + [ + "int", + "p_line" + ] + ] + }, + { + "name": "godot_get_class_tag", + "return_type": "void *", + "arguments": [ + [ + "const godot_string_name *", + "p_class" + ] + ] + }, + { + "name": "godot_object_cast_to", + "return_type": "godot_object *", + "arguments": [ + [ + "const godot_object *", + "p_object" + ], + [ + "void *", + "p_class_tag" + ] + ] + }, + { + "name": "godot_instance_from_id", + "return_type": "godot_object *", + "arguments": [ + [ + "uint64_t", + "p_instance_id" + ] + ] + }, + { + "name": "godot_object_get_instance_id", + "return_type": "uint64_t", + "arguments": [ + [ + "const godot_object *", + "p_object" + ] + ] + }, + { + "name": "godot_variant_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_variant *", + "p_src" + ] + ] + }, + { + "name": "godot_variant_new_nil", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ] + ] + }, + { + "name": "godot_variant_new_bool", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_bool", + "p_b" + ] + ] + }, + { + "name": "godot_variant_new_int", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const int64_t", + "p_i" + ] + ] + }, + { + "name": "godot_variant_new_float", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const double", + "p_f" + ] + ] + }, + { + "name": "godot_variant_new_string", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_string *", + "p_s" + ] + ] + }, + { + "name": "godot_variant_new_string_name", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_string_name *", + "p_s" + ] + ] + }, + { + "name": "godot_variant_new_vector2", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_vector2 *", + "p_v2" + ] + ] + }, + { + "name": "godot_variant_new_vector2i", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_vector2i *", + "p_v2" + ] + ] + }, + { + "name": "godot_variant_new_rect2", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_rect2 *", + "p_rect2" + ] + ] + }, + { + "name": "godot_variant_new_rect2i", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_rect2i *", + "p_rect2" + ] + ] + }, + { + "name": "godot_variant_new_vector3", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_vector3 *", + "p_v3" + ] + ] + }, + { + "name": "godot_variant_new_vector3i", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_vector3i *", + "p_v3" + ] + ] + }, + { + "name": "godot_variant_new_transform2d", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_transform2d *", + "p_t2d" + ] + ] + }, + { + "name": "godot_variant_new_plane", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_plane *", + "p_plane" + ] + ] + }, + { + "name": "godot_variant_new_quaternion", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_quaternion *", + "p_quaternion" + ] + ] + }, + { + "name": "godot_variant_new_aabb", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_aabb *", + "p_aabb" + ] + ] + }, + { + "name": "godot_variant_new_basis", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_basis *", + "p_basis" + ] + ] + }, + { + "name": "godot_variant_new_transform3d", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_transform3d *", + "p_trans" + ] + ] + }, + { + "name": "godot_variant_new_color", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_color *", + "p_color" + ] + ] + }, + { + "name": "godot_variant_new_node_path", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_node_path *", + "p_np" + ] + ] + }, + { + "name": "godot_variant_new_rid", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_rid *", + "p_rid" + ] + ] + }, + { + "name": "godot_variant_new_object", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_object *", + "p_obj" + ] + ] + }, + { + "name": "godot_variant_new_callable", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_callable *", + "p_cb" + ] + ] + }, + { + "name": "godot_variant_new_signal", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_signal *", + "p_signal" + ] + ] + }, + { + "name": "godot_variant_new_dictionary", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_dictionary *", + "p_dict" + ] + ] + }, + { + "name": "godot_variant_new_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_array *", + "p_arr" + ] + ] + }, + { + "name": "godot_variant_new_packed_byte_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_byte_array *", + "p_pba" + ] + ] + }, + { + "name": "godot_variant_new_packed_int32_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_int32_array *", + "p_pia" + ] + ] + }, + { + "name": "godot_variant_new_packed_int64_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_int64_array *", + "p_pia" + ] + ] + }, + { + "name": "godot_variant_new_packed_float32_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_float32_array *", + "p_pra" + ] + ] + }, + { + "name": "godot_variant_new_packed_float64_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_float64_array *", + "p_pra" + ] + ] + }, + { + "name": "godot_variant_new_packed_string_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_string_array *", + "p_psa" + ] + ] + }, + { + "name": "godot_variant_new_packed_vector2_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_vector2_array *", + "p_pv2a" + ] + ] + }, + { + "name": "godot_variant_new_packed_vector3_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_vector3_array *", + "p_pv3a" + ] + ] + }, + { + "name": "godot_variant_new_packed_color_array", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "r_dest" + ], + [ + "const godot_packed_color_array *", + "p_pca" + ] + ] + }, + { + "name": "godot_variant_as_bool", + "return_type": "godot_bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_int", + "return_type": "int64_t", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_float", + "return_type": "double", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_string", + "return_type": "godot_string", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_string_name", + "return_type": "godot_string_name", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_vector2", + "return_type": "godot_vector2", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_vector2i", + "return_type": "godot_vector2i", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_rect2", + "return_type": "godot_rect2", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_rect2i", + "return_type": "godot_rect2i", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_vector3", + "return_type": "godot_vector3", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_vector3i", + "return_type": "godot_vector3i", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_transform2d", + "return_type": "godot_transform2d", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_plane", + "return_type": "godot_plane", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_quaternion", + "return_type": "godot_quaternion", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_aabb", + "return_type": "godot_aabb", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_basis", + "return_type": "godot_basis", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_transform3d", + "return_type": "godot_transform3d", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_color", + "return_type": "godot_color", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_node_path", + "return_type": "godot_node_path", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_rid", + "return_type": "godot_rid", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_object", + "return_type": "godot_object *", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_callable", + "return_type": "godot_callable", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_signal", + "return_type": "godot_signal", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_dictionary", + "return_type": "godot_dictionary", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_array", + "return_type": "godot_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_byte_array", + "return_type": "godot_packed_byte_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_int32_array", + "return_type": "godot_packed_int32_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_int64_array", + "return_type": "godot_packed_int64_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_float32_array", + "return_type": "godot_packed_float32_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_float64_array", + "return_type": "godot_packed_float64_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_string_array", + "return_type": "godot_packed_string_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_vector2_array", + "return_type": "godot_packed_vector2_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_vector3_array", + "return_type": "godot_packed_vector3_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_as_packed_color_array", + "return_type": "godot_packed_color_array", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_call", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const godot_string_name *", + "p_method" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "const godot_int", + "p_argument_count" + ], + [ + "godot_variant *", + "r_return" + ], + [ + "godot_variant_call_error *", + "r_error" + ] + ] + }, + { + "name": "godot_variant_call_with_cstring", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const char *", + "p_method" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "const godot_int", + "p_argument_count" + ], + [ + "godot_variant *", + "r_return" + ], + [ + "godot_variant_call_error *", + "r_error" + ] + ] + }, + { + "name": "godot_variant_evaluate", + "return_type": "void", + "arguments": [ + [ + "godot_variant_operator", + "p_op" + ], + [ + "const godot_variant *", + "p_a" + ], + [ + "const godot_variant *", + "p_b" + ], + [ + "godot_variant *", + "r_return" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_set", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ], + [ + "const godot_variant *", + "p_value" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_set_named", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const godot_string_name *", + "p_key" + ], + [ + "const godot_variant *", + "p_value" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_set_named_with_cstring", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const char *", + "p_key" + ], + [ + "const godot_variant *", + "p_value" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_set_keyed", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ], + [ + "const godot_variant *", + "p_value" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_set_indexed", + "return_type": "void", + "arguments": [ + [ + "godot_variant *", + "p_self" + ], + [ + "godot_int", + "p_index" + ], + [ + "const godot_variant *", + "p_value" + ], + [ + "bool *", + "r_valid" + ], + [ + "bool *", + "r_oob" + ] + ] + }, + { + "name": "godot_variant_get", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_get_named", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const godot_string_name *", + "p_key" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_get_named_with_cstring", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const char *", + "p_key" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_get_keyed", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_get_indexed", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "godot_int", + "p_index" + ], + [ + "bool *", + "r_valid" + ], + [ + "bool *", + "r_oob" + ] + ] + }, + { + "name": "godot_variant_iter_init", + "return_type": "bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "godot_variant *", + "r_iter" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_iter_next", + "return_type": "bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "godot_variant *", + "r_iter" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_iter_get", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "godot_variant *", + "r_iter" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_hash_compare", + "return_type": "godot_bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const godot_variant *", + "p_other" + ] + ] + }, + { + "name": "godot_variant_booleanize", + "return_type": "godot_bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_blend", + "return_type": "void", + "arguments": [ + [ + "const godot_variant *", + "p_a" + ], + [ + "const godot_variant *", + "p_b" + ], + [ + "float", + "p_c" + ], + [ + "godot_variant *", + "r_dst" + ] + ] + }, + { + "name": "godot_variant_interpolate", + "return_type": "void", + "arguments": [ + [ + "const godot_variant *", + "p_a" + ], + [ + "const godot_variant *", + "p_b" + ], + [ + "float", + "p_c" + ], + [ + "godot_variant *", + "r_dst" + ] + ] + }, + { + "name": "godot_variant_duplicate", + "return_type": "godot_variant", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "godot_bool", + "p_deep" + ] + ] + }, + { + "name": "godot_variant_stringify", + "return_type": "godot_string", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_get_validated_operator_evaluator", + "return_type": "godot_validated_operator_evaluator", + "arguments": [ + [ + "godot_variant_operator", + "p_operator" + ], + [ + "godot_variant_type", + "p_type_a" + ], + [ + "godot_variant_type", + "p_type_b" + ] + ] + }, + { + "name": "godot_variant_get_ptr_operator_evaluator", + "return_type": "godot_ptr_operator_evaluator", + "arguments": [ + [ + "godot_variant_operator", + "p_operator" + ], + [ + "godot_variant_type", + "p_type_a" + ], + [ + "godot_variant_type", + "p_type_b" + ] + ] + }, + { + "name": "godot_variant_get_operator_return_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_operator", + "p_operator" + ], + [ + "godot_variant_type", + "p_type_a" + ], + [ + "godot_variant_type", + "p_type_b" + ] + ] + }, + { + "name": "godot_variant_get_operator_name", + "return_type": "godot_string", + "arguments": [ + [ + "godot_variant_operator", + "p_operator" + ] + ] + }, + { + "name": "godot_variant_has_builtin_method", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_has_builtin_method_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_validated_builtin_method", + "return_type": "godot_validated_builtin_method", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_validated_builtin_method_with_cstring", + "return_type": "godot_validated_builtin_method", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_ptr_builtin_method", + "return_type": "godot_ptr_builtin_method", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_ptr_builtin_method_with_cstring", + "return_type": "godot_ptr_builtin_method", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_argument_count", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_argument_count_with_cstring", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_argument_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_argument_type_with_cstring", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_argument_name", + "return_type": "godot_string", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_argument_name_with_cstring", + "return_type": "godot_string", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_has_builtin_method_return_value", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_has_builtin_method_return_value_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_return_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_return_type_with_cstring", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_const", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_const_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_static", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_static_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_vararg", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_is_builtin_method_vararg_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_count", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_builtin_method_list", + "return_type": "void", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "godot_string_name *", + "r_list" + ] + ] + }, + { + "name": "godot_variant_get_constructor_count", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_validated_constructor", + "return_type": "godot_validated_constructor", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "int", + "p_constructor" + ] + ] + }, + { + "name": "godot_variant_get_ptr_constructor", + "return_type": "godot_ptr_constructor", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "int", + "p_constructor" + ] + ] + }, + { + "name": "godot_variant_get_constructor_argument_count", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "int", + "p_constructor" + ] + ] + }, + { + "name": "godot_variant_get_constructor_argument_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "int", + "p_constructor" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_constructor_argument_name", + "return_type": "godot_string", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "int", + "p_constructor" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_construct", + "return_type": "void", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "godot_variant *", + "p_base" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "int", + "p_argument_count" + ], + [ + "godot_variant_call_error *", + "r_error" + ] + ] + }, + { + "name": "godot_variant_get_member_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_member_type_with_cstring", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_member_count", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_member_list", + "return_type": "void", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "godot_string_name *", + "r_list" + ] + ] + }, + { + "name": "godot_variant_get_validated_setter", + "return_type": "godot_validated_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_validated_setter_with_cstring", + "return_type": "godot_validated_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_validated_getter", + "return_type": "godot_validated_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_validated_getter_with_cstring", + "return_type": "godot_validated_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_ptr_setter", + "return_type": "godot_ptr_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_ptr_setter_with_cstring", + "return_type": "godot_ptr_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_ptr_getter", + "return_type": "godot_ptr_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_get_ptr_getter_with_cstring", + "return_type": "godot_ptr_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_has_indexing", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_indexed_element_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_validated_indexed_setter", + "return_type": "godot_validated_indexed_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_validated_indexed_getter", + "return_type": "godot_validated_indexed_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_ptr_indexed_setter", + "return_type": "godot_ptr_indexed_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_ptr_indexed_getter", + "return_type": "godot_ptr_indexed_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_indexed_size", + "return_type": "uint64_t", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_is_keyed", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_validated_keyed_setter", + "return_type": "godot_validated_keyed_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_validated_keyed_getter", + "return_type": "godot_validated_keyed_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_validated_keyed_checker", + "return_type": "godot_validated_keyed_checker", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_ptr_keyed_setter", + "return_type": "godot_ptr_keyed_setter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_ptr_keyed_getter", + "return_type": "godot_ptr_keyed_getter", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_ptr_keyed_checker", + "return_type": "godot_ptr_keyed_checker", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_constants_count", + "return_type": "int", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_get_constants_list", + "return_type": "void", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "godot_string_name *", + "r_list" + ] + ] + }, + { + "name": "godot_variant_has_constant", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_constant" + ] + ] + }, + { + "name": "godot_variant_has_constant_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_constant" + ] + ] + }, + { + "name": "godot_variant_get_constant_value", + "return_type": "godot_variant", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_constant" + ] + ] + }, + { + "name": "godot_variant_get_constant_value_with_cstring", + "return_type": "godot_variant", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const char *", + "p_constant" + ] + ] + }, + { + "name": "godot_variant_has_utility_function", + "return_type": "bool", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_has_utility_function_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_call_utility_function", + "return_type": "void", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ], + [ + "godot_variant *", + "r_ret" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "int", + "p_argument_count" + ], + [ + "godot_variant_call_error *", + "r_error" + ] + ] + }, + { + "name": "godot_variant_call_utility_function_with_cstring", + "return_type": "void", + "arguments": [ + [ + "const char *", + "p_function" + ], + [ + "godot_variant *", + "r_ret" + ], + [ + "const godot_variant **", + "p_args" + ], + [ + "int", + "p_argument_count" + ], + [ + "godot_variant_call_error *", + "r_error" + ] + ] + }, + { + "name": "godot_variant_get_ptr_utility_function", + "return_type": "godot_ptr_utility_function", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_ptr_utility_function_with_cstring", + "return_type": "godot_ptr_utility_function", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_validated_utility_function", + "return_type": "godot_validated_utility_function", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_validated_utility_function_with_cstring", + "return_type": "godot_validated_utility_function", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_type", + "return_type": "godot_variant_utility_function_type", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_type_with_cstring", + "return_type": "godot_variant_utility_function_type", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_argument_count", + "return_type": "int", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_argument_count_with_cstring", + "return_type": "int", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_argument_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_argument_type_with_cstring", + "return_type": "godot_variant_type", + "arguments": [ + [ + "const char *", + "p_function" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_argument_name", + "return_type": "godot_string", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_argument_name_with_cstring", + "return_type": "godot_string", + "arguments": [ + [ + "const char *", + "p_function" + ], + [ + "int", + "p_argument" + ] + ] + }, + { + "name": "godot_variant_has_utility_function_return_value", + "return_type": "bool", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_has_utility_function_return_value_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_return_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_return_type_with_cstring", + "return_type": "godot_variant_type", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_is_utility_function_vararg", + "return_type": "bool", + "arguments": [ + [ + "const godot_string_name *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_is_utility_function_vararg_with_cstring", + "return_type": "bool", + "arguments": [ + [ + "const char *", + "p_function" + ] + ] + }, + { + "name": "godot_variant_get_utility_function_count", + "return_type": "int", + "arguments": [] + }, + { + "name": "godot_variant_get_utility_function_list", + "return_type": "void", + "arguments": [ + [ + "godot_string_name *", + "r_functions" + ] + ] + }, + { + "name": "godot_variant_get_type", + "return_type": "godot_variant_type", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ] + ] + }, + { + "name": "godot_variant_has_method", + "return_type": "bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const godot_string_name *", + "p_method" + ] + ] + }, + { + "name": "godot_variant_has_member", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ], + [ + "const godot_string_name *", + "p_member" + ] + ] + }, + { + "name": "godot_variant_has_key", + "return_type": "bool", + "arguments": [ + [ + "const godot_variant *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ], + [ + "bool *", + "r_valid" + ] + ] + }, + { + "name": "godot_variant_get_type_name", + "return_type": "godot_string", + "arguments": [ + [ + "godot_variant_type", + "p_type" + ] + ] + }, + { + "name": "godot_variant_can_convert", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_from" + ], + [ + "godot_variant_type", + "p_to" + ] + ] + }, + { + "name": "godot_variant_can_convert_strict", + "return_type": "bool", + "arguments": [ + [ + "godot_variant_type", + "p_from" + ], + [ + "godot_variant_type", + "p_to" + ] + ] + }, + { + "name": "godot_aabb_new", + "return_type": "void", + "arguments": [ + [ + "godot_aabb *", + "p_self" + ] + ] + }, + { + "name": "godot_aabb_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_aabb *", + "r_dest" + ], + [ + "const godot_aabb *", + "p_src" + ] + ] + }, + { + "name": "godot_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_array *", + "p_self" + ] + ] + }, + { + "name": "godot_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_array *", + "r_dest" + ], + [ + "const godot_array *", + "p_src" + ] + ] + }, + { + "name": "godot_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_array *", + "p_self" + ] + ] + }, + { + "name": "godot_array_operator_index", + "return_type": "godot_variant *", + "arguments": [ + [ + "godot_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_array_operator_index_const", + "return_type": "const godot_variant *", + "arguments": [ + [ + "const godot_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_basis_new", + "return_type": "void", + "arguments": [ + [ + "godot_basis *", + "p_self" + ] + ] + }, + { + "name": "godot_basis_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_basis *", + "r_dest" + ], + [ + "const godot_basis *", + "p_src" + ] + ] + }, + { + "name": "godot_basis_operator_index", + "return_type": "godot_vector3 *", + "arguments": [ + [ + "godot_basis *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_basis_operator_index_const", + "return_type": "const godot_vector3 *", + "arguments": [ + [ + "const godot_basis *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_callable_new", + "return_type": "void", + "arguments": [ + [ + "godot_callable *", + "p_self" + ] + ] + }, + { + "name": "godot_callable_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_callable *", + "r_dest" + ], + [ + "const godot_callable *", + "p_src" + ] + ] + }, + { + "name": "godot_callable_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_callable *", + "p_self" + ] + ] + }, + { + "name": "godot_color_new", + "return_type": "void", + "arguments": [ + [ + "godot_color *", + "p_self" + ] + ] + }, + { + "name": "godot_color_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_color *", + "r_dest" + ], + [ + "const godot_color *", + "p_src" + ] + ] + }, + { + "name": "godot_color_operator_index", + "return_type": "float *", + "arguments": [ + [ + "godot_color *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_color_operator_index_const", + "return_type": "const float *", + "arguments": [ + [ + "const godot_color *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_dictionary_new", + "return_type": "void", + "arguments": [ + [ + "godot_dictionary *", + "p_self" + ] + ] + }, + { + "name": "godot_dictionary_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_dictionary *", + "r_dest" + ], + [ + "const godot_dictionary *", + "p_src" + ] + ] + }, + { + "name": "godot_dictionary_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_dictionary *", + "p_self" + ] + ] + }, + { + "name": "godot_dictionary_operator_index", + "return_type": "godot_variant *", + "arguments": [ + [ + "godot_dictionary *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ] + ] + }, + { + "name": "godot_dictionary_operator_index_const", + "return_type": "const godot_variant *", + "arguments": [ + [ + "const godot_dictionary *", + "p_self" + ], + [ + "const godot_variant *", + "p_key" + ] + ] + }, + { + "name": "godot_node_path_new", + "return_type": "void", + "arguments": [ + [ + "godot_node_path *", + "p_self" + ] + ] + }, + { + "name": "godot_node_path_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_node_path *", + "r_dest" + ], + [ + "const godot_node_path *", + "p_src" + ] + ] + }, + { + "name": "godot_node_path_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_node_path *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_byte_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_byte_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_byte_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_byte_array *", + "r_dest" + ], + [ + "const godot_packed_byte_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_byte_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_byte_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_byte_array_operator_index", + "return_type": "uint8_t *", + "arguments": [ + [ + "godot_packed_byte_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_byte_array_operator_index_const", + "return_type": "const uint8_t *", + "arguments": [ + [ + "const godot_packed_byte_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_int32_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int32_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_int32_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int32_array *", + "r_dest" + ], + [ + "const godot_packed_int32_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_int32_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int32_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_int32_array_operator_index", + "return_type": "int32_t *", + "arguments": [ + [ + "godot_packed_int32_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_int32_array_operator_index_const", + "return_type": "const int32_t *", + "arguments": [ + [ + "const godot_packed_int32_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_int64_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int64_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_int64_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int64_array *", + "r_dest" + ], + [ + "const godot_packed_int64_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_int64_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_int64_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_int64_array_operator_index", + "return_type": "int64_t *", + "arguments": [ + [ + "godot_packed_int64_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_int64_array_operator_index_const", + "return_type": "const int64_t *", + "arguments": [ + [ + "const godot_packed_int64_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_float32_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float32_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_float32_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float32_array *", + "r_dest" + ], + [ + "const godot_packed_float32_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_float32_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float32_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_float32_array_operator_index", + "return_type": "float *", + "arguments": [ + [ + "godot_packed_float32_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_float32_array_operator_index_const", + "return_type": "const float *", + "arguments": [ + [ + "const godot_packed_float32_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_float64_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float64_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_float64_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float64_array *", + "r_dest" + ], + [ + "const godot_packed_float64_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_float64_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_float64_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_float64_array_operator_index", + "return_type": "double *", + "arguments": [ + [ + "godot_packed_float64_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_float64_array_operator_index_const", + "return_type": "const double *", + "arguments": [ + [ + "const godot_packed_float64_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_string_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_string_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_string_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_string_array *", + "r_dest" + ], + [ + "const godot_packed_string_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_string_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_string_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_string_array_operator_index", + "return_type": "godot_string *", + "arguments": [ + [ + "godot_packed_string_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_string_array_operator_index_const", + "return_type": "const godot_string *", + "arguments": [ + [ + "const godot_packed_string_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector2_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector2_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2_array *", + "r_dest" + ], + [ + "const godot_packed_vector2_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_vector2_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector2_array_operator_index", + "return_type": "godot_vector2 *", + "arguments": [ + [ + "godot_packed_vector2_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector2_array_operator_index_const", + "return_type": "const godot_vector2 *", + "arguments": [ + [ + "const godot_packed_vector2_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector2i_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2i_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector2i_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2i_array *", + "r_dest" + ], + [ + "const godot_packed_vector2i_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_vector2i_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector2i_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector2i_array_operator_index", + "return_type": "godot_vector2i *", + "arguments": [ + [ + "godot_packed_vector2i_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector2i_array_operator_index_const", + "return_type": "const godot_vector2i *", + "arguments": [ + [ + "const godot_packed_vector2i_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector3_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector3_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3_array *", + "r_dest" + ], + [ + "const godot_packed_vector3_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_vector3_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector3_array_operator_index", + "return_type": "godot_vector3 *", + "arguments": [ + [ + "godot_packed_vector3_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector3_array_operator_index_const", + "return_type": "const godot_vector3 *", + "arguments": [ + [ + "const godot_packed_vector3_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector3i_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3i_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector3i_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3i_array *", + "r_dest" + ], + [ + "const godot_packed_vector3i_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_vector3i_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_vector3i_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_vector3i_array_operator_index", + "return_type": "godot_vector3i *", + "arguments": [ + [ + "godot_packed_vector3i_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_vector3i_array_operator_index_const", + "return_type": "const godot_vector3i *", + "arguments": [ + [ + "const godot_packed_vector3i_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_color_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_color_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_color_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_color_array *", + "r_dest" + ], + [ + "const godot_packed_color_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_color_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_color_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_color_array_operator_index", + "return_type": "godot_color *", + "arguments": [ + [ + "godot_packed_color_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_color_array_operator_index_const", + "return_type": "const godot_color *", + "arguments": [ + [ + "const godot_packed_color_array *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_plane_new", + "return_type": "void", + "arguments": [ + [ + "godot_plane *", + "p_self" + ] + ] + }, + { + "name": "godot_plane_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_plane *", + "r_dest" + ], + [ + "const godot_plane *", + "p_src" + ] + ] + }, + { + "name": "godot_quaternion_new", + "return_type": "void", + "arguments": [ + [ + "godot_quaternion *", + "p_self" + ] + ] + }, + { + "name": "godot_quaternion_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_quaternion *", + "r_dest" + ], + [ + "const godot_quaternion *", + "p_src" + ] + ] + }, + { + "name": "godot_quaternion_operator_index", + "return_type": "godot_real_t *", + "arguments": [ + [ + "godot_quaternion *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_quaternion_operator_index_const", + "return_type": "const godot_real_t *", + "arguments": [ + [ + "const godot_quaternion *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_rect2_new", + "return_type": "void", + "arguments": [ + [ + "godot_rect2 *", + "p_self" + ] + ] + }, + { + "name": "godot_rect2_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_rect2 *", + "r_dest" + ], + [ + "const godot_rect2 *", + "p_src" + ] + ] + }, + { + "name": "godot_rect2i_new", + "return_type": "void", + "arguments": [ + [ + "godot_rect2i *", + "p_self" + ] + ] + }, + { + "name": "godot_rect2i_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_rect2i *", + "r_dest" + ], + [ + "const godot_rect2i *", + "p_src" + ] + ] + }, + { + "name": "godot_rid_new", + "return_type": "void", + "arguments": [ + [ + "godot_rid *", + "p_self" + ] + ] + }, + { + "name": "godot_rid_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_rid *", + "r_dest" + ], + [ + "const godot_rid *", + "p_src" + ] + ] + }, + { + "name": "godot_signal_new", + "return_type": "void", + "arguments": [ + [ + "godot_signal *", + "p_self" + ] + ] + }, + { + "name": "godot_signal_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_signal *", + "r_dest" + ], + [ + "const godot_signal *", + "p_src" + ] + ] + }, + { + "name": "godot_signal_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_signal *", + "p_self" + ] + ] + }, + { + "name": "godot_string_new", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ] + ] + }, + { + "name": "godot_string_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const godot_string *", + "p_src" + ] + ] + }, + { + "name": "godot_string_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_new_with_latin1_chars", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char *", + "p_contents" + ] + ] + }, + { + "name": "godot_string_new_with_utf8_chars", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char *", + "p_contents" + ] + ] + }, + { + "name": "godot_string_new_with_utf16_chars", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char16_t *", + "p_contents" + ] + ] + }, + { + "name": "godot_string_new_with_utf32_chars", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char32_t *", + "p_contents" + ] + ] + }, + { + "name": "godot_string_new_with_wide_chars", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const wchar_t *", + "p_contents" + ] + ] + }, + { + "name": "godot_string_new_with_latin1_chars_and_len", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char *", + "p_contents" + ], + [ + "const int", + "p_size" + ] + ] + }, + { + "name": "godot_string_new_with_utf8_chars_and_len", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char *", + "p_contents" + ], + [ + "const int", + "p_size" + ] + ] + }, + { + "name": "godot_string_new_with_utf16_chars_and_len", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char16_t *", + "p_contents" + ], + [ + "const int", + "p_size" + ] + ] + }, + { + "name": "godot_string_new_with_utf32_chars_and_len", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const char32_t *", + "p_contents" + ], + [ + "const int", + "p_size" + ] + ] + }, + { + "name": "godot_string_new_with_wide_chars_and_len", + "return_type": "void", + "arguments": [ + [ + "godot_string *", + "r_dest" + ], + [ + "const wchar_t *", + "p_contents" + ], + [ + "const int", + "p_size" + ] + ] + }, + { + "name": "godot_string_to_latin1_chars", + "return_type": "const char *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_utf8_chars", + "return_type": "const char *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_utf16_chars", + "return_type": "const char16_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_utf32_chars", + "return_type": "const char32_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_to_wide_chars", + "return_type": "const wchar_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ] + ] + }, + { + "name": "godot_string_operator_index", + "return_type": "char32_t *", + "arguments": [ + [ + "godot_string *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_string_operator_index_const", + "return_type": "const char32_t *", + "arguments": [ + [ + "const godot_string *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_string_name_new", + "return_type": "void", + "arguments": [ + [ + "godot_string_name *", + "r_dest" + ] + ] + }, + { + "name": "godot_string_name_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_string_name *", + "r_dest" + ], + [ + "const godot_string_name *", + "p_src" + ] + ] + }, + { + "name": "godot_string_name_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_string_name *", + "p_self" + ] + ] + }, + { + "name": "godot_string_name_new_with_latin1_chars", + "return_type": "void", + "arguments": [ + [ + "godot_string_name *", + "r_dest" + ], + [ + "const char *", + "p_contents" + ] + ] + }, + { + "name": "godot_transform3d_new", + "return_type": "void", + "arguments": [ + [ + "godot_transform3d *", + "r_dest" + ] + ] + }, + { + "name": "godot_transform3d_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_transform3d *", + "r_dest" + ], + [ + "const godot_transform3d *", + "p_src" + ] + ] + }, + { + "name": "godot_transform2d_new", + "return_type": "void", + "arguments": [ + [ + "godot_transform2d *", + "r_dest" + ] + ] + }, + { + "name": "godot_transform2d_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_transform2d *", + "r_dest" + ], + [ + "const godot_transform2d *", + "p_src" + ] + ] + }, + { + "name": "godot_transform2d_operator_index", + "return_type": "godot_vector2 *", + "arguments": [ + [ + "godot_transform2d *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_transform2d_operator_index_const", + "return_type": "const godot_vector2 *", + "arguments": [ + [ + "const godot_transform2d *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector2_new", + "return_type": "void", + "arguments": [ + [ + "godot_vector2 *", + "r_dest" + ] + ] + }, + { + "name": "godot_vector2_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector2 *", + "r_dest" + ], + [ + "const godot_vector2 *", + "p_src" + ] + ] + }, + { + "name": "godot_vector2_operator_index", + "return_type": "godot_real_t *", + "arguments": [ + [ + "godot_vector2 *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector2_operator_index_const", + "return_type": "const godot_real_t *", + "arguments": [ + [ + "const godot_vector2 *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector2i_new", + "return_type": "void", + "arguments": [ + [ + "godot_vector2i *", + "r_dest" + ] + ] + }, + { + "name": "godot_vector2i_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector2i *", + "r_dest" + ], + [ + "const godot_vector2i *", + "p_src" + ] + ] + }, + { + "name": "godot_vector2i_operator_index", + "return_type": "int32_t *", + "arguments": [ + [ + "godot_vector2i *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector2i_operator_index_const", + "return_type": "const int32_t *", + "arguments": [ + [ + "const godot_vector2i *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector3_new", + "return_type": "void", + "arguments": [ + [ + "godot_vector3 *", + "r_dest" + ] + ] + }, + { + "name": "godot_vector3_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector3 *", + "r_dest" + ], + [ + "const godot_vector3 *", + "p_src" + ] + ] + }, + { + "name": "godot_vector3_operator_index", + "return_type": "godot_real_t *", + "arguments": [ + [ + "godot_vector3 *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector3_operator_index_const", + "return_type": "const godot_real_t *", + "arguments": [ + [ + "const godot_vector3 *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector3i_new", + "return_type": "void", + "arguments": [ + [ + "godot_vector3i *", + "r_dest" + ] + ] + }, + { + "name": "godot_vector3i_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_vector3i *", + "r_dest" + ], + [ + "const godot_vector3i *", + "p_src" + ] + ] + }, + { + "name": "godot_vector3i_operator_index", + "return_type": "int32_t *", + "arguments": [ + [ + "godot_vector3i *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_vector3i_operator_index_const", + "return_type": "const int32_t *", + "arguments": [ + [ + "const godot_vector3i *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + } + ] + }, + "extensions": [ + { + "name": "nativescript", + "type": "NATIVESCRIPT", + "version": { + "major": 4, + "minor": 0 + }, + "next": null, + "api": [ + { + "name": "godot_nativescript_register_class", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_base" + ], + [ + "godot_nativescript_instance_create_func", + "p_create_func" + ], + [ + "godot_nativescript_instance_destroy_func", + "p_destroy_func" + ] + ] + }, + { + "name": "godot_nativescript_register_tool_class", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_base" + ], + [ + "godot_nativescript_instance_create_func", + "p_create_func" + ], + [ + "godot_nativescript_instance_destroy_func", + "p_destroy_func" + ] + ] + }, + { + "name": "godot_nativescript_register_method", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_function_name" + ], + [ + "godot_nativescript_method_attributes", + "p_attr" + ], + [ + "godot_nativescript_instance_method", + "p_method" + ] + ] + }, + { + "name": "godot_nativescript_set_method_argument_information", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_function_name" + ], + [ + "int", + "p_num_args" + ], + [ + "const godot_nativescript_method_argument *", + "p_args" + ] + ] + }, + { + "name": "godot_nativescript_register_property", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_path" + ], + [ + "godot_nativescript_property_attributes *", + "p_attr" + ], + [ + "godot_nativescript_property_set_func", + "p_set_func" + ], + [ + "godot_nativescript_property_get_func", + "p_get_func" + ] + ] + }, + { + "name": "godot_nativescript_register_signal", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const godot_nativescript_signal *", + "p_signal" + ] + ] + }, + { + "name": "godot_nativescript_get_userdata", + "return_type": "void *", + "arguments": [ + [ + "godot_object *", + "p_instance" + ] + ] + }, + { + "name": "godot_nativescript_set_class_documentation", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "godot_string", + "p_documentation" + ] + ] + }, + { + "name": "godot_nativescript_set_method_documentation", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_function_name" + ], + [ + "godot_string", + "p_documentation" + ] + ] + }, + { + "name": "godot_nativescript_set_property_documentation", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_path" + ], + [ + "godot_string", + "p_documentation" + ] + ] + }, + { + "name": "godot_nativescript_set_signal_documentation", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const char *", + "p_signal_name" + ], + [ + "godot_string", + "p_documentation" + ] + ] + }, + { + "name": "godot_nativescript_set_global_type_tag", + "return_type": "void", + "arguments": [ + [ + "int", + "p_idx" + ], + [ + "const char *", + "p_name" + ], + [ + "const void *", + "p_type_tag" + ] + ] + }, + { + "name": "godot_nativescript_get_global_type_tag", + "return_type": "const void *", + "arguments": [ + [ + "int", + "p_idx" + ], + [ + "const char *", + "p_name" + ] + ] + }, + { + "name": "godot_nativescript_set_type_tag", + "return_type": "void", + "arguments": [ + [ + "void *", + "p_gdnative_handle" + ], + [ + "const char *", + "p_name" + ], + [ + "const void *", + "p_type_tag" + ] + ] + }, + { + "name": "godot_nativescript_get_type_tag", + "return_type": "const void *", + "arguments": [ + [ + "const godot_object *", + "p_object" + ] + ] + }, + { + "name": "godot_nativescript_register_instance_binding_data_functions", + "return_type": "int", + "arguments": [ + [ + "godot_nativescript_instance_binding_functions", + "p_binding_functions" + ] + ] + }, + { + "name": "godot_nativescript_unregister_instance_binding_data_functions", + "return_type": "void", + "arguments": [ + [ + "int", + "p_idx" + ] + ] + }, + { + "name": "godot_nativescript_get_instance_binding_data", + "return_type": "void *", + "arguments": [ + [ + "int", + "p_idx" + ], + [ + "godot_object *", + "p_object" + ] + ] + }, + { + "name": "godot_nativescript_profiling_add_data", + "return_type": "void", + "arguments": [ + [ + "const char *", + "p_signature" + ], + [ + "uint64_t", + "p_line" + ] + ] + } + ] + }, + { + "name": "pluginscript", + "type": "PLUGINSCRIPT", + "version": { + "major": 1, + "minor": 0 + }, + "next": null, + "api": [ + { + "name": "godot_pluginscript_register_language", + "return_type": "void", + "arguments": [ + [ + "const godot_pluginscript_language_desc *", + "language_desc" + ] + ] + } + ] + }, + { + "name": "android", + "type": "ANDROID", + "version": { + "major": 1, + "minor": 1 + }, + "next": null, + "api": [ + { + "name": "godot_android_get_env", + "return_type": "JNIEnv*", + "arguments": [] + }, + { + "name": "godot_android_get_activity", + "return_type": "jobject", + "arguments": [] + }, + { + "name": "godot_android_get_surface", + "return_type": "jobject", + "arguments": [] + }, + { + "name": "godot_android_is_activity_resumed", + "return_type": "bool", + "arguments": [] + } + ] + }, + { + "name": "videodecoder", + "type": "VIDEODECODER", + "version": { + "major": 0, + "minor": 1 + }, + "next": null, + "api": [ + { + "name": "godot_videodecoder_file_read", + "return_type": "godot_int", + "arguments": [ + [ + "void *", + "file_ptr" + ], + [ + "uint8_t *", + "buf" + ], + [ + "int", + "buf_size" + ] + ] + }, + { + "name": "godot_videodecoder_file_seek", + "return_type": "int64_t", + "arguments": [ + [ + "void *", + "file_ptr" + ], + [ + "int64_t", + "pos" + ], + [ + "int", + "whence" + ] + ] + }, + { + "name": "godot_videodecoder_register_decoder", + "return_type": "void", + "arguments": [ + [ + "const godot_videodecoder_interface_gdnative *", + "p_interface" + ] + ] + } + ] + }, + { + "name": "net", + "type": "NET", + "version": { + "major": 4, + "minor": 0 + }, + "next": null, + "api": [ + { + "name": "godot_net_bind_stream_peer", + "return_type": "void", + "arguments": [ + [ + "godot_object *", + "p_obj" + ], + [ + "const godot_net_stream_peer *", + "p_interface" + ] + ] + }, + { + "name": "godot_net_bind_packet_peer", + "return_type": "void", + "arguments": [ + [ + "godot_object *", + "p_obj" + ], + [ + "const godot_net_packet_peer *", + "p_interface" + ] + ] + }, + { + "name": "godot_net_bind_multiplayer_peer", + "return_type": "void", + "arguments": [ + [ + "godot_object *", + "p_obj" + ], + [ + "const godot_net_multiplayer_peer *", + "p_interface" + ] + ] + }, + { + "name": "godot_net_set_webrtc_library", + "return_type": "godot_error", + "arguments": [ + [ + "const godot_net_webrtc_library *", + "p_library" + ] + ] + }, + { + "name": "godot_net_bind_webrtc_peer_connection", + "return_type": "void", + "arguments": [ + [ + "godot_object *", + "p_obj" + ], + [ + "const godot_net_webrtc_peer_connection *", + "p_interface" + ] + ] + }, + { + "name": "godot_net_bind_webrtc_data_channel", + "return_type": "void", + "arguments": [ + [ + "godot_object *", + "p_obj" + ], + [ + "const godot_net_webrtc_data_channel *", + "p_interface" + ] + ] + } + ] + }, + { + "name": "text", + "type": "TEXT", + "version": { + "major": 1, + "minor": 0 + }, + "next": null, + "api": [ + { + "name": "godot_text_register_interface", + "return_type": "void", + "arguments": [ + [ + "const godot_text_interface_gdnative *", + "p_interface" + ], + [ + "const godot_string *", + "p_name" + ], + [ + "uint32_t", + "p_features" + ] + ] + }, + { + "name": "godot_glyph_new", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "r_dest" + ] + ] + }, + { + "name": "godot_glyph_get_range", + "return_type": "godot_vector2i", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_range", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "const godot_vector2i *", + "p_range" + ] + ] + }, + { + "name": "godot_glyph_get_count", + "return_type": "godot_int", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_count", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_int", + "p_count" + ] + ] + }, + { + "name": "godot_glyph_get_repeat", + "return_type": "godot_int", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_repeat", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_int", + "p_repeat" + ] + ] + }, + { + "name": "godot_glyph_get_flags", + "return_type": "godot_int", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_flags", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_int", + "p_flags" + ] + ] + }, + { + "name": "godot_glyph_get_offset", + "return_type": "godot_vector2", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_offset", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "const godot_vector2 *", + "p_offset" + ] + ] + }, + { + "name": "godot_glyph_get_advance", + "return_type": "godot_real_t", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_advance", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_real_t", + "p_advance" + ] + ] + }, + { + "name": "godot_glyph_get_font", + "return_type": "godot_rid", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_font", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_rid *", + "p_font" + ] + ] + }, + { + "name": "godot_glyph_get_font_size", + "return_type": "godot_int", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_font_size", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_int", + "p_size" + ] + ] + }, + { + "name": "godot_glyph_get_index", + "return_type": "godot_int", + "arguments": [ + [ + "const godot_glyph *", + "p_self" + ] + ] + }, + { + "name": "godot_glyph_set_index", + "return_type": "void", + "arguments": [ + [ + "godot_glyph *", + "p_self" + ], + [ + "godot_int", + "p_index" + ] + ] + }, + { + "name": "godot_packed_glyph_array_new", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "r_dest" + ] + ] + }, + { + "name": "godot_packed_glyph_array_new_copy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "r_dest" + ], + [ + "const godot_packed_glyph_array *", + "p_src" + ] + ] + }, + { + "name": "godot_packed_glyph_array_is_empty", + "return_type": "godot_bool", + "arguments": [ + [ + "const godot_packed_glyph_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_glyph_array_append", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_glyph *", + "p_data" + ] + ] + }, + { + "name": "godot_packed_glyph_array_append_array", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_packed_glyph_array *", + "p_array" + ] + ] + }, + { + "name": "godot_packed_glyph_array_insert", + "return_type": "godot_error", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_int", + "p_idx" + ], + [ + "const godot_glyph *", + "p_data" + ] + ] + }, + { + "name": "godot_packed_glyph_array_has", + "return_type": "godot_bool", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_glyph *", + "p_value" + ] + ] + }, + { + "name": "godot_packed_glyph_array_sort", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_glyph_array_reverse", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_glyph_array_push_back", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_glyph *", + "p_data" + ] + ] + }, + { + "name": "godot_packed_glyph_array_remove", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_int", + "p_idx" + ] + ] + }, + { + "name": "godot_packed_glyph_array_resize", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_int", + "p_size" + ] + ] + }, + { + "name": "godot_packed_glyph_array_ptr", + "return_type": "const godot_glyph *", + "arguments": [ + [ + "const godot_packed_glyph_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_glyph_array_ptrw", + "return_type": "godot_glyph *", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_glyph_array_set", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_int", + "p_idx" + ], + [ + "const godot_glyph *", + "p_data" + ] + ] + }, + { + "name": "godot_packed_glyph_array_get", + "return_type": "godot_glyph", + "arguments": [ + [ + "const godot_packed_glyph_array *", + "p_self" + ], + [ + "const godot_int", + "p_idx" + ] + ] + }, + { + "name": "godot_packed_glyph_array_size", + "return_type": "godot_int", + "arguments": [ + [ + "const godot_packed_glyph_array *", + "p_self" + ] + ] + }, + { + "name": "godot_packed_glyph_array_destroy", + "return_type": "void", + "arguments": [ + [ + "godot_packed_glyph_array *", + "p_self" + ] + ] + } + ] + } + ] } diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py index 28e4957b2f..181fd71b82 100644 --- a/modules/gdnative/gdnative_builders.py +++ b/modules/gdnative/gdnative_builders.py @@ -19,11 +19,11 @@ def _build_gdnative_api_struct_header(api): "", "#include <gdnative/gdnative.h>", "#include <android/godot_android.h>", - "#include <xr/godot_xr.h>", "#include <nativescript/godot_nativescript.h>", "#include <net/godot_net.h>", "#include <pluginscript/godot_pluginscript.h>", "#include <videodecoder/godot_videodecoder.h>", + "#include <text/godot_text.h>", "", "#ifdef __cplusplus", 'extern "C" {', diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp index f0f095ddf5..f965bcd014 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ b/modules/gdnative/gdnative_library_editor_plugin.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -65,7 +65,7 @@ void GDNativeLibraryEditor::_update_tree() { continue; } Map<String, NativePlatformConfig>::Element *E = platforms.find(filter_list->get_item_metadata(i)); - if (!text.empty()) { + if (!text.is_empty()) { text += ", "; } text += E->get().name; @@ -74,9 +74,9 @@ void GDNativeLibraryEditor::_update_tree() { platform->set_text(0, E->get().name); platform->set_metadata(0, E->get().library_extension); - platform->set_custom_bg_color(0, get_theme_color("prop_category", "Editor")); - platform->set_custom_bg_color(1, get_theme_color("prop_category", "Editor")); - platform->set_custom_bg_color(2, get_theme_color("prop_category", "Editor")); + platform->set_custom_bg_color(0, get_theme_color(SNAME("prop_category"), SNAME("Editor"))); + platform->set_custom_bg_color(1, get_theme_color(SNAME("prop_category"), SNAME("Editor"))); + platform->set_custom_bg_color(2, get_theme_color(SNAME("prop_category"), SNAME("Editor"))); platform->set_selectable(0, false); platform->set_expand_right(0, true); @@ -87,31 +87,31 @@ void GDNativeLibraryEditor::_update_tree() { bit->set_text(0, it->get()); bit->set_metadata(0, target); bit->set_selectable(0, false); - bit->set_custom_bg_color(0, get_theme_color("prop_subsection", "Editor")); + bit->set_custom_bg_color(0, get_theme_color(SNAME("prop_subsection"), SNAME("Editor"))); - bit->add_button(1, get_theme_icon("Folder", "EditorIcons"), BUTTON_SELECT_LIBRARY, false, TTR("Select the dynamic library for this entry")); + bit->add_button(1, get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")), BUTTON_SELECT_LIBRARY, false, TTR("Select the dynamic library for this entry")); String file = entry_configs[target].library; - if (!file.empty()) { - bit->add_button(1, get_theme_icon("Clear", "EditorIcons"), BUTTON_CLEAR_LIBRARY, false, TTR("Clear")); + if (!file.is_empty()) { + bit->add_button(1, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), BUTTON_CLEAR_LIBRARY, false, TTR("Clear")); } bit->set_text(1, file); - bit->add_button(2, get_theme_icon("Folder", "EditorIcons"), BUTTON_SELECT_DEPENDENCES, false, TTR("Select dependencies of the library for this entry")); + bit->add_button(2, get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")), BUTTON_SELECT_DEPENDENCES, false, TTR("Select dependencies of the library for this entry")); Array files = entry_configs[target].dependencies; if (files.size()) { - bit->add_button(2, get_theme_icon("Clear", "EditorIcons"), BUTTON_CLEAR_DEPENDENCES, false, TTR("Clear")); + bit->add_button(2, get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")), BUTTON_CLEAR_DEPENDENCES, false, TTR("Clear")); } bit->set_text(2, Variant(files)); - bit->add_button(3, get_theme_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP, false, TTR("Move Up")); - bit->add_button(3, get_theme_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN, false, TTR("Move Down")); - bit->add_button(3, get_theme_icon("Remove", "EditorIcons"), BUTTON_ERASE_ENTRY, false, TTR("Remove current entry")); + bit->add_button(3, get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons")), BUTTON_MOVE_UP, false, TTR("Move Up")); + bit->add_button(3, get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons")), BUTTON_MOVE_DOWN, false, TTR("Move Down")); + bit->add_button(3, get_theme_icon(SNAME("Remove"), SNAME("EditorIcons")), BUTTON_ERASE_ENTRY, false, TTR("Remove current entry")); } TreeItem *new_arch = tree->create_item(platform); new_arch->set_text(0, TTR("Double click to create a new entry")); new_arch->set_text_align(0, TreeItem::ALIGN_CENTER); - new_arch->set_custom_color(0, get_theme_color("accent_color", "Editor")); + new_arch->set_custom_color(0, get_theme_color(SNAME("accent_color"), SNAME("Editor"))); new_arch->set_expand_right(0, true); new_arch->set_metadata(1, E->key()); @@ -131,7 +131,7 @@ void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) { EditorFileDialog::FileMode mode = EditorFileDialog::FILE_MODE_OPEN_FILE; if (id == BUTTON_SELECT_DEPENDENCES) { mode = EditorFileDialog::FILE_MODE_OPEN_FILES; - } else if (treeItem->get_text(0) == "iOS") { + } else if (treeItem->get_text(0) == "iOS" || treeItem->get_text(0) == "macOS") { mode = EditorFileDialog::FILE_MODE_OPEN_ANY; } @@ -195,7 +195,7 @@ void GDNativeLibraryEditor::_on_item_activated() { void GDNativeLibraryEditor::_on_create_new_entry() { String platform = new_architecture_dialog->get_meta("platform"); String entry = new_architecture_input->get_text().strip_edges(); - if (!entry.empty()) { + if (!entry.is_empty()) { platforms[platform].entries.push_back(entry); _update_tree(); } @@ -248,7 +248,7 @@ void GDNativeLibraryEditor::_translate_to_config_file() { for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) { for (List<String>::Element *it = E->value().entries.front(); it; it = it->next()) { String target = E->key() + "." + it->get(); - if (entry_configs[target].library.empty() && entry_configs[target].dependencies.empty()) { + if (entry_configs[target].library.is_empty() && entry_configs[target].dependencies.is_empty()) { continue; } @@ -257,7 +257,7 @@ void GDNativeLibraryEditor::_translate_to_config_file() { } } - library->_change_notify(); + library->notify_property_list_changed(); } } @@ -278,11 +278,10 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { platforms["X11"] = platform_linux; NativePlatformConfig platform_osx; - platform_osx.name = "Mac OSX"; + platform_osx.name = "macOS"; platform_osx.entries.push_back("64"); - platform_osx.entries.push_back("32"); - platform_osx.library_extension = "*.dylib"; - platforms["OSX"] = platform_osx; + platform_osx.library_extension = "*.framework; Framework, *.dylib; Dynamic Library"; + platforms["macOS"] = platform_osx; NativePlatformConfig platform_haiku; platform_haiku.name = "Haiku"; @@ -308,11 +307,11 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { platform_android.library_extension = "*.so"; platforms["Android"] = platform_android; - // TODO: Javascript platform is not supported yet - // NativePlatformConfig platform_html5; - // platform_html5.name = "HTML5"; - // platform_html5.library_extension = "*.wasm"; - // platforms["Javascript"] = platform_html5; + NativePlatformConfig platform_html5; + platform_html5.name = "HTML5"; + platform_html5.entries.push_back("wasm32"); + platform_html5.library_extension = "*.wasm"; + platforms["HTML5"] = platform_html5; NativePlatformConfig platform_ios; platform_ios.name = "iOS"; @@ -327,7 +326,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { VBoxContainer *container = memnew(VBoxContainer); add_child(container); - container->set_anchors_and_margins_preset(PRESET_WIDE); + container->set_anchors_and_offsets_preset(PRESET_WIDE); HBoxContainer *hbox = memnew(HBoxContainer); container->add_child(hbox); @@ -357,12 +356,12 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { tree->set_column_titles_visible(true); tree->set_columns(4); tree->set_column_expand(0, false); - tree->set_column_min_width(0, int(200 * EDSCALE)); + tree->set_column_custom_minimum_width(0, int(200 * EDSCALE)); tree->set_column_title(0, TTR("Platform")); tree->set_column_title(1, TTR("Dynamic Library")); tree->set_column_title(2, TTR("Dependencies")); tree->set_column_expand(3, false); - tree->set_column_min_width(3, int(110 * EDSCALE)); + tree->set_column_custom_minimum_width(3, int(110 * EDSCALE)); tree->connect("button_pressed", callable_mp(this, &GDNativeLibraryEditor::_on_item_button)); tree->connect("item_collapsed", callable_mp(this, &GDNativeLibraryEditor::_on_item_collapsed)); tree->connect("item_activated", callable_mp(this, &GDNativeLibraryEditor::_on_item_activated)); @@ -381,8 +380,8 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() { new_architecture_input = memnew(LineEdit); new_architecture_dialog->add_child(new_architecture_input); // new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE); - new_architecture_input->set_anchors_and_margins_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE); - new_architecture_dialog->get_ok()->connect("pressed", callable_mp(this, &GDNativeLibraryEditor::_on_create_new_entry)); + new_architecture_input->set_anchors_and_offsets_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE); + new_architecture_dialog->get_ok_button()->connect("pressed", callable_mp(this, &GDNativeLibraryEditor::_on_create_new_entry)); } void GDNativeLibraryEditorPlugin::edit(Object *p_node) { diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h index 180ab7707c..61afb1aaaa 100644 --- a/modules/gdnative/gdnative_library_editor_plugin.h +++ b/modules/gdnative/gdnative_library_editor_plugin.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -95,9 +95,9 @@ public: class GDNativeLibraryEditorPlugin : public EditorPlugin { GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin); - GDNativeLibraryEditor *library_editor; - EditorNode *editor; - Button *button; + GDNativeLibraryEditor *library_editor = nullptr; + EditorNode *editor = nullptr; + Button *button = nullptr; public: virtual String get_name() const override { return "GDNativeLibrary"; } diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp index 409b6cbffe..f1b4a9a81b 100644 --- a/modules/gdnative/gdnative_library_singleton_editor.cpp +++ b/modules/gdnative/gdnative_library_singleton_editor.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/gdnative_library_singleton_editor.h b/modules/gdnative/gdnative_library_singleton_editor.h index 1a213d8094..5bb823d920 100644 --- a/modules/gdnative/gdnative_library_singleton_editor.h +++ b/modules/gdnative/gdnative_library_singleton_editor.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/icons/GDNativeLibrary.svg b/modules/gdnative/icons/GDNativeLibrary.svg index b494c7af6e..0ddfd4e6f2 100644 --- a/modules/gdnative/icons/GDNativeLibrary.svg +++ b/modules/gdnative/icons/GDNativeLibrary.svg @@ -1,5 +1 @@ -<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m7 1l-0.56445 2.2578a5 5 0 0 0 -0.68945 0.2793l-1.9883-1.1934-1.4141 1.4141 1.1953 1.9941a5 5 0 0 0 -0.28516 0.68555l-2.2539 0.5625v2l2.2578 0.56445a5 5 0 0 0 0.2793 0.6875l-1.1934 1.9902 1.4141 1.4141 1.9941-1.1953a5 5 0 0 0 0.68555 0.28516l0.5625 2.2539v-5.2695a2 2 0 0 1 -1 -1.7305 2 2 0 0 1 1 -1.7285v-0.27148h1 4.5762a5 5 0 0 0 -0.11328 -0.25195l1.1934-1.9902-1.4141-1.4141-1.9941 1.1953a5 5 0 0 0 -0.68555 -0.28516l-0.5625-2.2539h-2zm2 7v1 5 1h5c0.55228 0 1-0.4477 1-1v-5c0-0.5523-0.44772-1-1-1v4l-1-1-1 1v-4h-3z" fill="#e0e0e0"/> -</g> -</svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1-.56445 2.2578a5 5 0 0 0 -.68945.2793l-1.9883-1.1934-1.4141 1.4141 1.1953 1.9941a5 5 0 0 0 -.28516.68555l-2.2539.5625v2l2.2578.56445a5 5 0 0 0 .2793.6875l-1.1934 1.9902 1.4141 1.4141 1.9941-1.1953a5 5 0 0 0 .68555.28516l.5625 2.2539v-5.2695a2 2 0 0 1 -1-1.7305 2 2 0 0 1 1-1.7285v-.27148h1 4.5762a5 5 0 0 0 -.11328-.25195l1.1934-1.9902-1.4141-1.4141-1.9941 1.1953a5 5 0 0 0 -.68555-.28516l-.5625-2.2539h-2zm2 7v1 5 1h5c.55228 0 1-.4477 1-1v-5c0-.5523-.44772-1-1-1v4l-1-1-1 1v-4z" fill="#e0e0e0"/></svg> diff --git a/modules/gdnative/icons/NativeScript.svg b/modules/gdnative/icons/NativeScript.svg index fb9e135627..2224b36b29 100644 --- a/modules/gdnative/icons/NativeScript.svg +++ b/modules/gdnative/icons/NativeScript.svg @@ -1,5 +1 @@ -<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"> -<g transform="translate(0 -1036.4)"> -<path transform="translate(0 1036.4)" d="m7 1l-0.56445 2.2578a5 5 0 0 0 -0.68945 0.2793l-1.9883-1.1934-1.4141 1.4141 1.1953 1.9941a5 5 0 0 0 -0.28516 0.68555l-2.2539 0.5625h3v1 1h2v-0.95117a2 2 0 0 1 0 -0.048828 2 2 0 0 1 2 -2 2 2 0 0 1 2 2v1h5v-2l-2.2578-0.56445a5 5 0 0 0 -0.2793 -0.6875l1.1934-1.9902-1.4141-1.4141-1.9941 1.1953a5 5 0 0 0 -0.68555 -0.28516l-0.5625-2.2539h-2zm-6 7v4 4h2a3 3 0 0 0 3 -3 3 3 0 0 0 -3 -3v-2h-2zm6 0v2h2v-2h-2zm3 2v6h2v-4a1 1 0 0 1 1 1v3h2v-3a3 3 0 0 0 -3 -3h-2zm-7 2a1 1 0 0 1 1 1 1 1 0 0 1 -1 1v-2zm4 0v4h2v-4h-2z" fill="#e0e0e0"/> -</g> -</svg> +<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m7 1-.56445 2.2578a5 5 0 0 0 -.68945.2793l-1.9883-1.1934-1.4141 1.4141 1.1953 1.9941a5 5 0 0 0 -.28516.68555l-2.2539.5625h3v1 1h2v-.95117a2 2 0 0 1 0-.048828 2 2 0 0 1 2-2 2 2 0 0 1 2 2v1h5v-2l-2.2578-.56445a5 5 0 0 0 -.2793-.6875l1.1934-1.9902-1.4141-1.4141-1.9941 1.1953a5 5 0 0 0 -.68555-.28516l-.5625-2.2539h-2zm-6 7v4 4h2a3 3 0 0 0 3-3 3 3 0 0 0 -3-3v-2zm6 0v2h2v-2zm3 2v6h2v-4a1 1 0 0 1 1 1v3h2v-3a3 3 0 0 0 -3-3zm-7 2a1 1 0 0 1 1 1 1 1 0 0 1 -1 1zm4 0v4h2v-4z" fill="#e0e0e0"/></svg> diff --git a/modules/gdnative/include/android/godot_android.h b/modules/gdnative/include/android/godot_android.h index 45d4eaff37..867ef9e03a 100644 --- a/modules/gdnative/include/android/godot_android.h +++ b/modules/gdnative/include/android/godot_android.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h index c776297944..860675065d 100644 --- a/modules/gdnative/include/gdnative/aabb.h +++ b/modules/gdnative/include/gdnative/aabb.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,9 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_AABB_SIZE 24 +#define GODOT_AABB_SIZE (sizeof(godot_real_t) * 6) #ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED #define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED @@ -46,72 +46,10 @@ typedef struct { } godot_aabb; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/plane.h> -#include <gdnative/vector3.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); - -godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self); -void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self); -void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v); - -godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self); - -godot_aabb GDAPI godot_aabb_abs(const godot_aabb *p_self); - -godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self); - -godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self); - -godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self); - -godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with); - -godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with); - -godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with); - -godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with); - -godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane); - -godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); - -godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point); - -godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir); - -godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self); - -godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self); - -godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self); - -godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self); - -godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self); - -godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self); - -godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point); - -godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by); - -godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx); -godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b); +void GDAPI godot_aabb_new(godot_aabb *p_self); +void GDAPI godot_aabb_new_copy(godot_aabb *r_dest, const godot_aabb *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h index 4db685873f..bf4b852449 100644 --- a/modules/gdnative/include/gdnative/array.h +++ b/modules/gdnative/include/gdnative/array.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -46,101 +46,14 @@ typedef struct { } godot_array; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/packed_arrays.h> -#include <gdnative/variant.h> - #include <gdnative/gdnative.h> +#include <gdnative/variant_struct.h> -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_array_new(godot_array *r_dest); +void GDAPI godot_array_new(godot_array *p_self); void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src); -void GDAPI godot_array_new_packed_color_array(godot_array *r_dest, const godot_packed_color_array *p_pca); -void GDAPI godot_array_new_packed_vector3_array(godot_array *r_dest, const godot_packed_vector3_array *p_pv3a); -void GDAPI godot_array_new_packed_vector2_array(godot_array *r_dest, const godot_packed_vector2_array *p_pv2a); -void GDAPI godot_array_new_packed_string_array(godot_array *r_dest, const godot_packed_string_array *p_psa); -void GDAPI godot_array_new_packed_float32_array(godot_array *r_dest, const godot_packed_float32_array *p_pra); -void GDAPI godot_array_new_packed_float64_array(godot_array *r_dest, const godot_packed_float64_array *p_pra); -void GDAPI godot_array_new_packed_int32_array(godot_array *r_dest, const godot_packed_int32_array *p_pia); -void GDAPI godot_array_new_packed_int64_array(godot_array *r_dest, const godot_packed_int64_array *p_pia); -void GDAPI godot_array_new_packed_byte_array(godot_array *r_dest, const godot_packed_byte_array *p_pba); - -void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); - -godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx); - -godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx); - -const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, const godot_int p_idx); - -void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value); - -void GDAPI godot_array_clear(godot_array *p_self); - -godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value); - -godot_bool GDAPI godot_array_empty(const godot_array *p_self); - -void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value); - -godot_variant GDAPI godot_array_front(const godot_array *p_self); - -godot_variant GDAPI godot_array_back(const godot_array *p_self); - -godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); - -godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what); - -godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value); - -godot_int GDAPI godot_array_hash(const godot_array *p_self); - -void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value); - -void GDAPI godot_array_invert(godot_array *p_self); - -godot_variant GDAPI godot_array_pop_back(godot_array *p_self); - -godot_variant GDAPI godot_array_pop_front(godot_array *p_self); - -void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value); - -void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value); - -void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx); - -void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size); - -godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); - -godot_int GDAPI godot_array_size(const godot_array *p_self); - -void GDAPI godot_array_sort(godot_array *p_self); - -void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func); - -godot_int GDAPI godot_array_bsearch(godot_array *p_self, const godot_variant *p_value, const godot_bool p_before); - -godot_int GDAPI godot_array_bsearch_custom(godot_array *p_self, const godot_variant *p_value, godot_object *p_obj, const godot_string *p_func, const godot_bool p_before); - void GDAPI godot_array_destroy(godot_array *p_self); - -godot_array GDAPI godot_array_duplicate(const godot_array *p_self, const godot_bool p_deep); - -godot_array GDAPI godot_array_slice(const godot_array *p_self, const godot_int p_begin, const godot_int p_end, const godot_int p_step, const godot_bool p_deep); - -godot_variant GDAPI godot_array_max(const godot_array *p_self); - -godot_variant GDAPI godot_array_min(const godot_array *p_self); - -void GDAPI godot_array_shuffle(godot_array *p_self); +godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, godot_int p_index); +const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h index c7425ebbfa..5477dbf811 100644 --- a/modules/gdnative/include/gdnative/basis.h +++ b/modules/gdnative/include/gdnative/basis.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,9 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_BASIS_SIZE 36 +#define GODOT_BASIS_SIZE (sizeof(godot_real_t) * 9) #ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED #define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED @@ -46,88 +46,12 @@ typedef struct { } godot_basis; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/quat.h> -#include <gdnative/vector3.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis); -void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi); -void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler); -void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler); - -godot_string GDAPI godot_basis_as_string(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self); - -godot_real GDAPI godot_basis_determinant(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - -godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale); - -godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self); - -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self); - -godot_quat GDAPI godot_basis_get_quat(const godot_basis *p_self); - -void GDAPI godot_basis_set_quat(godot_basis *p_self, const godot_quat *p_quat); - -void GDAPI godot_basis_set_axis_angle_scale(godot_basis *p_self, const godot_vector3 *p_axis, godot_real p_phi, const godot_vector3 *p_scale); - -void GDAPI godot_basis_set_euler_scale(godot_basis *p_self, const godot_vector3 *p_euler, const godot_vector3 *p_scale); - -void GDAPI godot_basis_set_quat_scale(godot_basis *p_self, const godot_quat *p_quat, const godot_vector3 *p_scale); - -godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with); - -godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with); - -godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with); - -godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v); - -godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self); - -void GDAPI godot_basis_new(godot_basis *r_dest); - -// p_elements is a pointer to an array of 3 (!!) vector3 -void GDAPI godot_basis_get_elements(const godot_basis *p_self, godot_vector3 *p_elements); - -godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis); - -void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value); - -godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row); - -void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value); - -godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_subtract(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b); -godot_basis GDAPI godot_basis_slerp(const godot_basis *p_self, const godot_basis *p_b, const godot_real p_t); +void GDAPI godot_basis_new(godot_basis *p_self); +void GDAPI godot_basis_new_copy(godot_basis *r_dest, const godot_basis *p_src); +godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index); +const godot_vector3 GDAPI *godot_basis_operator_index_const(const godot_basis *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/callable.h b/modules/gdnative/include/gdnative/callable.h index dbb5d02590..1d52ca7a68 100644 --- a/modules/gdnative/include/gdnative/callable.h +++ b/modules/gdnative/include/gdnative/callable.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -37,6 +37,7 @@ extern "C" { #include <stdint.h> +// Alignment hardcoded in `core/variant/callable.h`. #define GODOT_CALLABLE_SIZE (16) #ifndef GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED @@ -46,79 +47,12 @@ typedef struct { } godot_callable; #endif -#define GODOT_SIGNAL_SIZE (16) - -#ifndef GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_SIGNAL_SIZE]; -} godot_signal; -#endif - -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/string_name.h> -#ifdef __cplusplus -extern "C" { -#endif - -// Callable - -void GDAPI godot_callable_new_with_object(godot_callable *r_dest, const godot_object *p_object, const godot_string_name *p_method); -void GDAPI godot_callable_new_with_object_id(godot_callable *r_dest, uint64_t p_objectid, const godot_string_name *p_method); +void GDAPI godot_callable_new(godot_callable *p_self); void GDAPI godot_callable_new_copy(godot_callable *r_dest, const godot_callable *p_src); - void GDAPI godot_callable_destroy(godot_callable *p_self); -godot_int GDAPI godot_callable_call(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount, godot_variant *r_return_value); -void GDAPI godot_callable_call_deferred(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount); - -godot_bool GDAPI godot_callable_is_null(const godot_callable *p_self); -godot_bool GDAPI godot_callable_is_custom(const godot_callable *p_self); -godot_bool GDAPI godot_callable_is_standard(const godot_callable *p_self); - -godot_object GDAPI *godot_callable_get_object(const godot_callable *p_self); -uint64_t GDAPI godot_callable_get_object_id(const godot_callable *p_self); -godot_string_name GDAPI godot_callable_get_method(const godot_callable *p_self); - -uint32_t GDAPI godot_callable_hash(const godot_callable *p_self); - -godot_string GDAPI godot_callable_as_string(const godot_callable *p_self); - -godot_bool GDAPI godot_callable_operator_equal(const godot_callable *p_self, const godot_callable *p_other); -godot_bool GDAPI godot_callable_operator_less(const godot_callable *p_self, const godot_callable *p_other); - -// Signal - -void GDAPI godot_signal_new_with_object(godot_signal *r_dest, const godot_object *p_object, const godot_string_name *p_name); -void GDAPI godot_signal_new_with_object_id(godot_signal *r_dest, uint64_t p_objectid, const godot_string_name *p_name); -void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src); - -void GDAPI godot_signal_destroy(godot_signal *p_self); - -godot_int GDAPI godot_signal_emit(const godot_signal *p_self, const godot_variant **p_arguments, godot_int p_argcount); - -godot_int GDAPI godot_signal_connect(godot_signal *p_self, const godot_callable *p_callable, const godot_array *p_binds, uint32_t p_flags); -void GDAPI godot_signal_disconnect(godot_signal *p_self, const godot_callable *p_callable); - -godot_bool GDAPI godot_signal_is_null(const godot_signal *p_self); -godot_bool GDAPI godot_signal_is_connected(const godot_signal *p_self, const godot_callable *p_callable); - -godot_array GDAPI godot_signal_get_connections(const godot_signal *p_self); - -godot_object GDAPI *godot_signal_get_object(const godot_signal *p_self); -uint64_t GDAPI godot_signal_get_object_id(const godot_signal *p_self); -godot_string_name GDAPI godot_signal_get_name(const godot_signal *p_self); - -godot_string GDAPI godot_signal_as_string(const godot_signal *p_self); - -godot_bool GDAPI godot_signal_operator_equal(const godot_signal *p_self, const godot_signal *p_other); -godot_bool GDAPI godot_signal_operator_less(const godot_signal *p_self, const godot_signal *p_other); - #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h index e7737bf8e1..3334013147 100644 --- a/modules/gdnative/include/gdnative/color.h +++ b/modules/gdnative/include/gdnative/color.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,10 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_COLOR_SIZE 16 +// Colors should always use 32-bit floats, so don't use real_t here. +#define GODOT_COLOR_SIZE (sizeof(float) * 4) #ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED #define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED @@ -46,70 +47,12 @@ typedef struct { } godot_color; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a); -void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b); - -godot_real godot_color_get_r(const godot_color *p_self); -void godot_color_set_r(godot_color *p_self, const godot_real r); - -godot_real godot_color_get_g(const godot_color *p_self); -void godot_color_set_g(godot_color *p_self, const godot_real g); - -godot_real godot_color_get_b(const godot_color *p_self); -void godot_color_set_b(godot_color *p_self, const godot_real b); - -godot_real godot_color_get_a(const godot_color *p_self); -void godot_color_set_a(godot_color *p_self, const godot_real a); - -godot_real godot_color_get_h(const godot_color *p_self); -godot_real godot_color_get_s(const godot_color *p_self); -godot_real godot_color_get_v(const godot_color *p_self); - -godot_string GDAPI godot_color_as_string(const godot_color *p_self); - -godot_int GDAPI godot_color_to_rgba32(const godot_color *p_self); - -godot_int GDAPI godot_color_to_abgr32(const godot_color *p_self); - -godot_int GDAPI godot_color_to_abgr64(const godot_color *p_self); - -godot_int GDAPI godot_color_to_argb64(const godot_color *p_self); - -godot_int GDAPI godot_color_to_rgba64(const godot_color *p_self); - -godot_int GDAPI godot_color_to_argb32(const godot_color *p_self); - -godot_color GDAPI godot_color_inverted(const godot_color *p_self); - -godot_color GDAPI godot_color_contrasted(const godot_color *p_self); - -godot_color GDAPI godot_color_lerp(const godot_color *p_self, const godot_color *p_b, const godot_real p_t); - -godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over); - -godot_color GDAPI godot_color_darkened(const godot_color *p_self, const godot_real p_amount); - -godot_color GDAPI godot_color_from_hsv(const godot_color *p_self, const godot_real p_h, const godot_real p_s, const godot_real p_v, const godot_real p_a); - -godot_color GDAPI godot_color_lightened(const godot_color *p_self, const godot_real p_amount); - -godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha); - -godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b); -godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b); +void GDAPI godot_color_new(godot_color *p_self); +void GDAPI godot_color_new_copy(godot_color *r_dest, const godot_color *p_src); +float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index); +const float GDAPI *godot_color_operator_index_const(const godot_color *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h index 873efaa9bf..b9525fb5e6 100644 --- a/modules/gdnative/include/gdnative/dictionary.h +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -46,62 +46,15 @@ typedef struct { } godot_dictionary; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/array.h> #include <gdnative/gdnative.h> -#include <gdnative/variant.h> - -#ifdef __cplusplus -extern "C" { -#endif +#include <gdnative/variant_struct.h> -void GDAPI godot_dictionary_new(godot_dictionary *r_dest); +void GDAPI godot_dictionary_new(godot_dictionary *p_self); void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src); void GDAPI godot_dictionary_destroy(godot_dictionary *p_self); - -godot_dictionary GDAPI godot_dictionary_duplicate(const godot_dictionary *p_self, const godot_bool p_deep); - -godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self); - -godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self); - -void GDAPI godot_dictionary_clear(godot_dictionary *p_self); - -godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys); - -void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key); - -godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self); - -godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self); - -godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self); - -godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key); -void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value); - godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key); - const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key); -godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b); - -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self); - -// GDNative core 1.1 - -godot_bool GDAPI godot_dictionary_erase_with_return(godot_dictionary *p_self, const godot_variant *p_key); - -godot_variant GDAPI godot_dictionary_get_with_default(const godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_default); - #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 6a0a375da8..d8c290f6bd 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -53,7 +53,9 @@ extern "C" { #endif // This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! -#ifdef _WIN32 +#ifdef __GNUC__ +#define GDN_EXPORT __attribute__((visibility("default"))) +#elif defined(_WIN32) #define GDN_EXPORT __declspec(dllexport) #else #define GDN_EXPORT @@ -62,8 +64,6 @@ extern "C" { #include <stdbool.h> #include <stdint.h> -#define GODOT_API_VERSION 1 - ////// Error typedef enum { @@ -118,21 +118,6 @@ typedef enum { GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames } godot_error; -////// bool - -typedef bool godot_bool; - -#define GODOT_TRUE 1 -#define GODOT_FALSE 0 - -/////// int - -typedef int64_t godot_int; - -/////// real - -typedef float godot_real; - /////// Object (forward declared) typedef void godot_object; @@ -164,9 +149,9 @@ typedef void godot_object; #include <gdnative/plane.h> -/////// Quat +/////// Quaternion -#include <gdnative/quat.h> +#include <gdnative/quaternion.h> /////// AABB @@ -176,9 +161,9 @@ typedef void godot_object; #include <gdnative/basis.h> -/////// Transform +/////// Transform3D -#include <gdnative/transform.h> +#include <gdnative/transform_3d.h> /////// Color @@ -215,7 +200,7 @@ void GDAPI godot_object_destroy(godot_object *p_o); ////// Singleton API -godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed +godot_object GDAPI *godot_global_get_singleton(char *p_name); // Result shouldn't be freed. ////// MethodBind API @@ -281,12 +266,10 @@ void GDAPI *godot_alloc(int p_bytes); void GDAPI *godot_realloc(void *p_ptr, int p_bytes); void GDAPI godot_free(void *p_ptr); -//print using Godot's error handler list +// Helper print functions. void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line); void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line); -void GDAPI godot_print(const godot_string *p_message); - -// GDNATIVE CORE 1.0.2? +void GDAPI godot_print_script_error(const char *p_description, const char *p_function, const char *p_file, int p_line); //tags used for safe dynamic casting void GDAPI *godot_get_class_tag(const godot_string_name *p_class); @@ -301,4 +284,4 @@ uint64_t GDAPI godot_object_get_instance_id(const godot_object *p_object); } #endif -#endif // GODOT_C_H +#endif // GODOT_GDNATIVE_H diff --git a/modules/gdnative/include/gdnative/math_defs.h b/modules/gdnative/include/gdnative/math_defs.h new file mode 100644 index 0000000000..b5cf389506 --- /dev/null +++ b/modules/gdnative/include/gdnative/math_defs.h @@ -0,0 +1,66 @@ +/*************************************************************************/ +/* math_defs.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_GDNATIVE_MATH_DEFS_H +#define GODOT_GDNATIVE_MATH_DEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdbool.h> +#include <stdint.h> + +////// bool + +typedef bool godot_bool; + +#define GODOT_TRUE 1 +#define GODOT_FALSE 0 + +/////// int + +typedef int64_t godot_int; + +/////// float + +typedef double godot_float; + +#ifdef REAL_T_IS_DOUBLE +typedef double godot_real_t; +#else +typedef float godot_real_t; +#endif + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_C_H diff --git a/modules/gdnative/include/gdnative/node_path.h b/modules/gdnative/include/gdnative/node_path.h index 0cd0c3cb9c..a4607c0152 100644 --- a/modules/gdnative/include/gdnative/node_path.h +++ b/modules/gdnative/include/gdnative/node_path.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -46,42 +46,12 @@ typedef struct { } godot_node_path; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/string.h> -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from); +void GDAPI godot_node_path_new(godot_node_path *p_self); void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src); void GDAPI godot_node_path_destroy(godot_node_path *p_self); -godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self); - -godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self); - -godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self); - -godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx); - -godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self); - -godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx); - -godot_string GDAPI godot_node_path_get_concatenated_subnames(const godot_node_path *p_self); - -godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self); - -godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b); - -godot_node_path godot_node_path_get_as_property_path(const godot_node_path *p_self); - #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/packed_arrays.h b/modules/gdnative/include/gdnative/packed_arrays.h index 6a1727d76f..f9e4ba3a8d 100644 --- a/modules/gdnative/include/gdnative/packed_arrays.h +++ b/modules/gdnative/include/gdnative/packed_arrays.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -114,6 +114,17 @@ typedef struct { } godot_packed_vector2_array; #endif +/////// PackedVector2iArray + +#define GODOT_PACKED_VECTOR2I_ARRAY_SIZE (2 * sizeof(void *)) + +#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR2I_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_VECTOR2I_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_PACKED_VECTOR2I_ARRAY_SIZE]; +} godot_packed_vector2i_array; +#endif + /////// PackedVector3Array #define GODOT_PACKED_VECTOR3_ARRAY_SIZE (2 * sizeof(void *)) @@ -125,6 +136,17 @@ typedef struct { } godot_packed_vector3_array; #endif +/////// PackedVector3iArray + +#define GODOT_PACKED_VECTOR3I_ARRAY_SIZE (2 * sizeof(void *)) + +#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR3I_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_VECTOR3I_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_PACKED_VECTOR3I_ARRAY_SIZE]; +} godot_packed_vector3i_array; +#endif + /////// PackedColorArray #define GODOT_PACKED_COLOR_ARRAY_SIZE (2 * sizeof(void *)) @@ -136,348 +158,98 @@ typedef struct { } godot_packed_color_array; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/array.h> -#include <gdnative/color.h> -#include <gdnative/vector2.h> -#include <gdnative/vector3.h> - #include <gdnative/gdnative.h> -#ifdef __cplusplus -extern "C" { -#endif - -// byte +// Byte. -void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *r_dest); +void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *p_self); void GDAPI godot_packed_byte_array_new_copy(godot_packed_byte_array *r_dest, const godot_packed_byte_array *p_src); -void GDAPI godot_packed_byte_array_new_with_array(godot_packed_byte_array *r_dest, const godot_array *p_a); - -const uint8_t GDAPI *godot_packed_byte_array_ptr(const godot_packed_byte_array *p_self); -uint8_t GDAPI *godot_packed_byte_array_ptrw(godot_packed_byte_array *p_self); - -void GDAPI godot_packed_byte_array_append(godot_packed_byte_array *p_self, const uint8_t p_data); - -void GDAPI godot_packed_byte_array_append_array(godot_packed_byte_array *p_self, const godot_packed_byte_array *p_array); - -godot_error GDAPI godot_packed_byte_array_insert(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); - -godot_bool GDAPI godot_packed_byte_array_has(godot_packed_byte_array *p_self, const uint8_t p_value); - -void GDAPI godot_packed_byte_array_sort(godot_packed_byte_array *p_self); - -void GDAPI godot_packed_byte_array_invert(godot_packed_byte_array *p_self); - -void GDAPI godot_packed_byte_array_push_back(godot_packed_byte_array *p_self, const uint8_t p_data); - -void GDAPI godot_packed_byte_array_remove(godot_packed_byte_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_byte_array_resize(godot_packed_byte_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_byte_array_set(godot_packed_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); -uint8_t GDAPI godot_packed_byte_array_get(const godot_packed_byte_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_byte_array_size(const godot_packed_byte_array *p_self); - -godot_bool GDAPI godot_packed_byte_array_empty(const godot_packed_byte_array *p_self); - void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self); +uint8_t GDAPI *godot_packed_byte_array_operator_index(godot_packed_byte_array *p_self, godot_int p_index); +const uint8_t GDAPI *godot_packed_byte_array_operator_index_const(const godot_packed_byte_array *p_self, godot_int p_index); -// int32 +// Int32. -void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *r_dest); +void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *p_self); void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src); -void GDAPI godot_packed_int32_array_new_with_array(godot_packed_int32_array *r_dest, const godot_array *p_a); - -const int32_t GDAPI *godot_packed_int32_array_ptr(const godot_packed_int32_array *p_self); -int32_t GDAPI *godot_packed_int32_array_ptrw(godot_packed_int32_array *p_self); - -void GDAPI godot_packed_int32_array_append(godot_packed_int32_array *p_self, const int32_t p_data); - -void GDAPI godot_packed_int32_array_append_array(godot_packed_int32_array *p_self, const godot_packed_int32_array *p_array); - -godot_error GDAPI godot_packed_int32_array_insert(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data); - -godot_bool GDAPI godot_packed_int32_array_has(godot_packed_int32_array *p_self, const int32_t p_value); - -void GDAPI godot_packed_int32_array_sort(godot_packed_int32_array *p_self); - -void GDAPI godot_packed_int32_array_invert(godot_packed_int32_array *p_self); - -void GDAPI godot_packed_int32_array_push_back(godot_packed_int32_array *p_self, const int32_t p_data); - -void GDAPI godot_packed_int32_array_remove(godot_packed_int32_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_int32_array_resize(godot_packed_int32_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_int32_array_set(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data); -int32_t GDAPI godot_packed_int32_array_get(const godot_packed_int32_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_int32_array_size(const godot_packed_int32_array *p_self); - -godot_bool GDAPI godot_packed_int32_array_empty(const godot_packed_int32_array *p_self); - void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self); +int32_t GDAPI *godot_packed_int32_array_operator_index(godot_packed_int32_array *p_self, godot_int p_index); +const int32_t GDAPI *godot_packed_int32_array_operator_index_const(const godot_packed_int32_array *p_self, godot_int p_index); -// int64 +// Int64. -void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *r_dest); +void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *p_self); void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src); -void GDAPI godot_packed_int64_array_new_with_array(godot_packed_int64_array *r_dest, const godot_array *p_a); - -const int64_t GDAPI *godot_packed_int64_array_ptr(const godot_packed_int64_array *p_self); -int64_t GDAPI *godot_packed_int64_array_ptrw(godot_packed_int64_array *p_self); - -void GDAPI godot_packed_int64_array_append(godot_packed_int64_array *p_self, const int64_t p_data); - -void GDAPI godot_packed_int64_array_append_array(godot_packed_int64_array *p_self, const godot_packed_int64_array *p_array); - -godot_error GDAPI godot_packed_int64_array_insert(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data); - -godot_bool GDAPI godot_packed_int64_array_has(godot_packed_int64_array *p_self, const int64_t p_value); - -void GDAPI godot_packed_int64_array_sort(godot_packed_int64_array *p_self); - -void GDAPI godot_packed_int64_array_invert(godot_packed_int64_array *p_self); - -void GDAPI godot_packed_int64_array_push_back(godot_packed_int64_array *p_self, const int64_t p_data); - -void GDAPI godot_packed_int64_array_remove(godot_packed_int64_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_int64_array_resize(godot_packed_int64_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_int64_array_set(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data); -int64_t GDAPI godot_packed_int64_array_get(const godot_packed_int64_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_int64_array_size(const godot_packed_int64_array *p_self); - -godot_bool GDAPI godot_packed_int64_array_empty(const godot_packed_int64_array *p_self); - void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self); +int64_t GDAPI *godot_packed_int64_array_operator_index(godot_packed_int64_array *p_self, godot_int p_index); +const int64_t GDAPI *godot_packed_int64_array_operator_index_const(const godot_packed_int64_array *p_self, godot_int p_index); -// float32 +// Float32. -void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *r_dest); +void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *p_self); void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src); -void GDAPI godot_packed_float32_array_new_with_array(godot_packed_float32_array *r_dest, const godot_array *p_a); - -const float GDAPI *godot_packed_float32_array_ptr(const godot_packed_float32_array *p_self); -float GDAPI *godot_packed_float32_array_ptrw(godot_packed_float32_array *p_self); - -void GDAPI godot_packed_float32_array_append(godot_packed_float32_array *p_self, const float p_data); - -void GDAPI godot_packed_float32_array_append_array(godot_packed_float32_array *p_self, const godot_packed_float32_array *p_array); - -godot_error GDAPI godot_packed_float32_array_insert(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data); - -godot_bool GDAPI godot_packed_float32_array_has(godot_packed_float32_array *p_self, const float p_value); - -void GDAPI godot_packed_float32_array_sort(godot_packed_float32_array *p_self); - -void GDAPI godot_packed_float32_array_invert(godot_packed_float32_array *p_self); - -void GDAPI godot_packed_float32_array_push_back(godot_packed_float32_array *p_self, const float p_data); - -void GDAPI godot_packed_float32_array_remove(godot_packed_float32_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_float32_array_resize(godot_packed_float32_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_float32_array_set(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data); -float GDAPI godot_packed_float32_array_get(const godot_packed_float32_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_float32_array_size(const godot_packed_float32_array *p_self); - -godot_bool GDAPI godot_packed_float32_array_empty(const godot_packed_float32_array *p_self); - void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self); +float GDAPI *godot_packed_float32_array_operator_index(godot_packed_float32_array *p_self, godot_int p_index); +const float GDAPI *godot_packed_float32_array_operator_index_const(const godot_packed_float32_array *p_self, godot_int p_index); -// float64 +// Float64. -void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *r_dest); +void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *p_self); void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src); -void GDAPI godot_packed_float64_array_new_with_array(godot_packed_float64_array *r_dest, const godot_array *p_a); - -const double GDAPI *godot_packed_float64_array_ptr(const godot_packed_float64_array *p_self); -double GDAPI *godot_packed_float64_array_ptrw(godot_packed_float64_array *p_self); - -void GDAPI godot_packed_float64_array_append(godot_packed_float64_array *p_self, const double p_data); - -void GDAPI godot_packed_float64_array_append_array(godot_packed_float64_array *p_self, const godot_packed_float64_array *p_array); - -godot_error GDAPI godot_packed_float64_array_insert(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data); - -godot_bool GDAPI godot_packed_float64_array_has(godot_packed_float64_array *p_self, const double p_value); - -void GDAPI godot_packed_float64_array_sort(godot_packed_float64_array *p_self); - -void GDAPI godot_packed_float64_array_invert(godot_packed_float64_array *p_self); - -void GDAPI godot_packed_float64_array_push_back(godot_packed_float64_array *p_self, const double p_data); - -void GDAPI godot_packed_float64_array_remove(godot_packed_float64_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_float64_array_resize(godot_packed_float64_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_float64_array_set(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data); -double GDAPI godot_packed_float64_array_get(const godot_packed_float64_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_float64_array_size(const godot_packed_float64_array *p_self); - -godot_bool GDAPI godot_packed_float64_array_empty(const godot_packed_float64_array *p_self); - void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self); +double GDAPI *godot_packed_float64_array_operator_index(godot_packed_float64_array *p_self, godot_int p_index); +const double GDAPI *godot_packed_float64_array_operator_index_const(const godot_packed_float64_array *p_self, godot_int p_index); -// string +// String. -void GDAPI godot_packed_string_array_new(godot_packed_string_array *r_dest); +void GDAPI godot_packed_string_array_new(godot_packed_string_array *p_self); void GDAPI godot_packed_string_array_new_copy(godot_packed_string_array *r_dest, const godot_packed_string_array *p_src); -void GDAPI godot_packed_string_array_new_with_array(godot_packed_string_array *r_dest, const godot_array *p_a); - -const godot_string GDAPI *godot_packed_string_array_ptr(const godot_packed_string_array *p_self); -godot_string GDAPI *godot_packed_string_array_ptrw(godot_packed_string_array *p_self); - -void GDAPI godot_packed_string_array_append(godot_packed_string_array *p_self, const godot_string *p_data); - -void GDAPI godot_packed_string_array_append_array(godot_packed_string_array *p_self, const godot_packed_string_array *p_array); - -godot_error GDAPI godot_packed_string_array_insert(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data); - -godot_bool GDAPI godot_packed_string_array_has(godot_packed_string_array *p_self, const godot_string *p_value); - -void GDAPI godot_packed_string_array_sort(godot_packed_string_array *p_self); - -void GDAPI godot_packed_string_array_invert(godot_packed_string_array *p_self); - -void GDAPI godot_packed_string_array_push_back(godot_packed_string_array *p_self, const godot_string *p_data); - -void GDAPI godot_packed_string_array_remove(godot_packed_string_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_string_array_resize(godot_packed_string_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_string_array_set(godot_packed_string_array *p_self, const godot_int p_idx, const godot_string *p_data); -godot_string GDAPI godot_packed_string_array_get(const godot_packed_string_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_string_array_size(const godot_packed_string_array *p_self); - -godot_bool GDAPI godot_packed_string_array_empty(const godot_packed_string_array *p_self); - void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self); +godot_string GDAPI *godot_packed_string_array_operator_index(godot_packed_string_array *p_self, godot_int p_index); +const godot_string GDAPI *godot_packed_string_array_operator_index_const(const godot_packed_string_array *p_self, godot_int p_index); -// vector2 +// Vector2. -void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *r_dest); +void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *p_self); void GDAPI godot_packed_vector2_array_new_copy(godot_packed_vector2_array *r_dest, const godot_packed_vector2_array *p_src); -void GDAPI godot_packed_vector2_array_new_with_array(godot_packed_vector2_array *r_dest, const godot_array *p_a); - -const godot_vector2 GDAPI *godot_packed_vector2_array_ptr(const godot_packed_vector2_array *p_self); -godot_vector2 GDAPI *godot_packed_vector2_array_ptrw(godot_packed_vector2_array *p_self); - -void GDAPI godot_packed_vector2_array_append(godot_packed_vector2_array *p_self, const godot_vector2 *p_data); - -void GDAPI godot_packed_vector2_array_append_array(godot_packed_vector2_array *p_self, const godot_packed_vector2_array *p_array); - -godot_error GDAPI godot_packed_vector2_array_insert(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); - -godot_bool GDAPI godot_packed_vector2_array_has(godot_packed_vector2_array *p_self, const godot_vector2 *p_value); - -void GDAPI godot_packed_vector2_array_sort(godot_packed_vector2_array *p_self); - -void GDAPI godot_packed_vector2_array_invert(godot_packed_vector2_array *p_self); - -void GDAPI godot_packed_vector2_array_push_back(godot_packed_vector2_array *p_self, const godot_vector2 *p_data); - -void GDAPI godot_packed_vector2_array_remove(godot_packed_vector2_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_vector2_array_resize(godot_packed_vector2_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_vector2_array_set(godot_packed_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); -godot_vector2 GDAPI godot_packed_vector2_array_get(const godot_packed_vector2_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_vector2_array_size(const godot_packed_vector2_array *p_self); - -godot_bool GDAPI godot_packed_vector2_array_empty(const godot_packed_vector2_array *p_self); - void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self); +godot_vector2 GDAPI *godot_packed_vector2_array_operator_index(godot_packed_vector2_array *p_self, godot_int p_index); +const godot_vector2 GDAPI *godot_packed_vector2_array_operator_index_const(const godot_packed_vector2_array *p_self, godot_int p_index); -// vector3 - -void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *r_dest); -void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src); -void GDAPI godot_packed_vector3_array_new_with_array(godot_packed_vector3_array *r_dest, const godot_array *p_a); - -const godot_vector3 GDAPI *godot_packed_vector3_array_ptr(const godot_packed_vector3_array *p_self); -godot_vector3 GDAPI *godot_packed_vector3_array_ptrw(godot_packed_vector3_array *p_self); - -void GDAPI godot_packed_vector3_array_append(godot_packed_vector3_array *p_self, const godot_vector3 *p_data); - -void GDAPI godot_packed_vector3_array_append_array(godot_packed_vector3_array *p_self, const godot_packed_vector3_array *p_array); - -godot_error GDAPI godot_packed_vector3_array_insert(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); - -godot_bool GDAPI godot_packed_vector3_array_has(godot_packed_vector3_array *p_self, const godot_vector3 *p_value); - -void GDAPI godot_packed_vector3_array_sort(godot_packed_vector3_array *p_self); - -void GDAPI godot_packed_vector3_array_invert(godot_packed_vector3_array *p_self); - -void GDAPI godot_packed_vector3_array_push_back(godot_packed_vector3_array *p_self, const godot_vector3 *p_data); +// Vector2i. -void GDAPI godot_packed_vector3_array_remove(godot_packed_vector3_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self); +void GDAPI godot_packed_vector2i_array_new_copy(godot_packed_vector2i_array *r_dest, const godot_packed_vector2i_array *p_src); +void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_self); +godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index(godot_packed_vector2i_array *p_self, godot_int p_index); +const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(const godot_packed_vector2i_array *p_self, godot_int p_index); -void GDAPI godot_packed_vector3_array_resize(godot_packed_vector3_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_vector3_array_set(godot_packed_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); -godot_vector3 GDAPI godot_packed_vector3_array_get(const godot_packed_vector3_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_vector3_array_size(const godot_packed_vector3_array *p_self); - -godot_bool GDAPI godot_packed_vector3_array_empty(const godot_packed_vector3_array *p_self); +// Vector3. +void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *p_self); +void GDAPI godot_packed_vector3_array_new_copy(godot_packed_vector3_array *r_dest, const godot_packed_vector3_array *p_src); void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self); +godot_vector3 GDAPI *godot_packed_vector3_array_operator_index(godot_packed_vector3_array *p_self, godot_int p_index); +const godot_vector3 GDAPI *godot_packed_vector3_array_operator_index_const(const godot_packed_vector3_array *p_self, godot_int p_index); -// color - -void GDAPI godot_packed_color_array_new(godot_packed_color_array *r_dest); -void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src); -void GDAPI godot_packed_color_array_new_with_array(godot_packed_color_array *r_dest, const godot_array *p_a); - -const godot_color GDAPI *godot_packed_color_array_ptr(const godot_packed_color_array *p_self); -godot_color GDAPI *godot_packed_color_array_ptrw(godot_packed_color_array *p_self); - -void GDAPI godot_packed_color_array_append(godot_packed_color_array *p_self, const godot_color *p_data); - -void GDAPI godot_packed_color_array_append_array(godot_packed_color_array *p_self, const godot_packed_color_array *p_array); +// Vector3i. -godot_error GDAPI godot_packed_color_array_insert(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data); +void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self); +void GDAPI godot_packed_vector3i_array_new_copy(godot_packed_vector3i_array *r_dest, const godot_packed_vector3i_array *p_src); +void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_self); +godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index(godot_packed_vector3i_array *p_self, godot_int p_index); +const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(const godot_packed_vector3i_array *p_self, godot_int p_index); -godot_bool GDAPI godot_packed_color_array_has(godot_packed_color_array *p_self, const godot_color *p_value); - -void GDAPI godot_packed_color_array_sort(godot_packed_color_array *p_self); - -void GDAPI godot_packed_color_array_invert(godot_packed_color_array *p_self); - -void GDAPI godot_packed_color_array_push_back(godot_packed_color_array *p_self, const godot_color *p_data); - -void GDAPI godot_packed_color_array_remove(godot_packed_color_array *p_self, const godot_int p_idx); - -void GDAPI godot_packed_color_array_resize(godot_packed_color_array *p_self, const godot_int p_size); - -void GDAPI godot_packed_color_array_set(godot_packed_color_array *p_self, const godot_int p_idx, const godot_color *p_data); -godot_color GDAPI godot_packed_color_array_get(const godot_packed_color_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_packed_color_array_size(const godot_packed_color_array *p_self); - -godot_bool GDAPI godot_packed_color_array_empty(const godot_packed_color_array *p_self); +// Color. +void GDAPI godot_packed_color_array_new(godot_packed_color_array *p_self); +void GDAPI godot_packed_color_array_new_copy(godot_packed_color_array *r_dest, const godot_packed_color_array *p_src); void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self); +godot_color GDAPI *godot_packed_color_array_operator_index(godot_packed_color_array *p_self, godot_int p_index); +const godot_color GDAPI *godot_packed_color_array_operator_index_const(const godot_packed_color_array *p_self, godot_int p_index); #ifdef __cplusplus } #endif -#endif // GODOT_POOL_ARRAYS_H +#endif // GODOT_PACKED_ARRAYS_H diff --git a/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h index 9843056489..6cd0ed6307 100644 --- a/modules/gdnative/include/gdnative/plane.h +++ b/modules/gdnative/include/gdnative/plane.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,9 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_PLANE_SIZE 16 +#define GODOT_PLANE_SIZE (sizeof(godot_real_t) * 4) #ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED #define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED @@ -46,53 +46,10 @@ typedef struct { } godot_plane; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/vector3.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d); -void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3); -void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d); - -godot_string GDAPI godot_plane_as_string(const godot_plane *p_self); - -godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self); - -godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self); - -godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point); - -godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point); - -godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon); - -godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point); - -godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c); - -godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir); - -godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end); - -godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self); - -godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b); - -void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal); - -godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self); - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_self); -void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d); +void GDAPI godot_plane_new(godot_plane *p_self); +void GDAPI godot_plane_new_copy(godot_plane *r_dest, const godot_plane *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h deleted file mode 100644 index d315b2d754..0000000000 --- a/modules/gdnative/include/gdnative/quat.h +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************/ -/* quat.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GODOT_QUAT_H -#define GODOT_QUAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#define GODOT_QUAT_SIZE 16 - -#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_QUAT_SIZE]; -} godot_quat; -#endif - -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/gdnative.h> -#include <gdnative/vector3.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w); -void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle); -void GDAPI godot_quat_new_with_basis(godot_quat *r_dest, const godot_basis *p_basis); -void GDAPI godot_quat_new_with_euler(godot_quat *r_dest, const godot_vector3 *p_euler); - -godot_real GDAPI godot_quat_get_x(const godot_quat *p_self); -void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val); - -godot_real GDAPI godot_quat_get_y(const godot_quat *p_self); -void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val); - -godot_real GDAPI godot_quat_get_z(const godot_quat *p_self); -void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val); - -godot_real GDAPI godot_quat_get_w(const godot_quat *p_self); -void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val); - -godot_string GDAPI godot_quat_as_string(const godot_quat *p_self); - -godot_real GDAPI godot_quat_length(const godot_quat *p_self); - -godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self); - -godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self); - -godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self); - -godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self); - -godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b); - -godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v); - -godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); - -godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); - -godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t); - -godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b); - -godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b); - -godot_quat GDAPI godot_quat_operator_subtract(const godot_quat *p_self, const godot_quat *p_b); - -godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b); - -godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b); - -godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self); - -void GDAPI godot_quat_set_axis_angle(godot_quat *p_self, const godot_vector3 *p_axis, const godot_real p_angle); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_QUAT_H diff --git a/modules/gdnative/include/gdnative/quaternion.h b/modules/gdnative/include/gdnative/quaternion.h new file mode 100644 index 0000000000..75754e6ab5 --- /dev/null +++ b/modules/gdnative/include/gdnative/quaternion.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* quaternion.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_QUATERNION_H +#define GODOT_QUATERNION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <gdnative/math_defs.h> + +#define GODOT_QUATERNION_SIZE (sizeof(godot_real_t) * 4) + +#ifndef GODOT_CORE_API_GODOT_QUATERNION_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_QUATERNION_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_QUATERNION_SIZE]; +} godot_quaternion; +#endif + +#include <gdnative/gdnative.h> + +void GDAPI godot_quaternion_new(godot_quaternion *p_self); +void GDAPI godot_quaternion_new_copy(godot_quaternion *r_dest, const godot_quaternion *p_src); +godot_real_t GDAPI *godot_quaternion_operator_index(godot_quaternion *p_self, godot_int p_index); +const godot_real_t GDAPI *godot_quaternion_operator_index_const(const godot_quaternion *p_self, godot_int p_index); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_QUATERNION_H diff --git a/modules/gdnative/include/gdnative/rect2.h b/modules/gdnative/include/gdnative/rect2.h index f317afc9da..326462be43 100644 --- a/modules/gdnative/include/gdnative/rect2.h +++ b/modules/gdnative/include/gdnative/rect2.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,119 +35,32 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> + +#define GODOT_RECT2_SIZE (sizeof(godot_real_t) * 4) #ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED #define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED typedef struct godot_rect2 { - uint8_t _dont_touch_that[16]; + uint8_t _dont_touch_that[GODOT_RECT2_SIZE]; } godot_rect2; #endif +#define GODOT_RECT2I_SIZE (sizeof(int32_t) * 4) + #ifndef GODOT_CORE_API_GODOT_RECT2I_TYPE_DEFINED #define GODOT_CORE_API_GODOT_RECT2I_TYPE_DEFINED typedef struct godot_rect2i { - uint8_t _dont_touch_that[16]; + uint8_t _dont_touch_that[GODOT_RECT2I_SIZE]; } godot_rect2i; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/vector2.h> - -#ifdef __cplusplus -extern "C" { -#endif - -// Rect2 - -void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); -void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height); - -godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self); - -godot_rect2i GDAPI godot_rect2_as_rect2i(const godot_rect2 *p_self); - -godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self); - -godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self); - -godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point); - -godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by); - -godot_rect2 GDAPI godot_rect2_grow_individual(const godot_rect2 *p_self, const godot_real p_left, const godot_real p_top, const godot_real p_right, const godot_real p_bottom); - -godot_rect2 GDAPI godot_rect2_grow_margin(const godot_rect2 *p_self, const godot_int p_margin, const godot_real p_by); - -godot_rect2 GDAPI godot_rect2_abs(const godot_rect2 *p_self); - -godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to); - -godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self); - -godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self); - -void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos); - -void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size); - -// Rect2I - -void GDAPI godot_rect2i_new_with_position_and_size(godot_rect2i *r_dest, const godot_vector2i *p_pos, const godot_vector2i *p_size); -void GDAPI godot_rect2i_new(godot_rect2i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_width, const godot_int p_height); - -godot_string GDAPI godot_rect2i_as_string(const godot_rect2i *p_self); - -godot_rect2 GDAPI godot_rect2i_as_rect2(const godot_rect2i *p_self); - -godot_int GDAPI godot_rect2i_get_area(const godot_rect2i *p_self); - -godot_bool GDAPI godot_rect2i_intersects(const godot_rect2i *p_self, const godot_rect2i *p_b); - -godot_bool GDAPI godot_rect2i_encloses(const godot_rect2i *p_self, const godot_rect2i *p_b); - -godot_bool GDAPI godot_rect2i_has_no_area(const godot_rect2i *p_self); - -godot_rect2i GDAPI godot_rect2i_clip(const godot_rect2i *p_self, const godot_rect2i *p_b); - -godot_rect2i GDAPI godot_rect2i_merge(const godot_rect2i *p_self, const godot_rect2i *p_b); - -godot_bool GDAPI godot_rect2i_has_point(const godot_rect2i *p_self, const godot_vector2i *p_point); - -godot_rect2i GDAPI godot_rect2i_grow(const godot_rect2i *p_self, const godot_int p_by); - -godot_rect2i GDAPI godot_rect2i_grow_individual(const godot_rect2i *p_self, const godot_int p_left, const godot_int p_top, const godot_int p_right, const godot_int p_bottom); - -godot_rect2i GDAPI godot_rect2i_grow_margin(const godot_rect2i *p_self, const godot_int p_margin, const godot_int p_by); - -godot_rect2i GDAPI godot_rect2i_abs(const godot_rect2i *p_self); - -godot_rect2i GDAPI godot_rect2i_expand(const godot_rect2i *p_self, const godot_vector2i *p_to); - -godot_bool GDAPI godot_rect2i_operator_equal(const godot_rect2i *p_self, const godot_rect2i *p_b); - -godot_vector2i GDAPI godot_rect2i_get_position(const godot_rect2i *p_self); - -godot_vector2i GDAPI godot_rect2i_get_size(const godot_rect2i *p_self); - -void GDAPI godot_rect2i_set_position(godot_rect2i *p_self, const godot_vector2i *p_pos); -void GDAPI godot_rect2i_set_size(godot_rect2i *p_self, const godot_vector2i *p_size); +void GDAPI godot_rect2_new(godot_rect2 *p_self); +void GDAPI godot_rect2_new_copy(godot_rect2 *r_dest, const godot_rect2 *p_src); +void GDAPI godot_rect2i_new(godot_rect2i *p_self); +void GDAPI godot_rect2i_new_copy(godot_rect2i *r_dest, const godot_rect2i *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h index 73b601dc04..bc832fbeb9 100644 --- a/modules/gdnative/include/gdnative/rid.h +++ b/modules/gdnative/include/gdnative/rid.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -46,26 +46,10 @@ typedef struct { } godot_rid; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_rid_new(godot_rid *r_dest); - -godot_int GDAPI godot_rid_get_id(const godot_rid *p_self); - -void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from); - -godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b); - -godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b); +void GDAPI godot_rid_new(godot_rid *p_self); +void GDAPI godot_rid_new_copy(godot_rid *r_dest, const godot_rid *p_src); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/signal.h b/modules/gdnative/include/gdnative/signal.h new file mode 100644 index 0000000000..41a76d0510 --- /dev/null +++ b/modules/gdnative/include/gdnative/signal.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* signal.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_SIGNAL_H +#define GODOT_SIGNAL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +// Alignment hardcoded in `core/variant/callable.h`. +#define GODOT_SIGNAL_SIZE (16) + +#ifndef GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_SIGNAL_SIZE]; +} godot_signal; +#endif + +#include <gdnative/gdnative.h> + +void GDAPI godot_signal_new(godot_signal *p_self); +void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src); +void GDAPI godot_signal_destroy(godot_signal *p_self); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h index 0582d95f63..79de52c80f 100644 --- a/modules/gdnative/include/gdnative/string.h +++ b/modules/gdnative/include/gdnative/string.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,60 +35,31 @@ extern "C" { #endif +#include <stddef.h> #include <stdint.h> -#include <wchar.h> + +#ifndef __cplusplus +typedef uint16_t char16_t; +typedef uint32_t char32_t; +#endif typedef char32_t godot_char_type; #define GODOT_STRING_SIZE sizeof(void *) -#define GODOT_CHAR_STRING_SIZE sizeof(void *) -#define GODOT_CHAR16_STRING_SIZE sizeof(void *) #ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED #define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED typedef struct { uint8_t _dont_touch_that[GODOT_STRING_SIZE]; } godot_string; - -#endif - -#ifndef GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_CHAR_STRING_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_CHAR_STRING_SIZE]; -} godot_char_string; -#endif - -#ifndef GODOT_CORE_API_GODOT_CHAR16_STRING_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_CHAR16_STRING_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_CHAR16_STRING_SIZE]; -} godot_char16_string; -#endif - -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} #endif -#include <gdnative/array.h> #include <gdnative/gdnative.h> -#include <gdnative/variant.h> - -#ifdef __cplusplus -extern "C" { -#endif - -godot_int GDAPI godot_char_string_length(const godot_char_string *p_cs); -const char GDAPI *godot_char_string_get_data(const godot_char_string *p_cs); -void GDAPI godot_char_string_destroy(godot_char_string *p_cs); - -godot_int GDAPI godot_char16_string_length(const godot_char16_string *p_cs); -const char16_t GDAPI *godot_char16_string_get_data(const godot_char16_string *p_cs); -void GDAPI godot_char16_string_destroy(godot_char16_string *p_cs); +#include <gdnative/math_defs.h> void GDAPI godot_string_new(godot_string *r_dest); void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); +void GDAPI godot_string_destroy(godot_string *p_self); void GDAPI godot_string_new_with_latin1_chars(godot_string *r_dest, const char *p_contents); void GDAPI godot_string_new_with_utf8_chars(godot_string *r_dest, const char *p_contents); @@ -102,197 +73,14 @@ void GDAPI godot_string_new_with_utf16_chars_and_len(godot_string *r_dest, const void GDAPI godot_string_new_with_utf32_chars_and_len(godot_string *r_dest, const char32_t *p_contents, const int p_size); void GDAPI godot_string_new_with_wide_chars_and_len(godot_string *r_dest, const wchar_t *p_contents, const int p_size); -const godot_char_type GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx); -godot_char_type GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx); -const godot_char_type GDAPI *godot_string_get_data(const godot_string *p_self); - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b); -godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b); -godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b); - -/* Standard size stuff */ - -/*+++*/ godot_int GDAPI godot_string_length(const godot_string *p_self); - -/* Helpers */ - -signed char GDAPI godot_string_casecmp_to(const godot_string *p_self, const godot_string *p_str); -signed char GDAPI godot_string_nocasecmp_to(const godot_string *p_self, const godot_string *p_str); -signed char GDAPI godot_string_naturalnocasecmp_to(const godot_string *p_self, const godot_string *p_str); - -godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string); -godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array); -godot_packed_string_array GDAPI godot_string_bigrams(const godot_string *p_self); -godot_string GDAPI godot_string_chr(godot_char_type p_character); -godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string); -godot_bool GDAPI godot_string_ends_with_char_array(const godot_string *p_self, const char *p_char_array); -godot_int GDAPI godot_string_count(const godot_string *p_self, const godot_string *p_what, godot_int p_from, godot_int p_to); -godot_int GDAPI godot_string_countn(const godot_string *p_self, const godot_string *p_what, godot_int p_from, godot_int p_to); -godot_int GDAPI godot_string_find(const godot_string *p_self, const godot_string *p_what); -godot_int GDAPI godot_string_find_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from); -godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_packed_string_array *p_keys); -godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_packed_string_array *p_keys, godot_int p_from); -godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_packed_string_array *p_keys, godot_int p_from, godot_int *r_key); -godot_int GDAPI godot_string_findn(const godot_string *p_self, const godot_string *p_what); -godot_int GDAPI godot_string_findn_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from); -godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values); -godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder); -godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len); -godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self); -godot_int GDAPI godot_string_hex_to_int_with_prefix(const godot_string *p_self); -godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, const godot_string *p_string); -godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self); -godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string); -godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string); -godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length); -godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); -godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard); -godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard); -godot_string GDAPI godot_string_md5(const uint8_t *p_md5); -godot_string GDAPI godot_string_num(double p_num); -godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base); -godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); -godot_string GDAPI godot_string_num_real(double p_num); -godot_string GDAPI godot_string_num_scientific(double p_num); -godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals); -godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits); -godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits); -godot_string GDAPI godot_string_replace_first(const godot_string *p_self, const godot_string *p_key, const godot_string *p_with); -godot_string GDAPI godot_string_replace(const godot_string *p_self, const godot_string *p_key, const godot_string *p_with); -godot_string GDAPI godot_string_replacen(const godot_string *p_self, const godot_string *p_key, const godot_string *p_with); -godot_int GDAPI godot_string_rfind(const godot_string *p_self, const godot_string *p_what); -godot_int GDAPI godot_string_rfindn(const godot_string *p_self, const godot_string *p_what); -godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from); -godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, const godot_string *p_what, godot_int p_from); -godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length); -godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); -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_float(const godot_string *p_self); -godot_int GDAPI godot_string_to_int(const godot_string *p_self); +const char GDAPI *godot_string_to_latin1_chars(const godot_string *p_self); +const char GDAPI *godot_string_to_utf8_chars(const godot_string *p_self); +const char16_t GDAPI *godot_string_to_utf16_chars(const godot_string *p_self); +const char32_t GDAPI *godot_string_to_utf32_chars(const godot_string *p_self); +const wchar_t GDAPI *godot_string_to_wide_chars(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_float(const char *p_what); -double GDAPI godot_string_wchar_to_float(const wchar_t *p_str, const wchar_t **r_end); - -godot_int GDAPI godot_string_char_to_int(const char *p_what); -godot_int 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); -godot_int GDAPI godot_string_wchar_to_int_with_len(const wchar_t *p_str, int p_len); - -godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, const godot_string *p_splitter); -godot_string GDAPI godot_string_get_slice(const godot_string *p_self, const godot_string *p_splitter, godot_int p_slice); -godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, godot_char_type p_splitter, godot_int p_slice); - -godot_packed_string_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_string_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_string_array GDAPI godot_string_split_with_maxsplit(const godot_string *p_self, const godot_string *p_splitter, const godot_bool p_allow_empty, const godot_int p_maxsplit); - -godot_packed_string_array GDAPI godot_string_rsplit(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_string_array GDAPI godot_string_rsplit_allow_empty(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_string_array GDAPI godot_string_rsplit_with_maxsplit(const godot_string *p_self, const godot_string *p_splitter, const godot_bool p_allow_empty, const godot_int p_maxsplit); - -godot_packed_float32_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_float32_array GDAPI godot_string_split_floats_allow_empty(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_float32_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_packed_string_array *p_splitters); -godot_packed_float32_array GDAPI godot_string_split_floats_mk_allow_empty(const godot_string *p_self, const godot_packed_string_array *p_splitters); -godot_packed_int32_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_int32_array GDAPI godot_string_split_ints_allow_empty(const godot_string *p_self, const godot_string *p_splitter); -godot_packed_int32_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_packed_string_array *p_splitters); -godot_packed_int32_array GDAPI godot_string_split_ints_mk_allow_empty(const godot_string *p_self, const godot_packed_string_array *p_splitters); - -godot_packed_string_array GDAPI godot_string_split_spaces(const godot_string *p_self); - -godot_char_type GDAPI godot_string_char_lowercase(godot_char_type p_char); -godot_char_type GDAPI godot_string_char_uppercase(godot_char_type p_char); -godot_string GDAPI godot_string_to_lower(const godot_string *p_self); -godot_string GDAPI godot_string_to_upper(const godot_string *p_self); - -godot_string GDAPI godot_string_get_basename(const godot_string *p_self); -godot_string GDAPI godot_string_get_extension(const godot_string *p_self); -godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos); -godot_char_type GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx); -godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file); -godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos); -godot_string GDAPI godot_string_repeat(const godot_string *p_self, godot_int p_count); -godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right); -godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self); - -void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars); - -godot_char_string GDAPI godot_string_ascii(const godot_string *p_self); -godot_char_string GDAPI godot_string_latin1(const godot_string *p_self); - -godot_char_string GDAPI godot_string_utf8(const godot_string *p_self); -godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8); -godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len); - -godot_char16_string GDAPI godot_string_utf16(const godot_string *p_self); -godot_bool GDAPI godot_string_parse_utf16(godot_string *p_self, const char16_t *p_utf16); -godot_bool GDAPI godot_string_parse_utf16_with_len(godot_string *p_self, const char16_t *p_utf16, godot_int p_len); - -uint32_t GDAPI godot_string_hash(const godot_string *p_self); -uint64_t GDAPI godot_string_hash64(const godot_string *p_self); - -uint32_t GDAPI godot_string_hash_chars(const char *p_cstr); -uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len); -uint32_t GDAPI godot_string_hash_wide_chars(const wchar_t *p_str); -uint32_t GDAPI godot_string_hash_wide_chars_with_len(const wchar_t *p_str, godot_int p_len); - -godot_packed_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self); -godot_string GDAPI godot_string_md5_text(const godot_string *p_self); -godot_packed_byte_array GDAPI godot_string_sha1_buffer(const godot_string *p_self); -godot_string GDAPI godot_string_sha1_text(const godot_string *p_self); -godot_packed_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self); -godot_string GDAPI godot_string_sha256_text(const godot_string *p_self); - -godot_bool godot_string_empty(const godot_string *p_self); - -// path functions -godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self); -godot_string GDAPI godot_string_get_file(const godot_string *p_self); -godot_string GDAPI godot_string_humanize_size(size_t p_size); -godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self); -godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self); -godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self); -godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path); -godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path); -godot_string GDAPI godot_string_simplify_path(const godot_string *p_self); - -godot_string GDAPI godot_string_c_escape(const godot_string *p_self); -godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self); -godot_string GDAPI godot_string_c_unescape(const godot_string *p_self); -godot_string GDAPI godot_string_http_escape(const godot_string *p_self); -godot_string GDAPI godot_string_http_unescape(const godot_string *p_self); -godot_string GDAPI godot_string_json_escape(const godot_string *p_self); -godot_string GDAPI godot_string_xml_escape(const godot_string *p_self); -godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self); -godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self); - -godot_string GDAPI godot_string_percent_decode(const godot_string *p_self); -godot_string GDAPI godot_string_percent_encode(const godot_string *p_self); -godot_string GDAPI godot_string_join(const godot_string *p_self, const godot_packed_string_array *p_parts); - -godot_bool GDAPI godot_string_is_valid_filename(const godot_string *p_self); -godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self); -godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix); -godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self); -godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self); -godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self); -godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self); - -godot_string GDAPI godot_string_dedent(const godot_string *p_self); -godot_string GDAPI godot_string_trim_prefix(const godot_string *p_self, const godot_string *p_prefix); -godot_string GDAPI godot_string_trim_suffix(const godot_string *p_self, const godot_string *p_suffix); -godot_string GDAPI godot_string_lstrip(const godot_string *p_self, const godot_string *p_chars); -godot_string GDAPI godot_string_rstrip(const godot_string *p_self, const godot_string *p_chars); - -void GDAPI godot_string_destroy(godot_string *p_self); +char32_t GDAPI *godot_string_operator_index(godot_string *p_self, godot_int p_index); +const char32_t GDAPI *godot_string_operator_index_const(const godot_string *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/string_name.h b/modules/gdnative/include/gdnative/string_name.h index f2555ab98f..346f626e81 100644 --- a/modules/gdnative/include/gdnative/string_name.h +++ b/modules/gdnative/include/gdnative/string_name.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -47,30 +47,14 @@ typedef struct { } godot_string_name; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_string_name_new(godot_string_name *r_dest, const godot_string *p_name); -void GDAPI godot_string_name_new_data(godot_string_name *r_dest, const char *p_name); - -godot_string GDAPI godot_string_name_get_name(const godot_string_name *p_self); - -uint32_t GDAPI godot_string_name_get_hash(const godot_string_name *p_self); -const void GDAPI *godot_string_name_get_data_unique_pointer(const godot_string_name *p_self); - -godot_bool GDAPI godot_string_name_operator_equal(const godot_string_name *p_self, const godot_string_name *p_other); -godot_bool GDAPI godot_string_name_operator_less(const godot_string_name *p_self, const godot_string_name *p_other); - +void GDAPI godot_string_name_new(godot_string_name *r_dest); +void GDAPI godot_string_name_new_copy(godot_string_name *r_dest, const godot_string_name *p_src); void GDAPI godot_string_name_destroy(godot_string_name *p_self); +void GDAPI godot_string_name_new_with_latin1_chars(godot_string_name *r_dest, const char *p_contents); + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h deleted file mode 100644 index bc51438b17..0000000000 --- a/modules/gdnative/include/gdnative/transform.h +++ /dev/null @@ -1,111 +0,0 @@ -/*************************************************************************/ -/* transform.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GODOT_TRANSFORM_H -#define GODOT_TRANSFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#define GODOT_TRANSFORM_SIZE 48 - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_TRANSFORM_SIZE]; -} godot_transform; -#endif - -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/basis.h> -#include <gdnative/gdnative.h> -#include <gdnative/variant.h> -#include <gdnative/vector3.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin); -void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); -void GDAPI godot_transform_new_with_quat(godot_transform *r_dest, const godot_quat *p_quat); - -godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self); -void GDAPI godot_transform_set_basis(godot_transform *p_self, const godot_basis *p_v); - -godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self); -void GDAPI godot_transform_set_origin(godot_transform *p_self, const godot_vector3 *p_v); - -godot_string GDAPI godot_transform_as_string(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - -godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale); - -godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs); - -godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up); - -godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v); - -godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v); - -void GDAPI godot_transform_new_identity(godot_transform *r_dest); - -godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b); - -godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b); - -godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v); - -godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v); - -godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_TRANSFORM_H diff --git a/modules/gdnative/include/gdnative/transform2d.h b/modules/gdnative/include/gdnative/transform2d.h index 6b414ca7b2..5acb172081 100644 --- a/modules/gdnative/include/gdnative/transform2d.h +++ b/modules/gdnative/include/gdnative/transform2d.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,9 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_TRANSFORM2D_SIZE 24 +#define GODOT_TRANSFORM2D_SIZE (sizeof(godot_real_t) * 6) #ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED #define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED @@ -46,61 +46,12 @@ typedef struct { } godot_transform2d; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#include <gdnative/variant.h> -#include <gdnative/vector2.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos); -void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin); - -godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self); - -godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self); - -godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self); - -godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi); - -godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale); - -godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset); - -godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c); - -godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b); - -godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b); - -void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest); - -godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v); -godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v); +void GDAPI godot_transform2d_new(godot_transform2d *p_self); +void GDAPI godot_transform2d_new_copy(godot_transform2d *r_dest, const godot_transform2d *p_src); +godot_vector2 GDAPI *godot_transform2d_operator_index(godot_transform2d *p_self, godot_int p_index); +const godot_vector2 GDAPI *godot_transform2d_operator_index_const(const godot_transform2d *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/transform_3d.h b/modules/gdnative/include/gdnative/transform_3d.h new file mode 100644 index 0000000000..97ad451e9b --- /dev/null +++ b/modules/gdnative/include/gdnative/transform_3d.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* transform_3d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_TRANSFORM3D_H +#define GODOT_TRANSFORM3D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <gdnative/math_defs.h> + +#define GODOT_TRANSFORM3D_SIZE (sizeof(godot_real_t) * 12) + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM3D_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_TRANSFORM3D_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_TRANSFORM3D_SIZE]; +} godot_transform3d; +#endif + +#include <gdnative/gdnative.h> + +void GDAPI godot_transform3d_new(godot_transform3d *p_self); +void GDAPI godot_transform3d_new_copy(godot_transform3d *r_dest, const godot_transform3d *p_src); +godot_vector3 GDAPI *godot_transform3d_operator_index(godot_transform3d *p_self, godot_int p_index); +const godot_vector3 GDAPI *godot_transform3d_operator_index_const(const godot_transform3d *p_self, godot_int p_index); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_TRANSFORM3D_H diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 0a611b76e9..a88bd2878a 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,16 +35,8 @@ extern "C" { #endif -#include <stdint.h> - -#define GODOT_VARIANT_SIZE (16 + sizeof(int64_t)) - -#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_VARIANT_SIZE]; -} godot_variant; -#endif +#include <gdnative/math_defs.h> +#include <gdnative/variant_struct.h> typedef enum godot_variant_type { GODOT_VARIANT_TYPE_NIL, @@ -52,7 +44,7 @@ typedef enum godot_variant_type { // atomic types GODOT_VARIANT_TYPE_BOOL, GODOT_VARIANT_TYPE_INT, - GODOT_VARIANT_TYPE_REAL, + GODOT_VARIANT_TYPE_FLOAT, GODOT_VARIANT_TYPE_STRING, // math types @@ -64,10 +56,10 @@ typedef enum godot_variant_type { GODOT_VARIANT_TYPE_VECTOR3I, GODOT_VARIANT_TYPE_TRANSFORM2D, GODOT_VARIANT_TYPE_PLANE, - GODOT_VARIANT_TYPE_QUAT, + GODOT_VARIANT_TYPE_QUATERNION, GODOT_VARIANT_TYPE_AABB, GODOT_VARIANT_TYPE_BASIS, - GODOT_VARIANT_TYPE_TRANSFORM, + GODOT_VARIANT_TYPE_TRANSFORM3D, // misc types GODOT_VARIANT_TYPE_COLOR, @@ -146,10 +138,35 @@ typedef enum godot_variant_operator { GODOT_VARIANT_OP_MAX, } godot_variant_operator; -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif +typedef enum godot_variant_utility_function_type { + GODOT_UTILITY_FUNC_TYPE_MATH, + GODOT_UTILITY_FUNC_TYPE_RANDOM, + GODOT_UTILITY_FUNC_TYPE_GENERAL, +} godot_variant_utility_function_type; + +// Types for function pointers. +typedef void (*godot_validated_operator_evaluator)(const godot_variant *p_left, const godot_variant *p_right, godot_variant *r_result); +typedef void (*godot_ptr_operator_evaluator)(const void *p_left, const void *p_right, void *r_result); +typedef void (*godot_validated_builtin_method)(godot_variant *p_base, const godot_variant **p_args, int p_argument_count, godot_variant *r_return); +typedef void (*godot_ptr_builtin_method)(void *p_base, const void **p_args, void *r_return, int p_argument_count); +typedef void (*godot_validated_constructor)(godot_variant *p_base, const godot_variant **p_args); +typedef void (*godot_ptr_constructor)(void *p_base, const void **p_args); +typedef void (*godot_validated_setter)(godot_variant *p_base, const godot_variant *p_value); +typedef void (*godot_validated_getter)(const godot_variant *p_base, godot_variant *r_value); +typedef void (*godot_ptr_setter)(void *p_base, const void *p_value); +typedef void (*godot_ptr_getter)(const void *p_base, void *r_value); +typedef void (*godot_validated_indexed_setter)(godot_variant *p_base, godot_int p_index, const godot_variant *p_value, bool *r_oob); +typedef void (*godot_validated_indexed_getter)(const godot_variant *p_base, godot_int p_index, godot_variant *r_value, bool *r_oob); +typedef void (*godot_ptr_indexed_setter)(void *p_base, godot_int p_index, const void *p_value); +typedef void (*godot_ptr_indexed_getter)(const void *p_base, godot_int p_index, void *r_value); +typedef void (*godot_validated_keyed_setter)(godot_variant *p_base, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid); +typedef void (*godot_validated_keyed_getter)(const godot_variant *p_base, const godot_variant *p_key, godot_variant *r_value, bool *r_valid); +typedef bool (*godot_validated_keyed_checker)(const godot_variant *p_base, const godot_variant *p_key, bool *r_valid); +typedef void (*godot_ptr_keyed_setter)(void *p_base, const void *p_key, const void *p_value); +typedef void (*godot_ptr_keyed_getter)(const void *p_base, const void *p_key, void *r_value); +typedef uint32_t (*godot_ptr_keyed_checker)(const godot_variant *p_base, const godot_variant *p_key); +typedef void (*godot_validated_utility_function)(godot_variant *r_return, const godot_variant **p_arguments, int p_argument_count); +typedef void (*godot_ptr_utility_function)(void *r_return, const void **p_arguments, int p_argument_count); #include <gdnative/aabb.h> #include <gdnative/array.h> @@ -160,35 +177,29 @@ typedef enum godot_variant_operator { #include <gdnative/node_path.h> #include <gdnative/packed_arrays.h> #include <gdnative/plane.h> -#include <gdnative/quat.h> +#include <gdnative/quaternion.h> #include <gdnative/rect2.h> #include <gdnative/rid.h> +#include <gdnative/signal.h> #include <gdnative/string.h> #include <gdnative/string_name.h> -#include <gdnative/transform.h> #include <gdnative/transform2d.h> +#include <gdnative/transform_3d.h> #include <gdnative/variant.h> #include <gdnative/vector2.h> #include <gdnative/vector3.h> #include <gdnative/gdnative.h> -#ifdef __cplusplus -extern "C" { -#endif - -godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v); +// Memory. void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src); void GDAPI godot_variant_new_nil(godot_variant *r_dest); - void GDAPI godot_variant_new_bool(godot_variant *r_dest, const godot_bool p_b); -void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i); -void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i); -void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r); +void GDAPI godot_variant_new_int(godot_variant *r_dest, const godot_int p_i); +void GDAPI godot_variant_new_float(godot_variant *r_dest, const godot_float p_f); void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s); -void GDAPI godot_variant_new_string_name(godot_variant *r_dest, const godot_string_name *p_s); void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2); void GDAPI godot_variant_new_vector2i(godot_variant *r_dest, const godot_vector2i *p_v2); void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2); @@ -197,16 +208,17 @@ void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 void GDAPI godot_variant_new_vector3i(godot_variant *r_dest, const godot_vector3i *p_v3); void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d); void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane); -void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat); +void GDAPI godot_variant_new_quaternion(godot_variant *r_dest, const godot_quaternion *p_quaternion); void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb); void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis); -void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans); +void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans); void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color); +void GDAPI godot_variant_new_string_name(godot_variant *r_dest, const godot_string_name *p_s); void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np); void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid); +void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj); void GDAPI godot_variant_new_callable(godot_variant *r_dest, const godot_callable *p_callable); void GDAPI godot_variant_new_signal(godot_variant *r_dest, const godot_signal *p_signal); -void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj); void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict); void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr); void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godot_packed_byte_array *p_pba); @@ -220,11 +232,9 @@ void GDAPI godot_variant_new_packed_vector3_array(godot_variant *r_dest, const g void GDAPI godot_variant_new_packed_color_array(godot_variant *r_dest, const godot_packed_color_array *p_pca); godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self); -uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self); -int64_t GDAPI godot_variant_as_int(const godot_variant *p_self); -double GDAPI godot_variant_as_real(const godot_variant *p_self); +godot_int GDAPI godot_variant_as_int(const godot_variant *p_self); +godot_float GDAPI godot_variant_as_float(const godot_variant *p_self); godot_string GDAPI godot_variant_as_string(const godot_variant *p_self); -godot_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self); godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self); godot_vector2i GDAPI godot_variant_as_vector2i(const godot_variant *p_self); godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self); @@ -233,16 +243,17 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self); godot_vector3i GDAPI godot_variant_as_vector3i(const godot_variant *p_self); godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self); godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self); -godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self); +godot_quaternion GDAPI godot_variant_as_quaternion(const godot_variant *p_self); godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self); godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self); -godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self); +godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self); godot_color GDAPI godot_variant_as_color(const godot_variant *p_self); +godot_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self); godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self); godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self); +godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self); godot_callable GDAPI godot_variant_as_callable(const godot_variant *p_self); godot_signal GDAPI godot_variant_as_signal(const godot_variant *p_self); -godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self); godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self); godot_array GDAPI godot_variant_as_array(const godot_variant *p_self); godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_variant *p_self); @@ -255,24 +266,157 @@ godot_packed_vector2_array GDAPI godot_variant_as_packed_vector2_array(const god godot_packed_vector3_array GDAPI godot_variant_as_packed_vector3_array(const godot_variant *p_self); godot_packed_color_array GDAPI godot_variant_as_packed_color_array(const godot_variant *p_self); -godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error); - -godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method); - -godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other); -godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other); +void GDAPI godot_variant_destroy(godot_variant *p_self); -uint32_t GDAPI godot_variant_hash(const godot_variant *p_self); +// Dynamic interaction. + +void GDAPI godot_variant_call(godot_variant *p_self, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); +void GDAPI godot_variant_call_with_cstring(godot_variant *p_self, const char *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); +void GDAPI godot_variant_call_static(godot_variant_type p_type, const godot_string_name *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); +void GDAPI godot_variant_call_static_with_cstring(godot_variant_type p_type, const char *p_method, const godot_variant **p_args, const godot_int p_argument_count, godot_variant *r_return, godot_variant_call_error *r_error); +void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_return, bool *r_valid); +void GDAPI godot_variant_set(godot_variant *p_self, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid); +void GDAPI godot_variant_set_named(godot_variant *p_self, const godot_string_name *p_name, const godot_variant *p_value, bool *r_valid); +void GDAPI godot_variant_set_named_with_cstring(godot_variant *p_self, const char *p_name, const godot_variant *p_value, bool *r_valid); +void GDAPI godot_variant_set_keyed(godot_variant *p_self, const godot_variant *p_key, const godot_variant *p_value, bool *r_valid); +void GDAPI godot_variant_set_indexed(godot_variant *p_self, godot_int p_index, const godot_variant *p_value, bool *r_valid, bool *r_oob); +godot_variant GDAPI godot_variant_get(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid); +godot_variant GDAPI godot_variant_get_named(const godot_variant *p_self, const godot_string_name *p_key, bool *r_valid); +godot_variant GDAPI godot_variant_get_named_with_cstring(const godot_variant *p_self, const char *p_key, bool *r_valid); +godot_variant GDAPI godot_variant_get_keyed(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid); +godot_variant GDAPI godot_variant_get_indexed(const godot_variant *p_self, godot_int p_index, bool *r_valid, bool *r_oob); +/// Iteration. +bool GDAPI godot_variant_iter_init(const godot_variant *p_self, godot_variant *r_iter, bool *r_valid); +bool GDAPI godot_variant_iter_next(const godot_variant *p_self, godot_variant *r_iter, bool *r_valid); +godot_variant GDAPI godot_variant_iter_get(const godot_variant *p_self, godot_variant *r_iter, bool *r_valid); + +/// Variant functions. godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other); - godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self); - -void GDAPI godot_variant_destroy(godot_variant *p_self); - -// GDNative core 1.1 - -godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_op); -void GDAPI godot_variant_evaluate(godot_variant_operator p_op, const godot_variant *p_a, const godot_variant *p_b, godot_variant *r_ret, godot_bool *r_valid); +void GDAPI godot_variant_blend(const godot_variant *p_a, const godot_variant *p_b, float p_c, godot_variant *r_dst); +void GDAPI godot_variant_interpolate(const godot_variant *p_a, const godot_variant *p_b, float p_c, godot_variant *r_dst); +godot_variant GDAPI godot_variant_duplicate(const godot_variant *p_self, godot_bool p_deep); +godot_string GDAPI godot_variant_stringify(const godot_variant *p_self); + +// Discovery API. + +/// Operators. +godot_validated_operator_evaluator GDAPI godot_variant_get_validated_operator_evaluator(godot_variant_operator p_operator, godot_variant_type p_type_a, godot_variant_type p_type_b); +godot_ptr_operator_evaluator GDAPI godot_variant_get_ptr_operator_evaluator(godot_variant_operator p_operator, godot_variant_type p_type_a, godot_variant_type p_type_b); +godot_variant_type GDAPI godot_variant_get_operator_return_type(godot_variant_operator p_operator, godot_variant_type p_type_a, godot_variant_type p_type_b); +godot_string GDAPI godot_variant_get_operator_name(godot_variant_operator p_operator); + +/// Built-in methods. +bool GDAPI godot_variant_has_builtin_method(godot_variant_type p_type, const godot_string_name *p_method); +bool GDAPI godot_variant_has_builtin_method_with_cstring(godot_variant_type p_type, const char *p_method); +godot_validated_builtin_method GDAPI godot_variant_get_validated_builtin_method(godot_variant_type p_type, const godot_string_name *p_method); +godot_validated_builtin_method GDAPI godot_variant_get_validated_builtin_method_with_cstring(godot_variant_type p_type, const char *p_method); +godot_ptr_builtin_method GDAPI godot_variant_get_ptr_builtin_method(godot_variant_type p_type, const godot_string_name *p_method); +godot_ptr_builtin_method GDAPI godot_variant_get_ptr_builtin_method_with_cstring(godot_variant_type p_type, const char *p_method); +int GDAPI godot_variant_get_builtin_method_argument_count(godot_variant_type p_type, const godot_string_name *p_method); +int GDAPI godot_variant_get_builtin_method_argument_count_with_cstring(godot_variant_type p_type, const char *p_method); +godot_variant_type GDAPI godot_variant_get_builtin_method_argument_type(godot_variant_type p_type, const godot_string_name *p_method, int p_argument); +godot_variant_type GDAPI godot_variant_get_builtin_method_argument_type_with_cstring(godot_variant_type p_type, const char *p_method, int p_argument); +godot_string GDAPI godot_variant_get_builtin_method_argument_name(godot_variant_type p_type, const godot_string_name *p_method, int p_argument); +godot_string GDAPI godot_variant_get_builtin_method_argument_name_with_cstring(godot_variant_type p_type, const char *p_method, int p_argument); +bool GDAPI godot_variant_has_builtin_method_return_value(godot_variant_type p_type, const godot_string_name *p_method); +bool GDAPI godot_variant_has_builtin_method_return_value_with_cstring(godot_variant_type p_type, const char *p_method); +godot_variant_type GDAPI godot_variant_get_builtin_method_return_type(godot_variant_type p_type, const godot_string_name *p_method); +godot_variant_type GDAPI godot_variant_get_builtin_method_return_type_with_cstring(godot_variant_type p_type, const char *p_method); +bool GDAPI godot_variant_is_builtin_method_const(godot_variant_type p_type, const godot_string_name *p_method); +bool GDAPI godot_variant_is_builtin_method_const_with_cstring(godot_variant_type p_type, const char *p_method); +bool GDAPI godot_variant_is_builtin_method_static(godot_variant_type p_type, const godot_string_name *p_method); +bool GDAPI godot_variant_is_builtin_method_static_with_cstring(godot_variant_type p_type, const char *p_method); +bool GDAPI godot_variant_is_builtin_method_vararg(godot_variant_type p_type, const godot_string_name *p_method); +bool GDAPI godot_variant_is_builtin_method_vararg_with_cstring(godot_variant_type p_type, const char *p_method); +int GDAPI godot_variant_get_builtin_method_count(godot_variant_type p_type); +void GDAPI godot_variant_get_builtin_method_list(godot_variant_type p_type, godot_string_name *r_list); + +/// Constructors. +int GDAPI godot_variant_get_constructor_count(godot_variant_type p_type); +godot_validated_constructor GDAPI godot_variant_get_validated_constructor(godot_variant_type p_type, int p_constructor); +godot_ptr_constructor GDAPI godot_variant_get_ptr_constructor(godot_variant_type p_type, int p_constructor); +int GDAPI godot_variant_get_constructor_argument_count(godot_variant_type p_type, int p_constructor); +godot_variant_type GDAPI godot_variant_get_constructor_argument_type(godot_variant_type p_type, int p_constructor, int p_argument); +godot_string GDAPI godot_variant_get_constructor_argument_name(godot_variant_type p_type, int p_constructor, int p_argument); +void GDAPI godot_variant_construct(godot_variant_type p_type, godot_variant *p_base, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error); + +/// Properties. +godot_variant_type GDAPI godot_variant_get_member_type(godot_variant_type p_type, const godot_string_name *p_member); +godot_variant_type GDAPI godot_variant_get_member_type_with_cstring(godot_variant_type p_type, const char *p_member); +int GDAPI godot_variant_get_member_count(godot_variant_type p_type); +void GDAPI godot_variant_get_member_list(godot_variant_type p_type, godot_string_name *r_list); +godot_validated_setter GDAPI godot_variant_get_validated_setter(godot_variant_type p_type, const godot_string_name *p_member); +godot_validated_setter GDAPI godot_variant_get_validated_setter_with_cstring(godot_variant_type p_type, const char *p_member); +godot_validated_getter GDAPI godot_variant_get_validated_getter(godot_variant_type p_type, const godot_string_name *p_member); +godot_validated_getter GDAPI godot_variant_get_validated_getter_with_cstring(godot_variant_type p_type, const char *p_member); +godot_ptr_setter GDAPI godot_variant_get_ptr_setter(godot_variant_type p_type, const godot_string_name *p_member); +godot_ptr_setter GDAPI godot_variant_get_ptr_setter_with_cstring(godot_variant_type p_type, const char *p_member); +godot_ptr_getter GDAPI godot_variant_get_ptr_getter(godot_variant_type p_type, const godot_string_name *p_member); +godot_ptr_getter GDAPI godot_variant_get_ptr_getter_with_cstring(godot_variant_type p_type, const char *p_member); + +/// Indexing. +bool GDAPI godot_variant_has_indexing(godot_variant_type p_type); +godot_variant_type GDAPI godot_variant_get_indexed_element_type(godot_variant_type p_type); +godot_validated_indexed_setter GDAPI godot_variant_get_validated_indexed_setter(godot_variant_type p_type); +godot_validated_indexed_getter GDAPI godot_variant_get_validated_indexed_getter(godot_variant_type p_type); +godot_ptr_indexed_setter GDAPI godot_variant_get_ptr_indexed_setter(godot_variant_type p_type); +godot_ptr_indexed_getter GDAPI godot_variant_get_ptr_indexed_getter(godot_variant_type p_type); +uint64_t GDAPI godot_variant_get_indexed_size(const godot_variant *p_self); + +/// Keying. +bool GDAPI godot_variant_is_keyed(godot_variant_type p_type); +godot_validated_keyed_setter GDAPI godot_variant_get_validated_keyed_setter(godot_variant_type p_type); +godot_validated_keyed_getter GDAPI godot_variant_get_validated_keyed_getter(godot_variant_type p_type); +godot_validated_keyed_checker GDAPI godot_variant_get_validated_keyed_checker(godot_variant_type p_type); +godot_ptr_keyed_setter GDAPI godot_variant_get_ptr_keyed_setter(godot_variant_type p_type); +godot_ptr_keyed_getter GDAPI godot_variant_get_ptr_keyed_getter(godot_variant_type p_type); +godot_ptr_keyed_checker GDAPI godot_variant_get_ptr_keyed_checker(godot_variant_type p_type); + +/// Constants. +int GDAPI godot_variant_get_constants_count(godot_variant_type p_type); +void GDAPI godot_variant_get_constants_list(godot_variant_type p_type, godot_string_name *r_list); +bool GDAPI godot_variant_has_constant(godot_variant_type p_type, const godot_string_name *p_constant); +bool GDAPI godot_variant_has_constant_with_cstring(godot_variant_type p_type, const char *p_constant); +godot_variant GDAPI godot_variant_get_constant_value(godot_variant_type p_type, const godot_string_name *p_constant); +godot_variant GDAPI godot_variant_get_constant_value_with_cstring(godot_variant_type p_type, const char *p_constant); + +/// Utilities. +bool GDAPI godot_variant_has_utility_function(const godot_string_name *p_function); +bool GDAPI godot_variant_has_utility_function_with_cstring(const char *p_function); +void GDAPI godot_variant_call_utility_function(const godot_string_name *p_function, godot_variant *r_ret, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error); +void GDAPI godot_variant_call_utility_function_with_cstring(const char *p_function, godot_variant *r_ret, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error); +godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function(const godot_string_name *p_function); +godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function_with_cstring(const char *p_function); +godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function(const godot_string_name *p_function); +godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function_with_cstring(const char *p_function); +godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type(const godot_string_name *p_function); +godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type_with_cstring(const char *p_function); +int GDAPI godot_variant_get_utility_function_argument_count(const godot_string_name *p_function); +int GDAPI godot_variant_get_utility_function_argument_count_with_cstring(const char *p_function); +godot_variant_type GDAPI godot_variant_get_utility_function_argument_type(const godot_string_name *p_function, int p_argument); +godot_variant_type GDAPI godot_variant_get_utility_function_argument_type_with_cstring(const char *p_function, int p_argument); +godot_string GDAPI godot_variant_get_utility_function_argument_name(const godot_string_name *p_function, int p_argument); +godot_string GDAPI godot_variant_get_utility_function_argument_name_with_cstring(const char *p_function, int p_argument); +bool GDAPI godot_variant_has_utility_function_return_value(const godot_string_name *p_function); +bool GDAPI godot_variant_has_utility_function_return_value_with_cstring(const char *p_function); +godot_variant_type GDAPI godot_variant_get_utility_function_return_type(const godot_string_name *p_function); +godot_variant_type GDAPI godot_variant_get_utility_function_return_type_with_cstring(const char *p_function); +bool GDAPI godot_variant_is_utility_function_vararg(const godot_string_name *p_function); +bool GDAPI godot_variant_is_utility_function_vararg_with_cstring(const char *p_function); +int GDAPI godot_variant_get_utility_function_count(); +void GDAPI godot_variant_get_utility_function_list(godot_string_name *r_functions); + +// Introspection. + +godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self); +bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string_name *p_method); +bool GDAPI godot_variant_has_member(godot_variant_type p_type, const godot_string_name *p_member); +bool GDAPI godot_variant_has_key(const godot_variant *p_self, const godot_variant *p_key, bool *r_valid); + +godot_string GDAPI godot_variant_get_type_name(godot_variant_type p_type); +bool GDAPI godot_variant_can_convert(godot_variant_type p_from, godot_variant_type p_to); +bool GDAPI godot_variant_can_convert_strict(godot_variant_type p_from, godot_variant_type p_to); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/variant_struct.h b/modules/gdnative/include/gdnative/variant_struct.h new file mode 100644 index 0000000000..321c76c206 --- /dev/null +++ b/modules/gdnative/include/gdnative/variant_struct.h @@ -0,0 +1,53 @@ +/*************************************************************************/ +/* variant_struct.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_VARIANT_STRUCT_H +#define GODOT_VARIANT_STRUCT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <gdnative/math_defs.h> + +#define GODOT_VARIANT_SIZE (sizeof(godot_real_t) * 4 + sizeof(int64_t)) + +#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_VARIANT_SIZE]; +} godot_variant; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h index 35b02c5a75..00faffbad7 100644 --- a/modules/gdnative/include/gdnative/vector2.h +++ b/modules/gdnative/include/gdnative/vector2.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,9 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_VECTOR2_SIZE 8 +#define GODOT_VECTOR2_SIZE (sizeof(godot_real_t) * 2) #ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED #define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED @@ -46,7 +46,7 @@ typedef struct { } godot_vector2; #endif -#define GODOT_VECTOR2I_SIZE 8 +#define GODOT_VECTOR2I_SIZE (sizeof(int32_t) * 2) #ifndef GODOT_CORE_API_GODOT_VECTOR2I_TYPE_DEFINED #define GODOT_CORE_API_GODOT_VECTOR2I_TYPE_DEFINED @@ -55,140 +55,16 @@ typedef struct { } godot_vector2i; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - #include <gdnative/gdnative.h> -#ifdef __cplusplus -extern "C" { -#endif - -// Vector2 - -void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y); - -godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self); - -godot_vector2i GDAPI godot_vector2_as_vector2i(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self); - -godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_direction_to(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_vector2 GDAPI godot_vector2_lerp(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t); - -godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t); - -godot_vector2 GDAPI godot_vector2_move_toward(const godot_vector2 *p_self, const godot_vector2 *p_to, const godot_real p_delta); - -godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi); - -godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_sign(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by); - -godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with); - -godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n); - -godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n); - -godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n); - -godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length); - -godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b); - -godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b); - -godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self); - -void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x); - -void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y); - -godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self); - -// Vector2i - -void GDAPI godot_vector2i_new(godot_vector2i *r_dest, const godot_int p_x, const godot_int p_y); - -godot_string GDAPI godot_vector2i_as_string(const godot_vector2i *p_self); - -godot_vector2 GDAPI godot_vector2i_as_vector2(const godot_vector2i *p_self); - -godot_real GDAPI godot_vector2i_aspect(const godot_vector2i *p_self); - -godot_vector2i GDAPI godot_vector2i_abs(const godot_vector2i *p_self); - -godot_vector2i GDAPI godot_vector2i_sign(const godot_vector2i *p_self); - -godot_vector2i GDAPI godot_vector2i_operator_add(const godot_vector2i *p_self, const godot_vector2i *p_b); - -godot_vector2i GDAPI godot_vector2i_operator_subtract(const godot_vector2i *p_self, const godot_vector2i *p_b); - -godot_vector2i GDAPI godot_vector2i_operator_multiply_vector(const godot_vector2i *p_self, const godot_vector2i *p_b); - -godot_vector2i GDAPI godot_vector2i_operator_multiply_scalar(const godot_vector2i *p_self, const godot_int p_b); - -godot_vector2i GDAPI godot_vector2i_operator_divide_vector(const godot_vector2i *p_self, const godot_vector2i *p_b); - -godot_vector2i GDAPI godot_vector2i_operator_divide_scalar(const godot_vector2i *p_self, const godot_int p_b); - -godot_bool GDAPI godot_vector2i_operator_equal(const godot_vector2i *p_self, const godot_vector2i *p_b); - -godot_bool GDAPI godot_vector2i_operator_less(const godot_vector2i *p_self, const godot_vector2i *p_b); - -godot_vector2i GDAPI godot_vector2i_operator_neg(const godot_vector2i *p_self); - -void GDAPI godot_vector2i_set_x(godot_vector2i *p_self, const godot_int p_x); - -void GDAPI godot_vector2i_set_y(godot_vector2i *p_self, const godot_int p_y); - -godot_int GDAPI godot_vector2i_get_x(const godot_vector2i *p_self); - -godot_int GDAPI godot_vector2i_get_y(const godot_vector2i *p_self); +void GDAPI godot_vector2_new(godot_vector2 *p_self); +void GDAPI godot_vector2_new_copy(godot_vector2 *r_dest, const godot_vector2 *p_src); +void GDAPI godot_vector2i_new(godot_vector2i *p_self); +void GDAPI godot_vector2i_new_copy(godot_vector2i *r_dest, const godot_vector2i *p_src); +godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index); +const godot_real_t GDAPI *godot_vector2_operator_index_const(const godot_vector2 *p_self, godot_int p_index); +int32_t GDAPI *godot_vector2i_operator_index(godot_vector2i *p_self, godot_int p_index); +const int32_t GDAPI *godot_vector2i_operator_index_const(const godot_vector2i *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h index 5127b8789b..7db093ce52 100644 --- a/modules/gdnative/include/gdnative/vector3.h +++ b/modules/gdnative/include/gdnative/vector3.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -35,9 +35,9 @@ extern "C" { #endif -#include <stdint.h> +#include <gdnative/math_defs.h> -#define GODOT_VECTOR3_SIZE 12 +#define GODOT_VECTOR3_SIZE (sizeof(godot_real_t) * 3) #ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED #define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED @@ -46,7 +46,7 @@ typedef struct { } godot_vector3; #endif -#define GODOT_VECTOR3I_SIZE 12 +#define GODOT_VECTOR3I_SIZE (sizeof(int32_t) * 3) #ifndef GODOT_CORE_API_GODOT_VECTOR3I_TYPE_DEFINED #define GODOT_CORE_API_GODOT_VECTOR3I_TYPE_DEFINED @@ -55,145 +55,16 @@ typedef struct { } godot_vector3i; #endif -// reduce extern "C" nesting for VS2013 -#ifdef __cplusplus -} -#endif - -#include <gdnative/basis.h> #include <gdnative/gdnative.h> -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - GODOT_VECTOR3_AXIS_X, - GODOT_VECTOR3_AXIS_Y, - GODOT_VECTOR3_AXIS_Z, -} godot_vector3_axis; - -// Vector3 - -void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z); - -godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self); - -godot_vector3i GDAPI godot_vector3_as_vector3i(const godot_vector3 *p_self); - -godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self); - -godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self); - -godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self); - -godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self); - -godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_vector3 *p_by); - -godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - -godot_vector3 GDAPI godot_vector3_lerp(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t); - -godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t); - -godot_vector3 GDAPI godot_vector3_move_toward(const godot_vector3 *p_self, const godot_vector3 *p_to, const godot_real p_delta); - -godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_sign(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_direction_to(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to); - -godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n); - -godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n); - -godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n); - -godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b); - -godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b); - -godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self); - -void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val); - -godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis); - -// Vector3i - -void GDAPI godot_vector3i_new(godot_vector3i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_z); - -godot_string GDAPI godot_vector3i_as_string(const godot_vector3i *p_self); - -godot_vector3 GDAPI godot_vector3i_as_vector3(const godot_vector3i *p_self); - -godot_int GDAPI godot_vector3i_min_axis(const godot_vector3i *p_self); - -godot_int GDAPI godot_vector3i_max_axis(const godot_vector3i *p_self); - -godot_vector3i GDAPI godot_vector3i_abs(const godot_vector3i *p_self); - -godot_vector3i GDAPI godot_vector3i_sign(const godot_vector3i *p_self); - -godot_vector3i GDAPI godot_vector3i_operator_add(const godot_vector3i *p_self, const godot_vector3i *p_b); - -godot_vector3i GDAPI godot_vector3i_operator_subtract(const godot_vector3i *p_self, const godot_vector3i *p_b); - -godot_vector3i GDAPI godot_vector3i_operator_multiply_vector(const godot_vector3i *p_self, const godot_vector3i *p_b); - -godot_vector3i GDAPI godot_vector3i_operator_multiply_scalar(const godot_vector3i *p_self, const godot_int p_b); - -godot_vector3i GDAPI godot_vector3i_operator_divide_vector(const godot_vector3i *p_self, const godot_vector3i *p_b); - -godot_vector3i GDAPI godot_vector3i_operator_divide_scalar(const godot_vector3i *p_self, const godot_int p_b); - -godot_bool GDAPI godot_vector3i_operator_equal(const godot_vector3i *p_self, const godot_vector3i *p_b); - -godot_bool GDAPI godot_vector3i_operator_less(const godot_vector3i *p_self, const godot_vector3i *p_b); - -godot_vector3i GDAPI godot_vector3i_operator_neg(const godot_vector3i *p_self); - -void GDAPI godot_vector3i_set_axis(godot_vector3i *p_self, const godot_vector3_axis p_axis, const godot_int p_val); - -godot_int GDAPI godot_vector3i_get_axis(const godot_vector3i *p_self, const godot_vector3_axis p_axis); +void GDAPI godot_vector3_new(godot_vector3 *p_self); +void GDAPI godot_vector3_new_copy(godot_vector3 *r_dest, const godot_vector3 *p_src); +void GDAPI godot_vector3i_new(godot_vector3i *p_self); +void GDAPI godot_vector3i_new_copy(godot_vector3i *r_dest, const godot_vector3i *p_src); +godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index); +const godot_real_t GDAPI *godot_vector3_operator_index_const(const godot_vector3 *p_self, godot_int p_index); +int32_t GDAPI *godot_vector3i_operator_index(godot_vector3i *p_self, godot_int p_index); +const int32_t GDAPI *godot_vector3i_operator_index_const(const godot_vector3i *p_self, godot_int p_index); #ifdef __cplusplus } diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h index 825033c99c..09eac2492f 100644 --- a/modules/gdnative/include/nativescript/godot_nativescript.h +++ b/modules/gdnative/include/nativescript/godot_nativescript.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -39,12 +39,8 @@ extern "C" { typedef enum { GODOT_METHOD_RPC_MODE_DISABLED, - GODOT_METHOD_RPC_MODE_REMOTE, - GODOT_METHOD_RPC_MODE_MASTER, - GODOT_METHOD_RPC_MODE_PUPPET, - GODOT_METHOD_RPC_MODE_REMOTESYNC, - GODOT_METHOD_RPC_MODE_MASTERSYNC, - GODOT_METHOD_RPC_MODE_PUPPETSYNC, + GODOT_METHOD_RPC_MODE_ANY, + GODOT_METHOD_RPC_MODE_AUTHORITY, } godot_nativescript_method_rpc_mode; typedef enum { @@ -58,8 +54,10 @@ typedef enum { GODOT_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags) GODOT_PROPERTY_HINT_LAYERS_2D_RENDER, GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS, + GODOT_PROPERTY_HINT_LAYERS_2D_NAVIGATION, GODOT_PROPERTY_HINT_LAYERS_3D_RENDER, GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS, + GODOT_PROPERTY_HINT_LAYERS_3D_NAVIGATION, GODOT_PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," GODOT_PROPERTY_HINT_DIR, ///< a directory path must be passed GODOT_PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc," @@ -85,7 +83,6 @@ typedef enum { } godot_nativescript_property_hint; typedef enum { - GODOT_PROPERTY_USAGE_STORAGE = 1, GODOT_PROPERTY_USAGE_EDITOR = 2, GODOT_PROPERTY_USAGE_NETWORK = 4, diff --git a/modules/gdnative/include/net/godot_net.h b/modules/gdnative/include/net/godot_net.h index 42804112f2..3fb7b9e1cc 100644 --- a/modules/gdnative/include/net/godot_net.h +++ b/modules/gdnative/include/net/godot_net.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -90,7 +90,9 @@ typedef struct { godot_int (*get_available_packet_count)(const void *); godot_int (*get_max_packet_size)(const void *); - /* This is NetworkedMultiplayerPeer */ + /* This is MultiplayerPeer */ + void (*set_transfer_channel)(void *, godot_int); + godot_int (*get_transfer_channel)(void *); void (*set_transfer_mode)(void *, godot_int); godot_int (*get_transfer_mode)(const void *); // 0 = broadcast, 1 = server, <0 = all but abs(value) diff --git a/modules/gdnative/include/net/godot_webrtc.h b/modules/gdnative/include/net/godot_webrtc.h index 15e2df85cc..52006e56ec 100644 --- a/modules/gdnative/include/net/godot_webrtc.h +++ b/modules/gdnative/include/net/godot_webrtc.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -37,8 +37,8 @@ extern "C" { #endif -#define GODOT_NET_WEBRTC_API_MAJOR 3 -#define GODOT_NET_WEBRTC_API_MINOR 2 +#define GODOT_NET_WEBRTC_API_MAJOR 4 +#define GODOT_NET_WEBRTC_API_MINOR 0 /* Library Interface (used to set default GDNative WebRTC implementation */ typedef struct { @@ -101,6 +101,7 @@ typedef struct { int (*get_max_retransmits)(const void *); const char *(*get_protocol)(const void *); bool (*is_negotiated)(const void *); + int (*get_buffered_amount)(const void *); godot_error (*poll)(void *); void (*close)(void *); diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h index 406c3ba663..02ee4066d0 100644 --- a/modules/gdnative/include/pluginscript/godot_pluginscript.h +++ b/modules/gdnative/include/pluginscript/godot_pluginscript.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -56,11 +56,12 @@ typedef struct { int p_argcount, godot_variant_call_error *r_error); void (*notification)(godot_pluginscript_instance_data *p_data, int p_notification); + godot_string (*to_string)(godot_pluginscript_instance_data *p_data, godot_bool *r_valid); //this is used by script languages that keep a reference counter of their own //you can make make Ref<> not die when it reaches zero, so deleting the reference //depends entirely from the script. - // Note: You can set those function pointer to nullptr if not needed. + // Note: You can set those function pointer to nullptr if not needed. void (*refcount_incremented)(godot_pluginscript_instance_data *p_data); bool (*refcount_decremented)(godot_pluginscript_instance_data *p_data); // return true if it can die } godot_pluginscript_instance_desc; @@ -72,6 +73,7 @@ typedef struct { godot_string_name name; godot_bool is_tool; godot_string_name base; + godot_string icon_path; // Member lines format: {<string>: <int>} godot_dictionary member_lines; @@ -119,17 +121,18 @@ typedef struct { const char *name; const char *type; const char *extension; - const char **recognized_extensions; // nullptr terminated array + const char **recognized_extensions; // nullptr terminated array godot_pluginscript_language_data *(*init)(); void (*finish)(godot_pluginscript_language_data *p_data); - const char **reserved_words; // nullptr terminated array - const char **comment_delimiters; // nullptr terminated array - const char **string_delimiters; // nullptr terminated array + const char **reserved_words; // nullptr terminated array + const char **comment_delimiters; // nullptr terminated array + const char **string_delimiters; // nullptr terminated array godot_bool has_named_classes; godot_bool supports_builtin_mode; + godot_bool can_inherit_from_file; godot_string (*get_template_source_code)(godot_pluginscript_language_data *p_data, const godot_string *p_class_name, const godot_string *p_base_class_name); - godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, int *r_line_error, int *r_col_error, godot_string *r_test_error, const godot_string *p_path, godot_packed_string_array *r_functions); + godot_bool (*validate)(godot_pluginscript_language_data *p_data, const godot_string *p_script, const godot_string *p_path, godot_packed_string_array *r_functions, godot_array *r_errors); // errors = Array of Dictionary with "line", "column", "message" keys int (*find_function)(godot_pluginscript_language_data *p_data, const godot_string *p_function, const godot_string *p_code); // Can be nullptr godot_string (*make_function)(godot_pluginscript_language_data *p_data, const godot_string *p_class, const godot_string *p_name, const godot_packed_string_array *p_args); godot_error (*complete_code)(godot_pluginscript_language_data *p_data, const godot_string *p_code, const godot_string *p_path, godot_object *p_owner, godot_array *r_options, godot_bool *r_force, godot_string *r_call_hint); diff --git a/modules/gdnative/include/text/godot_text.h b/modules/gdnative/include/text/godot_text.h new file mode 100644 index 0000000000..940cfd11f8 --- /dev/null +++ b/modules/gdnative/include/text/godot_text.h @@ -0,0 +1,283 @@ +/*************************************************************************/ +/* godot_text.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_NATIVETEXT_H +#define GODOT_NATIVETEXT_H + +#include <gdnative/gdnative.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#define GODOT_TEXT_API_MAJOR 1 +#define GODOT_TEXT_API_MINOR 0 + +#define GODOT_GLYPH_SIZE 40 + +#ifndef GODOT_TEXT_API_GODOT_GLYPH_TYPE_DEFINED +#define GODOT_TEXT_API_GODOT_GLYPH_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_GLYPH_SIZE]; +} godot_glyph; +#endif + +#define GODOT_PACKED_GLYPH_ARRAY_SIZE (2 * sizeof(void *)) + +#ifndef GODOT_TEXT_API_GODOT_PACKED_GLYPH_ARRAY_TYPE_DEFINED +#define GODOT_TEXT_API_GODOT_PACKED_GLYPH_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_PACKED_GLYPH_ARRAY_SIZE]; +} godot_packed_glyph_array; +#endif + +typedef struct { + godot_gdnative_api_version version; + + void *(*constructor)(godot_object *); + void (*destructor)(void *); + + godot_string (*get_name)(const void *); + godot_bool (*has_feature)(const void *, godot_int); + + void (*free)(void *, godot_rid *); + bool (*has)(void *, godot_rid *); + + bool (*load_support_data)(void *, const godot_string *); + godot_string (*get_support_data_filename)(const void *); + godot_string (*get_support_data_info)(const void *); + bool (*save_support_data)(void *, const godot_string *); + + bool (*is_locale_right_to_left)(void *, const godot_string *); + int32_t (*name_to_tag)(const void *, const godot_string *); + godot_string (*tag_to_name)(const void *, int32_t); + + godot_rid (*create_font)(void *); + void (*font_set_data)(void *, godot_rid *, const godot_packed_byte_array *); + void (*font_set_data_ptr)(void *, godot_rid *, const uint8_t *, size_t); + void (*font_set_antialiased)(void *, godot_rid *, bool); + bool (*font_is_antialiased)(const void *, godot_rid *); + void (*font_set_multichannel_signed_distance_field)(void *, godot_rid *, bool); + bool (*font_is_multichannel_signed_distance_field)(const void *, godot_rid *); + void (*font_set_msdf_pixel_range)(void *, godot_rid *, godot_int); + godot_int (*font_get_msdf_pixel_range)(const void *, godot_rid *); + void (*font_set_msdf_size)(void *, godot_rid *, godot_int); + godot_int (*font_get_msdf_size)(const void *, godot_rid *); + void (*font_set_fixed_size)(void *, godot_rid *, godot_int); + godot_int (*font_get_fixed_size)(const void *, godot_rid *); + void (*font_set_force_autohinter)(void *, godot_rid *, bool); + bool (*font_is_force_autohinter)(const void *, godot_rid *); + void (*font_set_hinting)(void *, godot_rid *, godot_int); + godot_int (*font_get_hinting)(const void *, godot_rid *); + void (*font_set_variation_coordinates)(void *, godot_rid *, const godot_dictionary *); + godot_dictionary (*font_get_variation_coordinates)(const void *, godot_rid *); + void (*font_set_oversampling)(void *, godot_rid *, godot_real_t); + godot_real_t (*font_get_oversampling)(const void *, godot_rid *); + godot_array (*font_get_size_cache_list)(const void *, godot_rid *); + void (*font_clear_size_cache)(void *, godot_rid *); + void (*font_remove_size_cache)(void *, godot_rid *, const godot_vector2i *); + void (*font_set_ascent)(void *, godot_rid *, godot_int, godot_real_t); + godot_real_t (*font_get_ascent)(const void *, godot_rid *, godot_int); + void (*font_set_descent)(void *, godot_rid *, godot_int, godot_real_t); + godot_real_t (*font_get_descent)(const void *, godot_rid *, godot_int); + void (*font_set_underline_position)(void *, godot_rid *, godot_int, godot_real_t); + godot_real_t (*font_get_underline_position)(const void *, godot_rid *, godot_int); + void (*font_set_underline_thickness)(void *, godot_rid *, godot_int, godot_real_t); + godot_real_t (*font_get_underline_thickness)(const void *, godot_rid *, godot_int); + void (*font_set_scale)(void *, godot_rid *, godot_int, godot_real_t); + godot_real_t (*font_get_scale)(const void *, godot_rid *, godot_int); + void (*font_set_spacing)(void *, godot_rid *, godot_int, godot_int, godot_int); + godot_int (*font_get_spacing)(const void *, godot_rid *, godot_int, godot_int); + godot_int (*font_get_texture_count)(const void *, godot_rid *, const godot_vector2i *); + void (*font_clear_textures)(void *, godot_rid *, const godot_vector2i *); + void (*font_remove_texture)(void *, godot_rid *, const godot_vector2i *, godot_int); + void (*font_set_texture_image)(void *, godot_rid *, const godot_vector2i *, godot_int, const godot_object *); + godot_object *(*font_get_texture_image)(const void *, godot_rid *, const godot_vector2i *, godot_int); + void (*font_set_texture_offsets)(void *, godot_rid *, const godot_vector2i *, godot_int, const godot_packed_int32_array *); + godot_packed_int32_array (*font_get_texture_offsets)(const void *, godot_rid *, const godot_vector2i *, godot_int); + godot_array (*font_get_glyph_list)(const void *, godot_rid *, const godot_vector2i *); + void (*font_clear_glyphs)(void *, godot_rid *, const godot_vector2i *); + void (*font_remove_glyph)(void *, godot_rid *, const godot_vector2i *, int32_t); + godot_vector2 (*font_get_glyph_advance)(const void *, godot_rid *, godot_int, int32_t); + void (*font_set_glyph_advance)(void *, godot_rid *, godot_int, int32_t, const godot_vector2 *); + godot_vector2 (*font_get_glyph_offset)(const void *, godot_rid *, const godot_vector2i *, int32_t); + void (*font_set_glyph_offset)(void *, godot_rid *, const godot_vector2i *, int32_t, const godot_vector2 *); + godot_vector2 (*font_get_glyph_size)(const void *, godot_rid *, const godot_vector2i *, int32_t); + void (*font_set_glyph_size)(void *, godot_rid *, const godot_vector2i *, int32_t, const godot_vector2 *); + godot_rect2 (*font_get_glyph_uv_rect)(const void *, godot_rid *, const godot_vector2i *, int32_t); + void (*font_set_glyph_uv_rect)(void *, godot_rid *, const godot_vector2i *, int32_t, const godot_rect2 *); + godot_int (*font_get_glyph_texture_idx)(const void *, godot_rid *, const godot_vector2i *, int32_t); + void (*font_set_glyph_texture_idx)(void *, godot_rid *, const godot_vector2i *, int32_t, godot_int); + bool (*font_get_glyph_contours)(const void *, godot_rid *, godot_int, int32_t, godot_packed_vector3_array *, godot_packed_int32_array *, bool *); + godot_array (*font_get_kerning_list)(const void *, godot_rid *, godot_int); + void (*font_clear_kerning_map)(void *, godot_rid *, godot_int); + void (*font_remove_kerning)(void *, godot_rid *, godot_int, const godot_vector2i *); + void (*font_set_kerning)(void *, godot_rid *, godot_int, const godot_vector2i *, const godot_vector2 *); + godot_vector2 (*font_get_kerning)(const void *, godot_rid *, godot_int, const godot_vector2i *); + int32_t (*font_get_glyph_index)(const void *, godot_rid *, godot_int, char32_t, char32_t); + bool (*font_has_char)(const void *, godot_rid *, char32_t); + godot_string (*font_get_supported_chars)(const void *, godot_rid *); + void (*font_render_range)(void *, godot_rid *, const godot_vector2i *, char32_t, char32_t); + void (*font_render_glyph)(void *, godot_rid *, const godot_vector2i *, int32_t); + void (*font_draw_glyph)(const void *, godot_rid *, godot_rid *, godot_int, const godot_vector2 *, int32_t, const godot_color *); + void (*font_draw_glyph_outline)(const void *, godot_rid *, godot_rid *, godot_int, godot_int, const godot_vector2 *, int32_t, const godot_color *); + bool (*font_is_language_supported)(const void *, godot_rid *, const godot_string *); + void (*font_set_language_support_override)(void *, godot_rid *, const godot_string *, bool); + bool (*font_get_language_support_override)(const void *, godot_rid *, const godot_string *); + void (*font_remove_language_support_override)(void *, godot_rid *, const godot_string *); + godot_packed_string_array (*font_get_language_support_overrides)(const void *, godot_rid *); + bool (*font_is_script_supported)(const void *, godot_rid *, const godot_string *); + void (*font_set_script_support_override)(void *, godot_rid *, const godot_string *, bool); + bool (*font_get_script_support_override)(const void *, godot_rid *, const godot_string *); + void (*font_remove_script_support_override)(void *, godot_rid *, const godot_string *); + godot_packed_string_array (*font_get_script_support_overrides)(const void *, godot_rid *); + godot_dictionary (*font_supported_feature_list)(const void *, godot_rid *); + godot_dictionary (*font_supported_variation_list)(const void *, godot_rid *); + godot_real_t (*font_get_global_oversampling)(const void *); + void (*font_set_global_oversampling)(void *, godot_real_t); + + godot_rid (*create_shaped_text)(void *, godot_int, godot_int); + void (*shaped_text_clear)(void *, godot_rid *); + void (*shaped_text_set_direction)(void *, godot_rid *, godot_int); + godot_int (*shaped_text_get_direction)(void *, godot_rid *); + void (*shaped_text_set_bidi_override)(void *, godot_rid *, const godot_packed_vector2i_array *); + void (*shaped_text_set_orientation)(void *, godot_rid *, godot_int); + godot_int (*shaped_text_get_orientation)(void *, godot_rid *); + void (*shaped_text_set_preserve_invalid)(void *, godot_rid *, bool); + bool (*shaped_text_get_preserve_invalid)(void *, godot_rid *); + void (*shaped_text_set_preserve_control)(void *, godot_rid *, bool); + bool (*shaped_text_get_preserve_control)(void *, godot_rid *); + bool (*shaped_text_add_string)(void *, godot_rid *, const godot_string *, const godot_rid **, int, const godot_dictionary *, const godot_string *); + bool (*shaped_text_add_object)(void *, godot_rid *, const godot_variant *, const godot_vector2 *, godot_int, godot_int); + bool (*shaped_text_resize_object)(void *, godot_rid *, const godot_variant *, const godot_vector2 *, godot_int); + godot_rid (*shaped_text_substr)(void *, godot_rid *, godot_int, godot_int); + godot_rid (*shaped_text_get_parent)(void *, godot_rid *); + godot_real_t (*shaped_text_fit_to_width)(void *, godot_rid *, godot_real_t, uint8_t); + godot_real_t (*shaped_text_tab_align)(void *, godot_rid *, godot_packed_float32_array *); + bool (*shaped_text_shape)(void *, godot_rid *); + bool (*shaped_text_update_breaks)(void *, godot_rid *); + bool (*shaped_text_update_justification_ops)(void *, godot_rid *); + void (*shaped_text_overrun_trim_to_width)(void *, godot_rid *, godot_real_t, uint8_t); + bool (*shaped_text_is_ready)(void *, godot_rid *); + godot_packed_glyph_array (*shaped_text_get_glyphs)(void *, godot_rid *); + godot_vector2i (*shaped_text_get_range)(void *, godot_rid *); + godot_packed_glyph_array (*shaped_text_sort_logical)(void *, godot_rid *); + godot_packed_vector2i_array (*shaped_text_get_line_breaks_adv)(void *, godot_rid *, godot_packed_float32_array *, int, bool, uint8_t); + godot_packed_vector2i_array (*shaped_text_get_line_breaks)(void *, godot_rid *, godot_real_t, int, uint8_t); + godot_packed_vector2i_array (*shaped_text_get_word_breaks)(void *, godot_rid *, int); + godot_array (*shaped_text_get_objects)(void *, godot_rid *); + godot_rect2 (*shaped_text_get_object_rect)(void *, godot_rid *, const godot_variant *); + godot_vector2 (*shaped_text_get_size)(void *, godot_rid *); + godot_real_t (*shaped_text_get_ascent)(void *, godot_rid *); + godot_real_t (*shaped_text_get_descent)(void *, godot_rid *); + godot_real_t (*shaped_text_get_width)(void *, godot_rid *); + godot_real_t (*shaped_text_get_underline_position)(void *, godot_rid *); + godot_real_t (*shaped_text_get_underline_thickness)(void *, godot_rid *); + + godot_string (*format_number)(void *, const godot_string *, const godot_string *); + godot_string (*parse_number)(void *, const godot_string *, const godot_string *); + godot_string (*percent_sign)(void *, const godot_string *); +} godot_text_interface_gdnative; + +void GDAPI godot_text_register_interface(const godot_text_interface_gdnative *p_interface, const godot_string *p_name, uint32_t p_features); + +// Glyph + +void GDAPI godot_glyph_new(godot_glyph *r_dest); + +godot_vector2i GDAPI godot_glyph_get_range(const godot_glyph *p_self); +void GDAPI godot_glyph_set_range(godot_glyph *p_self, const godot_vector2i *p_range); + +godot_int GDAPI godot_glyph_get_count(const godot_glyph *p_self); +void GDAPI godot_glyph_set_count(godot_glyph *p_self, godot_int p_count); + +godot_int GDAPI godot_glyph_get_repeat(const godot_glyph *p_self); +void GDAPI godot_glyph_set_repeat(godot_glyph *p_self, godot_int p_repeat); + +godot_int GDAPI godot_glyph_get_flags(const godot_glyph *p_self); +void GDAPI godot_glyph_set_flags(godot_glyph *p_self, godot_int p_flags); + +godot_vector2 GDAPI godot_glyph_get_offset(const godot_glyph *p_self); +void GDAPI godot_glyph_set_offset(godot_glyph *p_self, const godot_vector2 *p_offset); + +godot_real_t GDAPI godot_glyph_get_advance(const godot_glyph *p_self); +void GDAPI godot_glyph_set_advance(godot_glyph *p_self, godot_real_t p_advance); + +godot_rid GDAPI godot_glyph_get_font(const godot_glyph *p_self); +void GDAPI godot_glyph_set_font(godot_glyph *p_self, godot_rid *p_font); + +godot_int GDAPI godot_glyph_get_font_size(const godot_glyph *p_self); +void GDAPI godot_glyph_set_font_size(godot_glyph *p_self, godot_int p_size); + +godot_int GDAPI godot_glyph_get_index(const godot_glyph *p_self); +void GDAPI godot_glyph_set_index(godot_glyph *p_self, godot_int p_index); + +// GlyphArray + +void GDAPI godot_packed_glyph_array_new(godot_packed_glyph_array *r_dest); +void GDAPI godot_packed_glyph_array_new_copy(godot_packed_glyph_array *r_dest, const godot_packed_glyph_array *p_src); + +const godot_glyph GDAPI *godot_packed_glyph_array_ptr(const godot_packed_glyph_array *p_self); +godot_glyph GDAPI *godot_packed_glyph_array_ptrw(godot_packed_glyph_array *p_self); + +void GDAPI godot_packed_glyph_array_append(godot_packed_glyph_array *p_self, const godot_glyph *p_data); + +void GDAPI godot_packed_glyph_array_append_array(godot_packed_glyph_array *p_self, const godot_packed_glyph_array *p_array); + +godot_error GDAPI godot_packed_glyph_array_insert(godot_packed_glyph_array *p_self, const godot_int p_idx, const godot_glyph *p_data); + +godot_bool GDAPI godot_packed_glyph_array_has(godot_packed_glyph_array *p_self, const godot_glyph *p_value); + +void GDAPI godot_packed_glyph_array_sort(godot_packed_glyph_array *p_self); + +void GDAPI godot_packed_glyph_array_reverse(godot_packed_glyph_array *p_self); + +void GDAPI godot_packed_glyph_array_push_back(godot_packed_glyph_array *p_self, const godot_glyph *p_data); + +void GDAPI godot_packed_glyph_array_remove(godot_packed_glyph_array *p_self, godot_int p_idx); + +void GDAPI godot_packed_glyph_array_resize(godot_packed_glyph_array *p_self, godot_int p_size); + +void GDAPI godot_packed_glyph_array_set(godot_packed_glyph_array *p_self, godot_int p_idx, const godot_glyph *p_data); +godot_glyph GDAPI godot_packed_glyph_array_get(const godot_packed_glyph_array *p_self, godot_int p_idx); + +godot_int GDAPI godot_packed_glyph_array_size(const godot_packed_glyph_array *p_self); + +godot_bool GDAPI godot_packed_glyph_array_is_empty(const godot_packed_glyph_array *p_self); + +void GDAPI godot_packed_glyph_array_destroy(godot_packed_glyph_array *p_self); + +// Grapheme + +#ifdef __cplusplus +} +#endif + +#endif /* !GODOT_NATIVETEXT_H */ diff --git a/modules/gdnative/include/videodecoder/godot_videodecoder.h b/modules/gdnative/include/videodecoder/godot_videodecoder.h index 16c92abd22..dc2cf5ec07 100644 --- a/modules/gdnative/include/videodecoder/godot_videodecoder.h +++ b/modules/gdnative/include/videodecoder/godot_videodecoder.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -49,11 +49,11 @@ typedef struct const char *(*get_plugin_name)(); const char **(*get_supported_extensions)(int *count); godot_bool (*open_file)(void *, void *); // data struct, and a FileAccess pointer - godot_real (*get_length)(const void *); - godot_real (*get_playback_position)(const void *); - void (*seek)(void *, godot_real); + godot_float (*get_length)(const void *); + godot_float (*get_playback_position)(const void *); + void (*seek)(void *, godot_float); void (*set_audio_track)(void *, godot_int); - void (*update)(void *, godot_real); + void (*update)(void *, godot_float); godot_packed_byte_array *(*get_videoframe)(void *); godot_int (*get_audioframe)(void *, float *, int); godot_int (*get_channels)(const void *); diff --git a/modules/gdnative/include/xr/godot_xr.h b/modules/gdnative/include/xr/godot_xr.h deleted file mode 100644 index 22f7f021c4..0000000000 --- a/modules/gdnative/include/xr/godot_xr.h +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************/ -/* godot_xr.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GODOT_NATIVEXR_H -#define GODOT_NATIVEXR_H - -#include <gdnative/gdnative.h> - -#ifdef __cplusplus -extern "C" { -#endif - -// For future versions of the API we should only add new functions at the end of the structure and use the -// version info to detect whether a call is available - -// Use these to populate version in your plugin -#define GODOTVR_API_MAJOR 1 -#define GODOTVR_API_MINOR 1 - -typedef struct { - godot_gdnative_api_version version; /* version of our API */ - void *(*constructor)(godot_object *); - void (*destructor)(void *); - godot_string (*get_name)(const void *); - godot_int (*get_capabilities)(const void *); - godot_bool (*get_anchor_detection_is_enabled)(const void *); - void (*set_anchor_detection_is_enabled)(void *, godot_bool); - godot_bool (*is_stereo)(const void *); - godot_bool (*is_initialized)(const void *); - godot_bool (*initialize)(void *); - void (*uninitialize)(void *); - godot_vector2 (*get_render_targetsize)(const void *); - godot_transform (*get_transform_for_eye)(void *, godot_int, godot_transform *); - void (*fill_projection_for_eye)(void *, godot_real *, godot_int, godot_real, godot_real, godot_real); - void (*commit_for_eye)(void *, godot_int, godot_rid *, godot_rect2 *); - void (*process)(void *); - godot_int (*get_external_texture_for_eye)(void *, godot_int); - void (*notification)(void *, godot_int); - godot_int (*get_camera_feed_id)(void *); -} godot_xr_interface_gdnative; - -void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_interface); - -// helper functions to access XRServer data -godot_real GDAPI godot_xr_get_worldscale(); -godot_transform GDAPI godot_xr_get_reference_frame(); - -// helper functions for rendering -void GDAPI godot_xr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect); -godot_int GDAPI godot_xr_get_texid(godot_rid *p_render_target); - -// helper functions for updating XR controllers -godot_int GDAPI godot_xr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position); -void GDAPI godot_xr_remove_controller(godot_int p_controller_id); -void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position); -void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed); -void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative); -godot_real GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id); - -#ifdef __cplusplus -} -#endif - -#endif /* !GODOT_NATIVEXR_H */ diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp index 8dbaec4e75..2d9b45cb07 100644 --- a/modules/gdnative/nativescript/api_generator.cpp +++ b/modules/gdnative/nativescript/api_generator.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,11 +32,13 @@ #ifdef TOOLS_ENABLED -#include "core/class_db.h" -#include "core/engine.h" -#include "core/global_constants.h" -#include "core/os/file_access.h" -#include "core/pair.h" +#include "core/config/engine.h" +#include "core/core_constants.h" +#include "core/io/file_access.h" +#include "core/object/class_db.h" +#include "core/string/string_builder.h" +#include "core/templates/pair.h" +#include "core/variant/variant_parser.h" // helper stuff @@ -65,14 +67,15 @@ struct MethodAPI { Map<int, Variant> default_arguments; - int argument_count; - bool has_varargs; - bool is_editor; - bool is_noscript; - bool is_const; - bool is_reverse; - bool is_virtual; - bool is_from_script; + int argument_count = 0; + bool has_varargs = false; + bool is_editor = false; + bool is_noscript = false; + bool is_const = false; + bool is_static = false; // For builtin types. + bool is_reverse = false; + bool is_virtual = false; + bool is_from_script = false; }; struct PropertyAPI { @@ -80,12 +83,14 @@ struct PropertyAPI { String getter; String setter; String type; - int index; + int index = 0; }; struct ConstantAPI { String constant_name; - int constant_value; + int constant_value = 0; + Variant builtin_constant_value; // For builtin types; + String builtin_constant_type; // For builtin types; }; struct SignalAPI { @@ -100,23 +105,35 @@ struct EnumAPI { List<Pair<int, String>> values; }; +struct OperatorAPI { // For builtin types; + String name; + int oper = Variant::OP_MAX; + String other_type; + String return_type; +}; + struct ClassAPI { String class_name; String super_class_name; - ClassDB::APIType api_type; + ClassDB::APIType api_type = ClassDB::API_NONE; - bool is_singleton; + bool is_singleton = false; String singleton_name; - bool is_instanciable; + bool is_instantiable = false; // @Unclear - bool is_reference; + bool is_ref_counted = false; + bool has_indexing = false; // For builtin types. + String indexed_type; // For builtin types. + bool is_keyed = false; // For builtin types. List<MethodAPI> methods; + List<MethodAPI> constructors; // For builtin types. List<PropertyAPI> properties; List<ConstantAPI> constants; List<SignalAPI> signals_; List<EnumAPI> enums; + List<OperatorAPI> operators; // For builtin types. }; static String get_type_name(const PropertyInfo &info) { @@ -127,7 +144,7 @@ static String get_type_name(const PropertyInfo &info) { return info.class_name; } if (info.hint == PROPERTY_HINT_RESOURCE_TYPE) { - return info.hint_string; + return info.class_name; } if (info.type == Variant::NIL && (info.usage & PROPERTY_USAGE_NIL_IS_VARIANT)) { return "Variant"; @@ -173,20 +190,41 @@ List<ClassAPI> generate_c_api_classes() { ClassDB::get_class_list(&classes); classes.sort_custom<StringName::AlphCompare>(); - // Register global constants as a fake GlobalConstants singleton class + // Register global constants as a fake CoreConstants singleton class { ClassAPI global_constants_api; - global_constants_api.class_name = "GlobalConstants"; + global_constants_api.class_name = "CoreConstants"; global_constants_api.api_type = ClassDB::API_CORE; global_constants_api.is_singleton = true; - global_constants_api.singleton_name = "GlobalConstants"; - global_constants_api.is_instanciable = false; - const int constants_count = GlobalConstants::get_global_constant_count(); + global_constants_api.singleton_name = "CoreConstants"; + global_constants_api.is_instantiable = false; + const int constants_count = CoreConstants::get_global_constant_count(); + + Map<StringName, EnumAPI> enum_api_map; for (int i = 0; i < constants_count; ++i) { - ConstantAPI constant_api; - constant_api.constant_name = GlobalConstants::get_global_constant_name(i); - constant_api.constant_value = GlobalConstants::get_global_constant_value(i); - global_constants_api.constants.push_back(constant_api); + StringName enum_name = CoreConstants::get_global_constant_enum(i); + String name = String(CoreConstants::get_global_constant_name(i)); + int value = CoreConstants::get_global_constant_value(i); + + if (enum_name == StringName()) { + ConstantAPI constant_api; + constant_api.constant_name = name; + constant_api.constant_value = value; + global_constants_api.constants.push_back(constant_api); + } else { + EnumAPI enum_api; + if (enum_api_map.has(enum_name)) { + enum_api = enum_api_map[enum_name]; + } else { + enum_api.name = String(enum_name); + } + enum_api.values.push_back(Pair(value, name)); + + enum_api_map[enum_name] = enum_api; + } + } + for (const Map<StringName, EnumAPI>::Element *E = enum_api_map.front(); E; E = E->next()) { + global_constants_api.enums.push_back(E->get()); } global_constants_api.constants.sort_custom<ConstantAPIComparator>(); api.push_back(global_constants_api); @@ -195,28 +233,28 @@ List<ClassAPI> generate_c_api_classes() { for (List<StringName>::Element *e = classes.front(); e != nullptr; e = e->next()) { StringName class_name = e->get(); + if (!ClassDB::is_class_exposed(class_name)) { + continue; + } + ClassAPI class_api; class_api.api_type = ClassDB::get_api_type(e->get()); class_api.class_name = class_name; class_api.super_class_name = ClassDB::get_parent_class(class_name); { - String name = class_name; - if (name.begins_with("_")) { - name.remove(0); - } - class_api.is_singleton = Engine::get_singleton()->has_singleton(name); + class_api.is_singleton = Engine::get_singleton()->has_singleton(class_name); if (class_api.is_singleton) { - class_api.singleton_name = name; + class_api.singleton_name = class_name; } } - class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name); + class_api.is_instantiable = !class_api.is_singleton && ClassDB::can_instantiate(class_name); { List<StringName> inheriters; - ClassDB::get_inheriters_from_class("Reference", &inheriters); - bool is_reference = !!inheriters.find(class_name) || class_name == "Reference"; + ClassDB::get_inheriters_from_class("RefCounted", &inheriters); + bool is_ref_counted = !!inheriters.find(class_name) || class_name == "RefCounted"; // @Unclear - class_api.is_reference = !class_api.is_singleton && is_reference; + class_api.is_ref_counted = !class_api.is_singleton && is_ref_counted; } // constants @@ -290,12 +328,14 @@ List<ClassAPI> generate_c_api_classes() { property_api.type = p->get().name.get_slice(":", 1); property_api.name = p->get().name.get_slice(":", 0); } else { - property_api.type = get_type_name(p->get()); + MethodInfo minfo; + ClassDB::get_method_info(class_name, property_api.getter, &minfo, true, false); + property_api.type = get_type_name(minfo.return_val); } property_api.index = ClassDB::get_property_index(class_name, p->get().name); - if (!property_api.setter.empty() || !property_api.getter.empty()) { + if (!property_api.setter.is_empty() || !property_api.getter.is_empty()) { class_api.properties.push_back(property_api); } } @@ -352,7 +392,7 @@ List<ClassAPI> generate_c_api_classes() { arg_type = arg_info.name.get_slice(":", 1); arg_name = arg_info.name.get_slice(":", 0); } else if (arg_info.hint == PROPERTY_HINT_RESOURCE_TYPE) { - arg_type = arg_info.hint_string; + arg_type = arg_info.class_name; } else if (arg_info.type == Variant::NIL) { arg_type = "Variant"; } else if (arg_info.type == Variant::OBJECT) { @@ -361,7 +401,7 @@ List<ClassAPI> generate_c_api_classes() { arg_type = Variant::get_type_name(arg_info.type); } } else { - arg_type = Variant::get_type_name(arg_info.type); + arg_type = get_type_name(arg_info); } method_api.argument_names.push_back(arg_name); @@ -381,11 +421,11 @@ List<ClassAPI> generate_c_api_classes() { List<EnumAPI> enums; List<StringName> enum_names; ClassDB::get_enum_list(class_name, &enum_names, true); - for (List<StringName>::Element *E = enum_names.front(); E; E = E->next()) { + for (const StringName &E : enum_names) { List<StringName> value_names; EnumAPI enum_api; - enum_api.name = E->get(); - ClassDB::get_enum_constants(class_name, E->get(), &value_names, true); + enum_api.name = E; + ClassDB::get_enum_constants(class_name, E, &value_names, true); for (List<StringName>::Element *val_e = value_names.front(); val_e; val_e = val_e->next()) { int int_val = ClassDB::get_integer_constant(class_name, val_e->get(), nullptr); enum_api.values.push_back(Pair<int, String>(int_val, val_e->get())); @@ -402,12 +442,200 @@ List<ClassAPI> generate_c_api_classes() { } /* + * Reads the builtin Variant API to a list + */ +List<ClassAPI> generate_c_builtin_api_types() { + List<ClassAPI> api; + + // Special class for the utility methods. + { + ClassAPI utility_api; + utility_api.class_name = "Utilities"; + utility_api.is_instantiable = false; + + List<StringName> utility_functions; + Variant::get_utility_function_list(&utility_functions); + for (const StringName &E : utility_functions) { + const StringName &function_name = E; + + MethodAPI function_api; + function_api.method_name = function_name; + function_api.has_varargs = Variant::is_utility_function_vararg(function_name); + function_api.argument_count = function_api.has_varargs ? 0 : Variant::get_utility_function_argument_count(function_name); + function_api.is_const = Variant::get_utility_function_type(function_name) == Variant::UTILITY_FUNC_TYPE_MATH; + + for (int i = 0; i < function_api.argument_count; i++) { + function_api.argument_names.push_back(Variant::get_utility_function_argument_name(function_name, i)); + Variant::Type arg_type = Variant::get_utility_function_argument_type(function_name, i); + function_api.argument_types.push_back(arg_type == Variant::NIL ? "Variant" : Variant::get_type_name(arg_type)); + } + + if (Variant::has_utility_function_return_value(function_name)) { + Variant::Type ret_type = Variant::get_utility_function_return_type(function_name); + function_api.return_type = ret_type == Variant::NIL ? "Variant" : Variant::get_type_name(ret_type); + } else { + function_api.return_type = "void"; + } + + utility_api.methods.push_back(function_api); + } + + api.push_back(utility_api); + } + + for (int t = 0; t < Variant::VARIANT_MAX; t++) { + Variant::Type type = (Variant::Type)t; + + ClassAPI class_api; + class_api.class_name = Variant::get_type_name(type); + class_api.is_instantiable = true; + class_api.has_indexing = Variant::has_indexing(type); + class_api.indexed_type = Variant::get_type_name(Variant::get_indexed_element_type(type)); + class_api.is_keyed = Variant::is_keyed(type); + // Types that are passed by reference. + switch (type) { + case Variant::OBJECT: + case Variant::DICTIONARY: + case Variant::ARRAY: + case Variant::PACKED_BYTE_ARRAY: + case Variant::PACKED_INT32_ARRAY: + case Variant::PACKED_INT64_ARRAY: + case Variant::PACKED_FLOAT32_ARRAY: + case Variant::PACKED_FLOAT64_ARRAY: + case Variant::PACKED_STRING_ARRAY: + case Variant::PACKED_VECTOR2_ARRAY: + case Variant::PACKED_VECTOR3_ARRAY: + case Variant::PACKED_COLOR_ARRAY: + class_api.is_ref_counted = true; + break; + default: + class_api.is_ref_counted = false; + break; + } + + // Methods. + + List<StringName> methods; + Variant::get_builtin_method_list(type, &methods); + for (const StringName &E : methods) { + const StringName &method_name = E; + + MethodAPI method_api; + + method_api.method_name = method_name; + method_api.argument_count = Variant::get_builtin_method_argument_count(type, method_name); + method_api.has_varargs = Variant::is_builtin_method_vararg(type, method_name); + method_api.is_const = Variant::is_builtin_method_const(type, method_name); + method_api.is_static = Variant::is_builtin_method_static(type, method_name); + + for (int i = 0; i < method_api.argument_count; i++) { + method_api.argument_names.push_back(Variant::get_builtin_method_argument_name(type, method_name, i)); + Variant::Type arg_type = Variant::get_builtin_method_argument_type(type, method_name, i); + method_api.argument_types.push_back(arg_type == Variant::NIL ? "Variant" : Variant::get_type_name(arg_type)); + } + + Vector<Variant> default_arguments = Variant::get_builtin_method_default_arguments(type, method_name); + + int default_start = method_api.argument_names.size() - default_arguments.size(); + + for (int i = 0; i < default_arguments.size(); i++) { + method_api.default_arguments[default_start + i] = default_arguments[i]; + } + + if (Variant::has_builtin_method_return_value(type, method_name)) { + Variant::Type ret_type = Variant::get_builtin_method_return_type(type, method_name); + method_api.return_type = ret_type == Variant::NIL ? "Variant" : Variant::get_type_name(ret_type); + } else { + method_api.return_type = "void"; + } + + class_api.methods.push_back(method_api); + } + + // Constructors. + + for (int c = 0; c < Variant::get_constructor_count(type); c++) { + MethodAPI constructor_api; + + constructor_api.method_name = Variant::get_type_name(type); + constructor_api.argument_count = Variant::get_constructor_argument_count(type, c); + constructor_api.return_type = Variant::get_type_name(type); + + for (int i = 0; i < constructor_api.argument_count; i++) { + constructor_api.argument_names.push_back(Variant::get_constructor_argument_name(type, c, i)); + Variant::Type arg_type = Variant::get_constructor_argument_type(type, c, i); + constructor_api.argument_types.push_back(arg_type == Variant::NIL ? "Variant" : Variant::get_type_name(arg_type)); + } + + class_api.constructors.push_back(constructor_api); + } + + // Constants. + + List<StringName> constants; + Variant::get_constants_for_type(type, &constants); + for (const StringName &E : constants) { + const StringName &constant_name = E; + ConstantAPI constant_api; + + constant_api.constant_name = constant_name; + constant_api.builtin_constant_value = Variant::get_constant_value(type, constant_name); + constant_api.builtin_constant_type = Variant::get_type_name(constant_api.builtin_constant_value.get_type()); + + class_api.constants.push_back(constant_api); + } + + // Members. + + List<StringName> members; + Variant::get_member_list(type, &members); + for (const StringName &E : members) { + const StringName &member_name = E; + + PropertyAPI member_api; + member_api.name = member_name; + Variant::Type member_type = Variant::get_member_type(type, member_name); + member_api.type = member_type == Variant::NIL ? "Variant" : Variant::get_type_name(member_type); + + class_api.properties.push_back(member_api); + } + + // Operators. + + for (int op = 0; op < Variant::OP_MAX; op++) { + Variant::Operator oper = (Variant::Operator)op; + + for (int ot = 0; ot < Variant::VARIANT_MAX; ot++) { + Variant::Type other_type = (Variant::Type)ot; + + if (!Variant::get_validated_operator_evaluator(oper, type, other_type)) { + continue; + } + + OperatorAPI oper_api; + oper_api.name = Variant::get_operator_name(oper); + oper_api.oper = oper; + oper_api.other_type = Variant::get_type_name(other_type); + oper_api.return_type = Variant::get_type_name(Variant::get_operator_return_type(oper, type, other_type)); + + class_api.operators.push_back(oper_api); + } + } + + api.push_back(class_api); + } + + return api; +} + +/* * Generates the JSON source from the API in p_api */ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { // I'm sorry for the \t mess List<String> source; + VariantWriter writer; source.push_back("[\n"); @@ -421,9 +649,8 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back(String("\t\t\"api_type\": \"") + (api.api_type == ClassDB::API_CORE ? "core" : (api.api_type == ClassDB::API_EDITOR ? "tools" : "none")) + "\",\n"); source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n"); source.push_back("\t\t\"singleton_name\": \"" + api.singleton_name + "\",\n"); - source.push_back(String("\t\t\"instanciable\": ") + (api.is_instanciable ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\"is_reference\": ") + (api.is_reference ? "true" : "false") + ",\n"); - // @Unclear + source.push_back(String("\t\t\"instantiable\": ") + (api.is_instantiable ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\"is_ref_counted\": ") + (api.is_ref_counted ? "true" : "false") + ",\n"); source.push_back("\t\t\"constants\": {\n"); for (List<ConstantAPI>::Element *e = api.constants.front(); e; e = e->next()) { @@ -453,7 +680,12 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n"); source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n"); source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n"); - source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n"); + String default_value; + if (e->get().default_arguments.has(i)) { + writer.write_to_string(e->get().default_arguments[i], default_value); + default_value = default_value.replace("\n", "").json_escape(); + } + source.push_back("\t\t\t\t\t\t\"default_value\": \"" + default_value + "\"\n"); source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n"); } source.push_back("\t\t\t\t]\n"); @@ -479,7 +711,12 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n"); source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n"); source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n"); - source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n"); + String default_value; + if (e->get().default_arguments.has(i)) { + writer.write_to_string(e->get().default_arguments[i], default_value); + default_value = default_value.replace("\n", "").json_escape(); + } + source.push_back("\t\t\t\t\t\t\"default_value\": \"" + default_value + "\"\n"); source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n"); } source.push_back("\t\t\t\t]\n"); @@ -508,6 +745,173 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { return source; } +static int indent_level = 0; + +static void append_indented(StringBuilder &p_source, const String &p_text) { + for (int i = 0; i < indent_level; i++) { + p_source.append("\t"); + } + p_source.append(p_text); + p_source.append("\n"); +} + +static void append_indented(StringBuilder &p_source, const char *p_text) { + for (int i = 0; i < indent_level; i++) { + p_source.append("\t"); + } + p_source.append(p_text); + p_source.append("\n"); +} + +static void write_builtin_method(StringBuilder &p_source, const MethodAPI &p_method) { + VariantWriter writer; + + append_indented(p_source, vformat(R"("name": "%s",)", p_method.method_name)); + append_indented(p_source, vformat(R"("return_type": "%s",)", p_method.return_type)); + append_indented(p_source, vformat(R"("is_const": %s,)", p_method.is_const ? "true" : "false")); + append_indented(p_source, vformat(R"("is_static": %s,)", p_method.is_static ? "true" : "false")); + append_indented(p_source, vformat(R"("has_varargs": %s,)", p_method.has_varargs ? "true" : "false")); + + append_indented(p_source, R"("arguments": [)"); + indent_level++; + for (int i = 0; i < p_method.argument_count; i++) { + append_indented(p_source, "{"); + indent_level++; + + append_indented(p_source, vformat(R"("name": "%s",)", p_method.argument_names[i])); + append_indented(p_source, vformat(R"("type": "%s",)", p_method.argument_types[i])); + append_indented(p_source, vformat(R"("has_default_value": %s,)", p_method.default_arguments.has(i) ? "true" : "false")); + String default_value; + if (p_method.default_arguments.has(i)) { + writer.write_to_string(p_method.default_arguments[i], default_value); + default_value = default_value.replace("\n", "").json_escape(); + } + append_indented(p_source, vformat(R"("default_value": "%s")", default_value)); + + indent_level--; + append_indented(p_source, i < p_method.argument_count - 1 ? "}," : "}"); + } + indent_level--; + append_indented(p_source, "]"); +} + +static List<String> generate_c_builtin_api_json(const List<ClassAPI> &p_api) { + StringBuilder source; + + source.append("[\n"); + + indent_level = 1; + + for (const List<ClassAPI>::Element *C = p_api.front(); C; C = C->next()) { + const ClassAPI &class_api = C->get(); + append_indented(source, "{"); + indent_level++; + + append_indented(source, vformat(R"("name": "%s",)", class_api.class_name)); + append_indented(source, vformat(R"("is_instantiable": %s,)", class_api.is_instantiable ? "true" : "false")); + append_indented(source, vformat(R"("is_ref_counted": %s,)", class_api.is_ref_counted ? "true" : "false")); + append_indented(source, vformat(R"("has_indexing": %s,)", class_api.has_indexing ? "true" : "false")); + append_indented(source, vformat(R"("indexed_type": "%s",)", class_api.has_indexing && class_api.indexed_type == "Nil" ? "Variant" : class_api.indexed_type)); + append_indented(source, vformat(R"("is_keyed": %s,)", class_api.is_keyed ? "true" : "false")); + + // Constructors. + append_indented(source, R"("constructors": [)"); + indent_level++; + for (const List<MethodAPI>::Element *E = class_api.constructors.front(); E; E = E->next()) { + const MethodAPI &constructor = E->get(); + append_indented(source, "{"); + indent_level++; + + write_builtin_method(source, constructor); + + indent_level--; + append_indented(source, E->next() ? "}," : "}"); + } + indent_level--; + append_indented(source, "],"); + + // Constants. + append_indented(source, R"("constants": [)"); + indent_level++; + for (const List<ConstantAPI>::Element *E = class_api.constants.front(); E; E = E->next()) { + const ConstantAPI &constant = E->get(); + append_indented(source, "{"); + indent_level++; + + append_indented(source, vformat(R"("name": "%s",)", constant.constant_name)); + append_indented(source, vformat(R"("type": "%s",)", constant.builtin_constant_type)); + append_indented(source, vformat(R"("value": "%s")", constant.builtin_constant_value.operator String())); + + indent_level--; + append_indented(source, E->next() ? "}," : "}"); + } + indent_level--; + append_indented(source, "],"); + + // Methods. + append_indented(source, R"("methods": [)"); + indent_level++; + for (const List<MethodAPI>::Element *E = class_api.methods.front(); E; E = E->next()) { + const MethodAPI &method = E->get(); + append_indented(source, "{"); + indent_level++; + + write_builtin_method(source, method); + + indent_level--; + append_indented(source, E->next() ? "}," : "}"); + } + indent_level--; + append_indented(source, "],"); + + // Members. + append_indented(source, R"("members": [)"); + indent_level++; + for (const List<PropertyAPI>::Element *E = class_api.properties.front(); E; E = E->next()) { + const PropertyAPI &member = E->get(); + append_indented(source, "{"); + indent_level++; + + append_indented(source, vformat(R"("name": "%s",)", member.name)); + append_indented(source, vformat(R"("type": "%s")", member.type)); + + indent_level--; + append_indented(source, E->next() ? "}," : "}"); + } + indent_level--; + append_indented(source, "],"); + + // Operators. + append_indented(source, R"("operators": [)"); + indent_level++; + for (const List<OperatorAPI>::Element *E = class_api.operators.front(); E; E = E->next()) { + const OperatorAPI &oper = E->get(); + append_indented(source, "{"); + indent_level++; + + append_indented(source, vformat(R"("name": "%s",)", oper.name)); + append_indented(source, vformat(R"("operator": %d,)", oper.oper)); + append_indented(source, vformat(R"("other_type": "%s",)", oper.other_type)); + append_indented(source, vformat(R"("return_type": "%s")", oper.return_type)); + + indent_level--; + append_indented(source, E->next() ? "}," : "}"); + } + indent_level--; + append_indented(source, "]"); + + indent_level--; + append_indented(source, C->next() ? "}," : "}"); + } + + indent_level--; + source.append("]\n"); + + List<String> result; + result.push_back(source.as_string()); + return result; +} + #endif /* @@ -526,3 +930,19 @@ Error generate_c_api(const String &p_path) { return save_file(p_path, json_source); #endif } +/* + * Saves the builtin Godot API to a JSON file located at + * p_path + */ +Error generate_c_builtin_api(const String &p_path) { +#ifndef TOOLS_ENABLED + return ERR_BUG; +#else + + List<ClassAPI> api = generate_c_builtin_api_types(); + + List<String> json_source = generate_c_builtin_api_json(api); + + return save_file(p_path, json_source); +#endif +} diff --git a/modules/gdnative/nativescript/api_generator.h b/modules/gdnative/nativescript/api_generator.h index edbb1d1f23..611abb2a2d 100644 --- a/modules/gdnative/nativescript/api_generator.h +++ b/modules/gdnative/nativescript/api_generator.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,9 +31,10 @@ #ifndef API_GENERATOR_H #define API_GENERATOR_H +#include "core/string/ustring.h" #include "core/typedefs.h" -#include "core/ustring.h" Error generate_c_api(const String &p_path); +Error generate_c_builtin_api(const String &p_path); #endif // API_GENERATOR_H diff --git a/modules/gdnative/nativescript/godot_nativescript.cpp b/modules/gdnative/nativescript/godot_nativescript.cpp index e47548f3e9..70b14836bf 100644 --- a/modules/gdnative/nativescript/godot_nativescript.cpp +++ b/modules/gdnative/nativescript/godot_nativescript.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,11 +30,11 @@ #include "nativescript/godot_nativescript.h" -#include "core/class_db.h" -#include "core/error_macros.h" -#include "core/global_constants.h" -#include "core/project_settings.h" -#include "core/variant.h" +#include "core/config/project_settings.h" +#include "core/core_constants.h" +#include "core/error/error_macros.h" +#include "core/object/class_db.h" +#include "core/variant/variant.h" #include "gdnative/gdnative.h" #include <stdint.h> @@ -70,8 +70,7 @@ void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, const char const NativeScriptDesc *b = desc.base_data; while (b) { - desc.rpc_count += b->rpc_count; - desc.rset_count += b->rset_count; + desc.rpc_methods.append_array(b->rpc_methods); b = b->base_data; } @@ -94,8 +93,6 @@ void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const desc.destroy_func = p_destroy_func; desc.is_tool = true; desc.base = p_base; - desc.rpc_count = 0; - desc.rset_count = 0; if (classes->has(p_base)) { desc.base_data = &(*classes)[p_base]; @@ -103,8 +100,7 @@ void GDAPI godot_nativescript_register_tool_class(void *p_gdnative_handle, const const NativeScriptDesc *b = desc.base_data; while (b) { - desc.rpc_count += b->rpc_count; - desc.rset_count += b->rset_count; + desc.rpc_methods.append_array(b->rpc_methods); b = b->base_data; } @@ -126,13 +122,16 @@ void GDAPI godot_nativescript_register_method(void *p_gdnative_handle, const cha method.method = p_method; method.rpc_mode = p_attr.rpc_type; method.rpc_method_id = UINT16_MAX; - if (p_attr.rpc_type != GODOT_METHOD_RPC_MODE_DISABLED) { - method.rpc_method_id = E->get().rpc_count; - E->get().rpc_count += 1; - } method.info = MethodInfo(p_function_name); E->get().methods.insert(p_function_name, method); + + if (p_attr.rpc_type != GODOT_METHOD_RPC_MODE_DISABLED) { + MultiplayerAPI::RPCConfig nd; + nd.name = String(p_name); + nd.rpc_mode = MultiplayerAPI::RPCMode(p_attr.rpc_type); + E->get().rpc_methods.push_back(nd); + } } void GDAPI godot_nativescript_register_property(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_nativescript_property_attributes *p_attr, godot_nativescript_property_set_func p_set_func, godot_nativescript_property_get_func p_get_func) { @@ -144,11 +143,6 @@ void GDAPI godot_nativescript_register_property(void *p_gdnative_handle, const c NativeScriptDesc::Property property; property.default_value = *(Variant *)&p_attr->default_value; property.getter = p_get_func; - property.rset_mode = p_attr->rset_type; - if (p_attr->rset_type != GODOT_METHOD_RPC_MODE_DISABLED) { - property.rset_property_id = E->get().rset_count; - E->get().rset_count += 1; - } property.setter = p_set_func; property.info = PropertyInfo((Variant::Type)p_attr->type, p_path, @@ -338,7 +332,7 @@ void GDAPI godot_nativescript_unregister_instance_binding_data_functions(int p_i } void GDAPI *godot_nativescript_get_instance_binding_data(int p_idx, godot_object *p_object) { - return NativeScriptLanguage::get_singleton()->get_instance_binding_data(p_idx, (Object *)p_object); + return nullptr; } void GDAPI godot_nativescript_profiling_add_data(const char *p_signature, uint64_t p_time) { diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 632f4e5fee..26d3aed702 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,12 +34,14 @@ #include "gdnative/gdnative.h" +#include "core/config/project_settings.h" +#include "core/core_constants.h" #include "core/core_string_names.h" -#include "core/global_constants.h" +#include "core/io/file_access.h" #include "core/io/file_access_encrypted.h" -#include "core/os/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" + +#include "main/main.h" #include "scene/main/scene_tree.h" #include "scene/resources/resource_format_text.h" @@ -96,10 +98,10 @@ void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) List<PropertyInfo> info; get_script_property_list(&info); Map<StringName, Variant> values; - for (List<PropertyInfo>::Element *E = info.front(); E; E = E->next()) { + for (const PropertyInfo &E : info) { Variant value; - get_property_default_value(E->get().name, value); - values[E->get().name] = value; + get_property_default_value(E.name, value); + values[E.name] = value; } p_placeholder->update(info, values); @@ -112,9 +114,25 @@ void NativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) #endif bool NativeScript::inherits_script(const Ref<Script> &p_script) const { -#ifndef _MSC_VER -#warning inheritance needs to be implemented in NativeScript -#endif + Ref<NativeScript> ns = p_script; + if (ns.is_null()) { + return false; + } + + const NativeScriptDesc *other_s = ns->get_script_desc(); + if (!other_s) { + return false; + } + + const NativeScriptDesc *s = get_script_desc(); + + while (s) { + if (s == other_s) { + return true; + } + s = s->base_data; + } + return false; } @@ -168,12 +186,12 @@ String NativeScript::get_script_class_icon_path() const { return script_class_icon_path; } -bool NativeScript::can_instance() const { +bool NativeScript::can_instantiate() const { NativeScriptDesc *script_data = get_script_desc(); #ifdef TOOLS_ENABLED // Only valid if this is either a tool script or a "regular" script. - // (so an environment whre scripting is disabled (and not the editor) would not + // (so, an environment where scripting is disabled (and not the editor) would not // create objects). return script_data && (is_tool() || ScriptServer::is_scripting_enabled()); #else @@ -413,245 +431,11 @@ void NativeScript::get_script_property_list(List<PropertyInfo> *p_list) const { } } -Vector<ScriptNetData> NativeScript::get_rpc_methods() const { - Vector<ScriptNetData> v; - - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - for (Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.front(); E; E = E->next()) { - if (E->get().rpc_mode != GODOT_METHOD_RPC_MODE_DISABLED) { - ScriptNetData nd; - nd.name = E->key(); - nd.mode = MultiplayerAPI::RPCMode(E->get().rpc_mode); - v.push_back(nd); - } - } - - script_data = script_data->base_data; - } - - return v; -} - -uint16_t NativeScript::get_rpc_method_id(const StringName &p_method) const { - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.find(p_method); - if (E) { - return E->get().rpc_method_id; - } - - script_data = script_data->base_data; - } - - return UINT16_MAX; -} - -StringName NativeScript::get_rpc_method(uint16_t p_id) const { - ERR_FAIL_COND_V(p_id == UINT16_MAX, StringName()); - - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - for (Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.front(); E; E = E->next()) { - if (E->get().rpc_method_id == p_id) { - return E->key(); - } - } - - script_data = script_data->base_data; - } - - return StringName(); -} - -MultiplayerAPI::RPCMode NativeScript::get_rpc_mode_by_id(uint16_t p_id) const { - ERR_FAIL_COND_V(p_id == UINT16_MAX, MultiplayerAPI::RPC_MODE_DISABLED); - - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - for (Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.front(); E; E = E->next()) { - if (E->get().rpc_method_id == p_id) { - switch (E->get().rpc_mode) { - case GODOT_METHOD_RPC_MODE_DISABLED: - return MultiplayerAPI::RPC_MODE_DISABLED; - case GODOT_METHOD_RPC_MODE_REMOTE: - return MultiplayerAPI::RPC_MODE_REMOTE; - case GODOT_METHOD_RPC_MODE_MASTER: - return MultiplayerAPI::RPC_MODE_MASTER; - case GODOT_METHOD_RPC_MODE_PUPPET: - return MultiplayerAPI::RPC_MODE_PUPPET; - case GODOT_METHOD_RPC_MODE_REMOTESYNC: - return MultiplayerAPI::RPC_MODE_REMOTESYNC; - case GODOT_METHOD_RPC_MODE_MASTERSYNC: - return MultiplayerAPI::RPC_MODE_MASTERSYNC; - case GODOT_METHOD_RPC_MODE_PUPPETSYNC: - return MultiplayerAPI::RPC_MODE_PUPPETSYNC; - default: - return MultiplayerAPI::RPC_MODE_DISABLED; - } - } - } - - script_data = script_data->base_data; - } - - return MultiplayerAPI::RPC_MODE_DISABLED; -} - -MultiplayerAPI::RPCMode NativeScript::get_rpc_mode(const StringName &p_method) const { - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - Map<StringName, NativeScriptDesc::Method>::Element *E = script_data->methods.find(p_method); - if (E) { - switch (E->get().rpc_mode) { - case GODOT_METHOD_RPC_MODE_DISABLED: - return MultiplayerAPI::RPC_MODE_DISABLED; - case GODOT_METHOD_RPC_MODE_REMOTE: - return MultiplayerAPI::RPC_MODE_REMOTE; - case GODOT_METHOD_RPC_MODE_MASTER: - return MultiplayerAPI::RPC_MODE_MASTER; - case GODOT_METHOD_RPC_MODE_PUPPET: - return MultiplayerAPI::RPC_MODE_PUPPET; - case GODOT_METHOD_RPC_MODE_REMOTESYNC: - return MultiplayerAPI::RPC_MODE_REMOTESYNC; - case GODOT_METHOD_RPC_MODE_MASTERSYNC: - return MultiplayerAPI::RPC_MODE_MASTERSYNC; - case GODOT_METHOD_RPC_MODE_PUPPETSYNC: - return MultiplayerAPI::RPC_MODE_PUPPETSYNC; - default: - return MultiplayerAPI::RPC_MODE_DISABLED; - } - } - - script_data = script_data->base_data; - } - - return MultiplayerAPI::RPC_MODE_DISABLED; -} - -Vector<ScriptNetData> NativeScript::get_rset_properties() const { - Vector<ScriptNetData> v; - - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.front(); E; E = E.next()) { - if (E.get().rset_mode != GODOT_METHOD_RPC_MODE_DISABLED) { - ScriptNetData nd; - nd.name = E.key(); - nd.mode = MultiplayerAPI::RPCMode(E.get().rset_mode); - v.push_back(nd); - } - } - script_data = script_data->base_data; - } - - return v; -} - -uint16_t NativeScript::get_rset_property_id(const StringName &p_variable) const { - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.find(p_variable); - if (E) { - return E.get().rset_property_id; - } - - script_data = script_data->base_data; - } - - return UINT16_MAX; -} - -StringName NativeScript::get_rset_property(uint16_t p_id) const { - ERR_FAIL_COND_V(p_id == UINT16_MAX, StringName()); - - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.front(); E; E = E.next()) { - if (E.get().rset_property_id == p_id) { - return E.key(); - } - } - - script_data = script_data->base_data; - } - - return StringName(); -} - -MultiplayerAPI::RPCMode NativeScript::get_rset_mode_by_id(uint16_t p_id) const { - ERR_FAIL_COND_V(p_id == UINT16_MAX, MultiplayerAPI::RPC_MODE_DISABLED); - - NativeScriptDesc *script_data = get_script_desc(); - - while (script_data) { - for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.front(); E; E = E.next()) { - if (E.get().rset_property_id == p_id) { - switch (E.get().rset_mode) { - case GODOT_METHOD_RPC_MODE_DISABLED: - return MultiplayerAPI::RPC_MODE_DISABLED; - case GODOT_METHOD_RPC_MODE_REMOTE: - return MultiplayerAPI::RPC_MODE_REMOTE; - case GODOT_METHOD_RPC_MODE_MASTER: - return MultiplayerAPI::RPC_MODE_MASTER; - case GODOT_METHOD_RPC_MODE_PUPPET: - return MultiplayerAPI::RPC_MODE_PUPPET; - case GODOT_METHOD_RPC_MODE_REMOTESYNC: - return MultiplayerAPI::RPC_MODE_REMOTESYNC; - case GODOT_METHOD_RPC_MODE_MASTERSYNC: - return MultiplayerAPI::RPC_MODE_MASTERSYNC; - case GODOT_METHOD_RPC_MODE_PUPPETSYNC: - return MultiplayerAPI::RPC_MODE_PUPPETSYNC; - default: - return MultiplayerAPI::RPC_MODE_DISABLED; - } - } - } - - script_data = script_data->base_data; - } - - return MultiplayerAPI::RPC_MODE_DISABLED; -} - -MultiplayerAPI::RPCMode NativeScript::get_rset_mode(const StringName &p_variable) const { +const Vector<MultiplayerAPI::RPCConfig> NativeScript::get_rpc_methods() const { NativeScriptDesc *script_data = get_script_desc(); + ERR_FAIL_COND_V(!script_data, Vector<MultiplayerAPI::RPCConfig>()); - while (script_data) { - OrderedHashMap<StringName, NativeScriptDesc::Property>::Element E = script_data->properties.find(p_variable); - if (E) { - switch (E.get().rset_mode) { - case GODOT_METHOD_RPC_MODE_DISABLED: - return MultiplayerAPI::RPC_MODE_DISABLED; - case GODOT_METHOD_RPC_MODE_REMOTE: - return MultiplayerAPI::RPC_MODE_REMOTE; - case GODOT_METHOD_RPC_MODE_MASTER: - return MultiplayerAPI::RPC_MODE_MASTER; - case GODOT_METHOD_RPC_MODE_PUPPET: - return MultiplayerAPI::RPC_MODE_PUPPET; - case GODOT_METHOD_RPC_MODE_REMOTESYNC: - return MultiplayerAPI::RPC_MODE_REMOTESYNC; - case GODOT_METHOD_RPC_MODE_MASTERSYNC: - return MultiplayerAPI::RPC_MODE_MASTERSYNC; - case GODOT_METHOD_RPC_MODE_PUPPETSYNC: - return MultiplayerAPI::RPC_MODE_PUPPETSYNC; - default: - return MultiplayerAPI::RPC_MODE_DISABLED; - } - } - - script_data = script_data->base_data; - } - - return MultiplayerAPI::RPC_MODE_DISABLED; + return script_data->rpc_methods; } String NativeScript::get_class_documentation() const { @@ -717,7 +501,7 @@ String NativeScript::get_property_documentation(const StringName &p_path) const } Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::CallError &r_error) { - if (lib_path.empty() || class_name.empty() || library.is_null()) { + if (lib_path.is_empty() || class_name.is_empty() || library.is_null()) { r_error.error = Callable::CallError::CALL_ERROR_INSTANCE_IS_NULL; return Variant(); } @@ -735,9 +519,9 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal Object *owner = nullptr; if (!(script_data->base_native_type == "")) { - owner = ClassDB::instance(script_data->base_native_type); + owner = ClassDB::instantiate(script_data->base_native_type); } else { - owner = memnew(Reference); + owner = memnew(RefCounted); } if (!owner) { @@ -745,7 +529,7 @@ Variant NativeScript::_new(const Variant **p_args, int p_argcount, Callable::Cal return Variant(); } - Reference *r = Object::cast_to<Reference>(owner); + RefCounted *r = Object::cast_to<RefCounted>(owner); if (r) { ref = REF(r); } @@ -1044,46 +828,10 @@ Ref<Script> NativeScriptInstance::get_script() const { return script; } -Vector<ScriptNetData> NativeScriptInstance::get_rpc_methods() const { +const Vector<MultiplayerAPI::RPCConfig> NativeScriptInstance::get_rpc_methods() const { return script->get_rpc_methods(); } -uint16_t NativeScriptInstance::get_rpc_method_id(const StringName &p_method) const { - return script->get_rpc_method_id(p_method); -} - -StringName NativeScriptInstance::get_rpc_method(uint16_t p_id) const { - return script->get_rpc_method(p_id); -} - -MultiplayerAPI::RPCMode NativeScriptInstance::get_rpc_mode_by_id(uint16_t p_id) const { - return script->get_rpc_mode_by_id(p_id); -} - -MultiplayerAPI::RPCMode NativeScriptInstance::get_rpc_mode(const StringName &p_method) const { - return script->get_rpc_mode(p_method); -} - -Vector<ScriptNetData> NativeScriptInstance::get_rset_properties() const { - return script->get_rset_properties(); -} - -uint16_t NativeScriptInstance::get_rset_property_id(const StringName &p_variable) const { - return script->get_rset_property_id(p_variable); -} - -StringName NativeScriptInstance::get_rset_property(uint16_t p_id) const { - return script->get_rset_property(p_id); -} - -MultiplayerAPI::RPCMode NativeScriptInstance::get_rset_mode_by_id(uint16_t p_id) const { - return script->get_rset_mode_by_id(p_id); -} - -MultiplayerAPI::RPCMode NativeScriptInstance::get_rset_mode(const StringName &p_variable) const { - return script->get_rset_mode(p_variable); -} - ScriptLanguage *NativeScriptInstance::get_language() { return NativeScriptLanguage::get_singleton(); } @@ -1196,13 +944,6 @@ void NativeScriptLanguage::_unload_stuff(bool p_reload) { NativeScriptLanguage::NativeScriptLanguage() { NativeScriptLanguage::singleton = this; -#ifndef NO_THREADS - has_objects_to_register = false; -#endif - -#ifdef DEBUG_ENABLED - profiling = false; -#endif _init_call_type = "nativescript_init"; _init_call_name = "nativescript_init"; @@ -1255,6 +996,17 @@ void NativeScriptLanguage::init() { if (generate_c_api(E->next()->get()) != OK) { ERR_PRINT("Failed to generate C API\n"); } + Main::cleanup(true); + exit(0); + } + + E = args.find("--gdnative-generate-json-builtin-api"); + + if (E && E->next()) { + if (generate_c_builtin_api(E->next()->get()) != OK) { + ERR_PRINT("Failed to generate C builtin API\n"); + } + Main::cleanup(true); exit(0); } #endif @@ -1283,6 +1035,10 @@ void NativeScriptLanguage::finish() { void NativeScriptLanguage::get_reserved_words(List<String> *p_words) const { } +bool NativeScriptLanguage::is_control_flow_keyword(String p_keyword) const { + return false; +} + void NativeScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const { } @@ -1295,7 +1051,7 @@ Ref<Script> NativeScriptLanguage::get_template(const String &p_class_name, const return Ref<NativeScript>(s); } -bool NativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const { +bool NativeScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const { return true; } @@ -1518,6 +1274,8 @@ void NativeScriptLanguage::unregister_binding_functions(int p_idx) { } void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_object) { + return nullptr; +#if 0 ERR_FAIL_INDEX_V(p_idx, binding_functions.size(), nullptr); ERR_FAIL_COND_V_MSG(!binding_functions[p_idx].first, nullptr, "Tried to get binding data for a nativescript binding that does not exist."); @@ -1547,9 +1305,12 @@ void *NativeScriptLanguage::get_instance_binding_data(int p_idx, Object *p_objec } return (*binding_data)[p_idx]; +#endif } void *NativeScriptLanguage::alloc_instance_binding_data(Object *p_object) { + return nullptr; +#if 0 Vector<void *> *binding_data = new Vector<void *>; binding_data->resize(binding_functions.size()); @@ -1561,9 +1322,11 @@ void *NativeScriptLanguage::alloc_instance_binding_data(Object *p_object) { binding_instances.insert(binding_data); return (void *)binding_data; +#endif } void NativeScriptLanguage::free_instance_binding_data(void *p_data) { +#if 0 if (!p_data) { return; } @@ -1583,9 +1346,11 @@ void NativeScriptLanguage::free_instance_binding_data(void *p_data) { binding_instances.erase(&binding_data); delete &binding_data; +#endif } void NativeScriptLanguage::refcount_incremented_instance_binding(Object *p_object) { +#if 0 void *data = p_object->get_script_instance_binding(lang_idx); if (!data) { @@ -1607,9 +1372,11 @@ void NativeScriptLanguage::refcount_incremented_instance_binding(Object *p_objec binding_functions[i].second.refcount_incremented_instance_binding(binding_data[i], p_object); } } +#endif } bool NativeScriptLanguage::refcount_decremented_instance_binding(Object *p_object) { +#if 0 void *data = p_object->get_script_instance_binding(lang_idx); if (!data) { @@ -1635,6 +1402,8 @@ bool NativeScriptLanguage::refcount_decremented_instance_binding(Object *p_objec } return can_die; +#endif + return false; } void NativeScriptLanguage::set_global_type_tag(int p_idx, StringName p_class_name, const void *p_type_tag) { @@ -1668,7 +1437,7 @@ void NativeScriptLanguage::defer_init_library(Ref<GDNativeLibrary> lib, NativeSc MutexLock lock(mutex); libs_to_init.insert(lib); scripts_to_register.insert(script); - has_objects_to_register = true; + has_objects_to_register.set(); } #endif @@ -1682,7 +1451,7 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) { if (!E) { Ref<GDNative> gdn; - gdn.instance(); + gdn.instantiate(); gdn->set_library(lib); // TODO check the return value? @@ -1724,6 +1493,52 @@ void NativeScriptLanguage::unregister_script(NativeScript *script) { S->get().erase(script); if (S->get().size() == 0) { library_script_users.erase(S); + + Map<String, Ref<GDNative>>::Element *G = library_gdnatives.find(script->lib_path); + if (G && G->get()->get_library()->is_reloadable()) { + // ONLY if the library is marked as reloadable, and no more instances of its scripts exist do we unload the library + + // First remove meta data related to the library + Map<String, Map<StringName, NativeScriptDesc>>::Element *L = library_classes.find(script->lib_path); + if (L) { + Map<StringName, NativeScriptDesc> classes = L->get(); + + for (Map<StringName, NativeScriptDesc>::Element *C = classes.front(); C; C = C->next()) { + // free property stuff first + for (OrderedHashMap<StringName, NativeScriptDesc::Property>::Element P = C->get().properties.front(); P; P = P.next()) { + if (P.get().getter.free_func) { + P.get().getter.free_func(P.get().getter.method_data); + } + + if (P.get().setter.free_func) { + P.get().setter.free_func(P.get().setter.method_data); + } + } + + // free method stuff + for (Map<StringName, NativeScriptDesc::Method>::Element *M = C->get().methods.front(); M; M = M->next()) { + if (M->get().method.free_func) { + M->get().method.free_func(M->get().method.method_data); + } + } + + // free constructor/destructor + if (C->get().create_func.free_func) { + C->get().create_func.free_func(C->get().create_func.method_data); + } + + if (C->get().destroy_func.free_func) { + C->get().destroy_func.free_func(C->get().destroy_func.method_data); + } + } + + library_classes.erase(script->lib_path); + } + + // now unload the library + G->get()->terminate(); + library_gdnatives.erase(G); + } } } #ifndef NO_THREADS @@ -1751,7 +1566,7 @@ void NativeScriptLanguage::call_libraries_cb(const StringName &name) { void NativeScriptLanguage::frame() { #ifndef NO_THREADS - if (has_objects_to_register) { + if (has_objects_to_register.is_set()) { MutexLock lock(mutex); for (Set<Ref<GDNativeLibrary>>::Element *L = libs_to_init.front(); L; L = L->next()) { init_library(L->get()); @@ -1761,7 +1576,7 @@ void NativeScriptLanguage::frame() { register_script(S->get()); } scripts_to_register.clear(); - has_objects_to_register = false; + has_objects_to_register.clear(); } #endif @@ -1800,7 +1615,7 @@ bool NativeScriptLanguage::handles_global_class_type(const String &p_type) const } String NativeScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path) const { - if (!p_path.empty()) { + if (!p_path.is_empty()) { Ref<NativeScript> script = ResourceLoader::load(p_path, "NativeScript"); if (script.is_valid()) { if (r_base_type) { @@ -1932,7 +1747,7 @@ void NativeReloadNode::_notification(int p_what) { #endif } -RES ResourceFormatLoaderNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { +RES ResourceFormatLoaderNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_no_cache) { return ResourceFormatLoaderText::singleton->load(p_path, p_original_path, r_error); } diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h index 145bf7dcb6..777a878660 100644 --- a/modules/gdnative/nativescript/nativescript.h +++ b/modules/gdnative/nativescript/nativescript.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,15 +31,17 @@ #ifndef NATIVE_SCRIPT_H #define NATIVE_SCRIPT_H +#include "core/doc_data.h" +#include "core/io/resource.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/oa_hash_map.h" -#include "core/ordered_hash_map.h" +#include "core/object/script_language.h" #include "core/os/mutex.h" #include "core/os/thread_safe.h" -#include "core/resource.h" -#include "core/script_language.h" -#include "core/self_list.h" +#include "core/templates/oa_hash_map.h" +#include "core/templates/ordered_hash_map.h" +#include "core/templates/safe_refcount.h" +#include "core/templates/self_list.h" #include "scene/main/node.h" #include "modules/gdnative/gdnative.h" @@ -50,8 +52,8 @@ struct NativeScriptDesc { struct Method { godot_nativescript_instance_method method; MethodInfo info; - int rpc_mode; - uint16_t rpc_method_id; + int rpc_mode = 0; + uint16_t rpc_method_id = 0; String documentation; }; @@ -60,8 +62,6 @@ struct NativeScriptDesc { godot_nativescript_property_get_func getter; PropertyInfo info; Variant default_value; - int rset_mode; - uint16_t rset_property_id; String documentation; }; @@ -70,14 +70,13 @@ struct NativeScriptDesc { String documentation; }; - uint16_t rpc_count = 0; Map<StringName, Method> methods; - uint16_t rset_count = 0; + Vector<MultiplayerAPI::RPCConfig> rpc_methods; OrderedHashMap<StringName, Property> properties; Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals StringName base; StringName base_native_type; - NativeScriptDesc *base_data; + NativeScriptDesc *base_data = nullptr; godot_nativescript_instance_create_func create_func; godot_nativescript_instance_destroy_func destroy_func; @@ -85,11 +84,11 @@ struct NativeScriptDesc { const void *type_tag = nullptr; - bool is_tool; + bool is_tool = false; inline NativeScriptDesc() { - zeromem(&create_func, sizeof(godot_nativescript_instance_create_func)); - zeromem(&destroy_func, sizeof(godot_nativescript_instance_destroy_func)); + memset(&create_func, 0, sizeof(godot_nativescript_instance_create_func)); + memset(&destroy_func, 0, sizeof(godot_nativescript_instance_destroy_func)); } }; @@ -138,7 +137,7 @@ public: void set_script_class_icon_path(String p_icon_path); String get_script_class_icon_path() const; - virtual bool can_instance() const override; + virtual bool can_instantiate() const override; virtual Ref<Script> get_base_script() const override; //for script inheritance @@ -152,6 +151,13 @@ public: virtual void set_source_code(const String &p_code) override; virtual Error reload(bool p_keep_state = false) override; +#ifdef TOOLS_ENABLED + virtual const Vector<DocData::ClassDoc> &get_documentation() const override { + static Vector<DocData::ClassDoc> docs; + return docs; + } +#endif // TOOLS_ENABLED + virtual bool has_method(const StringName &p_method) const override; virtual MethodInfo get_method_info(const StringName &p_method) const override; @@ -169,17 +175,7 @@ public: virtual void get_script_method_list(List<MethodInfo> *p_list) const override; virtual void get_script_property_list(List<PropertyInfo> *p_list) const override; - virtual Vector<ScriptNetData> get_rpc_methods() const override; - virtual uint16_t get_rpc_method_id(const StringName &p_method) const override; - virtual StringName get_rpc_method(uint16_t p_id) const override; - virtual MultiplayerAPI::RPCMode get_rpc_mode_by_id(uint16_t p_id) const override; - virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const override; - - virtual Vector<ScriptNetData> get_rset_properties() const override; - virtual uint16_t get_rset_property_id(const StringName &p_variable) const override; - virtual StringName get_rset_property(uint16_t p_id) const override; - virtual MultiplayerAPI::RPCMode get_rset_mode_by_id(uint16_t p_id) const override; - virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const override; + virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const override; String get_class_documentation() const; String get_method_documentation(const StringName &p_method) const; @@ -217,17 +213,7 @@ public: String to_string(bool *r_valid); virtual Ref<Script> get_script() const; - virtual Vector<ScriptNetData> get_rpc_methods() const; - virtual uint16_t get_rpc_method_id(const StringName &p_method) const; - virtual StringName get_rpc_method(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rpc_mode_by_id(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const; - - virtual Vector<ScriptNetData> get_rset_properties() const; - virtual uint16_t get_rset_property_id(const StringName &p_variable) const; - virtual StringName get_rset_property(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rset_mode_by_id(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const; + virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const; virtual ScriptLanguage *get_language(); @@ -246,7 +232,7 @@ class NativeScriptLanguage : public ScriptLanguage { private: static NativeScriptLanguage *singleton; - int lang_idx; + int lang_idx = 0; void _unload_stuff(bool p_reload = false); @@ -254,7 +240,7 @@ private: #ifndef NO_THREADS Set<Ref<GDNativeLibrary>> libs_to_init; Set<NativeScript *> scripts_to_register; - volatile bool has_objects_to_register; // so that we don't lock mutex every frame - it's rarely needed + SafeFlag has_objects_to_register; // so that we don't lock mutex every frame - it's rarely needed void defer_init_library(Ref<GDNativeLibrary> lib, NativeScript *script); #endif @@ -271,19 +257,19 @@ private: struct ProfileData { StringName signature; - uint64_t call_count; - uint64_t self_time; - uint64_t total_time; - uint64_t frame_call_count; - uint64_t frame_self_time; - uint64_t frame_total_time; - uint64_t last_frame_call_count; - uint64_t last_frame_self_time; - uint64_t last_frame_total_time; + uint64_t call_count = 0; + uint64_t self_time = 0; + uint64_t total_time = 0; + uint64_t frame_call_count = 0; + uint64_t frame_self_time = 0; + uint64_t frame_total_time = 0; + uint64_t last_frame_call_count = 0; + uint64_t last_frame_self_time = 0; + uint64_t last_frame_total_time = 0; }; Map<StringName, ProfileData> profile_data; - bool profiling; + bool profiling = false; public: // These two maps must only be touched on the main thread @@ -327,10 +313,11 @@ public: virtual Error execute_file(const String &p_path); virtual void finish(); virtual void get_reserved_words(List<String> *p_words) const; + virtual bool is_control_flow_keyword(String p_keyword) const; virtual void get_comment_delimiters(List<String> *p_delimiters) const; virtual void get_string_delimiters(List<String> *p_delimiters) const; virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const; - virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const; + virtual bool validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const; virtual Script *create_script() const; virtual bool has_named_classes() const; virtual bool supports_builtin_mode() const; @@ -394,7 +381,7 @@ public: class ResourceFormatLoaderNativeScript : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/nativescript/register_types.cpp b/modules/gdnative/nativescript/register_types.cpp index ac8c7ab2fd..82a3459517 100644 --- a/modules/gdnative/nativescript/register_types.cpp +++ b/modules/gdnative/nativescript/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -45,15 +45,15 @@ Ref<ResourceFormatSaverNativeScript> resource_saver_gdns; void register_nativescript_types() { native_script_language = memnew(NativeScriptLanguage); - ClassDB::register_class<NativeScript>(); + GDREGISTER_CLASS(NativeScript); native_script_language->set_language_index(ScriptServer::get_language_count()); ScriptServer::register_language(native_script_language); - resource_saver_gdns.instance(); + resource_saver_gdns.instantiate(); ResourceSaver::add_resource_format_saver(resource_saver_gdns); - resource_loader_gdns.instance(); + resource_loader_gdns.instantiate(); ResourceLoader::add_resource_format_loader(resource_loader_gdns); } diff --git a/modules/gdnative/nativescript/register_types.h b/modules/gdnative/nativescript/register_types.h index 088bf38dd5..d12ac9eda3 100644 --- a/modules/gdnative/nativescript/register_types.h +++ b/modules/gdnative/nativescript/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.cpp b/modules/gdnative/net/multiplayer_peer_gdnative.cpp index 997eec6425..9908ed4533 100644 --- a/modules/gdnative/net/multiplayer_peer_gdnative.cpp +++ b/modules/gdnative/net/multiplayer_peer_gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -61,13 +61,23 @@ int MultiplayerPeerGDNative::get_available_packet_count() const { return interface->get_available_packet_count(interface->data); } -/* NetworkedMultiplayerPeer */ +/* MultiplayerPeer */ +void MultiplayerPeerGDNative::set_transfer_channel(int p_channel) { + ERR_FAIL_COND(interface == nullptr); + return interface->set_transfer_channel(interface->data, p_channel); +} + +int MultiplayerPeerGDNative::get_transfer_channel() const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->get_transfer_channel(interface->data); +} + void MultiplayerPeerGDNative::set_transfer_mode(TransferMode p_mode) { ERR_FAIL_COND(interface == nullptr); interface->set_transfer_mode(interface->data, (godot_int)p_mode); } -NetworkedMultiplayerPeer::TransferMode MultiplayerPeerGDNative::get_transfer_mode() const { +MultiplayerPeer::TransferMode MultiplayerPeerGDNative::get_transfer_mode() const { ERR_FAIL_COND_V(interface == nullptr, TRANSFER_MODE_UNRELIABLE); return (TransferMode)interface->get_transfer_mode(interface->data); } @@ -107,12 +117,13 @@ bool MultiplayerPeerGDNative::is_refusing_new_connections() const { return interface->is_refusing_new_connections(interface->data); } -NetworkedMultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status() const { +MultiplayerPeer::ConnectionStatus MultiplayerPeerGDNative::get_connection_status() const { ERR_FAIL_COND_V(interface == nullptr, CONNECTION_DISCONNECTED); return (ConnectionStatus)interface->get_connection_status(interface->data); } void MultiplayerPeerGDNative::_bind_methods() { + ADD_PROPERTY_DEFAULT("transfer_channel", 0); ADD_PROPERTY_DEFAULT("transfer_mode", TRANSFER_MODE_UNRELIABLE); ADD_PROPERTY_DEFAULT("refuse_new_connections", true); } diff --git a/modules/gdnative/net/multiplayer_peer_gdnative.h b/modules/gdnative/net/multiplayer_peer_gdnative.h index 64d764029f..ab084faae6 100644 --- a/modules/gdnative/net/multiplayer_peer_gdnative.h +++ b/modules/gdnative/net/multiplayer_peer_gdnative.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,12 +31,12 @@ #ifndef MULTIPLAYER_PEER_GDNATIVE_H #define MULTIPLAYER_PEER_GDNATIVE_H -#include "core/io/networked_multiplayer_peer.h" +#include "core/io/multiplayer_peer.h" #include "modules/gdnative/gdnative.h" #include "modules/gdnative/include/net/godot_net.h" -class MultiplayerPeerGDNative : public NetworkedMultiplayerPeer { - GDCLASS(MultiplayerPeerGDNative, NetworkedMultiplayerPeer); +class MultiplayerPeerGDNative : public MultiplayerPeer { + GDCLASS(MultiplayerPeerGDNative, MultiplayerPeer); protected: static void _bind_methods(); @@ -55,7 +55,9 @@ public: virtual int get_max_packet_size() const override; virtual int get_available_packet_count() const override; - /* Specific to NetworkedMultiplayerPeer */ + /* Specific to MultiplayerPeer */ + virtual void set_transfer_channel(int p_channel) override; + virtual int get_transfer_channel() const override; virtual void set_transfer_mode(TransferMode p_mode) override; virtual TransferMode get_transfer_mode() const override; virtual void set_target_peer(int p_peer_id) override; diff --git a/modules/gdnative/net/packet_peer_gdnative.cpp b/modules/gdnative/net/packet_peer_gdnative.cpp index 6bb21cb48d..3bcdfed8ff 100644 --- a/modules/gdnative/net/packet_peer_gdnative.cpp +++ b/modules/gdnative/net/packet_peer_gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/net/packet_peer_gdnative.h b/modules/gdnative/net/packet_peer_gdnative.h index 00de8f7f4c..29013f9367 100644 --- a/modules/gdnative/net/packet_peer_gdnative.h +++ b/modules/gdnative/net/packet_peer_gdnative.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/net/register_types.cpp b/modules/gdnative/net/register_types.cpp index 4e48a43210..46c383e5ae 100644 --- a/modules/gdnative/net/register_types.cpp +++ b/modules/gdnative/net/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,9 +34,9 @@ #include "stream_peer_gdnative.h" void register_net_types() { - ClassDB::register_class<MultiplayerPeerGDNative>(); - ClassDB::register_class<PacketPeerGDNative>(); - ClassDB::register_class<StreamPeerGDNative>(); + GDREGISTER_CLASS(MultiplayerPeerGDNative); + GDREGISTER_CLASS(PacketPeerGDNative); + GDREGISTER_CLASS(StreamPeerGDNative); } void unregister_net_types() { diff --git a/modules/gdnative/net/register_types.h b/modules/gdnative/net/register_types.h index 70b266f9b9..c99c6f6fbf 100644 --- a/modules/gdnative/net/register_types.h +++ b/modules/gdnative/net/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/net/stream_peer_gdnative.cpp b/modules/gdnative/net/stream_peer_gdnative.cpp index 9dcb184115..72ab72323d 100644 --- a/modules/gdnative/net/stream_peer_gdnative.cpp +++ b/modules/gdnative/net/stream_peer_gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/net/stream_peer_gdnative.h b/modules/gdnative/net/stream_peer_gdnative.h index 302fb48012..dd5abceb83 100644 --- a/modules/gdnative/net/stream_peer_gdnative.h +++ b/modules/gdnative/net/stream_peer_gdnative.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/net/webrtc_gdnative.cpp b/modules/gdnative/net/webrtc_gdnative.cpp index a7355e4d12..76ccbad009 100644 --- a/modules/gdnative/net/webrtc_gdnative.cpp +++ b/modules/gdnative/net/webrtc_gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -54,7 +54,7 @@ godot_error GDAPI godot_net_set_webrtc_library(const godot_net_webrtc_library *p #ifdef WEBRTC_GDNATIVE_ENABLED return (godot_error)WebRTCPeerConnectionGDNative::set_default_library(p_lib); #else - return ERR_UNAVAILABLE; + return (godot_error)ERR_UNAVAILABLE; #endif } } diff --git a/modules/gdnative/pluginscript/pluginscript_instance.cpp b/modules/gdnative/pluginscript/pluginscript_instance.cpp index 7d17a7d5ab..ed1c0af3ed 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.cpp +++ b/modules/gdnative/pluginscript/pluginscript_instance.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,7 +32,7 @@ // Godot imports #include "core/os/os.h" -#include "core/variant.h" +#include "core/variant/variant.h" // PluginScript imports #include "pluginscript_language.h" @@ -93,44 +93,15 @@ void PluginScriptInstance::notification(int p_notification) { _desc->notification(_data, p_notification); } -Vector<ScriptNetData> PluginScriptInstance::get_rpc_methods() const { - return _script->get_rpc_methods(); -} - -uint16_t PluginScriptInstance::get_rpc_method_id(const StringName &p_variable) const { - return _script->get_rpc_method_id(p_variable); -} - -StringName PluginScriptInstance::get_rpc_method(uint16_t p_id) const { - return _script->get_rpc_method(p_id); -} - -MultiplayerAPI::RPCMode PluginScriptInstance::get_rpc_mode_by_id(uint16_t p_id) const { - return _script->get_rpc_mode_by_id(p_id); -} - -MultiplayerAPI::RPCMode PluginScriptInstance::get_rpc_mode(const StringName &p_method) const { - return _script->get_rpc_mode(p_method); +String PluginScriptInstance::to_string(bool *r_valid) { + godot_string ret = _desc->to_string(_data, r_valid); + String str_ret = *(String *)&ret; + godot_string_destroy(&ret); + return str_ret; } -Vector<ScriptNetData> PluginScriptInstance::get_rset_properties() const { - return _script->get_rset_properties(); -} - -uint16_t PluginScriptInstance::get_rset_property_id(const StringName &p_variable) const { - return _script->get_rset_property_id(p_variable); -} - -StringName PluginScriptInstance::get_rset_property(uint16_t p_id) const { - return _script->get_rset_property(p_id); -} - -MultiplayerAPI::RPCMode PluginScriptInstance::get_rset_mode_by_id(uint16_t p_id) const { - return _script->get_rset_mode_by_id(p_id); -} - -MultiplayerAPI::RPCMode PluginScriptInstance::get_rset_mode(const StringName &p_variable) const { - return _script->get_rset_mode(p_variable); +const Vector<MultiplayerAPI::RPCConfig> PluginScriptInstance::get_rpc_methods() const { + return _script->get_rpc_methods(); } void PluginScriptInstance::refcount_incremented() { diff --git a/modules/gdnative/pluginscript/pluginscript_instance.h b/modules/gdnative/pluginscript/pluginscript_instance.h index 690d1a0432..25b62ae8ab 100644 --- a/modules/gdnative/pluginscript/pluginscript_instance.h +++ b/modules/gdnative/pluginscript/pluginscript_instance.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,7 +32,7 @@ #define PLUGINSCRIPT_INSTANCE_H // Godot imports -#include "core/script_language.h" +#include "core/object/script_language.h" // PluginScript imports #include <pluginscript/godot_pluginscript.h> @@ -44,10 +44,10 @@ class PluginScriptInstance : public ScriptInstance { private: Ref<PluginScript> _script; - Object *_owner; + Object *_owner = nullptr; Variant _owner_variant; - godot_pluginscript_instance_data *_data; - const godot_pluginscript_instance_desc *_desc; + godot_pluginscript_instance_data *_data = nullptr; + const godot_pluginscript_instance_desc *_desc = nullptr; public: _FORCE_INLINE_ Object *get_owner() { return _owner; } @@ -63,6 +63,7 @@ public: virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error); virtual void notification(int p_notification); + virtual String to_string(bool *r_valid); virtual Ref<Script> get_script() const; @@ -70,17 +71,7 @@ public: void set_path(const String &p_path); - virtual Vector<ScriptNetData> get_rpc_methods() const; - virtual uint16_t get_rpc_method_id(const StringName &p_method) const; - virtual StringName get_rpc_method(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rpc_mode_by_id(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const; - - virtual Vector<ScriptNetData> get_rset_properties() const; - virtual uint16_t get_rset_property_id(const StringName &p_variable) const; - virtual StringName get_rset_property(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rset_mode_by_id(uint16_t p_id) const; - virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const; + virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const; virtual void refcount_incremented(); virtual bool refcount_decremented(); diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp index bccbe95033..79aba342c9 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.cpp +++ b/modules/gdnative/pluginscript/pluginscript_language.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -29,9 +29,9 @@ /*************************************************************************/ // Godot imports -#include "core/os/file_access.h" +#include "core/config/project_settings.h" +#include "core/io/file_access.h" #include "core/os/os.h" -#include "core/project_settings.h" // PluginScript imports #include "pluginscript_language.h" #include "pluginscript_script.h" @@ -77,6 +77,10 @@ void PluginScriptLanguage::get_reserved_words(List<String> *p_words) const { } } +bool PluginScriptLanguage::is_control_flow_keyword(String p_keyword) const { + return false; +} + void PluginScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const { if (_desc.comment_delimiters) { const char **w = _desc.comment_delimiters; @@ -108,20 +112,29 @@ Ref<Script> PluginScriptLanguage::get_template(const String &p_class_name, const return script; } -bool PluginScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const { +bool PluginScriptLanguage::validate(const String &p_script, const String &p_path, List<String> *r_functions, List<ScriptLanguage::ScriptError> *r_errors, List<ScriptLanguage::Warning> *r_warnings, Set<int> *r_safe_lines) const { PackedStringArray functions; + Array errors; if (_desc.validate) { bool ret = _desc.validate( _data, (godot_string *)&p_script, - &r_line_error, - &r_col_error, - (godot_string *)&r_test_error, (godot_string *)&p_path, - (godot_packed_string_array *)&functions); + (godot_packed_string_array *)&functions, + (godot_array *)&errors); for (int i = 0; i < functions.size(); i++) { r_functions->push_back(functions[i]); } + if (r_errors) { + for (int i = 0; i < errors.size(); i++) { + Dictionary error = errors[i]; + ScriptLanguage::ScriptError e; + e.line = error["line"]; + e.column = error["column"]; + e.message = error["message"]; + r_errors->push_back(e); + } + } return ret; } return true; @@ -142,6 +155,10 @@ bool PluginScriptLanguage::supports_builtin_mode() const { return _desc.supports_builtin_mode; } +bool PluginScriptLanguage::can_inherit_from_file() const { + return _desc.can_inherit_from_file; +} + int PluginScriptLanguage::find_function(const String &p_function, const String &p_code) const { if (_desc.find_function) { return _desc.find_function(_data, (godot_string *)&p_function, (godot_string *)&p_code); @@ -398,6 +415,32 @@ void PluginScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool #endif } +bool PluginScriptLanguage::handles_global_class_type(const String &p_type) const { + return p_type == "PluginScript"; +} + +String PluginScriptLanguage::get_global_class_name(const String &p_path, String *r_base_type, String *r_icon_path) const { + if (!p_path.is_empty()) { + Ref<PluginScript> script = ResourceLoader::load(p_path, "PluginScript"); + if (script.is_valid()) { + if (r_base_type) { + *r_base_type = script->get_instance_base_type(); + } + if (r_icon_path) { + *r_icon_path = script->get_script_class_icon_path(); + } + return script->get_script_class_name(); + } + if (r_base_type) { + *r_base_type = String(); + } + if (r_icon_path) { + *r_icon_path = String(); + } + } + return String(); +} + void PluginScriptLanguage::lock() { _lock.lock(); } diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h index dd6758713f..26ab4a95e3 100644 --- a/modules/gdnative/pluginscript/pluginscript_language.h +++ b/modules/gdnative/pluginscript/pluginscript_language.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,9 +34,9 @@ // Godot imports #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/map.h" -#include "core/script_language.h" -#include "core/self_list.h" +#include "core/object/script_language.h" +#include "core/templates/map.h" +#include "core/templates/self_list.h" // PluginScript imports #include "pluginscript_loader.h" #include <pluginscript/godot_pluginscript.h> @@ -71,14 +71,15 @@ public: /* EDITOR FUNCTIONS */ virtual void get_reserved_words(List<String> *p_words) const; + virtual bool is_control_flow_keyword(String p_keyword) const; virtual void get_comment_delimiters(List<String> *p_delimiters) const; virtual void get_string_delimiters(List<String> *p_delimiters) const; virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const; - virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const; + virtual bool validate(const String &p_script, const String &p_path = "", List<String> *r_functions = nullptr, List<ScriptLanguage::ScriptError> *r_errors = nullptr, List<ScriptLanguage::Warning> *r_warnings = nullptr, Set<int> *r_safe_lines = nullptr) const; virtual Script *create_script() const; virtual bool has_named_classes() const; virtual bool supports_builtin_mode() const; - virtual bool can_inherit_from_file() { return true; } + virtual bool can_inherit_from_file() const; virtual int find_function(const String &p_function, const String &p_code) const; virtual String make_function(const String &p_class, const String &p_name, const PackedStringArray &p_args) const; virtual Error complete_code(const String &p_code, const String &p_path, Object *p_owner, List<ScriptCodeCompletionOption> *r_options, bool &r_force, String &r_call_hint); @@ -122,6 +123,11 @@ public: virtual void frame(); + /* GLOBAL CLASSES */ + + virtual bool handles_global_class_type(const String &p_type) const; + virtual String get_global_class_name(const String &p_path, String *r_base_type = nullptr, String *r_icon_path = nullptr) const; + void lock(); void unlock(); diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp index 4feee4f4a5..462452a897 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.cpp +++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -29,7 +29,7 @@ /*************************************************************************/ // Godot imports -#include "core/os/file_access.h" +#include "core/io/file_access.h" // Pythonscript imports #include "pluginscript_language.h" #include "pluginscript_loader.h" @@ -39,7 +39,7 @@ ResourceFormatLoaderPluginScript::ResourceFormatLoaderPluginScript(PluginScriptL _language = language; } -RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { +RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { if (r_error) { *r_error = ERR_FILE_CANT_OPEN; } diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h index 35fc79c2ca..e5d665c186 100644 --- a/modules/gdnative/pluginscript/pluginscript_loader.h +++ b/modules/gdnative/pluginscript/pluginscript_loader.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -34,7 +34,7 @@ // Godot imports #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/script_language.h" +#include "core/object/script_language.h" class PluginScriptLanguage; @@ -43,7 +43,7 @@ class ResourceFormatLoaderPluginScript : public ResourceFormatLoader { public: ResourceFormatLoaderPluginScript(PluginScriptLanguage *language); - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/pluginscript/pluginscript_script.cpp b/modules/gdnative/pluginscript/pluginscript_script.cpp index 87c6288806..5380858582 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.cpp +++ b/modules/gdnative/pluginscript/pluginscript_script.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -29,7 +29,7 @@ /*************************************************************************/ // Godot imports -#include "core/os/file_access.h" +#include "core/io/file_access.h" // PluginScript imports #include "pluginscript_instance.h" #include "pluginscript_script.h" @@ -38,13 +38,13 @@ #ifdef DEBUG_ENABLED #define __ASSERT_SCRIPT_REASON "Cannot retrieve PluginScript class for this script, is your code correct?" -#define ASSERT_SCRIPT_VALID() \ - { \ - ERR_FAIL_COND_MSG(!can_instance(), __ASSERT_SCRIPT_REASON); \ +#define ASSERT_SCRIPT_VALID() \ + { \ + ERR_FAIL_COND_MSG(!can_instantiate(), __ASSERT_SCRIPT_REASON); \ } -#define ASSERT_SCRIPT_VALID_V(ret) \ - { \ - ERR_FAIL_COND_V_MSG(!can_instance(), ret, __ASSERT_SCRIPT_REASON); \ +#define ASSERT_SCRIPT_VALID_V(ret) \ + { \ + ERR_FAIL_COND_V_MSG(!can_instantiate(), ret, __ASSERT_SCRIPT_REASON); \ } #else #define ASSERT_SCRIPT_VALID() @@ -94,9 +94,9 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal Object *owner = nullptr; if (get_instance_base_type() == "") { - owner = memnew(Reference); + owner = memnew(RefCounted); } else { - owner = ClassDB::instance(get_instance_base_type()); + owner = ClassDB::instantiate(get_instance_base_type()); } if (!owner) { @@ -104,7 +104,7 @@ Variant PluginScript::_new(const Variant **p_args, int p_argcount, Callable::Cal return Variant(); } - Reference *r = Object::cast_to<Reference>(owner); + RefCounted *r = Object::cast_to<RefCounted>(owner); if (r) { ref = REF(r); } @@ -133,15 +133,26 @@ void PluginScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) #endif -bool PluginScript::can_instance() const { +bool PluginScript::can_instantiate() const { bool can = _valid || (!_tool && !ScriptServer::is_scripting_enabled()); return can; } bool PluginScript::inherits_script(const Ref<Script> &p_script) const { -#ifndef _MSC_VER -#warning inheritance needs to be implemented in PluginScript -#endif + Ref<PluginScript> ps = p_script; + if (ps.is_null()) { + return false; + } + + const PluginScript *s = this; + + while (s) { + if (s == p_script.ptr()) { + return true; + } + s = Object::cast_to<PluginScript>(s->_ref_base_parent.ptr()); + } + return false; } @@ -198,7 +209,7 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) { StringName base_type = get_instance_base_type(); if (base_type) { if (!ClassDB::is_parent_class(p_this->get_class_name(), base_type)) { - String msg = "Script inherits from native type '" + String(base_type) + "', so it can't be instanced in object of type: '" + p_this->get_class() + "'"; + String msg = "Script inherits from native type '" + String(base_type) + "', so it can't be instantiated in object of type: '" + p_this->get_class() + "'"; // TODO: implement PluginscriptLanguage::debug_break_parse // if (EngineDebugger::is_active()) { // _language->debug_break_parse(get_path(), 0, msg); @@ -212,6 +223,8 @@ ScriptInstance *PluginScript::instance_create(Object *p_this) { } bool PluginScript::instance_has(const Object *p_this) const { + ERR_FAIL_COND_V(!_language, false); + _language->lock(); bool hasit = _instances.has((Object *)p_this); _language->unlock(); @@ -302,6 +315,7 @@ Error PluginScript::reload(bool p_keep_state) { _data = manifest.data; _name = *(StringName *)&manifest.name; _tool = manifest.is_tool; + _icon_path = *(String *)&manifest.icon_path; Dictionary *members = (Dictionary *)&manifest.member_lines; for (const Variant *key = members->next(); key != nullptr; key = members->next(key)) { @@ -309,10 +323,9 @@ Error PluginScript::reload(bool p_keep_state) { } Array *methods = (Array *)&manifest.methods; _rpc_methods.clear(); - _rpc_variables.clear(); if (_ref_base_parent.is_valid()) { + /// XXX TODO Should this be _rpc_methods.append_array(...) _rpc_methods = _ref_base_parent->get_rpc_methods(); - _rpc_variables = _ref_base_parent->get_rset_properties(); } for (int i = 0; i < methods->size(); ++i) { Dictionary v = (*methods)[i]; @@ -321,9 +334,10 @@ Error PluginScript::reload(bool p_keep_state) { // rpc_mode is passed as an optional field and is not part of MethodInfo Variant var = v["rpc_mode"]; if (var != Variant()) { - ScriptNetData nd; + MultiplayerAPI::RPCConfig nd; nd.name = mi.name; - nd.mode = MultiplayerAPI::RPCMode(int(var)); + nd.rpc_mode = MultiplayerAPI::RPCMode(int(var)); + // TODO Transfer Channel if (_rpc_methods.find(nd) == -1) { _rpc_methods.push_back(nd); } @@ -331,7 +345,7 @@ Error PluginScript::reload(bool p_keep_state) { } // Sort so we are 100% that they are always the same. - _rpc_methods.sort_custom<SortNetData>(); + _rpc_methods.sort_custom<MultiplayerAPI::SortRPCConfig>(); Array *signals = (Array *)&manifest.signals; for (int i = 0; i < signals->size(); ++i) { @@ -345,21 +359,8 @@ Error PluginScript::reload(bool p_keep_state) { PropertyInfo pi = PropertyInfo::from_dict(v); _properties_info[pi.name] = pi; _properties_default_values[pi.name] = v["default_value"]; - // rset_mode is passed as an optional field and is not part of PropertyInfo - Variant var = v["rset_mode"]; - if (var != Variant()) { - ScriptNetData nd; - nd.name = pi.name; - nd.mode = MultiplayerAPI::RPCMode(int(var)); - if (_rpc_variables.find(nd) == -1) { - _rpc_variables.push_back(nd); - } - } } - // Sort so we are 100% that they are always the same. - _rpc_variables.sort_custom<SortNetData>(); - #ifdef TOOLS_ENABLED /*for (Set<PlaceHolderScriptInstance*>::Element *E=placeholders.front();E;E=E->next()) { @@ -440,10 +441,10 @@ Error PluginScript::load_source_code(const String &p_path) { FileAccess *f = FileAccess::open(p_path, FileAccess::READ, &err); ERR_FAIL_COND_V_MSG(err, err, "Cannot open file '" + p_path + "'."); - int len = f->get_len(); + uint64_t len = f->get_length(); sourcef.resize(len + 1); uint8_t *w = sourcef.ptrw(); - int r = f->get_buffer(w, len); + uint64_t r = f->get_buffer(w, len); f->close(); memdelete(f); ERR_FAIL_COND_V(r != len, ERR_CANT_OPEN); @@ -483,76 +484,10 @@ int PluginScript::get_member_line(const StringName &p_member) const { return -1; } -Vector<ScriptNetData> PluginScript::get_rpc_methods() const { +const Vector<MultiplayerAPI::RPCConfig> PluginScript::get_rpc_methods() const { return _rpc_methods; } -uint16_t PluginScript::get_rpc_method_id(const StringName &p_method) const { - ASSERT_SCRIPT_VALID_V(UINT16_MAX); - for (int i = 0; i < _rpc_methods.size(); i++) { - if (_rpc_methods[i].name == p_method) { - return i; - } - } - return UINT16_MAX; -} - -StringName PluginScript::get_rpc_method(const uint16_t p_rpc_method_id) const { - ASSERT_SCRIPT_VALID_V(StringName()); - if (p_rpc_method_id >= _rpc_methods.size()) { - return StringName(); - } - return _rpc_methods[p_rpc_method_id].name; -} - -MultiplayerAPI::RPCMode PluginScript::get_rpc_mode_by_id(const uint16_t p_rpc_method_id) const { - ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED); - if (p_rpc_method_id >= _rpc_methods.size()) { - return MultiplayerAPI::RPC_MODE_DISABLED; - } - return _rpc_methods[p_rpc_method_id].mode; -} - -MultiplayerAPI::RPCMode PluginScript::get_rpc_mode(const StringName &p_method) const { - ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED); - return get_rpc_mode_by_id(get_rpc_method_id(p_method)); -} - -Vector<ScriptNetData> PluginScript::get_rset_properties() const { - return _rpc_variables; -} - -uint16_t PluginScript::get_rset_property_id(const StringName &p_property) const { - ASSERT_SCRIPT_VALID_V(UINT16_MAX); - for (int i = 0; i < _rpc_variables.size(); i++) { - if (_rpc_variables[i].name == p_property) { - return i; - } - } - return UINT16_MAX; -} - -StringName PluginScript::get_rset_property(const uint16_t p_rset_property_id) const { - ASSERT_SCRIPT_VALID_V(StringName()); - if (p_rset_property_id >= _rpc_variables.size()) { - return StringName(); - } - return _rpc_variables[p_rset_property_id].name; -} - -MultiplayerAPI::RPCMode PluginScript::get_rset_mode_by_id(const uint16_t p_rset_property_id) const { - ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED); - if (p_rset_property_id >= _rpc_variables.size()) { - return MultiplayerAPI::RPC_MODE_DISABLED; - } - return _rpc_variables[p_rset_property_id].mode; -} - -MultiplayerAPI::RPCMode PluginScript::get_rset_mode(const StringName &p_variable) const { - ASSERT_SCRIPT_VALID_V(MultiplayerAPI::RPC_MODE_DISABLED); - return get_rset_mode_by_id(get_rset_property_id(p_variable)); -} - PluginScript::PluginScript() : _script_list(this) { } diff --git a/modules/gdnative/pluginscript/pluginscript_script.h b/modules/gdnative/pluginscript/pluginscript_script.h index 9cd38cd4b4..838195147f 100644 --- a/modules/gdnative/pluginscript/pluginscript_script.h +++ b/modules/gdnative/pluginscript/pluginscript_script.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,7 +32,9 @@ #define PLUGINSCRIPT_SCRIPT_H // Godot imports -#include "core/script_language.h" + +#include "core/doc_data.h" +#include "core/object/script_language.h" // PluginScript imports #include "pluginscript_language.h" #include <pluginscript/godot_pluginscript.h> @@ -59,14 +61,14 @@ private: Map<StringName, PropertyInfo> _properties_info; Map<StringName, MethodInfo> _signals_info; Map<StringName, MethodInfo> _methods_info; - Vector<ScriptNetData> _rpc_methods; - Vector<ScriptNetData> _rpc_variables; + Vector<MultiplayerAPI::RPCConfig> _rpc_methods; Set<Object *> _instances; //exported members String _source; String _path; StringName _name; + String _icon_path; protected: static void _bind_methods(); @@ -82,7 +84,15 @@ protected: virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) override; #endif public: - virtual bool can_instance() const override; + String get_script_class_name() const { + return _name; + } + + String get_script_class_icon_path() const { + return _icon_path; + } + + virtual bool can_instantiate() const override; virtual Ref<Script> get_base_script() const override; //for script inheritance @@ -97,6 +107,13 @@ public: // TODO: load_source_code only allow utf-8 file, should handle bytecode as well ? virtual Error load_source_code(const String &p_path); +#ifdef TOOLS_ENABLED + virtual const Vector<DocData::ClassDoc> &get_documentation() const override { + static Vector<DocData::ClassDoc> docs; + return docs; + } +#endif // TOOLS_ENABLED + virtual bool has_method(const StringName &p_method) const override; virtual MethodInfo get_method_info(const StringName &p_method) const override; @@ -119,17 +136,7 @@ public: virtual int get_member_line(const StringName &p_member) const override; - virtual Vector<ScriptNetData> get_rpc_methods() const override; - virtual uint16_t get_rpc_method_id(const StringName &p_method) const override; - virtual StringName get_rpc_method(const uint16_t p_rpc_method_id) const override; - virtual MultiplayerAPI::RPCMode get_rpc_mode_by_id(const uint16_t p_rpc_method_id) const override; - virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const override; - - virtual Vector<ScriptNetData> get_rset_properties() const override; - virtual uint16_t get_rset_property_id(const StringName &p_property) const override; - virtual StringName get_rset_property(const uint16_t p_rset_property_id) const override; - virtual MultiplayerAPI::RPCMode get_rset_mode_by_id(const uint16_t p_rpc_method_id) const override; - virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const override; + virtual const Vector<MultiplayerAPI::RPCConfig> get_rpc_methods() const override; PluginScript(); void init(PluginScriptLanguage *language); diff --git a/modules/gdnative/pluginscript/register_types.cpp b/modules/gdnative/pluginscript/register_types.cpp index 97a48b0e89..7faacfdcb9 100644 --- a/modules/gdnative/pluginscript/register_types.cpp +++ b/modules/gdnative/pluginscript/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,11 +30,11 @@ #include "register_types.h" +#include "core/config/project_settings.h" +#include "core/io/dir_access.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" -#include "core/os/dir_access.h" #include "core/os/os.h" -#include "core/project_settings.h" #include "scene/main/scene_tree.h" #include "pluginscript_language.h" @@ -107,7 +107,7 @@ void GDAPI godot_pluginscript_register_language(const godot_pluginscript_languag } void register_pluginscript_types() { - ClassDB::register_class<PluginScript>(); + GDREGISTER_CLASS(PluginScript); } void unregister_pluginscript_types() { diff --git a/modules/gdnative/pluginscript/register_types.h b/modules/gdnative/pluginscript/register_types.h index c6a64b4f40..2118f668e9 100644 --- a/modules/gdnative/pluginscript/register_types.h +++ b/modules/gdnative/pluginscript/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp index 3a2d0b09a3..e4c2b20224 100644 --- a/modules/gdnative/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -38,13 +38,12 @@ #include "net/register_types.h" #include "pluginscript/register_types.h" #include "videodecoder/register_types.h" -#include "xr/register_types.h" -#include "core/engine.h" +#include "core/config/engine.h" +#include "core/config/project_settings.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/os/os.h" -#include "core/project_settings.h" #ifdef TOOLS_ENABLED #include "editor/editor_export.h" @@ -79,9 +78,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty List<String> entry_keys; config->get_section_keys("entry", &entry_keys); - for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -112,9 +109,7 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty List<String> dependency_keys; config->get_section_keys("dependencies", &dependency_keys); - for (List<String>::Element *E = dependency_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : dependency_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -142,16 +137,14 @@ void GDNativeExportPlugin::_export_file(const String &p_path, const String &p_ty } } - // Add symbols for staticaly linked libraries on iOS + // Add symbols for statically linked libraries on iOS if (p_features.has("iOS")) { bool should_fake_dynamic = false; List<String> entry_keys; config->get_section_keys("entry", &entry_keys); - for (List<String>::Element *E = entry_keys.front(); E; E = E->next()) { - String key = E->get(); - + for (const String &key : entry_keys) { Vector<String> tags = key.split("."); bool skip = false; @@ -230,7 +223,7 @@ static void editor_init_callback() { ProjectSettingsEditor::get_singleton()->get_tabs()->add_child(library_editor); Ref<GDNativeExportPlugin> export_plugin; - export_plugin.instance(); + export_plugin.instantiate(); EditorExport::get_singleton()->add_export_plugin(export_plugin); @@ -259,13 +252,13 @@ void register_gdnative_types() { EditorNode::add_init_callback(editor_init_callback); #endif - ClassDB::register_class<GDNativeLibrary>(); - ClassDB::register_class<GDNative>(); + GDREGISTER_CLASS(GDNativeLibrary); + GDREGISTER_CLASS(GDNative); - resource_loader_gdnlib.instance(); + resource_loader_gdnlib.instantiate(); ResourceLoader::add_resource_format_loader(resource_loader_gdnlib); - resource_saver_gdnlib.instance(); + resource_saver_gdnlib.instantiate(); ResourceSaver::add_resource_format_saver(resource_saver_gdnlib); GDNativeCallRegistry::singleton = memnew(GDNativeCallRegistry); @@ -273,7 +266,6 @@ void register_gdnative_types() { GDNativeCallRegistry::singleton->register_native_call_type("standard_varcall", cb_standard_varcall); register_net_types(); - register_xr_types(); register_nativescript_types(); register_pluginscript_types(); register_videodecoder_types(); @@ -298,7 +290,7 @@ void register_gdnative_types() { Ref<GDNativeLibrary> lib = ResourceLoader::load(path); Ref<GDNative> singleton; - singleton.instance(); + singleton.instantiate(); singleton->set_library(lib); if (!singleton->initialize()) { @@ -337,7 +329,6 @@ void unregister_gdnative_types() { unregister_videodecoder_types(); unregister_pluginscript_types(); unregister_nativescript_types(); - unregister_xr_types(); unregister_net_types(); memdelete(GDNativeCallRegistry::singleton); @@ -363,7 +354,7 @@ void unregister_gdnative_types() { print_line(String("aabb:\t") + itos(sizeof(AABB))); print_line(String("rid:\t") + itos(sizeof(RID))); print_line(String("string:\t") + itos(sizeof(String))); - print_line(String("transform:\t") + itos(sizeof(Transform))); + print_line(String("transform:\t") + itos(sizeof(Transform3D))); print_line(String("transfo2D:\t") + itos(sizeof(Transform2D))); print_line(String("variant:\t") + itos(sizeof(Variant))); print_line(String("vector2:\t") + itos(sizeof(Vector2))); diff --git a/modules/gdnative/register_types.h b/modules/gdnative/register_types.h index b5c182f8b7..662c638442 100644 --- a/modules/gdnative/register_types.h +++ b/modules/gdnative/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/tests/test_string.h b/modules/gdnative/tests/test_string.h deleted file mode 100644 index aeb855a1c4..0000000000 --- a/modules/gdnative/tests/test_string.h +++ /dev/null @@ -1,1980 +0,0 @@ -/*************************************************************************/ -/* test_string.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef TEST_GDNATIVE_STRING_H -#define TEST_GDNATIVE_STRING_H - -namespace TestGDNativeString { - -#include "gdnative/string.h" - -#include "tests/test_macros.h" - -int u32scmp(const char32_t *l, const char32_t *r) { - for (; *l == *r && *l && *r; l++, r++) - ; - return *l - *r; -} - -TEST_CASE("[GDNative String] Construct from Latin-1 char string") { - godot_string s; - - godot_string_new_with_latin1_chars(&s, "Hello"); - CHECK(u32scmp(godot_string_get_data(&s), U"Hello") == 0); - godot_string_destroy(&s); - - godot_string_new_with_latin1_chars_and_len(&s, "Hello", 3); - CHECK(u32scmp(godot_string_get_data(&s), U"Hel") == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Construct from wchar_t string") { - godot_string s; - - godot_string_new_with_wide_chars(&s, L"Give me"); - CHECK(u32scmp(godot_string_get_data(&s), U"Give me") == 0); - godot_string_destroy(&s); - - godot_string_new_with_wide_chars_and_len(&s, L"Give me", 3); - CHECK(u32scmp(godot_string_get_data(&s), U"Giv") == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Construct from UTF-8 char string") { - static const char32_t u32str[] = { 0x0045, 0x0020, 0x304A, 0x360F, 0x3088, 0x3046, 0x1F3A4, 0 }; - static const char32_t u32str_short[] = { 0x0045, 0x0020, 0x304A, 0 }; - static const uint8_t u8str[] = { 0x45, 0x20, 0xE3, 0x81, 0x8A, 0xE3, 0x98, 0x8F, 0xE3, 0x82, 0x88, 0xE3, 0x81, 0x86, 0xF0, 0x9F, 0x8E, 0xA4, 0 }; - - godot_string s; - - godot_string_new_with_utf8_chars(&s, (const char *)u8str); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf8_chars_and_len(&s, (const char *)u8str, 5); - CHECK(u32scmp(godot_string_get_data(&s), u32str_short) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf32_chars(&s, u32str); - godot_char_string cs = godot_string_utf8(&s); - godot_string_parse_utf8(&s, godot_char_string_get_data(&cs)); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - godot_char_string_destroy(&cs); - - godot_string_new_with_utf32_chars(&s, u32str); - cs = godot_string_utf8(&s); - godot_string_parse_utf8_with_len(&s, godot_char_string_get_data(&cs), godot_char_string_length(&cs)); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - godot_char_string_destroy(&cs); -} - -TEST_CASE("[GDNative String] Construct from UTF-8 string with BOM") { - static const char32_t u32str[] = { 0x0045, 0x0020, 0x304A, 0x360F, 0x3088, 0x3046, 0x1F3A4, 0 }; - static const char32_t u32str_short[] = { 0x0045, 0x0020, 0x304A, 0 }; - static const uint8_t u8str[] = { 0xEF, 0xBB, 0xBF, 0x45, 0x20, 0xE3, 0x81, 0x8A, 0xE3, 0x98, 0x8F, 0xE3, 0x82, 0x88, 0xE3, 0x81, 0x86, 0xF0, 0x9F, 0x8E, 0xA4, 0 }; - - godot_string s; - - godot_string_new_with_utf8_chars(&s, (const char *)u8str); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf8_chars_and_len(&s, (const char *)u8str, 8); - CHECK(u32scmp(godot_string_get_data(&s), u32str_short) == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Construct from UTF-16 string") { - static const char32_t u32str[] = { 0x0045, 0x0020, 0x1F3A4, 0x360F, 0x3088, 0x3046, 0x1F3A4, 0 }; - static const char32_t u32str_short[] = { 0x0045, 0x0020, 0x1F3A4, 0 }; - static const char16_t u16str[] = { 0x0045, 0x0020, 0xD83C, 0xDFA4, 0x360F, 0x3088, 0x3046, 0xD83C, 0xDFA4, 0 }; - - godot_string s; - - godot_string_new_with_utf16_chars(&s, u16str); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf16_chars_and_len(&s, u16str, 4); - CHECK(u32scmp(godot_string_get_data(&s), u32str_short) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf32_chars(&s, u32str); - godot_char16_string cs = godot_string_utf16(&s); - godot_string_parse_utf16(&s, godot_char16_string_get_data(&cs)); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - godot_char16_string_destroy(&cs); - - godot_string_new_with_utf32_chars(&s, u32str); - cs = godot_string_utf16(&s); - godot_string_parse_utf16_with_len(&s, godot_char16_string_get_data(&cs), godot_char16_string_length(&cs)); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - godot_char16_string_destroy(&cs); -} - -TEST_CASE("[GDNative String] Construct from UTF-16 string with BOM ") { - static const char32_t u32str[] = { 0x0045, 0x0020, 0x1F3A4, 0x360F, 0x3088, 0x3046, 0x1F3A4, 0 }; - static const char32_t u32str_short[] = { 0x0045, 0x0020, 0x1F3A4, 0 }; - static const char16_t u16str[] = { 0xFEFF, 0x0045, 0x0020, 0xD83C, 0xDFA4, 0x360F, 0x3088, 0x3046, 0xD83C, 0xDFA4, 0 }; - static const char16_t u16str_swap[] = { 0xFFFE, 0x4500, 0x2000, 0x3CD8, 0xA4DF, 0x0F36, 0x8830, 0x4630, 0x3CD8, 0xA4DF, 0 }; - - godot_string s; - - godot_string_new_with_utf16_chars(&s, u16str); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf16_chars(&s, u16str_swap); - CHECK(u32scmp(godot_string_get_data(&s), u32str) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf16_chars_and_len(&s, u16str, 5); - CHECK(u32scmp(godot_string_get_data(&s), u32str_short) == 0); - godot_string_destroy(&s); - - godot_string_new_with_utf16_chars_and_len(&s, u16str_swap, 5); - CHECK(u32scmp(godot_string_get_data(&s), u32str_short) == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Construct string copy") { - godot_string s, t; - - godot_string_new_with_latin1_chars(&s, "Hello"); - godot_string_new_copy(&t, &s); - CHECK(u32scmp(godot_string_get_data(&t), U"Hello") == 0); - godot_string_destroy(&t); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Construct empty string") { - godot_string s; - - godot_string_new(&s); - CHECK(u32scmp(godot_string_get_data(&s), U"") == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] ASCII/Latin-1") { - godot_string s; - godot_string_new_with_utf32_chars(&s, U"Primero Leche"); - - godot_char_string cs = godot_string_ascii(&s); - CHECK(strcmp(godot_char_string_get_data(&cs), "Primero Leche") == 0); - godot_char_string_destroy(&cs); - - cs = godot_string_latin1(&s); - CHECK(strcmp(godot_char_string_get_data(&cs), "Primero Leche") == 0); - godot_char_string_destroy(&cs); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Comparisons (equal)") { - godot_string s, t; - - godot_string_new_with_latin1_chars(&s, "Test Compare"); - godot_string_new_with_latin1_chars(&t, "Test Compare"); - CHECK(godot_string_operator_equal(&s, &t)); - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] Comparisons (operator <)") { - godot_string s, t; - - godot_string_new_with_latin1_chars(&s, "Bees"); - - godot_string_new_with_latin1_chars(&t, "Elephant"); - CHECK(godot_string_operator_less(&s, &t)); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Amber"); - CHECK(!godot_string_operator_less(&s, &t)); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Beatrix"); - CHECK(!godot_string_operator_less(&s, &t)); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Concatenation (operator +)") { - godot_string s, t, x; - - godot_string_new_with_latin1_chars(&s, "Hel"); - godot_string_new_with_latin1_chars(&t, "lo"); - x = godot_string_operator_plus(&s, &t); - CHECK(u32scmp(godot_string_get_data(&x), U"Hello") == 0); - godot_string_destroy(&x); - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] Testing size and length of string") { - godot_string s; - - godot_string_new_with_latin1_chars(&s, "Mellon"); - CHECK(godot_string_length(&s) == 6); - godot_string_destroy(&s); - - godot_string_new_with_latin1_chars(&s, "Mellon1"); - CHECK(godot_string_length(&s) == 7); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Testing for empty string") { - godot_string s; - - godot_string_new_with_latin1_chars(&s, "Mellon"); - CHECK(!godot_string_empty(&s)); - godot_string_destroy(&s); - - godot_string_new_with_latin1_chars(&s, ""); - CHECK(godot_string_empty(&s)); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Test chr") { - godot_string s; - - s = godot_string_chr('H'); - CHECK(u32scmp(godot_string_get_data(&s), U"H") == 0); - godot_string_destroy(&s); - - s = godot_string_chr(0x3012); - CHECK(godot_string_operator_index_const(&s, 0) == 0x3012); - godot_string_destroy(&s); - - ERR_PRINT_OFF - s = godot_string_chr(0xd812); - CHECK(godot_string_operator_index_const(&s, 0) == 0xfffd); // Unpaired UTF-16 surrogate - godot_string_destroy(&s); - - s = godot_string_chr(0x20d812); - CHECK(godot_string_operator_index_const(&s, 0) == 0xfffd); // Outside UTF-32 range - godot_string_destroy(&s); - ERR_PRINT_ON -} - -TEST_CASE("[GDNative String] Operator []") { - godot_string s; - - godot_string_new_with_latin1_chars(&s, "Hello"); - CHECK(*godot_string_operator_index(&s, 1) == 'e'); - CHECK(godot_string_operator_index_const(&s, 0) == 'H'); - CHECK(godot_string_ord_at(&s, 0) == 'H'); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Case function test") { - godot_string s, t; - - godot_string_new_with_latin1_chars(&s, "MoMoNgA"); - - t = godot_string_to_upper(&s); - CHECK(u32scmp(godot_string_get_data(&t), U"MOMONGA") == 0); - godot_string_destroy(&t); - - t = godot_string_to_lower(&s); - CHECK(u32scmp(godot_string_get_data(&t), U"momonga") == 0); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Case compare function test") { - godot_string s, t; - - godot_string_new_with_latin1_chars(&s, "MoMoNgA"); - godot_string_new_with_latin1_chars(&t, "momonga"); - - CHECK(godot_string_casecmp_to(&s, &t) != 0); - CHECK(godot_string_nocasecmp_to(&s, &t) == 0); - - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] Natural compare function test") { - godot_string s, t; - - godot_string_new_with_latin1_chars(&s, "img2.png"); - godot_string_new_with_latin1_chars(&t, "img10.png"); - - CHECK(godot_string_nocasecmp_to(&s, &t) > 0); - CHECK(godot_string_naturalnocasecmp_to(&s, &t) < 0); - - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] hex_encode_buffer") { - static const uint8_t u8str[] = { 0x45, 0xE3, 0x81, 0x8A, 0x8F, 0xE3 }; - godot_string s = godot_string_hex_encode_buffer(u8str, 6); - CHECK(u32scmp(godot_string_get_data(&s), U"45e3818a8fe3") == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Substr") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "Killer Baby"); - t = godot_string_substr(&s, 3, 4); - CHECK(u32scmp(godot_string_get_data(&t), U"ler ") == 0); - godot_string_destroy(&t); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Find") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "Pretty Woman Woman"); - - godot_string_new_with_latin1_chars(&t, "Revenge of the Monster Truck"); - CHECK(godot_string_find(&s, &t) == -1); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "tty"); - CHECK(godot_string_find(&s, &t) == 3); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Wo"); - CHECK(godot_string_find_from(&s, &t, 9) == 13); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "man"); - CHECK(godot_string_rfind(&s, &t) == 15); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Find no case") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "Pretty Whale Whale"); - - godot_string_new_with_latin1_chars(&t, "WHA"); - CHECK(godot_string_findn(&s, &t) == 7); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "WHA"); - CHECK(godot_string_findn_from(&s, &t, 9) == 13); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "WHA"); - CHECK(godot_string_rfindn(&s, &t) == 13); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Revenge of the Monster SawFish"); - CHECK(godot_string_findn(&s, &t) == -1); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Find MK") { - godot_packed_string_array keys; - godot_packed_string_array_new(&keys); - -#define PUSH_KEY(x) \ - { \ - godot_string t; \ - godot_string_new_with_latin1_chars(&t, x); \ - godot_packed_string_array_push_back(&keys, &t); \ - godot_string_destroy(&t); \ - } - - PUSH_KEY("sty") - PUSH_KEY("tty") - PUSH_KEY("man") - - godot_string s; - godot_string_new_with_latin1_chars(&s, "Pretty Woman"); - godot_int key = 0; - - CHECK(godot_string_findmk(&s, &keys) == 3); - CHECK(godot_string_findmk_from_in_place(&s, &keys, 0, &key) == 3); - CHECK(key == 1); - - CHECK(godot_string_findmk_from(&s, &keys, 5) == 9); - CHECK(godot_string_findmk_from_in_place(&s, &keys, 5, &key) == 9); - CHECK(key == 2); - - godot_string_destroy(&s); - godot_packed_string_array_destroy(&keys); - -#undef PUSH_KEY -} - -TEST_CASE("[GDNative String] Find and replace") { - godot_string s, c, w; - godot_string_new_with_latin1_chars(&s, "Happy Birthday, Anna!"); - godot_string_new_with_latin1_chars(&c, "Birthday"); - godot_string_new_with_latin1_chars(&w, "Halloween"); - godot_string t = godot_string_replace(&s, &c, &w); - CHECK(u32scmp(godot_string_get_data(&t), U"Happy Halloween, Anna!") == 0); - godot_string_destroy(&s); - godot_string_destroy(&c); - godot_string_destroy(&w); - - godot_string_new_with_latin1_chars(&c, "H"); - godot_string_new_with_latin1_chars(&w, "W"); - s = godot_string_replace_first(&t, &c, &w); - godot_string_destroy(&t); - godot_string_destroy(&c); - godot_string_destroy(&w); - - CHECK(u32scmp(godot_string_get_data(&s), U"Wappy Halloween, Anna!") == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Insertion") { - godot_string s, t, r, u; - godot_string_new_with_latin1_chars(&s, "Who is Frederic?"); - godot_string_new_with_latin1_chars(&t, "?"); - godot_string_new_with_latin1_chars(&r, " Chopin"); - - u = godot_string_insert(&s, godot_string_find(&s, &t), &r); - CHECK(u32scmp(godot_string_get_data(&u), U"Who is Frederic Chopin?") == 0); - - godot_string_destroy(&s); - godot_string_destroy(&t); - godot_string_destroy(&r); - godot_string_destroy(&u); -} - -TEST_CASE("[GDNative String] Number to string") { - godot_string s; - s = godot_string_num(3.141593); - CHECK(u32scmp(godot_string_get_data(&s), U"3.141593") == 0); - godot_string_destroy(&s); - - s = godot_string_num_with_decimals(3.141593, 3); - CHECK(u32scmp(godot_string_get_data(&s), U"3.142") == 0); - godot_string_destroy(&s); - - s = godot_string_num_real(3.141593); - CHECK(u32scmp(godot_string_get_data(&s), U"3.141593") == 0); - godot_string_destroy(&s); - - s = godot_string_num_scientific(30000000); - CHECK(u32scmp(godot_string_get_data(&s), U"3e+07") == 0); - godot_string_destroy(&s); - - s = godot_string_num_int64(3141593, 10); - CHECK(u32scmp(godot_string_get_data(&s), U"3141593") == 0); - godot_string_destroy(&s); - - s = godot_string_num_int64(0xA141593, 16); - CHECK(u32scmp(godot_string_get_data(&s), U"a141593") == 0); - godot_string_destroy(&s); - - s = godot_string_num_int64_capitalized(0xA141593, 16, true); - CHECK(u32scmp(godot_string_get_data(&s), U"A141593") == 0); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] String to integer") { - static const wchar_t *wnums[4] = { L"1237461283", L"- 22", L"0", L" - 1123412" }; - static const char *nums[4] = { "1237461283", "- 22", "0", " - 1123412" }; - static const int num[4] = { 1237461283, -22, 0, -1123412 }; - - for (int i = 0; i < 4; i++) { - godot_string s; - godot_string_new_with_latin1_chars(&s, nums[i]); - CHECK(godot_string_to_int(&s) == num[i]); - godot_string_destroy(&s); - - CHECK(godot_string_char_to_int(nums[i]) == num[i]); - CHECK(godot_string_wchar_to_int(wnums[i]) == num[i]); - } -} - -TEST_CASE("[GDNative String] Hex to integer") { - static const char *nums[4] = { "0xFFAE", "22", "0", "AADDAD" }; - static const int64_t num[4] = { 0xFFAE, 0x22, 0, 0xAADDAD }; - static const bool wo_prefix[4] = { false, true, true, true }; - static const bool w_prefix[4] = { true, false, true, false }; - - for (int i = 0; i < 4; i++) { - godot_string s; - godot_string_new_with_latin1_chars(&s, nums[i]); - CHECK((godot_string_hex_to_int_with_prefix(&s) == num[i]) == w_prefix[i]); - CHECK((godot_string_hex_to_int(&s) == num[i]) == wo_prefix[i]); - godot_string_destroy(&s); - } -} - -TEST_CASE("[GDNative String] String to float") { - static const wchar_t *wnums[4] = { L"-12348298412.2", L"0.05", L"2.0002", L" -0.0001" }; - static const char *nums[4] = { "-12348298412.2", "0.05", "2.0002", " -0.0001" }; - static const double num[4] = { -12348298412.2, 0.05, 2.0002, -0.0001 }; - - for (int i = 0; i < 4; i++) { - godot_string s; - godot_string_new_with_latin1_chars(&s, nums[i]); - CHECK(!(ABS(godot_string_to_float(&s) - num[i]) > 0.00001)); - godot_string_destroy(&s); - - CHECK(!(ABS(godot_string_char_to_float(nums[i]) - num[i]) > 0.00001)); - CHECK(!(ABS(godot_string_wchar_to_float(wnums[i], nullptr) - num[i]) > 0.00001)); - } -} - -TEST_CASE("[GDNative String] CamelCase to underscore") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "TestTestStringGD"); - - t = godot_string_camelcase_to_underscore(&s); - CHECK(u32scmp(godot_string_get_data(&t), U"Test_Test_String_GD") == 0); - godot_string_destroy(&t); - - t = godot_string_camelcase_to_underscore_lowercased(&s); - CHECK(u32scmp(godot_string_get_data(&t), U"test_test_string_gd") == 0); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Slicing") { - godot_string s, c; - godot_string_new_with_latin1_chars(&s, "Mars,Jupiter,Saturn,Uranus"); - godot_string_new_with_latin1_chars(&c, ","); - - const char32_t *slices[4] = { U"Mars", U"Jupiter", U"Saturn", U"Uranus" }; - for (int i = 0; i < godot_string_get_slice_count(&s, &c); i++) { - godot_string t; - t = godot_string_get_slice(&s, &c, i); - CHECK(u32scmp(godot_string_get_data(&t), slices[i]) == 0); - godot_string_destroy(&t); - - t = godot_string_get_slicec(&s, U',', i); - CHECK(u32scmp(godot_string_get_data(&t), slices[i]) == 0); - godot_string_destroy(&t); - } - - godot_string_destroy(&c); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Splitting") { - godot_string s, c; - godot_string_new_with_latin1_chars(&s, "Mars,Jupiter,Saturn,Uranus"); - godot_string_new_with_latin1_chars(&c, ","); - - godot_packed_string_array l; - - const char32_t *slices_l[3] = { U"Mars", U"Jupiter", U"Saturn,Uranus" }; - const char32_t *slices_r[3] = { U"Mars,Jupiter", U"Saturn", U"Uranus" }; - - l = godot_string_split_with_maxsplit(&s, &c, true, 2); - CHECK(godot_packed_string_array_size(&l) == 3); - for (int i = 0; i < godot_packed_string_array_size(&l); i++) { - godot_string t = godot_packed_string_array_get(&l, i); - CHECK(u32scmp(godot_string_get_data(&t), slices_l[i]) == 0); - godot_string_destroy(&t); - } - godot_packed_string_array_destroy(&l); - - l = godot_string_rsplit_with_maxsplit(&s, &c, true, 2); - CHECK(godot_packed_string_array_size(&l) == 3); - for (int i = 0; i < godot_packed_string_array_size(&l); i++) { - godot_string t = godot_packed_string_array_get(&l, i); - CHECK(u32scmp(godot_string_get_data(&t), slices_r[i]) == 0); - godot_string_destroy(&t); - } - godot_packed_string_array_destroy(&l); - godot_string_destroy(&s); - - godot_string_new_with_latin1_chars(&s, "Mars Jupiter Saturn Uranus"); - const char32_t *slices_s[4] = { U"Mars", U"Jupiter", U"Saturn", U"Uranus" }; - l = godot_string_split_spaces(&s); - for (int i = 0; i < godot_packed_string_array_size(&l); i++) { - godot_string t = godot_packed_string_array_get(&l, i); - CHECK(u32scmp(godot_string_get_data(&t), slices_s[i]) == 0); - godot_string_destroy(&t); - } - godot_packed_string_array_destroy(&l); - godot_string_destroy(&s); - - godot_string c1, c2; - godot_string_new_with_latin1_chars(&c1, ";"); - godot_string_new_with_latin1_chars(&c2, " "); - - godot_string_new_with_latin1_chars(&s, "1.2;2.3 4.5"); - const double slices_d[3] = { 1.2, 2.3, 4.5 }; - - godot_packed_float32_array lf = godot_string_split_floats_allow_empty(&s, &c1); - CHECK(godot_packed_float32_array_size(&lf) == 2); - for (int i = 0; i < godot_packed_float32_array_size(&lf); i++) { - CHECK(ABS(godot_packed_float32_array_get(&lf, i) - slices_d[i]) <= 0.00001); - } - godot_packed_float32_array_destroy(&lf); - - godot_packed_string_array keys; - godot_packed_string_array_new(&keys); - godot_packed_string_array_push_back(&keys, &c1); - godot_packed_string_array_push_back(&keys, &c2); - - lf = godot_string_split_floats_mk_allow_empty(&s, &keys); - CHECK(godot_packed_float32_array_size(&lf) == 3); - for (int i = 0; i < godot_packed_float32_array_size(&lf); i++) { - CHECK(ABS(godot_packed_float32_array_get(&lf, i) - slices_d[i]) <= 0.00001); - } - godot_packed_float32_array_destroy(&lf); - - godot_string_destroy(&s); - godot_string_new_with_latin1_chars(&s, "1;2 4"); - const int slices_i[3] = { 1, 2, 4 }; - - godot_packed_int32_array li = godot_string_split_ints_allow_empty(&s, &c1); - CHECK(godot_packed_int32_array_size(&li) == 2); - for (int i = 0; i < godot_packed_int32_array_size(&li); i++) { - CHECK(godot_packed_int32_array_get(&li, i) == slices_i[i]); - } - godot_packed_int32_array_destroy(&li); - - li = godot_string_split_ints_mk_allow_empty(&s, &keys); - CHECK(godot_packed_int32_array_size(&li) == 3); - for (int i = 0; i < godot_packed_int32_array_size(&li); i++) { - CHECK(godot_packed_int32_array_get(&li, i) == slices_i[i]); - } - godot_packed_int32_array_destroy(&li); - - godot_string_destroy(&s); - godot_string_destroy(&c); - godot_string_destroy(&c1); - godot_string_destroy(&c2); - godot_packed_string_array_destroy(&keys); -} - -TEST_CASE("[GDNative String] Erasing") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "Josephine is such a cute girl!"); - godot_string_new_with_latin1_chars(&t, "cute "); - - godot_string_erase(&s, godot_string_find(&s, &t), godot_string_length(&t)); - - CHECK(u32scmp(godot_string_get_data(&s), U"Josephine is such a girl!") == 0); - - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -struct test_27_data { - char const *data; - char const *part; - bool expected; -}; - -TEST_CASE("[GDNative String] Begins with") { - test_27_data tc[] = { - { "res://foobar", "res://", true }, - { "res", "res://", false }, - { "abc", "abc", true } - }; - size_t count = sizeof(tc) / sizeof(tc[0]); - bool state = true; - for (size_t i = 0; state && i < count; ++i) { - godot_string s; - godot_string_new_with_latin1_chars(&s, tc[i].data); - - state = godot_string_begins_with_char_array(&s, tc[i].part) == tc[i].expected; - if (state) { - godot_string t; - godot_string_new_with_latin1_chars(&t, tc[i].part); - state = godot_string_begins_with(&s, &t) == tc[i].expected; - godot_string_destroy(&t); - } - godot_string_destroy(&s); - - CHECK(state); - if (!state) { - break; - } - }; - CHECK(state); -} - -TEST_CASE("[GDNative String] Ends with") { - test_27_data tc[] = { - { "res://foobar", "foobar", true }, - { "res", "res://", false }, - { "abc", "abc", true } - }; - size_t count = sizeof(tc) / sizeof(tc[0]); - bool state = true; - for (size_t i = 0; state && i < count; ++i) { - godot_string s; - godot_string_new_with_latin1_chars(&s, tc[i].data); - - state = godot_string_ends_with_char_array(&s, tc[i].part) == tc[i].expected; - if (state) { - godot_string t; - godot_string_new_with_latin1_chars(&t, tc[i].part); - state = godot_string_ends_with(&s, &t) == tc[i].expected; - godot_string_destroy(&t); - } - godot_string_destroy(&s); - - CHECK(state); - if (!state) { - break; - } - }; - CHECK(state); -} - -TEST_CASE("[GDNative String] format") { - godot_string value_format, t; - godot_string_new_with_latin1_chars(&value_format, "red=\"$red\" green=\"$green\" blue=\"$blue\" alpha=\"$alpha\""); - - godot_variant key_v, val_v; - godot_dictionary value_dictionary; - godot_dictionary_new(&value_dictionary); - - godot_string_new_with_latin1_chars(&t, "red"); - godot_variant_new_string(&key_v, &t); - godot_string_destroy(&t); - godot_variant_new_int(&val_v, 10); - godot_dictionary_set(&value_dictionary, &key_v, &val_v); - godot_variant_destroy(&key_v); - godot_variant_destroy(&val_v); - - godot_string_new_with_latin1_chars(&t, "green"); - godot_variant_new_string(&key_v, &t); - godot_string_destroy(&t); - godot_variant_new_int(&val_v, 20); - godot_dictionary_set(&value_dictionary, &key_v, &val_v); - godot_variant_destroy(&key_v); - godot_variant_destroy(&val_v); - - godot_string_new_with_latin1_chars(&t, "blue"); - godot_variant_new_string(&key_v, &t); - godot_string_destroy(&t); - godot_string_new_with_latin1_chars(&t, "bla"); - godot_variant_new_string(&val_v, &t); - godot_string_destroy(&t); - godot_dictionary_set(&value_dictionary, &key_v, &val_v); - godot_variant_destroy(&key_v); - godot_variant_destroy(&val_v); - - godot_string_new_with_latin1_chars(&t, "alpha"); - godot_variant_new_string(&key_v, &t); - godot_string_destroy(&t); - godot_variant_new_real(&val_v, 0.4); - godot_dictionary_set(&value_dictionary, &key_v, &val_v); - godot_variant_destroy(&key_v); - godot_variant_destroy(&val_v); - - godot_variant dict_v; - godot_variant_new_dictionary(&dict_v, &value_dictionary); - godot_string s = godot_string_format_with_custom_placeholder(&value_format, &dict_v, "$_"); - - CHECK(u32scmp(godot_string_get_data(&s), U"red=\"10\" green=\"20\" blue=\"bla\" alpha=\"0.4\"") == 0); - - godot_dictionary_destroy(&value_dictionary); - godot_string_destroy(&s); - godot_variant_destroy(&dict_v); - godot_string_destroy(&value_format); -} - -TEST_CASE("[GDNative String] sprintf") { - //godot_string GDAPI (const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); - godot_string format, output; - godot_array args; - bool error; - -#define ARRAY_PUSH_STRING(x) \ - { \ - godot_variant v; \ - godot_string t; \ - godot_string_new_with_latin1_chars(&t, x); \ - godot_variant_new_string(&v, &t); \ - godot_string_destroy(&t); \ - godot_array_push_back(&args, &v); \ - godot_variant_destroy(&v); \ - } - -#define ARRAY_PUSH_INT(x) \ - { \ - godot_variant v; \ - godot_variant_new_int(&v, x); \ - godot_array_push_back(&args, &v); \ - godot_variant_destroy(&v); \ - } - -#define ARRAY_PUSH_REAL(x) \ - { \ - godot_variant v; \ - godot_variant_new_real(&v, x); \ - godot_array_push_back(&args, &v); \ - godot_variant_destroy(&v); \ - } - - godot_array_new(&args); - - // %% - godot_string_new_with_latin1_chars(&format, "fish %% frog"); - godot_array_clear(&args); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish % frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - //////// INTS - - // Int - godot_string_new_with_latin1_chars(&format, "fish %d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(5); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 5 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Int left padded with zeroes. - godot_string_new_with_latin1_chars(&format, "fish %05d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(5); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 00005 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Int left padded with spaces. - godot_string_new_with_latin1_chars(&format, "fish %5d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(5); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 5 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Int right padded with spaces. - godot_string_new_with_latin1_chars(&format, "fish %-5d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(5); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 5 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Int with sign (positive). - godot_string_new_with_latin1_chars(&format, "fish %+d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(5); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish +5 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Negative int. - godot_string_new_with_latin1_chars(&format, "fish %d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(-5); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish -5 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Hex (lower) - godot_string_new_with_latin1_chars(&format, "fish %x frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(45); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 2d frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Hex (upper) - godot_string_new_with_latin1_chars(&format, "fish %X frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(45); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 2D frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Octal - godot_string_new_with_latin1_chars(&format, "fish %o frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 143 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - ////// REALS - - // Real - godot_string_new_with_latin1_chars(&format, "fish %f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 99.990000 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real left-padded - godot_string_new_with_latin1_chars(&format, "fish %11f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 99.990000 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real right-padded - godot_string_new_with_latin1_chars(&format, "fish %-11f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 99.990000 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real given int. - godot_string_new_with_latin1_chars(&format, "fish %f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 99.000000 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real with sign (positive). - godot_string_new_with_latin1_chars(&format, "fish %+f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish +99.990000 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real with 1 decimals. - godot_string_new_with_latin1_chars(&format, "fish %.1f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 100.0 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real with 12 decimals. - godot_string_new_with_latin1_chars(&format, "fish %.12f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 99.990000000000 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Real with no decimals. - godot_string_new_with_latin1_chars(&format, "fish %.f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 100 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - /////// Strings. - - // String - godot_string_new_with_latin1_chars(&format, "fish %s frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish cheese frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // String left-padded - godot_string_new_with_latin1_chars(&format, "fish %10s frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish cheese frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // String right-padded - godot_string_new_with_latin1_chars(&format, "fish %-10s frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish cheese frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - ///// Characters - - // Character as string. - godot_string_new_with_latin1_chars(&format, "fish %c frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("A"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish A frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Character as int. - godot_string_new_with_latin1_chars(&format, "fish %c frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(65); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish A frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - ///// Dynamic width - - // String dynamic width - godot_string_new_with_latin1_chars(&format, "fish %*s frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(10); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - REQUIRE(u32scmp(godot_string_get_data(&output), U"fish cheese frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Int dynamic width - godot_string_new_with_latin1_chars(&format, "fish %*d frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(10); - ARRAY_PUSH_INT(99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - REQUIRE(u32scmp(godot_string_get_data(&output), U"fish 99 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Float dynamic width - godot_string_new_with_latin1_chars(&format, "fish %*.*f frog"); - godot_array_clear(&args); - ARRAY_PUSH_INT(10); - ARRAY_PUSH_INT(3); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error == false); - CHECK(u32scmp(godot_string_get_data(&output), U"fish 99.990 frog") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - ///// Errors - - // More formats than arguments. - godot_string_new_with_latin1_chars(&format, "fish %s %s frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"not enough arguments for format string") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // More arguments than formats. - godot_string_new_with_latin1_chars(&format, "fish %s frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("hello"); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"not all arguments converted during string formatting") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Incomplete format. - godot_string_new_with_latin1_chars(&format, "fish %10"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"incomplete format") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Bad character in format string - godot_string_new_with_latin1_chars(&format, "fish %&f frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"unsupported format character") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Too many decimals. - godot_string_new_with_latin1_chars(&format, "fish %2.2.2f frog"); - godot_array_clear(&args); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"too many decimal points in format") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // * not a number - godot_string_new_with_latin1_chars(&format, "fish %*f frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("cheese"); - ARRAY_PUSH_REAL(99.99); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"* wants number") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Character too long. - godot_string_new_with_latin1_chars(&format, "fish %c frog"); - godot_array_clear(&args); - ARRAY_PUSH_STRING("sc"); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"%c requires number or single-character string") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - // Character bad type. - godot_string_new_with_latin1_chars(&format, "fish %c frog"); - godot_array_clear(&args); - godot_array t; - godot_array_new(&t); - godot_variant v; - godot_variant_new_array(&v, &t); - godot_array_destroy(&t); - godot_array_push_back(&args, &v); - godot_variant_destroy(&v); - output = godot_string_sprintf(&format, &args, &error); - REQUIRE(error); - CHECK(u32scmp(godot_string_get_data(&output), U"%c requires number or single-character string") == 0); - godot_string_destroy(&format); - godot_string_destroy(&output); - - godot_array_destroy(&args); -#undef ARRAY_PUSH_INT -#undef ARRAY_PUSH_REAL -#undef ARRAY_PUSH_STRING -} - -TEST_CASE("[GDNative String] is_numeric") { -#define IS_NUM_TEST(x, r) \ - { \ - godot_string t; \ - godot_string_new_with_latin1_chars(&t, x); \ - CHECK(godot_string_is_numeric(&t) == r); \ - godot_string_destroy(&t); \ - } - - IS_NUM_TEST("12", true); - IS_NUM_TEST("1.2", true); - IS_NUM_TEST("AF", false); - IS_NUM_TEST("-12", true); - IS_NUM_TEST("-1.2", true); - -#undef IS_NUM_TEST -} - -TEST_CASE("[GDNative String] pad") { - godot_string s, c; - godot_string_new_with_latin1_chars(&s, "test"); - godot_string_new_with_latin1_chars(&c, "x"); - - godot_string l = godot_string_lpad_with_custom_character(&s, 10, &c); - CHECK(u32scmp(godot_string_get_data(&l), U"xxxxxxtest") == 0); - godot_string_destroy(&l); - - godot_string r = godot_string_rpad_with_custom_character(&s, 10, &c); - CHECK(u32scmp(godot_string_get_data(&r), U"testxxxxxx") == 0); - godot_string_destroy(&r); - - godot_string_destroy(&s); - godot_string_destroy(&c); - - godot_string_new_with_latin1_chars(&s, "10.10"); - c = godot_string_pad_decimals(&s, 4); - CHECK(u32scmp(godot_string_get_data(&c), U"10.1000") == 0); - godot_string_destroy(&c); - c = godot_string_pad_zeros(&s, 4); - CHECK(u32scmp(godot_string_get_data(&c), U"0010.10") == 0); - godot_string_destroy(&c); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] is_subsequence_of") { - godot_string a, t; - godot_string_new_with_latin1_chars(&a, "is subsequence of"); - - godot_string_new_with_latin1_chars(&t, "sub"); - CHECK(godot_string_is_subsequence_of(&t, &a)); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Sub"); - CHECK(!godot_string_is_subsequence_of(&t, &a)); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Sub"); - CHECK(godot_string_is_subsequence_ofi(&t, &a)); - godot_string_destroy(&t); - - godot_string_destroy(&a); -} - -TEST_CASE("[GDNative String] match") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "*.png"); - - godot_string_new_with_latin1_chars(&t, "img1.png"); - CHECK(godot_string_match(&t, &s)); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "img1.jpeg"); - CHECK(!godot_string_match(&t, &s)); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "img1.Png"); - CHECK(!godot_string_match(&t, &s)); - CHECK(godot_string_matchn(&t, &s)); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] IPVX address to string") { - godot_string ip; - - godot_string_new_with_latin1_chars(&ip, "192.168.0.1"); - CHECK(godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); - - godot_string_new_with_latin1_chars(&ip, "192.368.0.1"); - CHECK(!godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); - - godot_string_new_with_latin1_chars(&ip, "2001:0db8:85a3:0000:0000:8a2e:0370:7334"); - CHECK(godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); - - godot_string_new_with_latin1_chars(&ip, "2001:0db8:85j3:0000:0000:8a2e:0370:7334"); - CHECK(!godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); - - godot_string_new_with_latin1_chars(&ip, "2001:0db8:85f345:0000:0000:8a2e:0370:7334"); - CHECK(!godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); - - godot_string_new_with_latin1_chars(&ip, "2001:0db8::0:8a2e:370:7334"); - CHECK(godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); - - godot_string_new_with_latin1_chars(&ip, "::ffff:192.168.0.1"); - CHECK(godot_string_is_valid_ip_address(&ip)); - godot_string_destroy(&ip); -} - -TEST_CASE("[GDNative String] Capitalize against many strings") { -#define CAP_TEST(i, o) \ - godot_string_new_with_latin1_chars(&input, i); \ - godot_string_new_with_latin1_chars(&output, o); \ - test = godot_string_capitalize(&input); \ - CHECK(u32scmp(godot_string_get_data(&output), godot_string_get_data(&test)) == 0); \ - godot_string_destroy(&input); \ - godot_string_destroy(&output); \ - godot_string_destroy(&test); - - godot_string input, output, test; - - CAP_TEST("bytes2var", "Bytes 2 Var"); - CAP_TEST("linear2db", "Linear 2 Db"); - CAP_TEST("vector3", "Vector 3"); - CAP_TEST("sha256", "Sha 256"); - CAP_TEST("2db", "2 Db"); - CAP_TEST("PascalCase", "Pascal Case"); - CAP_TEST("PascalPascalCase", "Pascal Pascal Case"); - CAP_TEST("snake_case", "Snake Case"); - CAP_TEST("snake_snake_case", "Snake Snake Case"); - CAP_TEST("sha256sum", "Sha 256 Sum"); - CAP_TEST("cat2dog", "Cat 2 Dog"); - CAP_TEST("function(name)", "Function(name)"); - CAP_TEST("snake_case_function(snake_case_arg)", "Snake Case Function(snake Case Arg)"); - CAP_TEST("snake_case_function( snake_case_arg )", "Snake Case Function( Snake Case Arg )"); - -#undef CAP_TEST -} - -TEST_CASE("[GDNative String] lstrip and rstrip") { -#define LSTRIP_TEST(x, y, z) \ - { \ - godot_string xx, yy, zz, rr; \ - godot_string_new_with_latin1_chars(&xx, x); \ - godot_string_new_with_latin1_chars(&yy, y); \ - godot_string_new_with_latin1_chars(&zz, z); \ - rr = godot_string_lstrip(&xx, &yy); \ - state = state && (u32scmp(godot_string_get_data(&rr), godot_string_get_data(&zz)) == 0); \ - godot_string_destroy(&xx); \ - godot_string_destroy(&yy); \ - godot_string_destroy(&zz); \ - godot_string_destroy(&rr); \ - } - -#define RSTRIP_TEST(x, y, z) \ - { \ - godot_string xx, yy, zz, rr; \ - godot_string_new_with_latin1_chars(&xx, x); \ - godot_string_new_with_latin1_chars(&yy, y); \ - godot_string_new_with_latin1_chars(&zz, z); \ - rr = godot_string_rstrip(&xx, &yy); \ - state = state && (u32scmp(godot_string_get_data(&rr), godot_string_get_data(&zz)) == 0); \ - godot_string_destroy(&xx); \ - godot_string_destroy(&yy); \ - godot_string_destroy(&zz); \ - godot_string_destroy(&rr); \ - } - -#define LSTRIP_UTF8_TEST(x, y, z) \ - { \ - godot_string xx, yy, zz, rr; \ - godot_string_new_with_utf8_chars(&xx, x); \ - godot_string_new_with_utf8_chars(&yy, y); \ - godot_string_new_with_utf8_chars(&zz, z); \ - rr = godot_string_lstrip(&xx, &yy); \ - state = state && (u32scmp(godot_string_get_data(&rr), godot_string_get_data(&zz)) == 0); \ - godot_string_destroy(&xx); \ - godot_string_destroy(&yy); \ - godot_string_destroy(&zz); \ - godot_string_destroy(&rr); \ - } - -#define RSTRIP_UTF8_TEST(x, y, z) \ - { \ - godot_string xx, yy, zz, rr; \ - godot_string_new_with_utf8_chars(&xx, x); \ - godot_string_new_with_utf8_chars(&yy, y); \ - godot_string_new_with_utf8_chars(&zz, z); \ - rr = godot_string_rstrip(&xx, &yy); \ - state = state && (u32scmp(godot_string_get_data(&rr), godot_string_get_data(&zz)) == 0); \ - godot_string_destroy(&xx); \ - godot_string_destroy(&yy); \ - godot_string_destroy(&zz); \ - godot_string_destroy(&rr); \ - } - - bool state = true; - - // strip none - LSTRIP_TEST("abc", "", "abc"); - RSTRIP_TEST("abc", "", "abc"); - // strip one - LSTRIP_TEST("abc", "a", "bc"); - RSTRIP_TEST("abc", "c", "ab"); - // strip lots - LSTRIP_TEST("bababbababccc", "ab", "ccc"); - RSTRIP_TEST("aaabcbcbcbbcbbc", "cb", "aaa"); - // strip empty string - LSTRIP_TEST("", "", ""); - RSTRIP_TEST("", "", ""); - // strip to empty string - LSTRIP_TEST("abcabcabc", "bca", ""); - RSTRIP_TEST("abcabcabc", "bca", ""); - // don't strip wrong end - LSTRIP_TEST("abc", "c", "abc"); - LSTRIP_TEST("abca", "a", "bca"); - RSTRIP_TEST("abc", "a", "abc"); - RSTRIP_TEST("abca", "a", "abc"); - // in utf-8 "¿" (\u00bf) has the same first byte as "µ" (\u00b5) - // and the same second as "ÿ" (\u00ff) - LSTRIP_UTF8_TEST("¿", "µÿ", "¿"); - RSTRIP_UTF8_TEST("¿", "µÿ", "¿"); - LSTRIP_UTF8_TEST("µ¿ÿ", "µÿ", "¿ÿ"); - RSTRIP_UTF8_TEST("µ¿ÿ", "µÿ", "µ¿"); - - // the above tests repeated with additional superfluous strip chars - - // strip none - LSTRIP_TEST("abc", "qwjkl", "abc"); - RSTRIP_TEST("abc", "qwjkl", "abc"); - // strip one - LSTRIP_TEST("abc", "qwajkl", "bc"); - RSTRIP_TEST("abc", "qwcjkl", "ab"); - // strip lots - LSTRIP_TEST("bababbababccc", "qwabjkl", "ccc"); - RSTRIP_TEST("aaabcbcbcbbcbbc", "qwcbjkl", "aaa"); - // strip empty string - LSTRIP_TEST("", "qwjkl", ""); - RSTRIP_TEST("", "qwjkl", ""); - // strip to empty string - LSTRIP_TEST("abcabcabc", "qwbcajkl", ""); - RSTRIP_TEST("abcabcabc", "qwbcajkl", ""); - // don't strip wrong end - LSTRIP_TEST("abc", "qwcjkl", "abc"); - LSTRIP_TEST("abca", "qwajkl", "bca"); - RSTRIP_TEST("abc", "qwajkl", "abc"); - RSTRIP_TEST("abca", "qwajkl", "abc"); - // in utf-8 "¿" (\u00bf) has the same first byte as "µ" (\u00b5) - // and the same second as "ÿ" (\u00ff) - LSTRIP_UTF8_TEST("¿", "qwaµÿjkl", "¿"); - RSTRIP_UTF8_TEST("¿", "qwaµÿjkl", "¿"); - LSTRIP_UTF8_TEST("µ¿ÿ", "qwaµÿjkl", "¿ÿ"); - RSTRIP_UTF8_TEST("µ¿ÿ", "qwaµÿjkl", "µ¿"); - - CHECK(state); - -#undef LSTRIP_TEST -#undef RSTRIP_TEST -#undef LSTRIP_UTF8_TEST -#undef RSTRIP_UTF8_TEST -} - -TEST_CASE("[GDNative String] Cyrillic to_lower()") { - godot_string upper, lower, test; - godot_string_new_with_utf8_chars(&upper, "АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ"); - godot_string_new_with_utf8_chars(&lower, "абвгдеёжзийклмнопрстуфхцчшщъыьэюя"); - - test = godot_string_to_lower(&upper); - - CHECK((u32scmp(godot_string_get_data(&test), godot_string_get_data(&lower)) == 0)); - - godot_string_destroy(&upper); - godot_string_destroy(&lower); - godot_string_destroy(&test); -} - -TEST_CASE("[GDNative String] Count and countn functionality") { -#define COUNT_TEST(x, y, r) \ - { \ - godot_string s, t; \ - godot_string_new_with_latin1_chars(&s, x); \ - godot_string_new_with_latin1_chars(&t, y); \ - state = state && (godot_string_count(&s, &t, 0, 0) == r); \ - godot_string_destroy(&s); \ - godot_string_destroy(&t); \ - } - -#define COUNTR_TEST(x, y, a, b, r) \ - { \ - godot_string s, t; \ - godot_string_new_with_latin1_chars(&s, x); \ - godot_string_new_with_latin1_chars(&t, y); \ - state = state && (godot_string_count(&s, &t, a, b) == r); \ - godot_string_destroy(&s); \ - godot_string_destroy(&t); \ - } - -#define COUNTN_TEST(x, y, r) \ - { \ - godot_string s, t; \ - godot_string_new_with_latin1_chars(&s, x); \ - godot_string_new_with_latin1_chars(&t, y); \ - state = state && (godot_string_countn(&s, &t, 0, 0) == r); \ - godot_string_destroy(&s); \ - godot_string_destroy(&t); \ - } - -#define COUNTNR_TEST(x, y, a, b, r) \ - { \ - godot_string s, t; \ - godot_string_new_with_latin1_chars(&s, x); \ - godot_string_new_with_latin1_chars(&t, y); \ - state = state && (godot_string_countn(&s, &t, a, b) == r); \ - godot_string_destroy(&s); \ - godot_string_destroy(&t); \ - } - bool state = true; - - COUNT_TEST("", "Test", 0); - COUNT_TEST("Test", "", 0); - COUNT_TEST("Test", "test", 0); - COUNT_TEST("Test", "TEST", 0); - COUNT_TEST("TEST", "TEST", 1); - COUNT_TEST("Test", "Test", 1); - COUNT_TEST("aTest", "Test", 1); - COUNT_TEST("Testa", "Test", 1); - COUNT_TEST("TestTestTest", "Test", 3); - COUNT_TEST("TestTestTest", "TestTest", 1); - COUNT_TEST("TestGodotTestGodotTestGodot", "Test", 3); - - COUNTR_TEST("TestTestTestTest", "Test", 4, 8, 1); - COUNTR_TEST("TestTestTestTest", "Test", 4, 12, 2); - COUNTR_TEST("TestTestTestTest", "Test", 4, 16, 3); - COUNTR_TEST("TestTestTestTest", "Test", 4, 0, 3); - - COUNTN_TEST("Test", "test", 1); - COUNTN_TEST("Test", "TEST", 1); - COUNTN_TEST("testTest-Testatest", "tEst", 4); - COUNTNR_TEST("testTest-TeStatest", "tEsT", 4, 16, 2); - - CHECK(state); - -#undef COUNT_TEST -#undef COUNTR_TEST -#undef COUNTN_TEST -#undef COUNTNR_TEST -} - -TEST_CASE("[GDNative String] Bigrams") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, "abcd"); - godot_packed_string_array bigr = godot_string_bigrams(&s); - godot_string_destroy(&s); - - CHECK(godot_packed_string_array_size(&bigr) == 3); - - t = godot_packed_string_array_get(&bigr, 0); - CHECK(u32scmp(godot_string_get_data(&t), U"ab") == 0); - godot_string_destroy(&t); - - t = godot_packed_string_array_get(&bigr, 1); - CHECK(u32scmp(godot_string_get_data(&t), U"bc") == 0); - godot_string_destroy(&t); - - t = godot_packed_string_array_get(&bigr, 2); - CHECK(u32scmp(godot_string_get_data(&t), U"cd") == 0); - godot_string_destroy(&t); - - godot_packed_string_array_destroy(&bigr); -} - -TEST_CASE("[GDNative String] c-escape/unescape") { - godot_string s; - godot_string_new_with_latin1_chars(&s, "\\1\a2\b\f3\n45\r6\t7\v8\'9\?0\""); - godot_string t = godot_string_c_escape(&s); - godot_string u = godot_string_c_unescape(&t); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&s)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] dedent") { - godot_string s, t; - godot_string_new_with_latin1_chars(&s, " aaa\n bbb"); - godot_string_new_with_latin1_chars(&t, "aaa\nbbb"); - godot_string u = godot_string_dedent(&s); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Path functions") { - static const char *path[4] = { "C:\\Godot\\project\\test.tscn", "/Godot/project/test.xscn", "../Godot/project/test.scn", "Godot\\test.doc" }; - static const char *base_dir[4] = { "C:\\Godot\\project", "/Godot/project", "../Godot/project", "Godot" }; - static const char *base_name[4] = { "C:\\Godot\\project\\test", "/Godot/project/test", "../Godot/project/test", "Godot\\test" }; - static const char *ext[4] = { "tscn", "xscn", "scn", "doc" }; - static const char *file[4] = { "test.tscn", "test.xscn", "test.scn", "test.doc" }; - static const bool abs[4] = { true, true, false, false }; - - for (int i = 0; i < 4; i++) { - godot_string s, t, u, f; - godot_string_new_with_latin1_chars(&s, path[i]); - - t = godot_string_get_base_dir(&s); - godot_string_new_with_latin1_chars(&u, base_dir[i]); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - t = godot_string_get_basename(&s); - godot_string_new_with_latin1_chars(&u, base_name[i]); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - t = godot_string_get_extension(&s); - godot_string_new_with_latin1_chars(&u, ext[i]); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - t = godot_string_get_file(&s); - godot_string_new_with_latin1_chars(&u, file[i]); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string s_simp; - s_simp = godot_string_simplify_path(&s); - t = godot_string_get_base_dir(&s_simp); - godot_string_new_with_latin1_chars(&u, file[i]); - f = godot_string_plus_file(&t, &u); - CHECK(u32scmp(godot_string_get_data(&f), godot_string_get_data(&s_simp)) == 0); - godot_string_destroy(&f); - godot_string_destroy(&u); - godot_string_destroy(&t); - godot_string_destroy(&s_simp); - - CHECK(godot_string_is_abs_path(&s) == abs[i]); - CHECK(godot_string_is_rel_path(&s) != abs[i]); - - godot_string_destroy(&s); - } - - static const char *file_name[3] = { "test.tscn", "test://.xscn", "?tes*t.scn" }; - static const bool valid[3] = { true, false, false }; - for (int i = 0; i < 3; i++) { - godot_string s; - godot_string_new_with_latin1_chars(&s, file_name[i]); - CHECK(godot_string_is_valid_filename(&s) == valid[i]); - godot_string_destroy(&s); - } -} - -TEST_CASE("[GDNative String] hash") { - godot_string a, b, c; - godot_string_new_with_latin1_chars(&a, "Test"); - godot_string_new_with_latin1_chars(&b, "Test"); - godot_string_new_with_latin1_chars(&c, "West"); - CHECK(godot_string_hash(&a) == godot_string_hash(&b)); - CHECK(godot_string_hash(&a) != godot_string_hash(&c)); - - CHECK(godot_string_hash64(&a) == godot_string_hash64(&b)); - CHECK(godot_string_hash64(&a) != godot_string_hash64(&c)); - - godot_string_destroy(&a); - godot_string_destroy(&b); - godot_string_destroy(&c); -} - -TEST_CASE("[GDNative String] http_escape/unescape") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, "Godot Engine:'docs'"); - godot_string_new_with_latin1_chars(&t, "Godot%20Engine%3A%27docs%27"); - - u = godot_string_http_escape(&s); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - - u = godot_string_http_unescape(&t); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&s)) == 0); - godot_string_destroy(&u); - - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] percent_encode/decode") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, "Godot Engine:'docs'"); - godot_string_new_with_latin1_chars(&t, "Godot%20Engine%3a%27docs%27"); - - u = godot_string_percent_encode(&s); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - - u = godot_string_percent_decode(&t); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&s)) == 0); - godot_string_destroy(&u); - - godot_string_destroy(&s); - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] xml_escape/unescape") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, "\"Test\" <test@test&'test'>"); - - t = godot_string_xml_escape_with_quotes(&s); - u = godot_string_xml_unescape(&t); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&s)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - t = godot_string_xml_escape(&s); - u = godot_string_xml_unescape(&t); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&s)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Strip escapes") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, "\t\tTest Test\r\n Test"); - godot_string_new_with_latin1_chars(&t, "Test Test Test"); - - u = godot_string_strip_escapes(&s); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - - godot_string_destroy(&t); - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Strip edges") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, "\t Test Test "); - - godot_string_new_with_latin1_chars(&t, "Test Test "); - u = godot_string_strip_edges(&s, true, false); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "\t Test Test"); - u = godot_string_strip_edges(&s, false, true); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "Test Test"); - u = godot_string_strip_edges(&s, true, true); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Similarity") { - godot_string a, b, c; - godot_string_new_with_latin1_chars(&a, "Test"); - godot_string_new_with_latin1_chars(&b, "West"); - godot_string_new_with_latin1_chars(&c, "Toad"); - - CHECK(godot_string_similarity(&a, &b) > godot_string_similarity(&a, &c)); - - godot_string_destroy(&a); - godot_string_destroy(&b); - godot_string_destroy(&c); -} - -TEST_CASE("[GDNative String] Trim") { - godot_string s, t, u, p; - godot_string_new_with_latin1_chars(&s, "aaaTestbbb"); - - godot_string_new_with_latin1_chars(&p, "aaa"); - godot_string_new_with_latin1_chars(&t, "Testbbb"); - u = godot_string_trim_prefix(&s, &p); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - godot_string_destroy(&p); - - godot_string_new_with_latin1_chars(&p, "bbb"); - godot_string_new_with_latin1_chars(&t, "aaaTest"); - u = godot_string_trim_suffix(&s, &p); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - godot_string_destroy(&p); - - godot_string_new_with_latin1_chars(&p, "Test"); - u = godot_string_trim_suffix(&s, &p); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&s)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&p); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Right/Left") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, "aaaTestbbb"); - // ^ - - godot_string_new_with_latin1_chars(&t, "tbbb"); - u = godot_string_right(&s, 6); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&t, "aaaTes"); - u = godot_string_left(&s, 6); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_destroy(&s); -} - -TEST_CASE("[GDNative String] Repeat") { - godot_string t, u; - godot_string_new_with_latin1_chars(&t, "ab"); - - u = godot_string_repeat(&t, 4); - CHECK(u32scmp(godot_string_get_data(&u), U"abababab") == 0); - godot_string_destroy(&u); - - godot_string_destroy(&t); -} - -TEST_CASE("[GDNative String] SHA1/SHA256/MD5") { - godot_string s, t, sha1, sha256, md5; - godot_string_new_with_latin1_chars(&s, "Godot"); - godot_string_new_with_latin1_chars(&sha1, "a1e91f39b9fce6a9998b14bdbe2aa2b39dc2d201"); - static uint8_t sha1_buf[20] = { - 0xA1, 0xE9, 0x1F, 0x39, 0xB9, 0xFC, 0xE6, 0xA9, 0x99, 0x8B, 0x14, 0xBD, 0xBE, 0x2A, 0xA2, 0xB3, - 0x9D, 0xC2, 0xD2, 0x01 - }; - godot_string_new_with_latin1_chars(&sha256, "2a02b2443f7985d89d09001086ae3dcfa6eb0f55c6ef170715d42328e16e6cb8"); - static uint8_t sha256_buf[32] = { - 0x2A, 0x02, 0xB2, 0x44, 0x3F, 0x79, 0x85, 0xD8, 0x9D, 0x09, 0x00, 0x10, 0x86, 0xAE, 0x3D, 0xCF, - 0xA6, 0xEB, 0x0F, 0x55, 0xC6, 0xEF, 0x17, 0x07, 0x15, 0xD4, 0x23, 0x28, 0xE1, 0x6E, 0x6C, 0xB8 - }; - godot_string_new_with_latin1_chars(&md5, "4a336d087aeb0390da10ee2ea7cb87f8"); - static uint8_t md5_buf[16] = { - 0x4A, 0x33, 0x6D, 0x08, 0x7A, 0xEB, 0x03, 0x90, 0xDA, 0x10, 0xEE, 0x2E, 0xA7, 0xCB, 0x87, 0xF8 - }; - - godot_packed_byte_array buf = godot_string_sha1_buffer(&s); - CHECK(memcmp(sha1_buf, godot_packed_byte_array_ptr(&buf), 20) == 0); - godot_packed_byte_array_destroy(&buf); - - t = godot_string_sha1_text(&s); - CHECK(u32scmp(godot_string_get_data(&t), godot_string_get_data(&sha1)) == 0); - godot_string_destroy(&t); - - buf = godot_string_sha256_buffer(&s); - CHECK(memcmp(sha256_buf, godot_packed_byte_array_ptr(&buf), 32) == 0); - godot_packed_byte_array_destroy(&buf); - - t = godot_string_sha256_text(&s); - CHECK(u32scmp(godot_string_get_data(&t), godot_string_get_data(&sha256)) == 0); - godot_string_destroy(&t); - - buf = godot_string_md5_buffer(&s); - CHECK(memcmp(md5_buf, godot_packed_byte_array_ptr(&buf), 16) == 0); - godot_packed_byte_array_destroy(&buf); - - t = godot_string_md5_text(&s); - CHECK(u32scmp(godot_string_get_data(&t), godot_string_get_data(&md5)) == 0); - godot_string_destroy(&t); - - godot_string_destroy(&s); - godot_string_destroy(&sha1); - godot_string_destroy(&sha256); - godot_string_destroy(&md5); -} - -TEST_CASE("[GDNative String] Join") { - godot_string s, t, u; - godot_string_new_with_latin1_chars(&s, ", "); - - godot_packed_string_array parts; - godot_packed_string_array_new(&parts); - godot_string_new_with_latin1_chars(&t, "One"); - godot_packed_string_array_push_back(&parts, &t); - godot_string_destroy(&t); - godot_string_new_with_latin1_chars(&t, "B"); - godot_packed_string_array_push_back(&parts, &t); - godot_string_destroy(&t); - godot_string_new_with_latin1_chars(&t, "C"); - godot_packed_string_array_push_back(&parts, &t); - godot_string_destroy(&t); - - godot_string_new_with_latin1_chars(&u, "One, B, C"); - t = godot_string_join(&s, &parts); - CHECK(u32scmp(godot_string_get_data(&u), godot_string_get_data(&t)) == 0); - godot_string_destroy(&u); - godot_string_destroy(&t); - - godot_string_destroy(&s); - godot_packed_string_array_destroy(&parts); -} - -TEST_CASE("[GDNative String] Is_*") { - static const char *data[12] = { "-30", "100", "10.1", "10,1", "1e2", "1e-2", "1e2e3", "0xAB", "AB", "Test1", "1Test", "Test*1" }; - static bool isnum[12] = { true, true, true, false, false, false, false, false, false, false, false, false }; - static bool isint[12] = { true, true, false, false, false, false, false, false, false, false, false, false }; - static bool ishex[12] = { true, true, false, false, true, false, true, false, true, false, false, false }; - static bool ishex_p[12] = { false, false, false, false, false, false, false, true, false, false, false, false }; - static bool isflt[12] = { true, true, true, false, true, true, false, false, false, false, false, false }; - static bool isid[12] = { false, false, false, false, false, false, false, false, true, true, false, false }; - - for (int i = 0; i < 12; i++) { - godot_string s; - godot_string_new_with_latin1_chars(&s, data[i]); - CHECK(godot_string_is_numeric(&s) == isnum[i]); - CHECK(godot_string_is_valid_integer(&s) == isint[i]); - CHECK(godot_string_is_valid_hex_number(&s, false) == ishex[i]); - CHECK(godot_string_is_valid_hex_number(&s, true) == ishex_p[i]); - CHECK(godot_string_is_valid_float(&s) == isflt[i]); - CHECK(godot_string_is_valid_identifier(&s) == isid[i]); - godot_string_destroy(&s); - } -} - -TEST_CASE("[GDNative String] humanize_size") { - godot_string s; - - s = godot_string_humanize_size(1000); - CHECK(u32scmp(godot_string_get_data(&s), U"1000 B") == 0); - godot_string_destroy(&s); - - s = godot_string_humanize_size(1025); - CHECK(u32scmp(godot_string_get_data(&s), U"1.00 KiB") == 0); - godot_string_destroy(&s); - - s = godot_string_humanize_size(1025300); - CHECK(u32scmp(godot_string_get_data(&s), U"1001.2 KiB") == 0); - godot_string_destroy(&s); - - s = godot_string_humanize_size(100523550); - CHECK(u32scmp(godot_string_get_data(&s), U"95.86 MiB") == 0); - godot_string_destroy(&s); - - s = godot_string_humanize_size(5345555000); - CHECK(u32scmp(godot_string_get_data(&s), U"4.97 GiB") == 0); - godot_string_destroy(&s); -} - -} // namespace TestGDNativeString - -#endif // TEST_GDNATIVE_STRING_H diff --git a/modules/gdnative/tests/test_variant.h b/modules/gdnative/tests/test_variant.h new file mode 100644 index 0000000000..c506882283 --- /dev/null +++ b/modules/gdnative/tests/test_variant.h @@ -0,0 +1,205 @@ +/*************************************************************************/ +/* test_variant.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TEST_GDNATIVE_VARIANT_H +#define TEST_GDNATIVE_VARIANT_H + +#include <gdnative/gdnative.h> +#include <gdnative/variant.h> + +#include "tests/test_macros.h" + +namespace TestGDNativeVariant { + +TEST_CASE("[GDNative Variant] New Variant with copy") { + godot_variant src; + godot_variant_new_int(&src, 42); + + godot_variant copy; + godot_variant_new_copy(©, &src); + + CHECK(godot_variant_as_int(©) == 42); + CHECK(godot_variant_get_type(©) == GODOT_VARIANT_TYPE_INT); + + godot_variant_destroy(&src); + godot_variant_destroy(©); +} + +TEST_CASE("[GDNative Variant] New Variant with Nil") { + godot_variant val; + godot_variant_new_nil(&val); + + CHECK(godot_variant_get_type(&val) == GODOT_VARIANT_TYPE_NIL); + + godot_variant_destroy(&val); +} + +TEST_CASE("[GDNative Variant] New Variant with bool") { + godot_variant val; + godot_variant_new_bool(&val, true); + + CHECK(godot_variant_as_bool(&val)); + CHECK(godot_variant_get_type(&val) == GODOT_VARIANT_TYPE_BOOL); + + godot_variant_destroy(&val); +} + +TEST_CASE("[GDNative Variant] New Variant with float") { + godot_variant val; + godot_variant_new_float(&val, 4.2); + + CHECK(godot_variant_as_float(&val) == 4.2); + CHECK(godot_variant_get_type(&val) == GODOT_VARIANT_TYPE_FLOAT); + + godot_variant_destroy(&val); +} + +TEST_CASE("[GDNative Variant] New Variant with String") { + String str = "something"; + + godot_variant val; + godot_variant_new_string(&val, (godot_string *)&str); + godot_string gd_str = godot_variant_as_string(&val); + String *result = (String *)&gd_str; + + CHECK(*result == String("something")); + CHECK(godot_variant_get_type(&val) == GODOT_VARIANT_TYPE_STRING); + + godot_variant_destroy(&val); + godot_string_destroy(&gd_str); +} + +TEST_CASE("[GDNative Variant] Variant call") { + String str("something"); + godot_variant self; + godot_variant_new_string(&self, (godot_string *)&str); + + godot_variant ret; + + godot_string_name method; + godot_string_name_new_with_latin1_chars(&method, "is_valid_identifier"); + + godot_variant_call_error error; + godot_variant_call(&self, &method, nullptr, 0, &ret, &error); + + CHECK(godot_variant_get_type(&ret) == GODOT_VARIANT_TYPE_BOOL); + CHECK(godot_variant_as_bool(&ret)); + + godot_variant_destroy(&ret); + godot_variant_destroy(&self); + godot_string_name_destroy(&method); +} + +TEST_CASE("[GDNative Variant] Variant evaluate") { + godot_variant one; + godot_variant_new_int(&one, 1); + godot_variant two; + godot_variant_new_int(&two, 2); + + godot_variant three; + godot_variant_new_nil(&three); + bool valid = false; + + godot_variant_evaluate(GODOT_VARIANT_OP_ADD, &one, &two, &three, &valid); + + CHECK(godot_variant_get_type(&three) == GODOT_VARIANT_TYPE_INT); + CHECK(godot_variant_as_int(&three) == 3); + CHECK(valid); + + godot_variant_destroy(&one); + godot_variant_destroy(&two); + godot_variant_destroy(&three); +} + +TEST_CASE("[GDNative Variant] Variant set/get named") { + godot_string_name x; + godot_string_name_new_with_latin1_chars(&x, "x"); + + Vector2 vec(0, 0); + godot_variant self; + godot_variant_new_vector2(&self, (godot_vector2 *)&vec); + + godot_variant set; + godot_variant_new_float(&set, 1.0); + + bool set_valid = false; + godot_variant_set_named(&self, &x, &set, &set_valid); + + bool get_valid = false; + godot_variant get = godot_variant_get_named(&self, &x, &get_valid); + + CHECK(get_valid); + CHECK(set_valid); + CHECK(godot_variant_get_type(&get) == GODOT_VARIANT_TYPE_FLOAT); + CHECK(godot_variant_as_float(&get) == 1.0); + + godot_string_name_destroy(&x); + godot_variant_destroy(&self); + godot_variant_destroy(&set); + godot_variant_destroy(&get); +} + +TEST_CASE("[GDNative Variant] Get utility function argument name") { + godot_string_name function; + godot_string_name_new_with_latin1_chars(&function, "pow"); + + godot_string arg_name = godot_variant_get_utility_function_argument_name(&function, 0); + + String *arg_name_str = (String *)&arg_name; + + CHECK(*arg_name_str == "base"); + + godot_string_destroy(&arg_name); + godot_string_name_destroy(&function); +} + +TEST_CASE("[GDNative Variant] Get utility function list") { + int count = godot_variant_get_utility_function_count(); + + godot_string_name *c_list = (godot_string_name *)godot_alloc(count * sizeof(godot_string_name)); + godot_variant_get_utility_function_list(c_list); + + List<StringName> cpp_list; + Variant::get_utility_function_list(&cpp_list); + + godot_string_name *cur = c_list; + + for (const StringName &E : cpp_list) { + const StringName &cpp_name = E; + StringName *c_name = (StringName *)cur++; + + CHECK(*c_name == cpp_name); + } + + godot_free(c_list); +} +} // namespace TestGDNativeVariant + +#endif // TEST_GDNATIVE_VARIANT_H diff --git a/modules/gdnative/xr/SCsub b/modules/gdnative/text/SCsub index 0b2db3b504..0b2db3b504 100644 --- a/modules/gdnative/xr/SCsub +++ b/modules/gdnative/text/SCsub diff --git a/modules/gdnative/xr/config.py b/modules/gdnative/text/config.py index d22f9454ed..d22f9454ed 100644 --- a/modules/gdnative/xr/config.py +++ b/modules/gdnative/text/config.py diff --git a/modules/gdnative/xr/register_types.cpp b/modules/gdnative/text/register_types.cpp index da3a7dc4b8..67385d2fbf 100644 --- a/modules/gdnative/xr/register_types.cpp +++ b/modules/gdnative/text/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -29,12 +29,8 @@ /*************************************************************************/ #include "register_types.h" -#include "xr_interface_gdnative.h" +#include "text_server_gdnative.h" -void register_xr_types() { - ClassDB::register_class<XRInterfaceGDNative>(); - ClassDB::add_compatibility_class("ARVRInterfaceGDNative", "XRInterfaceGDNative"); -} +void register_text_server_gdn_types() {} -void unregister_xr_types() { -} +void unregister_text_server_gdn_types() {} diff --git a/modules/gdnative/xr/register_types.h b/modules/gdnative/text/register_types.h index 2501d28651..cd4f2a3089 100644 --- a/modules/gdnative/xr/register_types.h +++ b/modules/gdnative/text/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -28,10 +28,10 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef XR_REGISTER_TYPES_H -#define XR_REGISTER_TYPES_H +#ifndef TEXT_REGISTER_TYPES_H +#define TEXT_REGISTER_TYPES_H -void register_xr_types(); -void unregister_xr_types(); +void register_text_server_gdn_types(); +void unregister_text_server_gdn_types(); -#endif // XR_REGISTER_TYPES_H +#endif // TEXT_REGISTER_TYPES_H diff --git a/modules/gdnative/text/text_server_gdnative.cpp b/modules/gdnative/text/text_server_gdnative.cpp new file mode 100644 index 0000000000..39db8ae636 --- /dev/null +++ b/modules/gdnative/text/text_server_gdnative.cpp @@ -0,0 +1,1086 @@ +/*************************************************************************/ +/* text_server_gdnative.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "text_server_gdnative.h" + +bool TextServerGDNative::has_feature(Feature p_feature) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->has_feature(data, (godot_int)p_feature); +} + +String TextServerGDNative::get_name() const { + ERR_FAIL_COND_V(interface == nullptr, String()); + godot_string result = interface->get_name(data); + String name = *(String *)&result; + godot_string_destroy(&result); + return name; +} + +void TextServerGDNative::free(RID p_rid) { + ERR_FAIL_COND(interface == nullptr); + interface->free(data, (godot_rid *)&p_rid); +} + +bool TextServerGDNative::has(RID p_rid) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->has(data, (godot_rid *)&p_rid); +} + +bool TextServerGDNative::load_support_data(const String &p_filename) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->load_support_data(data, (godot_string *)&p_filename); +} + +#ifdef TOOLS_ENABLED + +String TextServerGDNative::get_support_data_filename() { + ERR_FAIL_COND_V(interface == nullptr, String()); + godot_string result = interface->get_support_data_filename(data); + String name = *(String *)&result; + godot_string_destroy(&result); + return name; +} + +String TextServerGDNative::get_support_data_info() { + ERR_FAIL_COND_V(interface == nullptr, String()); + godot_string result = interface->get_support_data_info(data); + String info = *(String *)&result; + godot_string_destroy(&result); + return info; +} + +bool TextServerGDNative::save_support_data(const String &p_filename) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->save_support_data(data, (godot_string *)&p_filename); +} + +#endif + +bool TextServerGDNative::is_locale_right_to_left(const String &p_locale) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->is_locale_right_to_left(data, (godot_string *)&p_locale); +} + +int32_t TextServerGDNative::name_to_tag(const String &p_name) const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->name_to_tag(data, (godot_string *)&p_name); +} + +String TextServerGDNative::tag_to_name(int32_t p_tag) const { + ERR_FAIL_COND_V(interface == nullptr, String()); + godot_string result = interface->tag_to_name(data, p_tag); + String name = *(String *)&result; + godot_string_destroy(&result); + return name; +} + +/*************************************************************************/ +/* Font */ +/*************************************************************************/ + +RID TextServerGDNative::create_font() { + ERR_FAIL_COND_V(interface == nullptr, RID()); + godot_rid result = interface->create_font(data); + RID rid = *(RID *)&result; + return rid; +} + +void TextServerGDNative::font_set_data(RID p_font_rid, const PackedByteArray &p_data) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_data(data, (godot_rid *)&p_font_rid, (const godot_packed_byte_array *)&p_data); +} + +void TextServerGDNative::font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_data_ptr(data, (godot_rid *)&p_font_rid, p_data_ptr, p_data_size); +} + +void TextServerGDNative::font_set_antialiased(RID p_font_rid, bool p_antialiased) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_antialiased(data, (godot_rid *)&p_font_rid, p_antialiased); +} + +bool TextServerGDNative::font_is_antialiased(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_is_antialiased(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_multichannel_signed_distance_field(data, (godot_rid *)&p_font_rid, p_msdf); +} + +bool TextServerGDNative::font_is_multichannel_signed_distance_field(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_is_multichannel_signed_distance_field(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_msdf_pixel_range(data, (godot_rid *)&p_font_rid, p_msdf_pixel_range); +} + +int TextServerGDNative::font_get_msdf_pixel_range(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->font_get_msdf_pixel_range(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_msdf_size(RID p_font_rid, int p_msdf_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_msdf_size(data, (godot_rid *)&p_font_rid, p_msdf_size); +} + +int TextServerGDNative::font_get_msdf_size(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->font_get_msdf_size(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_fixed_size(RID p_font_rid, int p_fixed_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_fixed_size(data, (godot_rid *)&p_font_rid, p_fixed_size); +} + +int TextServerGDNative::font_get_fixed_size(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->font_get_fixed_size(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_force_autohinter(data, (godot_rid *)&p_font_rid, p_force_autohinter); +} + +bool TextServerGDNative::font_is_force_autohinter(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_is_force_autohinter(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_hinting(data, (godot_rid *)&p_font_rid, (godot_int)p_hinting); +} + +TextServer::Hinting TextServerGDNative::font_get_hinting(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, TextServer::HINTING_NONE); + return (TextServer::Hinting)interface->font_get_hinting(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_variation_coordinates(data, (godot_rid *)&p_font_rid, (const godot_dictionary *)&p_variation_coordinates); +} + +Dictionary TextServerGDNative::font_get_variation_coordinates(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, Dictionary()); + godot_dictionary result = interface->font_get_variation_coordinates(data, (godot_rid *)&p_font_rid); + Dictionary dict = *(Dictionary *)&result; + godot_dictionary_destroy(&result); + return dict; +} + +void TextServerGDNative::font_set_oversampling(RID p_font_rid, real_t p_oversampling) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_oversampling(data, (godot_rid *)&p_font_rid, p_oversampling); +} + +real_t TextServerGDNative::font_get_oversampling(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_oversampling(data, (godot_rid *)&p_font_rid); +} + +Array TextServerGDNative::font_get_size_cache_list(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, Array()); + godot_array result = interface->font_get_size_cache_list(data, (godot_rid *)&p_font_rid); + Array list = *(Array *)&result; + godot_array_destroy(&result); + return list; +} + +void TextServerGDNative::font_clear_size_cache(RID p_font_rid) { + ERR_FAIL_COND(interface == nullptr); + interface->font_clear_size_cache(data, (godot_rid *)&p_font_rid); +} + +void TextServerGDNative::font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_remove_size_cache(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size); +} + +void TextServerGDNative::font_set_ascent(RID p_font_rid, int p_size, real_t p_ascent) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_ascent(data, (godot_rid *)&p_font_rid, p_size, p_ascent); +} + +real_t TextServerGDNative::font_get_ascent(RID p_font_rid, int p_size) const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_ascent(data, (godot_rid *)&p_font_rid, p_size); +} + +void TextServerGDNative::font_set_descent(RID p_font_rid, int p_size, real_t p_descent) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_descent(data, (godot_rid *)&p_font_rid, p_size, p_descent); +} + +real_t TextServerGDNative::font_get_descent(RID p_font_rid, int p_size) const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_descent(data, (godot_rid *)&p_font_rid, p_size); +} + +void TextServerGDNative::font_set_underline_position(RID p_font_rid, int p_size, real_t p_underline_position) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_underline_position(data, (godot_rid *)&p_font_rid, p_size, p_underline_position); +} + +real_t TextServerGDNative::font_get_underline_position(RID p_font_rid, int p_size) const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_underline_position(data, (godot_rid *)&p_font_rid, p_size); +} + +void TextServerGDNative::font_set_underline_thickness(RID p_font_rid, int p_size, real_t p_underline_thickness) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_underline_thickness(data, (godot_rid *)&p_font_rid, p_size, p_underline_thickness); +} + +real_t TextServerGDNative::font_get_underline_thickness(RID p_font_rid, int p_size) const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_underline_thickness(data, (godot_rid *)&p_font_rid, p_size); +} + +void TextServerGDNative::font_set_scale(RID p_font_rid, int p_size, real_t p_scale) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_scale(data, (godot_rid *)&p_font_rid, p_size, p_scale); +} + +real_t TextServerGDNative::font_get_scale(RID p_font_rid, int p_size) const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_scale(data, (godot_rid *)&p_font_rid, p_size); +} + +void TextServerGDNative::font_set_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing, int p_value) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_spacing(data, (godot_rid *)&p_font_rid, p_size, (godot_int)p_spacing, p_value); +} + +int TextServerGDNative::font_get_spacing(RID p_font_rid, int p_size, TextServer::SpacingType p_spacing) const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->font_get_spacing(data, (godot_rid *)&p_font_rid, p_size, (godot_int)p_spacing); +} + +int TextServerGDNative::font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const { + ERR_FAIL_COND_V(interface == nullptr, -1); + return interface->font_get_texture_count(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size); +} + +void TextServerGDNative::font_clear_textures(RID p_font_rid, const Vector2i &p_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_clear_textures(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size); +} + +void TextServerGDNative::font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) { + ERR_FAIL_COND(interface == nullptr); + interface->font_remove_texture(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_texture_index); +} + +void TextServerGDNative::font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_texture_image(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_texture_index, (const godot_object *)p_image.ptr()); +} + +Ref<Image> TextServerGDNative::font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { + ERR_FAIL_COND_V(interface == nullptr, Ref<Image>()); + godot_object *result = interface->font_get_texture_image(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_texture_index); + return Ref<Image>((Image *)result); +} + +void TextServerGDNative::font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_texture_offsets(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_texture_index, (const godot_packed_int32_array *)&p_offset); +} + +PackedInt32Array TextServerGDNative::font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const { + ERR_FAIL_COND_V(interface == nullptr, PackedInt32Array()); + godot_packed_int32_array result = interface->font_get_texture_offsets(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_texture_index); + PackedInt32Array offset = *(PackedInt32Array *)&result; + godot_packed_int32_array_destroy(&result); + return offset; +} + +Array TextServerGDNative::font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const { + ERR_FAIL_COND_V(interface == nullptr, Array()); + godot_array result = interface->font_get_glyph_list(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size); + Array list = *(Array *)&result; + godot_array_destroy(&result); + return list; +} + +void TextServerGDNative::font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_clear_glyphs(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size); +} + +void TextServerGDNative::font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) { + ERR_FAIL_COND(interface == nullptr); + interface->font_remove_glyph(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph); +} + +Vector2 TextServerGDNative::font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const { + ERR_FAIL_COND_V(interface == nullptr, Vector2()); + godot_vector2 result = interface->font_get_glyph_advance(data, (godot_rid *)&p_font_rid, p_size, p_glyph); + Vector2 adv = *(Vector2 *)&result; + return adv; +} + +void TextServerGDNative::font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_glyph_advance(data, (godot_rid *)&p_font_rid, p_size, p_glyph, (const godot_vector2 *)&p_advance); +} + +Vector2 TextServerGDNative::font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { + ERR_FAIL_COND_V(interface == nullptr, Vector2()); + godot_vector2 result = interface->font_get_glyph_offset(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph); + Vector2 off = *(Vector2 *)&result; + return off; +} + +void TextServerGDNative::font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_glyph_offset(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph, (const godot_vector2 *)&p_offset); +} + +Vector2 TextServerGDNative::font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { + ERR_FAIL_COND_V(interface == nullptr, Vector2()); + godot_vector2 result = interface->font_get_glyph_size(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph); + Vector2 sz = *(Vector2 *)&result; + return sz; +} + +void TextServerGDNative::font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_glyph_size(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph, (const godot_vector2 *)&p_gl_size); +} + +Rect2 TextServerGDNative::font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { + ERR_FAIL_COND_V(interface == nullptr, Rect2()); + godot_rect2 result = interface->font_get_glyph_uv_rect(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph); + Rect2 uv = *(Rect2 *)&result; + return uv; +} + +void TextServerGDNative::font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_glyph_uv_rect(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph, (const godot_rect2 *)&p_uv_rect); +} + +int TextServerGDNative::font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const { + ERR_FAIL_COND_V(interface == nullptr, -1); + return interface->font_get_glyph_texture_idx(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph); +} + +void TextServerGDNative::font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_glyph_texture_idx(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_glyph, p_texture_idx); +} + +bool TextServerGDNative::font_get_glyph_contours(RID p_font_rid, int p_size, int32_t p_index, Vector<Vector3> &r_points, Vector<int32_t> &r_contours, bool &r_orientation) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_get_glyph_contours(data, (godot_rid *)&p_font_rid, p_size, p_index, (godot_packed_vector3_array *)&r_points, (godot_packed_int32_array *)&r_contours, &r_orientation); +} + +Array TextServerGDNative::font_get_kerning_list(RID p_font_rid, int p_size) const { + ERR_FAIL_COND_V(interface == nullptr, Array()); + godot_array result = interface->font_get_kerning_list(data, (godot_rid *)&p_font_rid, p_size); + Array list = *(Array *)&result; + godot_array_destroy(&result); + return list; +} + +void TextServerGDNative::font_clear_kerning_map(RID p_font_rid, int p_size) { + ERR_FAIL_COND(interface == nullptr); + interface->font_clear_kerning_map(data, (godot_rid *)&p_font_rid, p_size); +} + +void TextServerGDNative::font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) { + ERR_FAIL_COND(interface == nullptr); + interface->font_remove_kerning(data, (godot_rid *)&p_font_rid, p_size, (const godot_vector2i *)&p_glyph_pair); +} + +void TextServerGDNative::font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_kerning(data, (godot_rid *)&p_font_rid, p_size, (const godot_vector2i *)&p_glyph_pair, (const godot_vector2 *)&p_kerning); +} + +Vector2 TextServerGDNative::font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const { + ERR_FAIL_COND_V(interface == nullptr, Vector2()); + godot_vector2 result = interface->font_get_kerning(data, (godot_rid *)&p_font_rid, p_size, (const godot_vector2i *)&p_glyph_pair); + Vector2 kern = *(Vector2 *)&result; + return kern; +} + +int32_t TextServerGDNative::font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector) const { + ERR_FAIL_COND_V(interface == nullptr, 0); + return interface->font_get_glyph_index(data, (godot_rid *)&p_font_rid, p_size, p_char, p_variation_selector); +} + +bool TextServerGDNative::font_has_char(RID p_font_rid, char32_t p_char) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_has_char(data, (godot_rid *)&p_font_rid, p_char); +} + +String TextServerGDNative::font_get_supported_chars(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, String()); + godot_string result = interface->font_get_supported_chars(data, (godot_rid *)&p_font_rid); + String chars = *(String *)&result; + godot_string_destroy(&result); + return chars; +} + +void TextServerGDNative::font_render_range(RID p_font_rid, const Vector2i &p_size, char32_t p_start, char32_t p_end) { + ERR_FAIL_COND(interface == nullptr); + interface->font_render_range(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_start, p_end); +} + +void TextServerGDNative::font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) { + ERR_FAIL_COND(interface == nullptr); + interface->font_render_glyph(data, (godot_rid *)&p_font_rid, (const godot_vector2i *)&p_size, p_index); +} + +void TextServerGDNative::font_draw_glyph(RID p_font_rid, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { + ERR_FAIL_COND(interface == nullptr); + interface->font_draw_glyph(data, (godot_rid *)&p_font_rid, (godot_rid *)&p_canvas, p_size, (const godot_vector2 *)&p_pos, p_index, (const godot_color *)&p_color); +} + +void TextServerGDNative::font_draw_glyph_outline(RID p_font_rid, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color) const { + ERR_FAIL_COND(interface == nullptr); + interface->font_draw_glyph_outline(data, (godot_rid *)&p_font_rid, (godot_rid *)&p_canvas, p_size, p_outline_size, (const godot_vector2 *)&p_pos, p_index, (const godot_color *)&p_color); +} + +bool TextServerGDNative::font_is_language_supported(RID p_font_rid, const String &p_language) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_is_language_supported(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_language); +} + +void TextServerGDNative::font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_language_support_override(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_language, p_supported); +} + +bool TextServerGDNative::font_get_language_support_override(RID p_font_rid, const String &p_language) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_get_language_support_override(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_language); +} + +void TextServerGDNative::font_remove_language_support_override(RID p_font_rid, const String &p_language) { + ERR_FAIL_COND(interface == nullptr); + interface->font_remove_language_support_override(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_language); +} + +Vector<String> TextServerGDNative::font_get_language_support_overrides(RID p_font_rid) { + ERR_FAIL_COND_V(interface == nullptr, PackedStringArray()); + godot_packed_string_array result = interface->font_get_language_support_overrides(data, (godot_rid *)&p_font_rid); + PackedStringArray list = *(PackedStringArray *)&result; + godot_packed_string_array_destroy(&result); + return list; +} + +bool TextServerGDNative::font_is_script_supported(RID p_font_rid, const String &p_script) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_is_script_supported(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_script); +} + +void TextServerGDNative::font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_script_support_override(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_script, p_supported); +} + +bool TextServerGDNative::font_get_script_support_override(RID p_font_rid, const String &p_script) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->font_get_script_support_override(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_script); +} + +void TextServerGDNative::font_remove_script_support_override(RID p_font_rid, const String &p_script) { + ERR_FAIL_COND(interface == nullptr); + interface->font_remove_script_support_override(data, (godot_rid *)&p_font_rid, (const godot_string *)&p_script); +} + +Vector<String> TextServerGDNative::font_get_script_support_overrides(RID p_font_rid) { + ERR_FAIL_COND_V(interface == nullptr, PackedStringArray()); + godot_packed_string_array result = interface->font_get_script_support_overrides(data, (godot_rid *)&p_font_rid); + PackedStringArray list = *(PackedStringArray *)&result; + godot_packed_string_array_destroy(&result); + return list; +} + +Dictionary TextServerGDNative::font_supported_feature_list(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, Dictionary()); + godot_dictionary result = interface->font_supported_feature_list(data, (godot_rid *)&p_font_rid); + Dictionary dict = *(Dictionary *)&result; + godot_dictionary_destroy(&result); + return dict; +} + +Dictionary TextServerGDNative::font_supported_variation_list(RID p_font_rid) const { + ERR_FAIL_COND_V(interface == nullptr, Dictionary()); + godot_dictionary result = interface->font_supported_variation_list(data, (godot_rid *)&p_font_rid); + Dictionary dict = *(Dictionary *)&result; + godot_dictionary_destroy(&result); + return dict; +} + +real_t TextServerGDNative::font_get_global_oversampling() const { + ERR_FAIL_COND_V(interface == nullptr, 0.0f); + return interface->font_get_global_oversampling(data); +} + +void TextServerGDNative::font_set_global_oversampling(real_t p_oversampling) { + ERR_FAIL_COND(interface == nullptr); + interface->font_set_global_oversampling(data, p_oversampling); +} + +/*************************************************************************/ +/* Shaped text buffer interface */ +/*************************************************************************/ + +RID TextServerGDNative::create_shaped_text(TextServer::Direction p_direction, TextServer::Orientation p_orientation) { + ERR_FAIL_COND_V(interface == nullptr, RID()); + godot_rid result = interface->create_shaped_text(data, (godot_int)p_direction, (godot_int)p_orientation); + RID rid = *(RID *)&result; + return rid; +} + +void TextServerGDNative::shaped_text_clear(RID p_shaped) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_clear(data, (godot_rid *)&p_shaped); +} + +void TextServerGDNative::shaped_text_set_direction(RID p_shaped, TextServer::Direction p_direction) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_set_direction(data, (godot_rid *)&p_shaped, (godot_int)p_direction); +} + +TextServer::Direction TextServerGDNative::shaped_text_get_direction(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, TextServer::DIRECTION_LTR); + return (TextServer::Direction)interface->shaped_text_get_direction(data, (godot_rid *)&p_shaped); +} + +void TextServerGDNative::shaped_text_set_orientation(RID p_shaped, TextServer::Orientation p_orientation) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_set_orientation(data, (godot_rid *)&p_shaped, (godot_int)p_orientation); +} + +TextServer::Orientation TextServerGDNative::shaped_text_get_orientation(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, TextServer::ORIENTATION_HORIZONTAL); + return (TextServer::Orientation)interface->shaped_text_get_orientation(data, (godot_rid *)&p_shaped); +} + +void TextServerGDNative::shaped_text_set_bidi_override(RID p_shaped, const Vector<Vector2i> &p_override) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_set_bidi_override(data, (godot_rid *)&p_shaped, (const godot_packed_vector2i_array *)&p_override); +} + +void TextServerGDNative::shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_set_preserve_invalid(data, (godot_rid *)&p_shaped, p_enabled); +} + +bool TextServerGDNative::shaped_text_get_preserve_invalid(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return (TextServer::Orientation)interface->shaped_text_get_preserve_invalid(data, (godot_rid *)&p_shaped); +} + +void TextServerGDNative::shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_set_preserve_control(data, (godot_rid *)&p_shaped, p_enabled); +} + +bool TextServerGDNative::shaped_text_get_preserve_control(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return (TextServer::Orientation)interface->shaped_text_get_preserve_control(data, (godot_rid *)&p_shaped); +} + +bool TextServerGDNative::shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features, const String &p_language) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_add_string(data, (godot_rid *)&p_shaped, (const godot_string *)&p_text, (const godot_rid **)p_fonts.ptr(), p_size, (const godot_dictionary *)&p_opentype_features, (const godot_string *)&p_language); +} + +bool TextServerGDNative::shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align, int p_length) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_add_object(data, (godot_rid *)&p_shaped, (const godot_variant *)&p_key, (const godot_vector2 *)&p_size, (godot_int)p_inline_align, p_length); +} + +bool TextServerGDNative::shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_resize_object(data, (godot_rid *)&p_shaped, (const godot_variant *)&p_key, (const godot_vector2 *)&p_size, (godot_int)p_inline_align); +} + +RID TextServerGDNative::shaped_text_substr(RID p_shaped, int p_start, int p_length) const { + ERR_FAIL_COND_V(interface == nullptr, RID()); + godot_rid result = interface->shaped_text_substr(data, (godot_rid *)&p_shaped, (godot_int)p_start, (godot_int)p_length); + RID rid = *(RID *)&result; + return rid; +} + +RID TextServerGDNative::shaped_text_get_parent(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, RID()); + godot_rid result = interface->shaped_text_get_parent(data, (godot_rid *)&p_shaped); + RID rid = *(RID *)&result; + return rid; +} + +real_t TextServerGDNative::shaped_text_fit_to_width(RID p_shaped, real_t p_width, uint8_t p_jst_flags) { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_fit_to_width(data, (godot_rid *)&p_shaped, p_width, p_jst_flags); +} + +real_t TextServerGDNative::shaped_text_tab_align(RID p_shaped, const Vector<real_t> &p_tab_stops) { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_tab_align(data, (godot_rid *)&p_shaped, (godot_packed_float32_array *)&p_tab_stops); +} + +bool TextServerGDNative::shaped_text_shape(RID p_shaped) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_shape(data, (godot_rid *)&p_shaped); +} + +bool TextServerGDNative::shaped_text_update_breaks(RID p_shaped) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_update_breaks(data, (godot_rid *)&p_shaped); +} + +bool TextServerGDNative::shaped_text_update_justification_ops(RID p_shaped) { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_update_justification_ops(data, (godot_rid *)&p_shaped); +} + +void TextServerGDNative::shaped_text_overrun_trim_to_width(RID p_shaped_line, real_t p_width, uint8_t p_trim_flags) { + ERR_FAIL_COND(interface == nullptr); + interface->shaped_text_overrun_trim_to_width(data, (godot_rid *)&p_shaped_line, p_width, p_trim_flags); +}; + +bool TextServerGDNative::shaped_text_is_ready(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, false); + return interface->shaped_text_is_ready(data, (godot_rid *)&p_shaped); +} + +Vector<TextServer::Glyph> TextServerGDNative::shaped_text_get_glyphs(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, Vector<TextServer::Glyph>()); + godot_packed_glyph_array result = interface->shaped_text_get_glyphs(data, (godot_rid *)&p_shaped); + Vector<TextServer::Glyph> glyphs = *(Vector<TextServer::Glyph> *)&result; + godot_packed_glyph_array_destroy(&result); + return glyphs; +} + +Vector2i TextServerGDNative::shaped_text_get_range(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, Vector2i()); + godot_vector2i result = interface->shaped_text_get_range(data, (godot_rid *)&p_shaped); + Vector2i range = *(Vector2i *)&result; + return range; +} + +Vector<TextServer::Glyph> TextServerGDNative::shaped_text_sort_logical(RID p_shaped) { + ERR_FAIL_COND_V(interface == nullptr, Vector<TextServer::Glyph>()); + godot_packed_glyph_array result = interface->shaped_text_sort_logical(data, (godot_rid *)&p_shaped); + Vector<TextServer::Glyph> glyphs = *(Vector<TextServer::Glyph> *)&result; + godot_packed_glyph_array_destroy(&result); + return glyphs; +} + +Vector<Vector2i> TextServerGDNative::shaped_text_get_line_breaks_adv(RID p_shaped, const Vector<real_t> &p_width, int p_start, bool p_once, uint8_t p_break_flags) const { + ERR_FAIL_COND_V(interface == nullptr, Vector<Vector2i>()); + if (interface->shaped_text_get_line_breaks_adv != nullptr) { + godot_packed_vector2i_array result = interface->shaped_text_get_line_breaks_adv(data, (godot_rid *)&p_shaped, (godot_packed_float32_array *)&p_width, p_start, p_once, p_break_flags); + Vector<Vector2i> breaks = *(Vector<Vector2i> *)&result; + godot_packed_vector2i_array_destroy(&result); + return breaks; + } else { + return TextServer::shaped_text_get_line_breaks_adv(p_shaped, p_width, p_break_flags); + } +} + +Vector<Vector2i> TextServerGDNative::shaped_text_get_line_breaks(RID p_shaped, real_t p_width, int p_start, uint8_t p_break_flags) const { + ERR_FAIL_COND_V(interface == nullptr, Vector<Vector2i>()); + if (interface->shaped_text_get_line_breaks != nullptr) { + godot_packed_vector2i_array result = interface->shaped_text_get_line_breaks(data, (godot_rid *)&p_shaped, p_width, p_start, p_break_flags); + Vector<Vector2i> breaks = *(Vector<Vector2i> *)&result; + godot_packed_vector2i_array_destroy(&result); + return breaks; + } else { + return TextServer::shaped_text_get_line_breaks(p_shaped, p_width, p_break_flags); + } +} + +Vector<Vector2i> TextServerGDNative::shaped_text_get_word_breaks(RID p_shaped, int p_grapheme_flags) const { + ERR_FAIL_COND_V(interface == nullptr, Vector<Vector2i>()); + if (interface->shaped_text_get_word_breaks != nullptr) { + godot_packed_vector2i_array result = interface->shaped_text_get_word_breaks(data, (godot_rid *)&p_shaped, p_grapheme_flags); + Vector<Vector2i> breaks = *(Vector<Vector2i> *)&result; + godot_packed_vector2i_array_destroy(&result); + return breaks; + } else { + return TextServer::shaped_text_get_word_breaks(p_shaped, p_grapheme_flags); + } +} + +Array TextServerGDNative::shaped_text_get_objects(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, Array()); + godot_array result = interface->shaped_text_get_objects(data, (godot_rid *)&p_shaped); + Array rect = *(Array *)&result; + return rect; +} + +Rect2 TextServerGDNative::shaped_text_get_object_rect(RID p_shaped, Variant p_key) const { + ERR_FAIL_COND_V(interface == nullptr, Rect2()); + godot_rect2 result = interface->shaped_text_get_object_rect(data, (godot_rid *)&p_shaped, (const godot_variant *)&p_key); + Rect2 rect = *(Rect2 *)&result; + return rect; +} + +Size2 TextServerGDNative::shaped_text_get_size(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, Size2()); + godot_vector2 result = interface->shaped_text_get_size(data, (godot_rid *)&p_shaped); + Size2 size = *(Size2 *)&result; + return size; +} + +real_t TextServerGDNative::shaped_text_get_ascent(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_get_ascent(data, (godot_rid *)&p_shaped); +} + +real_t TextServerGDNative::shaped_text_get_descent(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_get_descent(data, (godot_rid *)&p_shaped); +} + +real_t TextServerGDNative::shaped_text_get_width(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_get_width(data, (godot_rid *)&p_shaped); +} + +real_t TextServerGDNative::shaped_text_get_underline_position(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_get_underline_position(data, (godot_rid *)&p_shaped); +} + +real_t TextServerGDNative::shaped_text_get_underline_thickness(RID p_shaped) const { + ERR_FAIL_COND_V(interface == nullptr, 0.f); + return interface->shaped_text_get_underline_thickness(data, (godot_rid *)&p_shaped); +} + +String TextServerGDNative::format_number(const String &p_string, const String &p_language) const { + ERR_FAIL_COND_V(interface == nullptr, String()); + godot_string result = interface->format_number(data, (const godot_string *)&p_string, (const godot_string *)&p_language); + if (interface->format_number == nullptr) { + return p_string; + } + String ret = *(String *)&result; + godot_string_destroy(&result); + return ret; +} + +String TextServerGDNative::parse_number(const String &p_string, const String &p_language) const { + ERR_FAIL_COND_V(interface == nullptr, String()); + if (interface->parse_number == nullptr) { + return p_string; + } + godot_string result = interface->parse_number(data, (const godot_string *)&p_string, (const godot_string *)&p_language); + String ret = *(String *)&result; + godot_string_destroy(&result); + return ret; +} + +String TextServerGDNative::percent_sign(const String &p_language) const { + ERR_FAIL_COND_V(interface == nullptr, String()); + if (interface->percent_sign == nullptr) { + return "%"; + } + godot_string result = interface->percent_sign(data, (const godot_string *)&p_language); + String ret = *(String *)&result; + godot_string_destroy(&result); + return ret; +} + +TextServer *TextServerGDNative::create_func(Error &r_error, void *p_user_data) { + const godot_text_interface_gdnative *interface = (const godot_text_interface_gdnative *)p_user_data; + r_error = OK; + + TextServerGDNative *server = memnew(TextServerGDNative()); + server->interface = interface; + server->data = interface->constructor((godot_object *)server); + + return server; +} + +TextServerGDNative::TextServerGDNative() { + data = nullptr; + interface = nullptr; +} + +TextServerGDNative::~TextServerGDNative() { + if (interface != nullptr) { + interface->destructor(data); + data = nullptr; + interface = nullptr; + } +} + +/*************************************************************************/ +/* GDNative functions */ +/*************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +static_assert(sizeof(godot_glyph) == sizeof(TextServer::Glyph), "Glyph size mismatch"); +static_assert(sizeof(godot_packed_glyph_array) == sizeof(Vector<TextServer::Glyph>), "Vector<Glyph> size mismatch"); + +void GDAPI godot_text_register_interface(const godot_text_interface_gdnative *p_interface, const godot_string *p_name, uint32_t p_features) { + ERR_FAIL_COND(p_interface->version.major != 1); + String name = *(String *)p_name; + TextServerManager::register_create_function(name + "(GDNative)", p_features, TextServerGDNative::create_func, (void *)p_interface); +} + +// Glyph + +void GDAPI godot_glyph_new(godot_glyph *r_dest) { + TextServer::Glyph *dest = (TextServer::Glyph *)r_dest; + *dest = TextServer::Glyph(); +} + +godot_vector2i GDAPI godot_glyph_get_range(const godot_glyph *p_self) { + godot_vector2i dest; + Vector2i *d = (Vector2i *)&dest; + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + d->x = self->start; + d->y = self->end; + return dest; +} + +void GDAPI godot_glyph_set_range(godot_glyph *p_self, const godot_vector2i *p_range) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + const Vector2i *range = (const Vector2i *)p_range; + self->start = range->x; + self->end = range->y; +} + +godot_int GDAPI godot_glyph_get_count(const godot_glyph *p_self) { + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + return self->count; +} + +void GDAPI godot_glyph_set_count(godot_glyph *p_self, godot_int p_count) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + self->count = p_count; +} + +godot_int GDAPI godot_glyph_get_repeat(const godot_glyph *p_self) { + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + return self->repeat; +} + +void GDAPI godot_glyph_set_repeat(godot_glyph *p_self, godot_int p_repeat) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + self->repeat = p_repeat; +} + +godot_int GDAPI godot_glyph_get_flags(const godot_glyph *p_self) { + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + return self->flags; +} + +void GDAPI godot_glyph_set_flags(godot_glyph *p_self, godot_int p_flags) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + self->flags = p_flags; +} + +godot_vector2 GDAPI godot_glyph_get_offset(const godot_glyph *p_self) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + d->x = self->x_off; + d->y = self->y_off; + return dest; +} + +void GDAPI godot_glyph_set_offset(godot_glyph *p_self, const godot_vector2 *p_offset) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + const Vector2 *offset = (const Vector2 *)p_offset; + self->x_off = offset->x; + self->y_off = offset->y; +} + +godot_real_t GDAPI godot_glyph_get_advance(const godot_glyph *p_self) { + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + return self->advance; +} + +void GDAPI godot_glyph_set_advance(godot_glyph *p_self, godot_real_t p_advance) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + self->advance = p_advance; +} + +godot_rid GDAPI godot_glyph_get_font(const godot_glyph *p_self) { + godot_rid dest; + RID *d = (RID *)&dest; + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + *d = self->font_rid; + return dest; +} + +void GDAPI godot_glyph_set_font(godot_glyph *p_self, godot_rid *p_font) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + const RID *font = (const RID *)p_font; + self->font_rid = *font; +} + +godot_int GDAPI godot_glyph_get_font_size(const godot_glyph *p_self) { + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + return self->font_size; +} + +void GDAPI godot_glyph_set_font_size(godot_glyph *p_self, godot_int p_size) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + self->font_size = p_size; +} + +godot_int GDAPI godot_glyph_get_index(const godot_glyph *p_self) { + const TextServer::Glyph *self = (const TextServer::Glyph *)p_self; + return self->index; +} + +void GDAPI godot_glyph_set_index(godot_glyph *p_self, godot_int p_index) { + TextServer::Glyph *self = (TextServer::Glyph *)p_self; + self->index = p_index; +} + +// GlyphArray + +void GDAPI godot_packed_glyph_array_new(godot_packed_glyph_array *r_dest) { + Vector<TextServer::Glyph> *dest = (Vector<TextServer::Glyph> *)r_dest; + memnew_placement(dest, Vector<TextServer::Glyph>); +} + +void GDAPI godot_packed_glyph_array_new_copy(godot_packed_glyph_array *r_dest, const godot_packed_glyph_array *p_src) { + Vector<TextServer::Glyph> *dest = (Vector<TextServer::Glyph> *)r_dest; + const Vector<TextServer::Glyph> *src = (const Vector<TextServer::Glyph> *)p_src; + memnew_placement(dest, Vector<TextServer::Glyph>(*src)); +} + +const godot_glyph GDAPI *godot_packed_glyph_array_ptr(const godot_packed_glyph_array *p_self) { + const Vector<TextServer::Glyph> *self = (const Vector<TextServer::Glyph> *)p_self; + return (const godot_glyph *)self->ptr(); +} + +godot_glyph GDAPI *godot_packed_glyph_array_ptrw(godot_packed_glyph_array *p_self) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + return (godot_glyph *)self->ptrw(); +} + +void GDAPI godot_packed_glyph_array_append(godot_packed_glyph_array *p_self, const godot_glyph *p_data) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + TextServer::Glyph &s = *(TextServer::Glyph *)p_data; + self->push_back(s); +} + +void GDAPI godot_packed_glyph_array_append_array(godot_packed_glyph_array *p_self, const godot_packed_glyph_array *p_array) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + Vector<TextServer::Glyph> *array = (Vector<TextServer::Glyph> *)p_array; + self->append_array(*array); +} + +godot_error GDAPI godot_packed_glyph_array_insert(godot_packed_glyph_array *p_self, const godot_int p_idx, const godot_glyph *p_data) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + TextServer::Glyph &s = *(TextServer::Glyph *)p_data; + return (godot_error)self->insert(p_idx, s); +} + +godot_bool GDAPI godot_packed_glyph_array_has(godot_packed_glyph_array *p_self, const godot_glyph *p_value) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + TextServer::Glyph &v = *(TextServer::Glyph *)p_value; + return (godot_bool)self->has(v); +} + +void GDAPI godot_packed_glyph_array_sort(godot_packed_glyph_array *p_self) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + self->sort(); +} + +void GDAPI godot_packed_glyph_array_reverse(godot_packed_glyph_array *p_self) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + self->reverse(); +} + +void GDAPI godot_packed_glyph_array_push_back(godot_packed_glyph_array *p_self, const godot_glyph *p_data) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + TextServer::Glyph &s = *(TextServer::Glyph *)p_data; + self->push_back(s); +} + +void GDAPI godot_packed_glyph_array_remove(godot_packed_glyph_array *p_self, const godot_int p_idx) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + self->remove(p_idx); +} + +void GDAPI godot_packed_glyph_array_resize(godot_packed_glyph_array *p_self, const godot_int p_size) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + self->resize(p_size); +} + +void GDAPI godot_packed_glyph_array_set(godot_packed_glyph_array *p_self, const godot_int p_idx, const godot_glyph *p_data) { + Vector<TextServer::Glyph> *self = (Vector<TextServer::Glyph> *)p_self; + TextServer::Glyph &s = *(TextServer::Glyph *)p_data; + self->set(p_idx, s); +} + +godot_glyph GDAPI godot_packed_glyph_array_get(const godot_packed_glyph_array *p_self, const godot_int p_idx) { + const Vector<TextServer::Glyph> *self = (const Vector<TextServer::Glyph> *)p_self; + godot_glyph v; + TextServer::Glyph *s = (TextServer::Glyph *)&v; + *s = self->get(p_idx); + return v; +} + +godot_int GDAPI godot_packed_glyph_array_size(const godot_packed_glyph_array *p_self) { + const Vector<TextServer::Glyph> *self = (const Vector<TextServer::Glyph> *)p_self; + return self->size(); +} + +godot_bool GDAPI godot_packed_glyph_array_is_empty(const godot_packed_glyph_array *p_self) { + const Vector<TextServer::Glyph> *self = (const Vector<TextServer::Glyph> *)p_self; + return self->is_empty(); +} + +void GDAPI godot_packed_glyph_array_destroy(godot_packed_glyph_array *p_self) { + ((Vector<TextServer::Glyph> *)p_self)->~Vector(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/text/text_server_gdnative.h b/modules/gdnative/text/text_server_gdnative.h new file mode 100644 index 0000000000..f081637e23 --- /dev/null +++ b/modules/gdnative/text/text_server_gdnative.h @@ -0,0 +1,254 @@ +/*************************************************************************/ +/* text_server_gdnative.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef TEXT_SERVER_GDNATIVE_H +#define TEXT_SERVER_GDNATIVE_H + +#include "modules/gdnative/gdnative.h" + +#include "servers/text_server.h" + +class TextServerGDNative : public TextServer { + GDCLASS(TextServerGDNative, TextServer); + + const godot_text_interface_gdnative *interface = nullptr; + void *data = nullptr; + +protected: + static void _bind_methods(){}; + +public: + virtual bool has_feature(Feature p_feature) override; + virtual String get_name() const override; + + virtual void free(RID p_rid) override; + virtual bool has(RID p_rid) override; + virtual bool load_support_data(const String &p_filename) override; + +#ifdef TOOLS_ENABLED + virtual String get_support_data_filename() override; + virtual String get_support_data_info() override; + virtual bool save_support_data(const String &p_filename) override; +#endif + + virtual bool is_locale_right_to_left(const String &p_locale) override; + + virtual int32_t name_to_tag(const String &p_name) const override; + virtual String tag_to_name(int32_t p_tag) const override; + + /* Font interface */ + virtual RID create_font() override; + + virtual void font_set_data(RID p_font_rid, const PackedByteArray &p_data) override; + virtual void font_set_data_ptr(RID p_font_rid, const uint8_t *p_data_ptr, size_t p_data_size) override; + + virtual void font_set_antialiased(RID p_font_rid, bool p_antialiased) override; + virtual bool font_is_antialiased(RID p_font_rid) const override; + + virtual void font_set_multichannel_signed_distance_field(RID p_font_rid, bool p_msdf) override; + virtual bool font_is_multichannel_signed_distance_field(RID p_font_rid) const override; + + virtual void font_set_msdf_pixel_range(RID p_font_rid, int p_msdf_pixel_range) override; + virtual int font_get_msdf_pixel_range(RID p_font_rid) const override; + + virtual void font_set_msdf_size(RID p_font_rid, int p_msdf_size) override; + virtual int font_get_msdf_size(RID p_font_rid) const override; + + virtual void font_set_fixed_size(RID p_font_rid, int p_fixed_size) override; + virtual int font_get_fixed_size(RID p_font_rid) const override; + + virtual void font_set_force_autohinter(RID p_font_rid, bool p_force_autohinter) override; + virtual bool font_is_force_autohinter(RID p_font_rid) const override; + + virtual void font_set_hinting(RID p_font_rid, TextServer::Hinting p_hinting) override; + virtual TextServer::Hinting font_get_hinting(RID p_font_rid) const override; + + virtual void font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) override; + virtual Dictionary font_get_variation_coordinates(RID p_font_rid) const override; + + virtual void font_set_oversampling(RID p_font_rid, real_t p_oversampling) override; + virtual real_t font_get_oversampling(RID p_font_rid) const override; + + virtual Array font_get_size_cache_list(RID p_font_rid) const override; + virtual void font_clear_size_cache(RID p_font_rid) override; + virtual void font_remove_size_cache(RID p_font_rid, const Vector2i &p_size) override; + + virtual void font_set_ascent(RID p_font_rid, int p_size, real_t p_ascent) override; + virtual real_t font_get_ascent(RID p_font_rid, int p_size) const override; + + virtual void font_set_descent(RID p_font_rid, int p_size, real_t p_descent) override; + virtual real_t font_get_descent(RID p_font_rid, int p_size) const override; + + virtual void font_set_underline_position(RID p_font_rid, int p_size, real_t p_underline_position) override; + virtual real_t font_get_underline_position(RID p_font_rid, int p_size) const override; + + virtual void font_set_underline_thickness(RID p_font_rid, int p_size, real_t p_underline_thickness) override; + virtual real_t font_get_underline_thickness(RID p_font_rid, int p_size) const override; + + virtual void font_set_scale(RID p_font_rid, int p_size, real_t p_scale) override; + virtual real_t font_get_scale(RID p_font_rid, int p_size) const override; + + virtual void font_set_spacing(RID p_font_rid, int p_size, SpacingType p_spacing, int p_value) override; + virtual int font_get_spacing(RID p_font_rid, int p_size, SpacingType p_spacing) const override; + + virtual int font_get_texture_count(RID p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_textures(RID p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_texture(RID p_font_rid, const Vector2i &p_size, int p_texture_index) override; + + virtual void font_set_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const Ref<Image> &p_image) override; + virtual Ref<Image> font_get_texture_image(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; + + virtual void font_set_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index, const PackedInt32Array &p_offset) override; + virtual PackedInt32Array font_get_texture_offsets(RID p_font_rid, const Vector2i &p_size, int p_texture_index) const override; + + virtual Array font_get_glyph_list(RID p_font_rid, const Vector2i &p_size) const override; + virtual void font_clear_glyphs(RID p_font_rid, const Vector2i &p_size) override; + virtual void font_remove_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) override; + + virtual Vector2 font_get_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph) const override; + virtual void font_set_glyph_advance(RID p_font_rid, int p_size, int32_t p_glyph, const Vector2 &p_advance) override; + + virtual Vector2 font_get_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; + virtual void font_set_glyph_offset(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_offset) override; + + virtual Vector2 font_get_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; + virtual void font_set_glyph_size(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Vector2 &p_gl_size) override; + + virtual Rect2 font_get_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; + virtual void font_set_glyph_uv_rect(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, const Rect2 &p_uv_rect) override; + + virtual int font_get_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph) const override; + virtual void font_set_glyph_texture_idx(RID p_font_rid, const Vector2i &p_size, int32_t p_glyph, int p_texture_idx) override; + + virtual bool font_get_glyph_contours(RID p_font, int p_size, int32_t p_index, Vector<Vector3> &r_points, Vector<int32_t> &r_contours, bool &r_orientation) const override; + + virtual Array font_get_kerning_list(RID p_font_rid, int p_size) const override; + virtual void font_clear_kerning_map(RID p_font_rid, int p_size) override; + virtual void font_remove_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) override; + + virtual void font_set_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair, const Vector2 &p_kerning) override; + virtual Vector2 font_get_kerning(RID p_font_rid, int p_size, const Vector2i &p_glyph_pair) const override; + + virtual int32_t font_get_glyph_index(RID p_font_rid, int p_size, char32_t p_char, char32_t p_variation_selector = 0) const override; + + virtual bool font_has_char(RID p_font_rid, char32_t p_char) const override; + virtual String font_get_supported_chars(RID p_font_rid) const override; + + virtual void font_render_range(RID p_font, const Vector2i &p_size, char32_t p_start, char32_t p_end) override; + virtual void font_render_glyph(RID p_font_rid, const Vector2i &p_size, int32_t p_index) override; + + virtual void font_draw_glyph(RID p_font, RID p_canvas, int p_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + virtual void font_draw_glyph_outline(RID p_font, RID p_canvas, int p_size, int p_outline_size, const Vector2 &p_pos, int32_t p_index, const Color &p_color = Color(1, 1, 1)) const override; + + virtual bool font_is_language_supported(RID p_font_rid, const String &p_language) const override; + virtual void font_set_language_support_override(RID p_font_rid, const String &p_language, bool p_supported) override; + virtual bool font_get_language_support_override(RID p_font_rid, const String &p_language) override; + virtual void font_remove_language_support_override(RID p_font_rid, const String &p_language) override; + virtual Vector<String> font_get_language_support_overrides(RID p_font_rid) override; + + virtual bool font_is_script_supported(RID p_font_rid, const String &p_script) const override; + virtual void font_set_script_support_override(RID p_font_rid, const String &p_script, bool p_supported) override; + virtual bool font_get_script_support_override(RID p_font_rid, const String &p_script) override; + virtual void font_remove_script_support_override(RID p_font_rid, const String &p_script) override; + virtual Vector<String> font_get_script_support_overrides(RID p_font_rid) override; + + virtual Dictionary font_supported_feature_list(RID p_font_rid) const override; + virtual Dictionary font_supported_variation_list(RID p_font_rid) const override; + + virtual real_t font_get_global_oversampling() const override; + virtual void font_set_global_oversampling(real_t p_oversampling) override; + + /* Shaped text buffer interface */ + + virtual RID create_shaped_text(Direction p_direction = DIRECTION_AUTO, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; + + virtual void shaped_text_clear(RID p_shaped) override; + + virtual void shaped_text_set_direction(RID p_shaped, Direction p_direction = DIRECTION_AUTO) override; + virtual Direction shaped_text_get_direction(RID p_shaped) const override; + + virtual void shaped_text_set_bidi_override(RID p_shaped, const Vector<Vector2i> &p_override) override; + + virtual void shaped_text_set_orientation(RID p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override; + virtual Orientation shaped_text_get_orientation(RID p_shaped) const override; + + virtual void shaped_text_set_preserve_invalid(RID p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_invalid(RID p_shaped) const override; + + virtual void shaped_text_set_preserve_control(RID p_shaped, bool p_enabled) override; + virtual bool shaped_text_get_preserve_control(RID p_shaped) const override; + + virtual bool shaped_text_add_string(RID p_shaped, const String &p_text, const Vector<RID> &p_fonts, int p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "") override; + virtual bool shaped_text_add_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER, int p_length = 1) override; + virtual bool shaped_text_resize_object(RID p_shaped, Variant p_key, const Size2 &p_size, InlineAlign p_inline_align = INLINE_ALIGN_CENTER) override; + + virtual RID shaped_text_substr(RID p_shaped, int p_start, int p_length) const override; + virtual RID shaped_text_get_parent(RID p_shaped) const override; + + virtual real_t shaped_text_fit_to_width(RID p_shaped, real_t p_width, uint8_t /*JustificationFlag*/ p_jst_flags = JUSTIFICATION_WORD_BOUND | JUSTIFICATION_KASHIDA) override; + virtual real_t shaped_text_tab_align(RID p_shaped, const Vector<real_t> &p_tab_stops) override; + + virtual bool shaped_text_shape(RID p_shaped) override; + virtual bool shaped_text_update_breaks(RID p_shaped) override; + virtual bool shaped_text_update_justification_ops(RID p_shaped) override; + + virtual void shaped_text_overrun_trim_to_width(RID p_shaped, real_t p_width, uint8_t p_trim_flags) override; + + virtual bool shaped_text_is_ready(RID p_shaped) const override; + + virtual Vector<Glyph> shaped_text_get_glyphs(RID p_shaped) const override; + + virtual Vector2i shaped_text_get_range(RID p_shaped) const override; + + virtual Vector<Glyph> shaped_text_sort_logical(RID p_shaped) override; + virtual Vector<Vector2i> shaped_text_get_line_breaks_adv(RID p_shaped, const Vector<real_t> &p_width, int p_start = 0, bool p_once = true, uint8_t /*TextBreakFlag*/ p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; + virtual Vector<Vector2i> shaped_text_get_line_breaks(RID p_shaped, real_t p_width, int p_start = 0, uint8_t p_break_flags = BREAK_MANDATORY | BREAK_WORD_BOUND) const override; + virtual Vector<Vector2i> shaped_text_get_word_breaks(RID p_shaped, int p_grapheme_flags = GRAPHEME_IS_SPACE | GRAPHEME_IS_PUNCTUATION) const override; + virtual Array shaped_text_get_objects(RID p_shaped) const override; + virtual Rect2 shaped_text_get_object_rect(RID p_shaped, Variant p_key) const override; + + virtual Size2 shaped_text_get_size(RID p_shaped) const override; + virtual real_t shaped_text_get_ascent(RID p_shaped) const override; + virtual real_t shaped_text_get_descent(RID p_shaped) const override; + virtual real_t shaped_text_get_width(RID p_shaped) const override; + virtual real_t shaped_text_get_underline_position(RID p_shaped) const override; + virtual real_t shaped_text_get_underline_thickness(RID p_shaped) const override; + + virtual String format_number(const String &p_string, const String &p_language = "") const override; + virtual String parse_number(const String &p_string, const String &p_language = "") const override; + virtual String percent_sign(const String &p_language = "") const override; + + static TextServer *create_func(Error &r_error, void *p_user_data); + + TextServerGDNative(); + ~TextServerGDNative(); +}; + +#endif // TEXT_SERVER_GDNATIVE_H diff --git a/modules/gdnative/videodecoder/register_types.cpp b/modules/gdnative/videodecoder/register_types.cpp index 4181d8813f..54a577a2b6 100644 --- a/modules/gdnative/videodecoder/register_types.cpp +++ b/modules/gdnative/videodecoder/register_types.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,16 +30,16 @@ #include "register_types.h" -#include "core/class_db.h" +#include "core/object/class_db.h" #include "video_stream_gdnative.h" static Ref<ResourceFormatLoaderVideoStreamGDNative> resource_loader_vsgdnative; void register_videodecoder_types() { - resource_loader_vsgdnative.instance(); + resource_loader_vsgdnative.instantiate(); ResourceLoader::add_resource_format_loader(resource_loader_vsgdnative, true); - ClassDB::register_class<VideoStreamGDNative>(); + GDREGISTER_CLASS(VideoStreamGDNative); } void unregister_videodecoder_types() { diff --git a/modules/gdnative/videodecoder/register_types.h b/modules/gdnative/videodecoder/register_types.h index b1a83d4071..809225c925 100644 --- a/modules/gdnative/videodecoder/register_types.h +++ b/modules/gdnative/videodecoder/register_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp index fe7c10cad9..4c9bfb395d 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp +++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -30,7 +30,7 @@ #include "video_stream_gdnative.h" -#include "core/project_settings.h" +#include "core/config/project_settings.h" #include "servers/audio_server.h" VideoDecoderServer *VideoDecoderServer::instance = nullptr; @@ -47,11 +47,7 @@ godot_int GDAPI godot_videodecoder_file_read(void *ptr, uint8_t *buf, int buf_si // if file exists if (file) { - long bytes_read = file->get_buffer(buf, buf_size); - // No bytes to read => EOF - if (bytes_read == 0) { - return 0; - } + int64_t bytes_read = file->get_buffer(buf, buf_size); return bytes_read; } return -1; @@ -62,41 +58,35 @@ int64_t GDAPI godot_videodecoder_file_seek(void *ptr, int64_t pos, int whence) { FileAccess *file = reinterpret_cast<FileAccess *>(ptr); if (file) { - size_t len = file->get_len(); + int64_t len = file->get_length(); switch (whence) { case SEEK_SET: { - // Just for explicitness - size_t new_pos = static_cast<size_t>(pos); - if (new_pos > len) { + if (pos > len) { return -1; } - file->seek(new_pos); - pos = static_cast<int64_t>(file->get_position()); - return pos; + file->seek(pos); + return file->get_position(); } break; case SEEK_CUR: { // Just in case it doesn't exist - if (pos < 0 && (size_t)-pos > file->get_position()) { + if (pos < 0 && -pos > (int64_t)file->get_position()) { return -1; } - pos = pos + static_cast<int>(file->get_position()); - file->seek(pos); - pos = static_cast<int64_t>(file->get_position()); - return pos; + file->seek(file->get_position() + pos); + return file->get_position(); } break; case SEEK_END: { // Just in case something goes wrong - if ((size_t)-pos > len) { + if (-pos > len) { return -1; } file->seek_end(pos); - pos = static_cast<int64_t>(file->get_position()); - return pos; + return file->get_position(); } break; default: { // Only 4 possible options, hence default = AVSEEK_SIZE // Asks to return the length of file - return static_cast<int64_t>(len); + return len; } break; } } @@ -132,7 +122,7 @@ bool VideoStreamPlaybackGDNative::open_file(const String &p_file) { samples_decoded = 0; Ref<Image> img; - img.instance(); + img.instantiate(); img->create((int)texture_size.width, false, (int)texture_size.height, Image::FORMAT_RGBA8); texture->create_from_image(img); @@ -195,7 +185,7 @@ void VideoStreamPlaybackGDNative::update_texture() { Ref<Image> img = memnew(Image(texture_size.width, texture_size.height, 0, Image::FORMAT_RGBA8, *pba)); - texture->update(img, true); + texture->update(img); } // ctor and dtor @@ -250,7 +240,7 @@ void VideoStreamPlaybackGDNative::play() { playing = true; - delay_compensation = ProjectSettings::get_singleton()->get("audio/video_delay_compensation_ms"); + delay_compensation = ProjectSettings::get_singleton()->get("audio/video/video_delay_compensation_ms"); delay_compensation /= 1000.0; } @@ -360,7 +350,7 @@ void VideoStreamGDNative::set_audio_track(int p_track) { /* --- NOTE ResourceFormatLoaderVideoStreamGDNative starts here. ----- */ -RES ResourceFormatLoaderVideoStreamGDNative::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, bool p_no_cache) { +RES ResourceFormatLoaderVideoStreamGDNative::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { FileAccess *f = FileAccess::open(p_path, FileAccess::READ); if (!f) { if (r_error) { diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h index 408d4a2454..c605dbb433 100644 --- a/modules/gdnative/videodecoder/video_stream_gdnative.h +++ b/modules/gdnative/videodecoder/video_stream_gdnative.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,7 +32,7 @@ #define VIDEO_STREAM_GDNATIVE_H #include "../gdnative.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "scene/resources/texture.h" #include "scene/resources/video_stream.h" @@ -118,7 +118,7 @@ class VideoStreamPlaybackGDNative : public VideoStreamPlayback { AudioMixCallback mix_callback = nullptr; int num_channels = -1; - float time = 0; + float time = 0.0; bool seek_backward = false; int mix_rate = 0; double delay_compensation = 0; @@ -196,7 +196,7 @@ public: class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, bool p_no_cache = false); + virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/modules/gdnative/xr/xr_interface_gdnative.cpp b/modules/gdnative/xr/xr_interface_gdnative.cpp deleted file mode 100644 index d03fc33935..0000000000 --- a/modules/gdnative/xr/xr_interface_gdnative.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/*************************************************************************/ -/* xr_interface_gdnative.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#include "xr_interface_gdnative.h" -#include "core/input/input.h" -#include "servers/rendering/rendering_server_globals.h" -#include "servers/xr/xr_positional_tracker.h" - -void XRInterfaceGDNative::_bind_methods() { - ADD_PROPERTY_DEFAULT("interface_is_initialized", false); - ADD_PROPERTY_DEFAULT("ar_is_anchor_detection_enabled", false); -} - -XRInterfaceGDNative::XRInterfaceGDNative() { - print_verbose("Construct gdnative interface\n"); - - // we won't have our data pointer until our library gets set - data = nullptr; - - interface = nullptr; -} - -XRInterfaceGDNative::~XRInterfaceGDNative() { - print_verbose("Destruct gdnative interface\n"); - - if (interface != nullptr && is_initialized()) { - uninitialize(); - }; - - // cleanup after ourselves - cleanup(); -} - -void XRInterfaceGDNative::cleanup() { - if (interface != nullptr) { - interface->destructor(data); - data = nullptr; - interface = nullptr; - } -} - -void XRInterfaceGDNative::set_interface(const godot_xr_interface_gdnative *p_interface) { - // this should only be called once, just being paranoid.. - if (interface) { - cleanup(); - } - - // bind to our interface - interface = p_interface; - - // Now we do our constructing... - data = interface->constructor((godot_object *)this); -} - -StringName XRInterfaceGDNative::get_name() const { - ERR_FAIL_COND_V(interface == nullptr, StringName()); - - godot_string result = interface->get_name(data); - - StringName name = *(String *)&result; - - godot_string_destroy(&result); - - return name; -} - -int XRInterfaceGDNative::get_capabilities() const { - int capabilities; - - ERR_FAIL_COND_V(interface == nullptr, 0); // 0 = None - - capabilities = interface->get_capabilities(data); - - return capabilities; -} - -bool XRInterfaceGDNative::get_anchor_detection_is_enabled() const { - ERR_FAIL_COND_V(interface == nullptr, false); - - return interface->get_anchor_detection_is_enabled(data); -} - -void XRInterfaceGDNative::set_anchor_detection_is_enabled(bool p_enable) { - ERR_FAIL_COND(interface == nullptr); - - interface->set_anchor_detection_is_enabled(data, p_enable); -} - -int XRInterfaceGDNative::get_camera_feed_id() { - ERR_FAIL_COND_V(interface == nullptr, 0); - - return (unsigned int)interface->get_camera_feed_id(data); -} - -bool XRInterfaceGDNative::is_stereo() { - bool stereo; - - ERR_FAIL_COND_V(interface == nullptr, false); - - stereo = interface->is_stereo(data); - - return stereo; -} - -bool XRInterfaceGDNative::is_initialized() const { - ERR_FAIL_COND_V(interface == nullptr, false); - - return interface->is_initialized(data); -} - -bool XRInterfaceGDNative::initialize() { - ERR_FAIL_COND_V(interface == nullptr, false); - - bool initialized = interface->initialize(data); - - if (initialized) { - // if we successfully initialize our interface and we don't have a primary interface yet, this becomes our primary interface - - XRServer *xr_server = XRServer::get_singleton(); - if ((xr_server != nullptr) && (xr_server->get_primary_interface() == nullptr)) { - xr_server->set_primary_interface(this); - }; - }; - - return initialized; -} - -void XRInterfaceGDNative::uninitialize() { - ERR_FAIL_COND(interface == nullptr); - - XRServer *xr_server = XRServer::get_singleton(); - if (xr_server != nullptr) { - // Whatever happens, make sure this is no longer our primary interface - xr_server->clear_primary_interface_if(this); - } - - interface->uninitialize(data); -} - -Size2 XRInterfaceGDNative::get_render_targetsize() { - ERR_FAIL_COND_V(interface == nullptr, Size2()); - - godot_vector2 result = interface->get_render_targetsize(data); - Vector2 *vec = (Vector2 *)&result; - - return *vec; -} - -Transform XRInterfaceGDNative::get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) { - Transform *ret; - - ERR_FAIL_COND_V(interface == nullptr, Transform()); - - godot_transform t = interface->get_transform_for_eye(data, (int)p_eye, (godot_transform *)&p_cam_transform); - - ret = (Transform *)&t; - - return *ret; -} - -CameraMatrix XRInterfaceGDNative::get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) { - CameraMatrix cm; - - ERR_FAIL_COND_V(interface == nullptr, CameraMatrix()); - - interface->fill_projection_for_eye(data, (godot_real *)cm.matrix, (godot_int)p_eye, p_aspect, p_z_near, p_z_far); - - return cm; -} - -unsigned int XRInterfaceGDNative::get_external_texture_for_eye(XRInterface::Eyes p_eye) { - ERR_FAIL_COND_V(interface == nullptr, 0); - - return (unsigned int)interface->get_external_texture_for_eye(data, (godot_int)p_eye); -} - -void XRInterfaceGDNative::commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) { - ERR_FAIL_COND(interface == nullptr); - - interface->commit_for_eye(data, (godot_int)p_eye, (godot_rid *)&p_render_target, (godot_rect2 *)&p_screen_rect); -} - -void XRInterfaceGDNative::process() { - ERR_FAIL_COND(interface == nullptr); - - interface->process(data); -} - -void XRInterfaceGDNative::notification(int p_what) { - ERR_FAIL_COND(interface == nullptr); - - interface->notification(data, p_what); -} - -///////////////////////////////////////////////////////////////////////////////////// -// some helper callbacks - -extern "C" { - -void GDAPI godot_xr_register_interface(const godot_xr_interface_gdnative *p_interface) { - // Must be on a version 4 plugin - ERR_FAIL_COND_MSG(p_interface->version.major < 4, "GDNative XR interfaces build for Godot 3.x are not supported."); - - Ref<XRInterfaceGDNative> new_interface; - new_interface.instance(); - new_interface->set_interface((const godot_xr_interface_gdnative *)p_interface); - XRServer::get_singleton()->add_interface(new_interface); -} - -godot_real GDAPI godot_xr_get_worldscale() { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL_V(xr_server, 1.0); - - return xr_server->get_world_scale(); -} - -godot_transform GDAPI godot_xr_get_reference_frame() { - godot_transform reference_frame; - Transform *reference_frame_ptr = (Transform *)&reference_frame; - - XRServer *xr_server = XRServer::get_singleton(); - if (xr_server != nullptr) { - *reference_frame_ptr = xr_server->get_reference_frame(); - } else { - godot_transform_new_identity(&reference_frame); - } - - return reference_frame; -} - -void GDAPI godot_xr_blit(godot_int p_eye, godot_rid *p_render_target, godot_rect2 *p_rect) { - // blits out our texture as is, handy for preview display of one of the eyes that is already rendered with lens distortion on an external HMD - XRInterface::Eyes eye = (XRInterface::Eyes)p_eye; -#if 0 - RID *render_target = (RID *)p_render_target; -#endif - Rect2 screen_rect = *(Rect2 *)p_rect; - - if (eye == XRInterface::EYE_LEFT) { - screen_rect.size.x /= 2.0; - } else if (p_eye == XRInterface::EYE_RIGHT) { - screen_rect.size.x /= 2.0; - screen_rect.position.x += screen_rect.size.x; - } -#ifndef _MSC_VER -#warning this needs to be redone -#endif -#if 0 - RSG::rasterizer->blit_render_target_to_screen(*render_target, screen_rect, 0); -#endif -} - -godot_int GDAPI godot_xr_get_texid(godot_rid *p_render_target) { - // In order to send off our textures to display on our hardware we need the opengl texture ID instead of the render target RID - // This is a handy function to expose that. -#if 0 - RID *render_target = (RID *)p_render_target; - - RID eye_texture = RSG::storage->render_target_get_texture(*render_target); -#endif - -#ifndef _MSC_VER -#warning need to obtain this ID again -#endif - uint32_t texid = 0; //RS::get_singleton()->texture_get_texid(eye_texture); - - return texid; -} - -godot_int GDAPI godot_xr_add_controller(char *p_device_name, godot_int p_hand, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL_V(xr_server, 0); - - Input *input = Input::get_singleton(); - ERR_FAIL_NULL_V(input, 0); - - XRPositionalTracker *new_tracker = memnew(XRPositionalTracker); - new_tracker->set_name(p_device_name); - new_tracker->set_type(XRServer::TRACKER_CONTROLLER); - if (p_hand == 1) { - new_tracker->set_hand(XRPositionalTracker::TRACKER_LEFT_HAND); - } else if (p_hand == 2) { - new_tracker->set_hand(XRPositionalTracker::TRACKER_RIGHT_HAND); - } - - // also register as joystick... - int joyid = input->get_unused_joy_id(); - if (joyid != -1) { - new_tracker->set_joy_id(joyid); - input->joy_connection_changed(joyid, true, p_device_name, ""); - } - - if (p_tracks_orientation) { - Basis orientation; - new_tracker->set_orientation(orientation); - } - if (p_tracks_position) { - Vector3 position; - new_tracker->set_position(position); - } - - // add our tracker to our server and remember its pointer - xr_server->add_tracker(new_tracker); - - // note, this ID is only unique within controllers! - return new_tracker->get_tracker_id(); -} - -void GDAPI godot_xr_remove_controller(godot_int p_controller_id) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL(xr_server); - - Input *input = Input::get_singleton(); - ERR_FAIL_NULL(input); - - XRPositionalTracker *remove_tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, p_controller_id); - if (remove_tracker != nullptr) { - // unset our joystick if applicable - int joyid = remove_tracker->get_joy_id(); - if (joyid != -1) { - input->joy_connection_changed(joyid, false, "", ""); - remove_tracker->set_joy_id(-1); - } - - // remove our tracker from our server - xr_server->remove_tracker(remove_tracker); - memdelete(remove_tracker); - } -} - -void GDAPI godot_xr_set_controller_transform(godot_int p_controller_id, godot_transform *p_transform, godot_bool p_tracks_orientation, godot_bool p_tracks_position) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL(xr_server); - - XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != nullptr) { - Transform *transform = (Transform *)p_transform; - if (p_tracks_orientation) { - tracker->set_orientation(transform->basis); - } - if (p_tracks_position) { - tracker->set_rw_position(transform->origin); - } - } -} - -void GDAPI godot_xr_set_controller_button(godot_int p_controller_id, godot_int p_button, godot_bool p_is_pressed) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL(xr_server); - - Input *input = Input::get_singleton(); - ERR_FAIL_NULL(input); - - XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != nullptr) { - int joyid = tracker->get_joy_id(); - if (joyid != -1) { - input->joy_button(joyid, p_button, p_is_pressed); - } - } -} - -void GDAPI godot_xr_set_controller_axis(godot_int p_controller_id, godot_int p_axis, godot_real p_value, godot_bool p_can_be_negative) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL(xr_server); - - Input *input = Input::get_singleton(); - ERR_FAIL_NULL(input); - - XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != nullptr) { - int joyid = tracker->get_joy_id(); - if (joyid != -1) { - Input::JoyAxis jx; - jx.min = p_can_be_negative ? -1 : 0; - jx.value = p_value; - input->joy_axis(joyid, p_axis, jx); - } - } -} - -godot_real GDAPI godot_xr_get_controller_rumble(godot_int p_controller_id) { - XRServer *xr_server = XRServer::get_singleton(); - ERR_FAIL_NULL_V(xr_server, 0.0); - - XRPositionalTracker *tracker = xr_server->find_by_type_and_id(XRServer::TRACKER_CONTROLLER, p_controller_id); - if (tracker != nullptr) { - return tracker->get_rumble(); - } - - return 0.0; -} -} diff --git a/modules/gdnative/xr/xr_interface_gdnative.h b/modules/gdnative/xr/xr_interface_gdnative.h deleted file mode 100644 index de96487397..0000000000 --- a/modules/gdnative/xr/xr_interface_gdnative.h +++ /dev/null @@ -1,91 +0,0 @@ -/*************************************************************************/ -/* xr_interface_gdnative.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef XR_INTERFACE_GDNATIVE_H -#define XR_INTERFACE_GDNATIVE_H - -#include "modules/gdnative/gdnative.h" -#include "servers/xr/xr_interface.h" - -/** - @authors Hinsbart & Karroffel & Mux213 - - This subclass of our AR/VR interface forms a bridge to GDNative. -*/ - -class XRInterfaceGDNative : public XRInterface { - GDCLASS(XRInterfaceGDNative, XRInterface); - - void cleanup(); - -protected: - const godot_xr_interface_gdnative *interface; - void *data; - - static void _bind_methods(); - -public: - /** general interface information **/ - XRInterfaceGDNative(); - ~XRInterfaceGDNative(); - - void set_interface(const godot_xr_interface_gdnative *p_interface); - - virtual StringName get_name() const override; - virtual int get_capabilities() const override; - - virtual bool is_initialized() const override; - virtual bool initialize() override; - virtual void uninitialize() override; - - /** specific to AR **/ - virtual bool get_anchor_detection_is_enabled() const override; - virtual void set_anchor_detection_is_enabled(bool p_enable) override; - virtual int get_camera_feed_id() override; - - /** rendering and internal **/ - virtual Size2 get_render_targetsize() override; - virtual bool is_stereo() override; - virtual Transform get_transform_for_eye(XRInterface::Eyes p_eye, const Transform &p_cam_transform) override; - - // we expose a Vector<float> version of this function to GDNative - Vector<float> _get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far); - - // and a CameraMatrix version to XRServer - virtual CameraMatrix get_projection_for_eye(XRInterface::Eyes p_eye, real_t p_aspect, real_t p_z_near, real_t p_z_far) override; - - virtual unsigned int get_external_texture_for_eye(XRInterface::Eyes p_eye) override; - virtual void commit_for_eye(XRInterface::Eyes p_eye, RID p_render_target, const Rect2 &p_screen_rect) override; - - virtual void process() override; - virtual void notification(int p_what) override; -}; - -#endif // XR_INTERFACE_GDNATIVE_H |