From 9b05f29894cfcc477c2963fda3618a87458bd890 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 9 Mar 2022 13:56:14 +0100 Subject: Remove unused GDNative code This has been superseded by GDExtension so this code is no longer useful nor usable. There's still some GDNative-related stuff in platform export code which needs to be adapted for GDExtension (e.g. to include GDExtension libraries in exports). --- modules/gdnative/SCsub | 30 - modules/gdnative/android/android_gdn.cpp | 86 - modules/gdnative/config.py | 20 - modules/gdnative/doc_classes/GDNative.xml | 33 - modules/gdnative/doc_classes/GDNativeLibrary.xml | 48 - modules/gdnative/doc_classes/NativeScript.xml | 55 - modules/gdnative/doc_classes/PluginScript.xml | 17 - .../gdnative/doc_classes/VideoStreamGDNative.xml | 27 - modules/gdnative/gdnative.cpp | 583 --- modules/gdnative/gdnative.h | 184 - modules/gdnative/gdnative/aabb.cpp | 52 - modules/gdnative/gdnative/array.cpp | 66 - modules/gdnative/gdnative/basis.cpp | 61 - modules/gdnative/gdnative/callable.cpp | 57 - modules/gdnative/gdnative/color.cpp | 61 - modules/gdnative/gdnative/dictionary.cpp | 67 - modules/gdnative/gdnative/gdnative.cpp | 193 - modules/gdnative/gdnative/node_path.cpp | 56 - modules/gdnative/gdnative/packed_arrays.cpp | 320 -- modules/gdnative/gdnative/plane.cpp | 52 - modules/gdnative/gdnative/quaternion.cpp | 61 - modules/gdnative/gdnative/rect2.cpp | 62 - modules/gdnative/gdnative/rid.cpp | 52 - modules/gdnative/gdnative/signal.cpp | 57 - modules/gdnative/gdnative/string.cpp | 171 - modules/gdnative/gdnative/string_name.cpp | 62 - modules/gdnative/gdnative/transform2d.cpp | 62 - modules/gdnative/gdnative/transform_3d.cpp | 51 - modules/gdnative/gdnative/variant.cpp | 1273 ----- modules/gdnative/gdnative/vector2.cpp | 82 - modules/gdnative/gdnative/vector3.cpp | 82 - modules/gdnative/gdnative_api.json | 5108 -------------------- modules/gdnative/gdnative_builders.py | 263 - .../gdnative/gdnative_library_editor_plugin.cpp | 420 -- modules/gdnative/gdnative_library_editor_plugin.h | 119 - .../gdnative/gdnative_library_singleton_editor.cpp | 213 - .../gdnative/gdnative_library_singleton_editor.h | 62 - modules/gdnative/icons/GDNativeLibrary.svg | 1 - modules/gdnative/icons/NativeScript.svg | 1 - modules/gdnative/include/android/godot_android.h | 56 - modules/gdnative/include/gdnative/aabb.h | 58 - modules/gdnative/include/gdnative/array.h | 62 - modules/gdnative/include/gdnative/basis.h | 60 - modules/gdnative/include/gdnative/callable.h | 60 - modules/gdnative/include/gdnative/color.h | 61 - modules/gdnative/include/gdnative/dictionary.h | 62 - modules/gdnative/include/gdnative/gdnative.h | 287 -- modules/gdnative/include/gdnative/math_defs.h | 66 - modules/gdnative/include/gdnative/node_path.h | 59 - modules/gdnative/include/gdnative/packed_arrays.h | 255 - modules/gdnative/include/gdnative/plane.h | 58 - modules/gdnative/include/gdnative/quaternion.h | 60 - modules/gdnative/include/gdnative/rect2.h | 69 - modules/gdnative/include/gdnative/rid.h | 58 - modules/gdnative/include/gdnative/signal.h | 60 - modules/gdnative/include/gdnative/string.h | 89 - modules/gdnative/include/gdnative/string_name.h | 62 - modules/gdnative/include/gdnative/transform2d.h | 60 - modules/gdnative/include/gdnative/transform_3d.h | 60 - modules/gdnative/include/gdnative/variant.h | 425 -- modules/gdnative/include/gdnative/variant_struct.h | 53 - modules/gdnative/include/gdnative/vector2.h | 73 - modules/gdnative/include/gdnative/vector3.h | 73 - .../include/nativescript/godot_nativescript.h | 233 - .../include/pluginscript/godot_pluginscript.h | 171 - .../include/videodecoder/godot_videodecoder.h | 75 - modules/gdnative/nativescript/SCsub | 9 - modules/gdnative/nativescript/api_generator.cpp | 948 ---- modules/gdnative/nativescript/api_generator.h | 40 - .../gdnative/nativescript/godot_nativescript.cpp | 344 -- modules/gdnative/nativescript/nativescript.cpp | 1777 ------- modules/gdnative/nativescript/nativescript.h | 393 -- modules/gdnative/nativescript/register_types.cpp | 71 - modules/gdnative/nativescript/register_types.h | 37 - modules/gdnative/pluginscript/SCsub | 6 - .../pluginscript/pluginscript_instance.cpp | 140 - .../gdnative/pluginscript/pluginscript_instance.h | 82 - .../pluginscript/pluginscript_language.cpp | 459 -- .../gdnative/pluginscript/pluginscript_language.h | 138 - .../gdnative/pluginscript/pluginscript_loader.cpp | 114 - .../gdnative/pluginscript/pluginscript_loader.h | 62 - .../gdnative/pluginscript/pluginscript_script.cpp | 510 -- .../gdnative/pluginscript/pluginscript_script.h | 146 - modules/gdnative/pluginscript/register_types.cpp | 121 - modules/gdnative/pluginscript/register_types.h | 37 - modules/gdnative/register_types.cpp | 360 -- modules/gdnative/register_types.h | 37 - modules/gdnative/tests/test_variant.h | 205 - modules/gdnative/videodecoder/SCsub | 9 - modules/gdnative/videodecoder/register_types.cpp | 48 - modules/gdnative/videodecoder/register_types.h | 37 - .../videodecoder/video_stream_gdnative.cpp | 389 -- .../gdnative/videodecoder/video_stream_gdnative.h | 205 - modules/theora/video_stream_theora.cpp | 2 +- 94 files changed, 1 insertion(+), 19760 deletions(-) delete mode 100644 modules/gdnative/SCsub delete mode 100644 modules/gdnative/android/android_gdn.cpp delete mode 100644 modules/gdnative/config.py delete mode 100644 modules/gdnative/doc_classes/GDNative.xml delete mode 100644 modules/gdnative/doc_classes/GDNativeLibrary.xml delete mode 100644 modules/gdnative/doc_classes/NativeScript.xml delete mode 100644 modules/gdnative/doc_classes/PluginScript.xml delete mode 100644 modules/gdnative/doc_classes/VideoStreamGDNative.xml delete mode 100644 modules/gdnative/gdnative.cpp delete mode 100644 modules/gdnative/gdnative.h delete mode 100644 modules/gdnative/gdnative/aabb.cpp delete mode 100644 modules/gdnative/gdnative/array.cpp delete mode 100644 modules/gdnative/gdnative/basis.cpp delete mode 100644 modules/gdnative/gdnative/callable.cpp delete mode 100644 modules/gdnative/gdnative/color.cpp delete mode 100644 modules/gdnative/gdnative/dictionary.cpp delete mode 100644 modules/gdnative/gdnative/gdnative.cpp delete mode 100644 modules/gdnative/gdnative/node_path.cpp delete mode 100644 modules/gdnative/gdnative/packed_arrays.cpp delete mode 100644 modules/gdnative/gdnative/plane.cpp delete mode 100644 modules/gdnative/gdnative/quaternion.cpp delete mode 100644 modules/gdnative/gdnative/rect2.cpp delete mode 100644 modules/gdnative/gdnative/rid.cpp delete mode 100644 modules/gdnative/gdnative/signal.cpp delete mode 100644 modules/gdnative/gdnative/string.cpp delete mode 100644 modules/gdnative/gdnative/string_name.cpp delete mode 100644 modules/gdnative/gdnative/transform2d.cpp delete mode 100644 modules/gdnative/gdnative/transform_3d.cpp delete mode 100644 modules/gdnative/gdnative/variant.cpp delete mode 100644 modules/gdnative/gdnative/vector2.cpp delete mode 100644 modules/gdnative/gdnative/vector3.cpp delete mode 100644 modules/gdnative/gdnative_api.json delete mode 100644 modules/gdnative/gdnative_builders.py delete mode 100644 modules/gdnative/gdnative_library_editor_plugin.cpp delete mode 100644 modules/gdnative/gdnative_library_editor_plugin.h delete mode 100644 modules/gdnative/gdnative_library_singleton_editor.cpp delete mode 100644 modules/gdnative/gdnative_library_singleton_editor.h delete mode 100644 modules/gdnative/icons/GDNativeLibrary.svg delete mode 100644 modules/gdnative/icons/NativeScript.svg delete mode 100644 modules/gdnative/include/android/godot_android.h delete mode 100644 modules/gdnative/include/gdnative/aabb.h delete mode 100644 modules/gdnative/include/gdnative/array.h delete mode 100644 modules/gdnative/include/gdnative/basis.h delete mode 100644 modules/gdnative/include/gdnative/callable.h delete mode 100644 modules/gdnative/include/gdnative/color.h delete mode 100644 modules/gdnative/include/gdnative/dictionary.h delete mode 100644 modules/gdnative/include/gdnative/gdnative.h delete mode 100644 modules/gdnative/include/gdnative/math_defs.h delete mode 100644 modules/gdnative/include/gdnative/node_path.h delete mode 100644 modules/gdnative/include/gdnative/packed_arrays.h delete mode 100644 modules/gdnative/include/gdnative/plane.h delete mode 100644 modules/gdnative/include/gdnative/quaternion.h delete mode 100644 modules/gdnative/include/gdnative/rect2.h delete mode 100644 modules/gdnative/include/gdnative/rid.h delete mode 100644 modules/gdnative/include/gdnative/signal.h delete mode 100644 modules/gdnative/include/gdnative/string.h delete mode 100644 modules/gdnative/include/gdnative/string_name.h delete mode 100644 modules/gdnative/include/gdnative/transform2d.h delete mode 100644 modules/gdnative/include/gdnative/transform_3d.h delete mode 100644 modules/gdnative/include/gdnative/variant.h delete mode 100644 modules/gdnative/include/gdnative/variant_struct.h delete mode 100644 modules/gdnative/include/gdnative/vector2.h delete mode 100644 modules/gdnative/include/gdnative/vector3.h delete mode 100644 modules/gdnative/include/nativescript/godot_nativescript.h delete mode 100644 modules/gdnative/include/pluginscript/godot_pluginscript.h delete mode 100644 modules/gdnative/include/videodecoder/godot_videodecoder.h delete mode 100644 modules/gdnative/nativescript/SCsub delete mode 100644 modules/gdnative/nativescript/api_generator.cpp delete mode 100644 modules/gdnative/nativescript/api_generator.h delete mode 100644 modules/gdnative/nativescript/godot_nativescript.cpp delete mode 100644 modules/gdnative/nativescript/nativescript.cpp delete mode 100644 modules/gdnative/nativescript/nativescript.h delete mode 100644 modules/gdnative/nativescript/register_types.cpp delete mode 100644 modules/gdnative/nativescript/register_types.h delete mode 100644 modules/gdnative/pluginscript/SCsub delete mode 100644 modules/gdnative/pluginscript/pluginscript_instance.cpp delete mode 100644 modules/gdnative/pluginscript/pluginscript_instance.h delete mode 100644 modules/gdnative/pluginscript/pluginscript_language.cpp delete mode 100644 modules/gdnative/pluginscript/pluginscript_language.h delete mode 100644 modules/gdnative/pluginscript/pluginscript_loader.cpp delete mode 100644 modules/gdnative/pluginscript/pluginscript_loader.h delete mode 100644 modules/gdnative/pluginscript/pluginscript_script.cpp delete mode 100644 modules/gdnative/pluginscript/pluginscript_script.h delete mode 100644 modules/gdnative/pluginscript/register_types.cpp delete mode 100644 modules/gdnative/pluginscript/register_types.h delete mode 100644 modules/gdnative/register_types.cpp delete mode 100644 modules/gdnative/register_types.h delete mode 100644 modules/gdnative/tests/test_variant.h delete mode 100644 modules/gdnative/videodecoder/SCsub delete mode 100644 modules/gdnative/videodecoder/register_types.cpp delete mode 100644 modules/gdnative/videodecoder/register_types.h delete mode 100644 modules/gdnative/videodecoder/video_stream_gdnative.cpp delete mode 100644 modules/gdnative/videodecoder/video_stream_gdnative.h (limited to 'modules') diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub deleted file mode 100644 index f7f21a433e..0000000000 --- a/modules/gdnative/SCsub +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python - -Import("env") -Import("env_modules") - -env_gdnative = env_modules.Clone() -env_gdnative.add_source_files(env.modules_sources, "gdnative.cpp") -env_gdnative.add_source_files(env.modules_sources, "register_types.cpp") -env_gdnative.add_source_files(env.modules_sources, "android/*.cpp") -env_gdnative.add_source_files(env.modules_sources, "gdnative/*.cpp") -env_gdnative.add_source_files(env.modules_sources, "nativescript/*.cpp") -env_gdnative.add_source_files(env.modules_sources, "gdnative_library_singleton_editor.cpp") -env_gdnative.add_source_files(env.modules_sources, "gdnative_library_editor_plugin.cpp") - -env_gdnative.Prepend(CPPPATH=["#modules/gdnative/include/"]) - -Export("env_gdnative") - -SConscript("pluginscript/SCsub") -SConscript("videodecoder/SCsub") - - -import gdnative_builders - -_, gensource = env_gdnative.CommandNoCache( - ["include/gdnative_api_struct.gen.h", "gdnative_api_struct.gen.cpp"], - "gdnative_api.json", - env.Run(gdnative_builders.build_gdnative_api_struct, "Generating GDNative API."), -) -env_gdnative.add_source_files(env.modules_sources, [gensource]) diff --git a/modules/gdnative/android/android_gdn.cpp b/modules/gdnative/android/android_gdn.cpp deleted file mode 100644 index 7411fc4031..0000000000 --- a/modules/gdnative/android/android_gdn.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************/ -/* android_gdn.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 "modules/gdnative/gdnative.h" - -// Code by Paritosh97 with minor tweaks by Mux213 -// These entry points are only for the android platform and are simple stubs in all others. - -#ifdef __ANDROID__ -#include "platform/android/java_godot_wrapper.h" -#include "platform/android/os_android.h" -#include "platform/android/thread_jandroid.h" -#else -#define JNIEnv void -#define jobject void * -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEnv *GDAPI godot_android_get_env() { -#ifdef __ANDROID__ - return get_jni_env(); -#else - return nullptr; -#endif -} - -jobject GDAPI godot_android_get_activity() { -#ifdef __ANDROID__ - OS_Android *os_android = (OS_Android *)OS::get_singleton(); - return os_android->get_godot_java()->get_activity(); -#else - return nullptr; -#endif -} - -jobject GDAPI godot_android_get_surface() { -#ifdef __ANDROID__ - OS_Android *os_android = (OS_Android *)OS::get_singleton(); - return os_android->get_godot_java()->get_surface(); -#else - return nullptr; -#endif -} - -bool GDAPI godot_android_is_activity_resumed() { -#ifdef __ANDROID__ - OS_Android *os_android = (OS_Android *)OS::get_singleton(); - return os_android->get_godot_java()->is_activity_resumed(); -#else - return false; -#endif -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/config.py b/modules/gdnative/config.py deleted file mode 100644 index 026a84a70f..0000000000 --- a/modules/gdnative/config.py +++ /dev/null @@ -1,20 +0,0 @@ -def can_build(env, platform): - return True - - -def configure(env): - pass - - -def get_doc_classes(): - return [ - "GDNative", - "GDNativeLibrary", - "NativeScript", - "PluginScript", - "VideoStreamGDNative", - ] - - -def get_doc_path(): - return "doc_classes" diff --git a/modules/gdnative/doc_classes/GDNative.xml b/modules/gdnative/doc_classes/GDNative.xml deleted file mode 100644 index 405365ad68..0000000000 --- a/modules/gdnative/doc_classes/GDNative.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/modules/gdnative/doc_classes/GDNativeLibrary.xml b/modules/gdnative/doc_classes/GDNativeLibrary.xml deleted file mode 100644 index 66811467fc..0000000000 --- a/modules/gdnative/doc_classes/GDNativeLibrary.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - An external library containing functions or script classes to use in Godot. - - - 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. - - - $DOCS_URL/tutorials/scripting/gdnative/gdnative_c_example.html - $DOCS_URL/tutorials/scripting/gdnative/gdnative_cpp_example.html - - - - - - Returns paths to all dependency libraries for the current platform and architecture. - - - - - - Returns the path to the dynamic library file for the current platform and architecture. - - - - - - This resource in INI-style [ConfigFile] format, as in [code].gdnlib[/code] files. - - - If [code]true[/code], Godot loads only one copy of the library and each script that references the library will share static data like static or global variables. - If [code]false[/code], Godot loads a separate copy of the library into memory for each script that references it. - - - If [code]true[/code], the editor will temporarily unload the library whenever the user switches away from the editor window, allowing the user to recompile the library without restarting Godot. - [b]Note:[/b] If the library defines tool scripts that run inside the editor, [code]reloadable[/code] must be [code]false[/code]. Otherwise, the editor will attempt to unload the tool scripts while they're in use and crash. - - - If [code]true[/code], Godot loads the library at startup rather than the first time a script uses the library, calling [code]{prefix}gdnative_singleton[/code] after initializing the library (where [code]{prefix}[/code] is the value of [member symbol_prefix]). The library remains loaded as long as Godot is running. - [b]Note:[/b] A singleton library cannot be [member reloadable]. - - - The prefix this library's entry point functions begin with. For example, a GDNativeLibrary would declare its [code]gdnative_init[/code] function as [code]godot_gdnative_init[/code] by default. - On platforms that require statically linking libraries (currently only iOS), each library must have a different [code]symbol_prefix[/code]. - - - diff --git a/modules/gdnative/doc_classes/NativeScript.xml b/modules/gdnative/doc_classes/NativeScript.xml deleted file mode 100644 index b752b66f7e..0000000000 --- a/modules/gdnative/doc_classes/NativeScript.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - Returns the documentation string that was previously set with [code]godot_nativescript_set_class_documentation[/code]. - - - - - - - Returns the documentation string that was previously set with [code]godot_nativescript_set_method_documentation[/code]. - - - - - - - Returns the documentation string that was previously set with [code]godot_nativescript_set_property_documentation[/code]. - - - - - - - Returns the documentation string that was previously set with [code]godot_nativescript_set_signal_documentation[/code]. - - - - - - Constructs a new object of the base type with a script of this type already attached. - [b]Note:[/b] 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 deleted file mode 100644 index 1fe6d95d3b..0000000000 --- a/modules/gdnative/doc_classes/PluginScript.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - Returns a new instance of the script. - - - - diff --git a/modules/gdnative/doc_classes/VideoStreamGDNative.xml b/modules/gdnative/doc_classes/VideoStreamGDNative.xml deleted file mode 100644 index 2b27556fab..0000000000 --- a/modules/gdnative/doc_classes/VideoStreamGDNative.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - [VideoStream] resource for for video formats implemented via GDNative. - - - [VideoStream] resource for for video formats implemented via GDNative. - It can be used via [url=https://github.com/KidRigger/godot-videodecoder]godot-videodecoder[/url] which uses the [url=https://ffmpeg.org]FFmpeg[/url] library. - - - - - - - - Returns the video file handled by this [VideoStreamGDNative]. - - - - - - - Sets the video file that this [VideoStreamGDNative] resource handles. The supported extensions depend on the GDNative plugins used to expose video formats. - - - - diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp deleted file mode 100644 index 3950ce1ade..0000000000 --- a/modules/gdnative/gdnative.cpp +++ /dev/null @@ -1,583 +0,0 @@ -/*************************************************************************/ -/* gdnative.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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.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/os.h" - -#include "scene/main/scene_tree.h" - -static const String init_symbol = "gdnative_init"; -static const String terminate_symbol = "gdnative_terminate"; -static const String default_symbol_prefix = "godot_"; -static const bool default_singleton = false; -static const bool default_load_once = true; -static const bool default_reloadable = true; - -// Defined in gdnative_api_struct.gen.cpp -extern const godot_gdnative_core_api_struct api_struct; - -Map>> GDNativeLibrary::loaded_libraries; - -GDNativeLibrary::GDNativeLibrary() { - config_file.instantiate(); - - symbol_prefix = default_symbol_prefix; - load_once = default_load_once; - singleton = default_singleton; - reloadable = default_reloadable; -} - -GDNativeLibrary::~GDNativeLibrary() { -} - -bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_property) { - String name = p_name; - - if (name.begins_with("entry/")) { - String key = name.substr(6, name.length() - 6); - - config_file->set_value("entry", key, p_property); - - set_config_file(config_file); - - return true; - } - - if (name.begins_with("dependency/")) { - String key = name.substr(11, name.length() - 11); - - config_file->set_value("dependencies", key, p_property); - - set_config_file(config_file); - - return true; - } - - return false; -} - -bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_property) const { - String name = p_name; - - if (name.begins_with("entry/")) { - String key = name.substr(6, name.length() - 6); - - r_property = config_file->get_value("entry", key); - - return true; - } - - if (name.begins_with("dependency/")) { - String key = name.substr(11, name.length() - 11); - - r_property = config_file->get_value("dependencies", key); - - return true; - } - - 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 *p_list) const { - // set entries - List entry_key_list; - - if (config_file->has_section("entry")) { - config_file->get_section_keys("entry", &entry_key_list); - } - - for (const String &key : entry_key_list) { - PropertyInfo prop; - - prop.type = Variant::STRING; - prop.name = "entry/" + key; - - p_list->push_back(prop); - } - - // set dependencies - List dependency_key_list; - - if (config_file->has_section("dependencies")) { - config_file->get_section_keys("dependencies", &dependency_key_list); - } - - for (const String &key : dependency_key_list) { - PropertyInfo prop; - - prop.type = Variant::STRING; - prop.name = "dependency/" + key; - - p_list->push_back(prop); - } -} - -void GDNativeLibrary::set_config_file(Ref 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)); - set_reloadable(p_config_file->get_value("general", "reloadable", default_reloadable)); - - String entry_lib_path; - { - List entry_keys; - - if (p_config_file->has_section("entry")) { - p_config_file->get_section_keys("entry", &entry_keys); - } - - for (const String &key : entry_keys) { - Vector tags = key.split("."); - - bool skip = false; - for (int i = 0; i < tags.size(); i++) { - bool has_feature = OS::get_singleton()->has_feature(tags[i]); - - if (!has_feature) { - skip = true; - break; - } - } - - if (skip) { - continue; - } - - entry_lib_path = p_config_file->get_value("entry", key); - break; - } - } - - Vector dependency_paths; - { - List dependency_keys; - - if (p_config_file->has_section("dependencies")) { - p_config_file->get_section_keys("dependencies", &dependency_keys); - } - - for (const String &key : dependency_keys) { - Vector tags = key.split("."); - - bool skip = false; - for (int i = 0; i < tags.size(); i++) { - bool has_feature = OS::get_singleton()->has_feature(tags[i]); - - if (!has_feature) { - skip = true; - break; - } - } - - if (skip) { - continue; - } - - dependency_paths = p_config_file->get_value("dependencies", key); - break; - } - } - - current_library_path = entry_lib_path; - current_dependencies = dependency_paths; -} - -void GDNativeLibrary::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_config_file"), &GDNativeLibrary::get_config_file); - ClassDB::bind_method(D_METHOD("set_config_file", "config_file"), &GDNativeLibrary::set_config_file); - - ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path); - ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies); - - ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once); - ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton); - ClassDB::bind_method(D_METHOD("get_symbol_prefix"), &GDNativeLibrary::get_symbol_prefix); - ClassDB::bind_method(D_METHOD("is_reloadable"), &GDNativeLibrary::is_reloadable); - - ClassDB::bind_method(D_METHOD("set_load_once", "load_once"), &GDNativeLibrary::set_load_once); - ClassDB::bind_method(D_METHOD("set_singleton", "singleton"), &GDNativeLibrary::set_singleton); - 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", 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"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "symbol_prefix"), "set_symbol_prefix", "get_symbol_prefix"); - ADD_PROPERTY(PropertyInfo(Variant::BOOL, "reloadable"), "set_reloadable", "is_reloadable"); -} - -GDNative::GDNative() { - native_handle = nullptr; - initialized = false; -} - -GDNative::~GDNative() { -} - -void GDNative::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNative::set_library); - ClassDB::bind_method(D_METHOD("get_library"), &GDNative::get_library); - - ClassDB::bind_method(D_METHOD("initialize"), &GDNative::initialize); - ClassDB::bind_method(D_METHOD("terminate"), &GDNative::terminate); - - ClassDB::bind_method(D_METHOD("call_native", "calling_type", "procedure_name", "arguments"), &GDNative::call_native); - - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); -} - -void GDNative::set_library(Ref p_library) { - ERR_FAIL_COND_MSG(library.is_valid(), "Tried to change library of GDNative when it is already set."); - library = p_library; -} - -Ref GDNative::get_library() const { - return library; -} - -extern "C" 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); -extern "C" void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what); - -bool GDNative::initialize() { - if (library.is_null()) { - ERR_PRINT("No library set, can't initialize GDNative object"); - return false; - } - - String lib_path = library->get_current_library_path(); - if (lib_path.is_empty()) { - ERR_PRINT("No library set for this platform"); - return false; - } -#ifdef IPHONE_ENABLED - // On iOS we use static linking by default. - String path = ""; - - // On iOS dylibs is not allowed, but can be replaced with .framework or .xcframework. - // If they are used, we can run dlopen on them. - // They should be located under Frameworks directory, so we need to replace library path. - if (!lib_path.ends_with(".a")) { - path = ProjectSettings::get_singleton()->globalize_path(lib_path); - - if (!FileAccess::exists(path)) { - String lib_name = lib_path.get_basename().get_file(); - String framework_path_format = "Frameworks/$name.framework/$name"; - - Dictionary format_dict; - format_dict["name"] = lib_name; - String framework_path = framework_path_format.format(format_dict, "$_"); - - path = OS::get_singleton()->get_executable_path().get_base_dir().plus_file(framework_path); - } - } -#elif defined(ANDROID_ENABLED) - // On Android dynamic libraries are located separately from resource assets, - // we should pass library name to dlopen(). The library name is flattened - // during export. - String path = lib_path.get_file(); -#elif defined(UWP_ENABLED) - // On UWP we use a relative path from the app - String path = lib_path.replace("res://", ""); -#elif defined(OSX_ENABLED) - // 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); - 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 - - if (library->should_load_once()) { - if (GDNativeLibrary::loaded_libraries.has(lib_path)) { - // already loaded. Don't load again. - // copy some of the stuff instead - this->native_handle = GDNativeLibrary::loaded_libraries[lib_path][0]->native_handle; - initialized = true; - return true; - } - } - - Error err = OS::get_singleton()->open_dynamic_library(path, native_handle, true); - if (err != OK) { - return false; - } - - void *library_init; - - // we cheat here a little bit. you saw nothing - initialized = true; - - err = get_symbol(library->get_symbol_prefix() + init_symbol, library_init, false); - - initialized = false; - - if (err || !library_init) { - OS::get_singleton()->close_dynamic_library(native_handle); - native_handle = nullptr; - ERR_PRINT("Failed to obtain " + library->get_symbol_prefix() + "gdnative_init symbol"); - return false; - } - - godot_gdnative_init_fn library_init_fpointer; - library_init_fpointer = (godot_gdnative_init_fn)library_init; - - static uint64_t core_api_hash = 0; - static uint64_t editor_api_hash = 0; - static uint64_t no_api_hash = 0; - - if (!(core_api_hash || editor_api_hash || no_api_hash)) { - core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE); - editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); - no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE); - } - - godot_gdnative_init_options options; - - options.api_struct = &api_struct; - options.in_editor = Engine::get_singleton()->is_editor_hint(); - options.core_api_hash = core_api_hash; - options.editor_api_hash = editor_api_hash; - options.no_api_hash = no_api_hash; - options.report_version_mismatch = &_gdnative_report_version_mismatch; - options.report_loading_error = &_gdnative_report_loading_error; - options.gd_native_library = (godot_object *)(get_library().ptr()); - options.active_library_path = (godot_string *)&path; - - library_init_fpointer(&options); - - initialized = true; - - if (library->should_load_once() && !GDNativeLibrary::loaded_libraries.has(lib_path)) { - Vector> gdnatives; - gdnatives.resize(1); - gdnatives.write[0] = Ref(this); - GDNativeLibrary::loaded_libraries.insert(lib_path, gdnatives); - } - - return true; -} - -bool GDNative::terminate() { - if (!initialized) { - ERR_PRINT("No valid library handle, can't terminate GDNative object"); - return false; - } - - if (library->should_load_once()) { - Vector> *gdnatives = &GDNativeLibrary::loaded_libraries[library->get_current_library_path()]; - if (gdnatives->size() > 1) { - // there are other GDNative's still using this library, so we actually don't terminate - gdnatives->erase(Ref(this)); - initialized = false; - return true; - } else if (gdnatives->size() == 1) { - // we're the last one, terminate! - gdnatives->clear(); - // whew this looks scary, but all it does is remove the entry completely - GDNativeLibrary::loaded_libraries.erase(GDNativeLibrary::loaded_libraries.find(library->get_current_library_path())); - } - } - - void *library_terminate; - Error error = get_symbol(library->get_symbol_prefix() + terminate_symbol, library_terminate); - if (error || !library_terminate) { - OS::get_singleton()->close_dynamic_library(native_handle); - native_handle = nullptr; - initialized = false; - return true; - } - - godot_gdnative_terminate_fn library_terminate_pointer; - library_terminate_pointer = (godot_gdnative_terminate_fn)library_terminate; - - godot_gdnative_terminate_options options; - options.in_editor = Engine::get_singleton()->is_editor_hint(); - - library_terminate_pointer(&options); - - initialized = false; - - // GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); - - OS::get_singleton()->close_dynamic_library(native_handle); - native_handle = nullptr; - - return true; -} - -bool GDNative::is_initialized() const { - return initialized; -} - -void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, native_call_cb p_callback) { - native_calls.insert(p_call_type, p_callback); -} - -Vector GDNativeCallRegistry::get_native_call_types() { - Vector call_types; - call_types.resize(native_calls.size()); - - size_t idx = 0; - for (Map::Element *E = native_calls.front(); E; E = E->next(), idx++) { - call_types.write[idx] = E->key(); - } - - return call_types; -} - -Variant GDNative::call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments) { - Map::Element *E = GDNativeCallRegistry::singleton->native_calls.find(p_native_call_type); - if (!E) { - ERR_PRINT((String("No handler for native call type \"" + p_native_call_type) + "\" found").utf8().get_data()); - return Variant(); - } - - void *procedure_handle; - - Error err = OS::get_singleton()->get_dynamic_library_symbol_handle( - native_handle, - p_procedure_name, - procedure_handle); - - if (err != OK || procedure_handle == nullptr) { - return Variant(); - } - - godot_variant result = E->get()(procedure_handle, (godot_array *)&p_arguments); - - Variant res = *(Variant *)&result; - godot_variant_destroy(&result); - return res; -} - -Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional) const { - if (!initialized) { - ERR_PRINT("No valid library handle, can't get symbol from GDNative object"); - return ERR_CANT_OPEN; - } - - Error result = OS::get_singleton()->get_dynamic_library_symbol_handle( - native_handle, - p_procedure_name, - r_handle, - p_optional); - - 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, CacheMode p_cache_mode) { - Ref lib; - lib.instantiate(); - - Ref config = lib->get_config_file(); - - Error err = config->load(p_path); - - if (r_error) { - *r_error = err; - } - - lib->set_config_file(config); - - return lib; -} - -void GDNativeLibraryResourceLoader::get_recognized_extensions(List *p_extensions) const { - p_extensions->push_back("gdnlib"); -} - -bool GDNativeLibraryResourceLoader::handles_type(const String &p_type) const { - return p_type == "GDNativeLibrary"; -} - -String GDNativeLibraryResourceLoader::get_resource_type(const String &p_path) const { - String el = p_path.get_extension().to_lower(); - if (el == "gdnlib") { - return "GDNativeLibrary"; - } - return ""; -} - -Error GDNativeLibraryResourceSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { - Ref lib = p_resource; - - if (lib.is_null()) { - return ERR_INVALID_DATA; - } - - Ref config = lib->get_config_file(); - - config->set_value("general", "singleton", lib->is_singleton()); - config->set_value("general", "load_once", lib->should_load_once()); - config->set_value("general", "symbol_prefix", lib->get_symbol_prefix()); - config->set_value("general", "reloadable", lib->is_reloadable()); - - return config->save(p_path); -} - -bool GDNativeLibraryResourceSaver::recognize(const RES &p_resource) const { - return Object::cast_to(*p_resource) != nullptr; -} - -void GDNativeLibraryResourceSaver::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { - if (Object::cast_to(*p_resource) != nullptr) { - p_extensions->push_back("gdnlib"); - } -} diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h deleted file mode 100644 index 8facd43743..0000000000 --- a/modules/gdnative/gdnative.h +++ /dev/null @@ -1,184 +0,0 @@ -/*************************************************************************/ -/* gdnative.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 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 "gdnative/gdnative.h" -#include "gdnative_api_struct.gen.h" - -#include "core/io/config_file.h" - -class GDNativeLibraryResourceLoader; -class GDNative; - -class GDNativeLibrary : public Resource { - GDCLASS(GDNativeLibrary, Resource); - - static Map>> loaded_libraries; - - friend class GDNativeLibraryResourceLoader; - friend class GDNative; - - Ref config_file; - - String current_library_path; - Vector current_dependencies; - - bool singleton; - bool load_once; - String symbol_prefix; - bool reloadable; - -public: - virtual void reset_state() override; - - GDNativeLibrary(); - ~GDNativeLibrary(); - - virtual bool _set(const StringName &p_name, const Variant &p_property); - virtual bool _get(const StringName &p_name, Variant &r_property) const; - virtual void _get_property_list(List *p_list) const; - - _FORCE_INLINE_ Ref get_config_file() { return config_file; } - - void set_config_file(Ref p_config_file); - - // things that change per-platform - // so there are no setters for this - _FORCE_INLINE_ String get_current_library_path() const { - return current_library_path; - } - _FORCE_INLINE_ Vector get_current_dependencies() const { - return current_dependencies; - } - - // things that are a property of the library itself, not platform specific - _FORCE_INLINE_ bool should_load_once() const { - return load_once; - } - _FORCE_INLINE_ bool is_singleton() const { - return singleton; - } - _FORCE_INLINE_ String get_symbol_prefix() const { - return symbol_prefix; - } - - _FORCE_INLINE_ bool is_reloadable() const { - return reloadable; - } - - _FORCE_INLINE_ void set_load_once(bool p_load_once) { - config_file->set_value("general", "load_once", p_load_once); - load_once = p_load_once; - } - _FORCE_INLINE_ void set_singleton(bool p_singleton) { - config_file->set_value("general", "singleton", p_singleton); - singleton = p_singleton; - } - _FORCE_INLINE_ void set_symbol_prefix(String p_symbol_prefix) { - config_file->set_value("general", "symbol_prefix", p_symbol_prefix); - symbol_prefix = p_symbol_prefix; - } - - _FORCE_INLINE_ void set_reloadable(bool p_reloadable) { - config_file->set_value("general", "reloadable", p_reloadable); - reloadable = p_reloadable; - } - - static void _bind_methods(); -}; - -struct GDNativeCallRegistry { - static GDNativeCallRegistry *singleton; - - inline static GDNativeCallRegistry *get_singleton() { - return singleton; - } - - inline GDNativeCallRegistry() : - native_calls() {} - - Map native_calls; - - void register_native_call_type(StringName p_call_type, native_call_cb p_callback); - - Vector get_native_call_types(); -}; - -class GDNative : public RefCounted { - GDCLASS(GDNative, RefCounted); - - Ref library; - - void *native_handle; - - bool initialized; - -public: - GDNative(); - ~GDNative(); - - static void _bind_methods(); - - void set_library(Ref p_library); - Ref get_library() const; - - bool is_initialized() const; - - bool initialize(); - bool terminate(); - - Variant call_native(StringName p_native_call_type, StringName p_procedure_name, Array p_arguments = Array()); - - Error get_symbol(StringName p_procedure_name, void *&r_handle, bool p_optional = true) const; -}; - -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, CacheMode p_cache_mode = CACHE_MODE_REUSE); - virtual void get_recognized_extensions(List *p_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; -}; - -class GDNativeLibraryResourceSaver : public ResourceFormatSaver { -public: - virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags); - virtual bool recognize(const RES &p_resource) const; - virtual void get_recognized_extensions(const RES &p_resource, List *p_extensions) const; -}; - -#endif // GDNATIVE_H diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp deleted file mode 100644 index b8909433cc..0000000000 --- a/modules/gdnative/gdnative/aabb.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************/ -/* aabb.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/aabb.h" - -#include "core/math/aabb.h" -#include "core/os/memory.h" - -static_assert(sizeof(godot_aabb) == sizeof(AABB), "AABB size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_aabb_new(godot_aabb *p_self) { - memnew_placement(p_self, AABB); -} - -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 -} -#endif diff --git a/modules/gdnative/gdnative/array.cpp b/modules/gdnative/gdnative/array.cpp deleted file mode 100644 index 31063e43c1..0000000000 --- a/modules/gdnative/gdnative/array.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************/ -/* array.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/array.h" - -#include "core/os/memory.h" -#include "core/variant/array.h" - -static_assert(sizeof(godot_array) == sizeof(Array), "Array size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -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) { - memnew_placement(r_dest, Array(*(Array *)p_src)); -} - -void GDAPI godot_array_destroy(godot_array *p_self) { - ((Array *)p_self)->~Array(); -} - -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); -} - -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; - return (const godot_variant *)&self->operator[](p_index); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/basis.cpp b/modules/gdnative/gdnative/basis.cpp deleted file mode 100644 index af7f9a2399..0000000000 --- a/modules/gdnative/gdnative/basis.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************/ -/* basis.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/basis.h" - -#include "core/math/basis.h" - -static_assert(sizeof(godot_basis) == sizeof(Basis), "Basis size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_basis_new(godot_basis *p_self) { - memnew_placement(p_self, Basis); -} - -void GDAPI godot_basis_new_copy(godot_basis *r_dest, const godot_basis *p_src) { - memnew_placement(r_dest, Basis(*(Basis *)p_src)); -} - -godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index) { - Basis *self = (Basis *)p_self; - return (godot_vector3 *)&self->operator[](p_index); -} - -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; - return (const godot_vector3 *)&self->operator[](p_index); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/callable.cpp b/modules/gdnative/gdnative/callable.cpp deleted file mode 100644 index 7ae1038a13..0000000000 --- a/modules/gdnative/gdnative/callable.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************/ -/* callable.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/callable.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 - -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) { - memnew_placement(r_dest, Callable(*(Callable *)p_src)); -} - -void GDAPI godot_callable_destroy(godot_callable *p_self) { - Callable *self = (Callable *)p_self; - self->~Callable(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/color.cpp b/modules/gdnative/gdnative/color.cpp deleted file mode 100644 index 8f13610b2c..0000000000 --- a/modules/gdnative/gdnative/color.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************/ -/* color.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/color.h" - -#include "core/math/color.h" - -static_assert(sizeof(godot_color) == sizeof(Color), "Color size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_color_new(godot_color *p_self) { - memnew_placement(p_self, Color); -} - -void GDAPI godot_color_new_copy(godot_color *r_dest, const godot_color *p_src) { - memnew_placement(r_dest, Color(*(Color *)p_src)); -} - -float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index) { - Color *self = (Color *)p_self; - return (float *)&self->operator[](p_index); -} - -const float GDAPI *godot_color_operator_index_const(const godot_color *p_self, godot_int p_index) { - const Color *self = (const Color *)p_self; - return (const float *)&self->operator[](p_index); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/dictionary.cpp b/modules/gdnative/gdnative/dictionary.cpp deleted file mode 100644 index dea01dad43..0000000000 --- a/modules/gdnative/gdnative/dictionary.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/*************************************************************************/ -/* dictionary.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/dictionary.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 - -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) { - memnew_placement(r_dest, Dictionary(*(Dictionary *)p_src)); -} - -void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) { - Dictionary *self = (Dictionary *)p_self; - self->~Dictionary(); -} - -godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) { - Dictionary *self = (Dictionary *)p_self; - 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; - return (const godot_variant *)&self->operator[](*((const Variant *)p_key)); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp deleted file mode 100644 index 8ba41b3224..0000000000 --- a/modules/gdnative/gdnative/gdnative.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/*************************************************************************/ -/* gdnative.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/gdnative.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/variant.h" - -#include "modules/gdnative/gdnative.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_object_destroy(godot_object *p_o) { - memdelete((Object *)p_o); -} - -// Singleton API - -godot_object GDAPI *godot_global_get_singleton(char *p_name) { - return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name)); -} // result shouldn't be freed - -// MethodBind API - -godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) { - MethodBind *mb = ClassDB::get_method(StringName(p_classname), StringName(p_methodname)); - // MethodBind *mb = ClassDB::get_method("Node", "get_name"); - return (godot_method_bind *)mb; -} - -void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret) { - MethodBind *mb = (MethodBind *)p_method_bind; - Object *o = (Object *)p_instance; - mb->ptrcall(o, p_args, p_ret); -} - -godot_variant GDAPI godot_method_bind_call(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) { - MethodBind *mb = (MethodBind *)p_method_bind; - Object *o = (Object *)p_instance; - const Variant **args = (const Variant **)p_args; - - godot_variant ret; - godot_variant_new_nil(&ret); - - Variant *ret_val = (Variant *)&ret; - - Callable::CallError r_error; - *ret_val = mb->call(o, args, p_arg_count, r_error); - - if (p_call_error) { - p_call_error->error = (godot_variant_call_error_error)r_error.error; - p_call_error->argument = r_error.argument; - p_call_error->expected = (godot_variant_type)r_error.expected; - } - - return ret; -} - -godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) { - ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname)); - if (class_info) { - return (godot_class_constructor)class_info->creation_func; - } - return nullptr; -} - -godot_dictionary GDAPI godot_get_global_constants() { - godot_dictionary constants; - memnew_placement(&constants, Dictionary); - Dictionary *p_constants = (Dictionary *)&constants; - const int constants_count = CoreConstants::get_global_constant_count(); - for (int i = 0; i < constants_count; ++i) { - const char *name = CoreConstants::get_global_constant_name(i); - int value = CoreConstants::get_global_constant_value(i); - (*p_constants)[name] = value; - } - return constants; -} - -// System functions -void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback) { - GDNativeCallRegistry::get_singleton()->register_native_call_type(StringName(p_call_type), p_callback); -} - -void GDAPI *godot_alloc(int p_bytes) { - return memalloc(p_bytes); -} - -void GDAPI *godot_realloc(void *p_ptr, int p_bytes) { - return memrealloc(p_ptr, p_bytes); -} - -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, false, 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, false, ERR_HANDLER_WARNING); -} -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, false, 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) { - String message = "Error loading GDNative file "; - GDNativeLibrary *library = (GDNativeLibrary *)p_library; - - message += library->get_current_library_path() + ": Extension \"" + p_ext + "\" can't be loaded.\n"; - - Dictionary versions; - versions["have_major"] = p_have.major; - versions["have_minor"] = p_have.minor; - versions["want_major"] = p_want.major; - versions["want_minor"] = p_want.minor; - - message += String("Got version {have_major}.{have_minor} but needs {want_major}.{want_minor}!").format(versions); - - _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr()); -} - -void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what) { - String message = "Error loading GDNative file "; - GDNativeLibrary *library = (GDNativeLibrary *)p_library; - - message += library->get_current_library_path() + ": " + p_what; - - _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr()); -} - -godot_object GDAPI *godot_instance_from_id(uint64_t p_instance_id) { - return (godot_object *)ObjectDB::get_instance(ObjectID(p_instance_id)); -} - -void *godot_get_class_tag(const godot_string_name *p_class) { - StringName class_name = *(StringName *)p_class; - ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(class_name); - return class_info ? class_info->class_ptr : nullptr; -} - -godot_object *godot_object_cast_to(const godot_object *p_object, void *p_class_tag) { - if (!p_object) { - return nullptr; - } - Object *o = (Object *)p_object; - - return o->is_class_ptr(p_class_tag) ? (godot_object *)o : nullptr; -} - -uint64_t GDAPI godot_object_get_instance_id(const godot_object *p_object) { - const Object *o = (const Object *)p_object; - return (uint64_t)o->get_instance_id(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/node_path.cpp b/modules/gdnative/gdnative/node_path.cpp deleted file mode 100644 index 3db705f550..0000000000 --- a/modules/gdnative/gdnative/node_path.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************/ -/* node_path.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/node_path.h" - -#include "core/string/node_path.h" - -static_assert(sizeof(godot_node_path) == sizeof(NodePath), "NodePath size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -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) { - memnew_placement(r_dest, NodePath(*(NodePath *)p_src)); -} - -void GDAPI godot_node_path_destroy(godot_node_path *p_self) { - NodePath *self = (NodePath *)p_self; - self->~NodePath(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/packed_arrays.cpp b/modules/gdnative/gdnative/packed_arrays.cpp deleted file mode 100644 index 0c49694e0b..0000000000 --- a/modules/gdnative/gdnative/packed_arrays.cpp +++ /dev/null @@ -1,320 +0,0 @@ -/*************************************************************************/ -/* packed_arrays.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/packed_arrays.h" - -#include "core/variant/variant.h" - -#include "core/math/vector2i.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), "Vector size mismatch"); -static_assert(sizeof(godot_packed_vector3_array) == sizeof(PackedVector3Array), "PackedVector3Array size mismatch"); -static_assert(sizeof(godot_packed_vector3i_array) == sizeof(Vector), "Vector size mismatch"); -static_assert(sizeof(godot_packed_color_array) == sizeof(PackedColorArray), "PackedColorArray size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -// byte - -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) { - memnew_placement(r_dest, PackedByteArray(*(PackedByteArray *)p_src)); -} - -void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) { - ((PackedByteArray *)p_self)->~PackedByteArray(); -} - -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); -} - -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 *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) { - memnew_placement(r_dest, PackedInt32Array(*(PackedInt32Array *)p_src)); -} - -void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self) { - ((PackedInt32Array *)p_self)->~PackedInt32Array(); -} - -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); -} - -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 *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) { - memnew_placement(r_dest, PackedInt64Array(*(PackedInt64Array *)p_src)); -} - -void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self) { - ((PackedInt64Array *)p_self)->~PackedInt64Array(); -} - -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); -} - -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 *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) { - memnew_placement(r_dest, PackedFloat32Array(*(PackedFloat32Array *)p_src)); -} - -void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self) { - ((PackedFloat32Array *)p_self)->~PackedFloat32Array(); -} - -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); -} - -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 *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) { - memnew_placement(r_dest, PackedFloat64Array(*(PackedFloat64Array *)p_src)); -} - -void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self) { - ((PackedFloat64Array *)p_self)->~PackedFloat64Array(); -} - -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); -} - -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 *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) { - memnew_placement(r_dest, PackedStringArray(*(PackedStringArray *)p_src)); -} - -void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self) { - ((PackedStringArray *)p_self)->~PackedStringArray(); -} - -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); -} - -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 *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) { - memnew_placement(r_dest, PackedVector2Array(*(PackedVector2Array *)p_src)); -} - -void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self) { - ((PackedVector2Array *)p_self)->~PackedVector2Array(); -} - -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); -} - -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); -} - -// vector2i - -void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self) { - memnew_placement(p_self, Vector); -} - -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(*(Vector *)p_src)); -} - -void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_self) { - ((Vector *)p_self)->~Vector(); -} - -godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index(godot_packed_vector2i_array *p_self, godot_int p_index) { - Vector *self = (Vector *)p_self; - return (godot_vector2i *)&self->operator[](p_index); -} - -const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(const godot_packed_vector2i_array *p_self, godot_int p_index) { - const Vector *self = (const Vector *)p_self; - return (const godot_vector2i *)&self->operator[](p_index); -} - -// 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) { - memnew_placement(r_dest, PackedVector3Array(*(PackedVector3Array *)p_src)); -} - -void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self) { - ((PackedVector3Array *)p_self)->~PackedVector3Array(); -} - -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); -} - -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); -} - -// vector3i - -void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self) { - memnew_placement(p_self, Vector); -} - -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(*(Vector *)p_src)); -} - -void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_self) { - ((Vector *)p_self)->~Vector(); -} - -godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index(godot_packed_vector3i_array *p_self, godot_int p_index) { - Vector *self = (Vector *)p_self; - return (godot_vector3i *)&self->operator[](p_index); -} - -const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(const godot_packed_vector3i_array *p_self, godot_int p_index) { - const Vector *self = (const Vector *)p_self; - return (const godot_vector3i *)&self->operator[](p_index); -} - -// 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) { - memnew_placement(r_dest, PackedColorArray(*(PackedColorArray *)p_src)); -} - -void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self) { - ((PackedColorArray *)p_self)->~PackedColorArray(); -} - -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); -} - -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 -} -#endif diff --git a/modules/gdnative/gdnative/plane.cpp b/modules/gdnative/gdnative/plane.cpp deleted file mode 100644 index 41fa0da5db..0000000000 --- a/modules/gdnative/gdnative/plane.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************/ -/* plane.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/plane.h" - -#include "core/math/plane.h" -#include "core/os/memory.h" - -static_assert(sizeof(godot_plane) == sizeof(Plane), "Plane size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_plane_new(godot_plane *p_self) { - memnew_placement(p_self, Plane); -} - -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 -} -#endif diff --git a/modules/gdnative/gdnative/quaternion.cpp b/modules/gdnative/gdnative/quaternion.cpp deleted file mode 100644 index b91e47e77e..0000000000 --- a/modules/gdnative/gdnative/quaternion.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************/ -/* quaternion.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 deleted file mode 100644 index 7e0ce76c26..0000000000 --- a/modules/gdnative/gdnative/rect2.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* rect2.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/rect2.h" - -#include "core/math/rect2.h" -#include "core/math/rect2i.h" -#include "core/os/memory.h" - -static_assert(sizeof(godot_rect2) == sizeof(Rect2), "Rect2 size mismatch"); -static_assert(sizeof(godot_rect2i) == sizeof(Rect2i), "Rect2i size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_rect2_new(godot_rect2 *p_self) { - memnew_placement(p_self, Rect2); -} - -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_new(godot_rect2i *p_self) { - memnew_placement(p_self, Rect2i); -} - -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 -} -#endif diff --git a/modules/gdnative/gdnative/rid.cpp b/modules/gdnative/gdnative/rid.cpp deleted file mode 100644 index b40fa7c2c6..0000000000 --- a/modules/gdnative/gdnative/rid.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/*************************************************************************/ -/* rid.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/rid.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 - -void GDAPI godot_rid_new(godot_rid *p_self) { - memnew_placement(p_self, RID); -} - -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 -} -#endif diff --git a/modules/gdnative/gdnative/signal.cpp b/modules/gdnative/gdnative/signal.cpp deleted file mode 100644 index 8293aed439..0000000000 --- a/modules/gdnative/gdnative/signal.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/*************************************************************************/ -/* signal.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 deleted file mode 100644 index 7a5d8c6703..0000000000 --- a/modules/gdnative/gdnative/string.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/*************************************************************************/ -/* string.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/string.h" - -#include "core/string/ustring.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 - -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) { - memnew_placement(r_dest, String(*(String *)p_src)); -} - -void GDAPI godot_string_new_with_latin1_chars(godot_string *r_dest, const char *p_contents) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - *dest = String(p_contents); -} - -void GDAPI godot_string_new_with_utf8_chars(godot_string *r_dest, const char *p_contents) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - dest->parse_utf8(p_contents); -} - -void GDAPI godot_string_new_with_utf16_chars(godot_string *r_dest, const char16_t *p_contents) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - dest->parse_utf16(p_contents); -} - -void GDAPI godot_string_new_with_utf32_chars(godot_string *r_dest, const char32_t *p_contents) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - *dest = String((const char32_t *)p_contents); -} - -void GDAPI godot_string_new_with_wide_chars(godot_string *r_dest, const wchar_t *p_contents) { - String *dest = (String *)r_dest; - if (sizeof(wchar_t) == 2) { - // wchar_t is 16 bit, parse. - memnew_placement(dest, String); - dest->parse_utf16((const char16_t *)p_contents); - } else { - // wchar_t is 32 bit, copy. - memnew_placement(dest, String); - *dest = String((const char32_t *)p_contents); - } -} - -void GDAPI godot_string_new_with_latin1_chars_and_len(godot_string *r_dest, const char *p_contents, const int p_size) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - *dest = String(p_contents, p_size); -} - -void GDAPI godot_string_new_with_utf8_chars_and_len(godot_string *r_dest, const char *p_contents, const int p_size) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - dest->parse_utf8(p_contents, p_size); -} - -void GDAPI godot_string_new_with_utf16_chars_and_len(godot_string *r_dest, const char16_t *p_contents, const int p_size) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - dest->parse_utf16(p_contents, p_size); -} - -void GDAPI godot_string_new_with_utf32_chars_and_len(godot_string *r_dest, const char32_t *p_contents, const int p_size) { - String *dest = (String *)r_dest; - memnew_placement(dest, String); - *dest = String((const char32_t *)p_contents, 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) { - String *dest = (String *)r_dest; - if (sizeof(wchar_t) == 2) { - // wchar_t is 16 bit, parse. - memnew_placement(dest, String); - dest->parse_utf16((const char16_t *)p_contents, p_size); - } else { - // wchar_t is 32 bit, copy. - memnew_placement(dest, String); - *dest = String((const char32_t *)p_contents, p_size); - } -} - -const char GDAPI *godot_string_to_latin1_chars(const godot_string *p_self) { - String *self = (String *)p_self; - return self->ascii(true).get_data(); -} - -const char GDAPI *godot_string_to_utf8_chars(const godot_string *p_self) { - String *self = (String *)p_self; - return self->utf8().get_data(); -} - -const char16_t GDAPI *godot_string_to_utf16_chars(const godot_string *p_self) { - String *self = (String *)p_self; - return self->utf16().get_data(); -} - -const char32_t GDAPI *godot_string_to_utf32_chars(const godot_string *p_self) { - String *self = (String *)p_self; - return self->get_data(); -} - -const wchar_t GDAPI *godot_string_to_wide_chars(const godot_string *p_self) { - String *self = (String *)p_self; - if (sizeof(wchar_t) == 2) { - return (const wchar_t *)self->utf16().get_data(); - } else { - return (const wchar_t *)self->get_data(); - } -} - -char32_t GDAPI *godot_string_operator_index(godot_string *p_self, godot_int p_index) { - String *self = (String *)p_self; - return self->ptrw(); -} - -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->ptr(); -} - -void GDAPI godot_string_destroy(godot_string *p_self) { - String *self = (String *)p_self; - self->~String(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/string_name.cpp b/modules/gdnative/gdnative/string_name.cpp deleted file mode 100644 index 0bdacd2e5d..0000000000 --- a/modules/gdnative/gdnative/string_name.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* string_name.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/string_name.h" - -#include "core/string/string_name.h" - -static_assert(sizeof(godot_string_name) == sizeof(StringName), "StringName size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_string_name_new(godot_string_name *r_dest) { - StringName *dest = (StringName *)r_dest; - memnew_placement(dest, StringName); -} - -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)); -} - -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) { - StringName *self = (StringName *)p_self; - self->~StringName(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/transform2d.cpp b/modules/gdnative/gdnative/transform2d.cpp deleted file mode 100644 index 7dc07024e5..0000000000 --- a/modules/gdnative/gdnative/transform2d.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* transform2d.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/transform2d.h" - -#include "core/math/transform_2d.h" -#include "core/os/memory.h" - -static_assert(sizeof(godot_transform2d) == sizeof(Transform2D), "Transform2D size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_transform2d_new(godot_transform2d *p_self) { - memnew_placement(p_self, Transform2D); -} - -void GDAPI godot_transform2d_new_copy(godot_transform2d *r_dest, const godot_transform2d *p_src) { - memnew_placement(r_dest, Transform2D(*(Transform2D *)p_src)); -} - -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); -} - -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; - return (const godot_vector2 *)&self->operator[](p_index); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/transform_3d.cpp b/modules/gdnative/gdnative/transform_3d.cpp deleted file mode 100644 index b47e8e69de..0000000000 --- a/modules/gdnative/gdnative/transform_3d.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/*************************************************************************/ -/* transform_3d.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 deleted file mode 100644 index 42fa77a174..0000000000 --- a/modules/gdnative/gdnative/variant.cpp +++ /dev/null @@ -1,1273 +0,0 @@ -/*************************************************************************/ -/* variant.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/variant.h" - -#include "core/object/ref_counted.h" -#include "core/variant/variant.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static_assert(sizeof(godot_variant) == sizeof(Variant), "Variant size mismatch"); - -// Workaround GCC ICE on armv7hl which was affected GCC 6.0 up to 8.0 (GH-16100). -// It was fixed upstream in 8.1, and a fix was backported to 7.4. -// This can be removed once no supported distro ships with versions older than 7.4. -#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \ - (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1)) -#pragma GCC push_options -#pragma GCC optimize("-O0") -#endif - -#if defined(__arm__) && defined(__GNUC__) && !defined(__clang__) && \ - (__GNUC__ == 6 || (__GNUC__ == 7 && __GNUC_MINOR__ < 4) || (__GNUC__ == 8 && __GNUC_MINOR__ < 1)) -#pragma GCC pop_options -#endif - -// Memory - -void GDAPI godot_variant_new_copy(godot_variant *p_dest, const godot_variant *p_src) { - Variant *dest = (Variant *)p_dest; - const Variant *src = (const Variant *)p_src; - memnew_placement(dest, Variant(*src)); -} - -void GDAPI godot_variant_new_nil(godot_variant *r_dest) { - Variant *dest = (Variant *)r_dest; - memnew_placement(dest, Variant); -} - -void GDAPI godot_variant_new_bool(godot_variant *r_dest, const godot_bool p_b) { - Variant *dest = (Variant *)r_dest; - memnew_placement(dest, Variant(p_b)); -} - -void GDAPI godot_variant_new_int(godot_variant *r_dest, const godot_int p_i) { - Variant *dest = (Variant *)r_dest; - memnew_placement(dest, Variant(p_i)); -} - -void GDAPI godot_variant_new_float(godot_variant *r_dest, const godot_float p_r) { - Variant *dest = (Variant *)r_dest; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - const Plane *plane = (const Plane *)p_plane; - memnew_placement(dest, Variant(*plane)); -} - -void GDAPI godot_variant_new_quaternion(godot_variant *r_dest, const godot_quaternion *p_quaternion) { - Variant *dest = (Variant *)r_dest; - 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; - 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; - const Basis *basis = (const Basis *)p_basis; - memnew_placement(dest, Variant(*basis)); -} - -void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans) { - Variant *dest = (Variant *)r_dest; - 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; - 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; - 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; - 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; - 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; - 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; - const Object *obj = (const Object *)p_obj; - const RefCounted *ref_counted = Object::cast_to(obj); - REF ref; - if (ref_counted) { - ref = REF(ref_counted); - } - if (!ref.is_null()) { - memnew_placement(dest, Variant(ref)); - } else { -#if defined(DEBUG_METHODS_ENABLED) - if (ref_counted) { - ERR_PRINT("RefCounted object has 0 refcount in godot_variant_new_object - you lost it somewhere."); - } -#endif - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - 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; - const PackedColorArray *pca = (const PackedColorArray *)p_pca; - memnew_placement(dest, Variant(*pca)); -} - -godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - return self->operator bool(); -} - -godot_int GDAPI godot_variant_as_int(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - return self->operator int64_t(); -} - -godot_float GDAPI godot_variant_as_float(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - return self->operator double(); -} - -godot_string GDAPI godot_variant_as_string(const godot_variant *p_self) { - godot_string raw_dest; - const Variant *self = (const Variant *)p_self; - String *dest = (String *)&raw_dest; - memnew_placement(dest, String(self->operator String())); // operator = is overloaded by String - return raw_dest; -} - -godot_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self) { - godot_string_name raw_dest; - const Variant *self = (const Variant *)p_self; - StringName *dest = (StringName *)&raw_dest; - memnew_placement(dest, StringName(self->operator StringName())); // operator = is overloaded by StringName - return raw_dest; -} - -godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self) { - godot_vector2 raw_dest; - const Variant *self = (const Variant *)p_self; - Vector2 *dest = (Vector2 *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_vector2i GDAPI godot_variant_as_vector2i(const godot_variant *p_self) { - godot_vector2i raw_dest; - const Variant *self = (const Variant *)p_self; - Vector2i *dest = (Vector2i *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self) { - godot_rect2 raw_dest; - const Variant *self = (const Variant *)p_self; - Rect2 *dest = (Rect2 *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_rect2i GDAPI godot_variant_as_rect2i(const godot_variant *p_self) { - godot_rect2i raw_dest; - const Variant *self = (const Variant *)p_self; - Rect2i *dest = (Rect2i *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self) { - godot_vector3 raw_dest; - const Variant *self = (const Variant *)p_self; - Vector3 *dest = (Vector3 *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_vector3i GDAPI godot_variant_as_vector3i(const godot_variant *p_self) { - godot_vector3i raw_dest; - const Variant *self = (const Variant *)p_self; - Vector3i *dest = (Vector3i *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self) { - godot_transform2d raw_dest; - const Variant *self = (const Variant *)p_self; - Transform2D *dest = (Transform2D *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self) { - godot_plane raw_dest; - const Variant *self = (const Variant *)p_self; - Plane *dest = (Plane *)&raw_dest; - *dest = *self; - return 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; - Quaternion *dest = (Quaternion *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self) { - godot_aabb raw_dest; - const Variant *self = (const Variant *)p_self; - AABB *dest = (AABB *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self) { - godot_basis raw_dest; - const Variant *self = (const Variant *)p_self; - Basis *dest = (Basis *)&raw_dest; - *dest = *self; - return 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; - Transform3D *dest = (Transform3D *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_color GDAPI godot_variant_as_color(const godot_variant *p_self) { - godot_color raw_dest; - const Variant *self = (const Variant *)p_self; - Color *dest = (Color *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self) { - godot_node_path raw_dest; - const Variant *self = (const Variant *)p_self; - NodePath *dest = (NodePath *)&raw_dest; - memnew_placement(dest, NodePath(self->operator NodePath())); // operator = is overloaded by NodePath - return raw_dest; -} - -godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self) { - godot_rid raw_dest; - const Variant *self = (const Variant *)p_self; - RID *dest = (RID *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_callable GDAPI godot_variant_as_callable(const godot_variant *p_self) { - godot_callable raw_dest; - const Variant *self = (const Variant *)p_self; - Callable *dest = (Callable *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_signal GDAPI godot_variant_as_signal(const godot_variant *p_self) { - godot_signal raw_dest; - const Variant *self = (const Variant *)p_self; - Signal *dest = (Signal *)&raw_dest; - *dest = *self; - return raw_dest; -} - -godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - Object *dest; - dest = *self; - return (godot_object *)dest; -} - -godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self) { - godot_dictionary raw_dest; - const Variant *self = (const Variant *)p_self; - Dictionary *dest = (Dictionary *)&raw_dest; - memnew_placement(dest, Dictionary(self->operator Dictionary())); // operator = is overloaded by Dictionary - return raw_dest; -} - -godot_array GDAPI godot_variant_as_array(const godot_variant *p_self) { - godot_array raw_dest; - const Variant *self = (const Variant *)p_self; - Array *dest = (Array *)&raw_dest; - memnew_placement(dest, Array(self->operator Array())); // operator = is overloaded by Array - return raw_dest; -} - -godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_variant *p_self) { - godot_packed_byte_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedByteArray *dest = (PackedByteArray *)&raw_dest; - memnew_placement(dest, PackedByteArray(self->operator PackedByteArray())); // operator = is overloaded by PackedByteArray - *dest = *self; - return raw_dest; -} - -godot_packed_int32_array GDAPI godot_variant_as_packed_int32_array(const godot_variant *p_self) { - godot_packed_int32_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedInt32Array *dest = (PackedInt32Array *)&raw_dest; - memnew_placement(dest, PackedInt32Array(self->operator PackedInt32Array())); // operator = is overloaded by PackedInt32Array - *dest = *self; - return raw_dest; -} - -godot_packed_int64_array GDAPI godot_variant_as_packed_int64_array(const godot_variant *p_self) { - godot_packed_int64_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedInt64Array *dest = (PackedInt64Array *)&raw_dest; - memnew_placement(dest, PackedInt64Array(self->operator PackedInt64Array())); // operator = is overloaded by PackedInt64Array - *dest = *self; - return raw_dest; -} - -godot_packed_float32_array GDAPI godot_variant_as_packed_float32_array(const godot_variant *p_self) { - godot_packed_float32_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedFloat32Array *dest = (PackedFloat32Array *)&raw_dest; - memnew_placement(dest, PackedFloat32Array(self->operator PackedFloat32Array())); // operator = is overloaded by PackedFloat32Array - *dest = *self; - return raw_dest; -} - -godot_packed_float64_array GDAPI godot_variant_as_packed_float64_array(const godot_variant *p_self) { - godot_packed_float64_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedFloat64Array *dest = (PackedFloat64Array *)&raw_dest; - memnew_placement(dest, PackedFloat64Array(self->operator PackedFloat64Array())); // operator = is overloaded by PackedFloat64Array - *dest = *self; - return raw_dest; -} - -godot_packed_string_array GDAPI godot_variant_as_packed_string_array(const godot_variant *p_self) { - godot_packed_string_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedStringArray *dest = (PackedStringArray *)&raw_dest; - memnew_placement(dest, PackedStringArray(self->operator PackedStringArray())); // operator = is overloaded by PackedStringArray - *dest = *self; - return raw_dest; -} - -godot_packed_vector2_array GDAPI godot_variant_as_packed_vector2_array(const godot_variant *p_self) { - godot_packed_vector2_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedVector2Array *dest = (PackedVector2Array *)&raw_dest; - memnew_placement(dest, PackedVector2Array(self->operator PackedVector2Array())); // operator = is overloaded by PackedVector2Array - *dest = *self; - return raw_dest; -} - -godot_packed_vector3_array GDAPI godot_variant_as_packed_vector3_array(const godot_variant *p_self) { - godot_packed_vector3_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedVector3Array *dest = (PackedVector3Array *)&raw_dest; - memnew_placement(dest, PackedVector3Array(self->operator PackedVector3Array())); // operator = is overloaded by PackedVector3Array - *dest = *self; - return raw_dest; -} - -godot_packed_color_array GDAPI godot_variant_as_packed_color_array(const godot_variant *p_self) { - godot_packed_color_array raw_dest; - const Variant *self = (const Variant *)p_self; - PackedColorArray *dest = (PackedColorArray *)&raw_dest; - memnew_placement(dest, PackedColorArray(self->operator PackedColorArray())); // operator = is overloaded by PackedColorArray - *dest = *self; - return raw_dest; -} - -void GDAPI godot_variant_destroy(godot_variant *p_self) { - Variant *self = (Variant *)p_self; - 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; - 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_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 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_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 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_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 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_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; - 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; - return self->hash_compare(*other); -} - -godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self) { - const Variant *self = (const Variant *)p_self; - return self->booleanize(); -} - -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); -} - -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_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; -} - -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 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 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 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; - 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 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 -} -#endif diff --git a/modules/gdnative/gdnative/vector2.cpp b/modules/gdnative/gdnative/vector2.cpp deleted file mode 100644 index a8d4281d25..0000000000 --- a/modules/gdnative/gdnative/vector2.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************/ -/* vector2.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/vector2.h" - -#include "core/math/vector2.h" -#include "core/math/vector2i.h" -#include "core/os/memory.h" - -static_assert(sizeof(godot_vector2) == sizeof(Vector2), "Vector2 size mismatch"); -static_assert(sizeof(godot_vector2i) == sizeof(Vector2i), "Vector2i size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_vector2_new(godot_vector2 *p_self) { - memnew_placement(p_self, Vector2); -} - -void GDAPI godot_vector2_new_copy(godot_vector2 *r_dest, const godot_vector2 *p_src) { - memnew_placement(r_dest, Vector2(*(Vector2 *)p_src)); -} - -void GDAPI godot_vector2i_new(godot_vector2i *p_self) { - memnew_placement(p_self, Vector2i); -} - -void GDAPI godot_vector2i_new_copy(godot_vector2i *r_dest, const godot_vector2i *p_src) { - memnew_placement(r_dest, Vector2i(*(Vector2i *)p_src)); -} - -godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index) { - Vector2 *self = (Vector2 *)p_self; - return (godot_real_t *)&self->operator[](p_index); -} - -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 (const godot_real_t *)&self->operator[](p_index); -} - -int32_t GDAPI *godot_vector2i_operator_index(godot_vector2i *p_self, godot_int p_index) { - Vector2i *self = (Vector2i *)p_self; - return (int32_t *)&self->operator[](p_index); -} - -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 (const int32_t *)&self->operator[](p_index); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative/vector3.cpp b/modules/gdnative/gdnative/vector3.cpp deleted file mode 100644 index 37c88c3cca..0000000000 --- a/modules/gdnative/gdnative/vector3.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/*************************************************************************/ -/* vector3.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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/vector3.h" - -#include "core/math/vector3.h" -#include "core/math/vector3i.h" -#include "core/os/memory.h" - -static_assert(sizeof(godot_vector3) == sizeof(Vector3), "Vector3 size mismatch"); -static_assert(sizeof(godot_vector3i) == sizeof(Vector3i), "Vector3i size mismatch"); - -#ifdef __cplusplus -extern "C" { -#endif - -void GDAPI godot_vector3_new(godot_vector3 *p_self) { - memnew_placement(p_self, Vector3); -} - -void GDAPI godot_vector3_new_copy(godot_vector3 *r_dest, const godot_vector3 *p_src) { - memnew_placement(r_dest, Vector3(*(Vector3 *)p_src)); -} - -void GDAPI godot_vector3i_new(godot_vector3i *p_self) { - memnew_placement(p_self, Vector3i); -} - -void GDAPI godot_vector3i_new_copy(godot_vector3i *r_dest, const godot_vector3i *p_src) { - memnew_placement(r_dest, Vector3i(*(Vector3i *)p_src)); -} - -godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index) { - Vector3 *self = (Vector3 *)p_self; - return (godot_real_t *)&self->operator[](p_index); -} - -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 (const godot_real_t *)&self->operator[](p_index); -} - -int32_t GDAPI *godot_vector3i_operator_index(godot_vector3i *p_self, godot_int p_index) { - Vector3i *self = (Vector3i *)p_self; - return (int32_t *)&self->operator[](p_index); -} - -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 (const int32_t *)&self->operator[](p_index); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json deleted file mode 100644 index cf1c7dc01f..0000000000 --- a/modules/gdnative/gdnative_api.json +++ /dev/null @@ -1,5108 +0,0 @@ -{ - "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" - ] - ] - } - ] - } - ] -} diff --git a/modules/gdnative/gdnative_builders.py b/modules/gdnative/gdnative_builders.py deleted file mode 100644 index 6c96e23426..0000000000 --- a/modules/gdnative/gdnative_builders.py +++ /dev/null @@ -1,263 +0,0 @@ -"""Functions used to generate source files during build time - -All such functions are invoked in a subprocess on Windows to prevent build flakiness. - -""" -import json -from platform_methods import subprocess_main - - -def _spaced(e): - return e if e[-1] == "*" else e + " " - - -def _build_gdnative_api_struct_header(api): - out = [ - "/* THIS FILE IS GENERATED DO NOT EDIT */", - "#ifndef GODOT_GDNATIVE_API_STRUCT_H", - "#define GODOT_GDNATIVE_API_STRUCT_H", - "", - "#include ", - "#include ", - "#include ", - "#include ", - "#include ", - "", - "#ifdef __cplusplus", - 'extern "C" {', - "#endif", - "", - "enum GDNATIVE_API_TYPES {", - "\tGDNATIVE_" + api["core"]["type"] + ",", - ] - - for ext in api["extensions"]: - out += ["\tGDNATIVE_EXT_" + ext["type"] + ","] - - out += ["};", ""] - - def generate_extension_struct(name, ext, include_version=True): - ret_val = [] - if ext["next"]: - ret_val += generate_extension_struct(name, ext["next"]) - - ret_val += [ - "typedef struct godot_gdnative_ext_" - + name - + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) - + "_api_struct {", - "\tunsigned int type;", - "\tgodot_gdnative_api_version version;", - "\tconst godot_gdnative_api_struct *next;", - ] - - for funcdef in ext["api"]: - args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) - ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) - - ret_val += [ - "} godot_gdnative_ext_" - + name - + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) - + "_api_struct;", - "", - ] - - return ret_val - - def generate_core_extension_struct(core): - ret_val = [] - if core["next"]: - ret_val += generate_core_extension_struct(core["next"]) - - ret_val += [ - "typedef struct godot_gdnative_core_" - + "{0}_{1}".format(core["version"]["major"], core["version"]["minor"]) - + "_api_struct {", - "\tunsigned int type;", - "\tgodot_gdnative_api_version version;", - "\tconst godot_gdnative_api_struct *next;", - ] - - for funcdef in core["api"]: - args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) - ret_val.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) - - ret_val += [ - "} godot_gdnative_core_" - + "{0}_{1}".format(core["version"]["major"], core["version"]["minor"]) - + "_api_struct;", - "", - ] - - return ret_val - - for ext in api["extensions"]: - name = ext["name"] - out += generate_extension_struct(name, ext, False) - - if api["core"]["next"]: - out += generate_core_extension_struct(api["core"]["next"]) - - out += [ - "typedef struct godot_gdnative_core_api_struct {", - "\tunsigned int type;", - "\tgodot_gdnative_api_version version;", - "\tconst godot_gdnative_api_struct *next;", - "\tunsigned int num_extensions;", - "\tconst godot_gdnative_api_struct **extensions;", - ] - - for funcdef in api["core"]["api"]: - args = ", ".join(["%s%s" % (_spaced(t), n) for t, n in funcdef["arguments"]]) - out.append("\t%s(*%s)(%s);" % (_spaced(funcdef["return_type"]), funcdef["name"], args)) - - out += [ - "} godot_gdnative_core_api_struct;", - "", - "#ifdef __cplusplus", - "}", - "#endif", - "", - "#endif // GODOT_GDNATIVE_API_STRUCT_H", - "", - ] - return "\n".join(out) - - -def _build_gdnative_api_struct_source(api): - out = ["/* THIS FILE IS GENERATED DO NOT EDIT */", "", "#include ", ""] - - def get_extension_struct_name(name, ext, include_version=True): - return ( - "godot_gdnative_ext_" - + name - + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) - + "_api_struct" - ) - - def get_extension_struct_instance_name(name, ext, include_version=True): - return ( - "api_extension_" - + name - + ("" if not include_version else ("_{0}_{1}".format(ext["version"]["major"], ext["version"]["minor"]))) - + "_struct" - ) - - def get_extension_struct_definition(name, ext, include_version=True): - - ret_val = [] - - if ext["next"]: - ret_val += get_extension_struct_definition(name, ext["next"]) - - ret_val += [ - "extern const " - + get_extension_struct_name(name, ext, include_version) - + " " - + get_extension_struct_instance_name(name, ext, include_version) - + " = {", - "\tGDNATIVE_EXT_" + ext["type"] + ",", - "\t{" + str(ext["version"]["major"]) + ", " + str(ext["version"]["minor"]) + "},", - "\t" - + ( - "nullptr" - if not ext["next"] - else ("(const godot_gdnative_api_struct *)&" + get_extension_struct_instance_name(name, ext["next"])) - ) - + ",", - ] - - for funcdef in ext["api"]: - ret_val.append("\t%s," % funcdef["name"]) - - ret_val += ["};\n"] - - return ret_val - - def get_core_struct_definition(core): - ret_val = [] - - if core["next"]: - ret_val += get_core_struct_definition(core["next"]) - - ret_val += [ - "extern const godot_gdnative_core_" - + "{0}_{1}_api_struct api_{0}_{1}".format(core["version"]["major"], core["version"]["minor"]) - + " = {", - "\tGDNATIVE_" + core["type"] + ",", - "\t{" + str(core["version"]["major"]) + ", " + str(core["version"]["minor"]) + "},", - "\t" - + ( - "nullptr" - if not core["next"] - else ( - "(const godot_gdnative_api_struct *)& api_{0}_{1}".format( - core["next"]["version"]["major"], core["next"]["version"]["minor"] - ) - ) - ) - + ",", - ] - - for funcdef in core["api"]: - ret_val.append("\t%s," % funcdef["name"]) - - ret_val += ["};\n"] - - return ret_val - - for ext in api["extensions"]: - name = ext["name"] - out += get_extension_struct_definition(name, ext, False) - - out += ["", "const godot_gdnative_api_struct *gdnative_extensions_pointers[] = {"] - - for ext in api["extensions"]: - name = ext["name"] - out += ["\t(godot_gdnative_api_struct *)&api_extension_" + name + "_struct,"] - - out += ["};\n"] - - if api["core"]["next"]: - out += get_core_struct_definition(api["core"]["next"]) - - out += [ - "extern const godot_gdnative_core_api_struct api_struct = {", - "\tGDNATIVE_" + api["core"]["type"] + ",", - "\t{" + str(api["core"]["version"]["major"]) + ", " + str(api["core"]["version"]["minor"]) + "},", - "\t" - + ( - "nullptr, " - if not api["core"]["next"] - else ( - "(const godot_gdnative_api_struct *)& api_{0}_{1},".format( - api["core"]["next"]["version"]["major"], api["core"]["next"]["version"]["minor"] - ) - ) - ), - "\t" + str(len(api["extensions"])) + ",", - "\tgdnative_extensions_pointers,", - ] - - for funcdef in api["core"]["api"]: - out.append("\t%s," % funcdef["name"]) - out.append("};\n") - - return "\n".join(out) - - -def build_gdnative_api_struct(target, source, env): - - with open(source[0], "r") as fd: - api = json.load(fd) - - header, source = target - with open(header, "w") as fd: - fd.write(_build_gdnative_api_struct_header(api)) - with open(source, "w") as fd: - fd.write(_build_gdnative_api_struct_source(api)) - - -if __name__ == "__main__": - subprocess_main(globals()) diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp deleted file mode 100644 index 66c8ab7b37..0000000000 --- a/modules/gdnative/gdnative_library_editor_plugin.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/*************************************************************************/ -/* gdnative_library_editor_plugin.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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. */ -/*************************************************************************/ - -#ifdef TOOLS_ENABLED - -#include "gdnative_library_editor_plugin.h" - -#include "editor/editor_file_dialog.h" -#include "editor/editor_node.h" -#include "editor/editor_scale.h" -#include "gdnative.h" - -void GDNativeLibraryEditor::edit(Ref p_library) { - library = p_library; - Ref config = p_library->get_config_file(); - - for (KeyValue &E : platforms) { - for (List::Element *it = E.value.entries.front(); it; it = it->next()) { - String target = E.key + "." + it->get(); - TargetConfig ecfg; - ecfg.library = config->get_value("entry", target, ""); - ecfg.dependencies = config->get_value("dependencies", target, Array()); - entry_configs[target] = ecfg; - } - } - - _update_tree(); -} - -void GDNativeLibraryEditor::_bind_methods() { -} - -void GDNativeLibraryEditor::_update_tree() { - tree->clear(); - TreeItem *root = tree->create_item(); - - PopupMenu *filter_list = filter->get_popup(); - String text = ""; - for (int i = 0; i < filter_list->get_item_count(); i++) { - if (!filter_list->is_item_checked(i)) { - continue; - } - Map::Element *E = platforms.find(filter_list->get_item_metadata(i)); - if (!text.is_empty()) { - text += ", "; - } - text += E->get().name; - - TreeItem *platform = tree->create_item(root); - platform->set_text(0, E->get().name); - platform->set_metadata(0, E->get().library_extension); - - 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); - - for (List::Element *it = E->value().entries.front(); it; it = it->next()) { - String target = E->key() + "." + it->get(); - TreeItem *bit = tree->create_item(platform); - - 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(SNAME("prop_subsection"), SNAME("Editor"))); - - 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.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(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(SNAME("Clear"), SNAME("EditorIcons")), BUTTON_CLEAR_DEPENDENCES, false, TTR("Clear")); - } - bit->set_text(2, Variant(files)); - - 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_alignment(0, HORIZONTAL_ALIGNMENT_CENTER); - 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()); - - platform->set_collapsed(collapsed_items.find(E->get().name) != nullptr); - } - filter->set_text(text); -} - -void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) { - String target = Object::cast_to(item)->get_metadata(0); - String platform = target.substr(0, target.find(".")); - String entry = target.substr(platform.length() + 1, target.length()); - String section = (id == BUTTON_SELECT_DEPENDENCES || id == BUTTON_CLEAR_DEPENDENCES) ? "dependencies" : "entry"; - - if (id == BUTTON_SELECT_LIBRARY || id == BUTTON_SELECT_DEPENDENCES) { - TreeItem *treeItem = Object::cast_to(item)->get_parent(); - 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" || treeItem->get_text(0) == "macOS") { - mode = EditorFileDialog::FILE_MODE_OPEN_ANY; - } - - file_dialog->set_meta("target", target); - file_dialog->set_meta("section", section); - file_dialog->clear_filters(); - - String filter_string = treeItem->get_metadata(0); - Vector filters = filter_string.split(",", false, 0); - for (int i = 0; i < filters.size(); i++) { - file_dialog->add_filter(filters[i]); - } - - file_dialog->set_file_mode(mode); - file_dialog->popup_file_dialog(); - - } else if (id == BUTTON_CLEAR_LIBRARY) { - _set_target_value(section, target, ""); - } else if (id == BUTTON_CLEAR_DEPENDENCES) { - _set_target_value(section, target, Array()); - } else if (id == BUTTON_ERASE_ENTRY) { - _erase_entry(platform, entry); - } else if (id == BUTTON_MOVE_UP || id == BUTTON_MOVE_DOWN) { - _move_entry(platform, entry, id); - } -} - -void GDNativeLibraryEditor::_on_library_selected(const String &file) { - _set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), file); -} - -void GDNativeLibraryEditor::_on_dependencies_selected(const PackedStringArray &files) { - _set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), files); -} - -void GDNativeLibraryEditor::_on_filter_selected(int index) { - PopupMenu *filter_list = filter->get_popup(); - filter_list->set_item_checked(index, !filter_list->is_item_checked(index)); - _update_tree(); -} - -void GDNativeLibraryEditor::_on_item_collapsed(Object *p_item) { - TreeItem *item = Object::cast_to(p_item); - String name = item->get_text(0); - - if (item->is_collapsed()) { - collapsed_items.insert(name); - } else if (Set::Element *e = collapsed_items.find(name)) { - collapsed_items.erase(e); - } -} - -void GDNativeLibraryEditor::_on_item_activated() { - TreeItem *item = tree->get_selected(); - if (item && tree->get_selected_column() == 0 && item->get_metadata(0).get_type() == Variant::NIL) { - new_architecture_dialog->set_meta("platform", item->get_metadata(1)); - new_architecture_dialog->popup_centered(); - } -} - -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.is_empty()) { - platforms[platform].entries.push_back(entry); - _update_tree(); - } -} - -void GDNativeLibraryEditor::_set_target_value(const String §ion, const String &target, Variant file) { - if (section == "entry") { - entry_configs[target].library = file; - } else if (section == "dependencies") { - entry_configs[target].dependencies = file; - } - _translate_to_config_file(); - _update_tree(); -} - -void GDNativeLibraryEditor::_erase_entry(const String &platform, const String &entry) { - if (platforms.has(platform)) { - if (List::Element *E = platforms[platform].entries.find(entry)) { - String target = platform + "." + entry; - - platforms[platform].entries.erase(E); - _set_target_value("entry", target, ""); - _set_target_value("dependencies", target, Array()); - _translate_to_config_file(); - _update_tree(); - } - } -} - -void GDNativeLibraryEditor::_move_entry(const String &platform, const String &entry, int dir) { - if (List::Element *E = platforms[platform].entries.find(entry)) { - if (E->prev() && dir == BUTTON_MOVE_UP) { - platforms[platform].entries.insert_before(E->prev(), E->get()); - platforms[platform].entries.erase(E); - } else if (E->next() && dir == BUTTON_MOVE_DOWN) { - platforms[platform].entries.insert_after(E->next(), E->get()); - platforms[platform].entries.erase(E); - } - _translate_to_config_file(); - _update_tree(); - } -} - -void GDNativeLibraryEditor::_translate_to_config_file() { - if (!library.is_null()) { - Ref config = library->get_config_file(); - config->erase_section("entry"); - config->erase_section("dependencies"); - - for (KeyValue &E : platforms) { - for (List::Element *it = E.value.entries.front(); it; it = it->next()) { - String target = E.key + "." + it->get(); - if (entry_configs[target].library.is_empty() && entry_configs[target].dependencies.is_empty()) { - continue; - } - - config->set_value("entry", target, entry_configs[target].library); - config->set_value("dependencies", target, entry_configs[target].dependencies); - } - } - - library->notify_property_list_changed(); - } -} - -GDNativeLibraryEditor::GDNativeLibraryEditor() { - { // Define platforms - NativePlatformConfig platform_windows; - platform_windows.name = "Windows"; - platform_windows.entries.push_back("64"); - platform_windows.entries.push_back("32"); - platform_windows.library_extension = "*.dll"; - platforms["Windows"] = platform_windows; - - NativePlatformConfig platform_linux; - platform_linux.name = "Linux/X11"; - platform_linux.entries.push_back("64"); - platform_linux.entries.push_back("32"); - platform_linux.library_extension = "*.so"; - platforms["X11"] = platform_linux; - - NativePlatformConfig platform_osx; - platform_osx.name = "macOS"; - platform_osx.entries.push_back("64"); - platform_osx.library_extension = "*.framework; Framework, *.dylib; Dynamic Library"; - platforms["macOS"] = platform_osx; - - NativePlatformConfig platform_haiku; - platform_haiku.name = "Haiku"; - platform_haiku.entries.push_back("64"); - platform_haiku.entries.push_back("32"); - platform_haiku.library_extension = "*.so"; - platforms["Haiku"] = platform_haiku; - - NativePlatformConfig platform_uwp; - platform_uwp.name = "UWP"; - platform_uwp.entries.push_back("arm"); - platform_uwp.entries.push_back("32"); - platform_uwp.entries.push_back("64"); - platform_uwp.library_extension = "*.dll"; - platforms["UWP"] = platform_uwp; - - NativePlatformConfig platform_android; - platform_android.name = "Android"; - platform_android.entries.push_back("armeabi-v7a"); - platform_android.entries.push_back("arm64-v8a"); - platform_android.entries.push_back("x86"); - platform_android.entries.push_back("x86_64"); - platform_android.library_extension = "*.so"; - platforms["Android"] = platform_android; - - 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"; - platform_ios.entries.push_back("arm64"); - platform_ios.entries.push_back("x86_64"); - // iOS can use both Static and Dynamic libraries. - // Frameworks is actually a folder with files. - platform_ios.library_extension = "*.framework; Framework, *.xcframework; Binary Framework, *.a; Static Library, *.dylib; Dynamic Library"; - platforms["iOS"] = platform_ios; - } - - VBoxContainer *container = memnew(VBoxContainer); - add_child(container); - container->set_anchors_and_offsets_preset(PRESET_WIDE); - - HBoxContainer *hbox = memnew(HBoxContainer); - container->add_child(hbox); - Label *label = memnew(Label); - label->set_text(TTR("Platform:")); - hbox->add_child(label); - filter = memnew(MenuButton); - filter->set_h_size_flags(SIZE_EXPAND_FILL); - filter->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT); - hbox->add_child(filter); - PopupMenu *filter_list = filter->get_popup(); - filter_list->set_hide_on_checkable_item_selection(false); - - int idx = 0; - for (const KeyValue &E : platforms) { - filter_list->add_check_item(E.value.name, idx); - filter_list->set_item_metadata(idx, E.key); - filter_list->set_item_checked(idx, true); - idx += 1; - } - filter_list->connect("index_pressed", callable_mp(this, &GDNativeLibraryEditor::_on_filter_selected)); - - tree = memnew(Tree); - container->add_child(tree); - tree->set_v_size_flags(SIZE_EXPAND_FILL); - tree->set_hide_root(true); - tree->set_column_titles_visible(true); - tree->set_columns(4); - tree->set_column_expand(0, false); - 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_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)); - - file_dialog = memnew(EditorFileDialog); - file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES); - //file_dialog->set_resizable(true); - add_child(file_dialog); - file_dialog->connect("file_selected", callable_mp(this, &GDNativeLibraryEditor::_on_library_selected)); - file_dialog->connect("dir_selected", callable_mp(this, &GDNativeLibraryEditor::_on_library_selected)); - file_dialog->connect("files_selected", callable_mp(this, &GDNativeLibraryEditor::_on_dependencies_selected)); - - new_architecture_dialog = memnew(ConfirmationDialog); - add_child(new_architecture_dialog); - new_architecture_dialog->set_title(TTR("Add an architecture entry")); - 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_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) { - Ref new_library = Object::cast_to(p_node); - if (new_library.is_valid()) { - library_editor->edit(new_library); - } -} - -bool GDNativeLibraryEditorPlugin::handles(Object *p_node) const { - return p_node->is_class("GDNativeLibrary"); -} - -void GDNativeLibraryEditorPlugin::make_visible(bool p_visible) { - if (p_visible) { - button->show(); - EditorNode::get_singleton()->make_bottom_panel_item_visible(library_editor); - - } else { - if (library_editor->is_visible_in_tree()) { - EditorNode::get_singleton()->hide_bottom_panel(); - } - button->hide(); - } -} - -GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin() { - library_editor = memnew(GDNativeLibraryEditor); - library_editor->set_custom_minimum_size(Size2(0, 250 * EDSCALE)); - button = EditorNode::get_singleton()->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor); - button->hide(); -} - -#endif diff --git a/modules/gdnative/gdnative_library_editor_plugin.h b/modules/gdnative/gdnative_library_editor_plugin.h deleted file mode 100644 index 797695366c..0000000000 --- a/modules/gdnative/gdnative_library_editor_plugin.h +++ /dev/null @@ -1,119 +0,0 @@ -/*************************************************************************/ -/* gdnative_library_editor_plugin.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 GDNATIVE_LIBRARY_EDITOR_PLUGIN_H -#define GDNATIVE_LIBRARY_EDITOR_PLUGIN_H - -#ifdef TOOLS_ENABLED - -#include "editor/editor_plugin.h" -#include "gdnative.h" -#include "scene/gui/control.h" -#include "scene/gui/menu_button.h" -#include "scene/gui/tree.h" - -class EditorFileDialog; - -class GDNativeLibraryEditor : public Control { - GDCLASS(GDNativeLibraryEditor, Control); - - struct NativePlatformConfig { - String name; - String library_extension; - List entries; - }; - - struct TargetConfig { - String library; - Array dependencies; - }; - - enum ItemButton { - BUTTON_SELECT_LIBRARY, - BUTTON_CLEAR_LIBRARY, - BUTTON_SELECT_DEPENDENCES, - BUTTON_CLEAR_DEPENDENCES, - BUTTON_ERASE_ENTRY, - BUTTON_MOVE_UP, - BUTTON_MOVE_DOWN, - }; - - Tree *tree; - MenuButton *filter; - EditorFileDialog *file_dialog; - ConfirmationDialog *new_architecture_dialog; - LineEdit *new_architecture_input; - Set collapsed_items; - - String showing_platform; - Ref library; - Map platforms; - Map entry_configs; - -protected: - static void _bind_methods(); - void _update_tree(); - void _on_item_button(Object *item, int column, int id); - void _on_library_selected(const String &file); - void _on_dependencies_selected(const PackedStringArray &files); - void _on_filter_selected(int id); - void _on_item_collapsed(Object *p_item); - void _on_item_activated(); - void _on_create_new_entry(); - void _set_target_value(const String §ion, const String &target, Variant file); - void _erase_entry(const String &platform, const String &entry); - void _move_entry(const String &platform, const String &entry, int dir); - void _translate_to_config_file(); - -public: - void edit(Ref p_library); - - GDNativeLibraryEditor(); -}; - -class GDNativeLibraryEditorPlugin : public EditorPlugin { - GDCLASS(GDNativeLibraryEditorPlugin, EditorPlugin); - - GDNativeLibraryEditor *library_editor = nullptr; - Button *button = nullptr; - -public: - virtual String get_name() const override { return "GDNativeLibrary"; } - bool has_main_screen() const override { return false; } - virtual void edit(Object *p_node) override; - virtual bool handles(Object *p_node) const override; - virtual void make_visible(bool p_visible) override; - - GDNativeLibraryEditorPlugin(); -}; - -#endif // TOOLS_ENABLED - -#endif // GDNATIVE_LIBRARY_EDITOR_PLUGIN_H diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp deleted file mode 100644 index ce1f41bdf1..0000000000 --- a/modules/gdnative/gdnative_library_singleton_editor.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/*************************************************************************/ -/* gdnative_library_singleton_editor.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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. */ -/*************************************************************************/ - -#ifdef TOOLS_ENABLED -#include "gdnative_library_singleton_editor.h" -#include "gdnative.h" - -#include "core/config/project_settings.h" -#include "editor/editor_node.h" - -Set GDNativeLibrarySingletonEditor::_find_singletons_recursive(EditorFileSystemDirectory *p_dir) { - Set file_paths; - - // check children - - for (int i = 0; i < p_dir->get_file_count(); i++) { - String file_name = p_dir->get_file(i); - String file_type = p_dir->get_file_type(i); - - if (file_type != "GDNativeLibrary") { - continue; - } - - Ref lib = ResourceLoader::load(p_dir->get_file_path(i)); - if (lib.is_valid() && lib->is_singleton()) { - file_paths.insert(p_dir->get_file_path(i)); - } - } - - // check subdirectories - for (int i = 0; i < p_dir->get_subdir_count(); i++) { - Set paths = _find_singletons_recursive(p_dir->get_subdir(i)); - - for (Set::Element *E = paths.front(); E; E = E->next()) { - file_paths.insert(E->get()); - } - } - - return file_paths; -} - -void GDNativeLibrarySingletonEditor::_discover_singletons() { - EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->get_filesystem(); - - Set file_paths = _find_singletons_recursive(dir); - - bool changed = false; - Array current_files; - if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) { - current_files = ProjectSettings::get_singleton()->get("gdnative/singletons"); - } - Array files; - for (Set::Element *E = file_paths.front(); E; E = E->next()) { - if (!current_files.has(E->get())) { - changed = true; - } - files.append(E->get()); - } - - // Check for removed files - if (!changed) { - // Removed singleton - for (int j = 0; j < current_files.size(); j++) { - if (!files.has(current_files[j])) { - changed = true; - break; - } - } - } - - if (changed) { - ProjectSettings::get_singleton()->set("gdnative/singletons", files); - _update_libraries(); // So singleton options (i.e. disabled) updates too - ProjectSettings::get_singleton()->save(); - } -} - -void GDNativeLibrarySingletonEditor::_update_libraries() { - updating = true; - libraries->clear(); - libraries->create_item(); // root item - - Array singletons; - if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons")) { - singletons = ProjectSettings::get_singleton()->get("gdnative/singletons"); - } - Array singletons_disabled; - if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) { - singletons_disabled = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled"); - } - - Array updated_disabled; - for (int i = 0; i < singletons.size(); i++) { - bool enabled = true; - String path = singletons[i]; - if (singletons_disabled.has(path)) { - enabled = false; - updated_disabled.push_back(path); - } - TreeItem *ti = libraries->create_item(libraries->get_root()); - ti->set_text(0, path.get_file()); - ti->set_tooltip(0, path); - ti->set_metadata(0, path); - ti->set_cell_mode(1, TreeItem::CELL_MODE_RANGE); - ti->set_text(1, "Disabled,Enabled"); - ti->set_range(1, enabled ? 1 : 0); - ti->set_custom_color(1, enabled ? Color(0, 1, 0) : Color(1, 0, 0)); - ti->set_editable(1, true); - } - - // The singletons list changed, we must update the settings - if (updated_disabled.size() != singletons_disabled.size()) { - ProjectSettings::get_singleton()->set("gdnative/singletons_disabled", updated_disabled); - } - - updating = false; -} - -void GDNativeLibrarySingletonEditor::_item_edited() { - if (updating) { - return; - } - - TreeItem *item = libraries->get_edited(); - if (!item) { - return; - } - - bool enabled = item->get_range(1); - String path = item->get_metadata(0); - - Array disabled_paths; - Array undo_paths; - if (ProjectSettings::get_singleton()->has_setting("gdnative/singletons_disabled")) { - disabled_paths = ProjectSettings::get_singleton()->get("gdnative/singletons_disabled"); - // Duplicate so redo works (not a reference) - disabled_paths = disabled_paths.duplicate(); - // For undo, so we can reset the property. - undo_paths = disabled_paths.duplicate(); - } - - if (enabled) { - disabled_paths.erase(path); - } else { - if (disabled_paths.find(path) == -1) { - disabled_paths.push_back(path); - } - } - - undo_redo->create_action(enabled ? TTR("Enabled GDNative Singleton") : TTR("Disabled GDNative Singleton")); - undo_redo->add_do_property(ProjectSettings::get_singleton(), "gdnative/singletons_disabled", disabled_paths); - undo_redo->add_do_method(this, "_update_libraries"); - undo_redo->add_undo_property(ProjectSettings::get_singleton(), "gdnative/singletons_disabled", undo_paths); - undo_redo->add_undo_method(this, "_update_libraries"); - undo_redo->commit_action(); -} - -void GDNativeLibrarySingletonEditor::_notification(int p_what) { - switch (p_what) { - case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible_in_tree()) { - _update_libraries(); - } - } break; - } -} - -void GDNativeLibrarySingletonEditor::_bind_methods() { - ClassDB::bind_method(D_METHOD("_update_libraries"), &GDNativeLibrarySingletonEditor::_update_libraries); -} - -GDNativeLibrarySingletonEditor::GDNativeLibrarySingletonEditor() { - undo_redo = EditorNode::get_singleton()->get_undo_redo(); - libraries = memnew(Tree); - libraries->set_columns(2); - libraries->set_column_titles_visible(true); - libraries->set_column_title(0, TTR("Library")); - libraries->set_column_title(1, TTR("Status")); - libraries->set_hide_root(true); - add_margin_child(TTR("Libraries: "), libraries, true); - updating = false; - libraries->connect("item_edited", callable_mp(this, &GDNativeLibrarySingletonEditor::_item_edited)); - EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &GDNativeLibrarySingletonEditor::_discover_singletons)); -} - -#endif // TOOLS_ENABLED diff --git a/modules/gdnative/gdnative_library_singleton_editor.h b/modules/gdnative/gdnative_library_singleton_editor.h deleted file mode 100644 index 16155723bc..0000000000 --- a/modules/gdnative/gdnative_library_singleton_editor.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* gdnative_library_singleton_editor.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 GD_NATIVE_LIBRARY_EDITOR_H -#define GD_NATIVE_LIBRARY_EDITOR_H - -#ifdef TOOLS_ENABLED -#include "editor/editor_file_system.h" -#include "editor/project_settings_editor.h" - -class GDNativeLibrarySingletonEditor : public VBoxContainer { - GDCLASS(GDNativeLibrarySingletonEditor, VBoxContainer); - -private: - Tree *libraries; - UndoRedo *undo_redo; - - bool updating; - - static Set _find_singletons_recursive(EditorFileSystemDirectory *p_dir); - -protected: - void _notification(int p_what); - static void _bind_methods(); - - void _discover_singletons(); - void _item_edited(); - void _update_libraries(); - -public: - GDNativeLibrarySingletonEditor(); -}; - -#endif -#endif // GD_NATIVE_LIBRARY_EDITOR_H diff --git a/modules/gdnative/icons/GDNativeLibrary.svg b/modules/gdnative/icons/GDNativeLibrary.svg deleted file mode 100644 index 0ddfd4e6f2..0000000000 --- a/modules/gdnative/icons/GDNativeLibrary.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/modules/gdnative/icons/NativeScript.svg b/modules/gdnative/icons/NativeScript.svg deleted file mode 100644 index 2224b36b29..0000000000 --- a/modules/gdnative/icons/NativeScript.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/modules/gdnative/include/android/godot_android.h b/modules/gdnative/include/android/godot_android.h deleted file mode 100644 index 859a85ae1e..0000000000 --- a/modules/gdnative/include/android/godot_android.h +++ /dev/null @@ -1,56 +0,0 @@ -/*************************************************************************/ -/* godot_android.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_ANDROID_GDN_H -#define GODOT_ANDROID_GDN_H - -#include - -#ifdef __ANDROID__ -#include -#else -#define JNIEnv void -#define jobject void * -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEnv *GDAPI godot_android_get_env(); -jobject GDAPI godot_android_get_activity(); -jobject GDAPI godot_android_get_surface(); -bool GDAPI godot_android_is_activity_resumed(); - -#ifdef __cplusplus -} -#endif - -#endif /* !GODOT_ANDROID_GDN_H */ diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h deleted file mode 100644 index 67818f61c8..0000000000 --- a/modules/gdnative/include/gdnative/aabb.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* aabb.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_AABB_H -#define GODOT_AABB_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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 -typedef struct { - uint8_t _dont_touch_that[GODOT_AABB_SIZE]; -} godot_aabb; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_AABB_H diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h deleted file mode 100644 index cee641a7c5..0000000000 --- a/modules/gdnative/include/gdnative/array.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* array.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_ARRAY_H -#define GODOT_ARRAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_ARRAY_SIZE sizeof(void *) - -#ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_ARRAY_SIZE]; -} godot_array; -#endif - -#include -#include - -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_destroy(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 -} -#endif - -#endif // GODOT_ARRAY_H diff --git a/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h deleted file mode 100644 index 50c9aa6408..0000000000 --- a/modules/gdnative/include/gdnative/basis.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* basis.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_BASIS_H -#define GODOT_BASIS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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 -typedef struct { - uint8_t _dont_touch_that[GODOT_BASIS_SIZE]; -} godot_basis; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_BASIS_H diff --git a/modules/gdnative/include/gdnative/callable.h b/modules/gdnative/include/gdnative/callable.h deleted file mode 100644 index db068d2ac7..0000000000 --- a/modules/gdnative/include/gdnative/callable.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* callable.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_CALLABLE_H -#define GODOT_CALLABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// Alignment hardcoded in `core/variant/callable.h`. -#define GODOT_CALLABLE_SIZE (16) - -#ifndef GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_CALLABLE_SIZE]; -} godot_callable; -#endif - -#include - -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); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h deleted file mode 100644 index 2d64a323f9..0000000000 --- a/modules/gdnative/include/gdnative/color.h +++ /dev/null @@ -1,61 +0,0 @@ -/*************************************************************************/ -/* color.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_COLOR_H -#define GODOT_COLOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -// 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 -typedef struct { - uint8_t _dont_touch_that[GODOT_COLOR_SIZE]; -} godot_color; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_COLOR_H diff --git a/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h deleted file mode 100644 index 4219753f71..0000000000 --- a/modules/gdnative/include/gdnative/dictionary.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* dictionary.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_DICTIONARY_H -#define GODOT_DICTIONARY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_DICTIONARY_SIZE sizeof(void *) - -#ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_DICTIONARY_SIZE]; -} godot_dictionary; -#endif - -#include -#include - -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_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); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DICTIONARY_H diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h deleted file mode 100644 index b46a00c185..0000000000 --- a/modules/gdnative/include/gdnative/gdnative.h +++ /dev/null @@ -1,287 +0,0 @@ -/*************************************************************************/ -/* gdnative.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_H -#define GODOT_GDNATIVE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#if defined(_WIN32) || defined(__ANDROID__) -#define GDCALLINGCONV -#define GDAPI GDCALLINGCONV -#elif defined(__APPLE__) -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -#define GDCALLINGCONV __attribute__((visibility("default"))) -#define GDAPI GDCALLINGCONV -#elif TARGET_OS_MAC -#define GDCALLINGCONV __attribute__((sysv_abi)) -#define GDAPI GDCALLINGCONV -#endif -#else // !_WIN32 && !__APPLE__ -#define GDCALLINGCONV __attribute__((sysv_abi)) -#define GDAPI GDCALLINGCONV -#endif - -// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! -#ifdef __GNUC__ -#define GDN_EXPORT __attribute__((visibility("default"))) -#elif defined(_WIN32) -#define GDN_EXPORT __declspec(dllexport) -#else -#define GDN_EXPORT -#endif - -#include -#include - -////// Error - -typedef enum { - GODOT_OK, // (0) - GODOT_FAILED, ///< Generic fail error - GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable - GODOT_ERR_UNCONFIGURED, ///< The object being used hasn't been properly set up yet - GODOT_ERR_UNAUTHORIZED, ///< Missing credentials for requested resource - GODOT_ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5) - GODOT_ERR_OUT_OF_MEMORY, ///< Out of memory - GODOT_ERR_FILE_NOT_FOUND, - GODOT_ERR_FILE_BAD_DRIVE, - GODOT_ERR_FILE_BAD_PATH, - GODOT_ERR_FILE_NO_PERMISSION, // (10) - GODOT_ERR_FILE_ALREADY_IN_USE, - GODOT_ERR_FILE_CANT_OPEN, - GODOT_ERR_FILE_CANT_WRITE, - GODOT_ERR_FILE_CANT_READ, - GODOT_ERR_FILE_UNRECOGNIZED, // (15) - GODOT_ERR_FILE_CORRUPT, - GODOT_ERR_FILE_MISSING_DEPENDENCIES, - GODOT_ERR_FILE_EOF, - GODOT_ERR_CANT_OPEN, ///< Can't open a resource/socket/file - GODOT_ERR_CANT_CREATE, // (20) - GODOT_ERR_QUERY_FAILED, - GODOT_ERR_ALREADY_IN_USE, - GODOT_ERR_LOCKED, ///< resource is locked - GODOT_ERR_TIMEOUT, - GODOT_ERR_CANT_CONNECT, // (25) - GODOT_ERR_CANT_RESOLVE, - GODOT_ERR_CONNECTION_ERROR, - GODOT_ERR_CANT_ACQUIRE_RESOURCE, - GODOT_ERR_CANT_FORK, - GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30) - GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid - GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists - GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist - GODOT_ERR_DATABASE_CANT_READ, ///< database is full - GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35) - GODOT_ERR_COMPILATION_FAILED, - GODOT_ERR_METHOD_NOT_FOUND, - GODOT_ERR_LINK_FAILED, - GODOT_ERR_SCRIPT_FAILED, - GODOT_ERR_CYCLIC_LINK, // (40) - GODOT_ERR_INVALID_DECLARATION, - GODOT_ERR_DUPLICATE_SYMBOL, - GODOT_ERR_PARSE_ERROR, - GODOT_ERR_BUSY, - GODOT_ERR_SKIP, // (45) - GODOT_ERR_HELP, ///< user requested help!! - GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior. - GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames -} godot_error; - -/////// Object (forward declared) -typedef void godot_object; - -/////// String - -#include - -/////// String name - -#include - -////// Vector2 & Vector2i - -#include - -////// Rect2 & Rect2i - -#include - -////// Vector3 & Vector3i - -#include - -////// Transform2D - -#include - -/////// Plane - -#include - -/////// Quaternion - -#include - -/////// AABB - -#include - -/////// Basis - -#include - -/////// Transform3D - -#include - -/////// Color - -#include - -/////// NodePath - -#include - -/////// RID - -#include - -/////// Callable & Signal - -#include - -/////// Dictionary - -#include - -/////// Array - -#include - -// single API file for Packed*Array -#include - -void GDAPI godot_object_destroy(godot_object *p_o); - -////// Variant - -#include - -////// Singleton API - -godot_object GDAPI *godot_global_get_singleton(char *p_name); // Result shouldn't be freed. - -////// MethodBind API - -typedef struct { - uint8_t _dont_touch_that[1]; // TODO -} godot_method_bind; - -godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname); -void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret); -godot_variant GDAPI godot_method_bind_call(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); -////// Script API - -typedef struct godot_gdnative_api_version { - unsigned int major; - unsigned int minor; -} godot_gdnative_api_version; - -typedef struct godot_gdnative_api_struct godot_gdnative_api_struct; - -struct godot_gdnative_api_struct { - unsigned int type; - godot_gdnative_api_version version; - const godot_gdnative_api_struct *next; -}; - -#define GDNATIVE_VERSION_COMPATIBLE(want, have) (want.major == have.major && want.minor <= have.minor) - -typedef struct { - godot_bool in_editor; - uint64_t core_api_hash; - uint64_t editor_api_hash; - uint64_t no_api_hash; - void (*report_version_mismatch)(const godot_object *p_library, const char *p_what, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have); - void (*report_loading_error)(const godot_object *p_library, const char *p_what); - godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized - const struct godot_gdnative_core_api_struct *api_struct; - const godot_string *active_library_path; -} godot_gdnative_init_options; - -typedef struct { - godot_bool in_editor; -} godot_gdnative_terminate_options; - -// Calling convention? -typedef godot_object *(*godot_class_constructor)(); - -godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname); - -godot_dictionary GDAPI godot_get_global_constants(); - -////// GDNative procedure types -typedef void (*godot_gdnative_init_fn)(godot_gdnative_init_options *); -typedef void (*godot_gdnative_terminate_fn)(godot_gdnative_terminate_options *); -typedef godot_variant (*godot_gdnative_procedure_fn)(godot_array *); - -////// System Functions - -typedef godot_variant (*native_call_cb)(void *, godot_array *); -void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback); - -//using these will help Godot track how much memory is in use in debug mode -void GDAPI *godot_alloc(int p_bytes); -void GDAPI *godot_realloc(void *p_ptr, int p_bytes); -void GDAPI godot_free(void *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); -void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line); -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); -godot_object GDAPI *godot_object_cast_to(const godot_object *p_object, void *p_class_tag); - -// equivalent of GDScript's instance_from_id -godot_object GDAPI *godot_instance_from_id(uint64_t p_instance_id); - -uint64_t GDAPI godot_object_get_instance_id(const godot_object *p_object); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_GDNATIVE_H diff --git a/modules/gdnative/include/gdnative/math_defs.h b/modules/gdnative/include/gdnative/math_defs.h deleted file mode 100644 index dee027527e..0000000000 --- a/modules/gdnative/include/gdnative/math_defs.h +++ /dev/null @@ -1,66 +0,0 @@ -/*************************************************************************/ -/* math_defs.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 -#include - -////// 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 deleted file mode 100644 index 46b693dcf6..0000000000 --- a/modules/gdnative/include/gdnative/node_path.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************/ -/* node_path.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_NODE_PATH_H -#define GODOT_NODE_PATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_NODE_PATH_SIZE sizeof(void *) - -#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_NODE_PATH_SIZE]; -} godot_node_path; -#endif - -#include - -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); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_NODE_PATH_H diff --git a/modules/gdnative/include/gdnative/packed_arrays.h b/modules/gdnative/include/gdnative/packed_arrays.h deleted file mode 100644 index f4935ee0dc..0000000000 --- a/modules/gdnative/include/gdnative/packed_arrays.h +++ /dev/null @@ -1,255 +0,0 @@ -/*************************************************************************/ -/* packed_arrays.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_PACKED_ARRAYS_H -#define GODOT_PACKED_ARRAYS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/////// PackedByteArray - -#define GODOT_PACKED_BYTE_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_BYTE_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_BYTE_ARRAY_SIZE]; -} godot_packed_byte_array; -#endif - -/////// PackedInt32Array - -#define GODOT_PACKED_INT32_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_INT32_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_INT32_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_INT32_ARRAY_SIZE]; -} godot_packed_int32_array; -#endif - -/////// PackedInt64Array - -#define GODOT_PACKED_INT64_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_INT64_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_INT64_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_INT64_ARRAY_SIZE]; -} godot_packed_int64_array; -#endif - -/////// PackedFloat32Array - -#define GODOT_PACKED_FLOAT32_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_FLOAT32_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_FLOAT32_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_FLOAT32_ARRAY_SIZE]; -} godot_packed_float32_array; -#endif - -/////// PackedFloat64Array - -#define GODOT_PACKED_FLOAT64_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_FLOAT64_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_FLOAT64_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_FLOAT64_ARRAY_SIZE]; -} godot_packed_float64_array; -#endif - -/////// PackedStringArray - -#define GODOT_PACKED_STRING_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_STRING_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_STRING_ARRAY_SIZE]; -} godot_packed_string_array; -#endif - -/////// PackedVector2Array - -#define GODOT_PACKED_VECTOR2_ARRAY_SIZE (2 * sizeof(void *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_VECTOR2_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_VECTOR2_ARRAY_SIZE]; -} 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 *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_VECTOR3_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_VECTOR3_ARRAY_SIZE]; -} 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 *)) - -#ifndef GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_COLOR_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_COLOR_ARRAY_SIZE]; -} godot_packed_color_array; -#endif - -#include - -// Byte. - -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_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. - -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_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. - -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_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. - -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_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. - -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_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. - -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_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. - -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_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); - -// Vector2i. - -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); - -// 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); - -// Vector3i. - -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); - -// 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_PACKED_ARRAYS_H diff --git a/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h deleted file mode 100644 index e8f4f13b99..0000000000 --- a/modules/gdnative/include/gdnative/plane.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* plane.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_PLANE_H -#define GODOT_PLANE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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 -typedef struct { - uint8_t _dont_touch_that[GODOT_PLANE_SIZE]; -} godot_plane; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_PLANE_H diff --git a/modules/gdnative/include/gdnative/quaternion.h b/modules/gdnative/include/gdnative/quaternion.h deleted file mode 100644 index 80e99c3a7c..0000000000 --- a/modules/gdnative/include/gdnative/quaternion.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* quaternion.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 - -#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 - -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 deleted file mode 100644 index a901537fc4..0000000000 --- a/modules/gdnative/include/gdnative/rect2.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************/ -/* rect2.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_RECT2_H -#define GODOT_RECT2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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[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[GODOT_RECT2I_SIZE]; -} godot_rect2i; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_RECT2_H diff --git a/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h deleted file mode 100644 index f3013f36f0..0000000000 --- a/modules/gdnative/include/gdnative/rid.h +++ /dev/null @@ -1,58 +0,0 @@ -/*************************************************************************/ -/* rid.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_RID_H -#define GODOT_RID_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_RID_SIZE sizeof(uint64_t) - -#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_RID_SIZE]; -} godot_rid; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_RID_H diff --git a/modules/gdnative/include/gdnative/signal.h b/modules/gdnative/include/gdnative/signal.h deleted file mode 100644 index 64aef1c918..0000000000 --- a/modules/gdnative/include/gdnative/signal.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* signal.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 - -// 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 - -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 deleted file mode 100644 index 375e8f94c3..0000000000 --- a/modules/gdnative/include/gdnative/string.h +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************/ -/* string.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_STRING_H -#define GODOT_STRING_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#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 *) - -#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 - -#include -#include - -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); -void GDAPI godot_string_new_with_utf16_chars(godot_string *r_dest, const char16_t *p_contents); -void GDAPI godot_string_new_with_utf32_chars(godot_string *r_dest, const char32_t *p_contents); -void GDAPI godot_string_new_with_wide_chars(godot_string *r_dest, const wchar_t *p_contents); - -void GDAPI godot_string_new_with_latin1_chars_and_len(godot_string *r_dest, const char *p_contents, const int p_size); -void GDAPI godot_string_new_with_utf8_chars_and_len(godot_string *r_dest, const char *p_contents, const int p_size); -void GDAPI godot_string_new_with_utf16_chars_and_len(godot_string *r_dest, const char16_t *p_contents, const int p_size); -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 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); - -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 -} -#endif - -#endif // GODOT_STRING_H diff --git a/modules/gdnative/include/gdnative/string_name.h b/modules/gdnative/include/gdnative/string_name.h deleted file mode 100644 index 6f4d9c64fe..0000000000 --- a/modules/gdnative/include/gdnative/string_name.h +++ /dev/null @@ -1,62 +0,0 @@ -/*************************************************************************/ -/* string_name.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_STRING_NAME_H -#define GODOT_STRING_NAME_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#define GODOT_STRING_NAME_SIZE sizeof(void *) - -#ifndef GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_STRING_NAME_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_STRING_NAME_SIZE]; -} godot_string_name; -#endif - -#include - -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 - -#endif // GODOT_STRING_NAME_H diff --git a/modules/gdnative/include/gdnative/transform2d.h b/modules/gdnative/include/gdnative/transform2d.h deleted file mode 100644 index a083e61a2c..0000000000 --- a/modules/gdnative/include/gdnative/transform2d.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* transform2d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_TRANSFORM2D_H -#define GODOT_TRANSFORM2D_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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 -typedef struct { - uint8_t _dont_touch_that[GODOT_TRANSFORM2D_SIZE]; -} godot_transform2d; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_TRANSFORM2D_H diff --git a/modules/gdnative/include/gdnative/transform_3d.h b/modules/gdnative/include/gdnative/transform_3d.h deleted file mode 100644 index abd64a4d1d..0000000000 --- a/modules/gdnative/include/gdnative/transform_3d.h +++ /dev/null @@ -1,60 +0,0 @@ -/*************************************************************************/ -/* transform_3d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 - -#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 - -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 deleted file mode 100644 index b716fdaca1..0000000000 --- a/modules/gdnative/include/gdnative/variant.h +++ /dev/null @@ -1,425 +0,0 @@ -/*************************************************************************/ -/* variant.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_H -#define GODOT_VARIANT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -typedef enum godot_variant_type { - GODOT_VARIANT_TYPE_NIL, - - // atomic types - GODOT_VARIANT_TYPE_BOOL, - GODOT_VARIANT_TYPE_INT, - GODOT_VARIANT_TYPE_FLOAT, - GODOT_VARIANT_TYPE_STRING, - - // math types - GODOT_VARIANT_TYPE_VECTOR2, - GODOT_VARIANT_TYPE_VECTOR2I, - GODOT_VARIANT_TYPE_RECT2, - GODOT_VARIANT_TYPE_RECT2I, - GODOT_VARIANT_TYPE_VECTOR3, - GODOT_VARIANT_TYPE_VECTOR3I, - GODOT_VARIANT_TYPE_TRANSFORM2D, - GODOT_VARIANT_TYPE_PLANE, - GODOT_VARIANT_TYPE_QUATERNION, - GODOT_VARIANT_TYPE_AABB, - GODOT_VARIANT_TYPE_BASIS, - GODOT_VARIANT_TYPE_TRANSFORM3D, - - // misc types - GODOT_VARIANT_TYPE_COLOR, - GODOT_VARIANT_TYPE_STRING_NAME, - GODOT_VARIANT_TYPE_NODE_PATH, - GODOT_VARIANT_TYPE_RID, - GODOT_VARIANT_TYPE_OBJECT, - GODOT_VARIANT_TYPE_CALLABLE, - GODOT_VARIANT_TYPE_SIGNAL, - GODOT_VARIANT_TYPE_DICTIONARY, - GODOT_VARIANT_TYPE_ARRAY, - - // arrays - GODOT_VARIANT_TYPE_PACKED_BYTE_ARRAY, - GODOT_VARIANT_TYPE_PACKED_INT32_ARRAY, - GODOT_VARIANT_TYPE_PACKED_INT64_ARRAY, - GODOT_VARIANT_TYPE_PACKED_FLOAT32_ARRAY, - GODOT_VARIANT_TYPE_PACKED_FLOAT64_ARRAY, - GODOT_VARIANT_TYPE_PACKED_STRING_ARRAY, - GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, - GODOT_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, - GODOT_VARIANT_TYPE_PACKED_COLOR_ARRAY, -} godot_variant_type; - -typedef enum godot_variant_call_error_error { - GODOT_CALL_ERROR_CALL_OK, - GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD, - GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT, - GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS, - GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS, - GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL, -} godot_variant_call_error_error; - -typedef struct godot_variant_call_error { - godot_variant_call_error_error error; - int argument; - godot_variant_type expected; -} godot_variant_call_error; - -typedef enum godot_variant_operator { - // comparison - GODOT_VARIANT_OP_EQUAL, - GODOT_VARIANT_OP_NOT_EQUAL, - GODOT_VARIANT_OP_LESS, - GODOT_VARIANT_OP_LESS_EQUAL, - GODOT_VARIANT_OP_GREATER, - GODOT_VARIANT_OP_GREATER_EQUAL, - - // mathematic - GODOT_VARIANT_OP_ADD, - GODOT_VARIANT_OP_SUBTRACT, - GODOT_VARIANT_OP_MULTIPLY, - GODOT_VARIANT_OP_DIVIDE, - GODOT_VARIANT_OP_NEGATE, - GODOT_VARIANT_OP_POSITIVE, - GODOT_VARIANT_OP_MODULE, - GODOT_VARIANT_OP_STRING_CONCAT, - - // bitwise - GODOT_VARIANT_OP_SHIFT_LEFT, - GODOT_VARIANT_OP_SHIFT_RIGHT, - GODOT_VARIANT_OP_BIT_AND, - GODOT_VARIANT_OP_BIT_OR, - GODOT_VARIANT_OP_BIT_XOR, - GODOT_VARIANT_OP_BIT_NEGATE, - - // logic - GODOT_VARIANT_OP_AND, - GODOT_VARIANT_OP_OR, - GODOT_VARIANT_OP_XOR, - GODOT_VARIANT_OP_NOT, - - // containment - GODOT_VARIANT_OP_IN, - - GODOT_VARIANT_OP_MAX, -} godot_variant_operator; - -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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -// 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_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_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); -void GDAPI godot_variant_new_rect2i(godot_variant *r_dest, const godot_rect2i *p_rect2); -void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3); -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_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_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_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); -void GDAPI godot_variant_new_packed_int32_array(godot_variant *r_dest, const godot_packed_int32_array *p_pia); -void GDAPI godot_variant_new_packed_int64_array(godot_variant *r_dest, const godot_packed_int64_array *p_pia); -void GDAPI godot_variant_new_packed_float32_array(godot_variant *r_dest, const godot_packed_float32_array *p_pra); -void GDAPI godot_variant_new_packed_float64_array(godot_variant *r_dest, const godot_packed_float64_array *p_pra); -void GDAPI godot_variant_new_packed_string_array(godot_variant *r_dest, const godot_packed_string_array *p_psa); -void GDAPI godot_variant_new_packed_vector2_array(godot_variant *r_dest, const godot_packed_vector2_array *p_pv2a); -void GDAPI godot_variant_new_packed_vector3_array(godot_variant *r_dest, const godot_packed_vector3_array *p_pv3a); -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); -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_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); -godot_rect2i GDAPI godot_variant_as_rect2i(const godot_variant *p_self); -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_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_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_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); -godot_packed_int32_array GDAPI godot_variant_as_packed_int32_array(const godot_variant *p_self); -godot_packed_int64_array GDAPI godot_variant_as_packed_int64_array(const godot_variant *p_self); -godot_packed_float32_array GDAPI godot_variant_as_packed_float32_array(const godot_variant *p_self); -godot_packed_float64_array GDAPI godot_variant_as_packed_float64_array(const godot_variant *p_self); -godot_packed_string_array GDAPI godot_variant_as_packed_string_array(const godot_variant *p_self); -godot_packed_vector2_array GDAPI godot_variant_as_packed_vector2_array(const godot_variant *p_self); -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); - -void GDAPI godot_variant_destroy(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_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 -} -#endif - -#endif diff --git a/modules/gdnative/include/gdnative/variant_struct.h b/modules/gdnative/include/gdnative/variant_struct.h deleted file mode 100644 index cc75a8c498..0000000000 --- a/modules/gdnative/include/gdnative/variant_struct.h +++ /dev/null @@ -1,53 +0,0 @@ -/*************************************************************************/ -/* variant_struct.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 - -#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 deleted file mode 100644 index f5b55fd4ce..0000000000 --- a/modules/gdnative/include/gdnative/vector2.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************/ -/* vector2.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_VECTOR2_H -#define GODOT_VECTOR2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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 -typedef struct { - uint8_t _dont_touch_that[GODOT_VECTOR2_SIZE]; -} godot_vector2; -#endif - -#define GODOT_VECTOR2I_SIZE (sizeof(int32_t) * 2) - -#ifndef GODOT_CORE_API_GODOT_VECTOR2I_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VECTOR2I_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_VECTOR2I_SIZE]; -} godot_vector2i; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_VECTOR2_H diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h deleted file mode 100644 index d52cd38a72..0000000000 --- a/modules/gdnative/include/gdnative/vector3.h +++ /dev/null @@ -1,73 +0,0 @@ -/*************************************************************************/ -/* vector3.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_VECTOR3_H -#define GODOT_VECTOR3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#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 -typedef struct { - uint8_t _dont_touch_that[GODOT_VECTOR3_SIZE]; -} godot_vector3; -#endif - -#define GODOT_VECTOR3I_SIZE (sizeof(int32_t) * 3) - -#ifndef GODOT_CORE_API_GODOT_VECTOR3I_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VECTOR3I_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_VECTOR3I_SIZE]; -} godot_vector3i; -#endif - -#include - -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 -} -#endif - -#endif // GODOT_VECTOR3_H diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h deleted file mode 100644 index 879291c2e0..0000000000 --- a/modules/gdnative/include/nativescript/godot_nativescript.h +++ /dev/null @@ -1,233 +0,0 @@ -/*************************************************************************/ -/* godot_nativescript.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_NATIVESCRIPT_H -#define GODOT_NATIVESCRIPT_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - GODOT_METHOD_RPC_MODE_DISABLED, - GODOT_METHOD_RPC_MODE_ANY_PEER, - GODOT_METHOD_RPC_MODE_AUTHORITY, -} godot_nativescript_method_rpc_mode; - -typedef enum { - GODOT_PROPERTY_HINT_NONE, ///< no hint provided. - GODOT_PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional" - GODOT_PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit - GODOT_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc" - GODOT_PROPERTY_HINT_EXP_EASING, /// exponential easing function (Math::ease) - GODOT_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer) - GODOT_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer) - 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," - GODOT_PROPERTY_HINT_GLOBAL_DIR, ///< a directory path must be passed - GODOT_PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type - GODOT_PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines - GODOT_PROPERTY_HINT_PLACEHOLDER_TEXT, ///< used to set a placeholder text for string properties - GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color - GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY, - GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS, - GODOT_PROPERTY_HINT_OBJECT_ID, - GODOT_PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose - GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts) - GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type - GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type - GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance - GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base - GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type - GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type - GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance - GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base - GODOT_PROPERTY_HINT_LOCALE_ID, - GODOT_PROPERTY_HINT_MAX, -} godot_nativescript_property_hint; - -typedef enum { - GODOT_PROPERTY_USAGE_STORAGE = 1, - GODOT_PROPERTY_USAGE_EDITOR = 2, - GODOT_PROPERTY_USAGE_NETWORK = 4, - GODOT_PROPERTY_USAGE_EDITOR_HELPER = 8, - GODOT_PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables - GODOT_PROPERTY_USAGE_CHECKED = 32, //used for editing global variables - GODOT_PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings - GODOT_PROPERTY_USAGE_GROUP = 128, //used for grouping props in the editor - GODOT_PROPERTY_USAGE_CATEGORY = 256, - GODOT_PROPERTY_USAGE_SUBGROUP = 512, - GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE = 2048, - GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED = 4096, - GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE = 8192, - GODOT_PROPERTY_USAGE_STORE_IF_NULL = 16384, - GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768, - GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536, - - GODOT_PROPERTY_USAGE_DEFAULT = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK, - GODOT_PROPERTY_USAGE_DEFAULT_INTL = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED, - GODOT_PROPERTY_USAGE_NO_EDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK, -} godot_nativescript_property_usage_flags; - -typedef struct { - godot_nativescript_method_rpc_mode rset_type; - - godot_int type; - godot_nativescript_property_hint hint; - godot_string hint_string; - godot_nativescript_property_usage_flags usage; - godot_variant default_value; -} godot_nativescript_property_attributes; - -typedef struct { - // instance pointer, method_data - return user data - GDCALLINGCONV void *(*create_func)(godot_object *, void *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_nativescript_instance_create_func; - -typedef struct { - // instance pointer, method data, user data - GDCALLINGCONV void (*destroy_func)(godot_object *, void *, void *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_nativescript_instance_destroy_func; - -void GDAPI godot_nativescript_register_class(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); - -void GDAPI godot_nativescript_register_tool_class(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); - -typedef struct { - godot_nativescript_method_rpc_mode rpc_type; -} godot_nativescript_method_attributes; - -typedef struct { - godot_string name; - - godot_variant_type type; - godot_nativescript_property_hint hint; - godot_string hint_string; -} godot_nativescript_method_argument; - -typedef struct { - // instance pointer, method data, user data, num args, args - return result as variant - GDCALLINGCONV godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_nativescript_instance_method; - -void GDAPI godot_nativescript_register_method(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); -void GDAPI godot_nativescript_set_method_argument_information(void *p_gdnative_handle, const char *p_name, const char *p_function_name, int p_num_args, const godot_nativescript_method_argument *p_args); - -typedef struct { - // instance pointer, method data, user data, value - GDCALLINGCONV void (*set_func)(godot_object *, void *, void *, godot_variant *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_nativescript_property_set_func; - -typedef struct { - // instance pointer, method data, user data, value - GDCALLINGCONV godot_variant (*get_func)(godot_object *, void *, void *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_nativescript_property_get_func; - -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); - -typedef struct { - godot_string name; - godot_int type; - godot_nativescript_property_hint hint; - godot_string hint_string; - godot_nativescript_property_usage_flags usage; - godot_variant default_value; -} godot_nativescript_signal_argument; - -typedef struct { - godot_string name; - int num_args; - godot_nativescript_signal_argument *args; - int num_default_args; - godot_variant *default_args; -} godot_nativescript_signal; - -void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_nativescript_signal *p_signal); - -void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance); - -// documentation - -void GDAPI godot_nativescript_set_class_documentation(void *p_gdnative_handle, const char *p_name, godot_string p_documentation); -void GDAPI godot_nativescript_set_method_documentation(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_string p_documentation); -void GDAPI godot_nativescript_set_property_documentation(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_string p_documentation); -void GDAPI godot_nativescript_set_signal_documentation(void *p_gdnative_handle, const char *p_name, const char *p_signal_name, godot_string p_documentation); - -// type tag API - -void GDAPI godot_nativescript_set_global_type_tag(int p_idx, const char *p_name, const void *p_type_tag); -const void GDAPI *godot_nativescript_get_global_type_tag(int p_idx, const char *p_name); - -void GDAPI godot_nativescript_set_type_tag(void *p_gdnative_handle, const char *p_name, const void *p_type_tag); -const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object); - -// instance binding API - -typedef struct { - GDCALLINGCONV void *(*alloc_instance_binding_data)(void *, const void *, godot_object *); - GDCALLINGCONV void (*free_instance_binding_data)(void *, void *); - GDCALLINGCONV void (*refcount_incremented_instance_binding)(void *, godot_object *); - GDCALLINGCONV bool (*refcount_decremented_instance_binding)(void *, godot_object *); - void *data; - GDCALLINGCONV void (*free_func)(void *); -} godot_nativescript_instance_binding_functions; - -int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_nativescript_instance_binding_functions p_binding_functions); -void GDAPI godot_nativescript_unregister_instance_binding_data_functions(int p_idx); - -void GDAPI *godot_nativescript_get_instance_binding_data(int p_idx, godot_object *p_object); - -void GDAPI godot_nativescript_profiling_add_data(const char *p_signature, uint64_t p_time); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/modules/gdnative/include/pluginscript/godot_pluginscript.h b/modules/gdnative/include/pluginscript/godot_pluginscript.h deleted file mode 100644 index 0042d79966..0000000000 --- a/modules/gdnative/include/pluginscript/godot_pluginscript.h +++ /dev/null @@ -1,171 +0,0 @@ -/*************************************************************************/ -/* godot_pluginscript.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_PLUGINSCRIPT_H -#define GODOT_PLUGINSCRIPT_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void godot_pluginscript_instance_data; -typedef void godot_pluginscript_script_data; -typedef void godot_pluginscript_language_data; - -// --- Instance --- - -typedef struct { - godot_pluginscript_instance_data *(*init)(godot_pluginscript_script_data *p_data, godot_object *p_owner); - void (*finish)(godot_pluginscript_instance_data *p_data); - - godot_bool (*set_prop)(godot_pluginscript_instance_data *p_data, const godot_string_name *p_name, const godot_variant *p_value); - godot_bool (*get_prop)(godot_pluginscript_instance_data *p_data, const godot_string_name *p_name, godot_variant *r_ret); - - godot_variant (*call_method)(godot_pluginscript_instance_data *p_data, - const godot_string_name *p_method, const godot_variant **p_args, - 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. - 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; - -// --- Script --- - -typedef struct { - godot_pluginscript_script_data *data; - godot_string_name name; - godot_bool is_tool; - godot_string_name base; - godot_string icon_path; - - // Member lines format: {: } - godot_dictionary member_lines; - // Method info dictionary format - // { - // name: - // args: [] - // default_args: [] - // return: - // flags: - // rpc_mode: - // } - godot_array methods; - // Same format than for methods - godot_array signals; - // Property info dictionary format - // { - // name: - // type: - // hint: - // hint_string: - // usage: - // default_value: - // rset_mode: - // } - godot_array properties; -} godot_pluginscript_script_manifest; - -typedef struct { - godot_pluginscript_script_manifest (*init)(godot_pluginscript_language_data *p_data, const godot_string *p_path, const godot_string *p_source, godot_error *r_error); - void (*finish)(godot_pluginscript_script_data *p_data); - godot_pluginscript_instance_desc instance_desc; -} godot_pluginscript_script_desc; - -// --- Language --- - -typedef struct { - godot_string_name signature; - godot_int call_count; - godot_int total_time; // In microseconds - godot_int self_time; // In microseconds -} godot_pluginscript_profiling_data; - -typedef struct { - const char *name; - const char *type; - const char *extension; - 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 - 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, 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); - void (*auto_indent_code)(godot_pluginscript_language_data *p_data, godot_string *p_code, int p_from_line, int p_to_line); - - void (*add_global_constant)(godot_pluginscript_language_data *p_data, const godot_string_name *p_variable, const godot_variant *p_value); - godot_string (*debug_get_error)(godot_pluginscript_language_data *p_data); - int (*debug_get_stack_level_count)(godot_pluginscript_language_data *p_data); - int (*debug_get_stack_level_line)(godot_pluginscript_language_data *p_data, int p_level); - godot_string (*debug_get_stack_level_function)(godot_pluginscript_language_data *p_data, int p_level); - godot_string (*debug_get_stack_level_source)(godot_pluginscript_language_data *p_data, int p_level); - void (*debug_get_stack_level_locals)(godot_pluginscript_language_data *p_data, int p_level, godot_packed_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); - void (*debug_get_stack_level_members)(godot_pluginscript_language_data *p_data, int p_level, godot_packed_string_array *p_members, godot_array *p_values, int p_max_subitems, int p_max_depth); - void (*debug_get_globals)(godot_pluginscript_language_data *p_data, godot_packed_string_array *p_locals, godot_array *p_values, int p_max_subitems, int p_max_depth); - godot_string (*debug_parse_stack_level_expression)(godot_pluginscript_language_data *p_data, int p_level, const godot_string *p_expression, int p_max_subitems, int p_max_depth); - - // TODO: could this stuff be moved to the godot_pluginscript_language_desc ? - void (*get_public_functions)(godot_pluginscript_language_data *p_data, godot_array *r_functions); - void (*get_public_constants)(godot_pluginscript_language_data *p_data, godot_dictionary *r_constants); - - void (*profiling_start)(godot_pluginscript_language_data *p_data); - void (*profiling_stop)(godot_pluginscript_language_data *p_data); - int (*profiling_get_accumulated_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); - int (*profiling_get_frame_data)(godot_pluginscript_language_data *p_data, godot_pluginscript_profiling_data *r_info, int p_info_max); - void (*profiling_frame)(godot_pluginscript_language_data *p_data); - - godot_pluginscript_script_desc script_desc; -} godot_pluginscript_language_desc; - -void GDAPI godot_pluginscript_register_language(const godot_pluginscript_language_desc *language_desc); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_PLUGINSCRIPT_H diff --git a/modules/gdnative/include/videodecoder/godot_videodecoder.h b/modules/gdnative/include/videodecoder/godot_videodecoder.h deleted file mode 100644 index 16daba0a67..0000000000 --- a/modules/gdnative/include/videodecoder/godot_videodecoder.h +++ /dev/null @@ -1,75 +0,0 @@ -/*************************************************************************/ -/* godot_videodecoder.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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_NATIVEVIDEODECODER_H -#define GODOT_NATIVEVIDEODECODER_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define GODOTAV_API_MAJOR 0 -#define GODOTAV_API_MINOR 1 - -typedef struct -{ - godot_gdnative_api_version version; - void *next; - void *(*constructor)(godot_object *); - void (*destructor)(void *); - 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_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_float); - godot_packed_byte_array *(*get_videoframe)(void *); - godot_int (*get_audioframe)(void *, float *, int); - godot_int (*get_channels)(const void *); - godot_int (*get_mix_rate)(const void *); - godot_vector2 (*get_texture_size)(const void *); -} godot_videodecoder_interface_gdnative; - -typedef int (*GDNativeAudioMixCallback)(void *, const float *, int); - -// FileAccess wrappers for custom FFmpeg IO -godot_int GDAPI godot_videodecoder_file_read(void *file_ptr, uint8_t *buf, int buf_size); -int64_t GDAPI godot_videodecoder_file_seek(void *file_ptr, int64_t pos, int whence); -void GDAPI godot_videodecoder_register_decoder(const godot_videodecoder_interface_gdnative *p_interface); - -#ifdef __cplusplus -} -#endif - -#endif /* GODOT_NATIVEVIDEODECODER_H */ diff --git a/modules/gdnative/nativescript/SCsub b/modules/gdnative/nativescript/SCsub deleted file mode 100644 index 4212e87a87..0000000000 --- a/modules/gdnative/nativescript/SCsub +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python - -Import("env") -Import("env_gdnative") - -env_gdnative.add_source_files(env.modules_sources, "*.cpp") - -if "platform" in env and env["platform"] in ["linuxbsd", "iphone"]: - env.Append(LINKFLAGS=["-rdynamic"]) diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp deleted file mode 100644 index 0309d1d9c7..0000000000 --- a/modules/gdnative/nativescript/api_generator.cpp +++ /dev/null @@ -1,948 +0,0 @@ -/*************************************************************************/ -/* api_generator.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 "api_generator.h" - -#ifdef TOOLS_ENABLED - -#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 - -static Error save_file(const String &p_path, const List &p_content) { - FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE); - - ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE); - - for (const List::Element *e = p_content.front(); e != nullptr; e = e->next()) { - file->store_string(e->get()); - } - - file->close(); - - return OK; -} - -// helper stuff end - -struct MethodAPI { - String method_name; - String return_type; - - List argument_types; - List argument_names; - - Map default_arguments; - - 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 { - String name; - String getter; - String setter; - String type; - int index = 0; -}; - -struct ConstantAPI { - String constant_name; - int constant_value = 0; - Variant builtin_constant_value; // For builtin types; - String builtin_constant_type; // For builtin types; -}; - -struct SignalAPI { - String name; - List argument_types; - List argument_names; - Map default_arguments; -}; - -struct EnumAPI { - String name; - List> 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::API_NONE; - - bool is_singleton = false; - String singleton_name; - bool is_instantiable = false; - // @Unclear - 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 methods; - List constructors; // For builtin types. - List properties; - List constants; - List signals_; - List enums; - List operators; // For builtin types. -}; - -static String get_type_name(const PropertyInfo &info) { - if (info.type == Variant::INT && (info.usage & PROPERTY_USAGE_CLASS_IS_ENUM)) { - return String("enum.") + String(info.class_name).replace(".", "::"); - } - if (info.class_name != StringName()) { - return info.class_name; - } - if (info.hint == PROPERTY_HINT_RESOURCE_TYPE) { - return info.class_name; - } - if (info.type == Variant::NIL && (info.usage & PROPERTY_USAGE_NIL_IS_VARIANT)) { - return "Variant"; - } - if (info.type == Variant::NIL) { - return "void"; - } - return Variant::get_type_name(info.type); -} - -/* - * Some comparison helper functions we need - */ - -struct MethodInfoComparator { - StringName::AlphCompare compare; - bool operator()(const MethodInfo &p_a, const MethodInfo &p_b) const { - return compare(p_a.name, p_b.name); - } -}; - -struct PropertyInfoComparator { - StringName::AlphCompare compare; - bool operator()(const PropertyInfo &p_a, const PropertyInfo &p_b) const { - return compare(p_a.name, p_b.name); - } -}; - -struct ConstantAPIComparator { - NoCaseComparator compare; - bool operator()(const ConstantAPI &p_a, const ConstantAPI &p_b) const { - return compare(p_a.constant_name, p_b.constant_name); - } -}; - -/* - * Reads the entire Godot API to a list - */ -List generate_c_api_classes() { - List api; - - List classes; - ClassDB::get_class_list(&classes); - classes.sort_custom(); - - // Register global constants as a fake CoreConstants singleton class - { - ClassAPI global_constants_api; - 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 = "CoreConstants"; - global_constants_api.is_instantiable = false; - const int constants_count = CoreConstants::get_global_constant_count(); - - Map enum_api_map; - for (int i = 0; i < constants_count; ++i) { - 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 KeyValue &E : enum_api_map) { - global_constants_api.enums.push_back(E.value); - } - global_constants_api.constants.sort_custom(); - api.push_back(global_constants_api); - } - - for (List::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); - { - class_api.is_singleton = Engine::get_singleton()->has_singleton(class_name); - if (class_api.is_singleton) { - class_api.singleton_name = class_name; - } - } - class_api.is_instantiable = !class_api.is_singleton && ClassDB::can_instantiate(class_name); - - { - List inheriters; - ClassDB::get_inheriters_from_class("RefCounted", &inheriters); - bool is_ref_counted = !!inheriters.find(class_name) || class_name == "RefCounted"; - // @Unclear - class_api.is_ref_counted = !class_api.is_singleton && is_ref_counted; - } - - // constants - { - List constant; - ClassDB::get_integer_constant_list(class_name, &constant, true); - constant.sort_custom(); - for (List::Element *c = constant.front(); c != nullptr; c = c->next()) { - ConstantAPI constant_api; - constant_api.constant_name = c->get(); - constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get()); - - class_api.constants.push_back(constant_api); - } - } - - // signals - { - List signals_; - ClassDB::get_signal_list(class_name, &signals_, true); - signals_.sort_custom(); - - for (int i = 0; i < signals_.size(); i++) { - SignalAPI signal; - - MethodInfo method_info = signals_[i]; - signal.name = method_info.name; - - for (int j = 0; j < method_info.arguments.size(); j++) { - PropertyInfo argument = method_info.arguments[j]; - String type; - String name = argument.name; - - if (argument.name.contains(":")) { - type = argument.name.get_slice(":", 1); - name = argument.name.get_slice(":", 0); - } else { - type = get_type_name(argument); - } - - signal.argument_names.push_back(name); - signal.argument_types.push_back(type); - } - - Vector default_arguments = method_info.default_arguments; - - int default_start = signal.argument_names.size() - default_arguments.size(); - - for (int j = 0; j < default_arguments.size(); j++) { - signal.default_arguments[default_start + j] = default_arguments[j]; - } - - class_api.signals_.push_back(signal); - } - } - - //properties - { - List properties; - ClassDB::get_property_list(class_name, &properties, true); - properties.sort_custom(); - - for (List::Element *p = properties.front(); p != nullptr; p = p->next()) { - PropertyAPI property_api; - - property_api.name = p->get().name; - property_api.getter = ClassDB::get_property_getter(class_name, p->get().name); - property_api.setter = ClassDB::get_property_setter(class_name, p->get().name); - - if (p->get().name.contains(":")) { - property_api.type = p->get().name.get_slice(":", 1); - property_api.name = p->get().name.get_slice(":", 0); - } else { - 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.is_empty() || !property_api.getter.is_empty()) { - class_api.properties.push_back(property_api); - } - } - } - - //methods - { - List methods; - ClassDB::get_method_list(class_name, &methods, true); - methods.sort_custom(); - - for (List::Element *m = methods.front(); m != nullptr; m = m->next()) { - MethodAPI method_api; - MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name); - MethodInfo &method_info = m->get(); - - //method name - method_api.method_name = method_info.name; - //method return type - if (method_api.method_name.contains(":")) { - method_api.return_type = method_api.method_name.get_slice(":", 1); - method_api.method_name = method_api.method_name.get_slice(":", 0); - } else { - method_api.return_type = get_type_name(m->get().return_val); - } - - method_api.argument_count = method_info.arguments.size(); - method_api.has_varargs = method_bind && method_bind->is_vararg(); - - // Method flags - method_api.is_virtual = false; - if (method_info.flags) { - const uint32_t flags = method_info.flags; - method_api.is_editor = flags & METHOD_FLAG_EDITOR; - method_api.is_noscript = flags & METHOD_FLAG_NOSCRIPT; - method_api.is_const = flags & METHOD_FLAG_CONST; - method_api.is_reverse = flags & METHOD_FLAG_REVERSE; - method_api.is_virtual = flags & METHOD_FLAG_VIRTUAL; - method_api.is_from_script = flags & METHOD_FLAG_FROM_SCRIPT; - } - - method_api.is_virtual = method_api.is_virtual || method_api.method_name[0] == '_'; - - // method argument name and type - - for (int i = 0; i < method_api.argument_count; i++) { - String arg_name; - String arg_type; - PropertyInfo arg_info = method_info.arguments[i]; - - arg_name = arg_info.name; - - if (arg_info.name.contains(":")) { - 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.class_name; - } else if (arg_info.type == Variant::NIL) { - arg_type = "Variant"; - } else if (arg_info.type == Variant::OBJECT) { - arg_type = arg_info.class_name; - if (arg_type.is_empty()) { - arg_type = Variant::get_type_name(arg_info.type); - } - } else { - arg_type = get_type_name(arg_info); - } - - method_api.argument_names.push_back(arg_name); - method_api.argument_types.push_back(arg_type); - - if (method_bind && method_bind->has_default_argument(i)) { - method_api.default_arguments[i] = method_bind->get_default_argument(i); - } - } - - class_api.methods.push_back(method_api); - } - } - - // enums - { - List enums; - List enum_names; - ClassDB::get_enum_list(class_name, &enum_names, true); - for (const StringName &E : enum_names) { - List value_names; - EnumAPI enum_api; - enum_api.name = E; - ClassDB::get_enum_constants(class_name, E, &value_names, true); - for (List::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_val, val_e->get())); - } - enum_api.values.sort_custom>(); - class_api.enums.push_back(enum_api); - } - } - - api.push_back(class_api); - } - - return api; -} - -/* - * Reads the builtin Variant API to a list - */ -List generate_c_builtin_api_types() { - List api; - - // Special class for the utility methods. - { - ClassAPI utility_api; - utility_api.class_name = "Utilities"; - utility_api.is_instantiable = false; - - List 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 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 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 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 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 generate_c_api_json(const List &p_api) { - // I'm sorry for the \t mess - - List source; - VariantWriter writer; - - source.push_back("[\n"); - - for (const List::Element *c = p_api.front(); c != nullptr; c = c->next()) { - ClassAPI api = c->get(); - - source.push_back("\t{\n"); - - source.push_back("\t\t\"name\": \"" + api.class_name + "\",\n"); - source.push_back("\t\t\"base_class\": \"" + api.super_class_name + "\",\n"); - 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\"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::Element *e = api.constants.front(); e; e = e->next()) { - source.push_back("\t\t\t\"" + e->get().constant_name + "\": " + String::num_int64(e->get().constant_value) + (e->next() ? "," : "") + "\n"); - } - source.push_back("\t\t},\n"); - - source.push_back("\t\t\"properties\": [\n"); - for (List::Element *e = api.properties.front(); e; e = e->next()) { - source.push_back("\t\t\t{\n"); - source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); - source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n"); - source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n"); - source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\",\n"); - source.push_back(String("\t\t\t\t\"index\": ") + itos(e->get().index) + "\n"); - source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); - } - source.push_back("\t\t],\n"); - - source.push_back("\t\t\"signals\": [\n"); - for (List::Element *e = api.signals_.front(); e; e = e->next()) { - source.push_back("\t\t\t{\n"); - source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); - source.push_back("\t\t\t\t\"arguments\": [\n"); - for (int i = 0; i < e->get().argument_names.size(); i++) { - source.push_back("\t\t\t\t\t{\n"); - 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"); - 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"); - source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); - } - source.push_back("\t\t],\n"); - - source.push_back("\t\t\"methods\": [\n"); - for (List::Element *e = api.methods.front(); e; e = e->next()) { - source.push_back("\t\t\t{\n"); - source.push_back("\t\t\t\t\"name\": \"" + e->get().method_name + "\",\n"); - source.push_back("\t\t\t\t\"return_type\": \"" + e->get().return_type + "\",\n"); - source.push_back(String("\t\t\t\t\"is_editor\": ") + (e->get().is_editor ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\t\t\"is_noscript\": ") + (e->get().is_noscript ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\t\t\"is_const\": ") + (e->get().is_const ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\t\t\"is_reverse\": ") + (e->get().is_reverse ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\t\t\"is_virtual\": ") + (e->get().is_virtual ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\t\t\"has_varargs\": ") + (e->get().has_varargs ? "true" : "false") + ",\n"); - source.push_back(String("\t\t\t\t\"is_from_script\": ") + (e->get().is_from_script ? "true" : "false") + ",\n"); - source.push_back("\t\t\t\t\"arguments\": [\n"); - for (int i = 0; i < e->get().argument_names.size(); i++) { - source.push_back("\t\t\t\t\t{\n"); - 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"); - 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"); - source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); - } - source.push_back("\t\t],\n"); - - source.push_back("\t\t\"enums\": [\n"); - for (List::Element *e = api.enums.front(); e; e = e->next()) { - source.push_back("\t\t\t{\n"); - source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n"); - source.push_back("\t\t\t\t\"values\": {\n"); - for (List>::Element *val_e = e->get().values.front(); val_e; val_e = val_e->next()) { - source.push_back("\t\t\t\t\t\"" + val_e->get().second + "\": " + itos(val_e->get().first)); - source.push_back(String((val_e->next() ? "," : "")) + "\n"); - } - source.push_back("\t\t\t\t}\n"); - source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n"); - } - source.push_back("\t\t]\n"); - - source.push_back(String("\t}") + (c->next() ? "," : "") + "\n"); - } - source.push_back("]"); - - 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 generate_c_builtin_api_json(const List &p_api) { - StringBuilder source; - - source.append("[\n"); - - indent_level = 1; - - for (const List::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::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::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::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::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::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 result; - result.push_back(source.as_string()); - return result; -} - -#endif - -/* - * Saves the whole Godot API to a JSON file located at - * p_path - */ -Error generate_c_api(const String &p_path) { -#ifndef TOOLS_ENABLED - return ERR_BUG; -#else - - List api = generate_c_api_classes(); - - List json_source = generate_c_api_json(api); - - 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 api = generate_c_builtin_api_types(); - - List 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 deleted file mode 100644 index 58e141f07e..0000000000 --- a/modules/gdnative/nativescript/api_generator.h +++ /dev/null @@ -1,40 +0,0 @@ -/*************************************************************************/ -/* api_generator.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 API_GENERATOR_H -#define API_GENERATOR_H - -#include "core/string/ustring.h" -#include "core/typedefs.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 deleted file mode 100644 index 992eeba8f4..0000000000 --- a/modules/gdnative/nativescript/godot_nativescript.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/*************************************************************************/ -/* godot_nativescript.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 "nativescript/godot_nativescript.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 - -#include "nativescript.h" - -#ifdef __cplusplus -extern "C" { -#endif - -extern "C" void _native_script_hook() { -} - -#define NSL NativeScriptLanguage::get_singleton() - -// Script API - -void GDAPI godot_nativescript_register_class(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) { - String *s = (String *)p_gdnative_handle; - - Map *classes = &NSL->library_classes[*s]; - - NativeScriptDesc desc; - - desc.create_func = p_create_func; - desc.destroy_func = p_destroy_func; - desc.is_tool = false; - - desc.base = p_base; - - if (classes->has(p_base)) { - desc.base_data = &(*classes)[p_base]; - desc.base_native_type = desc.base_data->base_native_type; - - const NativeScriptDesc *b = desc.base_data; - while (b) { - desc.rpc_methods.append_array(b->rpc_methods); - b = b->base_data; - } - - } else { - desc.base_data = nullptr; - desc.base_native_type = p_base; - } - - classes->insert(p_name, desc); -} - -void GDAPI godot_nativescript_register_tool_class(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) { - String *s = (String *)p_gdnative_handle; - - Map *classes = &NSL->library_classes[*s]; - - NativeScriptDesc desc; - - desc.create_func = p_create_func; - desc.destroy_func = p_destroy_func; - desc.is_tool = true; - desc.base = p_base; - - if (classes->has(p_base)) { - desc.base_data = &(*classes)[p_base]; - desc.base_native_type = desc.base_data->base_native_type; - - const NativeScriptDesc *b = desc.base_data; - while (b) { - desc.rpc_methods.append_array(b->rpc_methods); - b = b->base_data; - } - - } else { - desc.base_data = nullptr; - desc.base_native_type = p_base; - } - - classes->insert(p_name, desc); -} - -void GDAPI godot_nativescript_register_method(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) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to register method on non-existent class."); - - NativeScriptDesc::Method method; - method.method = p_method; - method.rpc_mode = p_attr.rpc_type; - method.rpc_method_id = UINT16_MAX; - method.info = MethodInfo(p_function_name); - - E->get().methods.insert(p_function_name, method); - - if (p_attr.rpc_type != GODOT_METHOD_RPC_MODE_DISABLED) { - Multiplayer::RPCConfig nd; - nd.name = String(p_name); - nd.rpc_mode = Multiplayer::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) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to register method on non-existent class."); - - NativeScriptDesc::Property property; - property.default_value = *(Variant *)&p_attr->default_value; - property.getter = p_get_func; - property.setter = p_set_func; - property.info = PropertyInfo((Variant::Type)p_attr->type, - p_path, - (PropertyHint)p_attr->hint, - *(String *)&p_attr->hint_string, - (PropertyUsageFlags)p_attr->usage); - - E->get().properties.insert(p_path, property); -} - -void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_nativescript_signal *p_signal) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to register method on non-existent class."); - - List args; - Vector default_args; - - for (int i = 0; i < p_signal->num_args; i++) { - PropertyInfo info; - - godot_nativescript_signal_argument arg = p_signal->args[i]; - - info.hint = (PropertyHint)arg.hint; - info.hint_string = *(String *)&arg.hint_string; - info.name = *(String *)&arg.name; - info.type = (Variant::Type)arg.type; - info.usage = (PropertyUsageFlags)arg.usage; - - args.push_back(info); - } - - for (int i = 0; i < p_signal->num_default_args; i++) { - Variant *v; - godot_nativescript_signal_argument attrib = p_signal->args[i]; - - v = (Variant *)&attrib.default_value; - - default_args.push_back(*v); - } - - MethodInfo method_info; - method_info.name = *(String *)&p_signal->name; - method_info.arguments = args; - method_info.default_arguments = default_args; - - NativeScriptDesc::Signal signal; - signal.signal = method_info; - - E->get().signals_.insert(*(String *)&p_signal->name, signal); -} - -void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance) { - Object *instance = (Object *)p_instance; - if (!instance) { - return nullptr; - } - if (instance->get_script_instance() && instance->get_script_instance()->get_language() == NativeScriptLanguage::get_singleton()) { - return ((NativeScriptInstance *)instance->get_script_instance())->userdata; - } - return nullptr; -} - -/* - * - * - * NativeScript 1.1 - * - * - */ - -void GDAPI godot_nativescript_set_method_argument_information(void *p_gdnative_handle, const char *p_name, const char *p_function_name, int p_num_args, const godot_nativescript_method_argument *p_args) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to add argument information for a method on a non-existent class."); - - Map::Element *method = E->get().methods.find(p_function_name); - ERR_FAIL_COND_MSG(!method, "Attempted to add argument information to non-existent method."); - - MethodInfo *method_information = &method->get().info; - - List args; - - for (int i = 0; i < p_num_args; i++) { - godot_nativescript_method_argument arg = p_args[i]; - String name = *(String *)&arg.name; - String hint_string = *(String *)&arg.hint_string; - - Variant::Type type = (Variant::Type)arg.type; - PropertyHint hint = (PropertyHint)arg.hint; - - args.push_back(PropertyInfo(type, p_name, hint, hint_string)); - } - - method_information->arguments = args; -} - -void GDAPI godot_nativescript_set_class_documentation(void *p_gdnative_handle, const char *p_name, godot_string p_documentation) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a non-existent class."); - - E->get().documentation = *(String *)&p_documentation; -} - -void GDAPI godot_nativescript_set_method_documentation(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_string p_documentation) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a method on a non-existent class."); - - Map::Element *method = E->get().methods.find(p_function_name); - ERR_FAIL_COND_MSG(!method, "Attempted to add documentation to non-existent method."); - - method->get().documentation = *(String *)&p_documentation; -} - -void GDAPI godot_nativescript_set_property_documentation(void *p_gdnative_handle, const char *p_name, const char *p_path, godot_string p_documentation) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a property on a non-existent class."); - - OrderedHashMap::Element property = E->get().properties.find(p_path); - ERR_FAIL_COND_MSG(!property, "Attempted to add documentation to non-existent property."); - - property.get().documentation = *(String *)&p_documentation; -} - -void GDAPI godot_nativescript_set_signal_documentation(void *p_gdnative_handle, const char *p_name, const char *p_signal_name, godot_string p_documentation) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to add documentation to a signal on a non-existent class."); - - Map::Element *signal = E->get().signals_.find(p_signal_name); - ERR_FAIL_COND_MSG(!signal, "Attempted to add documentation to non-existent signal."); - - signal->get().documentation = *(String *)&p_documentation; -} - -void GDAPI godot_nativescript_set_global_type_tag(int p_idx, const char *p_name, const void *p_type_tag) { - NativeScriptLanguage::get_singleton()->set_global_type_tag(p_idx, StringName(p_name), p_type_tag); -} - -const void GDAPI *godot_nativescript_get_global_type_tag(int p_idx, const char *p_name) { - return NativeScriptLanguage::get_singleton()->get_global_type_tag(p_idx, StringName(p_name)); -} - -void GDAPI godot_nativescript_set_type_tag(void *p_gdnative_handle, const char *p_name, const void *p_type_tag) { - String *s = (String *)p_gdnative_handle; - - Map::Element *E = NSL->library_classes[*s].find(p_name); - ERR_FAIL_COND_MSG(!E, "Attempted to set type tag on a non-existent class."); - - E->get().type_tag = p_type_tag; -} - -const void GDAPI *godot_nativescript_get_type_tag(const godot_object *p_object) { - const Object *o = (Object *)p_object; - - if (!o->get_script_instance()) { - return nullptr; - } else { - NativeScript *script = Object::cast_to(o->get_script_instance()->get_script().ptr()); - if (!script) { - return nullptr; - } - - if (script->get_script_desc()) { - return script->get_script_desc()->type_tag; - } - } - - return nullptr; -} - -int GDAPI godot_nativescript_register_instance_binding_data_functions(godot_nativescript_instance_binding_functions p_binding_functions) { - return NativeScriptLanguage::get_singleton()->register_binding_functions(p_binding_functions); -} - -void GDAPI godot_nativescript_unregister_instance_binding_data_functions(int p_idx) { - NativeScriptLanguage::get_singleton()->unregister_binding_functions(p_idx); -} - -void GDAPI *godot_nativescript_get_instance_binding_data(int p_idx, godot_object *p_object) { - return nullptr; -} - -void GDAPI godot_nativescript_profiling_add_data(const char *p_signature, uint64_t p_time) { - NativeScriptLanguage::get_singleton()->profiling_add_data(StringName(p_signature), p_time); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp deleted file mode 100644 index 95976a8827..0000000000 --- a/modules/gdnative/nativescript/nativescript.cpp +++ /dev/null @@ -1,1777 +0,0 @@ -/*************************************************************************/ -/* nativescript.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2022 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 "nativescript.h" - -#include - -#include "gdnative/gdnative.h" - -#include "core/config/project_settings.h" -#include "core/core_constants.h" -#include "core/core_string_names.h" -#include "core/io/file_access.h" -#include "core/io/file_access_encrypted.h" -#include "core/os/os.h" - -#include "main/main.h" - -#include "scene/main/scene_tree.h" -#include "scene/resources/resource_format_text.h" - -#include - -#ifndef NO_THREADS -#include "core/os/thread.h" -#endif - -#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) -#include "api_generator.h" -#endif - -#ifdef TOOLS_ENABLED -#include "editor/editor_node.h" -#endif - -void NativeScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_class_name", "class_name"), &NativeScript::set_class_name); - ClassDB::bind_method(D_METHOD("get_class_name"), &NativeScript::get_class_name); - - ClassDB::bind_method(D_METHOD("set_library", "library"), &NativeScript::set_library); - ClassDB::bind_method(D_METHOD("get_library"), &NativeScript::get_library); - - ClassDB::bind_method(D_METHOD("set_script_class_name", "class_name"), &NativeScript::set_script_class_name); - ClassDB::bind_method(D_METHOD("get_script_class_name"), &NativeScript::get_script_class_name); - ClassDB::bind_method(D_METHOD("set_script_class_icon_path", "icon_path"), &NativeScript::set_script_class_icon_path); - ClassDB::bind_method(D_METHOD("get_script_class_icon_path"), &NativeScript::get_script_class_icon_path); - - ClassDB::bind_method(D_METHOD("get_class_documentation"), &NativeScript::get_class_documentation); - ClassDB::bind_method(D_METHOD("get_method_documentation", "method"), &NativeScript::get_method_documentation); - ClassDB::bind_method(D_METHOD("get_signal_documentation", "signal_name"), &NativeScript::get_signal_documentation); - ClassDB::bind_method(D_METHOD("get_property_documentation", "path"), &NativeScript::get_property_documentation); - - ADD_PROPERTY(PropertyInfo(Variant::STRING, "class_name"), "set_class_name", "get_class_name"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); - ADD_GROUP("Script Class", "script_class_"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "script_class_name"), "set_script_class_name", "get_script_class_name"); - ADD_PROPERTY(PropertyInfo(Variant::STRING, "script_class_icon_path", PROPERTY_HINT_FILE), "set_script_class_icon_path", "get_script_class_icon_path"); - - ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &NativeScript::_new, MethodInfo("new")); -} - -#define NSL NativeScriptLanguage::get_singleton() - -#ifdef TOOLS_ENABLED - -void NativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { - NativeScriptDesc *script_data = get_script_desc(); - - ERR_FAIL_COND(!script_data); - - List info; - get_script_property_list(&info); - Map values; - for (const PropertyInfo &E : info) { - Variant value; - get_property_default_value(E.name, value); - values[E.name] = value; - } - - p_placeholder->update(info, values); -} - -void NativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { - placeholders.erase(p_placeholder); -} - -#endif - -bool NativeScript::inherits_script(const Ref