From 10c3d1bc5f7f68bb4e260f32b9a8b529d23873ba Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Wed, 21 Aug 2024 18:31:12 -0700 Subject: [PATCH] Fix missing MAKE_TYPED_ARRAY_INFO for Packed*Arrays --- include/godot_cpp/core/type_info.hpp | 19 ++++++++++--------- test/src/example.cpp | 14 ++++++++++++++ test/src/example.h | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/godot_cpp/core/type_info.hpp b/include/godot_cpp/core/type_info.hpp index f368988..b78f7e7 100644 --- a/include/godot_cpp/core/type_info.hpp +++ b/include/godot_cpp/core/type_info.hpp @@ -397,16 +397,17 @@ MAKE_TYPED_ARRAY_INFO(Callable, Variant::CALLABLE) MAKE_TYPED_ARRAY_INFO(Signal, Variant::SIGNAL) MAKE_TYPED_ARRAY_INFO(Dictionary, Variant::DICTIONARY) MAKE_TYPED_ARRAY_INFO(Array, Variant::ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedByteArray, Variant::PACKED_BYTE_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedInt32Array, Variant::PACKED_INT32_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedInt64Array, Variant::PACKED_INT64_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedFloat32Array, Variant::PACKED_FLOAT32_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedFloat64Array, Variant::PACKED_FLOAT64_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedStringArray, Variant::PACKED_STRING_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedVector2Array, Variant::PACKED_VECTOR2_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedVector3Array, Variant::PACKED_VECTOR3_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedVector4Array, Variant::PACKED_VECTOR4_ARRAY) +MAKE_TYPED_ARRAY_INFO(PackedColorArray, Variant::PACKED_COLOR_ARRAY) /* -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_BYTE_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_INT32_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_INT64_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_FLOAT32_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_FLOAT64_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_STRING_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_VECTOR2_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_VECTOR3_ARRAY) -MAKE_TYPED_ARRAY_INFO(Vector, Variant::PACKED_COLOR_ARRAY) MAKE_TYPED_ARRAY_INFO(IPAddress, Variant::STRING) */ diff --git a/test/src/example.cpp b/test/src/example.cpp index a941889..84dc176 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -204,6 +204,7 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility); ClassDB::bind_method(D_METHOD("test_string_is_forty_two"), &Example::test_string_is_forty_two); ClassDB::bind_method(D_METHOD("test_string_resize"), &Example::test_string_resize); + ClassDB::bind_method(D_METHOD("test_typed_array_of_packed"), &Example::test_typed_array_of_packed); ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops); ClassDB::bind_method(D_METHOD("test_vector_init_list"), &Example::test_vector_init_list); @@ -424,6 +425,19 @@ String Example::test_string_resize(String p_string) const { return p_string; } +TypedArray Example::test_typed_array_of_packed() const { + TypedArray arr; + PackedInt32Array packed_arr1; + packed_arr1.push_back(1); + packed_arr1.push_back(2); + arr.push_back(packed_arr1); + PackedInt32Array packed_arr2; + packed_arr2.push_back(3); + packed_arr2.push_back(4); + arr.push_back(packed_arr2); + return arr; +} + int Example::test_vector_ops() const { PackedInt32Array arr; arr.push_back(10); diff --git a/test/src/example.h b/test/src/example.h index 7f3dfaa..59c907a 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -134,6 +134,7 @@ public: String test_str_utility() const; bool test_string_is_forty_two(const String &p_str) const; String test_string_resize(String p_original) const; + TypedArray test_typed_array_of_packed() const; int test_vector_ops() const; int test_vector_init_list() const;