summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/dds/texture_loader_dds.cpp10
-rw-r--r--modules/dlscript/api_generator.h9
-rw-r--r--modules/dlscript/godot/godot_basis.cpp58
-rw-r--r--modules/dlscript/godot/godot_basis.h34
-rw-r--r--modules/dlscript/godot/godot_color.cpp34
-rw-r--r--modules/dlscript/godot/godot_color.h29
-rw-r--r--modules/dlscript/godot/godot_dictionary.h51
-rw-r--r--modules/dlscript/godot/godot_node_path.h39
-rw-r--r--modules/dlscript/godot/godot_plane.cpp48
-rw-r--r--modules/dlscript/godot/godot_plane.h37
-rw-r--r--modules/dlscript/godot/godot_quat.cpp77
-rw-r--r--modules/dlscript/godot/godot_quat.h33
-rw-r--r--modules/dlscript/godot/godot_rect2.cpp48
-rw-r--r--modules/dlscript/godot/godot_rect2.h31
-rw-r--r--modules/dlscript/godot/godot_rect3.cpp48
-rw-r--r--modules/dlscript/godot/godot_rect3.h31
-rw-r--r--modules/dlscript/godot/godot_rid.cpp36
-rw-r--r--modules/dlscript/godot/godot_rid.h28
-rw-r--r--modules/dlscript/godot/godot_string.cpp83
-rw-r--r--modules/dlscript/godot/godot_string.h42
-rw-r--r--modules/dlscript/godot/godot_transform.cpp42
-rw-r--r--modules/dlscript/godot/godot_transform.h29
-rw-r--r--modules/dlscript/godot/godot_transform2d.cpp59
-rw-r--r--modules/dlscript/godot/godot_transform2d.h48
-rw-r--r--modules/dlscript/godot/godot_vector2.cpp124
-rw-r--r--modules/dlscript/godot/godot_vector2.h78
-rw-r--r--modules/dlscript/godot/godot_vector3.cpp150
-rw-r--r--modules/dlscript/godot/godot_vector3.h82
-rw-r--r--modules/gdnative/SCsub (renamed from modules/dlscript/SCsub)0
-rw-r--r--modules/gdnative/api_generator.cpp (renamed from modules/dlscript/api_generator.cpp)54
-rw-r--r--modules/gdnative/api_generator.h38
-rw-r--r--modules/gdnative/config.py (renamed from modules/dlscript/config.py)0
-rw-r--r--modules/gdnative/gdnative.cpp (renamed from modules/dlscript/dl_script.cpp)487
-rw-r--r--modules/gdnative/gdnative.h (renamed from modules/dlscript/dl_script.h)120
-rw-r--r--modules/gdnative/godot.cpp (renamed from modules/dlscript/godot.cpp)41
-rw-r--r--modules/gdnative/godot.h (renamed from modules/dlscript/godot.h)63
-rw-r--r--modules/gdnative/godot/godot_array.cpp (renamed from modules/dlscript/godot/godot_array.cpp)29
-rw-r--r--modules/gdnative/godot/godot_array.h (renamed from modules/dlscript/godot/godot_array.h)36
-rw-r--r--modules/gdnative/godot/godot_basis.cpp215
-rw-r--r--modules/gdnative/godot/godot_basis.h84
-rw-r--r--modules/gdnative/godot/godot_color.cpp63
-rw-r--r--modules/gdnative/godot/godot_color.h58
-rw-r--r--modules/gdnative/godot/godot_dictionary.cpp (renamed from modules/dlscript/godot/godot_dictionary.cpp)29
-rw-r--r--modules/gdnative/godot/godot_dictionary.h80
-rw-r--r--modules/gdnative/godot/godot_image.cpp (renamed from modules/dlscript/godot/godot_image.cpp)29
-rw-r--r--modules/gdnative/godot/godot_image.h (renamed from modules/dlscript/godot/godot_image.h)35
-rw-r--r--modules/gdnative/godot/godot_input_event.cpp (renamed from modules/dlscript/godot/godot_input_event.cpp)29
-rw-r--r--modules/gdnative/godot/godot_input_event.h (renamed from modules/dlscript/godot/godot_input_event.h)35
-rw-r--r--modules/gdnative/godot/godot_node_path.cpp (renamed from modules/dlscript/godot/godot_node_path.cpp)29
-rw-r--r--modules/gdnative/godot/godot_node_path.h68
-rw-r--r--modules/gdnative/godot/godot_plane.cpp77
-rw-r--r--modules/gdnative/godot/godot_plane.h66
-rw-r--r--modules/gdnative/godot/godot_pool_arrays.cpp (renamed from modules/dlscript/godot/godot_pool_arrays.cpp)29
-rw-r--r--modules/gdnative/godot/godot_pool_arrays.h (renamed from modules/dlscript/godot/godot_pool_arrays.h)35
-rw-r--r--modules/gdnative/godot/godot_quat.cpp106
-rw-r--r--modules/gdnative/godot/godot_quat.h62
-rw-r--r--modules/gdnative/godot/godot_rect2.cpp77
-rw-r--r--modules/gdnative/godot/godot_rect2.h60
-rw-r--r--modules/gdnative/godot/godot_rect3.cpp77
-rw-r--r--modules/gdnative/godot/godot_rect3.h60
-rw-r--r--modules/gdnative/godot/godot_rid.cpp65
-rw-r--r--modules/gdnative/godot/godot_rid.h57
-rw-r--r--modules/gdnative/godot/godot_string.cpp117
-rw-r--r--modules/gdnative/godot/godot_string.h73
-rw-r--r--modules/gdnative/godot/godot_transform.cpp71
-rw-r--r--modules/gdnative/godot/godot_transform.h58
-rw-r--r--modules/gdnative/godot/godot_transform2d.cpp88
-rw-r--r--modules/gdnative/godot/godot_transform2d.h77
-rw-r--r--modules/gdnative/godot/godot_variant.cpp (renamed from modules/dlscript/godot/godot_variant.cpp)29
-rw-r--r--modules/gdnative/godot/godot_variant.h (renamed from modules/dlscript/godot/godot_variant.h)29
-rw-r--r--modules/gdnative/godot/godot_vector2.cpp296
-rw-r--r--modules/gdnative/godot/godot_vector2.h98
-rw-r--r--modules/gdnative/godot/godot_vector3.cpp342
-rw-r--r--modules/gdnative/godot/godot_vector3.h113
-rw-r--r--modules/gdnative/register_types.cpp (renamed from modules/dlscript/register_types.cpp)46
-rw-r--r--modules/gdnative/register_types.h (renamed from modules/dlscript/register_types.h)4
-rw-r--r--modules/gdscript/gd_editor.cpp58
-rw-r--r--modules/gdscript/gd_parser.cpp13
-rw-r--r--modules/gdscript/gd_parser.h1
-rw-r--r--modules/gdscript/gd_script.cpp5
-rw-r--r--modules/gdscript/gd_script.h2
-rw-r--r--modules/multiscript/SCsub7
-rw-r--r--modules/multiscript/config.py8
-rw-r--r--modules/multiscript/multiscript.cpp750
-rw-r--r--modules/multiscript/multiscript.h200
-rw-r--r--modules/multiscript/register_types.cpp51
-rw-r--r--modules/multiscript/register_types.h31
-rw-r--r--modules/openssl/SCsub11
-rw-r--r--modules/openssl/curl_hostcheck.c217
-rw-r--r--modules/openssl/curl_hostcheck.h39
-rw-r--r--modules/openssl/stream_peer_openssl.h6
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.cpp13
-rw-r--r--modules/stb_vorbis/audio_stream_ogg_vorbis.h2
-rw-r--r--modules/theora/video_stream_theora.cpp3
-rw-r--r--modules/theora/yuv2rgb.h1123
-rw-r--r--modules/visual_script/visual_script.cpp12
-rw-r--r--modules/visual_script/visual_script.h2
-rw-r--r--modules/visual_script/visual_script_editor.cpp30
-rw-r--r--modules/visual_script/visual_script_editor.h3
-rw-r--r--modules/webm/video_stream_webm.cpp3
-rw-r--r--modules/webp/image_loader_webp.cpp10
101 files changed, 4664 insertions, 3188 deletions
diff --git a/modules/dds/texture_loader_dds.cpp b/modules/dds/texture_loader_dds.cpp
index f80e6e501e..d79b7685d1 100644
--- a/modules/dds/texture_loader_dds.cpp
+++ b/modules/dds/texture_loader_dds.cpp
@@ -144,12 +144,14 @@ RES ResourceFormatDDS::load(const String &p_path, const String &p_original_path,
f->get_32();
f->get_32();
- /*print_line("DDS width: "+itos(width));
+ /*
+ print_line("DDS width: "+itos(width));
print_line("DDS height: "+itos(height));
- print_line("DDS mipmaps: "+itos(mipmaps));*/
+ print_line("DDS mipmaps: "+itos(mipmaps));
- //printf("fourcc: %x fflags: %x, rgbbits: %x, fsize: %x\n",format_fourcc,format_flags,format_rgb_bits,format_size);
- //printf("rmask: %x gmask: %x, bmask: %x, amask: %x\n",format_red_mask,format_green_mask,format_blue_mask,format_alpha_mask);
+ printf("fourcc: %x fflags: %x, rgbbits: %x, fsize: %x\n",format_fourcc,format_flags,format_rgb_bits,format_size);
+ printf("rmask: %x gmask: %x, bmask: %x, amask: %x\n",format_red_mask,format_green_mask,format_blue_mask,format_alpha_mask);
+ */
//must avoid this later
while (f->get_pos() < 128)
diff --git a/modules/dlscript/api_generator.h b/modules/dlscript/api_generator.h
deleted file mode 100644
index 4a8354e9d6..0000000000
--- a/modules/dlscript/api_generator.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef API_GENERATOR_H
-#define API_GENERATOR_H
-
-#include "core/ustring.h"
-#include "typedefs.h"
-
-Error generate_c_api(const String &p_path);
-
-#endif // API_GENERATOR_H
diff --git a/modules/dlscript/godot/godot_basis.cpp b/modules/dlscript/godot/godot_basis.cpp
deleted file mode 100644
index 813a531de5..0000000000
--- a/modules/dlscript/godot/godot_basis.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-#include "godot_basis.h"
-
-#include "math/matrix3.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _basis_api_anchor() {
-}
-
-void GDAPI godot_basis_new(godot_basis *p_basis) {
- Basis *basis = (Basis *)p_basis;
- *basis = Basis();
-}
-
-void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) {
- Basis *basis = (Basis *)p_basis;
- Quat *euler = (Quat *)p_euler;
- *basis = Basis(*euler);
-}
-
-void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) {
- Basis *basis = (Basis *)p_basis;
- Vector3 *euler = (Vector3 *)p_euler;
- *basis = Basis(*euler);
-}
-
-godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) {
- const Basis *basis = (const Basis *)p_basis;
- godot_quat quat;
- Quat *p_quat = (Quat *)&quat;
- *p_quat = basis->operator Quat();
- return quat;
-}
-
-godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) {
- const Basis *basis = (const Basis *)p_basis;
- godot_vector3 euler;
- Vector3 *p_euler = (Vector3 *)&euler;
- *p_euler = basis->get_euler();
- return euler;
-}
-
-/*
- * p_elements is a pointer to an array of 3 (!!) vector3
- */
-void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) {
- Basis *basis = (Basis *)p_basis;
- Vector3 *elements = (Vector3 *)p_elements;
- elements[0] = basis->elements[0];
- elements[1] = basis->elements[1];
- elements[2] = basis->elements[2];
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_basis.h b/modules/dlscript/godot/godot_basis.h
deleted file mode 100644
index 43efd65ea2..0000000000
--- a/modules/dlscript/godot/godot_basis.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef GODOT_DLSCRIPT_BASIS_H
-#define GODOT_DLSCRIPT_BASIS_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
-typedef struct godot_basis {
- uint8_t _dont_touch_that[36];
-} godot_basis;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_basis_new(godot_basis *p_basis);
-void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler);
-void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler);
-
-godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis);
-godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis);
-
-/*
- * p_elements is a pointer to an array of 3 (!!) vector3
- */
-void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_BASIS_H
diff --git a/modules/dlscript/godot/godot_color.cpp b/modules/dlscript/godot/godot_color.cpp
deleted file mode 100644
index 7e49565d40..0000000000
--- a/modules/dlscript/godot/godot_color.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "godot_color.h"
-
-#include "color.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _color_api_anchor() {
-}
-
-void GDAPI godot_color_new(godot_color *p_color) {
- Color *color = (Color *)p_color;
- *color = Color();
-}
-
-void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
- Color *color = (Color *)p_color;
- *color = Color(r, g, b, a);
-}
-
-uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
- const Color *color = (const Color *)p_color;
- return color->to_32();
-}
-
-float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
- Color *color = (Color *)p_color;
- return &color->operator[](idx);
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_color.h b/modules/dlscript/godot/godot_color.h
deleted file mode 100644
index 72e16a2c5a..0000000000
--- a/modules/dlscript/godot/godot_color.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef GODOT_DLSCRIPT_COLOR_H
-#define GODOT_DLSCRIPT_COLOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
-typedef struct godot_color {
- uint8_t _dont_touch_that[16];
-} godot_color;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_color_new(godot_color *p_color);
-void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a);
-
-uint32_t GDAPI godot_color_get_32(const godot_color *p_color);
-
-float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_COLOR_H
diff --git a/modules/dlscript/godot/godot_dictionary.h b/modules/dlscript/godot/godot_dictionary.h
deleted file mode 100644
index 5f86cbca5a..0000000000
--- a/modules/dlscript/godot/godot_dictionary.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef GODOT_DLSCRIPT_DICTIONARY_H
-#define GODOT_DLSCRIPT_DICTIONARY_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED
-typedef struct godot_dictionary {
- uint8_t _dont_touch_that[8];
-} godot_dictionary;
-#endif
-
-#include "godot_array.h"
-#include "godot_variant.h"
-
-void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
-
-void GDAPI godot_dictionary_clear(godot_dictionary *p_dict);
-
-godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict);
-
-void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key);
-
-godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key);
-
-godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys);
-
-uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict);
-
-godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict);
-
-godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json);
-
-godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
-
-godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict);
-
-godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
-
-godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
-
-void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_DICTIONARY_H
diff --git a/modules/dlscript/godot/godot_node_path.h b/modules/dlscript/godot/godot_node_path.h
deleted file mode 100644
index 04f1e70c1d..0000000000
--- a/modules/dlscript/godot/godot_node_path.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef GODOT_DLSCRIPT_NODE_PATH_H
-#define GODOT_DLSCRIPT_NODE_PATH_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
-typedef struct godot_node_path {
- uint8_t _dont_touch_that[8];
-} godot_node_path;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from);
-void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from);
-
-godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx);
-godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np);
-
-godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np);
-godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx);
-godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np);
-
-godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np);
-godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np);
-
-godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np);
-
-void GDAPI godot_node_path_destroy(godot_node_path *p_np);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_NODE_PATH_H
diff --git a/modules/dlscript/godot/godot_plane.cpp b/modules/dlscript/godot/godot_plane.cpp
deleted file mode 100644
index 883aeb6282..0000000000
--- a/modules/dlscript/godot/godot_plane.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "godot_plane.h"
-
-#include "math/plane.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _plane_api_anchor() {
-}
-
-void GDAPI godot_plane_new(godot_plane *p_pl) {
- Plane *pl = (Plane *)p_pl;
- *pl = Plane();
-}
-
-void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) {
- Plane *pl = (Plane *)p_pl;
- const Vector3 *normal = (const Vector3 *)p_normal;
- *pl = Plane(*normal, p_d);
-}
-
-void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) {
- Plane *pl = (Plane *)p_pl;
- const Vector3 *normal = (const Vector3 *)p_normal;
- pl->set_normal(*normal);
-}
-
-godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) {
- const Plane *pl = (const Plane *)p_pl;
- const Vector3 normal = pl->get_normal();
- godot_vector3 *v3 = (godot_vector3 *)&normal;
- return *v3;
-}
-
-void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) {
- Plane *pl = (Plane *)p_pl;
- pl->d = p_d;
-}
-
-godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) {
- const Plane *pl = (const Plane *)p_pl;
- return pl->d;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_plane.h b/modules/dlscript/godot/godot_plane.h
deleted file mode 100644
index 1323ef4075..0000000000
--- a/modules/dlscript/godot/godot_plane.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef GODOT_DLSCRIPT_PLANE_H
-#define GODOT_DLSCRIPT_PLANE_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
-typedef struct godot_plane {
- uint8_t _dont_touch_that[16];
-} godot_plane;
-#endif
-
-#include "godot_vector3.h"
-
-void GDAPI godot_plane_new(godot_plane *p_pl);
-void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d);
-
-// @Incomplete
-// These are additional valid constructors
-// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
-// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal);
-// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
-
-void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal);
-godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl);
-
-godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl);
-void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_PLANE_H
diff --git a/modules/dlscript/godot/godot_quat.cpp b/modules/dlscript/godot/godot_quat.cpp
deleted file mode 100644
index 9bd2eb0639..0000000000
--- a/modules/dlscript/godot/godot_quat.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-#include "godot_quat.h"
-
-#include "math/quat.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _quat_api_anchor() {
-}
-
-void GDAPI godot_quat_new(godot_quat *p_quat) {
- Quat *quat = (Quat *)p_quat;
- *quat = Quat();
-}
-
-void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) {
- Quat *quat = (Quat *)p_quat;
- *quat = Quat(x, y, z, w);
-}
-
-void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) {
- Quat *quat = (Quat *)p_quat;
- const Vector3 *axis = (const Vector3 *)p_axis;
- *quat = Quat(*axis, p_angle);
-}
-
-void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) {
- Quat *quat = (Quat *)p_quat;
- const Vector3 *v0 = (const Vector3 *)p_v0;
- const Vector3 *v1 = (const Vector3 *)p_v1;
- *quat = Quat(*v0, *v1);
-}
-
-godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) {
- Quat *quat = (Quat *)p_quat;
- Vector3 euler = quat->get_euler();
- return *(godot_vector3 *)&euler;
-}
-
-void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) {
- Quat *quat = (Quat *)p_quat;
- const Vector3 *euler = (const Vector3 *)p_euler;
- quat->set_euler(*euler);
-}
-
-godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) {
- Quat *quat = (Quat *)p_quat;
- switch (p_idx) {
- case 0:
- return &quat->x;
- case 1:
- return &quat->y;
- case 2:
- return &quat->z;
- default:
- return &quat->y;
- }
-}
-
-godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) {
- const Quat *quat = (const Quat *)p_quat;
- switch (p_idx) {
- case 0:
- return quat->x;
- case 1:
- return quat->y;
- case 2:
- return quat->z;
- default:
- return quat->y;
- }
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_quat.h b/modules/dlscript/godot/godot_quat.h
deleted file mode 100644
index 4e3253c4e5..0000000000
--- a/modules/dlscript/godot/godot_quat.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef GODOT_DLSCRIPT_QUAT_H
-#define GODOT_DLSCRIPT_QUAT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
-typedef struct godot_quat {
- uint8_t _dont_touch_that[16];
-} godot_quat;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_quat_new(godot_quat *p_quat);
-void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w);
-void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle);
-void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1);
-
-godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat);
-void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler);
-
-godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx);
-godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_QUAT_H
diff --git a/modules/dlscript/godot/godot_rect2.cpp b/modules/dlscript/godot/godot_rect2.cpp
deleted file mode 100644
index 8e60811114..0000000000
--- a/modules/dlscript/godot/godot_rect2.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "godot_rect2.h"
-
-#include "math/math_2d.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _rect2_api_anchor() {
-}
-
-void GDAPI godot_rect2_new(godot_rect2 *p_rect) {
- Rect2 *rect = (Rect2 *)p_rect;
- *rect = Rect2();
-}
-
-void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
- Rect2 *rect = (Rect2 *)p_rect;
- const Vector2 *pos = (const Vector2 *)p_pos;
- const Vector2 *size = (const Vector2 *)p_size;
- *rect = Rect2(*pos, *size);
-}
-
-godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) {
- Rect2 *rect = (Rect2 *)p_rect;
- return (godot_vector2 *)&rect->pos;
-}
-
-void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) {
- Rect2 *rect = (Rect2 *)p_rect;
- const Vector2 *pos = (const Vector2 *)p_pos;
- rect->pos = *pos;
-}
-
-godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) {
- Rect2 *rect = (Rect2 *)p_rect;
- return (godot_vector2 *)&rect->size;
-}
-
-void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) {
- Rect2 *rect = (Rect2 *)p_rect;
- const Vector2 *size = (const Vector2 *)p_size;
- rect->size = *size;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_rect2.h b/modules/dlscript/godot/godot_rect2.h
deleted file mode 100644
index a3b19bdb7e..0000000000
--- a/modules/dlscript/godot/godot_rect2.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef GODOT_DLSCRIPT_RECT2_H
-#define GODOT_DLSCRIPT_RECT2_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
-typedef struct godot_rect2 {
- uint8_t _dont_touch_that[16];
-} godot_rect2;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_rect2_new(godot_rect2 *p_rect);
-void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size);
-
-godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect);
-void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos);
-
-godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect);
-void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_RECT3_H
diff --git a/modules/dlscript/godot/godot_rect3.cpp b/modules/dlscript/godot/godot_rect3.cpp
deleted file mode 100644
index 3c442a278b..0000000000
--- a/modules/dlscript/godot/godot_rect3.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "godot_rect3.h"
-
-#include "math/rect3.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _rect3_api_anchor() {
-}
-
-void GDAPI godot_rect3_new(godot_rect3 *p_rect) {
- Rect3 *rect = (Rect3 *)p_rect;
- *rect = Rect3();
-}
-
-void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
- Rect3 *rect = (Rect3 *)p_rect;
- const Vector3 *pos = (const Vector3 *)p_pos;
- const Vector3 *size = (const Vector3 *)p_size;
- *rect = Rect3(*pos, *size);
-}
-
-godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) {
- Rect3 *rect = (Rect3 *)p_rect;
- return (godot_vector3 *)&rect->pos;
-}
-
-void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) {
- Rect3 *rect = (Rect3 *)p_rect;
- const Vector3 *pos = (const Vector3 *)p_pos;
- rect->pos = *pos;
-}
-
-godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) {
- Rect3 *rect = (Rect3 *)p_rect;
- return (godot_vector3 *)&rect->size;
-}
-
-void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) {
- Rect3 *rect = (Rect3 *)p_rect;
- const Vector3 *size = (const Vector3 *)p_size;
- rect->size = *size;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_rect3.h b/modules/dlscript/godot/godot_rect3.h
deleted file mode 100644
index b9279616d1..0000000000
--- a/modules/dlscript/godot/godot_rect3.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef GODOT_DLSCRIPT_RECT3_H
-#define GODOT_DLSCRIPT_RECT3_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
-typedef struct godot_rect3 {
- uint8_t _dont_touch_that[24];
-} godot_rect3;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_rect3_new(godot_rect3 *p_rect);
-void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size);
-
-godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect);
-void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos);
-
-godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect);
-void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_RECT3_H
diff --git a/modules/dlscript/godot/godot_rid.cpp b/modules/dlscript/godot/godot_rid.cpp
deleted file mode 100644
index a36a2e64a3..0000000000
--- a/modules/dlscript/godot/godot_rid.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "godot_rid.h"
-
-#include "object.h"
-#include "resource.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _rid_api_anchor() {
-}
-
-void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) {
-
- Resource *res_from = ((Object *)p_from)->cast_to<Resource>();
-
- RID *rid = (RID *)p_rid;
- memnew_placement(rid, RID);
-
- if (res_from) {
- *rid = RID(res_from->get_rid());
- }
-}
-
-uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) {
- RID *rid = (RID *)p_rid;
- return rid->get_id();
-}
-
-void GDAPI godot_rid_destroy(godot_rid *p_rid) {
- ((RID *)p_rid)->~RID();
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_rid.h b/modules/dlscript/godot/godot_rid.h
deleted file mode 100644
index f20c0d4dae..0000000000
--- a/modules/dlscript/godot/godot_rid.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef GODOT_DLSCRIPT_RID_H
-#define GODOT_DLSCRIPT_RID_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
-typedef struct godot_rid {
- uint8_t _dont_touch_that[8];
-} godot_rid;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from);
-
-uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
-
-void GDAPI godot_rid_destroy(godot_rid *p_rid);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_RID_H
diff --git a/modules/dlscript/godot/godot_string.cpp b/modules/dlscript/godot/godot_string.cpp
deleted file mode 100644
index 97d0985a50..0000000000
--- a/modules/dlscript/godot/godot_string.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-#include "godot_string.h"
-
-#include "string_db.h"
-#include "ustring.h"
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _string_api_anchor() {
-}
-
-void GDAPI godot_string_new(godot_string *p_str) {
- String *p = (String *)p_str;
- memnew_placement(p, String);
- // *p = String(); // useless here
-}
-
-void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) {
- String *p = (String *)p_str;
- memnew_placement(p, String);
- *p = String::utf8(p_contents, p_size);
-}
-
-void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) {
- String *p = (String *)p_str;
- if (p_size != NULL) {
- *p_size = p->length();
- }
- if (p_dest != NULL) {
- memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType));
- }
-}
-
-void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) {
- String *dest = (String *)p_dest;
- String *src = (String *)p_src;
-
- *dest = *src;
-}
-
-wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) {
- String *s = (String *)p_str;
- return &(s->operator[](p_idx));
-}
-
-const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) {
- const String *s = (const String *)p_str;
- return s->c_str();
-}
-
-godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) {
- String *a = (String *)p_a;
- String *b = (String *)p_b;
- return *a == *b;
-}
-
-godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) {
- String *a = (String *)p_a;
- String *b = (String *)p_b;
- return *a < *b;
-}
-
-void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) {
- String *dest = (String *)p_dest;
- const String *a = (String *)p_a;
- const String *b = (String *)p_b;
-
- String tmp = *a + *b;
- godot_string_new(p_dest);
- *dest = tmp;
-}
-
-void GDAPI godot_string_destroy(godot_string *p_str) {
- String *p = (String *)p_str;
- p->~String();
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_string.h b/modules/dlscript/godot/godot_string.h
deleted file mode 100644
index 73b366d9cd..0000000000
--- a/modules/dlscript/godot/godot_string.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef GODOT_DLSCRIPT_STRING_H
-#define GODOT_DLSCRIPT_STRING_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
-typedef struct godot_string {
- uint8_t _dont_touch_that[8];
-} godot_string;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_string_new(godot_string *p_str);
-void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
-
-void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size);
-
-void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src);
-
-wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx);
-const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str);
-
-godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b);
-godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b);
-void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b);
-
-// @Incomplete
-// hmm, I guess exposing the whole API doesn't make much sense
-// since the language used in the library has its own string funcs
-
-void GDAPI godot_string_destroy(godot_string *p_str);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_STRING_H
diff --git a/modules/dlscript/godot/godot_transform.cpp b/modules/dlscript/godot/godot_transform.cpp
deleted file mode 100644
index c8da519f6b..0000000000
--- a/modules/dlscript/godot/godot_transform.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-#include "godot_transform.h"
-
-#include "math/transform.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _transform_api_anchor() {
-}
-
-void GDAPI godot_transform_new(godot_transform *p_trans) {
- Transform *trans = (Transform *)p_trans;
- *trans = Transform();
-}
-
-void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) {
- Transform *trans = (Transform *)p_trans;
- const Basis *basis = (const Basis *)p_basis;
- *trans = Transform(*basis);
-}
-
-void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) {
- Transform *trans = (Transform *)p_trans;
- const Basis *basis = (const Basis *)p_basis;
- const Vector3 *origin = (const Vector3 *)p_origin;
- *trans = Transform(*basis, *origin);
-}
-
-godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) {
- Transform *trans = (Transform *)p_trans;
- return (godot_basis *)&trans->basis;
-}
-
-godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) {
- Transform *trans = (Transform *)p_trans;
- return (godot_vector3 *)&trans->origin;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_transform.h b/modules/dlscript/godot/godot_transform.h
deleted file mode 100644
index 54af78d5b9..0000000000
--- a/modules/dlscript/godot/godot_transform.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef GODOT_DLSCRIPT_TRANSFORM_H
-#define GODOT_DLSCRIPT_TRANSFORM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
-typedef struct godot_transform {
- uint8_t _dont_touch_that[48];
-} godot_transform;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_transform_new(godot_transform *p_trans);
-void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis);
-void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin);
-
-godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans);
-godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_DLSCRIPT_TRANSFORM_H
diff --git a/modules/dlscript/godot/godot_transform2d.cpp b/modules/dlscript/godot/godot_transform2d.cpp
deleted file mode 100644
index 39fa0e7363..0000000000
--- a/modules/dlscript/godot/godot_transform2d.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#include "godot_transform2d.h"
-
-#include "../godot.h"
-
-#include "math/math_2d.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _transform2d_api_anchor() {
-}
-
-void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) {
- Transform2D *t = (Transform2D *)p_t;
- *t = Transform2D();
-}
-
-void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) {
- Transform2D *t = (Transform2D *)p_t;
- Vector2 *a = (Vector2 *)p_a;
- Vector2 *b = (Vector2 *)p_b;
- Vector2 *c = (Vector2 *)p_c;
- *t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y);
-}
-
-void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) {
- Transform2D *t = (Transform2D *)p_t;
- Vector2 *pos = (Vector2 *)p_pos;
- *t = Transform2D(p_rot, *pos);
-}
-
-godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) {
- const Transform2D *t = (const Transform2D *)p_t;
- const Vector2 *e = &t->operator[](p_idx);
- return (godot_vector2 const *)e;
-}
-
-godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) {
- Transform2D *t = (Transform2D *)p_t;
- Vector2 *e = &t->operator[](p_idx);
- return (godot_vector2 *)e;
-}
-
-godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) {
- return *godot_transform2d_const_index(p_t, p_axis);
-}
-
-void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) {
- godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis);
- *origin_v = *p_vec;
-}
-
-// @Incomplete
-// See header file
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_transform2d.h b/modules/dlscript/godot/godot_transform2d.h
deleted file mode 100644
index 7403954527..0000000000
--- a/modules/dlscript/godot/godot_transform2d.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef GODOT_TRANSFORM2D_H
-#define GODOT_TRANSFORM2D_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
-typedef struct godot_transform2d {
- uint8_t _dont_touch_that[24];
-} godot_transform2d;
-#endif
-
-#include "../godot.h"
-
-#include "godot_vector2.h"
-
-void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t);
-void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c);
-void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos);
-
-/*
-godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v);
-godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v);
-*/
-
-godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx);
-godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx);
-
-godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis);
-void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec);
-
-/*
-void GDAPI godot_transform2d_invert(godot_transform2d *p_t);
-godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t);
-*/
-
-// @Incomplete
-// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings.
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_TRANSFORM2D_H
diff --git a/modules/dlscript/godot/godot_vector2.cpp b/modules/dlscript/godot/godot_vector2.cpp
deleted file mode 100644
index 0664da186e..0000000000
--- a/modules/dlscript/godot/godot_vector2.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-#include "godot_vector2.h"
-
-#include "math/math_2d.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _vector2_api_anchor() {
-}
-
-void GDAPI godot_vector2_new(godot_vector2 *p_v, godot_real p_x, godot_real p_y) {
- Vector2 *v = (Vector2 *)p_v;
- v->x = p_x;
- v->y = p_y;
-}
-
-void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x) {
- Vector2 *v = (Vector2 *)p_v;
- v->x = p_x;
-}
-
-void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y) {
- Vector2 *v = (Vector2 *)p_v;
- v->y = p_y;
-}
-
-godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v) {
- Vector2 *v = (Vector2 *)p_v;
- return v->x;
-}
-godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v) {
- Vector2 *v = (Vector2 *)p_v;
- return v->y;
-}
-
-void GDAPI godot_vector2_normalize(godot_vector2 *p_v) {
- Vector2 *v = (Vector2 *)p_v;
- v->normalize();
-}
-void GDAPI godot_vector2_normalized(godot_vector2 *p_dest, const godot_vector2 *p_src) {
- Vector2 *v = (Vector2 *)p_src;
- Vector2 *d = (Vector2 *)p_dest;
-
- *d = v->normalized();
-}
-
-godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v) {
- Vector2 *v = (Vector2 *)p_v;
- return v->length();
-}
-
-godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v) {
- Vector2 *v = (Vector2 *)p_v;
- return v->length_squared();
-}
-
-godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b) {
- Vector2 *a = (Vector2 *)p_a;
- Vector2 *b = (Vector2 *)p_b;
- return a->distance_to(*b);
-}
-
-godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b) {
- Vector2 *a = (Vector2 *)p_a;
- Vector2 *b = (Vector2 *)p_b;
- return a->distance_squared_to(*b);
-}
-
-void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
- Vector2 *dest = (Vector2 *)p_dest;
- const Vector2 *a = (Vector2 *)p_a;
- const Vector2 *b = (Vector2 *)p_b;
- *dest = *a + *b;
-}
-
-void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
- Vector2 *dest = (Vector2 *)p_dest;
- const Vector2 *a = (Vector2 *)p_a;
- const Vector2 *b = (Vector2 *)p_b;
- *dest = *a - *b;
-}
-
-void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
- Vector2 *dest = (Vector2 *)p_dest;
- const Vector2 *a = (Vector2 *)p_a;
- const Vector2 *b = (Vector2 *)p_b;
- *dest = *a * *b;
-}
-
-void GDAPI godot_vector2_operator_multiply_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b) {
- Vector2 *dest = (Vector2 *)p_dest;
- const Vector2 *a = (Vector2 *)p_a;
- *dest = *a * p_b;
-}
-
-void GDAPI godot_vector2_operator_divide_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) {
- Vector2 *dest = (Vector2 *)p_dest;
- const Vector2 *a = (Vector2 *)p_a;
- const Vector2 *b = (Vector2 *)p_b;
- *dest = *a / *b;
-}
-
-void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b) {
- Vector2 *dest = (Vector2 *)p_dest;
- const Vector2 *a = (Vector2 *)p_a;
- *dest = *a / p_b;
-}
-
-godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b) {
- const Vector2 *a = (Vector2 *)p_a;
- const Vector2 *b = (Vector2 *)p_b;
- return *a == *b;
-}
-
-godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b) {
- const Vector2 *a = (Vector2 *)p_a;
- const Vector2 *b = (Vector2 *)p_b;
- return *a < *b;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_vector2.h b/modules/dlscript/godot/godot_vector2.h
deleted file mode 100644
index 63da367e4f..0000000000
--- a/modules/dlscript/godot/godot_vector2.h
+++ /dev/null
@@ -1,78 +0,0 @@
-#ifndef GODOT_VECTOR2_H
-#define GODOT_VECTOR2_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
-typedef struct godot_vector2 {
- uint8_t _dont_touch_that[8];
-} godot_vector2;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_vector2_new(godot_vector2 *p_v, const godot_real p_x, const godot_real p_y);
-
-void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x);
-void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y);
-godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v);
-godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v);
-
-void GDAPI godot_vector2_normalize(godot_vector2 *p_v);
-void GDAPI godot_vector2_normalized(godot_vector2 *p_dest, const godot_vector2 *p_src);
-
-godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v);
-godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v);
-
-godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b);
-godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b);
-
-// @Incomplete
-/*
- * missing:
- *
- * angle_to
- * angle_to_point
- * dot
- * cross_vector
- * cross_scalar
- * project
- * plane_project
- * clamped
- * linear_interpolate
- * cubic_interpolate
- * cubic_interpolate_soft
- * slide
- * reflect
- * angle
- * abs
- * rotated
- * tangent
- * floor
- * snapped
- * aspect
- *
- *
- * to_string
- */
-
-void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
-void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
-void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
-void GDAPI godot_vector2_operator_multiply_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b);
-void GDAPI godot_vector2_operator_divide_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
-void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b);
-
-godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b);
-godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_VECTOR2_H
diff --git a/modules/dlscript/godot/godot_vector3.cpp b/modules/dlscript/godot/godot_vector3.cpp
deleted file mode 100644
index 34005cbcb8..0000000000
--- a/modules/dlscript/godot/godot_vector3.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-#include "godot_vector3.h"
-
-#include "math/vector3.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void _vector3_api_anchor() {
-}
-
-void GDAPI godot_vector3_new(godot_vector3 *p_v, const godot_real p_x, const godot_real p_y, const godot_real p_z) {
- Vector3 *v = (Vector3 *)p_v;
- *v = Vector3(p_x, p_y, p_z);
-}
-
-void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val) {
- Vector3 *v = (Vector3 *)p_v;
- v->set_axis(p_axis, p_val);
-}
-
-godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis) {
- Vector3 *v = (Vector3 *)p_v;
- return v->get_axis(p_axis);
-}
-
-godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v) {
- Vector3 *v = (Vector3 *)p_v;
- return v->min_axis();
-}
-
-godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v) {
- Vector3 *v = (Vector3 *)p_v;
- return v->max_axis();
-}
-
-godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v) {
- Vector3 *v = (Vector3 *)p_v;
- return v->length();
-}
-
-godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v) {
- Vector3 *v = (Vector3 *)p_v;
- return v->length_squared();
-}
-
-void GDAPI godot_vector3_normalize(godot_vector3 *p_v) {
- Vector3 *v = (Vector3 *)p_v;
- v->normalize();
-}
-
-void GDAPI godot_vector3_normalized(godot_vector3 *p_dest, const godot_vector3 *p_src) {
- Vector3 *src = (Vector3 *)p_src;
- Vector3 *dest = (Vector3 *)p_dest;
- *dest = src->normalized();
-}
-
-/*
- * inverse
- * zero
- * snap
- * snapped
- * rotate
- * rotated
- *
- *
- * linear_interpolate
- * cubic_interpolate
- * cubic_interpolaten
- * cross
- * dot
- * outer
- * to_diagonal_matrix
- * abs
- * floor
- * ceil
- */
-
-godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- return a->distance_to(*b);
-}
-
-godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- return a->distance_squared_to(*b);
-}
-
-/*
- * slide
- * reflect
- */
-
-void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *dest = (Vector3 *)p_dest;
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- *dest = *a + *b;
-}
-
-void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *dest = (Vector3 *)p_dest;
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- *dest = *a - *b;
-}
-
-void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *dest = (Vector3 *)p_dest;
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- *dest = *a * *b;
-}
-
-void GDAPI godot_vector3_operator_multiply_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b) {
- Vector3 *dest = (Vector3 *)p_dest;
- Vector3 *a = (Vector3 *)p_a;
- *dest = *a * p_b;
-}
-
-void GDAPI godot_vector3_operator_divide_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *dest = (Vector3 *)p_dest;
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- *dest = *a / *b;
-}
-
-void GDAPI godot_vector3_operator_divide_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b) {
- Vector3 *dest = (Vector3 *)p_dest;
- Vector3 *a = (Vector3 *)p_a;
- *dest = *a / p_b;
-}
-
-godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- return *a == *b;
-}
-
-godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_a, const godot_vector3 *p_b) {
- Vector3 *a = (Vector3 *)p_a;
- Vector3 *b = (Vector3 *)p_b;
- return *a < *b;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/dlscript/godot/godot_vector3.h b/modules/dlscript/godot/godot_vector3.h
deleted file mode 100644
index 7fe93e3fd5..0000000000
--- a/modules/dlscript/godot/godot_vector3.h
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef GODOT_VECTOR3_H
-#define GODOT_VECTOR3_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
-typedef struct godot_vector3 {
- uint8_t _dont_touch_that[12];
-} godot_vector3;
-#endif
-
-#include "../godot.h"
-
-void GDAPI godot_vector3_new(godot_vector3 *p_v, const godot_real p_x, const godot_real p_y, const godot_real p_z);
-
-void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val);
-godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis);
-
-godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v);
-godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v);
-
-godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v);
-godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v);
-
-void GDAPI godot_vector3_normalize(godot_vector3 *p_v);
-void GDAPI godot_vector3_normalized(godot_vector3 *p_dest, const godot_vector3 *p_src);
-
-// @Incomplete
-
-/*
- * inverse
- * zero
- * snap
- * snapped
- * rotate
- * rotated
- *
- *
- * linear_interpolate
- * cubic_interpolate
- * cubic_interpolaten
- * cross
- * dot
- * outer
- * to_diagonal_matrix
- * abs
- * floor
- * ceil
- */
-
-godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_a, const godot_vector3 *p_b);
-godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, const godot_vector3 *p_b);
-
-// @Incomplete
-/*
- * slide
- * reflect
- */
-
-void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
-void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
-void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
-void GDAPI godot_vector3_operator_multiply_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b);
-void GDAPI godot_vector3_operator_divide_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
-void GDAPI godot_vector3_operator_divide_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b);
-
-godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_a, const godot_vector3 *p_b);
-godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_a, const godot_vector3 *p_b);
-
-/*
- * to_string
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_VECTOR3_H
diff --git a/modules/dlscript/SCsub b/modules/gdnative/SCsub
index ac13319a1d..ac13319a1d 100644
--- a/modules/dlscript/SCsub
+++ b/modules/gdnative/SCsub
diff --git a/modules/dlscript/api_generator.cpp b/modules/gdnative/api_generator.cpp
index 56e0e45608..d5f22ee7a3 100644
--- a/modules/dlscript/api_generator.cpp
+++ b/modules/gdnative/api_generator.cpp
@@ -1,9 +1,39 @@
+/*************************************************************************/
+/* api_generator.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "class_db.h"
#include "core/global_config.h"
+#include "core/global_constants.h"
#include "os/file_access.h"
// helper stuff
@@ -73,8 +103,7 @@ struct ClassAPI {
bool is_instanciable;
// @Unclear
bool is_creatable;
- // @Unclear
- bool memory_own;
+ bool is_reference;
List<MethodAPI> methods;
List<PropertyAPI> properties;
@@ -92,6 +121,23 @@ List<ClassAPI> generate_c_api_classes() {
List<StringName> classes;
ClassDB::get_class_list(&classes);
+ // Register global constants as a fake GlobalConstants singleton class
+ {
+ ClassAPI global_constants_api;
+ global_constants_api.class_name = L"GlobalConstants";
+ global_constants_api.api_type = ClassDB::API_CORE;
+ global_constants_api.is_singleton = true;
+ global_constants_api.is_instanciable = false;
+ const int constants_count = GlobalConstants::get_global_constant_count();
+ for (int i = 0; i < constants_count; ++i) {
+ ConstantAPI constant_api;
+ constant_api.constant_name = GlobalConstants::get_global_constant_name(i);
+ constant_api.constant_value = GlobalConstants::get_global_constant_value(i);
+ global_constants_api.constants.push_back(constant_api);
+ }
+ api.push_back(global_constants_api);
+ }
+
for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) {
StringName class_name = e->get();
@@ -114,7 +160,7 @@ List<ClassAPI> generate_c_api_classes() {
ClassDB::get_inheriters_from_class("Reference", &inheriters);
is_reference = !!inheriters.find(class_name);
// @Unclear
- class_api.memory_own = !class_api.is_singleton && is_reference;
+ class_api.is_reference = !class_api.is_singleton && is_reference;
}
// constants
@@ -301,6 +347,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
source.push_back(String("\t\t\"api_type\": \"") + (api.api_type == ClassDB::API_CORE ? "core" : (api.api_type == ClassDB::API_EDITOR ? "tools" : "none")) + "\",\n");
source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n");
source.push_back(String("\t\t\"instanciable\": ") + (api.is_instanciable ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\"is_reference\": ") + (api.is_reference ? "true" : "false") + ",\n");
// @Unclear
// source.push_back(String("\t\t\"createable\": ") + (api.is_creatable ? "true" : "false") + ",\n");
@@ -355,6 +402,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
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");
source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n");
source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n");
}
diff --git a/modules/gdnative/api_generator.h b/modules/gdnative/api_generator.h
new file mode 100644
index 0000000000..a108d7a7b6
--- /dev/null
+++ b/modules/gdnative/api_generator.h
@@ -0,0 +1,38 @@
+/*************************************************************************/
+/* api_generator.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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/ustring.h"
+#include "typedefs.h"
+
+Error generate_c_api(const String &p_path);
+
+#endif // API_GENERATOR_H
diff --git a/modules/dlscript/config.py b/modules/gdnative/config.py
index 9f57b9bb74..9f57b9bb74 100644
--- a/modules/dlscript/config.py
+++ b/modules/gdnative/config.py
diff --git a/modules/dlscript/dl_script.cpp b/modules/gdnative/gdnative.cpp
index fa082d7b94..09859d95bd 100644
--- a/modules/dlscript/dl_script.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* dl_script.cpp */
+/* gdnative.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,7 +27,7 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "dl_script.h"
+#include "gdnative.h"
#include "global_config.h"
#include "global_constants.h"
@@ -48,8 +48,8 @@
Error NativeLibrary::initialize(NativeLibrary *&p_native_lib, const StringName p_path) {
- if (DLScriptLanguage::get_singleton()->initialized_libraries.has(p_path)) {
- p_native_lib = DLScriptLanguage::get_singleton()->initialized_libraries[p_path];
+ if (GDNativeScriptLanguage::get_singleton()->initialized_libraries.has(p_path)) {
+ p_native_lib = GDNativeScriptLanguage::get_singleton()->initialized_libraries[p_path];
return OK;
}
@@ -68,31 +68,29 @@ Error NativeLibrary::initialize(NativeLibrary *&p_native_lib, const StringName p
// Get the method
void *library_init;
- error = OS::get_singleton()->get_dynamic_library_symbol_handle(lib->handle, DLScriptLanguage::get_init_symbol_name(), library_init);
+ error = OS::get_singleton()->get_dynamic_library_symbol_handle(lib->handle, GDNativeScriptLanguage::get_init_symbol_name(), library_init);
if (error) return error;
ERR_FAIL_COND_V(!library_init, ERR_BUG);
- void (*library_init_fpointer)(godot_dlscript_init_options *) = (void (*)(godot_dlscript_init_options *))library_init;
+ void (*library_init_fpointer)(godot_native_init_options *) = (void (*)(godot_native_init_options *))library_init;
- godot_dlscript_init_options options;
+ godot_native_init_options options;
options.in_editor = SceneTree::get_singleton()->is_editor_hint();
- /*
options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
- */
library_init_fpointer(&options); // Catch errors?
- DLScriptLanguage::get_singleton()->initialized_libraries[p_path] = lib;
+ GDNativeScriptLanguage::get_singleton()->initialized_libraries[p_path] = lib;
return OK;
}
Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) {
- if (!DLScriptLanguage::get_singleton()->initialized_libraries.has(p_native_lib->path)) {
+ if (!GDNativeScriptLanguage::get_singleton()->initialized_libraries.has(p_native_lib->path)) {
OS::get_singleton()->close_dynamic_library(p_native_lib->handle);
p_native_lib->handle = 0;
return OK;
@@ -100,18 +98,18 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) {
Error error = OK;
void *library_terminate;
- error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, DLScriptLanguage::get_terminate_symbol_name(), library_terminate);
+ error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, GDNativeScriptLanguage::get_terminate_symbol_name(), library_terminate);
if (error)
return OK; // no terminate? okay, not that important lol
- void (*library_terminate_pointer)(godot_dlscript_terminate_options *) = (void (*)(godot_dlscript_terminate_options *))library_terminate;
+ void (*library_terminate_pointer)(godot_native_terminate_options *) = (void (*)(godot_native_terminate_options *))library_terminate;
- godot_dlscript_terminate_options options;
+ godot_native_terminate_options options;
options.in_editor = SceneTree::get_singleton()->is_editor_hint();
library_terminate_pointer(&options);
- DLScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
+ GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
OS::get_singleton()->close_dynamic_library(p_native_lib->handle);
p_native_lib->handle = 0;
@@ -122,12 +120,13 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) {
// Script
#ifdef TOOLS_ENABLED
-void DLScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) {
+void GDNativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) {
+ ERR_FAIL_COND(!script_data);
List<PropertyInfo> pinfo;
Map<StringName, Variant> values;
- for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) {
+ for (Map<StringName, GDNativeScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) {
PropertyInfo p = E->get().info;
p.name = String(E->key());
pinfo.push_back(p);
@@ -137,24 +136,24 @@ void DLScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) {
p_placeholder->update(pinfo, values);
}
-void DLScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
+void GDNativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {
placeholders.erase(p_placeholder);
}
#endif
-bool DLScript::can_instance() const {
-#ifdef DLSCRIPT_EDITOR_FEATURES
+bool GDNativeScript::can_instance() const {
+#ifdef TOOLS_ENABLED
return script_data || (!is_tool() && !ScriptServer::is_scripting_enabled());
#else
// allow defaultlibrary without editor features
if (!library.is_valid()) {
- String path = GLOBAL_GET("dlscript/default_dllibrary");
+ String path = GLOBAL_GET("gdnative/default_gdnativelibrary");
RES lib = ResourceLoader::load(path);
- if (lib.is_valid() && lib->cast_to<DLLibrary>()) {
+ if (lib.is_valid() && lib->cast_to<GDNativeLibrary>()) {
return true;
}
}
@@ -165,28 +164,27 @@ bool DLScript::can_instance() const {
// change to true enable in editor stuff.
}
-Ref<Script> DLScript::get_base_script() const {
- Ref<DLScript> base_script;
+Ref<Script> GDNativeScript::get_base_script() const {
+ Ref<GDNativeScript> base_script;
base_script->library = library;
base_script->script_data = script_data;
base_script->script_name = script_data->base;
return base_script;
}
-StringName DLScript::get_instance_base_type() const {
+StringName GDNativeScript::get_instance_base_type() const {
return script_data->base_native_type;
}
-ScriptInstance *DLScript::instance_create(Object *p_this) {
+ScriptInstance *GDNativeScript::instance_create(Object *p_this) {
#ifdef TOOLS_ENABLED
-// find a good way to initialize stuff in the editor
-#ifdef DLSCRIPT_EDITOR_FEATURES
+ // find a good way to initialize stuff in the editor
if (!ScriptServer::is_scripting_enabled() && !is_tool()) {
// placeholder, for nodes. But for tools we want the real thing
- PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(DLScriptLanguage::singleton, Ref<Script>((Script *)this), p_this));
+ PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(GDNativeScriptLanguage::singleton, Ref<Script>((Script *)this), p_this));
placeholders.insert(sins);
if (!library.is_valid())
@@ -210,26 +208,25 @@ ScriptInstance *DLScript::instance_create(Object *p_this) {
return sins;
}
-#endif
#endif
if (!library.is_valid()) {
- String path = GLOBAL_GET("dlscript/default_dllibrary");
+ String path = GLOBAL_GET("gdnative/default_gdnativelibrary");
RES lib = ResourceLoader::load(path);
- if (lib.is_valid() && lib->cast_to<DLLibrary>()) {
+ if (lib.is_valid() && lib->cast_to<GDNativeLibrary>()) {
set_library(lib);
}
}
- DLInstance *new_instance = memnew(DLInstance);
+ GDNativeInstance *new_instance = memnew(GDNativeInstance);
new_instance->owner = p_this;
- new_instance->script = Ref<DLScript>(this);
+ new_instance->script = Ref<GDNativeScript>(this);
-#ifndef DLSCRIPT_EDITOR_FEATURES
+#ifndef TOOLS_ENABLED
if (!ScriptServer::is_scripting_enabled()) {
new_instance->userdata = 0;
} else {
@@ -243,26 +240,26 @@ ScriptInstance *DLScript::instance_create(Object *p_this) {
return new_instance;
}
-bool DLScript::instance_has(const Object *p_this) const {
+bool GDNativeScript::instance_has(const Object *p_this) const {
return instances.has((Object *)p_this); // TODO
}
-bool DLScript::has_source_code() const {
+bool GDNativeScript::has_source_code() const {
return false;
}
-String DLScript::get_source_code() const {
+String GDNativeScript::get_source_code() const {
return "";
}
-Error DLScript::reload(bool p_keep_state) {
+Error GDNativeScript::reload(bool p_keep_state) {
return FAILED;
}
-bool DLScript::has_method(const StringName &p_method) const {
+bool GDNativeScript::has_method(const StringName &p_method) const {
if (!script_data)
return false;
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
if (data->methods.has(p_method))
@@ -274,10 +271,10 @@ bool DLScript::has_method(const StringName &p_method) const {
return false;
}
-MethodInfo DLScript::get_method_info(const StringName &p_method) const {
+MethodInfo GDNativeScript::get_method_info(const StringName &p_method) const {
if (!script_data)
return MethodInfo();
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
if (data->methods.has(p_method))
@@ -290,14 +287,14 @@ MethodInfo DLScript::get_method_info(const StringName &p_method) const {
return MethodInfo();
}
-void DLScript::get_script_method_list(List<MethodInfo> *p_list) const {
+void GDNativeScript::get_script_method_list(List<MethodInfo> *p_list) const {
if (!script_data) return;
Set<MethodInfo> methods;
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
- for (Map<StringName, DLScriptData::Method>::Element *E = data->methods.front(); E; E = E->next()) {
+ for (Map<StringName, GDNativeScriptData::Method>::Element *E = data->methods.front(); E; E = E->next()) {
methods.insert(E->get().info);
}
data = data->base_data;
@@ -308,14 +305,14 @@ void DLScript::get_script_method_list(List<MethodInfo> *p_list) const {
}
}
-void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+void GDNativeScript::get_script_property_list(List<PropertyInfo> *p_list) const {
if (!script_data) return;
Set<PropertyInfo> properties;
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
- for (Map<StringName, DLScriptData::Property>::Element *E = data->properties.front(); E; E = E->next()) {
+ for (Map<StringName, GDNativeScriptData::Property>::Element *E = data->properties.front(); E; E = E->next()) {
properties.insert(E->get().info);
}
data = data->base_data;
@@ -326,10 +323,10 @@ void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const {
}
}
-bool DLScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
+bool GDNativeScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
if (!script_data) return false;
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
if (data->properties.has(p_property)) {
@@ -343,24 +340,24 @@ bool DLScript::get_property_default_value(const StringName &p_property, Variant
return false;
}
-bool DLScript::is_tool() const {
+bool GDNativeScript::is_tool() const {
ERR_FAIL_COND_V(!script_data, false);
return script_data->is_tool;
}
-String DLScript::get_node_type() const {
+String GDNativeScript::get_node_type() const {
return ""; // ?
}
-ScriptLanguage *DLScript::get_language() const {
- return DLScriptLanguage::singleton;
+ScriptLanguage *GDNativeScript::get_language() const {
+ return GDNativeScriptLanguage::singleton;
}
-bool DLScript::has_script_signal(const StringName &p_signal) const {
+bool GDNativeScript::has_script_signal(const StringName &p_signal) const {
if (!script_data)
return false;
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
if (data->signals_.has(p_signal)) {
@@ -373,16 +370,16 @@ bool DLScript::has_script_signal(const StringName &p_signal) const {
return false;
}
-void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
+void GDNativeScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
if (!script_data)
return;
Set<MethodInfo> signals_;
- DLScriptData *data = script_data;
+ GDNativeScriptData *data = script_data;
while (data) {
- for (Map<StringName, DLScriptData::Signal>::Element *S = data->signals_.front(); S; S = S->next()) {
+ for (Map<StringName, GDNativeScriptData::Signal>::Element *S = data->signals_.front(); S; S = S->next()) {
signals_.insert(S->get().signal);
}
@@ -394,11 +391,59 @@ void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
}
}
-Ref<DLLibrary> DLScript::get_library() const {
+Variant GDNativeScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+
+ /* STEP 1, CREATE */
+
+ if (!library.is_valid() || ((String)script_name).empty() || !script_data) {
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ return Variant();
+ }
+
+ r_error.error = Variant::CallError::CALL_OK;
+ REF ref;
+ Object *owner = NULL;
+
+ GDNativeScriptData *_baseptr = script_data;
+ while (_baseptr->base_data) {
+ _baseptr = _baseptr->base_data;
+ }
+
+ if (!(_baseptr->base_native_type == "")) {
+ owner = ClassDB::instance(_baseptr->base_native_type);
+ } else {
+ owner = memnew(Reference); //by default, no base means use reference
+ }
+
+ Reference *r = owner->cast_to<Reference>();
+ if (r) {
+ ref = REF(r);
+ }
+
+ // GDScript does it like this: _create_instance(p_args, p_argcount, owner, r != NULL, r_error);
+ // @Todo support varargs for constructors.
+ GDNativeInstance *instance = (GDNativeInstance *)instance_create(owner);
+
+ owner->set_script_instance(instance);
+ if (!instance) {
+ if (ref.is_null()) {
+ memdelete(owner); //no owner, sorry
+ }
+ return Variant();
+ }
+
+ if (ref.is_valid()) {
+ return ref;
+ } else {
+ return owner;
+ }
+}
+
+Ref<GDNativeLibrary> GDNativeScript::get_library() const {
return library;
}
-void DLScript::set_library(Ref<DLLibrary> p_library) {
+void GDNativeScript::set_library(Ref<GDNativeLibrary> p_library) {
library = p_library;
#ifdef TOOLS_ENABLED
@@ -415,15 +460,15 @@ void DLScript::set_library(Ref<DLLibrary> p_library) {
}
}
-StringName DLScript::get_script_name() const {
+StringName GDNativeScript::get_script_name() const {
return script_name;
}
-void DLScript::set_script_name(StringName p_script_name) {
+void GDNativeScript::set_script_name(StringName p_script_name) {
script_name = p_script_name;
if (library.is_valid()) {
-#ifdef DLSCRIPT_EDITOR_FEATURES
+#ifdef TOOLS_ENABLED
if (!library->native_library) {
library->_initialize();
}
@@ -435,31 +480,33 @@ void DLScript::set_script_name(StringName p_script_name) {
}
}
-void DLScript::_bind_methods() {
- ClassDB::bind_method(D_METHOD("get_library"), &DLScript::get_library);
- ClassDB::bind_method(D_METHOD("set_library", "library"), &DLScript::set_library);
- ClassDB::bind_method(D_METHOD("get_script_name"), &DLScript::get_script_name);
- ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &DLScript::set_script_name);
+void GDNativeScript::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("get_library"), &GDNativeScript::get_library);
+ ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNativeScript::set_library);
+ ClassDB::bind_method(D_METHOD("get_script_name"), &GDNativeScript::get_script_name);
+ ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &GDNativeScript::set_script_name);
- ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "DLLibrary"), "set_library", "get_library");
+ ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDNativeScript::_new, MethodInfo(Variant::OBJECT, "new"));
+
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library");
ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "script_name"), "set_script_name", "get_script_name");
}
-DLScript::DLScript() {
+GDNativeScript::GDNativeScript() {
script_data = NULL;
- DLScriptLanguage::get_singleton()->script_list.insert(this);
+ GDNativeScriptLanguage::get_singleton()->script_list.insert(this);
}
-DLScript::~DLScript() {
+GDNativeScript::~GDNativeScript() {
//hmm
- DLScriptLanguage::get_singleton()->script_list.erase(this);
+ GDNativeScriptLanguage::get_singleton()->script_list.erase(this);
}
// Library
-DLLibrary *DLLibrary::currently_initialized_library = NULL;
+GDNativeLibrary *GDNativeLibrary::currently_initialized_library = NULL;
-DLLibrary *DLLibrary::get_currently_initialized_library() {
+GDNativeLibrary *GDNativeLibrary::get_currently_initialized_library() {
return currently_initialized_library;
}
@@ -479,7 +526,7 @@ static const char *_dl_platforms_info[] = {
NULL // Finishing condition
};
-void DLLibrary::set_platform_file(StringName p_platform, String p_file) {
+void GDNativeLibrary::set_platform_file(StringName p_platform, String p_file) {
if (p_file.empty()) {
platform_files.erase(p_platform);
} else {
@@ -487,7 +534,7 @@ void DLLibrary::set_platform_file(StringName p_platform, String p_file) {
}
}
-String DLLibrary::get_platform_file(StringName p_platform) const {
+String GDNativeLibrary::get_platform_file(StringName p_platform) const {
if (platform_files.has(p_platform)) {
return platform_files[p_platform];
} else {
@@ -495,7 +542,7 @@ String DLLibrary::get_platform_file(StringName p_platform) const {
}
}
-Error DLLibrary::_initialize() {
+Error GDNativeLibrary::_initialize() {
_THREAD_SAFE_METHOD_
// Get the file
@@ -529,24 +576,24 @@ Error DLLibrary::_initialize() {
StringName path = GlobalConfig::get_singleton()->globalize_path(platform_file);
- DLLibrary::currently_initialized_library = this;
+ GDNativeLibrary::currently_initialized_library = this;
Error ret = NativeLibrary::initialize(native_library, path);
native_library->dllib = this;
- DLLibrary::currently_initialized_library = NULL;
+ GDNativeLibrary::currently_initialized_library = NULL;
return ret;
}
-Error DLLibrary::_terminate() {
+Error GDNativeLibrary::_terminate() {
ERR_FAIL_COND_V(!native_library, ERR_BUG);
ERR_FAIL_COND_V(!native_library->handle, ERR_BUG);
// de-init stuff
- for (Map<StringName, DLScriptData *>::Element *E = native_library->scripts.front(); E; E = E->next()) {
- for (Map<StringName, DLScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) {
+ for (Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.front(); E; E = E->next()) {
+ for (Map<StringName, GDNativeScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) {
if (M->get().method.free_func) {
M->get().method.free_func(M->get().method.method_data);
}
@@ -558,7 +605,7 @@ Error DLLibrary::_terminate() {
E->get()->destroy_func.free_func(E->get()->destroy_func.method_data);
}
- for (Set<DLScript *>::Element *S = DLScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) {
+ for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) {
if (S->get()->script_data == E->get()) {
S->get()->script_data = NULL;
}
@@ -574,15 +621,15 @@ Error DLLibrary::_terminate() {
return ret;
}
-void DLLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) {
+void GDNativeLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) {
ERR_FAIL_COND(!native_library);
ERR_FAIL_COND(native_library->scripts.has(p_name));
- DLScriptData *s = memnew(DLScriptData);
+ GDNativeScriptData *s = memnew(GDNativeScriptData);
s->base = p_base;
s->create_func = p_instance_func;
s->destroy_func = p_destroy_func;
- Map<StringName, DLScriptData *>::Element *E = native_library->scripts.find(p_base);
+ Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.find(p_base);
if (E) {
s->base_data = E->get();
s->base_native_type = s->base_data->base_native_type;
@@ -598,16 +645,16 @@ void DLLibrary::_register_script(const StringName p_name, const StringName p_bas
native_library->scripts.insert(p_name, s);
}
-void DLLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) {
+void GDNativeLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) {
ERR_FAIL_COND(!native_library);
ERR_FAIL_COND(native_library->scripts.has(p_name));
- DLScriptData *s = memnew(DLScriptData);
+ GDNativeScriptData *s = memnew(GDNativeScriptData);
s->base = p_base;
s->create_func = p_instance_func;
s->destroy_func = p_destroy_func;
s->is_tool = true;
- Map<StringName, DLScriptData *>::Element *E = native_library->scripts.find(p_base);
+ Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.find(p_base);
if (E) {
s->base_data = E->get();
s->base_native_type = s->base_data->base_native_type;
@@ -623,23 +670,23 @@ void DLLibrary::_register_tool_script(const StringName p_name, const StringName
native_library->scripts.insert(p_name, s);
}
-void DLLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) {
+void GDNativeLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) {
ERR_FAIL_COND(!native_library);
ERR_FAIL_COND(!native_library->scripts.has(p_name));
p_info.name = p_method;
- DLScriptData::Method method;
+ GDNativeScriptData::Method method;
- method = DLScriptData::Method(p_func, p_info, p_attr.rpc_type);
+ method = GDNativeScriptData::Method(p_func, p_info, p_attr.rpc_type);
native_library->scripts[p_name]->methods.insert(p_method, method);
}
-void DLLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) {
+void GDNativeLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) {
ERR_FAIL_COND(!native_library);
ERR_FAIL_COND(!native_library->scripts.has(p_name));
- DLScriptData::Property p;
+ GDNativeScriptData::Property p;
PropertyInfo pi;
pi.name = p_path;
@@ -647,18 +694,18 @@ void DLLibrary::_register_script_property(const StringName p_name, const String
if (p_attr != NULL) {
pi = PropertyInfo((Variant::Type)p_attr->type, p_path, (PropertyHint)p_attr->hint, *(String *)&p_attr->hint_string, p_attr->usage);
- p = DLScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type);
+ p = GDNativeScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type);
}
native_library->scripts[p_name]->properties.insert(p_path, p);
}
-void DLLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) {
+void GDNativeLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) {
ERR_FAIL_COND(!native_library);
ERR_FAIL_COND(!native_library->scripts.has(p_name));
ERR_FAIL_COND(!p_signal);
- DLScriptData::Signal signal;
+ GDNativeScriptData::Signal signal;
signal.signal.name = *(String *)&p_signal->name;
@@ -698,7 +745,7 @@ void DLLibrary::_register_script_signal(const StringName p_name, const godot_sig
native_library->scripts[p_name]->signals_.insert(*(String *)&p_signal->name, signal);
}
-DLScriptData *DLLibrary::get_script_data(const StringName p_name) {
+GDNativeScriptData *GDNativeLibrary::get_script_data(const StringName p_name) {
ERR_FAIL_COND_V(!native_library, NULL);
ERR_FAIL_COND_V(!native_library->scripts.has(p_name), NULL);
@@ -706,7 +753,7 @@ DLScriptData *DLLibrary::get_script_data(const StringName p_name) {
return native_library->scripts[p_name];
}
-bool DLLibrary::_set(const StringName &p_name, const Variant &p_value) {
+bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
if (name.begins_with("platform/")) {
set_platform_file(name.get_slice("/", 1), p_value);
@@ -715,7 +762,7 @@ bool DLLibrary::_set(const StringName &p_name, const Variant &p_value) {
return false;
}
-bool DLLibrary::_get(const StringName &p_name, Variant &r_ret) const {
+bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name;
if (name.begins_with("platform/")) {
r_ret = get_platform_file(name.get_slice("/", 1));
@@ -724,7 +771,7 @@ bool DLLibrary::_get(const StringName &p_name, Variant &r_ret) const {
return false;
}
-void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
+void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
char **platform_info = (char **)_dl_platforms_info;
Set<String> registered_platform_names;
@@ -769,20 +816,20 @@ void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
}
}
-void DLLibrary::_notification(int what) {
+void GDNativeLibrary::_notification(int what) {
// TODO
}
-void DLLibrary::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &DLLibrary::set_platform_file);
- ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &DLLibrary::get_platform_file);
+void GDNativeLibrary::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &GDNativeLibrary::set_platform_file);
+ ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &GDNativeLibrary::get_platform_file);
}
-DLLibrary::DLLibrary() {
+GDNativeLibrary::GDNativeLibrary() {
native_library = NULL;
}
-DLLibrary::~DLLibrary() {
+GDNativeLibrary::~GDNativeLibrary() {
if (!native_library) {
return;
@@ -795,7 +842,7 @@ DLLibrary::~DLLibrary() {
// Instance
-bool DLInstance::set(const StringName &p_name, const Variant &p_value) {
+bool GDNativeInstance::set(const StringName &p_name, const Variant &p_value) {
if (!script->script_data)
return false;
if (script->script_data->properties.has(p_name)) {
@@ -805,7 +852,7 @@ bool DLInstance::set(const StringName &p_name, const Variant &p_value) {
return false;
}
-bool DLInstance::get(const StringName &p_name, Variant &r_ret) const {
+bool GDNativeInstance::get(const StringName &p_name, Variant &r_ret) const {
if (!script->script_data)
return false;
if (script->script_data->properties.has(p_name)) {
@@ -816,12 +863,12 @@ bool DLInstance::get(const StringName &p_name, Variant &r_ret) const {
return false;
}
-void DLInstance::get_property_list(List<PropertyInfo> *p_properties) const {
+void GDNativeInstance::get_property_list(List<PropertyInfo> *p_properties) const {
script->get_script_property_list(p_properties);
// TODO: dynamic properties
}
-Variant::Type DLInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
+Variant::Type GDNativeInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
if (script->script_data->properties.has(p_name)) {
*r_is_valid = true;
return script->script_data->properties[p_name].info.type;
@@ -830,20 +877,20 @@ Variant::Type DLInstance::get_property_type(const StringName &p_name, bool *r_is
return Variant::NIL;
}
-void DLInstance::get_method_list(List<MethodInfo> *p_list) const {
+void GDNativeInstance::get_method_list(List<MethodInfo> *p_list) const {
script->get_script_method_list(p_list);
}
-bool DLInstance::has_method(const StringName &p_method) const {
+bool GDNativeInstance::has_method(const StringName &p_method) const {
return script->has_method(p_method);
}
-Variant DLInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+Variant GDNativeInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
// TODO: validated methods & errors
- DLScriptData *data_ptr = script->script_data;
+ GDNativeScriptData *data_ptr = script->script_data;
while (data_ptr) {
- Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
+ Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
if (E) {
godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args);
return *(Variant *)&result;
@@ -854,12 +901,12 @@ Variant DLInstance::call(const StringName &p_method, const Variant **p_args, int
return Variant();
}
-void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
+void GDNativeInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
// TODO: validated methods & errors
- DLScriptData *data_ptr = script->script_data;
+ GDNativeScriptData *data_ptr = script->script_data;
while (data_ptr) {
- Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
+ Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
if (E) {
E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args);
}
@@ -867,7 +914,7 @@ void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_a
}
}
-void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) {
+void GDNativeInstance::_ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) {
// TODO: validated methods & errors
if (data_ptr->base_data)
@@ -875,34 +922,34 @@ void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_m
// Variant::CallError ce;
- Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
+ Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method);
if (E) {
E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args);
}
}
-void DLInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) {
+void GDNativeInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) {
if (script.ptr() && script->script_data) {
_ml_call_reversed(script->script_data, p_method, p_args, p_argcount);
}
}
-void DLInstance::notification(int p_notification) {
+void GDNativeInstance::notification(int p_notification) {
Variant value = p_notification;
const Variant *args[1] = { &value };
- call_multilevel(DLScriptLanguage::singleton->strings._notification, args, 1);
+ call_multilevel(GDNativeScriptLanguage::singleton->strings._notification, args, 1);
}
-Ref<Script> DLInstance::get_script() const {
+Ref<Script> GDNativeInstance::get_script() const {
return script;
}
-ScriptLanguage *DLInstance::get_language() {
- return DLScriptLanguage::singleton;
+ScriptLanguage *GDNativeInstance::get_language() {
+ return GDNativeScriptLanguage::singleton;
}
-ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) const {
- DLScriptData::Method m = script->script_data->methods[p_method];
+ScriptInstance::RPCMode GDNativeInstance::get_rpc_mode(const StringName &p_method) const {
+ GDNativeScriptData::Method m = script->script_data->methods[p_method];
switch (m.rpc_mode) {
case GODOT_METHOD_RPC_MODE_DISABLED:
return RPC_MODE_DISABLED;
@@ -919,8 +966,8 @@ ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) con
}
}
-ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable) const {
- DLScriptData::Property p = script->script_data->properties[p_variable];
+ScriptInstance::RPCMode GDNativeInstance::get_rset_mode(const StringName &p_variable) const {
+ GDNativeScriptData::Property p = script->script_data->properties[p_variable];
switch (p.rset_mode) {
case GODOT_METHOD_RPC_MODE_DISABLED:
return RPC_MODE_DISABLED;
@@ -937,12 +984,12 @@ ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable)
}
}
-DLInstance::DLInstance() {
+GDNativeInstance::GDNativeInstance() {
owner = NULL;
userdata = NULL;
}
-DLInstance::~DLInstance() {
+GDNativeInstance::~GDNativeInstance() {
if (script.is_valid()) {
if (owner) {
script->instances.erase(owner);
@@ -959,31 +1006,31 @@ DLInstance::~DLInstance() {
// Language
-DLScriptLanguage *DLScriptLanguage::singleton = NULL;
+GDNativeScriptLanguage *GDNativeScriptLanguage::singleton = NULL;
-String DLScriptLanguage::get_name() const {
- return "DLScript";
+String GDNativeScriptLanguage::get_name() const {
+ return "Native";
}
void _add_reload_node() {
#ifdef TOOLS_ENABLED
- DLReloadNode *rn = memnew(DLReloadNode);
+ GDNativeReloadNode *rn = memnew(GDNativeReloadNode);
EditorNode::get_singleton()->add_child(rn);
#endif
}
-void DLScriptLanguage::init() {
+void GDNativeScriptLanguage::init() {
// TODO: Expose globals
- GLOBAL_DEF("dlscript/default_dllibrary", "");
- PropertyInfo prop_info(Variant::STRING, "dlscript/default_dllibrary", PROPERTY_HINT_FILE, "tres,res,dllib");
- GlobalConfig::get_singleton()->set_custom_property_info("dlscript/default_dllibrary", prop_info);
+ GLOBAL_DEF("gdnative/default_gdnativelibrary", "");
+ PropertyInfo prop_info(Variant::STRING, "gdnative/default_gdnativelibrary", PROPERTY_HINT_FILE, "tres,res,dllib");
+ GlobalConfig::get_singleton()->set_custom_property_info("gdnative/default_gdnativelibrary", prop_info);
// generate bindings
#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
List<String> args = OS::get_singleton()->get_cmdline_args();
- List<String>::Element *E = args.find("--dlscript-generate-json-api");
+ List<String>::Element *E = args.find("--gdnative-generate-json-api");
if (E && E->next()) {
if (generate_c_api(E->next()->get()) != OK) {
@@ -999,162 +1046,160 @@ void DLScriptLanguage::init() {
#endif
}
-String DLScriptLanguage::get_type() const {
- return "DLScript";
+String GDNativeScriptLanguage::get_type() const {
+ return "Native";
}
-String DLScriptLanguage::get_extension() const {
- return "dl";
+String GDNativeScriptLanguage::get_extension() const {
+ return "gdn";
}
-Error DLScriptLanguage::execute_file(const String &p_path) {
+Error GDNativeScriptLanguage::execute_file(const String &p_path) {
return OK; // ??
}
-void DLScriptLanguage::finish() {
+void GDNativeScriptLanguage::finish() {
// cleanup is for noobs
}
// scons doesn't want to link in the api source so we need to call a dummy function to cause it to link
extern "C" void _api_anchor();
-void DLScriptLanguage::_compile_dummy_for_the_api() {
+void GDNativeScriptLanguage::_compile_dummy_for_the_api() {
_api_anchor();
}
-Ref<Script> DLScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
- DLScript *src = memnew(DLScript);
+Ref<Script> GDNativeScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
+ GDNativeScript *src = memnew(GDNativeScript);
src->set_script_name(p_class_name);
- return Ref<DLScript>(src);
+ return Ref<GDNativeScript>(src);
}
-bool DLScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
+bool GDNativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const {
return false; // TODO
}
-Script *DLScriptLanguage::create_script() const {
- DLScript *scr = memnew(DLScript);
+Script *GDNativeScriptLanguage::create_script() const {
+ GDNativeScript *scr = memnew(GDNativeScript);
return scr;
}
-bool DLScriptLanguage::has_named_classes() const {
+bool GDNativeScriptLanguage::has_named_classes() const {
return true;
}
-int DLScriptLanguage::find_function(const String &p_function, const String &p_code) const {
+int GDNativeScriptLanguage::find_function(const String &p_function, const String &p_code) const {
return -1; // No source code!
}
-String DLScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const {
+String GDNativeScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const {
return ""; // No source code!
}
-void DLScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {
+void GDNativeScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {
// TODO TODO TODO
}
// TODO: Any debugging? (research)
-String DLScriptLanguage::debug_get_error() const {
+String GDNativeScriptLanguage::debug_get_error() const {
return "";
}
-int DLScriptLanguage::debug_get_stack_level_count() const {
+int GDNativeScriptLanguage::debug_get_stack_level_count() const {
return 1; // ?
}
-int DLScriptLanguage::debug_get_stack_level_line(int p_level) const {
+int GDNativeScriptLanguage::debug_get_stack_level_line(int p_level) const {
return -1;
}
-String DLScriptLanguage::debug_get_stack_level_function(int p_level) const {
+String GDNativeScriptLanguage::debug_get_stack_level_function(int p_level) const {
return "[native code]"; // ?
}
-String DLScriptLanguage::debug_get_stack_level_source(int p_level) const {
+String GDNativeScriptLanguage::debug_get_stack_level_source(int p_level) const {
return "";
}
-void DLScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+void GDNativeScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
-void DLScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+void GDNativeScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
-String DLScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
+String GDNativeScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
return ""; // ??
}
-void DLScriptLanguage::reload_all_scripts() {
+void GDNativeScriptLanguage::reload_all_scripts() {
// @Todo
}
-void DLScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) {
+void GDNativeScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) {
// @Todo
OS::get_singleton()->print("reload tool scripts\n");
}
-void DLScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const {
- p_extensions->push_back("dl"); // Container file format
+void GDNativeScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const {
+ p_extensions->push_back("gdn"); // Container file format
}
-void DLScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const {
+void GDNativeScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const {
}
-void DLScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const {
+void GDNativeScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const {
}
// TODO: all profilling
-void DLScriptLanguage::profiling_start() {
+void GDNativeScriptLanguage::profiling_start() {
}
-void DLScriptLanguage::profiling_stop() {
+void GDNativeScriptLanguage::profiling_stop() {
}
-int DLScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) {
+int GDNativeScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) {
return 0;
}
-int DLScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) {
+int GDNativeScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) {
return 0;
}
-void DLScriptLanguage::frame() {
+void GDNativeScriptLanguage::frame() {
}
-String DLScriptLanguage::get_init_symbol_name() {
- return "godot_dlscript_init"; // TODO: Maybe make some internal function which would do the actual stuff
+String GDNativeScriptLanguage::get_init_symbol_name() {
+ return "godot_native_init"; // TODO: Maybe make some internal function which would do the actual stuff
}
-String DLScriptLanguage::get_terminate_symbol_name() {
- return "godot_dlscript_terminate";
+String GDNativeScriptLanguage::get_terminate_symbol_name() {
+ return "godot_native_terminate";
}
-DLScriptLanguage::DLScriptLanguage() {
+GDNativeScriptLanguage::GDNativeScriptLanguage() {
ERR_FAIL_COND(singleton);
strings._notification = StringName("_notification");
singleton = this;
initialized_libraries = Map<StringName, NativeLibrary *>();
}
-DLScriptLanguage::~DLScriptLanguage() {
+GDNativeScriptLanguage::~GDNativeScriptLanguage() {
singleton = NULL;
}
// DLReloadNode
-void DLReloadNode::_bind_methods() {
- ClassDB::bind_method("_notification", &DLReloadNode::_notification);
+void GDNativeReloadNode::_bind_methods() {
+ ClassDB::bind_method("_notification", &GDNativeReloadNode::_notification);
}
-void DLReloadNode::_notification(int p_what) {
+void GDNativeReloadNode::_notification(int p_what) {
#ifdef TOOLS_ENABLED
switch (p_what) {
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
- // break; // For now.
-
Set<NativeLibrary *> libs_to_reload;
- for (Map<StringName, NativeLibrary *>::Element *L = DLScriptLanguage::get_singleton()->initialized_libraries.front(); L; L = L->next()) {
+ for (Map<StringName, NativeLibrary *>::Element *L = GDNativeScriptLanguage::get_singleton()->initialized_libraries.front(); L; L = L->next()) {
// check if file got modified at all
// @Todo
@@ -1163,34 +1208,32 @@ void DLReloadNode::_notification(int p_what) {
for (Set<NativeLibrary *>::Element *L = libs_to_reload.front(); L; L = L->next()) {
- DLLibrary *lib = L->get()->dllib;
+ GDNativeLibrary *lib = L->get()->dllib;
lib->_terminate();
lib->_initialize();
// update placeholders (if any)
- DLScript *script = NULL;
+ Set<GDNativeScript *> scripts;
- for (Set<DLScript *>::Element *S = DLScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) {
+ for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) {
if (lib->native_library->scripts.has(S->get()->get_script_name())) {
- script = S->get();
+ GDNativeScript *script = S->get();
script->script_data = lib->get_script_data(script->get_script_name());
- break;
+ scripts.insert(script);
}
}
- if (script == NULL) {
- // new class, cool. Nothing to do here
- continue;
- }
-
- if (script->placeholders.size() == 0)
- continue;
+ for (Set<GDNativeScript *>::Element *S = scripts.front(); S; S = S->next()) {
+ GDNativeScript *script = S->get();
+ if (script->placeholders.size() == 0)
+ continue;
- for (Set<PlaceHolderScriptInstance *>::Element *P = script->placeholders.front(); P; P = P->next()) {
- PlaceHolderScriptInstance *p = P->get();
- script->_update_placeholder(p);
+ for (Set<PlaceHolderScriptInstance *>::Element *P = script->placeholders.front(); P; P = P->next()) {
+ PlaceHolderScriptInstance *p = P->get();
+ script->_update_placeholder(p);
+ }
}
}
@@ -1203,35 +1246,35 @@ void DLReloadNode::_notification(int p_what) {
// Resource loader/saver
-RES ResourceFormatLoaderDLScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
+RES ResourceFormatLoaderGDNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
ResourceFormatLoaderText rsflt;
return rsflt.load(p_path, p_original_path, r_error);
}
-void ResourceFormatLoaderDLScript::get_recognized_extensions(List<String> *p_extensions) const {
- p_extensions->push_back("dl");
+void ResourceFormatLoaderGDNativeScript::get_recognized_extensions(List<String> *p_extensions) const {
+ p_extensions->push_back("gdn");
}
-bool ResourceFormatLoaderDLScript::handles_type(const String &p_type) const {
- return (p_type == "Script" || p_type == "DLScript");
+bool ResourceFormatLoaderGDNativeScript::handles_type(const String &p_type) const {
+ return (p_type == "Script" || p_type == "Native");
}
-String ResourceFormatLoaderDLScript::get_resource_type(const String &p_path) const {
+String ResourceFormatLoaderGDNativeScript::get_resource_type(const String &p_path) const {
String el = p_path.get_extension().to_lower();
- if (el == "dl")
- return "DLScript";
+ if (el == "gdn")
+ return "Native";
return "";
}
-Error ResourceFormatSaverDLScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
+Error ResourceFormatSaverGDNativeScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
ResourceFormatSaverText rfst;
return rfst.save(p_path, p_resource, p_flags);
}
-bool ResourceFormatSaverDLScript::recognize(const RES &p_resource) const {
- return p_resource->cast_to<DLScript>() != NULL;
+bool ResourceFormatSaverGDNativeScript::recognize(const RES &p_resource) const {
+ return p_resource->cast_to<GDNativeScript>() != NULL;
}
-void ResourceFormatSaverDLScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
- if (p_resource->cast_to<DLScript>()) {
- p_extensions->push_back("dl");
+void ResourceFormatSaverGDNativeScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
+ if (p_resource->cast_to<GDNativeScript>()) {
+ p_extensions->push_back("gdn");
}
}
diff --git a/modules/dlscript/dl_script.h b/modules/gdnative/gdnative.h
index 630ce21883..27e0c3788b 100644
--- a/modules/dlscript/dl_script.h
+++ b/modules/gdnative/gdnative.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* dl_script.h */
+/* gdnative.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,8 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef DL_SCRIPT_H
-#define DL_SCRIPT_H
+#ifndef GDNATIVE_H
+#define GDNATIVE_H
#include "io/resource_loader.h"
#include "io/resource_saver.h"
@@ -40,26 +40,22 @@
#include "godot.h"
-#ifdef TOOLS_ENABLED
-#define DLSCRIPT_EDITOR_FEATURES
-#endif
-
-class DLScriptData;
-class DLLibrary;
+class GDNativeScriptData;
+class GDNativeLibrary;
struct NativeLibrary {
StringName path;
void *handle;
- DLLibrary *dllib;
+ GDNativeLibrary *dllib;
- Map<StringName, DLScriptData *> scripts;
+ Map<StringName, GDNativeScriptData *> scripts;
static Error initialize(NativeLibrary *&p_native_lib, const StringName p_path);
static Error terminate(NativeLibrary *&p_native_lib);
};
-struct DLScriptData {
+struct GDNativeScriptData {
/* typedef void* (InstanceFunc)(godot_object* instance);
typedef void (DestroyFunc)(godot_object* instance,void* userdata);
typedef godot_variant (MethodFunc)(godot_object *instance, void *userdata, void *method_data, int arg_count,godot_variant **args);
@@ -111,18 +107,18 @@ struct DLScriptData {
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
StringName base;
StringName base_native_type;
- DLScriptData *base_data;
+ GDNativeScriptData *base_data;
godot_instance_create_func create_func;
godot_instance_destroy_func destroy_func;
bool is_tool;
- DLScriptData() {
+ GDNativeScriptData() {
base = StringName();
base_data = NULL;
is_tool = false;
}
- DLScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
+ GDNativeScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
base = p_base;
base_data = NULL;
create_func = p_instance;
@@ -131,16 +127,16 @@ struct DLScriptData {
}
};
-class DLLibrary;
+class GDNativeLibrary;
-class DLScript : public Script {
- GDCLASS(DLScript, Script);
+class GDNativeScript : public Script {
+ GDCLASS(GDNativeScript, Script);
- Ref<DLLibrary> library;
+ Ref<GDNativeLibrary> library;
StringName script_name;
StringName base_native_type;
Set<Object *> instances;
- DLScriptData *script_data;
+ GDNativeScriptData *script_data;
#ifdef TOOLS_ENABLED
Set<PlaceHolderScriptInstance *> placeholders;
@@ -148,10 +144,10 @@ class DLScript : public Script {
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
#endif
- friend class DLInstance;
- friend class DLScriptLanguage;
- friend class DLReloadNode;
- friend class DLLibrary;
+ friend class GDNativeInstance;
+ friend class GDNativeScriptLanguage;
+ friend class GDNativeReloadNode;
+ friend class GDNativeLibrary;
protected:
static void _bind_methods();
@@ -188,32 +184,34 @@ public:
virtual void get_script_method_list(List<MethodInfo> *p_list) const;
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
- Ref<DLLibrary> get_library() const;
- void set_library(Ref<DLLibrary> p_library);
+ Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+
+ Ref<GDNativeLibrary> get_library() const;
+ void set_library(Ref<GDNativeLibrary> p_library);
StringName get_script_name() const;
void set_script_name(StringName p_script_name);
- DLScript();
- ~DLScript();
+ GDNativeScript();
+ ~GDNativeScript();
};
-class DLLibrary : public Resource {
+class GDNativeLibrary : public Resource {
_THREAD_SAFE_CLASS_
- GDCLASS(DLLibrary, Resource);
- OBJ_SAVE_TYPE(DLLibrary);
+ GDCLASS(GDNativeLibrary, Resource);
+ OBJ_SAVE_TYPE(GDNativeLibrary);
Map<StringName, String> platform_files;
NativeLibrary *native_library;
- static DLLibrary *currently_initialized_library;
+ static GDNativeLibrary *currently_initialized_library;
protected:
- friend class DLScript;
+ friend class GDNativeScript;
friend class NativeLibrary;
- friend class DLReloadNode;
+ friend class GDNativeReloadNode;
- DLScriptData *get_script_data(const StringName p_name);
+ GDNativeScriptData *get_script_data(const StringName p_name);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
@@ -225,7 +223,7 @@ public:
Error _initialize();
Error _terminate();
- static DLLibrary *get_currently_initialized_library();
+ static GDNativeLibrary *get_currently_initialized_library();
void _register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
void _register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
@@ -236,18 +234,18 @@ public:
void set_platform_file(StringName p_platform, String p_file);
String get_platform_file(StringName p_platform) const;
- DLLibrary();
- ~DLLibrary();
+ GDNativeLibrary();
+ ~GDNativeLibrary();
};
-class DLInstance : public ScriptInstance {
- friend class DLScript;
+class GDNativeInstance : public ScriptInstance {
+ friend class GDNativeScript;
Object *owner;
- Ref<DLScript> script;
+ Ref<GDNativeScript> script;
void *userdata;
- void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
+ void _ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
public:
_FORCE_INLINE_ Object *get_owner() { return owner; }
@@ -280,19 +278,19 @@ public:
virtual RPCMode get_rpc_mode(const StringName &p_method) const;
virtual RPCMode get_rset_mode(const StringName &p_variable) const;
- DLInstance();
- ~DLInstance();
+ GDNativeInstance();
+ ~GDNativeInstance();
};
-class DLReloadNode;
+class GDNativeReloadNode;
-class DLScriptLanguage : public ScriptLanguage {
- friend class DLScript;
- friend class DLInstance;
- friend class DLReloadNode;
- friend class DLLibrary;
+class GDNativeScriptLanguage : public ScriptLanguage {
+ friend class GDNativeScript;
+ friend class GDNativeInstance;
+ friend class GDNativeReloadNode;
+ friend class GDNativeLibrary;
- static DLScriptLanguage *singleton;
+ static GDNativeScriptLanguage *singleton;
Variant *_global_array; // @Unused necessary?
Vector<Variant> global_array; // @Unused necessary?
@@ -303,7 +301,7 @@ class DLScriptLanguage : public ScriptLanguage {
Mutex *lock;
- Set<DLScript *> script_list;
+ Set<GDNativeScript *> script_list;
bool profiling;
uint64_t script_frame_time;
@@ -317,7 +315,7 @@ class DLScriptLanguage : public ScriptLanguage {
public:
Map<StringName, NativeLibrary *> initialized_libraries;
- _FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; }
+ _FORCE_INLINE_ static GDNativeScriptLanguage *get_singleton() { return singleton; }
virtual String get_name() const;
@@ -391,18 +389,18 @@ public:
/* HACKER FUNCTIONS */
void _compile_dummy_for_the_api();
- DLScriptLanguage();
- ~DLScriptLanguage();
+ GDNativeScriptLanguage();
+ ~GDNativeScriptLanguage();
};
-class DLReloadNode : public Node {
- GDCLASS(DLReloadNode, Node)
+class GDNativeReloadNode : public Node {
+ GDCLASS(GDNativeReloadNode, Node)
public:
static void _bind_methods();
void _notification(int p_what);
};
-class ResourceFormatLoaderDLScript : public ResourceFormatLoader {
+class ResourceFormatLoaderGDNativeScript : public ResourceFormatLoader {
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@@ -410,12 +408,10 @@ public:
virtual String get_resource_type(const String &p_path) const;
};
-class ResourceFormatSaverDLScript : public ResourceFormatSaver {
+class ResourceFormatSaverGDNativeScript : public ResourceFormatSaver {
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual bool recognize(const RES &p_resource) const;
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
};
-// ugly, but hey
-
-#endif // DL_SCRIPT_H
+#endif // GDNATIVE_H
diff --git a/modules/dlscript/godot.cpp b/modules/gdnative/godot.cpp
index 478eb86c08..7477a28db6 100644
--- a/modules/dlscript/godot.cpp
+++ b/modules/gdnative/godot.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* godot_c.cpp */
+/* godot.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -30,8 +30,9 @@
#include "godot.h"
#include "class_db.h"
-#include "dl_script.h"
+#include "gdnative.h"
#include "global_config.h"
+#include "global_constants.h"
#include "variant.h"
#ifdef __cplusplus
@@ -125,7 +126,7 @@ void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind)
// Script API
void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
- DLLibrary *library = DLLibrary::get_currently_initialized_library();
+ GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@@ -134,7 +135,7 @@ void GDAPI godot_script_register_class(const char *p_name, const char *p_base, g
}
void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
- DLLibrary *library = DLLibrary::get_currently_initialized_library();
+ GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@@ -143,7 +144,7 @@ void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_ba
}
void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) {
- DLLibrary *library = DLLibrary::get_currently_initialized_library();
+ GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@@ -152,7 +153,7 @@ void GDAPI godot_script_register_method(const char *p_name, const char *p_functi
}
void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) {
- DLLibrary *library = DLLibrary::get_currently_initialized_library();
+ GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@@ -162,7 +163,7 @@ void GDAPI godot_script_register_property(const char *p_name, const char *p_path
}
void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) {
- DLLibrary *library = DLLibrary::get_currently_initialized_library();
+ GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@@ -171,16 +172,36 @@ void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *
library->_register_script_signal(p_name, p_signal);
}
-void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) {
+void GDAPI *godot_native_get_userdata(godot_object *p_instance) {
Object *instance = (Object *)p_instance;
if (!instance)
return NULL;
- if (instance->get_script_instance() && instance->get_script_instance()->get_language() == DLScriptLanguage::get_singleton()) {
- return ((DLInstance *)instance->get_script_instance())->get_userdata();
+ if (instance->get_script_instance() && instance->get_script_instance()->get_language() == GDNativeScriptLanguage::get_singleton()) {
+ return ((GDNativeInstance *)instance->get_script_instance())->get_userdata();
}
return NULL;
}
+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 NULL;
+}
+
+godot_dictionary GDAPI godot_get_global_constants() {
+ godot_dictionary constants;
+ godot_dictionary_new(&constants);
+ Dictionary *p_constants = (Dictionary *)&constants;
+ const int constants_count = GlobalConstants::get_global_constant_count();
+ for (int i = 0; i < constants_count; ++i) {
+ const char *name = GlobalConstants::get_global_constant_name(i);
+ int value = GlobalConstants::get_global_constant_value(i);
+ (*p_constants)[name] = value;
+ }
+ return constants;
+}
+
// System functions
void GDAPI *godot_alloc(int p_bytes) {
return memalloc(p_bytes);
diff --git a/modules/dlscript/godot.h b/modules/gdnative/godot.h
index 4a977ad8cb..b05cafbe50 100644
--- a/modules/dlscript/godot.h
+++ b/modules/gdnative/godot.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* godot_c.h */
+/* godot.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -38,12 +38,26 @@ extern "C" {
#define GDAPI_EXPORT
#endif
-#if !defined(_WIN32) && !defined(_MSC_VER)
+#ifdef _WIN32
+#if defined(GDAPI_EXPORT)
+#define GDCALLINGCONV
+#define GDAPI __declspec(dllexport) GDCALLINGCONV
+#else
+#define GDCALLINGCONV
+#define GDAPI __declspec(dllimport) GDCALLINGCONV
+#endif
+#elif defined(__APPLE__)
+#include "TargetConditionals.h"
+#if TARGET_OS_IPHONE
+#define GDCALLINGCONV
#define GDAPI
-#elif defined(GDAPI_EXPORT)
-#define GDAPI __declspec(dllexport)
+#elif TARGET_OS_MAC
+#define GDCALLINGCONV __attribute__((sysv_abi))
+#define GDAPI GDCALLINGCONV
+#endif
#else
-#define GDAPI __declspec(dllimport)
+#define GDCALLINGCONV __attribute__((sysv_abi))
+#define GDAPI GDCALLINGCONV
#endif
#include <stdbool.h>
@@ -217,16 +231,16 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj
////// Script API
-typedef struct godot_dlscript_init_options {
+typedef struct godot_native_init_options {
godot_bool in_editor;
uint64_t core_api_hash;
uint64_t editor_api_hash;
uint64_t no_api_hash;
-} godot_dlscript_init_options;
+} godot_native_init_options;
-typedef struct godot_dlscript_terminate_options {
+typedef struct godot_native_terminate_options {
godot_bool in_editor;
-} godot_dlscript_terminate_options;
+} godot_native_terminate_options;
typedef enum godot_method_rpc_mode {
GODOT_METHOD_RPC_MODE_DISABLED,
@@ -314,16 +328,16 @@ typedef struct godot_property_attributes {
typedef struct godot_instance_create_func {
// instance pointer, method_data - return user data
- void *(*create_func)(godot_object *, void *);
+ GDCALLINGCONV void *(*create_func)(godot_object *, void *);
void *method_data;
- void (*free_func)(void *);
-} godot_script_instance_func;
+ GDCALLINGCONV void (*free_func)(void *);
+} godot_instance_create_func;
typedef struct godot_instance_destroy_func {
// instance pointer, method data, user data
- void (*destroy_func)(godot_object *, void *, void *);
+ GDCALLINGCONV void (*destroy_func)(godot_object *, void *, void *);
void *method_data;
- void (*free_func)(void *);
+ GDCALLINGCONV void (*free_func)(void *);
} godot_instance_destroy_func;
void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func);
@@ -332,25 +346,25 @@ void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_ba
typedef struct godot_instance_method {
// instance pointer, method data, user data, num args, args - return result as varaint
- godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **);
+ GDCALLINGCONV godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **);
void *method_data;
- void (*free_func)(void *);
+ GDCALLINGCONV void (*free_func)(void *);
} godot_instance_method;
void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method);
typedef struct godot_property_set_func {
// instance pointer, method data, user data, value
- void (*set_func)(godot_object *, void *, void *, godot_variant);
+ GDCALLINGCONV void (*set_func)(godot_object *, void *, void *, godot_variant);
void *method_data;
- void (*free_func)(void *);
+ GDCALLINGCONV void (*free_func)(void *);
} godot_property_set_func;
typedef struct godot_property_get_func {
// instance pointer, method data, user data, value
- godot_variant (*get_func)(godot_object *, void *, void *);
+ GDCALLINGCONV godot_variant (*get_func)(godot_object *, void *, void *);
void *method_data;
- void (*free_func)(void *);
+ GDCALLINGCONV void (*free_func)(void *);
} godot_property_get_func;
void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func);
@@ -374,7 +388,14 @@ typedef struct godot_signal {
void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal);
-void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance);
+void GDAPI *godot_native_get_userdata(godot_object *p_instance);
+
+// 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();
////// System Functions
diff --git a/modules/dlscript/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp
index 21ad97ca78..6c55c5d048 100644
--- a/modules/dlscript/godot/godot_array.cpp
+++ b/modules/gdnative/godot/godot_array.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_array.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_array.h"
#include "core/array.h"
diff --git a/modules/dlscript/godot/godot_array.h b/modules/gdnative/godot/godot_array.h
index 544e95a2ed..b92ebb834f 100644
--- a/modules/dlscript/godot/godot_array.h
+++ b/modules/gdnative/godot/godot_array.h
@@ -1,5 +1,35 @@
-#ifndef GODOT_DLSCRIPT_ARRAY_H
-#define GODOT_DLSCRIPT_ARRAY_H
+/*************************************************************************/
+/* godot_array.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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" {
@@ -85,4 +115,4 @@ void GDAPI godot_array_destroy(godot_array *p_arr);
}
#endif
-#endif // GODOT_DLSCRIPT_ARRAY_H
+#endif // GODOT_ARRAY_H
diff --git a/modules/gdnative/godot/godot_basis.cpp b/modules/gdnative/godot/godot_basis.cpp
new file mode 100644
index 0000000000..474cd3d448
--- /dev/null
+++ b/modules/gdnative/godot/godot_basis.cpp
@@ -0,0 +1,215 @@
+/*************************************************************************/
+/* godot_basis.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_basis.h"
+
+#include "math/matrix3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _basis_api_anchor() {
+}
+
+void GDAPI godot_basis_new(godot_basis *p_v) {
+ Basis *v = (Basis *)p_v;
+ *v = Basis();
+}
+
+void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_v, const godot_quat *p_euler) {
+ Basis *v = (Basis *)p_v;
+ Quat *euler = (Quat *)p_euler;
+ *v = Basis(*euler);
+}
+
+void GDAPI godot_basis_new_with_euler(godot_basis *p_v, const godot_vector3 p_euler) {
+ Basis *v = (Basis *)p_v;
+ Vector3 *euler = (Vector3 *)&p_euler;
+ *v = Basis(*euler);
+}
+
+void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi) {
+ Basis *v = (Basis *)p_v;
+ const Vector3 *axis = (Vector3 *)&p_axis;
+ *v = Basis(*axis, p_phi);
+}
+
+void GDAPI godot_basis_new_with_rows(godot_basis *p_v, const godot_vector3 p_row0, const godot_vector3 p_row1, const godot_vector3 p_row2) {
+ Basis *v = (Basis *)p_v;
+ const Vector3 *row0 = (Vector3 *)&p_row0;
+ const Vector3 *row1 = (Vector3 *)&p_row1;
+ const Vector3 *row2 = (Vector3 *)&p_row2;
+ *v = Basis(*row0, *row1, *row2);
+}
+
+godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_v) {
+ const Basis *v = (const Basis *)p_v;
+ godot_quat quat;
+ Quat *p_quat = (Quat *)&quat;
+ *p_quat = v->operator Quat();
+ return quat;
+}
+
+/*
+ * p_elements is a pointer to an array of 3 (!!) vector3
+ */
+void GDAPI godot_basis_get_elements(godot_basis *p_v, godot_vector3 *p_elements) {
+ Basis *v = (Basis *)p_v;
+ Vector3 *elements = (Vector3 *)p_elements;
+ elements[0] = v->elements[0];
+ elements[1] = v->elements[1];
+ elements[2] = v->elements[2];
+}
+
+godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_v, const godot_int p_axis) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->get_axis(p_axis);
+ return dest;
+}
+
+void GDAPI godot_basis_set_axis(godot_basis *p_v, const godot_int p_axis, const godot_vector3 p_value) {
+ Basis *v = (Basis *)p_v;
+ const Vector3 *value = (Vector3 *)&p_value;
+ v->set_axis(p_axis, *value);
+}
+
+godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_v, const godot_int p_row) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->get_row(p_row);
+ return dest;
+}
+
+void GDAPI godot_basis_set_row(godot_basis *p_v, const godot_int p_row, const godot_vector3 p_value) {
+ Basis *v = (Basis *)p_v;
+ const Vector3 *value = (Vector3 *)&p_value;
+ v->set_row(p_row, *value);
+}
+
+godot_real godot_basis_determinant(const godot_basis *p_v) {
+ Basis *v = (Basis *)p_v;
+ return v->determinant();
+}
+
+godot_vector3 godot_basis_get_euler(const godot_basis *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->get_euler();
+ return dest;
+}
+
+godot_int godot_basis_get_orthogonal_index(const godot_basis *p_v) {
+ const Basis *v = (Basis *)p_v;
+ return v->get_orthogonal_index();
+}
+
+godot_vector3 godot_basis_get_scale(const godot_basis *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->get_scale();
+ return dest;
+}
+
+void godot_basis_inverse(godot_basis *p_dest, const godot_basis *p_v) {
+ Basis *d = (Basis *)p_dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->inverse();
+}
+
+void godot_basis_orthonormalized(godot_basis *p_dest, const godot_basis *p_v) {
+ Basis *d = (Basis *)p_dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->orthonormalized();
+}
+
+void godot_basis_rotated(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi) {
+ Basis *d = (Basis *)p_dest;
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *axis = (Vector3 *)&p_axis;
+ *d = v->rotated(*axis, p_phi);
+}
+
+void godot_basis_scaled(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_scale) {
+ Basis *d = (Basis *)p_dest;
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *scale = (Vector3 *)&p_scale;
+ *d = v->scaled(*scale);
+}
+
+godot_real godot_basis_tdotx(const godot_basis *p_v, const godot_vector3 p_with) {
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *with = (Vector3 *)&p_with;
+ return v->tdotx(*with);
+}
+
+godot_real godot_basis_tdoty(const godot_basis *p_v, const godot_vector3 p_with) {
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *with = (Vector3 *)&p_with;
+ return v->tdoty(*with);
+}
+
+godot_real godot_basis_tdotz(const godot_basis *p_v, const godot_vector3 p_with) {
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *with = (Vector3 *)&p_with;
+ return v->tdotz(*with);
+}
+
+void godot_basis_transposed(godot_basis *p_dest, const godot_basis *p_v) {
+ Basis *d = (Basis *)p_dest;
+ const Basis *v = (Basis *)p_v;
+ *d = v->transposed();
+}
+
+godot_vector3 godot_basis_xform(const godot_basis *p_v, const godot_vector3 p_vect) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *vect = (Vector3 *)&p_vect;
+ *d = v->xform(*vect);
+ return dest;
+}
+
+godot_vector3 godot_basis_xform_inv(const godot_basis *p_v, const godot_vector3 p_vect) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Basis *v = (Basis *)p_v;
+ const Vector3 *vect = (Vector3 *)&p_vect;
+ *d = v->xform_inv(*vect);
+ return dest;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_basis.h b/modules/gdnative/godot/godot_basis.h
new file mode 100644
index 0000000000..2803396997
--- /dev/null
+++ b/modules/gdnative/godot/godot_basis.h
@@ -0,0 +1,84 @@
+/*************************************************************************/
+/* godot_basis.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
+typedef struct godot_basis {
+ uint8_t _dont_touch_that[36];
+} godot_basis;
+#endif
+
+#include "../godot.h"
+#include "godot_quat.h"
+
+void GDAPI godot_basis_new(godot_basis *p_v);
+void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_v, const godot_quat *p_euler);
+void GDAPI godot_basis_new_with_euler(godot_basis *p_v, const godot_vector3 p_euler);
+void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi);
+void GDAPI godot_basis_new_with_rows(godot_basis *p_v, const godot_vector3 p_row0, const godot_vector3 p_row1, const godot_vector3 p_row2);
+
+godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_v);
+
+/*
+ * p_elements is a pointer to an array of 3 (!!) vector3
+ */
+void GDAPI godot_basis_get_elements(godot_basis *p_v, godot_vector3 *p_elements);
+godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_v, const godot_int p_axis);
+void GDAPI godot_basis_set_axis(godot_basis *p_v, const godot_int p_axis, const godot_vector3 p_value);
+godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_v, const godot_int p_row);
+void GDAPI godot_basis_set_row(godot_basis *p_v, const godot_int p_row, const godot_vector3 p_value);
+
+godot_real godot_basis_determinant(const godot_basis *p_v);
+godot_vector3 godot_basis_get_euler(const godot_basis *p_v);
+godot_int godot_basis_get_orthogonal_index(const godot_basis *p_v);
+godot_vector3 godot_basis_get_scale(const godot_basis *p_v);
+void godot_basis_inverse(godot_basis *p_dest, const godot_basis *p_v);
+void godot_basis_orthonormalized(godot_basis *p_dest, const godot_basis *p_v);
+void godot_basis_rotated(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi);
+void godot_basis_scaled(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_scale);
+godot_real godot_basis_tdotx(const godot_basis *p_v, const godot_vector3 p_with);
+godot_real godot_basis_tdoty(const godot_basis *p_v, const godot_vector3 p_with);
+godot_real godot_basis_tdotz(const godot_basis *p_v, const godot_vector3 p_with);
+void godot_basis_transposed(godot_basis *p_dest, const godot_basis *p_v);
+godot_vector3 godot_basis_xform(const godot_basis *p_v, const godot_vector3 p_vect);
+godot_vector3 godot_basis_xform_inv(const godot_basis *p_v, const godot_vector3 p_vect);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_BASIS_H
diff --git a/modules/gdnative/godot/godot_color.cpp b/modules/gdnative/godot/godot_color.cpp
new file mode 100644
index 0000000000..203ce672fa
--- /dev/null
+++ b/modules/gdnative/godot/godot_color.cpp
@@ -0,0 +1,63 @@
+/*************************************************************************/
+/* godot_color.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_color.h"
+
+#include "color.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _color_api_anchor() {
+}
+
+void GDAPI godot_color_new(godot_color *p_color) {
+ Color *color = (Color *)p_color;
+ *color = Color();
+}
+
+void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
+ Color *color = (Color *)p_color;
+ *color = Color(r, g, b, a);
+}
+
+uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
+ const Color *color = (const Color *)p_color;
+ return color->to_32();
+}
+
+float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
+ Color *color = (Color *)p_color;
+ return &color->operator[](idx);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_color.h b/modules/gdnative/godot/godot_color.h
new file mode 100644
index 0000000000..b99a062a66
--- /dev/null
+++ b/modules/gdnative/godot/godot_color.h
@@ -0,0 +1,58 @@
+/*************************************************************************/
+/* godot_color.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
+typedef struct godot_color {
+ uint8_t _dont_touch_that[16];
+} godot_color;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_color_new(godot_color *p_color);
+void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a);
+
+uint32_t GDAPI godot_color_get_32(const godot_color *p_color);
+
+float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_COLOR_H
diff --git a/modules/dlscript/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp
index 9147b17307..16d08e58e2 100644
--- a/modules/dlscript/godot/godot_dictionary.cpp
+++ b/modules/gdnative/godot/godot_dictionary.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_dictionary.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_dictionary.h"
#include "core/dictionary.h"
diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h
new file mode 100644
index 0000000000..3f7c504880
--- /dev/null
+++ b/modules/gdnative/godot/godot_dictionary.h
@@ -0,0 +1,80 @@
+/*************************************************************************/
+/* godot_dictionary.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED
+typedef struct godot_dictionary {
+ uint8_t _dont_touch_that[8];
+} godot_dictionary;
+#endif
+
+#include "godot_array.h"
+#include "godot_variant.h"
+
+void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
+
+void GDAPI godot_dictionary_clear(godot_dictionary *p_dict);
+
+godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict);
+
+void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key);
+
+godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key);
+
+godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys);
+
+uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict);
+
+godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict);
+
+godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json);
+
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
+
+godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict);
+
+godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
+
+godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
+
+void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DICTIONARY_H
diff --git a/modules/dlscript/godot/godot_image.cpp b/modules/gdnative/godot/godot_image.cpp
index 362d1aa3e6..ae8290afc2 100644
--- a/modules/dlscript/godot/godot_image.cpp
+++ b/modules/gdnative/godot/godot_image.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_image.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_image.h"
#include "image.h"
diff --git a/modules/dlscript/godot/godot_image.h b/modules/gdnative/godot/godot_image.h
index 78593f21a7..c43dd45148 100644
--- a/modules/dlscript/godot/godot_image.h
+++ b/modules/gdnative/godot/godot_image.h
@@ -1,5 +1,34 @@
-#ifndef GODOT_DLSCRIPT_IMAGE_H
-#define GODOT_DLSCRIPT_IMAGE_H
+/*************************************************************************/
+/* godot_image.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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_IMAGE_H
+#define GODOT_IMAGE_H
#ifdef __cplusplus
extern "C" {
@@ -92,4 +121,4 @@ void GDAPI godot_image_destroy(godot_image *p_img);
}
#endif
-#endif // GODOT_DLSCRIPT_IMAGE_H
+#endif // GODOT_IMAGE_H
diff --git a/modules/dlscript/godot/godot_input_event.cpp b/modules/gdnative/godot/godot_input_event.cpp
index b50ed8a22d..0401c96a88 100644
--- a/modules/dlscript/godot/godot_input_event.cpp
+++ b/modules/gdnative/godot/godot_input_event.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_input_event.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_input_event.h"
#include "os/input_event.h"
diff --git a/modules/dlscript/godot/godot_input_event.h b/modules/gdnative/godot/godot_input_event.h
index bfda18bf7c..b0a133e3d9 100644
--- a/modules/dlscript/godot/godot_input_event.h
+++ b/modules/gdnative/godot/godot_input_event.h
@@ -1,5 +1,34 @@
-#ifndef GODOT_DLSCRIPT_INPUT_EVENT_H
-#define GODOT_DLSCRIPT_INPUT_EVENT_H
+/*************************************************************************/
+/* godot_input_event.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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_INPUT_EVENT_H
+#define GODOT_INPUT_EVENT_H
#ifdef __cplusplus
extern "C" {
@@ -203,4 +232,4 @@ float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_even
}
#endif
-#endif // GODOT_DLSCRIPT_INPUT_EVENT_H
+#endif // GODOT_INPUT_EVENT_H
diff --git a/modules/dlscript/godot/godot_node_path.cpp b/modules/gdnative/godot/godot_node_path.cpp
index 8b79175e44..a2c9e11699 100644
--- a/modules/dlscript/godot/godot_node_path.cpp
+++ b/modules/gdnative/godot/godot_node_path.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_node_path.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_node_path.h"
#include "path_db.h"
diff --git a/modules/gdnative/godot/godot_node_path.h b/modules/gdnative/godot/godot_node_path.h
new file mode 100644
index 0000000000..c5f313d190
--- /dev/null
+++ b/modules/gdnative/godot/godot_node_path.h
@@ -0,0 +1,68 @@
+/*************************************************************************/
+/* godot_node_path.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
+typedef struct godot_node_path {
+ uint8_t _dont_touch_that[8];
+} godot_node_path;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from);
+void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from);
+
+godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx);
+godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np);
+
+godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np);
+godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx);
+godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np);
+
+godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np);
+godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np);
+
+godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np);
+
+void GDAPI godot_node_path_destroy(godot_node_path *p_np);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_NODE_PATH_H
diff --git a/modules/gdnative/godot/godot_plane.cpp b/modules/gdnative/godot/godot_plane.cpp
new file mode 100644
index 0000000000..38329ef709
--- /dev/null
+++ b/modules/gdnative/godot/godot_plane.cpp
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* godot_plane.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_plane.h"
+
+#include "math/plane.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _plane_api_anchor() {
+}
+
+void GDAPI godot_plane_new(godot_plane *p_pl) {
+ Plane *pl = (Plane *)p_pl;
+ *pl = Plane();
+}
+
+void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) {
+ Plane *pl = (Plane *)p_pl;
+ const Vector3 *normal = (const Vector3 *)p_normal;
+ *pl = Plane(*normal, p_d);
+}
+
+void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) {
+ Plane *pl = (Plane *)p_pl;
+ const Vector3 *normal = (const Vector3 *)p_normal;
+ pl->set_normal(*normal);
+}
+
+godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) {
+ const Plane *pl = (const Plane *)p_pl;
+ const Vector3 normal = pl->get_normal();
+ godot_vector3 *v3 = (godot_vector3 *)&normal;
+ return *v3;
+}
+
+void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) {
+ Plane *pl = (Plane *)p_pl;
+ pl->d = p_d;
+}
+
+godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) {
+ const Plane *pl = (const Plane *)p_pl;
+ return pl->d;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_plane.h b/modules/gdnative/godot/godot_plane.h
new file mode 100644
index 0000000000..c98e45c9cb
--- /dev/null
+++ b/modules/gdnative/godot/godot_plane.h
@@ -0,0 +1,66 @@
+/*************************************************************************/
+/* godot_plane.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
+typedef struct godot_plane {
+ uint8_t _dont_touch_that[16];
+} godot_plane;
+#endif
+
+#include "godot_vector3.h"
+
+void GDAPI godot_plane_new(godot_plane *p_pl);
+void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d);
+
+// @Incomplete
+// These are additional valid constructors
+// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
+// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal);
+// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
+
+void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal);
+godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl);
+
+godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl);
+void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_PLANE_H
diff --git a/modules/dlscript/godot/godot_pool_arrays.cpp b/modules/gdnative/godot/godot_pool_arrays.cpp
index 3fb030f835..93e9a9e9dc 100644
--- a/modules/dlscript/godot/godot_pool_arrays.cpp
+++ b/modules/gdnative/godot/godot_pool_arrays.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_pool_arrays.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_pool_arrays.h"
#include "array.h"
diff --git a/modules/dlscript/godot/godot_pool_arrays.h b/modules/gdnative/godot/godot_pool_arrays.h
index 77b6c3dde0..ec9185f6f3 100644
--- a/modules/dlscript/godot/godot_pool_arrays.h
+++ b/modules/gdnative/godot/godot_pool_arrays.h
@@ -1,5 +1,34 @@
-#ifndef GODOT_DLSCRIPT_POOL_ARRAYS_H
-#define GODOT_DLSCRIPT_POOL_ARRAYS_H
+/*************************************************************************/
+/* godot_pool_arrays.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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_POOL_ARRAYS_H
+#define GODOT_POOL_ARRAYS_H
#ifdef __cplusplus
extern "C" {
@@ -253,4 +282,4 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca);
}
#endif
-#endif // GODOT_DLSCRIPT_POOL_ARRAYS_H
+#endif // GODOT_POOL_ARRAYS_H
diff --git a/modules/gdnative/godot/godot_quat.cpp b/modules/gdnative/godot/godot_quat.cpp
new file mode 100644
index 0000000000..7c3a71dfc0
--- /dev/null
+++ b/modules/gdnative/godot/godot_quat.cpp
@@ -0,0 +1,106 @@
+/*************************************************************************/
+/* godot_quat.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_quat.h"
+
+#include "math/quat.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _quat_api_anchor() {
+}
+
+void GDAPI godot_quat_new(godot_quat *p_quat) {
+ Quat *quat = (Quat *)p_quat;
+ *quat = Quat();
+}
+
+void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) {
+ Quat *quat = (Quat *)p_quat;
+ *quat = Quat(x, y, z, w);
+}
+
+void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) {
+ Quat *quat = (Quat *)p_quat;
+ const Vector3 *axis = (const Vector3 *)p_axis;
+ *quat = Quat(*axis, p_angle);
+}
+
+void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) {
+ Quat *quat = (Quat *)p_quat;
+ const Vector3 *v0 = (const Vector3 *)p_v0;
+ const Vector3 *v1 = (const Vector3 *)p_v1;
+ *quat = Quat(*v0, *v1);
+}
+
+godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) {
+ Quat *quat = (Quat *)p_quat;
+ Vector3 euler = quat->get_euler();
+ return *(godot_vector3 *)&euler;
+}
+
+void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) {
+ Quat *quat = (Quat *)p_quat;
+ const Vector3 *euler = (const Vector3 *)p_euler;
+ quat->set_euler(*euler);
+}
+
+godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) {
+ Quat *quat = (Quat *)p_quat;
+ switch (p_idx) {
+ case 0:
+ return &quat->x;
+ case 1:
+ return &quat->y;
+ case 2:
+ return &quat->z;
+ default:
+ return &quat->y;
+ }
+}
+
+godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) {
+ const Quat *quat = (const Quat *)p_quat;
+ switch (p_idx) {
+ case 0:
+ return quat->x;
+ case 1:
+ return quat->y;
+ case 2:
+ return quat->z;
+ default:
+ return quat->y;
+ }
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_quat.h b/modules/gdnative/godot/godot_quat.h
new file mode 100644
index 0000000000..35b1acd3ed
--- /dev/null
+++ b/modules/gdnative/godot/godot_quat.h
@@ -0,0 +1,62 @@
+/*************************************************************************/
+/* godot_quat.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOT_QUAT_H
+#define GODOT_QUAT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
+typedef struct godot_quat {
+ uint8_t _dont_touch_that[16];
+} godot_quat;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_quat_new(godot_quat *p_quat);
+void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w);
+void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle);
+void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1);
+
+godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat);
+void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler);
+
+godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx);
+godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_QUAT_H
diff --git a/modules/gdnative/godot/godot_rect2.cpp b/modules/gdnative/godot/godot_rect2.cpp
new file mode 100644
index 0000000000..b19096b79e
--- /dev/null
+++ b/modules/gdnative/godot/godot_rect2.cpp
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* godot_rect2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_rect2.h"
+
+#include "math/math_2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _rect2_api_anchor() {
+}
+
+void GDAPI godot_rect2_new(godot_rect2 *p_rect) {
+ Rect2 *rect = (Rect2 *)p_rect;
+ *rect = Rect2();
+}
+
+void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
+ Rect2 *rect = (Rect2 *)p_rect;
+ const Vector2 *pos = (const Vector2 *)p_pos;
+ const Vector2 *size = (const Vector2 *)p_size;
+ *rect = Rect2(*pos, *size);
+}
+
+godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) {
+ Rect2 *rect = (Rect2 *)p_rect;
+ return (godot_vector2 *)&rect->pos;
+}
+
+void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) {
+ Rect2 *rect = (Rect2 *)p_rect;
+ const Vector2 *pos = (const Vector2 *)p_pos;
+ rect->pos = *pos;
+}
+
+godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) {
+ Rect2 *rect = (Rect2 *)p_rect;
+ return (godot_vector2 *)&rect->size;
+}
+
+void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) {
+ Rect2 *rect = (Rect2 *)p_rect;
+ const Vector2 *size = (const Vector2 *)p_size;
+ rect->size = *size;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_rect2.h b/modules/gdnative/godot/godot_rect2.h
new file mode 100644
index 0000000000..e9e4a26897
--- /dev/null
+++ b/modules/gdnative/godot/godot_rect2.h
@@ -0,0 +1,60 @@
+/*************************************************************************/
+/* godot_rect2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
+typedef struct godot_rect2 {
+ uint8_t _dont_touch_that[16];
+} godot_rect2;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_rect2_new(godot_rect2 *p_rect);
+void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size);
+
+godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect);
+void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos);
+
+godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect);
+void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_RECT3_H
diff --git a/modules/gdnative/godot/godot_rect3.cpp b/modules/gdnative/godot/godot_rect3.cpp
new file mode 100644
index 0000000000..96c5d17b1a
--- /dev/null
+++ b/modules/gdnative/godot/godot_rect3.cpp
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* godot_rect3.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_rect3.h"
+
+#include "math/rect3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _rect3_api_anchor() {
+}
+
+void GDAPI godot_rect3_new(godot_rect3 *p_rect) {
+ Rect3 *rect = (Rect3 *)p_rect;
+ *rect = Rect3();
+}
+
+void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
+ Rect3 *rect = (Rect3 *)p_rect;
+ const Vector3 *pos = (const Vector3 *)p_pos;
+ const Vector3 *size = (const Vector3 *)p_size;
+ *rect = Rect3(*pos, *size);
+}
+
+godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) {
+ Rect3 *rect = (Rect3 *)p_rect;
+ return (godot_vector3 *)&rect->pos;
+}
+
+void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) {
+ Rect3 *rect = (Rect3 *)p_rect;
+ const Vector3 *pos = (const Vector3 *)p_pos;
+ rect->pos = *pos;
+}
+
+godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) {
+ Rect3 *rect = (Rect3 *)p_rect;
+ return (godot_vector3 *)&rect->size;
+}
+
+void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) {
+ Rect3 *rect = (Rect3 *)p_rect;
+ const Vector3 *size = (const Vector3 *)p_size;
+ rect->size = *size;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_rect3.h b/modules/gdnative/godot/godot_rect3.h
new file mode 100644
index 0000000000..562ac8379e
--- /dev/null
+++ b/modules/gdnative/godot/godot_rect3.h
@@ -0,0 +1,60 @@
+/*************************************************************************/
+/* godot_rect3.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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_RECT3_H
+#define GODOT_RECT3_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
+typedef struct godot_rect3 {
+ uint8_t _dont_touch_that[24];
+} godot_rect3;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_rect3_new(godot_rect3 *p_rect);
+void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size);
+
+godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect);
+void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos);
+
+godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect);
+void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_RECT3_H
diff --git a/modules/gdnative/godot/godot_rid.cpp b/modules/gdnative/godot/godot_rid.cpp
new file mode 100644
index 0000000000..fff31e3992
--- /dev/null
+++ b/modules/gdnative/godot/godot_rid.cpp
@@ -0,0 +1,65 @@
+/*************************************************************************/
+/* godot_rid.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_rid.h"
+
+#include "object.h"
+#include "resource.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _rid_api_anchor() {
+}
+
+void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) {
+
+ Resource *res_from = ((Object *)p_from)->cast_to<Resource>();
+
+ RID *rid = (RID *)p_rid;
+ memnew_placement(rid, RID);
+
+ if (res_from) {
+ *rid = RID(res_from->get_rid());
+ }
+}
+
+uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) {
+ RID *rid = (RID *)p_rid;
+ return rid->get_id();
+}
+
+void GDAPI godot_rid_destroy(godot_rid *p_rid) {
+ ((RID *)p_rid)->~RID();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_rid.h b/modules/gdnative/godot/godot_rid.h
new file mode 100644
index 0000000000..e00c8f89ad
--- /dev/null
+++ b/modules/gdnative/godot/godot_rid.h
@@ -0,0 +1,57 @@
+/*************************************************************************/
+/* godot_rid.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
+typedef struct godot_rid {
+ uint8_t _dont_touch_that[8];
+} godot_rid;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from);
+
+uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
+
+void GDAPI godot_rid_destroy(godot_rid *p_rid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_RID_H
diff --git a/modules/gdnative/godot/godot_string.cpp b/modules/gdnative/godot/godot_string.cpp
new file mode 100644
index 0000000000..92c0b04041
--- /dev/null
+++ b/modules/gdnative/godot/godot_string.cpp
@@ -0,0 +1,117 @@
+/*************************************************************************/
+/* godot_string.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_string.h"
+
+#include "string_db.h"
+#include "ustring.h"
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _string_api_anchor() {
+}
+
+void GDAPI godot_string_new(godot_string *p_str) {
+ String *p = (String *)p_str;
+ memnew_placement(p, String);
+ // *p = String(); // useless here
+}
+
+void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) {
+ String *p = (String *)p_str;
+ memnew_placement(p, String);
+ *p = String::utf8(p_contents, p_size);
+}
+
+void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size) {
+ String *p = (String *)p_str;
+ if (p_size != NULL) {
+ *p_size = p->utf8().length();
+ }
+ if (p_dest != NULL) {
+ memcpy(p_dest, p->utf8().get_data(), *p_size);
+ }
+}
+
+void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) {
+ String *dest = (String *)p_dest;
+ String *src = (String *)p_src;
+
+ *dest = *src;
+}
+
+wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) {
+ String *s = (String *)p_str;
+ return &(s->operator[](p_idx));
+}
+
+const char GDAPI *godot_string_c_str(const godot_string *p_str) {
+ const String *s = (const String *)p_str;
+ return s->utf8().get_data();
+}
+
+const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_str) {
+ const String *s = (const String *)p_str;
+ return s->c_str();
+}
+
+godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) {
+ String *a = (String *)p_a;
+ String *b = (String *)p_b;
+ return *a == *b;
+}
+
+godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) {
+ String *a = (String *)p_a;
+ String *b = (String *)p_b;
+ return *a < *b;
+}
+
+void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) {
+ String *dest = (String *)p_dest;
+ const String *a = (String *)p_a;
+ const String *b = (String *)p_b;
+
+ String tmp = *a + *b;
+ godot_string_new(p_dest);
+ *dest = tmp;
+}
+
+void GDAPI godot_string_destroy(godot_string *p_str) {
+ String *p = (String *)p_str;
+ p->~String();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_string.h b/modules/gdnative/godot/godot_string.h
new file mode 100644
index 0000000000..83ed5d6ec1
--- /dev/null
+++ b/modules/gdnative/godot/godot_string.h
@@ -0,0 +1,73 @@
+/*************************************************************************/
+/* godot_string.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+#include <wchar.h>
+
+#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
+typedef struct godot_string {
+ uint8_t _dont_touch_that[8];
+} godot_string;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_string_new(godot_string *p_str);
+void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
+
+void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size);
+
+void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src);
+
+wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx);
+const char GDAPI *godot_string_c_str(const godot_string *p_str);
+const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_str);
+
+godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b);
+godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b);
+void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b);
+
+// @Incomplete
+// hmm, I guess exposing the whole API doesn't make much sense
+// since the language used in the library has its own string funcs
+
+void GDAPI godot_string_destroy(godot_string *p_str);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_STRING_H
diff --git a/modules/gdnative/godot/godot_transform.cpp b/modules/gdnative/godot/godot_transform.cpp
new file mode 100644
index 0000000000..681c2b049a
--- /dev/null
+++ b/modules/gdnative/godot/godot_transform.cpp
@@ -0,0 +1,71 @@
+/*************************************************************************/
+/* godot_transform.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_transform.h"
+
+#include "math/transform.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _transform_api_anchor() {
+}
+
+void GDAPI godot_transform_new(godot_transform *p_trans) {
+ Transform *trans = (Transform *)p_trans;
+ *trans = Transform();
+}
+
+void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) {
+ Transform *trans = (Transform *)p_trans;
+ const Basis *basis = (const Basis *)p_basis;
+ *trans = Transform(*basis);
+}
+
+void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) {
+ Transform *trans = (Transform *)p_trans;
+ const Basis *basis = (const Basis *)p_basis;
+ const Vector3 *origin = (const Vector3 *)p_origin;
+ *trans = Transform(*basis, *origin);
+}
+
+godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) {
+ Transform *trans = (Transform *)p_trans;
+ return (godot_basis *)&trans->basis;
+}
+
+godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) {
+ Transform *trans = (Transform *)p_trans;
+ return (godot_vector3 *)&trans->origin;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_transform.h b/modules/gdnative/godot/godot_transform.h
new file mode 100644
index 0000000000..93817ffbf2
--- /dev/null
+++ b/modules/gdnative/godot/godot_transform.h
@@ -0,0 +1,58 @@
+/*************************************************************************/
+/* godot_transform.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#ifndef GODOT_TRANSFORM_H
+#define GODOT_TRANSFORM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
+typedef struct godot_transform {
+ uint8_t _dont_touch_that[48];
+} godot_transform;
+#endif
+
+#include "../godot.h"
+
+void GDAPI godot_transform_new(godot_transform *p_trans);
+void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis);
+void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin);
+
+godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans);
+godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_TRANSFORM_H
diff --git a/modules/gdnative/godot/godot_transform2d.cpp b/modules/gdnative/godot/godot_transform2d.cpp
new file mode 100644
index 0000000000..ffc7167559
--- /dev/null
+++ b/modules/gdnative/godot/godot_transform2d.cpp
@@ -0,0 +1,88 @@
+/*************************************************************************/
+/* godot_transform2d.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_transform2d.h"
+
+#include "../godot.h"
+
+#include "math/math_2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _transform2d_api_anchor() {
+}
+
+void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) {
+ Transform2D *t = (Transform2D *)p_t;
+ *t = Transform2D();
+}
+
+void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) {
+ Transform2D *t = (Transform2D *)p_t;
+ Vector2 *a = (Vector2 *)p_a;
+ Vector2 *b = (Vector2 *)p_b;
+ Vector2 *c = (Vector2 *)p_c;
+ *t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y);
+}
+
+void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) {
+ Transform2D *t = (Transform2D *)p_t;
+ Vector2 *pos = (Vector2 *)p_pos;
+ *t = Transform2D(p_rot, *pos);
+}
+
+godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) {
+ const Transform2D *t = (const Transform2D *)p_t;
+ const Vector2 *e = &t->operator[](p_idx);
+ return (godot_vector2 const *)e;
+}
+
+godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) {
+ Transform2D *t = (Transform2D *)p_t;
+ Vector2 *e = &t->operator[](p_idx);
+ return (godot_vector2 *)e;
+}
+
+godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) {
+ return *godot_transform2d_const_index(p_t, p_axis);
+}
+
+void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) {
+ godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis);
+ *origin_v = *p_vec;
+}
+
+// @Incomplete
+// See header file
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_transform2d.h b/modules/gdnative/godot/godot_transform2d.h
new file mode 100644
index 0000000000..ae0569dbe8
--- /dev/null
+++ b/modules/gdnative/godot/godot_transform2d.h
@@ -0,0 +1,77 @@
+/*************************************************************************/
+/* godot_transform2d.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
+typedef struct godot_transform2d {
+ uint8_t _dont_touch_that[24];
+} godot_transform2d;
+#endif
+
+#include "../godot.h"
+
+#include "godot_vector2.h"
+
+void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t);
+void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c);
+void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos);
+
+/*
+godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v);
+godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v);
+*/
+
+godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx);
+godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx);
+
+godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis);
+void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec);
+
+/*
+void GDAPI godot_transform2d_invert(godot_transform2d *p_t);
+godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t);
+*/
+
+// @Incomplete
+// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings.
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_TRANSFORM2D_H
diff --git a/modules/dlscript/godot/godot_variant.cpp b/modules/gdnative/godot/godot_variant.cpp
index 3681f89753..2214f85056 100644
--- a/modules/dlscript/godot/godot_variant.cpp
+++ b/modules/gdnative/godot/godot_variant.cpp
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_variant.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_variant.h"
#include "../godot.h"
diff --git a/modules/dlscript/godot/godot_variant.h b/modules/gdnative/godot/godot_variant.h
index 1ff5ba4a57..6f98b32363 100644
--- a/modules/dlscript/godot/godot_variant.h
+++ b/modules/gdnative/godot/godot_variant.h
@@ -1,3 +1,32 @@
+/*************************************************************************/
+/* godot_variant.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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
diff --git a/modules/gdnative/godot/godot_vector2.cpp b/modules/gdnative/godot/godot_vector2.cpp
new file mode 100644
index 0000000000..87e60b6245
--- /dev/null
+++ b/modules/gdnative/godot/godot_vector2.cpp
@@ -0,0 +1,296 @@
+/*************************************************************************/
+/* godot_vector2.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_vector2.h"
+
+#include "math/math_2d.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _vector2_api_anchor() {}
+
+godot_vector2 GDAPI godot_vector2_new(const godot_real p_x, const godot_real p_y) {
+ godot_vector2 value;
+ Vector2 *v = (Vector2 *)&value;
+ v->x = p_x;
+ v->y = p_y;
+ return value;
+}
+
+void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x) {
+ Vector2 *v = (Vector2 *)p_v;
+ v->x = p_x;
+}
+
+void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y) {
+ Vector2 *v = (Vector2 *)p_v;
+ v->y = p_y;
+}
+
+godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v) {
+ const Vector2 *v = (Vector2 *)p_v;
+ return v->x;
+}
+godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v) {
+ const Vector2 *v = (Vector2 *)p_v;
+ return v->y;
+}
+
+void GDAPI godot_vector2_normalize(godot_vector2 *p_v) {
+ Vector2 *v = (Vector2 *)p_v;
+ v->normalize();
+}
+
+godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_v) {
+ godot_vector2 dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ Vector2 *d = (Vector2 *)&dest;
+ *d = v->normalized();
+ return dest;
+}
+
+godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v) {
+ const Vector2 *v = (Vector2 *)p_v;
+ return v->length();
+}
+
+godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v) {
+ const Vector2 *v = (Vector2 *)p_v;
+ return v->length_squared();
+}
+
+godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ return v->distance_to(*b);
+}
+
+godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ return v->distance_squared_to(*b);
+}
+
+godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ *d = *v + *b;
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ *d = *v - *b;
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ *d = *v * *b;
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_v, const godot_real p_b) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = *v * p_b;
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ *d = *v / *b;
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_v, const godot_real p_b) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = *v / p_b;
+ return dest;
+}
+
+godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ return *v == *b;
+}
+
+godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_v, const godot_vector2 p_b) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ return *v < *b;
+}
+
+godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_v) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = v->abs();
+ return dest;
+}
+
+godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_v) {
+ const Vector2 *v = (Vector2 *)p_v;
+ return v->angle();
+}
+
+godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_v, const godot_vector2 p_to) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *to = (Vector2 *)&p_to;
+ return v->angle_to(*to);
+}
+
+godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_v, const godot_vector2 p_to) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *to = (Vector2 *)&p_to;
+ return v->angle_to_point(*to);
+}
+
+godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_v, const godot_real length) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = v->clamped(length);
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_cubic_interpolate(
+ const godot_vector2 *p_v, const godot_vector2 p_b, const godot_vector2 p_pre_a,
+ const godot_vector2 p_post_b, godot_real t) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ const Vector2 *pre_a = (Vector2 *)&p_pre_a;
+ const Vector2 *post_b = (Vector2 *)&p_post_b;
+ *d = v->cubic_interpolate(*b, *pre_a, *post_b, t);
+ return dest;
+}
+
+godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_v, const godot_vector2 p_with) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *with = (Vector2 *)&p_with;
+ return v->dot(*with);
+}
+
+godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_v) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = v->floor();
+ return dest;
+}
+
+godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_v) {
+ const Vector2 *v = (Vector2 *)p_v;
+ return v->aspect();
+}
+
+godot_vector2 GDAPI godot_vector2_linear_interpolate(
+ const godot_vector2 *p_v,
+ const godot_vector2 p_b,
+ godot_real t) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *b = (Vector2 *)&p_b;
+ *d = v->linear_interpolate(*b, t);
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_v, const godot_vector2 p_vec) {
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *vec = (Vector2 *)&p_vec;
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ *d = v->reflect(*vec);
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_v, godot_real phi) {
+ const Vector2 *v = (Vector2 *)p_v;
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ *d = v->rotated(phi);
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_v, godot_vector2 p_vec) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *vec = (Vector2 *)&p_vec;
+ *d = v->slide(*vec);
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_v, godot_vector2 p_by) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ const Vector2 *by = (Vector2 *)&p_by;
+ *d = v->snapped(*by);
+ return dest;
+}
+
+godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_v) {
+ godot_vector2 dest;
+ Vector2 *d = (Vector2 *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = v->tangent();
+ return dest;
+}
+
+godot_string GDAPI godot_vector2_to_string(const godot_vector2 *p_v) {
+ godot_string dest;
+ String *d = (String *)&dest;
+ const Vector2 *v = (Vector2 *)p_v;
+ *d = "(" + *v + ")";
+ return dest;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_vector2.h b/modules/gdnative/godot/godot_vector2.h
new file mode 100644
index 0000000000..36a4f01d03
--- /dev/null
+++ b/modules/gdnative/godot/godot_vector2.h
@@ -0,0 +1,98 @@
+/*************************************************************************/
+/* godot_vector2.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED
+typedef struct godot_vector2 {
+ uint8_t _dont_touch_that[8];
+} godot_vector2;
+#endif
+
+#include "../godot.h"
+
+godot_vector2 GDAPI godot_vector2_new(const godot_real p_x, const godot_real p_y);
+
+void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x);
+void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y);
+godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v);
+
+void GDAPI godot_vector2_normalize(godot_vector2 *p_v);
+godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_v);
+
+godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v);
+
+godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_v, const godot_vector2 p_b);
+godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_v, const godot_vector2 p_b);
+
+godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_v, const godot_vector2 p_to);
+godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_v, const godot_vector2 p_to);
+godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_v, godot_real length);
+godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_v,
+ const godot_vector2 p_b, const godot_vector2 p_pre_a,
+ const godot_vector2 p_post_b, godot_real t);
+godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_v, const godot_vector2 p_with);
+godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_v);
+godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_v);
+godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_v,
+ const godot_vector2 p_b, godot_real t);
+godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_v, const godot_vector2 p_vec);
+godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_v, godot_real phi);
+godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_v, godot_vector2 p_vec);
+godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_v, godot_vector2 p_by);
+godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_v);
+godot_string GDAPI godot_vector2_to_string(const godot_vector2 *p_v);
+
+godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_v, const godot_vector2 p_b);
+godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_v, const godot_vector2 p_b);
+godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_v, const godot_vector2 p_b);
+godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_v, const godot_real p_b);
+godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_v, const godot_vector2 p_b);
+godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_v, const godot_real p_b);
+
+godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_v, const godot_vector2 p_b);
+godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_v, const godot_vector2 p_b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_VECTOR2_H
diff --git a/modules/gdnative/godot/godot_vector3.cpp b/modules/gdnative/godot/godot_vector3.cpp
new file mode 100644
index 0000000000..5f71b9f7e4
--- /dev/null
+++ b/modules/gdnative/godot/godot_vector3.cpp
@@ -0,0 +1,342 @@
+/*************************************************************************/
+/* godot_vector3.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "godot_vector3.h"
+
+#include "math/vector3.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _vector3_api_anchor() {
+}
+
+godot_vector3 GDAPI godot_vector3_new(const godot_real p_x, const godot_real p_y, const godot_real p_z) {
+ godot_vector3 value;
+ Vector3 *v = (Vector3 *)&value;
+ *v = Vector3(p_x, p_y, p_z);
+ return value;
+}
+
+void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val) {
+ Vector3 *v = (Vector3 *)p_v;
+ v->set_axis(p_axis, p_val);
+}
+
+godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis) {
+ Vector3 *v = (Vector3 *)p_v;
+ return v->get_axis(p_axis);
+}
+
+godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v) {
+ Vector3 *v = (Vector3 *)p_v;
+ return v->min_axis();
+}
+
+godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v) {
+ Vector3 *v = (Vector3 *)p_v;
+ return v->max_axis();
+}
+
+godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v) {
+ Vector3 *v = (Vector3 *)p_v;
+ return v->length();
+}
+
+godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v) {
+ Vector3 *v = (Vector3 *)p_v;
+ return v->length_squared();
+}
+
+void GDAPI godot_vector3_normalize(godot_vector3 *p_v) {
+ Vector3 *v = (Vector3 *)p_v;
+ v->normalize();
+}
+
+godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ *d = v->normalized();
+ return dest;
+}
+
+godot_vector3 godot_vector3_inverse(const godot_vector3 *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = v->inverse();
+ return dest;
+}
+
+void godot_vector3_zero(godot_vector3 *p_v) {
+ Vector3 *v = (Vector3 *)p_v;
+ v->zero();
+}
+
+void godot_vector3_snap(godot_vector3 *p_v, const godot_real val) {
+ Vector3 *v = (Vector3 *)p_v;
+ v->snap(val);
+}
+
+godot_vector3 godot_vector3_snapped(const godot_vector3 *p_v, const godot_real val) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = v->snapped(val);
+ return dest;
+}
+
+void godot_vector3_rotate(godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi) {
+ Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *axis = (Vector3 *)&p_axis;
+ v->rotate(*axis, phi);
+}
+
+godot_vector3 godot_vector3_rotated(const godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *axis = (Vector3 *)&p_axis;
+ *d = v->rotated(*axis, phi);
+ return dest;
+}
+
+godot_vector3 godot_vector3_linear_interpolate(const godot_vector3 *p_v, const godot_vector3 p_b, const godot_real t) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *b = (Vector3 *)&p_b;
+ *d = v->linear_interpolate(*b, t);
+ return dest;
+}
+
+godot_vector3 godot_vector3_cubic_interpolate(const godot_vector3 *p_v,
+ const godot_vector3 p_b, const godot_vector3 p_pre_a,
+ const godot_vector3 p_post_b, const godot_real t) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *b = (Vector3 *)&p_b;
+ const Vector3 *pre_a = (Vector3 *)&p_pre_a;
+ const Vector3 *post_b = (Vector3 *)&p_post_b;
+ *d = v->cubic_interpolate(*b, *pre_a, *post_b, t);
+ return dest;
+}
+
+godot_vector3 godot_vector3_cubic_interpolaten(const godot_vector3 *p_v,
+ const godot_vector3 p_b, const godot_vector3 p_pre_a,
+ const godot_vector3 p_post_b, const godot_real t) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *b = (Vector3 *)&p_b;
+ const Vector3 *pre_a = (Vector3 *)&p_pre_a;
+ const Vector3 *post_b = (Vector3 *)&p_post_b;
+ *d = v->cubic_interpolaten(*b, *pre_a, *post_b, t);
+ return dest;
+}
+
+godot_vector3 godot_vector3_cross(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *b = (Vector3 *)&p_b;
+ *d = v->cross(*b);
+ return dest;
+}
+
+godot_real godot_vector3_dot(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *b = (Vector3 *)&p_b;
+ return v->dot(*b);
+}
+
+godot_basis godot_vector3_outer(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ godot_basis dest;
+ Basis *d = (Basis *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *b = (Vector3 *)&p_b;
+ *d = v->outer(*b);
+ return dest;
+}
+
+godot_basis godot_vector3_to_diagonal_matrix(const godot_vector3 *p_v) {
+ godot_basis dest;
+ Basis *d = (Basis *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = v->to_diagonal_matrix();
+ return dest;
+}
+
+godot_vector3 godot_vector3_abs(const godot_vector3 *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = v->abs();
+ return dest;
+}
+
+godot_vector3 godot_vector3_floor(const godot_vector3 *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = v->floor();
+ return dest;
+}
+
+godot_vector3 godot_vector3_ceil(const godot_vector3 *p_v) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = v->ceil();
+ return dest;
+}
+
+godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ return v->distance_to(*b);
+}
+
+godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ return v->distance_squared_to(*b);
+}
+
+godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ return v->angle_to(*b);
+}
+
+godot_vector3 godot_vector3_slide(const godot_vector3 *p_v, const godot_vector3 p_vec) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *vec = (Vector3 *)&p_vec;
+ *d = v->slide(*vec);
+ return dest;
+}
+
+godot_vector3 godot_vector3_bounce(const godot_vector3 *p_v, const godot_vector3 p_vec) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *vec = (Vector3 *)&p_vec;
+ *d = v->bounce(*vec);
+ return dest;
+}
+
+godot_vector3 godot_vector3_reflect(const godot_vector3 *p_v, const godot_vector3 p_vec) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ const Vector3 *vec = (Vector3 *)&p_vec;
+ *d = v->reflect(*vec);
+ return dest;
+}
+
+godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ *d = *v + *b;
+ return dest;
+}
+
+godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ *d = *v - *b;
+ return dest;
+}
+
+godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ *d = *v * *b;
+ return dest;
+}
+
+godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_v, const godot_real p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ *d = *v * p_b;
+ return dest;
+}
+
+godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ *d = *v / *b;
+ return dest;
+}
+
+godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_v, const godot_real p_b) {
+ godot_vector3 dest;
+ Vector3 *d = (Vector3 *)&dest;
+ Vector3 *v = (Vector3 *)p_v;
+ *d = *v / p_b;
+ return dest;
+}
+
+godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ return *v == *b;
+}
+
+godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_v, const godot_vector3 p_b) {
+ Vector3 *v = (Vector3 *)p_v;
+ Vector3 *b = (Vector3 *)&p_b;
+ return *v < *b;
+}
+
+godot_string GDAPI godot_vector3_to_string(const godot_vector3 *p_v) {
+ godot_string dest;
+ String *d = (String *)&dest;
+ const Vector3 *v = (Vector3 *)p_v;
+ *d = "(" + *v + ")";
+ return dest;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/godot/godot_vector3.h b/modules/gdnative/godot/godot_vector3.h
new file mode 100644
index 0000000000..654ddd7792
--- /dev/null
+++ b/modules/gdnative/godot/godot_vector3.h
@@ -0,0 +1,113 @@
+/*************************************************************************/
+/* godot_vector3.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED
+typedef struct godot_vector3 {
+ uint8_t _dont_touch_that[12];
+} godot_vector3;
+#endif
+
+#define GODOT_VECTOR3_AXIX_X 0
+#define GODOT_VECTOR3_AXIX_Y 1
+#define GODOT_VECTOR3_AXIX_Z 2
+
+#include "../godot.h"
+#include "godot_basis.h"
+
+godot_vector3 GDAPI godot_vector3_new(const godot_real p_x, const godot_real p_y, const godot_real p_z);
+
+void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val);
+godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis);
+
+godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v);
+godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v);
+
+godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v);
+godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v);
+
+void GDAPI godot_vector3_normalize(godot_vector3 *p_v);
+godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_v);
+
+godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_v);
+void GDAPI godot_vector3_zero(godot_vector3 *p_v);
+void GDAPI godot_vector3_snap(godot_vector3 *p_v, const godot_real val);
+godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_v, const godot_real val);
+void GDAPI godot_vector3_rotate(godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi);
+godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_v,
+ const godot_vector3 p_axis, const godot_real phi);
+godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_v,
+ const godot_vector3 p_b, const godot_real t);
+godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_v,
+ const godot_vector3 p_b, const godot_vector3 p_pre_a,
+ const godot_vector3 p_post_b, const godot_real t);
+godot_vector3 GDAPI godot_vector3_cubic_interpolaten(const godot_vector3 *p_v,
+ const godot_vector3 p_b, const godot_vector3 p_pre_a,
+ const godot_vector3 p_post_b, const godot_real t);
+godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_v);
+godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_v);
+godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_v);
+godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_v);
+
+godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_v, const godot_vector3 p_b);
+
+godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_v, const godot_vector3 p_vec);
+godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_v, const godot_vector3 p_vec);
+godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_v, const godot_vector3 p_vec);
+
+godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_v, const godot_real p_b);
+godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_v, const godot_real p_b);
+
+godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_v, const godot_vector3 p_b);
+godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_v, const godot_vector3 p_b);
+
+godot_string GDAPI godot_vector3_to_string(const godot_vector3 *p_v);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_VECTOR3_H
diff --git a/modules/dlscript/register_types.cpp b/modules/gdnative/register_types.cpp
index 2ec6b89cbf..8789c9a267 100644
--- a/modules/dlscript/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -28,43 +28,39 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
-#include "dl_script.h"
+#include "gdnative.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
-DLScriptLanguage *script_language_dl = NULL;
-ResourceFormatLoaderDLScript *resource_loader_dl = NULL;
-ResourceFormatSaverDLScript *resource_saver_dl = NULL;
+GDNativeScriptLanguage *script_language_gdn = NULL;
+ResourceFormatLoaderGDNativeScript *resource_loader_gdn = NULL;
+ResourceFormatSaverGDNativeScript *resource_saver_gdn = NULL;
//ResourceFormatLoaderDLLibrary *resource_loader_dllib=NULL;
-void register_dlscript_types() {
+void register_gdnative_types() {
- ClassDB::register_class<DLLibrary>();
- ClassDB::register_class<DLScript>();
+ ClassDB::register_class<GDNativeLibrary>();
+ ClassDB::register_class<GDNativeScript>();
- script_language_dl = memnew(DLScriptLanguage);
- //script_language_gd->init();
- ScriptServer::register_language(script_language_dl);
- resource_loader_dl = memnew(ResourceFormatLoaderDLScript);
- ResourceLoader::add_resource_format_loader(resource_loader_dl);
- resource_saver_dl = memnew(ResourceFormatSaverDLScript);
- ResourceSaver::add_resource_format_saver(resource_saver_dl);
-
- // resource_loader_dllib=memnew( ResourceFormatLoaderDLLibrary );
- // ResourceLoader::add_resource_format_loader(resource_loader_gd);
+ script_language_gdn = memnew(GDNativeScriptLanguage);
+ ScriptServer::register_language(script_language_gdn);
+ resource_loader_gdn = memnew(ResourceFormatLoaderGDNativeScript);
+ ResourceLoader::add_resource_format_loader(resource_loader_gdn);
+ resource_saver_gdn = memnew(ResourceFormatSaverGDNativeScript);
+ ResourceSaver::add_resource_format_saver(resource_saver_gdn);
}
-void unregister_dlscript_types() {
+void unregister_gdnative_types() {
- ScriptServer::unregister_language(script_language_dl);
+ ScriptServer::unregister_language(script_language_gdn);
- if (script_language_dl)
- memdelete(script_language_dl);
+ if (script_language_gdn)
+ memdelete(script_language_gdn);
- if (resource_loader_dl)
- memdelete(resource_loader_dl);
+ if (resource_loader_gdn)
+ memdelete(resource_loader_gdn);
- if (resource_saver_dl)
- memdelete(resource_saver_dl);
+ if (resource_saver_gdn)
+ memdelete(resource_saver_gdn);
}
diff --git a/modules/dlscript/register_types.h b/modules/gdnative/register_types.h
index 1968986718..48e778cb2c 100644
--- a/modules/dlscript/register_types.h
+++ b/modules/gdnative/register_types.h
@@ -27,5 +27,5 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-void register_dlscript_types();
-void unregister_dlscript_types();
+void register_gdnative_types();
+void unregister_gdnative_types();
diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp
index ae5bb5694c..4667e541dd 100644
--- a/modules/gdscript/gd_editor.cpp
+++ b/modules/gdscript/gd_editor.cpp
@@ -27,10 +27,15 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "editor/editor_settings.h"
#include "gd_compiler.h"
#include "gd_script.h"
#include "global_config.h"
#include "os/file_access.h"
+#ifdef TOOLS_ENABLED
+#include "editor/editor_file_system.h"
+#include "editor/editor_settings.h"
+#endif
void GDScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {
@@ -50,11 +55,12 @@ Ref<Script> GDScriptLanguage::get_template(const String &p_class_name, const Str
"# var a = 2\n" +
"# var b = \"textvar\"\n\n" +
"func _ready():\n" +
- "\t# Called every time the node is added to the scene.\n" +
- "\t# Initialization here\n" +
- "\tpass\n";
+ "%TS%# Called every time the node is added to the scene.\n" +
+ "%TS%# Initialization here\n" +
+ "%TS%pass\n";
_template = _template.replace("%BASE%", p_base_class_name);
+ _template = _template.replace("%TS%", _get_indentation());
Ref<GDScript> script;
script.instance();
@@ -1405,6 +1411,17 @@ static void _make_function_hint(const GDParser::FunctionNode *p_func, int p_argi
arghint += ")";
}
+void get_directory_contents(EditorFileSystemDirectory *p_dir, Set<String> &r_list) {
+
+ for (int i = 0; i < p_dir->get_subdir_count(); i++) {
+ get_directory_contents(p_dir->get_subdir(i), r_list);
+ }
+
+ for (int i = 0; i < p_dir->get_file_count(); i++) {
+ r_list.insert("\"" + p_dir->get_file_path(i) + "\"");
+ }
+}
+
static void _find_type_arguments(GDCompletionContext &context, const GDParser::Node *p_node, int p_line, const StringName &p_method, const GDCompletionIdentifier &id, int p_argidx, Set<String> &result, String &arghint) {
//print_line("find type arguments?");
@@ -1753,6 +1770,10 @@ static void _find_call_arguments(GDCompletionContext &context, const GDParser::N
const GDParser::BuiltInFunctionNode *fn = static_cast<const GDParser::BuiltInFunctionNode *>(op->arguments[0]);
MethodInfo mi = GDFunctions::get_info(fn->function);
+ if (mi.name == "load" && bool(EditorSettings::get_singleton()->get("text_editor/completion/complete_file_paths"))) {
+ get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), result);
+ }
+
arghint = _get_visual_datatype(mi.return_val, false) + " " + GDFunctions::get_func_name(fn->function) + String("(");
for (int i = 0; i < mi.arguments.size(); i++) {
if (i > 0)
@@ -2374,6 +2395,11 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
}
} break;
+ case GDParser::COMPLETION_PRELOAD: {
+
+ if (EditorSettings::get_singleton()->get("text_editor/completion/complete_file_paths"))
+ get_directory_contents(EditorFileSystem::get_singleton()->get_filesystem(), options);
+ } break;
}
for (Set<String>::Element *E = options.front(); E; E = E->next()) {
@@ -2391,8 +2417,29 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base
#endif
+String GDScriptLanguage::_get_indentation() const {
+#ifdef TOOLS_ENABLED
+ if (SceneTree::get_singleton()->is_editor_hint()) {
+ bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", 0);
+
+ if (use_space_indentation) {
+ int indent_size = EDITOR_DEF("text_editor/indent/size", 4);
+
+ String space_indent = "";
+ for (int i = 0; i < indent_size; i++) {
+ space_indent += " ";
+ }
+ return space_indent;
+ }
+ }
+#endif
+ return "\t";
+}
+
void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_to_line) const {
+ String indent = _get_indentation();
+
Vector<String> lines = p_code.split("\n");
List<int> indent_stack;
@@ -2432,8 +2479,9 @@ void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_t
if (i >= p_from_line) {
l = "";
- for (int j = 0; j < indent_stack.size(); j++)
- l += "\t";
+ for (int j = 0; j < indent_stack.size(); j++) {
+ l += indent;
+ }
l += st;
} else if (i > p_to_line) {
diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp
index 9033b51d28..b02d7f713b 100644
--- a/modules/gdscript/gd_parser.cpp
+++ b/modules/gdscript/gd_parser.cpp
@@ -387,6 +387,13 @@ GDParser::Node *GDParser::_parse_expression(Node *p_parent, bool p_static, bool
_set_error("Expected '(' after 'preload'");
return NULL;
}
+ completion_cursor = StringName();
+ completion_type = COMPLETION_PRELOAD;
+ completion_class = current_class;
+ completion_function = current_function;
+ completion_line = tokenizer->get_token_line();
+ completion_block = current_block;
+ completion_found = true;
tokenizer->advance();
String path;
@@ -2265,6 +2272,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) {
if (!is_first_line && tab_level.back()->prev() && tab_level.back()->prev()->get() == indent_level) {
// pythonic single-line expression, don't parse future lines
tab_level.pop_back();
+ p_block->end_line = tokenizer->get_token_line();
return;
}
is_first_line = false;
@@ -2436,9 +2444,8 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) {
while (true) {
- while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) {
- tokenizer->advance();
- }
+ while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline())
+ ;
if (tab_level.back()->get() < indent_level) { //not at current indent level
p_block->end_line = tokenizer->get_token_line();
diff --git a/modules/gdscript/gd_parser.h b/modules/gdscript/gd_parser.h
index 445ad7361c..4f3ca0dc5f 100644
--- a/modules/gdscript/gd_parser.h
+++ b/modules/gdscript/gd_parser.h
@@ -437,6 +437,7 @@ public:
COMPLETION_PARENT_FUNCTION,
COMPLETION_METHOD,
COMPLETION_CALL_ARGUMENTS,
+ COMPLETION_PRELOAD,
COMPLETION_INDEX,
COMPLETION_VIRTUAL_FUNC,
COMPLETION_YIELD,
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index 2367f60740..173014b138 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -1697,8 +1697,8 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
#ifdef TOOLS_ENABLED
while (E->get()->placeholders.size()) {
-
Object *obj = E->get()->placeholders.front()->get()->get_owner();
+
//save instance info
List<Pair<StringName, Variant> > state;
if (obj->get_script_instance()) {
@@ -1706,6 +1706,9 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
obj->get_script_instance()->get_property_state(state);
map[obj->get_instance_ID()] = state;
obj->set_script(RefPtr());
+ } else {
+ // no instance found. Let's remove it so we don't loop forever
+ E->get()->placeholders.erase(E->get()->placeholders.front()->get());
}
}
#endif
diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h
index 93f8ee8721..00ae136790 100644
--- a/modules/gdscript/gd_script.h
+++ b/modules/gdscript/gd_script.h
@@ -384,12 +384,14 @@ public:
virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_functions = NULL) const;
virtual Script *create_script() const;
virtual bool has_named_classes() const;
+ virtual bool can_inherit_from_file() { return true; }
virtual int find_function(const String &p_function, const String &p_code) const;
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, String &r_call_hint);
#ifdef TOOLS_ENABLED
virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result);
#endif
+ virtual String _get_indentation() const;
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
diff --git a/modules/multiscript/SCsub b/modules/multiscript/SCsub
new file mode 100644
index 0000000000..0882406761
--- /dev/null
+++ b/modules/multiscript/SCsub
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+Import('env')
+
+env.add_source_files(env.modules_sources, "*.cpp")
+
+Export('env')
diff --git a/modules/multiscript/config.py b/modules/multiscript/config.py
new file mode 100644
index 0000000000..5698a37295
--- /dev/null
+++ b/modules/multiscript/config.py
@@ -0,0 +1,8 @@
+
+
+def can_build(platform):
+ return True
+
+
+def configure(env):
+ pass
diff --git a/modules/multiscript/multiscript.cpp b/modules/multiscript/multiscript.cpp
new file mode 100644
index 0000000000..b2633b7207
--- /dev/null
+++ b/modules/multiscript/multiscript.cpp
@@ -0,0 +1,750 @@
+/*************************************************************************/
+/* multiscript.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "multiscript.h"
+
+bool MultiScriptInstance::set(const StringName &p_name, const Variant &p_value) {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ bool found = sarr[i]->set(p_name, p_value);
+ if (found)
+ return true;
+ }
+
+ if (String(p_name).begins_with("script_")) {
+ bool valid;
+ owner->set(p_name, p_value, &valid);
+ return valid;
+ }
+ return false;
+}
+
+bool MultiScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ bool found = sarr[i]->get(p_name, r_ret);
+ if (found)
+ return true;
+ }
+ if (String(p_name).begins_with("script_")) {
+ bool valid;
+ r_ret = owner->get(p_name, &valid);
+ return valid;
+ }
+ return false;
+}
+void MultiScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ Set<String> existing;
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ List<PropertyInfo> pl;
+ sarr[i]->get_property_list(&pl);
+
+ for (List<PropertyInfo>::Element *E = pl.front(); E; E = E->next()) {
+
+ if (existing.has(E->get().name))
+ continue;
+
+ p_properties->push_back(E->get());
+ existing.insert(E->get().name);
+ }
+ }
+
+ p_properties->push_back(PropertyInfo(Variant::NIL, "Scripts", PROPERTY_HINT_NONE, String(), PROPERTY_USAGE_CATEGORY));
+
+ for (int i = 0; i < owner->scripts.size(); i++) {
+
+ p_properties->push_back(PropertyInfo(Variant::OBJECT, "script_" + String::chr('a' + i), PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_EDITOR));
+ }
+
+ if (owner->scripts.size() < 25) {
+
+ p_properties->push_back(PropertyInfo(Variant::OBJECT, "script_" + String::chr('a' + (owner->scripts.size())), PROPERTY_HINT_RESOURCE_TYPE, "Script", PROPERTY_USAGE_EDITOR));
+ }
+}
+
+void MultiScriptInstance::get_method_list(List<MethodInfo> *p_list) const {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ Set<StringName> existing;
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ List<MethodInfo> ml;
+ sarr[i]->get_method_list(&ml);
+
+ for (List<MethodInfo>::Element *E = ml.front(); E; E = E->next()) {
+
+ if (existing.has(E->get().name))
+ continue;
+
+ p_list->push_back(E->get());
+ existing.insert(E->get().name);
+ }
+ }
+}
+bool MultiScriptInstance::has_method(const StringName &p_method) const {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ if (sarr[i]->has_method(p_method))
+ return true;
+ }
+
+ return false;
+}
+
+Variant MultiScriptInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ Variant r = sarr[i]->call(p_method, p_args, p_argcount, r_error);
+ if (r_error.error == Variant::CallError::CALL_OK)
+ return r;
+ else if (r_error.error != Variant::CallError::CALL_ERROR_INVALID_METHOD)
+ return r;
+ }
+
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ return Variant();
+}
+
+void MultiScriptInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ sarr[i]->call_multilevel(p_method, p_args, p_argcount);
+ }
+}
+void MultiScriptInstance::notification(int p_notification) {
+
+ // ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ ScriptInstance *instance = instances[i];
+
+ if (!instance)
+ continue;
+
+ instance->notification(p_notification);
+ }
+}
+
+Ref<Script> MultiScriptInstance::get_script() const {
+
+ return owner;
+}
+
+ScriptLanguage *MultiScriptInstance::get_language() {
+
+ return MultiScriptLanguage::get_singleton();
+}
+
+MultiScriptInstance::~MultiScriptInstance() {
+
+ owner->remove_instance(object);
+}
+
+Variant::Type MultiScriptInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
+ bool valid = false;
+ Variant::Type type;
+
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ type = sarr[i]->get_property_type(p_name, &valid);
+ if (valid) {
+ *r_is_valid = valid;
+ return type;
+ }
+ }
+ *r_is_valid = false;
+ return Variant::NIL;
+}
+
+ScriptInstance::RPCMode MultiScriptInstance::get_rpc_mode(const StringName &p_method) const {
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+ if (sarr[i]->has_method(p_method))
+ return sarr[i]->get_rpc_mode(p_method);
+ }
+ return RPC_MODE_DISABLED;
+}
+
+ScriptInstance::RPCMode MultiScriptInstance::get_rset_mode(const StringName &p_variable) const {
+ ScriptInstance **sarr = instances.ptr();
+ int sc = instances.size();
+
+ for (int i = 0; i < sc; i++) {
+
+ if (!sarr[i])
+ continue;
+
+ List<PropertyInfo> properties;
+ sarr[i]->get_property_list(&properties);
+
+ for (List<PropertyInfo>::Element *P = properties.front(); P; P = P->next()) {
+ if (P->get().name == p_variable) {
+ return sarr[i]->get_rset_mode(p_variable);
+ }
+ }
+ }
+ return RPC_MODE_DISABLED;
+}
+
+///////////////////
+
+bool MultiScript::is_tool() const {
+
+ for (int i = 0; i < scripts.size(); i++) {
+
+ if (scripts[i]->is_tool())
+ return true;
+ }
+
+ return false;
+}
+
+bool MultiScript::_set(const StringName &p_name, const Variant &p_value) {
+
+ _THREAD_SAFE_METHOD_
+
+ String s = String(p_name);
+ if (s.begins_with("script_")) {
+
+ int idx = s[7];
+ if (idx == 0)
+ return false;
+ idx -= 'a';
+
+ ERR_FAIL_COND_V(idx < 0, false);
+
+ Ref<Script> s = p_value;
+
+ if (idx < scripts.size()) {
+
+ if (s.is_null())
+ remove_script(idx);
+ else
+ set_script(idx, s);
+ } else if (idx == scripts.size()) {
+ if (s.is_null())
+ return false;
+ add_script(s);
+ } else
+ return false;
+
+ return true;
+ }
+
+ return false;
+}
+
+bool MultiScript::_get(const StringName &p_name, Variant &r_ret) const {
+
+ _THREAD_SAFE_METHOD_
+
+ String s = String(p_name);
+ if (s.begins_with("script_")) {
+
+ int idx = s[7];
+ if (idx == 0)
+ return false;
+ idx -= 'a';
+
+ ERR_FAIL_COND_V(idx < 0, false);
+
+ if (idx < scripts.size()) {
+
+ r_ret = get_script(idx);
+ return true;
+ } else if (idx == scripts.size()) {
+ r_ret = Ref<Script>();
+ return true;
+ }
+ }
+
+ return false;
+}
+void MultiScript::_get_property_list(List<PropertyInfo> *p_list) const {
+
+ _THREAD_SAFE_METHOD_
+
+ for (int i = 0; i < scripts.size(); i++) {
+
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "script_" + String::chr('a' + i), PROPERTY_HINT_RESOURCE_TYPE, "Script"));
+ }
+
+ if (scripts.size() < 25) {
+
+ p_list->push_back(PropertyInfo(Variant::OBJECT, "script_" + String::chr('a' + (scripts.size())), PROPERTY_HINT_RESOURCE_TYPE, "Script"));
+ }
+}
+
+void MultiScript::set_script(int p_idx, const Ref<Script> &p_script) {
+
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_INDEX(p_idx, scripts.size());
+ ERR_FAIL_COND(p_script.is_null());
+
+ scripts[p_idx] = p_script;
+ Ref<Script> s = p_script;
+
+ for (Map<Object *, MultiScriptInstance *>::Element *E = instances.front(); E; E = E->next()) {
+
+ MultiScriptInstance *msi = E->get();
+ ScriptInstance *si = msi->instances[p_idx];
+ if (si) {
+ msi->instances[p_idx] = NULL;
+ memdelete(si);
+ }
+
+ if (p_script->can_instance())
+ msi->instances[p_idx] = s->instance_create(msi->object);
+ }
+}
+
+Ref<Script> MultiScript::get_script(int p_idx) const {
+
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_INDEX_V(p_idx, scripts.size(), Ref<Script>());
+
+ return scripts[p_idx];
+}
+void MultiScript::add_script(const Ref<Script> &p_script) {
+
+ _THREAD_SAFE_METHOD_
+ ERR_FAIL_COND(p_script.is_null());
+ Multi *script_owner = memnew(Multi);
+ script_instances.push_back(script_owner);
+ scripts.push_back(p_script);
+ Ref<Script> s = p_script;
+
+ for (Map<Object *, MultiScriptInstance *>::Element *E = instances.front(); E; E = E->next()) {
+
+ MultiScriptInstance *msi = E->get();
+
+ if (p_script->can_instance()) {
+ script_owner->real_owner = msi->object;
+ msi->instances.push_back(s->instance_create(script_owner));
+ } else {
+ msi->instances.push_back(NULL);
+ }
+
+ msi->object->_change_notify();
+ }
+
+ _change_notify();
+}
+
+void MultiScript::remove_script(int p_idx) {
+
+ _THREAD_SAFE_METHOD_
+
+ ERR_FAIL_INDEX(p_idx, scripts.size());
+
+ scripts.remove(p_idx);
+ script_instances.remove(p_idx);
+
+ for (Map<Object *, MultiScriptInstance *>::Element *E = instances.front(); E; E = E->next()) {
+
+ MultiScriptInstance *msi = E->get();
+ ScriptInstance *si = msi->instances[p_idx];
+ msi->instances.remove(p_idx);
+ if (si) {
+ memdelete(si);
+ }
+
+ msi->object->_change_notify();
+ }
+}
+
+void MultiScript::remove_instance(Object *p_object) {
+
+ _THREAD_SAFE_METHOD_
+ instances.erase(p_object);
+}
+
+bool MultiScript::can_instance() const {
+
+ return true;
+}
+
+StringName MultiScript::get_instance_base_type() const {
+
+ return StringName();
+}
+ScriptInstance *MultiScript::instance_create(Object *p_this) {
+
+ _THREAD_SAFE_METHOD_
+ MultiScriptInstance *msi = memnew(MultiScriptInstance);
+ msi->object = p_this;
+ msi->owner = this;
+
+ for (int i = 0; i < scripts.size(); i++) {
+
+ ScriptInstance *si;
+
+ if (scripts[i]->can_instance()) {
+ script_instances[i]->real_owner = p_this;
+ si = scripts[i]->instance_create(script_instances[i]);
+ } else {
+ si = NULL;
+ }
+
+ msi->instances.push_back(si);
+ }
+
+ instances[p_this] = msi;
+ p_this->_change_notify();
+ return msi;
+}
+bool MultiScript::instance_has(const Object *p_this) const {
+
+ _THREAD_SAFE_METHOD_
+ return instances.has((Object *)p_this);
+}
+
+bool MultiScript::has_source_code() const {
+
+ return false;
+}
+String MultiScript::get_source_code() const {
+
+ return "";
+}
+void MultiScript::set_source_code(const String &p_code) {
+}
+Error MultiScript::reload(bool p_keep_state) {
+
+ for (int i = 0; i < scripts.size(); i++)
+ scripts[i]->reload(p_keep_state);
+
+ return OK;
+}
+
+String MultiScript::get_node_type() const {
+
+ return "";
+}
+
+void MultiScript::_bind_methods() {
+}
+
+ScriptLanguage *MultiScript::get_language() const {
+
+ return MultiScriptLanguage::get_singleton();
+}
+
+///////////////
+
+MultiScript::MultiScript() {
+}
+
+MultiScript::~MultiScript() {
+ for (int i = 0; i < script_instances.size(); i++) {
+ memdelete(script_instances[i]);
+ }
+
+ script_instances.resize(0);
+}
+
+Ref<Script> MultiScript::get_base_script() const {
+ Ref<MultiScript> base_script;
+ return base_script;
+}
+
+bool MultiScript::has_method(const StringName &p_method) const {
+ for (int i = 0; i < scripts.size(); i++) {
+ if (scripts[i]->has_method(p_method)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+MethodInfo MultiScript::get_method_info(const StringName &p_method) const {
+ for (int i = 0; i < scripts.size(); i++) {
+ if (scripts[i]->has_method(p_method)) {
+ return scripts[i]->get_method_info(p_method);
+ }
+ }
+ return MethodInfo();
+}
+
+bool MultiScript::has_script_signal(const StringName &p_signal) const {
+ for (int i = 0; i < scripts.size(); i++) {
+ if (scripts[i]->has_script_signal(p_signal)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void MultiScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
+ for (int i = 0; i < scripts.size(); i++) {
+ scripts[i]->get_script_signal_list(r_signals);
+ }
+}
+
+bool MultiScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
+ for (int i = 0; i < scripts.size(); i++) {
+
+ if (scripts[i]->get_property_default_value(p_property, r_value)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+void MultiScript::get_script_method_list(List<MethodInfo> *p_list) const {
+ for (int i = 0; i < scripts.size(); i++) {
+ scripts[i]->get_script_method_list(p_list);
+ }
+}
+
+void MultiScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+ for (int i = 0; i < scripts.size(); i++) {
+ scripts[i]->get_script_property_list(p_list);
+ }
+}
+
+void MultiScript::update_exports() {
+ for (int i = 0; i < scripts.size(); i++) {
+ scripts[i]->update_exports();
+ }
+}
+
+MultiScriptLanguage *MultiScriptLanguage::singleton = NULL;
+
+MultiScriptLanguage *MultiScriptLanguage::get_singleton() {
+ return singleton;
+}
+
+String MultiScriptLanguage::get_name() const {
+ return "MultiScript";
+}
+
+void MultiScriptLanguage::init() {}
+
+String MultiScriptLanguage::get_type() const {
+ return "MultiScript";
+}
+
+String MultiScriptLanguage::get_extension() const {
+ return "";
+}
+
+Error MultiScriptLanguage::execute_file(const String &p_path) {
+ return OK;
+}
+
+void MultiScriptLanguage::finish() {}
+
+void MultiScriptLanguage::get_reserved_words(List<String> *p_words) const {}
+
+void MultiScriptLanguage::get_comment_delimiters(List<String> *p_delimiters) const {}
+
+void MultiScriptLanguage::get_string_delimiters(List<String> *p_delimiters) const {}
+
+Ref<Script> MultiScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
+ MultiScript *s = memnew(MultiScript);
+ s->base_class_name = p_base_class_name;
+ return Ref<MultiScript>(s);
+}
+
+bool MultiScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_fn) const {
+ return true;
+}
+
+Script *MultiScriptLanguage::create_script() const {
+ return memnew(MultiScript);
+}
+
+bool MultiScriptLanguage::has_named_classes() const {
+ return false;
+}
+
+int MultiScriptLanguage::find_function(const String &p_function, const String &p_code) const {
+ return -1;
+}
+
+String MultiScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const {
+ return "";
+}
+
+String MultiScriptLanguage::debug_get_error() const {
+ return "";
+}
+
+int MultiScriptLanguage::debug_get_stack_level_count() const {
+ return 0;
+}
+
+int MultiScriptLanguage::debug_get_stack_level_line(int p_level) const {
+ return 0;
+}
+
+String MultiScriptLanguage::debug_get_stack_level_function(int p_level) const {
+ return "";
+}
+
+String MultiScriptLanguage::debug_get_stack_level_source(int p_level) const {
+ return "";
+}
+
+void MultiScriptLanguage::debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+
+void MultiScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+
+void MultiScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {}
+
+String MultiScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
+ return "";
+}
+
+void MultiScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const {}
+
+void MultiScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const {}
+
+MultiScriptLanguage::MultiScriptLanguage() {
+ singleton = this;
+}
+
+MultiScriptLanguage::~MultiScriptLanguage() {}
+
+void MultiScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_to_line) const {
+}
+
+void MultiScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {
+}
+
+void MultiScriptLanguage::reload_all_scripts() {
+}
+
+void MultiScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) {
+}
+
+void MultiScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const {
+}
+
+void MultiScriptLanguage::profiling_start() {
+}
+
+void MultiScriptLanguage::profiling_stop() {
+}
+
+int MultiScriptLanguage::profiling_get_accumulated_data(ScriptLanguage::ProfilingInfo *p_info_arr, int p_info_max) {
+ return 0;
+}
+
+int MultiScriptLanguage::profiling_get_frame_data(ScriptLanguage::ProfilingInfo *p_info_arr, int p_info_max) {
+ return 0;
+}
+
+void Multi::_bind_methods() {
+ // ClassDB::bind_method("call", &Multi::call);
+ // ClassDB::bind_method("call_multilevel", &Multi::call_multilevel);
+ // ClassDB::bind_method("call_multilevel_reversed", &Multi::call_multilevel_reversed);
+}
+
+Variant Multi::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) {
+ if (real_owner)
+ return real_owner->call(p_method, p_args, p_argcount, r_error);
+ return Variant();
+}
+
+void Multi::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
+ if (real_owner)
+ real_owner->call_multilevel(p_method, p_args, p_argcount);
+}
+
+void Multi::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) {
+ if (real_owner)
+ real_owner->call_multilevel_reversed(p_method, p_args, p_argcount);
+}
diff --git a/modules/multiscript/multiscript.h b/modules/multiscript/multiscript.h
new file mode 100644
index 0000000000..7ec1d5402f
--- /dev/null
+++ b/modules/multiscript/multiscript.h
@@ -0,0 +1,200 @@
+/*************************************************************************/
+/* multiscript.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 MULTISCRIPT_H
+#define MULTISCRIPT_H
+
+#include "os/thread_safe.h"
+#include "script_language.h"
+
+class MultiScript;
+
+class Multi : public Object {
+ GDCLASS(Multi, Object)
+
+ friend class MultiScript;
+
+ Object *real_owner;
+
+public:
+ static void _bind_methods();
+
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
+ virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
+};
+
+class MultiScriptInstance : public ScriptInstance {
+ friend class MultiScript;
+ mutable Vector<ScriptInstance *> instances;
+ Object *object;
+ mutable MultiScript *owner;
+
+public:
+ virtual bool set(const StringName &p_name, const Variant &p_value);
+ virtual bool get(const StringName &p_name, Variant &r_ret) const;
+ virtual void get_property_list(List<PropertyInfo> *p_properties) const;
+
+ virtual void get_method_list(List<MethodInfo> *p_list) const;
+ virtual bool has_method(const StringName &p_method) const;
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
+ virtual void notification(int p_notification);
+
+ virtual Ref<Script> get_script() const;
+
+ virtual ScriptLanguage *get_language();
+ virtual ~MultiScriptInstance();
+
+ // ScriptInstance interface
+public:
+ Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid) const;
+ RPCMode get_rpc_mode(const StringName &p_method) const;
+ RPCMode get_rset_mode(const StringName &p_variable) const;
+};
+
+class MultiScript : public Script {
+
+ _THREAD_SAFE_CLASS_
+ friend class MultiScriptInstance;
+ friend class MultiScriptLanguage;
+ GDCLASS(MultiScript, Script)
+
+ StringName base_class_name;
+
+ Vector<Ref<Script> > scripts;
+ Vector<Multi *> script_instances;
+
+ Map<Object *, MultiScriptInstance *> instances;
+
+protected:
+ bool _set(const StringName &p_name, const Variant &p_value);
+ bool _get(const StringName &p_name, Variant &r_ret) const;
+ void _get_property_list(List<PropertyInfo> *p_list) const;
+
+ static void _bind_methods();
+
+public:
+ void remove_instance(Object *p_object);
+ virtual bool can_instance() const;
+
+ virtual StringName get_instance_base_type() const;
+ virtual ScriptInstance *instance_create(Object *p_this);
+ virtual bool instance_has(const Object *p_this) const;
+
+ virtual bool has_source_code() const;
+ virtual String get_source_code() const;
+ virtual void set_source_code(const String &p_code);
+ virtual Error reload(bool p_keep_state = false);
+
+ virtual bool is_tool() const;
+
+ virtual String get_node_type() const;
+
+ void set_script(int p_idx, const Ref<Script> &p_script);
+ Ref<Script> get_script(int p_idx) const;
+ void remove_script(int p_idx);
+ void add_script(const Ref<Script> &p_script);
+
+ virtual ScriptLanguage *get_language() const;
+
+ MultiScript();
+ ~MultiScript();
+
+ virtual Ref<Script> get_base_script() const;
+ virtual bool has_method(const StringName &p_method) const;
+ virtual MethodInfo get_method_info(const StringName &p_method) const;
+ virtual bool has_script_signal(const StringName &p_signal) const;
+ virtual void get_script_signal_list(List<MethodInfo> *r_signals) const;
+ virtual bool get_property_default_value(const StringName &p_property, Variant &r_value) const;
+ virtual void get_script_method_list(List<MethodInfo> *p_list) const;
+ virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+ virtual void update_exports();
+};
+
+class MultiScriptLanguage : public ScriptLanguage {
+
+ static MultiScriptLanguage *singleton;
+
+public:
+ static _FORCE_INLINE_ MultiScriptLanguage *get_singleton();
+ virtual String get_name() const;
+
+ /* LANGUAGE FUNCTIONS */
+ virtual void init();
+ virtual String get_type() const;
+ virtual String get_extension() const;
+ virtual Error execute_file(const String &p_path);
+ virtual void finish();
+
+ /* EDITOR FUNCTIONS */
+ virtual void get_reserved_words(List<String> *p_words) const;
+ virtual void get_comment_delimiters(List<String> *p_delimiters) const;
+ virtual void get_string_delimiters(List<String> *p_delimiters) const;
+ virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ virtual bool validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path = "", List<String> *r_fn = NULL) const;
+ virtual Script *create_script() const;
+ virtual bool has_named_classes() const;
+ virtual int find_function(const String &p_function, const String &p_code) const;
+ virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
+
+ /* DEBUGGER FUNCTIONS */
+
+ virtual String debug_get_error() const;
+ virtual int debug_get_stack_level_count() const;
+ virtual int debug_get_stack_level_line(int p_level) const;
+ virtual String debug_get_stack_level_function(int p_level) const;
+ virtual String debug_get_stack_level_source(int p_level) const;
+ virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+ virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+ virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+ virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1);
+
+ /* LOADER FUNCTIONS */
+
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual void get_public_functions(List<MethodInfo> *p_functions) const;
+
+ MultiScriptLanguage();
+ virtual ~MultiScriptLanguage();
+
+ // ScriptLanguage interface
+public:
+ void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
+ void add_global_constant(const StringName &p_variable, const Variant &p_value);
+ void reload_all_scripts();
+ void reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload);
+ void get_public_constants(List<Pair<String, Variant> > *p_constants) const;
+ void profiling_start();
+ void profiling_stop();
+ int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max);
+ int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max);
+};
+
+#endif // MULTISCRIPT_H
diff --git a/modules/multiscript/register_types.cpp b/modules/multiscript/register_types.cpp
new file mode 100644
index 0000000000..8170a2d9c1
--- /dev/null
+++ b/modules/multiscript/register_types.cpp
@@ -0,0 +1,51 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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 "register_types.h"
+
+#include "multiscript.h"
+
+#include "core/script_language.h"
+
+static MultiScriptLanguage *script_multi_script = NULL;
+
+void register_multiscript_types() {
+ script_multi_script = memnew(MultiScriptLanguage);
+ ScriptServer::register_language(script_multi_script);
+ ClassDB::register_class<MultiScript>();
+
+ // ClassDB::register_class<Multi>();
+}
+
+void unregister_multiscript_types() {
+ if (script_multi_script) {
+ ScriptServer::unregister_language(script_multi_script);
+ memdelete(script_multi_script);
+ }
+}
diff --git a/modules/multiscript/register_types.h b/modules/multiscript/register_types.h
new file mode 100644
index 0000000000..b18d1adff2
--- /dev/null
+++ b/modules/multiscript/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 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. */
+/*************************************************************************/
+void register_multiscript_types();
+void unregister_multiscript_types();
diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub
index 0e811ce8c9..add7d4dcfc 100644
--- a/modules/openssl/SCsub
+++ b/modules/openssl/SCsub
@@ -677,7 +677,16 @@ if (env['builtin_openssl'] != 'no'):
# Module sources
env_openssl.add_source_files(env.modules_sources, "*.cpp")
-env_openssl.add_source_files(env.modules_sources, "*.c")
+
+
+# Other thirdparty dependencies
+thirdparty_misc_dir = "#thirdparty/misc/"
+thirdparty_misc_sources = [
+ "curl_hostcheck.c",
+]
+thirdparty_misc_sources = [thirdparty_misc_dir + file for file in thirdparty_misc_sources]
+env_openssl.add_source_files(env.modules_sources, thirdparty_misc_sources)
+
# platform/uwp need to know openssl is available, pass to main env
if "platform" in env and env["platform"] == "uwp":
diff --git a/modules/openssl/curl_hostcheck.c b/modules/openssl/curl_hostcheck.c
deleted file mode 100644
index feef232619..0000000000
--- a/modules/openssl/curl_hostcheck.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-/* This file is an amalgamation of hostcheck.c and most of rawstr.c
- from cURL. The contents of the COPYING file mentioned above are:
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1996 - 2013, Daniel Stenberg, <daniel@haxx.se>.
-
-All rights reserved.
-
-Permission to use, copy, modify, and distribute this software for any purpose
-with or without fee is hereby granted, provided that the above copyright
-notice and this permission notice appear in all copies.
-
-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 OF THIRD PARTY RIGHTS. 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.
-
-Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization of the copyright holder.
-*/
-
-#include "curl_hostcheck.h"
-#include <string.h>
-
-/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because
- its behavior is altered by the current locale. */
-static char Curl_raw_toupper(char in)
-{
- switch (in) {
- case 'a':
- return 'A';
- case 'b':
- return 'B';
- case 'c':
- return 'C';
- case 'd':
- return 'D';
- case 'e':
- return 'E';
- case 'f':
- return 'F';
- case 'g':
- return 'G';
- case 'h':
- return 'H';
- case 'i':
- return 'I';
- case 'j':
- return 'J';
- case 'k':
- return 'K';
- case 'l':
- return 'L';
- case 'm':
- return 'M';
- case 'n':
- return 'N';
- case 'o':
- return 'O';
- case 'p':
- return 'P';
- case 'q':
- return 'Q';
- case 'r':
- return 'R';
- case 's':
- return 'S';
- case 't':
- return 'T';
- case 'u':
- return 'U';
- case 'v':
- return 'V';
- case 'w':
- return 'W';
- case 'x':
- return 'X';
- case 'y':
- return 'Y';
- case 'z':
- return 'Z';
- }
- return in;
-}
-
-/*
- * Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant
- * to be locale independent and only compare strings we know are safe for
- * this. See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for
- * some further explanation to why this function is necessary.
- *
- * The function is capable of comparing a-z case insensitively even for
- * non-ascii.
- */
-
-static int Curl_raw_equal(const char *first, const char *second)
-{
- while(*first && *second) {
- if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second))
- /* get out of the loop as soon as they don't match */
- break;
- first++;
- second++;
- }
- /* we do the comparison here (possibly again), just to make sure that if the
- loop above is skipped because one of the strings reached zero, we must not
- return this as a successful match */
- return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second));
-}
-
-static int Curl_raw_nequal(const char *first, const char *second, size_t max)
-{
- while(*first && *second && max) {
- if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) {
- break;
- }
- max--;
- first++;
- second++;
- }
- if(0 == max)
- return 1; /* they are equal this far */
-
- return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
-}
-
-/*
- * Match a hostname against a wildcard pattern.
- * E.g.
- * "foo.host.com" matches "*.host.com".
- *
- * We use the matching rule described in RFC6125, section 6.4.3.
- * http://tools.ietf.org/html/rfc6125#section-6.4.3
- */
-
-static int hostmatch(const char *hostname, const char *pattern)
-{
- const char *pattern_label_end, *pattern_wildcard, *hostname_label_end;
- int wildcard_enabled;
- size_t prefixlen, suffixlen;
- pattern_wildcard = strchr(pattern, '*');
- if(pattern_wildcard == NULL)
- return Curl_raw_equal(pattern, hostname) ?
- CURL_HOST_MATCH : CURL_HOST_NOMATCH;
-
- /* We require at least 2 dots in pattern to avoid too wide wildcard
- match. */
- wildcard_enabled = 1;
- pattern_label_end = strchr(pattern, '.');
- if(pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL ||
- pattern_wildcard > pattern_label_end ||
- Curl_raw_nequal(pattern, "xn--", 4)) {
- wildcard_enabled = 0;
- }
- if(!wildcard_enabled)
- return Curl_raw_equal(pattern, hostname) ?
- CURL_HOST_MATCH : CURL_HOST_NOMATCH;
-
- hostname_label_end = strchr(hostname, '.');
- if(hostname_label_end == NULL ||
- !Curl_raw_equal(pattern_label_end, hostname_label_end))
- return CURL_HOST_NOMATCH;
-
- /* The wildcard must match at least one character, so the left-most
- label of the hostname is at least as large as the left-most label
- of the pattern. */
- if(hostname_label_end - hostname < pattern_label_end - pattern)
- return CURL_HOST_NOMATCH;
-
- prefixlen = pattern_wildcard - pattern;
- suffixlen = pattern_label_end - (pattern_wildcard+1);
- return Curl_raw_nequal(pattern, hostname, prefixlen) &&
- Curl_raw_nequal(pattern_wildcard+1, hostname_label_end - suffixlen,
- suffixlen) ?
- CURL_HOST_MATCH : CURL_HOST_NOMATCH;
-}
-
-int Tool_Curl_cert_hostcheck(const char *match_pattern, const char *hostname)
-{
- if(!match_pattern || !*match_pattern ||
- !hostname || !*hostname) /* sanity check */
- return 0;
-
- if(Curl_raw_equal(hostname, match_pattern)) /* trivial case */
- return 1;
-
- if(hostmatch(hostname,match_pattern) == CURL_HOST_MATCH)
- return 1;
- return 0;
-}
diff --git a/modules/openssl/curl_hostcheck.h b/modules/openssl/curl_hostcheck.h
deleted file mode 100644
index 1b7fbe81e3..0000000000
--- a/modules/openssl/curl_hostcheck.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef HEADER_TOOL_CURL_HOSTCHECK_H
-#define HEADER_TOOL_CURL_HOSTCHECK_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-#define CURL_HOST_NOMATCH 0
-#define CURL_HOST_MATCH 1
-int Tool_Curl_cert_hostcheck(const char *match_pattern, const char *hostname);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HEADER_CURL_HOSTCHECK_H */
-
diff --git a/modules/openssl/stream_peer_openssl.h b/modules/openssl/stream_peer_openssl.h
index 12262da94a..5c830ebf37 100644
--- a/modules/openssl/stream_peer_openssl.h
+++ b/modules/openssl/stream_peer_openssl.h
@@ -30,17 +30,19 @@
#ifndef STREAM_PEER_OPEN_SSL_H
#define STREAM_PEER_OPEN_SSL_H
-#include "curl_hostcheck.h"
#include "global_config.h"
#include "io/stream_peer_ssl.h"
#include "os/file_access.h"
-#include <stdio.h> // If you don't know what this is for stop reading now.
+
+#include "thirdparty/misc/curl_hostcheck.h"
#include <openssl/bio.h> // BIO objects for I/O
#include <openssl/err.h> // Error reporting
#include <openssl/ssl.h> // SSL and SSL_CTX for SSL connections
#include <openssl/x509v3.h>
+#include <stdio.h>
+
class StreamPeerOpenSSL : public StreamPeerSSL {
private:
static int _bio_create(BIO *b);
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
index 227e5e61b6..c645a55703 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp
@@ -30,7 +30,8 @@
#include "audio_stream_ogg_vorbis.h"
#include "os/file_access.h"
-#include "thirdparty/stb_vorbis/stb_vorbis.c"
+
+#include "thirdparty/misc/stb_vorbis.c"
void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_frames) {
@@ -42,6 +43,7 @@ void AudioStreamPlaybackOGGVorbis::_mix_internal(AudioFrame *p_buffer, int p_fra
int mixed = stb_vorbis_get_samples_float_interleaved(ogg_stream, 2, (float *)p_buffer, todo * 2);
todo -= mixed;
+ frames_mixed += mixed;
if (todo) {
//end of file!
@@ -66,8 +68,8 @@ float AudioStreamPlaybackOGGVorbis::get_stream_sampling_rate() {
void AudioStreamPlaybackOGGVorbis::start(float p_from_pos) {
- seek_pos(p_from_pos);
active = true;
+ seek_pos(p_from_pos);
loops = 0;
_begin_resample();
}
@@ -95,7 +97,12 @@ void AudioStreamPlaybackOGGVorbis::seek_pos(float p_time) {
if (!active)
return;
- stb_vorbis_seek(ogg_stream, uint32_t(p_time * vorbis_stream->sample_rate));
+ if (p_time >= get_length()) {
+ p_time = 0;
+ }
+ frames_mixed = uint32_t(vorbis_stream->sample_rate * p_time);
+
+ stb_vorbis_seek(ogg_stream, frames_mixed);
}
float AudioStreamPlaybackOGGVorbis::get_length() const {
diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.h b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
index bb895c4dfa..287aa4ca47 100644
--- a/modules/stb_vorbis/audio_stream_ogg_vorbis.h
+++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.h
@@ -34,7 +34,7 @@
#include "servers/audio/audio_stream.h"
#define STB_VORBIS_HEADER_ONLY
-#include "thirdparty/stb_vorbis/stb_vorbis.c"
+#include "thirdparty/misc/stb_vorbis.c"
#undef STB_VORBIS_HEADER_ONLY
class AudioStreamOGGVorbis;
diff --git a/modules/theora/video_stream_theora.cpp b/modules/theora/video_stream_theora.cpp
index 28463e2cba..61112f20b4 100644
--- a/modules/theora/video_stream_theora.cpp
+++ b/modules/theora/video_stream_theora.cpp
@@ -31,7 +31,8 @@
#include "global_config.h"
#include "os/os.h"
-#include "yuv2rgb.h"
+
+#include "thirdparty/misc/yuv2rgb.h"
int VideoStreamPlaybackTheora::buffer_data() {
diff --git a/modules/theora/yuv2rgb.h b/modules/theora/yuv2rgb.h
deleted file mode 100644
index a9bef76da8..0000000000
--- a/modules/theora/yuv2rgb.h
+++ /dev/null
@@ -1,1123 +0,0 @@
-/* Thirdparty code presumably from http://wss.co.uk/pinknoise/yuv2rgb/ */
-/* FIXME: Move to thirdparty dir */
-
-#ifndef YUV2RGB_H
-#define YUV2RGB_H
-
-#include "typedefs.h"
-
-static const uint32_t tables[256*3] = {
- /* y_table */
- 0x7FFFFFEDU,
- 0x7FFFFFEFU,
- 0x7FFFFFF0U,
- 0x7FFFFFF1U,
- 0x7FFFFFF2U,
- 0x7FFFFFF3U,
- 0x7FFFFFF4U,
- 0x7FFFFFF6U,
- 0x7FFFFFF7U,
- 0x7FFFFFF8U,
- 0x7FFFFFF9U,
- 0x7FFFFFFAU,
- 0x7FFFFFFBU,
- 0x7FFFFFFDU,
- 0x7FFFFFFEU,
- 0x7FFFFFFFU,
- 0x80000000U,
- 0x80400801U,
- 0x80A01002U,
- 0x80E01803U,
- 0x81202805U,
- 0x81803006U,
- 0x81C03807U,
- 0x82004008U,
- 0x82604809U,
- 0x82A0500AU,
- 0x82E0600CU,
- 0x8340680DU,
- 0x8380700EU,
- 0x83C0780FU,
- 0x84208010U,
- 0x84608811U,
- 0x84A09813U,
- 0x8500A014U,
- 0x8540A815U,
- 0x8580B016U,
- 0x85E0B817U,
- 0x8620C018U,
- 0x8660D01AU,
- 0x86C0D81BU,
- 0x8700E01CU,
- 0x8740E81DU,
- 0x87A0F01EU,
- 0x87E0F81FU,
- 0x88210821U,
- 0x88811022U,
- 0x88C11823U,
- 0x89012024U,
- 0x89412825U,
- 0x89A13026U,
- 0x89E14028U,
- 0x8A214829U,
- 0x8A81502AU,
- 0x8AC1582BU,
- 0x8B01602CU,
- 0x8B61682DU,
- 0x8BA1782FU,
- 0x8BE18030U,
- 0x8C418831U,
- 0x8C819032U,
- 0x8CC19833U,
- 0x8D21A034U,
- 0x8D61B036U,
- 0x8DA1B837U,
- 0x8E01C038U,
- 0x8E41C839U,
- 0x8E81D03AU,
- 0x8EE1D83BU,
- 0x8F21E83DU,
- 0x8F61F03EU,
- 0x8FC1F83FU,
- 0x90020040U,
- 0x90420841U,
- 0x90A21042U,
- 0x90E22044U,
- 0x91222845U,
- 0x91823046U,
- 0x91C23847U,
- 0x92024048U,
- 0x92624849U,
- 0x92A2504AU,
- 0x92E2604CU,
- 0x9342684DU,
- 0x9382704EU,
- 0x93C2784FU,
- 0x94228050U,
- 0x94628851U,
- 0x94A29853U,
- 0x9502A054U,
- 0x9542A855U,
- 0x9582B056U,
- 0x95E2B857U,
- 0x9622C058U,
- 0x9662D05AU,
- 0x96C2D85BU,
- 0x9702E05CU,
- 0x9742E85DU,
- 0x97A2F05EU,
- 0x97E2F85FU,
- 0x98230861U,
- 0x98831062U,
- 0x98C31863U,
- 0x99032064U,
- 0x99632865U,
- 0x99A33066U,
- 0x99E34068U,
- 0x9A434869U,
- 0x9A83506AU,
- 0x9AC3586BU,
- 0x9B23606CU,
- 0x9B63686DU,
- 0x9BA3786FU,
- 0x9BE38070U,
- 0x9C438871U,
- 0x9C839072U,
- 0x9CC39873U,
- 0x9D23A074U,
- 0x9D63B076U,
- 0x9DA3B877U,
- 0x9E03C078U,
- 0x9E43C879U,
- 0x9E83D07AU,
- 0x9EE3D87BU,
- 0x9F23E87DU,
- 0x9F63F07EU,
- 0x9FC3F87FU,
- 0xA0040080U,
- 0xA0440881U,
- 0xA0A41082U,
- 0xA0E42084U,
- 0xA1242885U,
- 0xA1843086U,
- 0xA1C43887U,
- 0xA2044088U,
- 0xA2644889U,
- 0xA2A4588BU,
- 0xA2E4608CU,
- 0xA344688DU,
- 0xA384708EU,
- 0xA3C4788FU,
- 0xA4248090U,
- 0xA4649092U,
- 0xA4A49893U,
- 0xA504A094U,
- 0xA544A895U,
- 0xA584B096U,
- 0xA5E4B897U,
- 0xA624C098U,
- 0xA664D09AU,
- 0xA6C4D89BU,
- 0xA704E09CU,
- 0xA744E89DU,
- 0xA7A4F09EU,
- 0xA7E4F89FU,
- 0xA82508A1U,
- 0xA88510A2U,
- 0xA8C518A3U,
- 0xA90520A4U,
- 0xA96528A5U,
- 0xA9A530A6U,
- 0xA9E540A8U,
- 0xAA4548A9U,
- 0xAA8550AAU,
- 0xAAC558ABU,
- 0xAB2560ACU,
- 0xAB6568ADU,
- 0xABA578AFU,
- 0xAC0580B0U,
- 0xAC4588B1U,
- 0xAC8590B2U,
- 0xACE598B3U,
- 0xAD25A0B4U,
- 0xAD65B0B6U,
- 0xADA5B8B7U,
- 0xAE05C0B8U,
- 0xAE45C8B9U,
- 0xAE85D0BAU,
- 0xAEE5D8BBU,
- 0xAF25E8BDU,
- 0xAF65F0BEU,
- 0xAFC5F8BFU,
- 0xB00600C0U,
- 0xB04608C1U,
- 0xB0A610C2U,
- 0xB0E620C4U,
- 0xB12628C5U,
- 0xB18630C6U,
- 0xB1C638C7U,
- 0xB20640C8U,
- 0xB26648C9U,
- 0xB2A658CBU,
- 0xB2E660CCU,
- 0xB34668CDU,
- 0xB38670CEU,
- 0xB3C678CFU,
- 0xB42680D0U,
- 0xB46690D2U,
- 0xB4A698D3U,
- 0xB506A0D4U,
- 0xB546A8D5U,
- 0xB586B0D6U,
- 0xB5E6B8D7U,
- 0xB626C8D9U,
- 0xB666D0DAU,
- 0xB6C6D8DBU,
- 0xB706E0DCU,
- 0xB746E8DDU,
- 0xB7A6F0DEU,
- 0xB7E6F8DFU,
- 0xB82708E1U,
- 0xB88710E2U,
- 0xB8C718E3U,
- 0xB90720E4U,
- 0xB96728E5U,
- 0xB9A730E6U,
- 0xB9E740E8U,
- 0xBA4748E9U,
- 0xBA8750EAU,
- 0xBAC758EBU,
- 0xBB2760ECU,
- 0xBB6768EDU,
- 0xBBA778EFU,
- 0xBC0780F0U,
- 0xBC4788F1U,
- 0xBC8790F2U,
- 0xBCE798F3U,
- 0xBD27A0F4U,
- 0xBD67B0F6U,
- 0xBDC7B8F7U,
- 0xBE07C0F8U,
- 0xBE47C8F9U,
- 0xBEA7D0FAU,
- 0xBEE7D8FBU,
- 0xBF27E8FDU,
- 0xBF87F0FEU,
- 0xBFC7F8FFU,
- 0xC0080100U,
- 0xC0480901U,
- 0xC0A81102U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- 0xC0E82104U,
- /* u_table */
- 0x0C400103U,
- 0x0C200105U,
- 0x0C200107U,
- 0x0C000109U,
- 0x0BE0010BU,
- 0x0BC0010DU,
- 0x0BA0010FU,
- 0x0BA00111U,
- 0x0B800113U,
- 0x0B600115U,
- 0x0B400117U,
- 0x0B400119U,
- 0x0B20011BU,
- 0x0B00011DU,
- 0x0AE0011FU,
- 0x0AE00121U,
- 0x0AC00123U,
- 0x0AA00125U,
- 0x0A800127U,
- 0x0A600129U,
- 0x0A60012BU,
- 0x0A40012DU,
- 0x0A20012FU,
- 0x0A000131U,
- 0x0A000132U,
- 0x09E00134U,
- 0x09C00136U,
- 0x09A00138U,
- 0x09A0013AU,
- 0x0980013CU,
- 0x0960013EU,
- 0x09400140U,
- 0x09400142U,
- 0x09200144U,
- 0x09000146U,
- 0x08E00148U,
- 0x08C0014AU,
- 0x08C0014CU,
- 0x08A0014EU,
- 0x08800150U,
- 0x08600152U,
- 0x08600154U,
- 0x08400156U,
- 0x08200158U,
- 0x0800015AU,
- 0x0800015CU,
- 0x07E0015EU,
- 0x07C00160U,
- 0x07A00162U,
- 0x07A00164U,
- 0x07800166U,
- 0x07600168U,
- 0x0740016AU,
- 0x0720016CU,
- 0x0720016EU,
- 0x07000170U,
- 0x06E00172U,
- 0x06C00174U,
- 0x06C00176U,
- 0x06A00178U,
- 0x0680017AU,
- 0x0660017CU,
- 0x0660017EU,
- 0x06400180U,
- 0x06200182U,
- 0x06000184U,
- 0x05E00185U,
- 0x05E00187U,
- 0x05C00189U,
- 0x05A0018BU,
- 0x0580018DU,
- 0x0580018FU,
- 0x05600191U,
- 0x05400193U,
- 0x05200195U,
- 0x05200197U,
- 0x05000199U,
- 0x04E0019BU,
- 0x04C0019DU,
- 0x04C0019FU,
- 0x04A001A1U,
- 0x048001A3U,
- 0x046001A5U,
- 0x044001A7U,
- 0x044001A9U,
- 0x042001ABU,
- 0x040001ADU,
- 0x03E001AFU,
- 0x03E001B1U,
- 0x03C001B3U,
- 0x03A001B5U,
- 0x038001B7U,
- 0x038001B9U,
- 0x036001BBU,
- 0x034001BDU,
- 0x032001BFU,
- 0x032001C1U,
- 0x030001C3U,
- 0x02E001C5U,
- 0x02C001C7U,
- 0x02A001C9U,
- 0x02A001CBU,
- 0x028001CDU,
- 0x026001CFU,
- 0x024001D1U,
- 0x024001D3U,
- 0x022001D5U,
- 0x020001D7U,
- 0x01E001D8U,
- 0x01E001DAU,
- 0x01C001DCU,
- 0x01A001DEU,
- 0x018001E0U,
- 0x016001E2U,
- 0x016001E4U,
- 0x014001E6U,
- 0x012001E8U,
- 0x010001EAU,
- 0x010001ECU,
- 0x00E001EEU,
- 0x00C001F0U,
- 0x00A001F2U,
- 0x00A001F4U,
- 0x008001F6U,
- 0x006001F8U,
- 0x004001FAU,
- 0x004001FCU,
- 0x002001FEU,
- 0x00000200U,
- 0xFFE00202U,
- 0xFFC00204U,
- 0xFFC00206U,
- 0xFFA00208U,
- 0xFF80020AU,
- 0xFF60020CU,
- 0xFF60020EU,
- 0xFF400210U,
- 0xFF200212U,
- 0xFF000214U,
- 0xFF000216U,
- 0xFEE00218U,
- 0xFEC0021AU,
- 0xFEA0021CU,
- 0xFEA0021EU,
- 0xFE800220U,
- 0xFE600222U,
- 0xFE400224U,
- 0xFE200226U,
- 0xFE200228U,
- 0xFE000229U,
- 0xFDE0022BU,
- 0xFDC0022DU,
- 0xFDC0022FU,
- 0xFDA00231U,
- 0xFD800233U,
- 0xFD600235U,
- 0xFD600237U,
- 0xFD400239U,
- 0xFD20023BU,
- 0xFD00023DU,
- 0xFCE0023FU,
- 0xFCE00241U,
- 0xFCC00243U,
- 0xFCA00245U,
- 0xFC800247U,
- 0xFC800249U,
- 0xFC60024BU,
- 0xFC40024DU,
- 0xFC20024FU,
- 0xFC200251U,
- 0xFC000253U,
- 0xFBE00255U,
- 0xFBC00257U,
- 0xFBC00259U,
- 0xFBA0025BU,
- 0xFB80025DU,
- 0xFB60025FU,
- 0xFB400261U,
- 0xFB400263U,
- 0xFB200265U,
- 0xFB000267U,
- 0xFAE00269U,
- 0xFAE0026BU,
- 0xFAC0026DU,
- 0xFAA0026FU,
- 0xFA800271U,
- 0xFA800273U,
- 0xFA600275U,
- 0xFA400277U,
- 0xFA200279U,
- 0xFA20027BU,
- 0xFA00027CU,
- 0xF9E0027EU,
- 0xF9C00280U,
- 0xF9A00282U,
- 0xF9A00284U,
- 0xF9800286U,
- 0xF9600288U,
- 0xF940028AU,
- 0xF940028CU,
- 0xF920028EU,
- 0xF9000290U,
- 0xF8E00292U,
- 0xF8E00294U,
- 0xF8C00296U,
- 0xF8A00298U,
- 0xF880029AU,
- 0xF860029CU,
- 0xF860029EU,
- 0xF84002A0U,
- 0xF82002A2U,
- 0xF80002A4U,
- 0xF80002A6U,
- 0xF7E002A8U,
- 0xF7C002AAU,
- 0xF7A002ACU,
- 0xF7A002AEU,
- 0xF78002B0U,
- 0xF76002B2U,
- 0xF74002B4U,
- 0xF74002B6U,
- 0xF72002B8U,
- 0xF70002BAU,
- 0xF6E002BCU,
- 0xF6C002BEU,
- 0xF6C002C0U,
- 0xF6A002C2U,
- 0xF68002C4U,
- 0xF66002C6U,
- 0xF66002C8U,
- 0xF64002CAU,
- 0xF62002CCU,
- 0xF60002CEU,
- 0xF60002CFU,
- 0xF5E002D1U,
- 0xF5C002D3U,
- 0xF5A002D5U,
- 0xF5A002D7U,
- 0xF58002D9U,
- 0xF56002DBU,
- 0xF54002DDU,
- 0xF52002DFU,
- 0xF52002E1U,
- 0xF50002E3U,
- 0xF4E002E5U,
- 0xF4C002E7U,
- 0xF4C002E9U,
- 0xF4A002EBU,
- 0xF48002EDU,
- 0xF46002EFU,
- 0xF46002F1U,
- 0xF44002F3U,
- 0xF42002F5U,
- 0xF40002F7U,
- 0xF3E002F9U,
- 0xF3E002FBU,
- /* v_table */
- 0x1A09A000U,
- 0x19E9A800U,
- 0x19A9B800U,
- 0x1969C800U,
- 0x1949D000U,
- 0x1909E000U,
- 0x18C9E800U,
- 0x18A9F800U,
- 0x186A0000U,
- 0x182A1000U,
- 0x180A2000U,
- 0x17CA2800U,
- 0x17AA3800U,
- 0x176A4000U,
- 0x172A5000U,
- 0x170A6000U,
- 0x16CA6800U,
- 0x168A7800U,
- 0x166A8000U,
- 0x162A9000U,
- 0x160AA000U,
- 0x15CAA800U,
- 0x158AB800U,
- 0x156AC000U,
- 0x152AD000U,
- 0x14EAE000U,
- 0x14CAE800U,
- 0x148AF800U,
- 0x146B0000U,
- 0x142B1000U,
- 0x13EB2000U,
- 0x13CB2800U,
- 0x138B3800U,
- 0x134B4000U,
- 0x132B5000U,
- 0x12EB6000U,
- 0x12CB6800U,
- 0x128B7800U,
- 0x124B8000U,
- 0x122B9000U,
- 0x11EBA000U,
- 0x11ABA800U,
- 0x118BB800U,
- 0x114BC000U,
- 0x112BD000U,
- 0x10EBE000U,
- 0x10ABE800U,
- 0x108BF800U,
- 0x104C0000U,
- 0x100C1000U,
- 0x0FEC2000U,
- 0x0FAC2800U,
- 0x0F8C3800U,
- 0x0F4C4000U,
- 0x0F0C5000U,
- 0x0EEC5800U,
- 0x0EAC6800U,
- 0x0E6C7800U,
- 0x0E4C8000U,
- 0x0E0C9000U,
- 0x0DEC9800U,
- 0x0DACA800U,
- 0x0D6CB800U,
- 0x0D4CC000U,
- 0x0D0CD000U,
- 0x0CCCD800U,
- 0x0CACE800U,
- 0x0C6CF800U,
- 0x0C4D0000U,
- 0x0C0D1000U,
- 0x0BCD1800U,
- 0x0BAD2800U,
- 0x0B6D3800U,
- 0x0B2D4000U,
- 0x0B0D5000U,
- 0x0ACD5800U,
- 0x0AAD6800U,
- 0x0A6D7800U,
- 0x0A2D8000U,
- 0x0A0D9000U,
- 0x09CD9800U,
- 0x098DA800U,
- 0x096DB800U,
- 0x092DC000U,
- 0x090DD000U,
- 0x08CDD800U,
- 0x088DE800U,
- 0x086DF800U,
- 0x082E0000U,
- 0x07EE1000U,
- 0x07CE1800U,
- 0x078E2800U,
- 0x076E3800U,
- 0x072E4000U,
- 0x06EE5000U,
- 0x06CE5800U,
- 0x068E6800U,
- 0x064E7800U,
- 0x062E8000U,
- 0x05EE9000U,
- 0x05CE9800U,
- 0x058EA800U,
- 0x054EB800U,
- 0x052EC000U,
- 0x04EED000U,
- 0x04AED800U,
- 0x048EE800U,
- 0x044EF000U,
- 0x042F0000U,
- 0x03EF1000U,
- 0x03AF1800U,
- 0x038F2800U,
- 0x034F3000U,
- 0x030F4000U,
- 0x02EF5000U,
- 0x02AF5800U,
- 0x028F6800U,
- 0x024F7000U,
- 0x020F8000U,
- 0x01EF9000U,
- 0x01AF9800U,
- 0x016FA800U,
- 0x014FB000U,
- 0x010FC000U,
- 0x00EFD000U,
- 0x00AFD800U,
- 0x006FE800U,
- 0x004FF000U,
- 0x00100000U,
- 0xFFD01000U,
- 0xFFB01800U,
- 0xFF702800U,
- 0xFF303000U,
- 0xFF104000U,
- 0xFED05000U,
- 0xFEB05800U,
- 0xFE706800U,
- 0xFE307000U,
- 0xFE108000U,
- 0xFDD09000U,
- 0xFD909800U,
- 0xFD70A800U,
- 0xFD30B000U,
- 0xFD10C000U,
- 0xFCD0D000U,
- 0xFC90D800U,
- 0xFC70E800U,
- 0xFC30F000U,
- 0xFBF10000U,
- 0xFBD11000U,
- 0xFB911800U,
- 0xFB712800U,
- 0xFB313000U,
- 0xFAF14000U,
- 0xFAD14800U,
- 0xFA915800U,
- 0xFA516800U,
- 0xFA317000U,
- 0xF9F18000U,
- 0xF9D18800U,
- 0xF9919800U,
- 0xF951A800U,
- 0xF931B000U,
- 0xF8F1C000U,
- 0xF8B1C800U,
- 0xF891D800U,
- 0xF851E800U,
- 0xF831F000U,
- 0xF7F20000U,
- 0xF7B20800U,
- 0xF7921800U,
- 0xF7522800U,
- 0xF7123000U,
- 0xF6F24000U,
- 0xF6B24800U,
- 0xF6925800U,
- 0xF6526800U,
- 0xF6127000U,
- 0xF5F28000U,
- 0xF5B28800U,
- 0xF5729800U,
- 0xF552A800U,
- 0xF512B000U,
- 0xF4F2C000U,
- 0xF4B2C800U,
- 0xF472D800U,
- 0xF452E800U,
- 0xF412F000U,
- 0xF3D30000U,
- 0xF3B30800U,
- 0xF3731800U,
- 0xF3532800U,
- 0xF3133000U,
- 0xF2D34000U,
- 0xF2B34800U,
- 0xF2735800U,
- 0xF2336800U,
- 0xF2137000U,
- 0xF1D38000U,
- 0xF1B38800U,
- 0xF1739800U,
- 0xF133A800U,
- 0xF113B000U,
- 0xF0D3C000U,
- 0xF093C800U,
- 0xF073D800U,
- 0xF033E000U,
- 0xF013F000U,
- 0xEFD40000U,
- 0xEF940800U,
- 0xEF741800U,
- 0xEF342000U,
- 0xEEF43000U,
- 0xEED44000U,
- 0xEE944800U,
- 0xEE745800U,
- 0xEE346000U,
- 0xEDF47000U,
- 0xEDD48000U,
- 0xED948800U,
- 0xED549800U,
- 0xED34A000U,
- 0xECF4B000U,
- 0xECD4C000U,
- 0xEC94C800U,
- 0xEC54D800U,
- 0xEC34E000U,
- 0xEBF4F000U,
- 0xEBB50000U,
- 0xEB950800U,
- 0xEB551800U,
- 0xEB352000U,
- 0xEAF53000U,
- 0xEAB54000U,
- 0xEA954800U,
- 0xEA555800U,
- 0xEA156000U,
- 0xE9F57000U,
- 0xE9B58000U,
- 0xE9958800U,
- 0xE9559800U,
- 0xE915A000U,
- 0xE8F5B000U,
- 0xE8B5C000U,
- 0xE875C800U,
- 0xE855D800U,
- 0xE815E000U,
- 0xE7F5F000U,
- 0xE7B60000U,
- 0xE7760800U,
- 0xE7561800U,
- 0xE7162000U,
- 0xE6D63000U,
- 0xE6B64000U,
- 0xE6764800U,
- 0xE6365800U
-};
-
-#define FLAGS 0x40080100
-#define READUV(U,V) (tables[256 + (U)] + tables[512 + (V)])
-#define READY(Y) tables[Y]
-#define FIXUP(Y) \
-do { \
- int tmp = (Y) & FLAGS; \
- if (tmp != 0) \
- { \
- tmp -= tmp>>8; \
- (Y) |= tmp; \
- tmp = FLAGS & ~(Y>>1); \
- (Y) += tmp>>8; \
- } \
-} while (0 == 1)
-
-#define STORE(Y,DSTPTR) \
-do { \
- *(DSTPTR)++ = (Y); \
- *(DSTPTR)++ = (Y)>>22; \
- *(DSTPTR)++ = (Y)>>11; \
- *(DSTPTR)++ = 255; \
-} while (0 == 1)
-
-static void yuv422_2_rgb8888(uint8_t *dst_ptr,
- const uint8_t *y_ptr,
- const uint8_t *u_ptr,
- const uint8_t *v_ptr,
- int32_t width,
- int32_t height,
- int32_t y_span,
- int32_t uv_span,
- int32_t dst_span,
- int32_t dither)
-{
- height -= 1;
- while (height > 0)
- {
- height -= width<<16;
- height += 1<<16;
- while (height < 0)
- {
- /* Do top row pair */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- y1 = uv + READY(*y_ptr++);
- FIXUP(y0);
- FIXUP(y1);
- STORE(y0, dst_ptr);
- STORE(y1, dst_ptr);
- height += (2<<16);
- }
- if ((height>>16) == 0)
- {
- /* Trailing top row pix */
- uint32_t uv, y0;
-
- uv = READUV(*u_ptr,*v_ptr);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, dst_ptr);
- }
- dst_ptr += dst_span-width*4;
- y_ptr += y_span-width;
- u_ptr += uv_span-(width>>1);
- v_ptr += uv_span-(width>>1);
- height = (height<<16)>>16;
- height -= 1;
- if (height == 0)
- break;
- height -= width<<16;
- height += 1<<16;
- while (height < 0)
- {
- /* Do second row pair */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- y1 = uv + READY(*y_ptr++);
- FIXUP(y0);
- FIXUP(y1);
- STORE(y0, dst_ptr);
- STORE(y1, dst_ptr);
- height += (2<<16);
- }
- if ((height>>16) == 0)
- {
- /* Trailing bottom row pix */
- uint32_t uv, y0;
-
- uv = READUV(*u_ptr,*v_ptr);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, dst_ptr);
- }
- dst_ptr += dst_span-width*4;
- y_ptr += y_span-width;
- u_ptr += uv_span-(width>>1);
- v_ptr += uv_span-(width>>1);
- height = (height<<16)>>16;
- height -= 1;
- }
-}
-
-
-#undef FLAGS
-#undef READUV
-#undef READY
-#undef FIXUP
-#undef STORE
-
-
-#define FLAGS 0x40080100
-#define READUV(U,V) (tables[256 + (U)] + tables[512 + (V)])
-#define READY(Y) tables[Y]
-#define FIXUP(Y) \
-do { \
- int tmp = (Y) & FLAGS; \
- if (tmp != 0) \
- { \
- tmp -= tmp>>8; \
- (Y) |= tmp; \
- tmp = FLAGS & ~(Y>>1); \
- (Y) += tmp>>8; \
- } \
-} while (0 == 1)
-
-#define STORE(Y,DSTPTR) \
-do { \
- (DSTPTR) = 0xFF000000 | (Y & 0xFF) | (0xFF00 & (Y>>14)) | (0xFF0000 & (Y<<5));\
-} while (0 == 1)
-
-static void yuv420_2_rgb8888(uint8_t *dst_ptr_,
- const uint8_t *y_ptr,
- const uint8_t *u_ptr,
- const uint8_t *v_ptr,
- int32_t width,
- int32_t height,
- int32_t y_span,
- int32_t uv_span,
- int32_t dst_span,
- int32_t dither)
-{
- uint32_t *dst_ptr = (uint32_t *)(void *)dst_ptr_;
- dst_span >>= 2;
-
- height -= 1;
- while (height > 0)
- {
- height -= width<<16;
- height += 1<<16;
- while (height < 0)
- {
- /* Do 2 column pairs */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y1 = uv + READY(y_ptr[y_span]);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y1);
- FIXUP(y0);
- STORE(y1, dst_ptr[dst_span]);
- STORE(y0, *dst_ptr++);
- y1 = uv + READY(y_ptr[y_span]);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y1);
- FIXUP(y0);
- STORE(y1, dst_ptr[dst_span]);
- STORE(y0, *dst_ptr++);
- height += (2<<16);
- }
- if ((height>>16) == 0)
- {
- /* Trailing column pair */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr,*v_ptr);
- y1 = uv + READY(y_ptr[y_span]);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y1);
- FIXUP(y0);
- STORE(y0, dst_ptr[dst_span]);
- STORE(y1, *dst_ptr++);
- }
- dst_ptr += dst_span*2-width;
- y_ptr += y_span*2-width;
- u_ptr += uv_span-(width>>1);
- v_ptr += uv_span-(width>>1);
- height = (height<<16)>>16;
- height -= 2;
- }
- if (height == 0)
- {
- /* Trail row */
- height -= width<<16;
- height += 1<<16;
- while (height < 0)
- {
- /* Do a row pair */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y1 = uv + READY(*y_ptr++);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y1);
- FIXUP(y0);
- STORE(y1, *dst_ptr++);
- STORE(y0, *dst_ptr++);
- height += (2<<16);
- }
- if ((height>>16) == 0)
- {
- /* Trailing pix */
- uint32_t uv, y0;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, *dst_ptr++);
- }
- }
-}
-
-
-
-#undef FLAGS
-#undef READUV
-#undef READY
-#undef FIXUP
-#undef STORE
-
-#define FLAGS 0x40080100
-#define READUV(U,V) (tables[256 + (U)] + tables[512 + (V)])
-#define READY(Y) tables[Y]
-#define FIXUP(Y) \
-do { \
- int tmp = (Y) & FLAGS; \
- if (tmp != 0) \
- { \
- tmp -= tmp>>8; \
- (Y) |= tmp; \
- tmp = FLAGS & ~(Y>>1); \
- (Y) += tmp>>8; \
- } \
-} while (0 == 1)
-
-#define STORE(Y,DSTPTR) \
-do { \
- *(DSTPTR)++ = (Y); \
- *(DSTPTR)++ = (Y)>>22; \
- *(DSTPTR)++ = (Y)>>11; \
- *(DSTPTR)++ = 255; \
-} while (0 == 1)
-
-static void yuv444_2_rgb8888(uint8_t *dst_ptr,
- const uint8_t *y_ptr,
- const uint8_t *u_ptr,
- const uint8_t *v_ptr,
- int32_t width,
- int32_t height,
- int32_t y_span,
- int32_t uv_span,
- int32_t dst_span,
- int32_t dither)
-{
- height -= 1;
- while (height > 0)
- {
- height -= width<<16;
- height += 1<<16;
- while (height < 0)
- {
- /* Do top row pair */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, dst_ptr);
- uv = READUV(*u_ptr++,*v_ptr++);
- y1 = uv + READY(*y_ptr++);
- FIXUP(y1);
- STORE(y1, dst_ptr);
- height += (2<<16);
- }
- if ((height>>16) == 0)
- {
- /* Trailing top row pix */
- uint32_t uv, y0;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, dst_ptr);
- }
- dst_ptr += dst_span-width*4;
- y_ptr += y_span-width;
- u_ptr += uv_span-width;
- v_ptr += uv_span-width;
- height = (height<<16)>>16;
- height -= 1;
- if (height == 0)
- break;
- height -= width<<16;
- height += 1<<16;
- while (height < 0)
- {
- /* Do second row pair */
- uint32_t uv, y0, y1;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, dst_ptr);
- uv = READUV(*u_ptr++,*v_ptr++);
- y1 = uv + READY(*y_ptr++);
- FIXUP(y1);
- STORE(y1, dst_ptr);
- height += (2<<16);
- }
- if ((height>>16) == 0)
- {
- /* Trailing bottom row pix */
- uint32_t uv, y0;
-
- uv = READUV(*u_ptr++,*v_ptr++);
- y0 = uv + READY(*y_ptr++);
- FIXUP(y0);
- STORE(y0, dst_ptr);
- }
- dst_ptr += dst_span-width*4;
- y_ptr += y_span-width;
- u_ptr += uv_span-width;
- v_ptr += uv_span-width;
- height = (height<<16)>>16;
- height -= 1;
- }
-}
-#endif // YUV2RGB_H
diff --git a/modules/visual_script/visual_script.cpp b/modules/visual_script/visual_script.cpp
index 53521c55a7..aec60391d3 100644
--- a/modules/visual_script/visual_script.cpp
+++ b/modules/visual_script/visual_script.cpp
@@ -1073,6 +1073,18 @@ void VisualScript::get_script_property_list(List<PropertyInfo> *p_list) const {
}
}
+int VisualScript::get_member_line(const StringName &p_member) const {
+#ifdef TOOLS_ENABLED
+ if (has_function(p_member)) {
+ for (Map<int, Function::NodeData>::Element *E = functions[p_member].nodes.front(); E; E = E->next()) {
+ if (E->get().node->cast_to<VisualScriptFunction>())
+ return E->key();
+ }
+ }
+#endif
+ return -1;
+}
+
#ifdef TOOLS_ENABLED
bool VisualScript::are_subnodes_edited() const {
diff --git a/modules/visual_script/visual_script.h b/modules/visual_script/visual_script.h
index ee8ed2c965..273a819611 100644
--- a/modules/visual_script/visual_script.h
+++ b/modules/visual_script/visual_script.h
@@ -356,6 +356,8 @@ public:
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
+ virtual int get_member_line(const StringName &p_member) const;
+
#ifdef TOOLS_ENABLED
virtual bool are_subnodes_edited() const;
#endif
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index ee5bd66aa2..d515f301ce 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -490,7 +490,7 @@ void VisualScriptEditor::_update_graph(int p_only_id) {
}
if (EditorSettings::get_singleton()->has("editors/visual_script/color_" + node->get_category())) {
- gnode->set_modulate(EditorSettings::get_singleton()->get("editors/visual_script/color_" + node->get_category()));
+ gnode->set_self_modulate(EditorSettings::get_singleton()->get("editors/visual_script/color_" + node->get_category()));
}
gnode->set_meta("__vnode", node);
@@ -1017,7 +1017,7 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt
}
Rect2 pos = members->get_item_rect(ti);
- new_function_menu->set_pos(members->get_global_pos() + pos.pos + Vector2(0, pos.size.y));
+ new_function_menu->set_position(members->get_global_position() + pos.pos + Vector2(0, pos.size.y));
new_function_menu->popup();
return;
} else if (p_button == 0) {
@@ -2153,7 +2153,7 @@ void VisualScriptEditor::goto_line(int p_line, bool p_with_error) {
_update_graph();
_update_members();
- call_deferred("_center_on_node", p_line); //editor might be just created and size might not exist yet
+ call_deferred("call_deferred", "_center_on_node", p_line); //editor might be just created and size might not exist yet
return;
}
@@ -2163,6 +2163,12 @@ void VisualScriptEditor::goto_line(int p_line, bool p_with_error) {
void VisualScriptEditor::trim_trailing_whitespace() {
}
+void VisualScriptEditor::convert_indent_to_spaces() {
+}
+
+void VisualScriptEditor::convert_indent_to_tabs() {
+}
+
void VisualScriptEditor::ensure_focus() {
graph->grab_focus();
@@ -2192,18 +2198,6 @@ void VisualScriptEditor::get_breakpoints(List<int> *p_breakpoints) {
}
}
-bool VisualScriptEditor::goto_method(const String &p_method) {
-
- if (!script->has_function(p_method))
- return false;
-
- edited_func = p_method;
- selected = edited_func;
- _update_members();
- _update_graph();
- return true;
-}
-
void VisualScriptEditor::add_callback(const String &p_function, PoolStringArray p_args) {
if (script->has_function(p_function)) {
@@ -2517,7 +2511,7 @@ void VisualScriptEditor::_graph_connect_to_empty(const String &p_from, int p_fro
port_action_pos = p_release_pos;
port_action_popup->set_size(Size2(1, 1));
- port_action_popup->set_pos(graph->get_global_pos() + p_release_pos);
+ port_action_popup->set_position(graph->get_global_position() + p_release_pos);
port_action_popup->popup();
}
@@ -2806,7 +2800,7 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i
existing = Variant::construct(pinfo.type, &existingp, 1, ce, false);
}
- default_value_edit->set_pos(p_button->cast_to<Control>()->get_global_pos() + Vector2(0, p_button->cast_to<Control>()->get_size().y));
+ default_value_edit->set_position(p_button->cast_to<Control>()->get_global_position() + Vector2(0, p_button->cast_to<Control>()->get_size().y));
default_value_edit->set_size(Size2(1, 1));
if (default_value_edit->edit(NULL, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) {
if (pinfo.hint == PROPERTY_HINT_MULTILINE_TEXT)
@@ -2839,7 +2833,7 @@ void VisualScriptEditor::_node_filter_changed(const String &p_text) {
void VisualScriptEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_READY) {
- node_filter_icon->set_texture(Control::get_icon("Zoom", "EditorIcons"));
+ node_filter_icon->set_texture(Control::get_icon("Search", "EditorIcons"));
}
}
diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h
index 7322da5cfb..1fd97cc1bc 100644
--- a/modules/visual_script/visual_script_editor.h
+++ b/modules/visual_script/visual_script_editor.h
@@ -240,11 +240,12 @@ public:
virtual void set_edit_state(const Variant &p_state);
virtual void goto_line(int p_line, bool p_with_error = false);
virtual void trim_trailing_whitespace();
+ virtual void convert_indent_to_spaces();
+ virtual void convert_indent_to_tabs();
virtual void ensure_focus();
virtual void tag_saved_version();
virtual void reload(bool p_soft);
virtual void get_breakpoints(List<int> *p_breakpoints);
- virtual bool goto_method(const String &p_method);
virtual void add_callback(const String &p_function, PoolStringArray p_args);
virtual void update_settings();
virtual void set_debugger_active(bool p_active);
diff --git a/modules/webm/video_stream_webm.cpp b/modules/webm/video_stream_webm.cpp
index 9d8062d283..eaf4215302 100644
--- a/modules/webm/video_stream_webm.cpp
+++ b/modules/webm/video_stream_webm.cpp
@@ -32,12 +32,13 @@
#include "OpusVorbisDecoder.hpp"
#include "VPXDecoder.hpp"
-#include "../theora/yuv2rgb.h"
#include "mkvparser/mkvparser.h"
#include "global_config.h"
#include "os/file_access.h"
+#include "thirdparty/misc/yuv2rgb.h"
+
#include <string.h>
class MkvReader : public mkvparser::IMkvReader {
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 39c8f812ac..889eac71a7 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -87,9 +87,11 @@ static Image _webp_lossy_unpack(const PoolVector<uint8_t> &p_buffer) {
ERR_FAIL_V(Image());
}
- //print_line("width: "+itos(features.width));
- //print_line("height: "+itos(features.height));
- //print_line("alpha: "+itos(features.has_alpha));
+ /*
+ print_line("width: "+itos(features.width));
+ print_line("height: "+itos(features.height));
+ print_line("alpha: "+itos(features.has_alpha));
+ */
PoolVector<uint8_t> dst_image;
int datasize = features.width * features.height * (features.has_alpha ? 4 : 3);
@@ -130,9 +132,11 @@ Error ImageLoaderWEBP::load_image(Image *p_image, FileAccess *f) {
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
+ /*
print_line("width: " + itos(features.width));
print_line("height: " + itos(features.height));
print_line("alpha: " + itos(features.has_alpha));
+ */
src_w = PoolVector<uint8_t>::Write();