diff --git a/binding_generator.py b/binding_generator.py index 972cbf95b..b973d9f5e 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -545,6 +545,8 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl result.append("#include ") if class_name == "PackedVector3Array": result.append("#include ") + if class_name == "PackedVector4Array": + result.append("#include ") if is_packed_array(class_name): result.append("#include ") @@ -2445,6 +2447,7 @@ def is_packed_array(type_name): "PackedStringArray", "PackedVector2Array", "PackedVector3Array", + "PackedVector4Array", ] diff --git a/gdextension/extension_api.json b/gdextension/extension_api.json index cfd5ebefc..ca9d02be2 100644 --- a/gdextension/extension_api.json +++ b/gdextension/extension_api.json @@ -163,6 +163,10 @@ "name": "PackedColorArray", "size": 8 }, + { + "name": "PackedVector4Array", + "size": 8 + }, { "name": "Variant", "size": 24 @@ -324,6 +328,10 @@ "name": "PackedColorArray", "size": 16 }, + { + "name": "PackedVector4Array", + "size": 16 + }, { "name": "Variant", "size": 24 @@ -485,6 +493,10 @@ "name": "PackedColorArray", "size": 8 }, + { + "name": "PackedVector4Array", + "size": 8 + }, { "name": "Variant", "size": 40 @@ -646,6 +658,10 @@ "name": "PackedColorArray", "size": 16 }, + { + "name": "PackedVector4Array", + "size": 16 + }, { "name": "Variant", "size": 40 @@ -3932,8 +3948,12 @@ "value": 37 }, { - "name": "TYPE_MAX", + "name": "TYPE_PACKED_VECTOR4_ARRAY", "value": 38 + }, + { + "name": "TYPE_MAX", + "value": 39 } ] }, @@ -6292,6 +6312,16 @@ "name": "!=", "right_type": "PackedColorArray", "return_type": "bool" + }, + { + "name": "==", + "right_type": "PackedVector4Array", + "return_type": "bool" + }, + { + "name": "!=", + "right_type": "PackedVector4Array", + "return_type": "bool" } ], "constructors": [ @@ -7445,6 +7475,11 @@ "name": "%", "right_type": "PackedColorArray", "return_type": "String" + }, + { + "name": "%", + "right_type": "PackedVector4Array", + "return_type": "String" } ], "methods": [ @@ -12334,6 +12369,11 @@ "name": "in", "right_type": "Array", "return_type": "bool" + }, + { + "name": "in", + "right_type": "PackedVector4Array", + "return_type": "bool" } ], "methods": [ @@ -17144,6 +17184,11 @@ "name": "%", "right_type": "PackedColorArray", "return_type": "String" + }, + { + "name": "%", + "right_type": "PackedVector4Array", + "return_type": "String" } ], "methods": [ @@ -19972,6 +20017,15 @@ "type": "PackedColorArray" } ] + }, + { + "index": 12, + "arguments": [ + { + "name": "from", + "type": "PackedVector4Array" + } + ] } ], "has_destructor": true @@ -23636,6 +23690,351 @@ } ], "has_destructor": true + }, + { + "name": "PackedVector4Array", + "indexing_return_type": "Vector4", + "is_keyed": false, + "operators": [ + { + "name": "==", + "right_type": "Variant", + "return_type": "bool" + }, + { + "name": "!=", + "right_type": "Variant", + "return_type": "bool" + }, + { + "name": "not", + "return_type": "bool" + }, + { + "name": "in", + "right_type": "Dictionary", + "return_type": "bool" + }, + { + "name": "in", + "right_type": "Array", + "return_type": "bool" + }, + { + "name": "==", + "right_type": "PackedVector4Array", + "return_type": "bool" + }, + { + "name": "!=", + "right_type": "PackedVector4Array", + "return_type": "bool" + }, + { + "name": "+", + "right_type": "PackedVector4Array", + "return_type": "PackedVector4Array" + } + ], + "methods": [ + { + "name": "size", + "return_type": "int", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3173160232 + }, + { + "name": "is_empty", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3918633141 + }, + { + "name": "set", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 1350366223, + "arguments": [ + { + "name": "index", + "type": "int" + }, + { + "name": "value", + "type": "Vector4" + } + ] + }, + { + "name": "push_back", + "return_type": "bool", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3289167688, + "arguments": [ + { + "name": "value", + "type": "Vector4" + } + ] + }, + { + "name": "append", + "return_type": "bool", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3289167688, + "arguments": [ + { + "name": "value", + "type": "Vector4" + } + ] + }, + { + "name": "append_array", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 537428395, + "arguments": [ + { + "name": "array", + "type": "PackedVector4Array" + } + ] + }, + { + "name": "remove_at", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 2823966027, + "arguments": [ + { + "name": "index", + "type": "int" + } + ] + }, + { + "name": "insert", + "return_type": "int", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 11085009, + "arguments": [ + { + "name": "at_index", + "type": "int" + }, + { + "name": "value", + "type": "Vector4" + } + ] + }, + { + "name": "fill", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3761353134, + "arguments": [ + { + "name": "value", + "type": "Vector4" + } + ] + }, + { + "name": "resize", + "return_type": "int", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 848867239, + "arguments": [ + { + "name": "new_size", + "type": "int" + } + ] + }, + { + "name": "clear", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3218959716 + }, + { + "name": "has", + "return_type": "bool", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 88913544, + "arguments": [ + { + "name": "value", + "type": "Vector4" + } + ] + }, + { + "name": "reverse", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3218959716 + }, + { + "name": "slice", + "return_type": "PackedVector4Array", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 2942803855, + "arguments": [ + { + "name": "begin", + "type": "int" + }, + { + "name": "end", + "type": "int", + "default_value": "2147483647" + } + ] + }, + { + "name": "to_byte_array", + "return_type": "PackedByteArray", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 247621236 + }, + { + "name": "sort", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3218959716 + }, + { + "name": "bsearch", + "return_type": "int", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 735671678, + "arguments": [ + { + "name": "value", + "type": "Vector4" + }, + { + "name": "before", + "type": "bool", + "default_value": "true" + } + ] + }, + { + "name": "duplicate", + "return_type": "PackedVector4Array", + "is_vararg": false, + "is_const": false, + "is_static": false, + "hash": 3186305013 + }, + { + "name": "find", + "return_type": "int", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3091171314, + "arguments": [ + { + "name": "value", + "type": "Vector4" + }, + { + "name": "from", + "type": "int", + "default_value": "0" + } + ] + }, + { + "name": "rfind", + "return_type": "int", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3091171314, + "arguments": [ + { + "name": "value", + "type": "Vector4" + }, + { + "name": "from", + "type": "int", + "default_value": "-1" + } + ] + }, + { + "name": "count", + "return_type": "int", + "is_vararg": false, + "is_const": true, + "is_static": false, + "hash": 3956594488, + "arguments": [ + { + "name": "value", + "type": "Vector4" + } + ] + } + ], + "constructors": [ + { + "index": 0 + }, + { + "index": 1, + "arguments": [ + { + "name": "from", + "type": "PackedVector4Array" + } + ] + }, + { + "index": 2, + "arguments": [ + { + "name": "from", + "type": "Array" + } + ] + } + ], + "has_destructor": true } ], "classes": [ diff --git a/gdextension/gdextension_interface.h b/gdextension/gdextension_interface.h index 60ec8d417..8b11935e5 100644 --- a/gdextension/gdextension_interface.h +++ b/gdextension/gdextension_interface.h @@ -96,6 +96,7 @@ typedef enum { GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY, + GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR4_ARRAY, GDEXTENSION_VARIANT_TYPE_VARIANT_MAX } GDExtensionVariantType; @@ -1962,32 +1963,6 @@ typedef uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndex)(GDExtension */ typedef const uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); -/** - * @name packed_color_array_operator_index - * @since 4.1 - * - * Gets a pointer to a color in a PackedColorArray. - * - * @param p_self A pointer to a PackedColorArray object. - * @param p_index The index of the Color to get. - * - * @return A pointer to the requested Color. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); - -/** - * @name packed_color_array_operator_index_const - * @since 4.1 - * - * Gets a const pointer to a color in a PackedColorArray. - * - * @param p_self A const pointer to a const PackedColorArray object. - * @param p_index The index of the Color to get. - * - * @return A const pointer to the requested Color. - */ -typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); - /** * @name packed_float32_array_operator_index * @since 4.1 @@ -2170,6 +2145,58 @@ typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndex */ typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); +/** + * @name packed_vector4_array_operator_index + * @since 4.3 + * + * Gets a pointer to a Vector4 in a PackedVector4Array. + * + * @param p_self A pointer to a PackedVector4Array object. + * @param p_index The index of the Vector4 to get. + * + * @return A pointer to the requested Vector4. + */ +typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector4ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); + +/** + * @name packed_vector4_array_operator_index_const + * @since 4.3 + * + * Gets a const pointer to a Vector4 in a PackedVector4Array. + * + * @param p_self A const pointer to a PackedVector4Array object. + * @param p_index The index of the Vector4 to get. + * + * @return A const pointer to the requested Vector4. + */ +typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector4ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); + +/** + * @name packed_color_array_operator_index + * @since 4.1 + * + * Gets a pointer to a color in a PackedColorArray. + * + * @param p_self A pointer to a PackedColorArray object. + * @param p_index The index of the Color to get. + * + * @return A pointer to the requested Color. + */ +typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); + +/** + * @name packed_color_array_operator_index_const + * @since 4.1 + * + * Gets a const pointer to a color in a PackedColorArray. + * + * @param p_self A const pointer to a PackedColorArray object. + * @param p_index The index of the Color to get. + * + * @return A const pointer to the requested Color. + */ +typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); + /** * @name array_operator_index * @since 4.1 diff --git a/include/godot_cpp/godot.hpp b/include/godot_cpp/godot.hpp index 5a6293027..8619dfd49 100644 --- a/include/godot_cpp/godot.hpp +++ b/include/godot_cpp/godot.hpp @@ -148,6 +148,8 @@ extern "C" GDExtensionInterfacePackedVector2ArrayOperatorIndex gdextension_inter extern "C" GDExtensionInterfacePackedVector2ArrayOperatorIndexConst gdextension_interface_packed_vector2_array_operator_index_const; extern "C" GDExtensionInterfacePackedVector3ArrayOperatorIndex gdextension_interface_packed_vector3_array_operator_index; extern "C" GDExtensionInterfacePackedVector3ArrayOperatorIndexConst gdextension_interface_packed_vector3_array_operator_index_const; +extern "C" GDExtensionInterfacePackedVector4ArrayOperatorIndex gdextension_interface_packed_vector4_array_operator_index; +extern "C" GDExtensionInterfacePackedVector4ArrayOperatorIndexConst gdextension_interface_packed_vector4_array_operator_index_const; extern "C" GDExtensionInterfaceArrayOperatorIndex gdextension_interface_array_operator_index; extern "C" GDExtensionInterfaceArrayOperatorIndexConst gdextension_interface_array_operator_index_const; extern "C" GDExtensionInterfaceArrayRef gdextension_interface_array_ref; diff --git a/src/godot.cpp b/src/godot.cpp index 8a031be23..f31d1cdbc 100644 --- a/src/godot.cpp +++ b/src/godot.cpp @@ -154,6 +154,8 @@ GDExtensionInterfacePackedVector2ArrayOperatorIndex gdextension_interface_packed GDExtensionInterfacePackedVector2ArrayOperatorIndexConst gdextension_interface_packed_vector2_array_operator_index_const = nullptr; GDExtensionInterfacePackedVector3ArrayOperatorIndex gdextension_interface_packed_vector3_array_operator_index = nullptr; GDExtensionInterfacePackedVector3ArrayOperatorIndexConst gdextension_interface_packed_vector3_array_operator_index_const = nullptr; +GDExtensionInterfacePackedVector4ArrayOperatorIndex gdextension_interface_packed_vector4_array_operator_index = nullptr; +GDExtensionInterfacePackedVector4ArrayOperatorIndexConst gdextension_interface_packed_vector4_array_operator_index_const = nullptr; GDExtensionInterfaceArrayOperatorIndex gdextension_interface_array_operator_index = nullptr; GDExtensionInterfaceArrayOperatorIndexConst gdextension_interface_array_operator_index_const = nullptr; GDExtensionInterfaceArrayRef gdextension_interface_array_ref = nullptr; @@ -394,6 +396,8 @@ GDExtensionBool GDExtensionBinding::init(GDExtensionInterfaceGetProcAddress p_ge LOAD_PROC_ADDRESS(packed_vector2_array_operator_index_const, GDExtensionInterfacePackedVector2ArrayOperatorIndexConst); LOAD_PROC_ADDRESS(packed_vector3_array_operator_index, GDExtensionInterfacePackedVector3ArrayOperatorIndex); LOAD_PROC_ADDRESS(packed_vector3_array_operator_index_const, GDExtensionInterfacePackedVector3ArrayOperatorIndexConst); + LOAD_PROC_ADDRESS(packed_vector4_array_operator_index, GDExtensionInterfacePackedVector4ArrayOperatorIndex); + LOAD_PROC_ADDRESS(packed_vector4_array_operator_index_const, GDExtensionInterfacePackedVector4ArrayOperatorIndexConst); LOAD_PROC_ADDRESS(array_operator_index, GDExtensionInterfaceArrayOperatorIndex); LOAD_PROC_ADDRESS(array_operator_index_const, GDExtensionInterfaceArrayOperatorIndexConst); LOAD_PROC_ADDRESS(array_ref, GDExtensionInterfaceArrayRef); diff --git a/src/variant/packed_arrays.cpp b/src/variant/packed_arrays.cpp index fe8b3597f..4384f7adc 100644 --- a/src/variant/packed_arrays.cpp +++ b/src/variant/packed_arrays.cpp @@ -43,6 +43,7 @@ #include #include #include +#include namespace godot { @@ -198,6 +199,24 @@ Vector3 *PackedVector3Array::ptrw() { return (Vector3 *)internal::gdextension_interface_packed_vector3_array_operator_index((GDExtensionTypePtr *)this, 0); } +const Vector4 &PackedVector4Array::operator[](int64_t p_index) const { + const Vector4 *vec = (const Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index_const((GDExtensionTypePtr *)this, p_index); + return *vec; +} + +Vector4 &PackedVector4Array::operator[](int64_t p_index) { + Vector4 *vec = (Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index((GDExtensionTypePtr *)this, p_index); + return *vec; +} + +const Vector4 *PackedVector4Array::ptr() const { + return (const Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index_const((GDExtensionTypePtr *)this, 0); +} + +Vector4 *PackedVector4Array::ptrw() { + return (Vector4 *)internal::gdextension_interface_packed_vector4_array_operator_index((GDExtensionTypePtr *)this, 0); +} + const Variant &Array::operator[](int64_t p_index) const { const Variant *var = (const Variant *)internal::gdextension_interface_array_operator_index_const((GDExtensionTypePtr *)this, p_index); return *var;