Parcourir la source

Further changes to GDNative API

- Moved Variant struct definition to its own file so it can be used
  without include cycles (like on Dictionary).
- Add `index` operator function so bindings like C++ can implement the
  operator[] overload (which needs a reference to the actual value).
- Added missing new/destroy functions to Vector3i array.
- Added print error/warning functions as helpers so bindings can print
  messages in the same manner as Godot itself does.
George Marques il y a 4 ans
Parent
commit
66ed69edb3

+ 10 - 0
modules/gdnative/gdnative/array.cpp

@@ -47,6 +47,16 @@ void GDAPI godot_array_destroy(godot_array *p_self) {
 	((Array *)p_self)->~Array();
 }
 
+godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, godot_int p_index) {
+	Array *self = (Array *)p_self;
+	return (godot_variant *)&self->operator[](p_index);
+}
+
+const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, godot_int p_index) {
+	const Array *self = (const Array *)p_self;
+	return (const godot_variant *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 10 - 0
modules/gdnative/gdnative/basis.cpp

@@ -42,6 +42,16 @@ void GDAPI godot_basis_new(godot_basis *p_self) {
 	memnew_placement(p_self, Basis);
 }
 
+godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index) {
+	Basis *self = (Basis *)p_self;
+	return (godot_vector3 *)&self->operator[](p_index);
+}
+
+const godot_vector3 GDAPI *godot_basis_operator_index_const(const godot_basis *p_self, godot_int p_index) {
+	const Basis *self = (const Basis *)p_self;
+	return (const godot_vector3 *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 10 - 0
modules/gdnative/gdnative/color.cpp

@@ -42,6 +42,16 @@ void GDAPI godot_color_new(godot_color *p_self) {
 	memnew_placement(p_self, Color);
 }
 
+float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index) {
+	Color *self = (Color *)p_self;
+	return (float *)&self->operator[](p_index);
+}
+
+const float GDAPI *godot_color_operator_index_const(const godot_color *p_self, godot_int p_index) {
+	const Color *self = (const Color *)p_self;
+	return (const float *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 11 - 0
modules/gdnative/gdnative/dictionary.cpp

@@ -31,6 +31,7 @@
 #include "gdnative/dictionary.h"
 
 #include "core/variant/dictionary.h"
+#include "core/variant/variant.h"
 
 static_assert(sizeof(godot_dictionary) == sizeof(Dictionary), "Dictionary size mismatch");
 
@@ -47,6 +48,16 @@ void GDAPI godot_dictionary_destroy(godot_dictionary *p_self) {
 	self->~Dictionary();
 }
 
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) {
+	Dictionary *self = (Dictionary *)p_self;
+	return (godot_variant *)&self->operator[](*((const Variant *)p_key));
+}
+
+const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key) {
+	const Dictionary *self = (const Dictionary *)p_self;
+	return (const godot_variant *)&self->operator[](*((const Variant *)p_key));
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 11 - 0
modules/gdnative/gdnative/gdnative.cpp

@@ -127,6 +127,17 @@ void GDAPI godot_free(void *p_ptr) {
 	memfree(p_ptr);
 }
 
+// Helper print functions.
+void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line) {
+	_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_ERROR);
+}
+void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line) {
+	_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_WARNING);
+}
+void GDAPI godot_print_script_error(const char *p_description, const char *p_function, const char *p_file, int p_line) {
+	_err_print_error(p_function, p_file, p_line, p_description, ERR_HANDLER_SCRIPT);
+}
+
 void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have) {
 	String message = "Error loading GDNative file ";
 	GDNativeLibrary *library = (GDNativeLibrary *)p_library;

+ 110 - 0
modules/gdnative/gdnative/packed_arrays.cpp

@@ -63,6 +63,16 @@ void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self) {
 	((PackedByteArray *)p_self)->~PackedByteArray();
 }
 
+uint8_t GDAPI *godot_packed_byte_array_operator_index(godot_packed_byte_array *p_self, godot_int p_index) {
+	PackedByteArray *self = (PackedByteArray *)p_self;
+	return (uint8_t *)&self->operator[](p_index);
+}
+
+const uint8_t GDAPI *godot_packed_byte_array_operator_index_const(const godot_packed_byte_array *p_self, godot_int p_index) {
+	const PackedByteArray *self = (const PackedByteArray *)p_self;
+	return (const uint8_t *)&self->operator[](p_index);
+}
+
 // int32
 
 void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *p_self) {
@@ -73,6 +83,16 @@ void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self) {
 	((PackedInt32Array *)p_self)->~PackedInt32Array();
 }
 
+int32_t GDAPI *godot_packed_int32_array_operator_index(godot_packed_int32_array *p_self, godot_int p_index) {
+	PackedInt32Array *self = (PackedInt32Array *)p_self;
+	return (int32_t *)&self->operator[](p_index);
+}
+
+const int32_t GDAPI *godot_packed_int32_array_operator_index_const(const godot_packed_int32_array *p_self, godot_int p_index) {
+	const PackedInt32Array *self = (const PackedInt32Array *)p_self;
+	return (const int32_t *)&self->operator[](p_index);
+}
+
 // int64
 
 void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *p_self) {
@@ -83,6 +103,16 @@ void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self) {
 	((PackedInt64Array *)p_self)->~PackedInt64Array();
 }
 
+int64_t GDAPI *godot_packed_int64_array_operator_index(godot_packed_int64_array *p_self, godot_int p_index) {
+	PackedInt64Array *self = (PackedInt64Array *)p_self;
+	return (int64_t *)&self->operator[](p_index);
+}
+
+const int64_t GDAPI *godot_packed_int64_array_operator_index_const(const godot_packed_int64_array *p_self, godot_int p_index) {
+	const PackedInt64Array *self = (const PackedInt64Array *)p_self;
+	return (const int64_t *)&self->operator[](p_index);
+}
+
 // float32
 
 void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *p_self) {
@@ -93,6 +123,16 @@ void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self
 	((PackedFloat32Array *)p_self)->~PackedFloat32Array();
 }
 
+float GDAPI *godot_packed_float32_array_operator_index(godot_packed_float32_array *p_self, godot_int p_index) {
+	PackedFloat32Array *self = (PackedFloat32Array *)p_self;
+	return (float *)&self->operator[](p_index);
+}
+
+const float GDAPI *godot_packed_float32_array_operator_index_const(const godot_packed_float32_array *p_self, godot_int p_index) {
+	const PackedFloat32Array *self = (const PackedFloat32Array *)p_self;
+	return (const float *)&self->operator[](p_index);
+}
+
 // float64
 
 void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *p_self) {
@@ -103,6 +143,16 @@ void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self
 	((PackedFloat64Array *)p_self)->~PackedFloat64Array();
 }
 
+double GDAPI *godot_packed_float64_array_operator_index(godot_packed_float64_array *p_self, godot_int p_index) {
+	PackedFloat64Array *self = (PackedFloat64Array *)p_self;
+	return (double *)&self->operator[](p_index);
+}
+
+const double GDAPI *godot_packed_float64_array_operator_index_const(const godot_packed_float64_array *p_self, godot_int p_index) {
+	const PackedFloat64Array *self = (const PackedFloat64Array *)p_self;
+	return (const double *)&self->operator[](p_index);
+}
+
 // string
 
 void GDAPI godot_packed_string_array_new(godot_packed_string_array *p_self) {
@@ -113,6 +163,16 @@ void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self)
 	((PackedStringArray *)p_self)->~PackedStringArray();
 }
 
+godot_string GDAPI *godot_packed_string_array_operator_index(godot_packed_string_array *p_self, godot_int p_index) {
+	PackedStringArray *self = (PackedStringArray *)p_self;
+	return (godot_string *)&self->operator[](p_index);
+}
+
+const godot_string GDAPI *godot_packed_string_array_operator_index_const(const godot_packed_string_array *p_self, godot_int p_index) {
+	const PackedStringArray *self = (const PackedStringArray *)p_self;
+	return (const godot_string *)&self->operator[](p_index);
+}
+
 // vector2
 
 void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *p_self) {
@@ -123,6 +183,16 @@ void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self
 	((PackedVector2Array *)p_self)->~PackedVector2Array();
 }
 
+godot_vector2 GDAPI *godot_packed_vector2_array_operator_index(godot_packed_vector2_array *p_self, godot_int p_index) {
+	PackedVector2Array *self = (PackedVector2Array *)p_self;
+	return (godot_vector2 *)&self->operator[](p_index);
+}
+
+const godot_vector2 GDAPI *godot_packed_vector2_array_operator_index_const(const godot_packed_vector2_array *p_self, godot_int p_index) {
+	const PackedVector2Array *self = (const PackedVector2Array *)p_self;
+	return (const godot_vector2 *)&self->operator[](p_index);
+}
+
 // vector2i
 
 void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self) {
@@ -133,6 +203,16 @@ void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_se
 	((Vector<Vector2i> *)p_self)->~Vector();
 }
 
+godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index(godot_packed_vector2i_array *p_self, godot_int p_index) {
+	Vector<Vector2i> *self = (Vector<Vector2i> *)p_self;
+	return (godot_vector2i *)&self->operator[](p_index);
+}
+
+const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(const godot_packed_vector2i_array *p_self, godot_int p_index) {
+	const Vector<Vector2i> *self = (const Vector<Vector2i> *)p_self;
+	return (const godot_vector2i *)&self->operator[](p_index);
+}
+
 // vector3
 
 void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *p_self) {
@@ -143,6 +223,16 @@ void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self
 	((PackedVector3Array *)p_self)->~PackedVector3Array();
 }
 
+godot_vector3 GDAPI *godot_packed_vector3_array_operator_index(godot_packed_vector3_array *p_self, godot_int p_index) {
+	PackedVector3Array *self = (PackedVector3Array *)p_self;
+	return (godot_vector3 *)&self->operator[](p_index);
+}
+
+const godot_vector3 GDAPI *godot_packed_vector3_array_operator_index_const(const godot_packed_vector3_array *p_self, godot_int p_index) {
+	const PackedVector3Array *self = (const PackedVector3Array *)p_self;
+	return (const godot_vector3 *)&self->operator[](p_index);
+}
+
 // vector3i
 
 void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self) {
@@ -153,6 +243,16 @@ void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_se
 	((Vector<Vector3i> *)p_self)->~Vector();
 }
 
+godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index(godot_packed_vector3i_array *p_self, godot_int p_index) {
+	Vector<Vector3i> *self = (Vector<Vector3i> *)p_self;
+	return (godot_vector3i *)&self->operator[](p_index);
+}
+
+const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(const godot_packed_vector3i_array *p_self, godot_int p_index) {
+	const Vector<Vector3i> *self = (const Vector<Vector3i> *)p_self;
+	return (const godot_vector3i *)&self->operator[](p_index);
+}
+
 // color
 
 void GDAPI godot_packed_color_array_new(godot_packed_color_array *p_self) {
@@ -163,6 +263,16 @@ void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self) {
 	((PackedColorArray *)p_self)->~PackedColorArray();
 }
 
+godot_color GDAPI *godot_packed_color_array_operator_index(godot_packed_color_array *p_self, godot_int p_index) {
+	PackedColorArray *self = (PackedColorArray *)p_self;
+	return (godot_color *)&self->operator[](p_index);
+}
+
+const godot_color GDAPI *godot_packed_color_array_operator_index_const(const godot_packed_color_array *p_self, godot_int p_index) {
+	const PackedColorArray *self = (const PackedColorArray *)p_self;
+	return (const godot_color *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 10 - 0
modules/gdnative/gdnative/quat.cpp

@@ -42,6 +42,16 @@ void GDAPI godot_quat_new(godot_quat *p_self) {
 	memnew_placement(p_self, Quat);
 }
 
+godot_real_t GDAPI *godot_quat_operator_index(godot_quat *p_self, godot_int p_index) {
+	Quat *self = (Quat *)p_self;
+	return (godot_real_t *)&self->operator[](p_index);
+}
+
+const godot_real_t GDAPI *godot_quat_operator_index_const(const godot_quat *p_self, godot_int p_index) {
+	const Quat *self = (const Quat *)p_self;
+	return (const godot_real_t *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 10 - 0
modules/gdnative/gdnative/transform2d.cpp

@@ -42,6 +42,16 @@ void GDAPI godot_transform2d_new(godot_transform2d *p_self) {
 	memnew_placement(p_self, Transform2D);
 }
 
+godot_vector2 GDAPI *godot_transform2d_operator_index(godot_transform2d *p_self, godot_int p_index) {
+	Transform2D *self = (Transform2D *)p_self;
+	return (godot_vector2 *)&self->operator[](p_index);
+}
+
+const godot_vector2 GDAPI *godot_transform2d_operator_index_const(const godot_transform2d *p_self, godot_int p_index) {
+	const Transform2D *self = (const Transform2D *)p_self;
+	return (const godot_vector2 *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 16 - 0
modules/gdnative/gdnative/variant.cpp

@@ -1065,6 +1065,22 @@ void GDAPI godot_variant_call_utility_function_with_cstring(const char *p_functi
 	}
 }
 
+godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function(const godot_string_name *p_function) {
+	return (godot_ptr_utility_function)Variant::get_ptr_utility_function(*((const StringName *)p_function));
+}
+
+godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function_with_cstring(const char *p_function) {
+	return (godot_ptr_utility_function)Variant::get_ptr_utility_function(StringName(p_function));
+}
+
+godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function(const godot_string_name *p_function) {
+	return (godot_validated_utility_function)Variant::get_validated_utility_function(*((const StringName *)p_function));
+}
+
+godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function_with_cstring(const char *p_function) {
+	return (godot_validated_utility_function)Variant::get_validated_utility_function(StringName(p_function));
+}
+
 godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type(const godot_string_name *p_function) {
 	return (godot_variant_utility_function_type)Variant::get_utility_function_type(*((const StringName *)p_function));
 }

+ 20 - 0
modules/gdnative/gdnative/vector2.cpp

@@ -47,6 +47,26 @@ void GDAPI godot_vector2i_new(godot_vector2i *p_self) {
 	memnew_placement(p_self, Vector2i);
 }
 
+godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index) {
+	Vector2 *self = (Vector2 *)p_self;
+	return (godot_real_t *)&self->operator[](p_index);
+}
+
+const godot_real_t GDAPI *godot_vector2_operator_index_const(const godot_vector2 *p_self, godot_int p_index) {
+	const Vector2 *self = (const Vector2 *)p_self;
+	return (const godot_real_t *)&self->operator[](p_index);
+}
+
+int32_t GDAPI *godot_vector2i_operator_index(godot_vector2i *p_self, godot_int p_index) {
+	Vector2i *self = (Vector2i *)p_self;
+	return (int32_t *)&self->operator[](p_index);
+}
+
+const int32_t GDAPI *godot_vector2i_operator_index_const(const godot_vector2i *p_self, godot_int p_index) {
+	const Vector2i *self = (const Vector2i *)p_self;
+	return (const int32_t *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

+ 20 - 0
modules/gdnative/gdnative/vector3.cpp

@@ -47,6 +47,26 @@ void GDAPI godot_vector3i_new(godot_vector3i *p_self) {
 	memnew_placement(p_self, Vector3i);
 }
 
+godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index) {
+	Vector3 *self = (Vector3 *)p_self;
+	return (godot_real_t *)&self->operator[](p_index);
+}
+
+const godot_real_t GDAPI *godot_vector3_operator_index_const(const godot_vector3 *p_self, godot_int p_index) {
+	const Vector3 *self = (const Vector3 *)p_self;
+	return (const godot_real_t *)&self->operator[](p_index);
+}
+
+int32_t GDAPI *godot_vector3i_operator_index(godot_vector3i *p_self, godot_int p_index) {
+	Vector3i *self = (Vector3i *)p_self;
+	return (int32_t *)&self->operator[](p_index);
+}
+
+const int32_t GDAPI *godot_vector3i_operator_index_const(const godot_vector3i *p_self, godot_int p_index) {
+	const Vector3i *self = (const Vector3i *)p_self;
+	return (const int32_t *)&self->operator[](p_index);
+}
+
 #ifdef __cplusplus
 }
 #endif

Fichier diff supprimé car celui-ci est trop grand
+ 701 - 71
modules/gdnative/gdnative_api.json


+ 3 - 0
modules/gdnative/include/gdnative/array.h

@@ -47,9 +47,12 @@ typedef struct {
 #endif
 
 #include <gdnative/gdnative.h>
+#include <gdnative/variant_struct.h>
 
 void GDAPI godot_array_new(godot_array *p_self);
 void GDAPI godot_array_destroy(godot_array *p_self);
+godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, godot_int p_index);
+const godot_variant GDAPI *godot_array_operator_index_const(const godot_array *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

+ 2 - 0
modules/gdnative/include/gdnative/basis.h

@@ -49,6 +49,8 @@ typedef struct {
 #include <gdnative/gdnative.h>
 
 void GDAPI godot_basis_new(godot_basis *p_self);
+godot_vector3 GDAPI *godot_basis_operator_index(godot_basis *p_self, godot_int p_index);
+const godot_vector3 GDAPI *godot_basis_operator_index_const(const godot_basis *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

+ 2 - 0
modules/gdnative/include/gdnative/color.h

@@ -50,6 +50,8 @@ typedef struct {
 #include <gdnative/gdnative.h>
 
 void GDAPI godot_color_new(godot_color *p_self);
+float GDAPI *godot_color_operator_index(godot_color *p_self, godot_int p_index);
+const float GDAPI *godot_color_operator_index_const(const godot_color *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

+ 3 - 0
modules/gdnative/include/gdnative/dictionary.h

@@ -47,9 +47,12 @@ typedef struct {
 #endif
 
 #include <gdnative/gdnative.h>
+#include <gdnative/variant_struct.h>
 
 void GDAPI godot_dictionary_new(godot_dictionary *p_self);
 void GDAPI godot_dictionary_destroy(godot_dictionary *p_self);
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key);
+const godot_variant GDAPI *godot_dictionary_operator_index_const(const godot_dictionary *p_self, const godot_variant *p_key);
 
 #ifdef __cplusplus
 }

+ 5 - 2
modules/gdnative/include/gdnative/gdnative.h

@@ -62,8 +62,6 @@ extern "C" {
 #include <stdbool.h>
 #include <stdint.h>
 
-#define GODOT_API_VERSION 1
-
 ////// Error
 
 typedef enum {
@@ -266,6 +264,11 @@ void GDAPI *godot_alloc(int p_bytes);
 void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
 void GDAPI godot_free(void *p_ptr);
 
+// Helper print functions.
+void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line);
+void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line);
+void GDAPI godot_print_script_error(const char *p_description, const char *p_function, const char *p_file, int p_line);
+
 //tags used for safe dynamic casting
 void GDAPI *godot_get_class_tag(const godot_string_name *p_class);
 godot_object GDAPI *godot_object_cast_to(const godot_object *p_object, void *p_class_tag);

+ 28 - 1
modules/gdnative/include/gdnative/packed_arrays.h

@@ -164,54 +164,81 @@ typedef struct {
 
 void GDAPI godot_packed_byte_array_new(godot_packed_byte_array *p_self);
 void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self);
+uint8_t GDAPI *godot_packed_byte_array_operator_index(godot_packed_byte_array *p_self, godot_int p_index);
+const uint8_t GDAPI *godot_packed_byte_array_operator_index_const(const godot_packed_byte_array *p_self, godot_int p_index);
 
 // Int32.
 
 void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *p_self);
 void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self);
+int32_t GDAPI *godot_packed_int32_array_operator_index(godot_packed_int32_array *p_self, godot_int p_index);
+const int32_t GDAPI *godot_packed_int32_array_operator_index_const(const godot_packed_int32_array *p_self, godot_int p_index);
 
 // Int64.
 
 void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *p_self);
 void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self);
+int64_t GDAPI *godot_packed_int64_array_operator_index(godot_packed_int64_array *p_self, godot_int p_index);
+const int64_t GDAPI *godot_packed_int64_array_operator_index_const(const godot_packed_int64_array *p_self, godot_int p_index);
 
 // Float32.
 
 void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *p_self);
 void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self);
+float GDAPI *godot_packed_float32_array_operator_index(godot_packed_float32_array *p_self, godot_int p_index);
+const float GDAPI *godot_packed_float32_array_operator_index_const(const godot_packed_float32_array *p_self, godot_int p_index);
 
 // Float64.
 
 void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *p_self);
 void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self);
+double GDAPI *godot_packed_float64_array_operator_index(godot_packed_float64_array *p_self, godot_int p_index);
+const double GDAPI *godot_packed_float64_array_operator_index_const(const godot_packed_float64_array *p_self, godot_int p_index);
 
 // String.
 
 void GDAPI godot_packed_string_array_new(godot_packed_string_array *p_self);
 void GDAPI godot_packed_string_array_destroy(godot_packed_string_array *p_self);
+godot_string GDAPI *godot_packed_string_array_operator_index(godot_packed_string_array *p_self, godot_int p_index);
+const godot_string GDAPI *godot_packed_string_array_operator_index_const(const godot_packed_string_array *p_self, godot_int p_index);
 
 // Vector2.
 
 void GDAPI godot_packed_vector2_array_new(godot_packed_vector2_array *p_self);
 void GDAPI godot_packed_vector2_array_destroy(godot_packed_vector2_array *p_self);
+godot_vector2 GDAPI *godot_packed_vector2_array_operator_index(godot_packed_vector2_array *p_self, godot_int p_index);
+const godot_vector2 GDAPI *godot_packed_vector2_array_operator_index_const(const godot_packed_vector2_array *p_self, godot_int p_index);
 
 // Vector2i.
 
 void GDAPI godot_packed_vector2i_array_new(godot_packed_vector2i_array *p_self);
 void GDAPI godot_packed_vector2i_array_destroy(godot_packed_vector2i_array *p_self);
+godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index(godot_packed_vector2i_array *p_self, godot_int p_index);
+const godot_vector2i GDAPI *godot_packed_vector2i_array_operator_index_const(const godot_packed_vector2i_array *p_self, godot_int p_index);
 
 // Vector3.
 
 void GDAPI godot_packed_vector3_array_new(godot_packed_vector3_array *p_self);
 void GDAPI godot_packed_vector3_array_destroy(godot_packed_vector3_array *p_self);
+godot_vector3 GDAPI *godot_packed_vector3_array_operator_index(godot_packed_vector3_array *p_self, godot_int p_index);
+const godot_vector3 GDAPI *godot_packed_vector3_array_operator_index_const(const godot_packed_vector3_array *p_self, godot_int p_index);
+
+// Vector3i.
+
+void GDAPI godot_packed_vector3i_array_new(godot_packed_vector3i_array *p_self);
+void GDAPI godot_packed_vector3i_array_destroy(godot_packed_vector3i_array *p_self);
+godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index(godot_packed_vector3i_array *p_self, godot_int p_index);
+const godot_vector3i GDAPI *godot_packed_vector3i_array_operator_index_const(const godot_packed_vector3i_array *p_self, godot_int p_index);
 
 // Color.
 
 void GDAPI godot_packed_color_array_new(godot_packed_color_array *p_self);
 void GDAPI godot_packed_color_array_destroy(godot_packed_color_array *p_self);
+godot_color GDAPI *godot_packed_color_array_operator_index(godot_packed_color_array *p_self, godot_int p_index);
+const godot_color GDAPI *godot_packed_color_array_operator_index_const(const godot_packed_color_array *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif // GODOT_POOL_ARRAYS_H
+#endif // GODOT_PACKED_ARRAYS_H

+ 2 - 0
modules/gdnative/include/gdnative/quat.h

@@ -49,6 +49,8 @@ typedef struct {
 #include <gdnative/gdnative.h>
 
 void GDAPI godot_quat_new(godot_quat *p_self);
+godot_real_t GDAPI *godot_quat_operator_index(godot_quat *p_self, godot_int p_index);
+const godot_real_t GDAPI *godot_quat_operator_index_const(const godot_quat *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

+ 2 - 0
modules/gdnative/include/gdnative/transform2d.h

@@ -49,6 +49,8 @@ typedef struct {
 #include <gdnative/gdnative.h>
 
 void GDAPI godot_transform2d_new(godot_transform2d *p_self);
+godot_vector2 GDAPI *godot_transform2d_operator_index(godot_transform2d *p_self, godot_int p_index);
+const godot_vector2 GDAPI *godot_transform2d_operator_index_const(const godot_transform2d *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

+ 5 - 9
modules/gdnative/include/gdnative/variant.h

@@ -36,15 +36,7 @@ extern "C" {
 #endif
 
 #include <gdnative/math_defs.h>
-
-#define GODOT_VARIANT_SIZE (sizeof(godot_real_t) * 4 + sizeof(int64_t))
-
-#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
-typedef struct {
-	uint8_t _dont_touch_that[GODOT_VARIANT_SIZE];
-} godot_variant;
-#endif
+#include <gdnative/variant_struct.h>
 
 typedef enum godot_variant_type {
 	GODOT_VARIANT_TYPE_NIL,
@@ -390,6 +382,10 @@ bool GDAPI godot_variant_has_utility_function(const godot_string_name *p_functio
 bool GDAPI godot_variant_has_utility_function_with_cstring(const char *p_function);
 void GDAPI godot_variant_call_utility_function(const godot_string_name *p_function, godot_variant *r_ret, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error);
 void GDAPI godot_variant_call_utility_function_with_cstring(const char *p_function, godot_variant *r_ret, const godot_variant **p_args, int p_argument_count, godot_variant_call_error *r_error);
+godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function(const godot_string_name *p_function);
+godot_ptr_utility_function GDAPI godot_variant_get_ptr_utility_function_with_cstring(const char *p_function);
+godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function(const godot_string_name *p_function);
+godot_validated_utility_function GDAPI godot_variant_get_validated_utility_function_with_cstring(const char *p_function);
 godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type(const godot_string_name *p_function);
 godot_variant_utility_function_type GDAPI godot_variant_get_utility_function_type_with_cstring(const char *p_function);
 int GDAPI godot_variant_get_utility_function_argument_count(const godot_string_name *p_function);

+ 53 - 0
modules/gdnative/include/gdnative/variant_struct.h

@@ -0,0 +1,53 @@
+/*************************************************************************/
+/*  variant_struct.h                                                     */
+/*************************************************************************/
+/*                       This file is part of:                           */
+/*                           GODOT ENGINE                                */
+/*                      https://godotengine.org                          */
+/*************************************************************************/
+/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/*                                                                       */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the       */
+/* "Software"), to deal in the Software without restriction, including   */
+/* without limitation the rights to use, copy, modify, merge, publish,   */
+/* distribute, sublicense, and/or sell copies of the Software, and to    */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions:                                             */
+/*                                                                       */
+/* The above copyright notice and this permission notice shall be        */
+/* included in all copies or substantial portions of the Software.       */
+/*                                                                       */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
+/*************************************************************************/
+
+#ifndef GODOT_VARIANT_STRUCT_H
+#define GODOT_VARIANT_STRUCT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <gdnative/math_defs.h>
+
+#define GODOT_VARIANT_SIZE (sizeof(godot_real_t) * 4 + sizeof(int64_t))
+
+#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
+typedef struct {
+	uint8_t _dont_touch_that[GODOT_VARIANT_SIZE];
+} godot_variant;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 4 - 0
modules/gdnative/include/gdnative/vector2.h

@@ -59,6 +59,10 @@ typedef struct {
 
 void GDAPI godot_vector2_new(godot_vector2 *p_self);
 void GDAPI godot_vector2i_new(godot_vector2i *p_self);
+godot_real_t GDAPI *godot_vector2_operator_index(godot_vector2 *p_self, godot_int p_index);
+const godot_real_t GDAPI *godot_vector2_operator_index_const(const godot_vector2 *p_self, godot_int p_index);
+int32_t GDAPI *godot_vector2i_operator_index(godot_vector2i *p_self, godot_int p_index);
+const int32_t GDAPI *godot_vector2i_operator_index_const(const godot_vector2i *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

+ 4 - 0
modules/gdnative/include/gdnative/vector3.h

@@ -59,6 +59,10 @@ typedef struct {
 
 void GDAPI godot_vector3_new(godot_vector3 *p_self);
 void GDAPI godot_vector3i_new(godot_vector3i *p_self);
+godot_real_t GDAPI *godot_vector3_operator_index(godot_vector3 *p_self, godot_int p_index);
+const godot_real_t GDAPI *godot_vector3_operator_index_const(const godot_vector3 *p_self, godot_int p_index);
+int32_t GDAPI *godot_vector3i_operator_index(godot_vector3i *p_self, godot_int p_index);
+const int32_t GDAPI *godot_vector3i_operator_index_const(const godot_vector3i *p_self, godot_int p_index);
 
 #ifdef __cplusplus
 }

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff