diff options
Diffstat (limited to 'modules')
37 files changed, 1385 insertions, 663 deletions
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp index c05c86d9ae..738bd27ed3 100644 --- a/modules/enet/networked_multiplayer_enet.cpp +++ b/modules/enet/networked_multiplayer_enet.cpp @@ -575,6 +575,9 @@ size_t NetworkedMultiplayerENet::enet_compress(void *context, const ENetBuffer * case COMPRESS_ZLIB: { mode = Compression::MODE_DEFLATE; } break; + case COMPRESS_ZSTD: { + mode = Compression::MODE_ZSTD; + } break; default: { ERR_FAIL_V(0); } } @@ -608,6 +611,10 @@ size_t NetworkedMultiplayerENet::enet_decompress(void *context, const enet_uint8 ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_DEFLATE); } break; + case COMPRESS_ZSTD: { + + ret = Compression::decompress(outData, outLimit, inData, inLimit, Compression::MODE_ZSTD); + } break; default: {} } if (ret < 0) { @@ -629,7 +636,8 @@ void NetworkedMultiplayerENet::_setup_compressor() { enet_host_compress_with_range_coder(host); } break; case COMPRESS_FASTLZ: - case COMPRESS_ZLIB: { + case COMPRESS_ZLIB: + case COMPRESS_ZSTD: { enet_host_compress(host, &enet_compressor); } break; @@ -654,6 +662,7 @@ void NetworkedMultiplayerENet::_bind_methods() { BIND_CONSTANT(COMPRESS_RANGE_CODER); BIND_CONSTANT(COMPRESS_FASTLZ); BIND_CONSTANT(COMPRESS_ZLIB); + BIND_CONSTANT(COMPRESS_ZSTD); } NetworkedMultiplayerENet::NetworkedMultiplayerENet() { diff --git a/modules/enet/networked_multiplayer_enet.h b/modules/enet/networked_multiplayer_enet.h index c20c1af68e..8b971adf55 100644 --- a/modules/enet/networked_multiplayer_enet.h +++ b/modules/enet/networked_multiplayer_enet.h @@ -43,7 +43,8 @@ public: COMPRESS_NONE, COMPRESS_RANGE_CODER, COMPRESS_FASTLZ, - COMPRESS_ZLIB + COMPRESS_ZLIB, + COMPRESS_ZSTD }; private: diff --git a/modules/gdnative/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp index 8cf6d1b8ef..5497dde520 100644 --- a/modules/gdnative/godot/godot_array.cpp +++ b/modules/gdnative/godot/godot_array.cpp @@ -44,256 +44,264 @@ extern "C" { void _array_api_anchor() { } -void GDAPI godot_array_new(godot_array *p_arr) { - Array *a = (Array *)p_arr; - memnew_placement(a, Array); +void GDAPI godot_array_new(godot_array *r_dest) { + Array *dest = (Array *)r_dest; + memnew_placement(dest, Array); } -void GDAPI godot_array_new_copy(godot_array *p_dest, const godot_array *p_src) { - Array *dest = (Array *)p_dest; +void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src) { + Array *dest = (Array *)r_dest; const Array *src = (const Array *)p_src; memnew_placement(dest, Array(*src)); } -void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca) { + Array *dest = (Array *)r_dest; PoolVector<Color> *pca = (PoolVector<Color> *)p_pca; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a) { + Array *dest = (Array *)r_dest; PoolVector<Vector3> *pca = (PoolVector<Vector3> *)p_pv3a; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a) { + Array *dest = (Array *)r_dest; PoolVector<Vector2> *pca = (PoolVector<Vector2> *)p_pv2a; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa) { + Array *dest = (Array *)r_dest; PoolVector<String> *pca = (PoolVector<String> *)p_psa; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra) { + Array *dest = (Array *)r_dest; PoolVector<godot_real> *pca = (PoolVector<godot_real> *)p_pra; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia) { + Array *dest = (Array *)r_dest; PoolVector<godot_int> *pca = (PoolVector<godot_int> *)p_pia; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba) { + Array *dest = (Array *)r_dest; PoolVector<uint8_t> *pca = (PoolVector<uint8_t> *)p_pba; - memnew_placement(a, Array); - a->resize(pca->size()); + memnew_placement(dest, Array); + dest->resize(pca->size()); - for (size_t i = 0; i < a->size(); i++) { + for (size_t i = 0; i < dest->size(); i++) { Variant v = pca->operator[](i); - a->operator[](i) = v; + dest->operator[](i) = v; } } -void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value) { + Array *self = (Array *)p_self; Variant *val = (Variant *)p_value; - a->operator[](p_idx) = *val; + self->operator[](p_idx) = *val; } -godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx) { - Array *a = (Array *)p_arr; - return (godot_variant *)&a->operator[](p_idx); +godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx) { + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + const Array *self = (const Array *)p_self; + memnew_placement(dest, Variant(self->operator[](p_idx))); + return raw_dest; } -void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) { - Array *a = (Array *)p_arr; +godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx) { + Array *self = (Array *)p_self; + return (godot_variant *)&self->operator[](p_idx); +} + +void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; Variant *val = (Variant *)p_value; - a->append(*val); + self->append(*val); } -void GDAPI godot_array_clear(godot_array *p_arr) { - Array *a = (Array *)p_arr; - a->clear(); +void GDAPI godot_array_clear(godot_array *p_self) { + Array *self = (Array *)p_self; + self->clear(); } -godot_int GDAPI godot_array_count(const godot_array *p_arr, const godot_variant *p_value) { - const Array *a = (const Array *)p_arr; +godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value) { + const Array *self = (const Array *)p_self; const Variant *val = (const Variant *)p_value; - return a->count(*val); + return self->count(*val); } -godot_bool GDAPI godot_array_empty(const godot_array *p_arr) { - const Array *a = (const Array *)p_arr; - return a->empty(); +godot_bool GDAPI godot_array_empty(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + return self->empty(); } -void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; const Variant *val = (const Variant *)p_value; - a->erase(*val); + self->erase(*val); } -godot_variant GDAPI godot_array_front(const godot_array *p_arr) { - const Array *a = (const Array *)p_arr; +godot_variant GDAPI godot_array_front(const godot_array *p_self) { + const Array *self = (const Array *)p_self; godot_variant v; Variant *val = (Variant *)&v; memnew_placement(val, Variant); - *val = a->front(); + *val = self->front(); return v; } -godot_variant GDAPI godot_array_back(const godot_array *p_arr) { - const Array *a = (const Array *)p_arr; +godot_variant GDAPI godot_array_back(const godot_array *p_self) { + const Array *self = (const Array *)p_self; godot_variant v; Variant *val = (Variant *)&v; memnew_placement(val, Variant); - *val = a->back(); + *val = self->back(); return v; } -godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) { - const Array *a = (const Array *)p_arr; +godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) { + const Array *self = (const Array *)p_self; const Variant *val = (const Variant *)p_what; - return a->find(*val, p_from); + return self->find(*val, p_from); } -godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what) { - const Array *a = (const Array *)p_arr; +godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what) { + const Array *self = (const Array *)p_self; const Variant *val = (const Variant *)p_what; - return a->find_last(*val); + return self->find_last(*val); } -godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value) { - const Array *a = (const Array *)p_arr; +godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value) { + const Array *self = (const Array *)p_self; const Variant *val = (const Variant *)p_value; - return a->has(*val); + return self->has(*val); } -uint32_t GDAPI godot_array_hash(const godot_array *p_arr) { - const Array *a = (const Array *)p_arr; - return a->hash(); +godot_int GDAPI godot_array_hash(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + return self->hash(); } -void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value) { + Array *self = (Array *)p_self; const Variant *val = (const Variant *)p_value; - a->insert(p_pos, *val); + self->insert(p_pos, *val); } -void GDAPI godot_array_invert(godot_array *p_arr) { - Array *a = (Array *)p_arr; - a->invert(); +void GDAPI godot_array_invert(godot_array *p_self) { + Array *self = (Array *)p_self; + self->invert(); } -godot_variant GDAPI godot_array_pop_back(godot_array *p_arr) { - Array *a = (Array *)p_arr; +godot_variant GDAPI godot_array_pop_back(godot_array *p_self) { + Array *self = (Array *)p_self; godot_variant v; Variant *val = (Variant *)&v; memnew_placement(val, Variant); - *val = a->pop_back(); + *val = self->pop_back(); return v; } -godot_variant GDAPI godot_array_pop_front(godot_array *p_arr) { - Array *a = (Array *)p_arr; +godot_variant GDAPI godot_array_pop_front(godot_array *p_self) { + Array *self = (Array *)p_self; godot_variant v; Variant *val = (Variant *)&v; memnew_placement(val, Variant); - *val = a->pop_front(); + *val = self->pop_front(); return v; } -void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; const Variant *val = (const Variant *)p_value; - a->push_back(*val); + self->push_back(*val); } -void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value) { + Array *self = (Array *)p_self; const Variant *val = (const Variant *)p_value; - a->push_front(*val); + self->push_front(*val); } -void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx) { - Array *a = (Array *)p_arr; - a->remove(p_idx); +void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx) { + Array *self = (Array *)p_self; + self->remove(p_idx); } -void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size) { - Array *a = (Array *)p_arr; - a->resize(p_size); +void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size) { + Array *self = (Array *)p_self; + self->resize(p_size); } -godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) { - const Array *a = (const Array *)p_arr; +godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from) { + const Array *self = (const Array *)p_self; const Variant *val = (const Variant *)p_what; - return a->rfind(*val, p_from); + return self->rfind(*val, p_from); } -godot_int GDAPI godot_array_size(const godot_array *p_arr) { - const Array *a = (const Array *)p_arr; - return a->size(); +godot_int GDAPI godot_array_size(const godot_array *p_self) { + const Array *self = (const Array *)p_self; + return self->size(); } -void GDAPI godot_array_sort(godot_array *p_arr) { - Array *a = (Array *)p_arr; - a->sort(); +void GDAPI godot_array_sort(godot_array *p_self) { + Array *self = (Array *)p_self; + self->sort(); } -void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func) { - Array *a = (Array *)p_arr; +void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func) { + Array *self = (Array *)p_self; const String *func = (const String *)p_func; - a->sort_custom((Object *)p_obj, *func); + self->sort_custom((Object *)p_obj, *func); } -void GDAPI godot_array_destroy(godot_array *p_arr) { - ((Array *)p_arr)->~Array(); +void GDAPI godot_array_destroy(godot_array *p_self) { + ((Array *)p_self)->~Array(); } #ifdef __cplusplus diff --git a/modules/gdnative/godot/godot_array.h b/modules/gdnative/godot/godot_array.h index 5db0031b8c..bf8bc61977 100644 --- a/modules/gdnative/godot/godot_array.h +++ b/modules/gdnative/godot/godot_array.h @@ -48,67 +48,69 @@ typedef struct godot_array { #include "../godot.h" -void GDAPI godot_array_new(godot_array *p_arr); -void GDAPI godot_array_new_copy(godot_array *p_dest, const godot_array *p_src); -void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca); -void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a); -void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a); -void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa); -void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra); -void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia); -void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba); +void GDAPI godot_array_new(godot_array *r_dest); +void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src); +void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca); +void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a); +void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a); +void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa); +void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra); +void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia); +void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba); -void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value); +void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); -godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx); +godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx); -void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value); +godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx); -void GDAPI godot_array_clear(godot_array *p_arr); +void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value); -godot_int GDAPI godot_array_count(const godot_array *p_arr, const godot_variant *p_value); +void GDAPI godot_array_clear(godot_array *p_self); -godot_bool GDAPI godot_array_empty(const godot_array *p_arr); +godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value); -void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value); +godot_bool GDAPI godot_array_empty(const godot_array *p_self); -godot_variant GDAPI godot_array_front(const godot_array *p_arr); +void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value); -godot_variant GDAPI godot_array_back(const godot_array *p_arr); +godot_variant GDAPI godot_array_front(const godot_array *p_self); -godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from); +godot_variant GDAPI godot_array_back(const godot_array *p_self); -godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what); +godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); -godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value); +godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what); -uint32_t GDAPI godot_array_hash(const godot_array *p_arr); +godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value); -void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value); +godot_int GDAPI godot_array_hash(const godot_array *p_self); -void GDAPI godot_array_invert(godot_array *p_arr); +void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value); -godot_variant GDAPI godot_array_pop_back(godot_array *p_arr); +void GDAPI godot_array_invert(godot_array *p_self); -godot_variant GDAPI godot_array_pop_front(godot_array *p_arr); +godot_variant GDAPI godot_array_pop_back(godot_array *p_self); -void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value); +godot_variant GDAPI godot_array_pop_front(godot_array *p_self); -void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value); +void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value); -void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx); +void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value); -void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size); +void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from); +void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size); -godot_int GDAPI godot_array_size(const godot_array *p_arr); +godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); -void GDAPI godot_array_sort(godot_array *p_arr); +godot_int GDAPI godot_array_size(const godot_array *p_self); -void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func); +void GDAPI godot_array_sort(godot_array *p_self); -void GDAPI godot_array_destroy(godot_array *p_arr); +void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func); + +void GDAPI godot_array_destroy(godot_array *p_self); #ifdef __cplusplus } diff --git a/modules/gdnative/godot/godot_color.cpp b/modules/gdnative/godot/godot_color.cpp index 0417a828ab..6dedf2ab10 100644 --- a/modules/gdnative/godot/godot_color.cpp +++ b/modules/gdnative/godot/godot_color.cpp @@ -50,6 +50,61 @@ void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const *dest = Color(p_r, p_g, p_b); } +godot_real godot_color_get_r(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->r; +} + +void godot_color_set_r(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->r = val; +} + +godot_real godot_color_get_g(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->g; +} + +void godot_color_set_g(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->g = val; +} + +godot_real godot_color_get_b(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->b; +} + +void godot_color_set_b(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->b = val; +} + +godot_real godot_color_get_a(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->a; +} + +void godot_color_set_a(godot_color *p_self, const godot_real val) { + Color *self = (Color *)p_self; + self->a = val; +} + +godot_real godot_color_get_h(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->get_h(); +} + +godot_real godot_color_get_s(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->get_s(); +} + +godot_real godot_color_get_v(const godot_color *p_self) { + const Color *self = (const Color *)p_self; + return self->get_v(); +} + godot_string GDAPI godot_color_as_string(const godot_color *p_self) { godot_string ret; const Color *self = (const Color *)p_self; @@ -106,7 +161,7 @@ godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bo godot_string dest; const Color *self = (const Color *)p_self; - *((String *)&dest) = self->to_html(p_with_alpha); + memnew_placement(&dest, String(self->to_html(p_with_alpha))); return dest; } diff --git a/modules/gdnative/godot/godot_color.h b/modules/gdnative/godot/godot_color.h index 8588c997ea..10dc228b1c 100644 --- a/modules/gdnative/godot/godot_color.h +++ b/modules/gdnative/godot/godot_color.h @@ -49,6 +49,22 @@ typedef struct godot_color { void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a); void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b); +godot_real godot_color_get_r(const godot_color *p_self); +void godot_color_set_r(godot_color *p_self, const godot_real r); + +godot_real godot_color_get_g(const godot_color *p_self); +void godot_color_set_g(godot_color *p_self, const godot_real g); + +godot_real godot_color_get_b(const godot_color *p_self); +void godot_color_set_b(godot_color *p_self, const godot_real b); + +godot_real godot_color_get_a(const godot_color *p_self); +void godot_color_set_a(godot_color *p_self, const godot_real a); + +godot_real godot_color_get_h(const godot_color *p_self); +godot_real godot_color_get_s(const godot_color *p_self); +godot_real godot_color_get_v(const godot_color *p_self); + godot_string GDAPI godot_color_as_string(const godot_color *p_self); godot_int GDAPI godot_color_to_32(const godot_color *p_self); diff --git a/modules/gdnative/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp index deec5f8ffb..12c40f0564 100644 --- a/modules/gdnative/godot/godot_dictionary.cpp +++ b/modules/gdnative/godot/godot_dictionary.cpp @@ -44,9 +44,9 @@ void GDAPI godot_dictionary_new(godot_dictionary *r_dest) { memnew_placement(dest, Dictionary); } -void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *r_src) { +void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src) { Dictionary *dest = (Dictionary *)r_dest; - const Dictionary *src = (const Dictionary *)r_src; + const Dictionary *src = (const Dictionary *)p_src; memnew_placement(dest, Dictionary(*src)); } @@ -107,10 +107,26 @@ godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) { return dest; } -godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) { - Dictionary *dict = (Dictionary *)p_dict; +godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key) { + godot_variant raw_dest; + Variant *dest = (Variant *)&raw_dest; + const Dictionary *self = (const Dictionary *)p_self; + const Variant *key = (const Variant *)p_key; + memnew_placement(dest, Variant(self->operator[](*key))); + return raw_dest; +} + +void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value) { + Dictionary *self = (Dictionary *)p_self; const Variant *key = (const Variant *)p_key; - return (godot_variant *)&dict->operator[](*key); + const Variant *value = (const Variant *)p_value; + self->operator[](*key) = *value; +} + +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key) { + Array *self = (Array *)p_self; + const Variant *key = (const Variant *)p_key; + return (godot_variant *)&self->operator[](*key); } godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) { @@ -119,11 +135,11 @@ godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, return *self == *b; } -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict) { +godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self) { godot_string raw_dest; String *dest = (String *)&raw_dest; - const Dictionary *dict = (const Dictionary *)p_dict; - memnew_placement(dest, String(JSON::print(Variant(*dict)))); + const Dictionary *self = (const Dictionary *)p_self; + memnew_placement(dest, String(JSON::print(Variant(*self)))); return raw_dest; } diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h index a89bd4bba1..0325670b15 100644 --- a/modules/gdnative/godot/godot_dictionary.h +++ b/modules/gdnative/godot/godot_dictionary.h @@ -48,7 +48,7 @@ typedef struct godot_dictionary { #include "godot_variant.h" void GDAPI godot_dictionary_new(godot_dictionary *r_dest); -void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *r_src); +void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src); void GDAPI godot_dictionary_destroy(godot_dictionary *p_self); godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self); @@ -69,11 +69,14 @@ godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self); godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self); -godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); +godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key); +void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value); + +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key); godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b); -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict); +godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self); #ifdef __cplusplus } diff --git a/modules/gdnative/godot/godot_node_path.cpp b/modules/gdnative/godot/godot_node_path.cpp index 165688a340..c8eacd05af 100644 --- a/modules/gdnative/godot/godot_node_path.cpp +++ b/modules/gdnative/godot/godot_node_path.cpp @@ -44,6 +44,12 @@ void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_fr memnew_placement(dest, NodePath(*from)); } +void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src) { + NodePath *dest = (NodePath *)r_dest; + const NodePath *src = (const NodePath *)p_src; + memnew_placement(dest, NodePath(*src)); +} + void GDAPI godot_node_path_destroy(godot_node_path *p_self) { NodePath *self = (NodePath *)p_self; self->~NodePath(); diff --git a/modules/gdnative/godot/godot_node_path.h b/modules/gdnative/godot/godot_node_path.h index fb94bd3822..b0c9d44859 100644 --- a/modules/gdnative/godot/godot_node_path.h +++ b/modules/gdnative/godot/godot_node_path.h @@ -47,6 +47,7 @@ typedef struct godot_node_path { #include "godot_string.h" void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from); +void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src); void GDAPI godot_node_path_destroy(godot_node_path *p_self); godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self); diff --git a/modules/gdnative/godot/godot_pool_arrays.cpp b/modules/gdnative/godot/godot_pool_arrays.cpp index ff4586ebe7..ea9aceea81 100644 --- a/modules/gdnative/godot/godot_pool_arrays.cpp +++ b/modules/gdnative/godot/godot_pool_arrays.cpp @@ -44,584 +44,584 @@ void _pool_arrays_api_anchor() { // byte -void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - memnew_placement(pba, PoolVector<uint8_t>); +void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest) { + PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest; + memnew_placement(dest, PoolVector<uint8_t>); } -void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *p_dest, const godot_pool_byte_array *p_src) { - PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)p_dest; +void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src) { + PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest; const PoolVector<uint8_t> *src = (const PoolVector<uint8_t> *)p_src; memnew_placement(dest, PoolVector<uint8_t>(*src)); } -void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; +void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a) { + PoolVector<uint8_t> *dest = (PoolVector<uint8_t> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<uint8_t>); + memnew_placement(dest, PoolVector<uint8_t>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - pba->append(p_data); +void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + self->append(p_data); } -void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; +void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; PoolVector<uint8_t> *array = (PoolVector<uint8_t> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - return pba->insert(p_idx, p_data); +godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + return (godot_error)self->insert(p_idx, p_data); } -void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - pba->invert(); +void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + self->invert(); } -void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - pba->push_back(p_data); +void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + self->push_back(p_data); } -void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) { - PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba; - pba->set(p_idx, p_data); +void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data) { + PoolVector<uint8_t> *self = (PoolVector<uint8_t> *)p_self; + self->set(p_idx, p_data); } -uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_pba, const godot_int p_idx) { - const PoolVector<uint8_t> *pba = (const PoolVector<uint8_t> *)p_pba; - return pba->get(p_idx); +uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx) { + const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; + return self->get(p_idx); } -godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_pba) { - const PoolVector<uint8_t> *pba = (const PoolVector<uint8_t> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self) { + const PoolVector<uint8_t> *self = (const PoolVector<uint8_t> *)p_self; + return self->size(); } -void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba) { - ((PoolVector<uint8_t> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self) { + ((PoolVector<uint8_t> *)p_self)->~PoolVector(); } // int -void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pba) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - memnew_placement(pba, PoolVector<godot_int>); +void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest) { + PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest; + memnew_placement(dest, PoolVector<godot_int>); } -void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *p_dest, const godot_pool_int_array *p_src) { - PoolVector<godot_int> *dest = (PoolVector<godot_int> *)p_dest; +void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src) { + PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest; const PoolVector<godot_int> *src = (const PoolVector<godot_int> *)p_src; memnew_placement(dest, PoolVector<godot_int>(*src)); } -void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pba, const godot_array *p_a) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; +void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a) { + PoolVector<godot_int> *dest = (PoolVector<godot_int> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<godot_int>); + memnew_placement(dest, PoolVector<godot_int>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pba, const godot_int p_data) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->append(p_data); +void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->append(p_data); } -void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pba, const godot_pool_int_array *p_array) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; +void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; PoolVector<godot_int> *array = (PoolVector<godot_int> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - return pba->insert(p_idx, p_data); +godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + return (godot_error)self->insert(p_idx, p_data); } -void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pba) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->invert(); +void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->invert(); } -void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pba, const godot_int p_data) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->push_back(p_data); +void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->push_back(p_data); } -void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pba, const godot_int p_idx) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pba, const godot_int p_size) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->set(p_idx, p_data); +void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->set(p_idx, p_data); } -godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_pba, const godot_int p_idx) { - const PoolVector<godot_int> *pba = (const PoolVector<godot_int> *)p_pba; - return pba->get(p_idx); +godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx) { + const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; + return self->get(p_idx); } -godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_pba) { - const PoolVector<godot_int> *pba = (const PoolVector<godot_int> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self) { + const PoolVector<godot_int> *self = (const PoolVector<godot_int> *)p_self; + return self->size(); } -void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pba) { - ((PoolVector<godot_int> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self) { + ((PoolVector<godot_int> *)p_self)->~PoolVector(); } // real -void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pba) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - memnew_placement(pba, PoolVector<godot_real>); +void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest) { + PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest; + memnew_placement(dest, PoolVector<godot_real>); } -void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *p_dest, const godot_pool_real_array *p_src) { - PoolVector<godot_real> *dest = (PoolVector<godot_real> *)p_dest; +void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src) { + PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest; const PoolVector<godot_real> *src = (const PoolVector<godot_real> *)p_src; memnew_placement(dest, PoolVector<godot_real>(*src)); } -void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pba, const godot_array *p_a) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; +void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a) { + PoolVector<godot_real> *dest = (PoolVector<godot_real> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<godot_real>); + memnew_placement(dest, PoolVector<godot_real>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pba, const godot_real p_data) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - pba->append(p_data); +void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; + self->append(p_data); } -void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pba, const godot_pool_real_array *p_array) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; +void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; PoolVector<godot_real> *array = (PoolVector<godot_real> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - return pba->insert(p_idx, p_data); +godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; + return (godot_error)self->insert(p_idx, p_data); } -void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pba) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - pba->invert(); +void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; + self->invert(); } -void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pba, const godot_real p_data) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - pba->push_back(p_data); +void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; + self->push_back(p_data); } -void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pba, const godot_int p_idx) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pba, const godot_int p_size) { - PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size) { + PoolVector<godot_int> *self = (PoolVector<godot_int> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) { - PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba; - pba->set(p_idx, p_data); +void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data) { + PoolVector<godot_real> *self = (PoolVector<godot_real> *)p_self; + self->set(p_idx, p_data); } -godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_pba, const godot_int p_idx) { - const PoolVector<godot_real> *pba = (const PoolVector<godot_real> *)p_pba; - return pba->get(p_idx); +godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx) { + const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; + return self->get(p_idx); } -godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_pba) { - const PoolVector<godot_real> *pba = (const PoolVector<godot_real> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self) { + const PoolVector<godot_real> *self = (const PoolVector<godot_real> *)p_self; + return self->size(); } -void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pba) { - ((PoolVector<godot_real> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self) { + ((PoolVector<godot_real> *)p_self)->~PoolVector(); } // string -void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_pba) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; - memnew_placement(pba, PoolVector<String>); +void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest) { + PoolVector<String> *dest = (PoolVector<String> *)r_dest; + memnew_placement(dest, PoolVector<String>); } -void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *p_dest, const godot_pool_string_array *p_src) { - PoolVector<String> *dest = (PoolVector<String> *)p_dest; +void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src) { + PoolVector<String> *dest = (PoolVector<String> *)r_dest; const PoolVector<String> *src = (const PoolVector<String> *)p_src; memnew_placement(dest, PoolVector<String>(*src)); } -void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_pba, const godot_array *p_a) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; +void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a) { + PoolVector<String> *dest = (PoolVector<String> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<String>); + memnew_placement(dest, PoolVector<String>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_pba, const godot_string *p_data) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; +void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data) { + PoolVector<String> *self = (PoolVector<String> *)p_self; String &s = *(String *)p_data; - pba->append(s); + self->append(s); } -void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_pba, const godot_pool_string_array *p_array) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; +void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array) { + PoolVector<String> *self = (PoolVector<String> *)p_self; PoolVector<String> *array = (PoolVector<String> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; +godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { + PoolVector<String> *self = (PoolVector<String> *)p_self; String &s = *(String *)p_data; - return pba->insert(p_idx, s); + return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_pba) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; - pba->invert(); +void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self) { + PoolVector<String> *self = (PoolVector<String> *)p_self; + self->invert(); } -void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_pba, const godot_string *p_data) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; +void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data) { + PoolVector<String> *self = (PoolVector<String> *)p_self; String &s = *(String *)p_data; - pba->push_back(s); + self->push_back(s); } -void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_pba, const godot_int p_idx) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx) { + PoolVector<String> *self = (PoolVector<String> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_pba, const godot_int p_size) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size) { + PoolVector<String> *self = (PoolVector<String> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) { - PoolVector<String> *pba = (PoolVector<String> *)p_pba; +void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data) { + PoolVector<String> *self = (PoolVector<String> *)p_self; String &s = *(String *)p_data; - pba->set(p_idx, s); + self->set(p_idx, s); } -godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_pba, const godot_int p_idx) { - const PoolVector<String> *pba = (const PoolVector<String> *)p_pba; +godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx) { + const PoolVector<String> *self = (const PoolVector<String> *)p_self; godot_string str; String *s = (String *)&str; memnew_placement(s, String); - *s = pba->get(p_idx); + *s = self->get(p_idx); return str; } -godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_pba) { - const PoolVector<String> *pba = (const PoolVector<String> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self) { + const PoolVector<String> *self = (const PoolVector<String> *)p_self; + return self->size(); } -void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_pba) { - ((PoolVector<String> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self) { + ((PoolVector<String> *)p_self)->~PoolVector(); } // vector2 -void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pba) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; - memnew_placement(pba, PoolVector<Vector2>); +void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest) { + PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest; + memnew_placement(dest, PoolVector<Vector2>); } -void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *p_dest, const godot_pool_vector2_array *p_src) { - PoolVector<Vector2> *dest = (PoolVector<Vector2> *)p_dest; +void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src) { + PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest; const PoolVector<Vector2> *src = (const PoolVector<Vector2> *)p_src; memnew_placement(dest, PoolVector<Vector2>(*src)); } -void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pba, const godot_array *p_a) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; +void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a) { + PoolVector<Vector2> *dest = (PoolVector<Vector2> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<Vector2>); + memnew_placement(dest, PoolVector<Vector2>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; +void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; - pba->append(s); + self->append(s); } -void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pba, const godot_pool_vector2_array *p_array) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; +void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; PoolVector<Vector2> *array = (PoolVector<Vector2> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; +godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; - return pba->insert(p_idx, s); + return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pba) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; - pba->invert(); +void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; + self->invert(); } -void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; +void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; - pba->push_back(s); + self->push_back(s); } -void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pba, const godot_int p_idx) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pba, const godot_int p_size) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) { - PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba; +void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data) { + PoolVector<Vector2> *self = (PoolVector<Vector2> *)p_self; Vector2 &s = *(Vector2 *)p_data; - pba->set(p_idx, s); + self->set(p_idx, s); } -godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_pba, const godot_int p_idx) { - const PoolVector<Vector2> *pba = (const PoolVector<Vector2> *)p_pba; +godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx) { + const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; godot_vector2 v; Vector2 *s = (Vector2 *)&v; - *s = pba->get(p_idx); + *s = self->get(p_idx); return v; } -godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_pba) { - const PoolVector<Vector2> *pba = (const PoolVector<Vector2> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self) { + const PoolVector<Vector2> *self = (const PoolVector<Vector2> *)p_self; + return self->size(); } -void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pba) { - ((PoolVector<Vector2> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self) { + ((PoolVector<Vector2> *)p_self)->~PoolVector(); } // vector3 -void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pba) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; - memnew_placement(pba, PoolVector<Vector3>); +void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest) { + PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest; + memnew_placement(dest, PoolVector<Vector3>); } -void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *p_dest, const godot_pool_vector3_array *p_src) { - PoolVector<Vector3> *dest = (PoolVector<Vector3> *)p_dest; +void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src) { + PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest; const PoolVector<Vector3> *src = (const PoolVector<Vector3> *)p_src; memnew_placement(dest, PoolVector<Vector3>(*src)); } -void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pba, const godot_array *p_a) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; +void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a) { + PoolVector<Vector3> *dest = (PoolVector<Vector3> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<Vector3>); + memnew_placement(dest, PoolVector<Vector3>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; +void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; - pba->append(s); + self->append(s); } -void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pba, const godot_pool_vector3_array *p_array) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; +void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; PoolVector<Vector3> *array = (PoolVector<Vector3> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; +godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; - return pba->insert(p_idx, s); + return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pba) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; - pba->invert(); +void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; + self->invert(); } -void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; +void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; - pba->push_back(s); + self->push_back(s); } -void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pba, const godot_int p_idx) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pba, const godot_int p_size) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) { - PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba; +void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data) { + PoolVector<Vector3> *self = (PoolVector<Vector3> *)p_self; Vector3 &s = *(Vector3 *)p_data; - pba->set(p_idx, s); + self->set(p_idx, s); } -godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_pba, const godot_int p_idx) { - const PoolVector<Vector3> *pba = (const PoolVector<Vector3> *)p_pba; +godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx) { + const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; godot_vector3 v; Vector3 *s = (Vector3 *)&v; - *s = pba->get(p_idx); + *s = self->get(p_idx); return v; } -godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_pba) { - const PoolVector<Vector3> *pba = (const PoolVector<Vector3> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self) { + const PoolVector<Vector3> *self = (const PoolVector<Vector3> *)p_self; + return self->size(); } -void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pba) { - ((PoolVector<Vector3> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self) { + ((PoolVector<Vector3> *)p_self)->~PoolVector(); } // color -void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pba) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; - memnew_placement(pba, PoolVector<Color>); +void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest) { + PoolVector<Color> *dest = (PoolVector<Color> *)r_dest; + memnew_placement(dest, PoolVector<Color>); } -void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *p_dest, const godot_pool_color_array *p_src) { - PoolVector<Color> *dest = (PoolVector<Color> *)p_dest; +void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src) { + PoolVector<Color> *dest = (PoolVector<Color> *)r_dest; const PoolVector<Color> *src = (const PoolVector<Color> *)p_src; memnew_placement(dest, PoolVector<Color>(*src)); } -void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pba, const godot_array *p_a) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; +void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a) { + PoolVector<Color> *dest = (PoolVector<Color> *)r_dest; Array *a = (Array *)p_a; - memnew_placement(pba, PoolVector<Color>); + memnew_placement(dest, PoolVector<Color>); - pba->resize(a->size()); + dest->resize(a->size()); for (size_t i = 0; i < a->size(); i++) { - pba->set(i, (*a)[i]); + dest->set(i, (*a)[i]); } } -void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pba, const godot_color *p_data) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; +void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; Color &s = *(Color *)p_data; - pba->append(s); + self->append(s); } -void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pba, const godot_pool_color_array *p_array) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; +void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; PoolVector<Color> *array = (PoolVector<Color> *)p_array; - pba->append_array(*array); + self->append_array(*array); } -int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; +godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; Color &s = *(Color *)p_data; - return pba->insert(p_idx, s); + return (godot_error)self->insert(p_idx, s); } -void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pba) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; - pba->invert(); +void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; + self->invert(); } -void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pba, const godot_color *p_data) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; +void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; Color &s = *(Color *)p_data; - pba->push_back(s); + self->push_back(s); } -void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pba, const godot_int p_idx) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; - pba->remove(p_idx); +void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; + self->remove(p_idx); } -void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pba, const godot_int p_size) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; - pba->resize(p_size); +void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; + self->resize(p_size); } -void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) { - PoolVector<Color> *pba = (PoolVector<Color> *)p_pba; +void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data) { + PoolVector<Color> *self = (PoolVector<Color> *)p_self; Color &s = *(Color *)p_data; - pba->set(p_idx, s); + self->set(p_idx, s); } -godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_pba, const godot_int p_idx) { - const PoolVector<Color> *pba = (const PoolVector<Color> *)p_pba; +godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx) { + const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; godot_color v; Color *s = (Color *)&v; - *s = pba->get(p_idx); + *s = self->get(p_idx); return v; } -godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_pba) { - const PoolVector<Color> *pba = (const PoolVector<Color> *)p_pba; - return pba->size(); +godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self) { + const PoolVector<Color> *self = (const PoolVector<Color> *)p_self; + return self->size(); } -void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pba) { - ((PoolVector<Color> *)p_pba)->~PoolVector(); +void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self) { + ((PoolVector<Color> *)p_self)->~PoolVector(); } #ifdef __cplusplus diff --git a/modules/gdnative/godot/godot_pool_arrays.h b/modules/gdnative/godot/godot_pool_arrays.h index 8b0d0137fd..a794d03f01 100644 --- a/modules/gdnative/godot/godot_pool_arrays.h +++ b/modules/gdnative/godot/godot_pool_arrays.h @@ -101,192 +101,192 @@ typedef struct godot_pool_color_array { // byte -void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba); -void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *p_dest, const godot_pool_byte_array *p_src); -void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a); +void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest); +void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src); +void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data); +void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data); -void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array); +void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array); -int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data); +godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); -void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba); +void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self); -void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data); +void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data); -void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx); +void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size); +void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size); -void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data); -uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_pba, const godot_int p_idx); +void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); +uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_pba); +godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self); -void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba); +void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self); // int -void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pia); -void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *p_dest, const godot_pool_int_array *p_src); -void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pia, const godot_array *p_a); +void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest); +void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src); +void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pia, const godot_int p_data); +void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data); -void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pia, const godot_pool_int_array *p_array); +void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array); -int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data); +godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); -void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pia); +void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self); -void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pia, const godot_int p_data); +void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data); -void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pia, const godot_int p_idx); +void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pia, const godot_int p_size); +void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size); -void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data); -godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_pia, const godot_int p_idx); +void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); +godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_pia); +godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self); -void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pia); +void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self); // real -void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pra); -void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *p_dest, const godot_pool_real_array *p_src); -void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pra, const godot_array *p_a); +void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest); +void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src); +void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pra, const godot_real p_data); +void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data); -void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pra, const godot_pool_real_array *p_array); +void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array); -int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data); +godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); -void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pra); +void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self); -void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pra, const godot_real p_data); +void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data); -void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pra, const godot_int p_idx); +void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pra, const godot_int p_size); +void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size); -void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data); -godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_pra, const godot_int p_idx); +void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); +godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_pra); +godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self); -void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pra); +void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self); // string -void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_psa); -void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *p_dest, const godot_pool_string_array *p_src); -void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_psa, const godot_array *p_a); +void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest); +void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src); +void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_psa, const godot_string *p_data); +void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data); -void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_psa, const godot_pool_string_array *p_array); +void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array); -int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data); +godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); -void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_psa); +void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self); -void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_psa, const godot_string *p_data); +void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data); -void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_psa, const godot_int p_idx); +void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_psa, const godot_int p_size); +void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size); -void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data); -godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_psa, const godot_int p_idx); +void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); +godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_psa); +godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self); -void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_psa); +void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self); // vector2 -void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pv2a); -void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *p_dest, const godot_pool_vector2_array *p_src); -void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pv2a, const godot_array *p_a); +void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest); +void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src); +void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data); +void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); -void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pv2a, const godot_pool_vector2_array *p_array); +void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array); -int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data); +godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); -void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pv2a); +void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self); -void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data); +void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); -void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pv2a, const godot_int p_idx); +void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pv2a, const godot_int p_size); +void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size); -void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data); -godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_pv2a, const godot_int p_idx); +void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); +godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_pv2a); +godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self); -void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pv2a); +void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self); // vector3 -void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pv3a); -void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *p_dest, const godot_pool_vector3_array *p_src); -void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pv3a, const godot_array *p_a); +void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest); +void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src); +void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data); +void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); -void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pv3a, const godot_pool_vector3_array *p_array); +void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array); -int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data); +godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); -void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pv3a); +void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self); -void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data); +void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); -void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pv3a, const godot_int p_idx); +void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pv3a, const godot_int p_size); +void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size); -void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data); -godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_pv3a, const godot_int p_idx); +void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); +godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_pv3a); +godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self); -void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pv3a); +void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self); // color -void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pca); -void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *p_dest, const godot_pool_color_array *p_src); -void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pca, const godot_array *p_a); +void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest); +void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src); +void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a); -void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pca, const godot_color *p_data); +void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data); -void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pca, const godot_pool_color_array *p_array); +void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array); -int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data); +godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); -void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pca); +void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self); -void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pca, const godot_color *p_data); +void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data); -void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pca, const godot_int p_idx); +void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx); -void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pca, const godot_int p_size); +void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size); -void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data); -godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_pca, const godot_int p_idx); +void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); +godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_pca); +godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self); -void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca); +void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); #ifdef __cplusplus } diff --git a/modules/gdnative/godot/godot_quat.cpp b/modules/gdnative/godot/godot_quat.cpp index 4d38c4987c..7235e4fcec 100644 --- a/modules/gdnative/godot/godot_quat.cpp +++ b/modules/gdnative/godot/godot_quat.cpp @@ -50,6 +50,46 @@ void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector *dest = Quat(*axis, p_angle); } +godot_real GDAPI godot_quat_get_x(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->x; +} + +void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->x = val; +} + +godot_real GDAPI godot_quat_get_y(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->y; +} + +void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->y = val; +} + +godot_real GDAPI godot_quat_get_z(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->z; +} + +void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->z = val; +} + +godot_real GDAPI godot_quat_get_w(const godot_quat *p_self) { + const Quat *self = (const Quat *)p_self; + return self->w; +} + +void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val) { + Quat *self = (Quat *)p_self; + self->w = val; +} + godot_string GDAPI godot_quat_as_string(const godot_quat *p_self) { godot_string ret; const Quat *self = (const Quat *)p_self; diff --git a/modules/gdnative/godot/godot_quat.h b/modules/gdnative/godot/godot_quat.h index 6bdc33accf..2289b6cbab 100644 --- a/modules/gdnative/godot/godot_quat.h +++ b/modules/gdnative/godot/godot_quat.h @@ -49,6 +49,18 @@ typedef struct godot_quat { void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w); void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle); +godot_real GDAPI godot_quat_get_x(const godot_quat *p_self); +void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val); + +godot_real GDAPI godot_quat_get_y(const godot_quat *p_self); +void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val); + +godot_real GDAPI godot_quat_get_z(const godot_quat *p_self); +void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val); + +godot_real GDAPI godot_quat_get_w(const godot_quat *p_self); +void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val); + godot_string GDAPI godot_quat_as_string(const godot_quat *p_self); godot_real GDAPI godot_quat_length(const godot_quat *p_self); diff --git a/modules/gdnative/godot/godot_rect2.cpp b/modules/gdnative/godot/godot_rect2.cpp index eea95ca6fe..0e456ea3ba 100644 --- a/modules/gdnative/godot/godot_rect2.cpp +++ b/modules/gdnative/godot/godot_rect2.cpp @@ -38,11 +38,11 @@ extern "C" { void _rect2_api_anchor() {} -void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) { - const Vector2 *pos = (const Vector2 *)p_pos; +void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size) { + const Vector2 *position = (const Vector2 *)p_pos; const Vector2 *size = (const Vector2 *)p_size; Rect2 *dest = (Rect2 *)r_dest; - *dest = Rect2(*pos, *size); + *dest = Rect2(*position, *size); } void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height) { @@ -124,11 +124,11 @@ godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const god return *self == *b; } -godot_vector2 GDAPI godot_rect2_get_pos(const godot_rect2 *p_self) { +godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self) { godot_vector2 dest; Vector2 *d = (Vector2 *)&dest; const Rect2 *self = (const Rect2 *)p_self; - *d = self->get_pos(); + *d = self->get_position(); return dest; } @@ -140,10 +140,10 @@ godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self) { return dest; } -void GDAPI godot_rect2_set_pos(godot_rect2 *p_self, const godot_vector2 *p_pos) { +void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos) { Rect2 *self = (Rect2 *)p_self; - const Vector2 *pos = (const Vector2 *)p_pos; - self->set_pos(*pos); + const Vector2 *position = (const Vector2 *)p_pos; + self->set_position(*position); } void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size) { diff --git a/modules/gdnative/godot/godot_rect2.h b/modules/gdnative/godot/godot_rect2.h index 9743321a3b..488a1204f7 100644 --- a/modules/gdnative/godot/godot_rect2.h +++ b/modules/gdnative/godot/godot_rect2.h @@ -46,7 +46,7 @@ typedef struct godot_rect2 { #include "../godot.h" #include "godot_vector2.h" -void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); +void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height); godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self); @@ -71,11 +71,11 @@ godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vect godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b); -godot_vector2 GDAPI godot_rect2_get_pos(const godot_rect2 *p_self); +godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self); godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self); -void GDAPI godot_rect2_set_pos(godot_rect2 *p_self, const godot_vector2 *p_pos); +void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos); void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size); diff --git a/modules/gdnative/godot/godot_rect3.cpp b/modules/gdnative/godot/godot_rect3.cpp index c4f8a853c2..e524fa8463 100644 --- a/modules/gdnative/godot/godot_rect3.cpp +++ b/modules/gdnative/godot/godot_rect3.cpp @@ -45,6 +45,34 @@ void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, cons *dest = Rect3(*pos, *size); } +godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self) { + godot_vector3 raw_ret; + const Rect3 *self = (const Rect3 *)p_self; + Vector3 *ret = (Vector3 *)&raw_ret; + *ret = self->position; + return raw_ret; +} + +void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v) { + Rect3 *self = (Rect3 *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->position = *v; +} + +godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) { + godot_vector3 raw_ret; + const Rect3 *self = (const Rect3 *)p_self; + Vector3 *ret = (Vector3 *)&raw_ret; + *ret = self->size; + return raw_ret; +} + +void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v) { + Rect3 *self = (Rect3 *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->size = *v; +} + godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) { godot_string ret; const Rect3 *self = (const Rect3 *)p_self; diff --git a/modules/gdnative/godot/godot_rect3.h b/modules/gdnative/godot/godot_rect3.h index 95969ab20e..9e9a49ac27 100644 --- a/modules/gdnative/godot/godot_rect3.h +++ b/modules/gdnative/godot/godot_rect3.h @@ -49,6 +49,12 @@ typedef struct godot_rect3 { void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); +godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self); +void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v); + +godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self); +void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v); + godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self); godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self); diff --git a/modules/gdnative/godot/godot_string.cpp b/modules/gdnative/godot/godot_string.cpp index 59d20c6d23..679011e715 100644 --- a/modules/gdnative/godot/godot_string.cpp +++ b/modules/gdnative/godot/godot_string.cpp @@ -41,81 +41,75 @@ extern "C" { 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(godot_string *r_dest) { + String *dest = (String *)r_dest; + memnew_placement(dest, String); } -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_new_copy(godot_string *r_dest, const godot_string *p_src) { + String *dest = (String *)r_dest; + const String *src = (const String *)p_src; + memnew_placement(dest, String(*src)); } -void GDAPI godot_string_new_unicode_data(godot_string *p_str, const wchar_t *p_contents, const int p_size) { - String *p = (String *)p_str; - memnew_placement(p, String); - *p = String(p_contents, p_size); +void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size) { + String *dest = (String *)r_dest; + memnew_placement(dest, String(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; +void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size) { + String *dest = (String *)r_dest; + memnew_placement(dest, String(p_contents, p_size)); +} + +void GDAPI godot_string_get_data(const godot_string *p_self, char *r_dest, int *p_size) { + String *self = (String *)p_self; if (p_size != NULL) { - *p_size = p->utf8().length(); + *p_size = self->utf8().length(); } - if (p_dest != NULL) { - memcpy(p_dest, p->utf8().get_data(), *p_size); + if (r_dest != NULL) { + memcpy(r_dest, self->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)); +wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx) { + String *self = (String *)p_self; + return &(self->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 char GDAPI *godot_string_c_str(const godot_string *p_self) { + const String *self = (const String *)p_self; + return self->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(); +const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self) { + const String *self = (const String *)p_self; + return self->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_equal(const godot_string *p_self, const godot_string *p_b) { + const String *self = (const String *)p_self; + const String *b = (const String *)p_b; + return *self == *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; +godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b) { + const String *self = (const String *)p_self; + const String *b = (const String *)p_b; + return *self < *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; +godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b) { + godot_string ret; + const String *self = (const String *)p_self; + const String *b = (const String *)p_b; + memnew_placement(&ret, String(*self + *b)); + return ret; } -void GDAPI godot_string_destroy(godot_string *p_str) { - String *p = (String *)p_str; - p->~String(); +void GDAPI godot_string_destroy(godot_string *p_self) { + String *self = (String *)p_self; + self->~String(); } #ifdef __cplusplus diff --git a/modules/gdnative/godot/godot_string.h b/modules/gdnative/godot/godot_string.h index e0ba298a9c..df848abb76 100644 --- a/modules/gdnative/godot/godot_string.h +++ b/modules/gdnative/godot/godot_string.h @@ -45,27 +45,26 @@ typedef struct godot_string { #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_new_unicode_data(godot_string *p_str, const wchar_t *p_contents, const int p_size); +void GDAPI godot_string_new(godot_string *r_dest); +void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); +void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size); +void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *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_get_data(const godot_string *p_self, 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_self, const godot_int p_idx); +const char GDAPI *godot_string_c_str(const godot_string *p_self); +const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self); -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); +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b); +godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b); +godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, 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); +void GDAPI godot_string_destroy(godot_string *p_self); #ifdef __cplusplus } diff --git a/modules/gdnative/godot/godot_transform.cpp b/modules/gdnative/godot/godot_transform.cpp index f5a012f59c..eb9e1e207b 100644 --- a/modules/gdnative/godot/godot_transform.cpp +++ b/modules/gdnative/godot/godot_transform.cpp @@ -57,6 +57,32 @@ void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_bas *dest = Transform(*basis, *origin); } +godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self) { + godot_basis dest; + const Transform *self = (const Transform *)p_self; + *((Basis *)&dest) = self->basis; + return dest; +} + +void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v) { + Transform *self = (Transform *)p_self; + const Basis *v = (const Basis *)p_v; + self->basis = *v; +} + +godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self) { + godot_vector3 dest; + const Transform *self = (const Transform *)p_self; + *((Vector3 *)&dest) = self->origin; + return dest; +} + +void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v) { + Transform *self = (Transform *)p_self; + const Vector3 *v = (const Vector3 *)p_v; + self->origin = *v; +} + godot_string GDAPI godot_transform_as_string(const godot_transform *p_self) { godot_string ret; const Transform *self = (const Transform *)p_self; diff --git a/modules/gdnative/godot/godot_transform.h b/modules/gdnative/godot/godot_transform.h index b15efc23b8..ee87e1d33f 100644 --- a/modules/gdnative/godot/godot_transform.h +++ b/modules/gdnative/godot/godot_transform.h @@ -51,6 +51,12 @@ typedef struct godot_transform { void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin); void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); +godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self); +void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v); + +godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self); +void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v); + godot_string GDAPI godot_transform_as_string(const godot_transform *p_self); godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self); diff --git a/modules/gdnative/godot/godot_variant.cpp b/modules/gdnative/godot/godot_variant.cpp index 9381fb86d3..c9607fb21a 100644 --- a/modules/gdnative/godot/godot_variant.cpp +++ b/modules/gdnative/godot/godot_variant.cpp @@ -45,10 +45,10 @@ godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_self) { return (godot_variant_type)self->get_type(); } -void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src) { +void GDAPI godot_variant_new_copy(godot_variant *p_dest, const godot_variant *p_src) { Variant *dest = (Variant *)p_dest; Variant *src = (Variant *)p_src; - *dest = *src; + memnew_placement(dest, Variant(*src)); } void GDAPI godot_variant_new_nil(godot_variant *r_dest) { diff --git a/modules/gdnative/godot/godot_variant.h b/modules/gdnative/godot/godot_variant.h index d46b87c41b..9b6d287249 100644 --- a/modules/gdnative/godot/godot_variant.h +++ b/modules/gdnative/godot/godot_variant.h @@ -68,7 +68,6 @@ typedef enum godot_variant_type { GODOT_VARIANT_TYPE_NODE_PATH, // 15 GODOT_VARIANT_TYPE_RID, GODOT_VARIANT_TYPE_OBJECT, - GODOT_VARIANT_TYPE_INPUT_EVENT, // TODO: remove me once input_event is removed from main Godot codebase GODOT_VARIANT_TYPE_DICTIONARY, GODOT_VARIANT_TYPE_ARRAY, // 20 @@ -119,7 +118,7 @@ typedef struct godot_variant_call_error { godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v); -void GDAPI godot_variant_copy(godot_variant *r_dest, const godot_variant *p_src); +void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src); void GDAPI godot_variant_new_nil(godot_variant *r_dest); diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index d1f54e021f..9d3da8227c 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -1057,12 +1057,12 @@ Error GridMap::create_area(int p_id, const Rect3 &p_bounds) { // FIRST VALIDATE AREA IndexKey from, to; - from.x = p_bounds.pos.x; - from.y = p_bounds.pos.y; - from.z = p_bounds.pos.z; - to.x = p_bounds.pos.x + p_bounds.size.x; - to.y = p_bounds.pos.y + p_bounds.size.y; - to.z = p_bounds.pos.z + p_bounds.size.z; + from.x = p_bounds.position.x; + from.y = p_bounds.position.y; + from.z = p_bounds.position.z; + to.x = p_bounds.position.x + p_bounds.size.x; + to.y = p_bounds.position.y + p_bounds.size.y; + to.z = p_bounds.position.z + p_bounds.size.z; for (Map<int, Area *>::Element *E = area_map.front(); E; E = E->next()) { //this should somehow be faster... @@ -1101,8 +1101,8 @@ Rect3 GridMap::area_get_bounds(int p_area) const { const Area *a = area_map[p_area]; Rect3 aabb; - aabb.pos = Vector3(a->from.x, a->from.y, a->from.z); - aabb.size = Vector3(a->to.x, a->to.y, a->to.z) - aabb.pos; + aabb.position = Vector3(a->from.x, a->from.y, a->from.z); + aabb.size = Vector3(a->to.x, a->to.y, a->to.z) - aabb.position; return aabb; } diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp index e567e08c79..954e865bcd 100644 --- a/modules/gridmap/grid_map_editor_plugin.cpp +++ b/modules/gridmap/grid_map_editor_plugin.cpp @@ -560,7 +560,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu else return false; - return do_input_action(p_camera, Point2(mb->get_pos().x, mb->get_pos().y), true); + return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true); } else { if ( @@ -604,7 +604,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu if (mm.is_valid()) { - return do_input_action(p_camera, mm->get_pos(), false); + return do_input_action(p_camera, mm->get_position(), false); } } else if (edit_mode->get_selected() == 1) { @@ -616,7 +616,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) { - Point2 point = mb->get_pos(); + Point2 point = mb->get_position(); Camera *camera = p_camera; Vector3 from = camera->project_ray_origin(point); @@ -635,7 +635,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera *p_camera, const Ref<Inpu int area = E->get(); Rect3 aabb = node->area_get_bounds(area); - aabb.pos *= node->get_cell_size(); + aabb.position *= node->get_cell_size(); aabb.size *= node->get_cell_size(); Vector3 rclip, rnormal; diff --git a/modules/hdr/image_loader_hdr.cpp b/modules/hdr/image_loader_hdr.cpp index 85819104cf..19df27b962 100644 --- a/modules/hdr/image_loader_hdr.cpp +++ b/modules/hdr/image_loader_hdr.cpp @@ -131,7 +131,7 @@ Error ImageLoaderHDR::load_image(Ref<Image> p_image, FileAccess *f, bool p_force //convert for (int i = 0; i < width * height; i++) { - float exp = pow(2, ptr[3] - 128); + float exp = pow(2.0f, ptr[3] - 128.0f); Color c( ptr[0] * exp / 255.0, diff --git a/modules/hdr/image_loader_hdr.h b/modules/hdr/image_loader_hdr.h index 9bc1fadd13..127833ebd0 100644 --- a/modules/hdr/image_loader_hdr.h +++ b/modules/hdr/image_loader_hdr.h @@ -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 IMAGE_LOADER_TINYEXR_H -#define IMAGE_LOADER_TINYEXR_H +#ifndef IMAGE_LOADER_HDR_H +#define IMAGE_LOADER_HDR_H #include "io/image_loader.h" diff --git a/modules/squish/image_compress_squish.cpp b/modules/squish/image_compress_squish.cpp index efed0b8665..32772e0cd2 100644 --- a/modules/squish/image_compress_squish.cpp +++ b/modules/squish/image_compress_squish.cpp @@ -64,6 +64,7 @@ void image_decompress_squish(Image *p_image) { } else if (p_image->get_format() == Image::FORMAT_RGTC_RG) { squish_flags = squish::kBc5; } else { + print_line("wtf askd to decompress.. " + itos(p_image->get_format())); ERR_FAIL_COND(true); return; } @@ -153,8 +154,8 @@ void image_compress_squish(Image *p_image, bool p_srgb) { int bh = h % 4 != 0 ? h + (4 - h % 4) : h; int src_ofs = p_image->get_mipmap_offset(i); - squish::CompressImage(&rb[src_ofs], bw, bh, &wb[dst_ofs], squish_comp); - dst_ofs += (MAX(4, w) * MAX(4, h)) >> shift; + squish::CompressImage(&rb[src_ofs], w, h, &wb[dst_ofs], squish_comp); + dst_ofs += (MAX(4, bw) * MAX(4, bh)) >> shift; w >>= 1; h >>= 1; } diff --git a/modules/tga/SCsub b/modules/tga/SCsub new file mode 100644 index 0000000000..7e405f405c --- /dev/null +++ b/modules/tga/SCsub @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +Import('env') +Import('env_modules') + +env_tga = env_modules.Clone() + +# Godot's own source files +env_tga.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/tga/config.py b/modules/tga/config.py new file mode 100644 index 0000000000..fb920482f5 --- /dev/null +++ b/modules/tga/config.py @@ -0,0 +1,7 @@ + +def can_build(platform): + return True + + +def configure(env): + pass diff --git a/modules/tga/image_loader_tga.cpp b/modules/tga/image_loader_tga.cpp new file mode 100644 index 0000000000..5b8610b975 --- /dev/null +++ b/modules/tga/image_loader_tga.cpp @@ -0,0 +1,314 @@ +/*************************************************************************/ +/* image_loader_jpegd.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 "image_loader_tga.h" + +#include "os/os.h" +#include "print_string.h" + +Error ImageLoaderTGA::decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size) { + Error error; + + PoolVector<uint8_t> pixels; + error = pixels.resize(p_pixel_size); + if (error != OK) + return error; + + PoolVector<uint8_t>::Write pixels_w = pixels.write(); + + size_t compressed_pos = 0; + size_t output_pos = 0; + size_t c = 0; + size_t count = 0; + + while (output_pos < p_output_size) { + c = p_compressed_buffer[compressed_pos]; + compressed_pos += 1; + count = (c & 0x7f) + 1; + + if (c & 0x80) { + for (int i = 0; i < p_pixel_size; i++) { + pixels_w.ptr()[i] = p_compressed_buffer[compressed_pos]; + compressed_pos += 1; + } + for (int i = 0; i < count; i++) { + for (int j = 0; j < p_pixel_size; j++) { + p_uncompressed_buffer[output_pos + j] = pixels_w.ptr()[j]; + } + output_pos += p_pixel_size; + } + } else { + count *= p_pixel_size; + for (int i = 0; i < count; i++) { + p_uncompressed_buffer[output_pos] = p_compressed_buffer[compressed_pos]; + compressed_pos += 1; + output_pos += 1; + } + } + } + return OK; +} + +Error ImageLoaderTGA::convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome) { + +#define TGA_PUT_PIXEL(r, g, b, a) \ + int image_data_ofs = ((y * width) + x); \ + image_data_w[image_data_ofs * 4 + 0] = r; \ + image_data_w[image_data_ofs * 4 + 1] = g; \ + image_data_w[image_data_ofs * 4 + 2] = b; \ + image_data_w[image_data_ofs * 4 + 3] = a; + + uint32_t width = p_header.image_width; + uint32_t height = p_header.image_height; + tga_origin_e origin = static_cast<tga_origin_e>((p_header.image_descriptor & TGA_ORIGIN_MASK) >> TGA_ORIGIN_SHIFT); + + uint32_t x_start; + int32_t x_step; + uint32_t x_end; + uint32_t y_start; + int32_t y_step; + uint32_t y_end; + + if (origin == TGA_ORIGIN_TOP_LEFT || origin == TGA_ORIGIN_TOP_RIGHT) { + y_start = 0; + y_step = 1; + y_end = height; + } else { + y_start = height - 1; + y_step = -1; + y_end = -1; + } + + if (origin == TGA_ORIGIN_TOP_LEFT || origin == TGA_ORIGIN_BOTTOM_LEFT) { + x_start = 0; + x_step = 1; + x_end = width; + } else { + x_start = width - 1; + x_step = -1; + x_end = -1; + } + + PoolVector<uint8_t> image_data; + image_data.resize(width * height * sizeof(uint32_t)); + PoolVector<uint8_t>::Write image_data_w = image_data.write(); + + size_t i = 0; + uint32_t x = x_start; + uint32_t y = y_start; + + if (p_header.pixel_depth == 8) { + if (p_is_monochrome) { + while (y != y_end) { + while (x != x_end) { + uint8_t shade = p_buffer[i]; + + TGA_PUT_PIXEL(shade, shade, shade, 0xff) + + x += x_step; + i += 1; + } + x = x_start; + y += y_step; + } + } else { + while (y != y_end) { + while (x != x_end) { + uint8_t index = p_buffer[i]; + uint8_t r = 0x00; + uint8_t g = 0x00; + uint8_t b = 0x00; + uint8_t a = 0xff; + + if (p_header.color_map_depth == 24) { + r = (p_palette[(index * 3) + 0]); + g = (p_palette[(index * 3) + 1]); + b = (p_palette[(index * 3) + 2]); + } else { + return ERR_INVALID_DATA; + } + + TGA_PUT_PIXEL(r, g, b, a) + + x += x_step; + i += 1; + } + x = x_start; + y += y_step; + } + } + } else if (p_header.pixel_depth == 24) { + while (y != y_end) { + while (x != x_end) { + uint8_t r = p_buffer[i + 2]; + uint8_t g = p_buffer[i + 1]; + uint8_t b = p_buffer[i + 0]; + + TGA_PUT_PIXEL(r, g, b, 0xff) + + x += x_step; + i += 3; + } + x = x_start; + y += y_step; + } + } else if (p_header.pixel_depth == 32) { + while (y != y_end) { + while (x != x_end) { + uint8_t a = p_buffer[i + 3]; + uint8_t r = p_buffer[i + 2]; + uint8_t g = p_buffer[i + 1]; + uint8_t b = p_buffer[i + 0]; + + TGA_PUT_PIXEL(r, g, b, a) + + x += x_step; + i += 4; + } + x = x_start; + y += y_step; + } + } + + image_data_w = PoolVector<uint8_t>::Write(); + + p_image->create(width, height, 0, Image::FORMAT_RGBA8, image_data); + + return OK; +} + +Error ImageLoaderTGA::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear) { + + PoolVector<uint8_t> src_image; + int src_image_len = f->get_len(); + ERR_FAIL_COND_V(src_image_len == 0, ERR_FILE_CORRUPT); + ERR_FAIL_COND_V(src_image_len < sizeof(tga_header_s), ERR_FILE_CORRUPT); + src_image.resize(src_image_len); + + Error err = OK; + + tga_header_s tga_header; + tga_header.id_length = f->get_8(); + tga_header.color_map_type = f->get_8(); + tga_header.image_type = static_cast<tga_type_e>(f->get_8()); + + tga_header.first_color_entry = f->get_16(); + tga_header.color_map_length = f->get_16(); + tga_header.color_map_depth = f->get_8(); + + tga_header.x_origin = f->get_16(); + tga_header.y_origin = f->get_16(); + tga_header.image_width = f->get_16(); + tga_header.image_height = f->get_16(); + tga_header.pixel_depth = f->get_8(); + tga_header.image_descriptor = f->get_8(); + + bool is_encoded = (tga_header.image_type == TGA_TYPE_RLE_INDEXED || tga_header.image_type == TGA_TYPE_RLE_RGB || tga_header.image_type == TGA_TYPE_RLE_MONOCHROME); + bool has_color_map = (tga_header.image_type == TGA_TYPE_RLE_INDEXED || tga_header.image_type == TGA_TYPE_INDEXED); + bool is_monochrome = (tga_header.image_type == TGA_TYPE_RLE_MONOCHROME || tga_header.image_type == TGA_TYPE_MONOCHROME); + + if (tga_header.image_type == TGA_TYPE_NO_DATA) + err = FAILED; + + if (has_color_map) { + if (tga_header.color_map_length > 256 || (tga_header.color_map_depth != 24) || tga_header.color_map_type != 1) { + err = FAILED; + } + } else { + if (tga_header.color_map_type) { + err = FAILED; + } + } + + if (tga_header.image_width <= 0 || tga_header.image_height <= 0) + err = FAILED; + + if (tga_header.pixel_depth != 8 && tga_header.pixel_depth != 24 && tga_header.pixel_depth != 32) + err = FAILED; + + if (err == OK) { + f->seek(f->get_pos() + tga_header.id_length); + + PoolVector<uint8_t> palette; + + if (has_color_map) { + size_t color_map_size = tga_header.color_map_length * (tga_header.color_map_depth >> 3); + err = palette.resize(color_map_size); + if (err == OK) { + PoolVector<uint8_t>::Write palette_w = palette.write(); + f->get_buffer(&palette_w[0], color_map_size); + } else { + return OK; + } + } + + PoolVector<uint8_t>::Write src_image_w = src_image.write(); + f->get_buffer(&src_image_w[0], src_image_len - f->get_pos()); + + PoolVector<uint8_t>::Read src_image_r = src_image.read(); + + const size_t pixel_size = tga_header.pixel_depth >> 3; + const size_t buffer_size = (tga_header.image_width * tga_header.image_height) * pixel_size; + + PoolVector<uint8_t> uncompressed_buffer; + uncompressed_buffer.resize(buffer_size); + PoolVector<uint8_t>::Write uncompressed_buffer_w = uncompressed_buffer.write(); + PoolVector<uint8_t>::Read uncompressed_buffer_r; + + const uint8_t *buffer = NULL; + + if (is_encoded) { + + err = decode_tga_rle(src_image_r.ptr(), pixel_size, uncompressed_buffer_w.ptr(), buffer_size); + + if (err == OK) { + uncompressed_buffer_r = uncompressed_buffer.read(); + buffer = uncompressed_buffer_r.ptr(); + } + } else { + buffer = src_image_r.ptr(); + }; + + if (err == OK) { + PoolVector<uint8_t>::Read palette_r = palette.read(); + err = convert_to_image(p_image, buffer, tga_header, palette_r.ptr(), is_monochrome); + } + } + + f->close(); + return err; +} + +void ImageLoaderTGA::get_recognized_extensions(List<String> *p_extensions) const { + + p_extensions->push_back("tga"); +} + +ImageLoaderTGA::ImageLoaderTGA() { +} diff --git a/modules/tga/image_loader_tga.h b/modules/tga/image_loader_tga.h new file mode 100644 index 0000000000..11329ec68a --- /dev/null +++ b/modules/tga/image_loader_tga.h @@ -0,0 +1,83 @@ +/*************************************************************************/ +/* image_loader_jpegd.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 IMAGE_LOADER_TGA_H +#define IMAGE_LOADER_TGA_H + +#include "io/image_loader.h" + +/** + @author SaracenOne +*/ +class ImageLoaderTGA : public ImageFormatLoader { + enum tga_type_e { + TGA_TYPE_NO_DATA = 0, + TGA_TYPE_INDEXED = 1, + TGA_TYPE_RGB = 2, + TGA_TYPE_MONOCHROME = 3, + TGA_TYPE_RLE_INDEXED = 9, + TGA_TYPE_RLE_RGB = 10, + TGA_TYPE_RLE_MONOCHROME = 11 + }; + + enum tga_origin_e { + TGA_ORIGIN_BOTTOM_LEFT = 0x00, + TGA_ORIGIN_BOTTOM_RIGHT = 0x01, + TGA_ORIGIN_TOP_LEFT = 0x02, + TGA_ORIGIN_TOP_RIGHT = 0x03, + TGA_ORIGIN_SHIFT = 0x04, + TGA_ORIGIN_MASK = 0x30 + }; + + struct tga_header_s { + uint8_t id_length; + uint8_t color_map_type; + tga_type_e image_type; + + uint16_t first_color_entry; + uint16_t color_map_length; + uint8_t color_map_depth; + + uint16_t x_origin; + uint16_t y_origin; + uint16_t image_width; + uint16_t image_height; + uint8_t pixel_depth; + uint8_t image_descriptor; + }; + static Error decode_tga_rle(const uint8_t *p_compressed_buffer, size_t p_pixel_size, uint8_t *p_uncompressed_buffer, size_t p_output_size); + static Error convert_to_image(Ref<Image> p_image, const uint8_t *p_buffer, const tga_header_s &p_header, const uint8_t *p_palette, const bool p_is_monochrome); + +public: + virtual Error load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear); + virtual void get_recognized_extensions(List<String> *p_extensions) const; + ImageLoaderTGA(); +}; + +#endif diff --git a/modules/tga/register_types.cpp b/modules/tga/register_types.cpp new file mode 100644 index 0000000000..6e120fa3bf --- /dev/null +++ b/modules/tga/register_types.cpp @@ -0,0 +1,45 @@ +/*************************************************************************/ +/* 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 "image_loader_tga.h" + +static ImageLoaderTGA *image_loader_tga = NULL; + +void register_tga_types() { + + image_loader_tga = memnew(ImageLoaderTGA); + ImageLoader::add_image_format_loader(image_loader_tga); +} + +void unregister_tga_types() { + + memdelete(image_loader_tga); +} diff --git a/modules/tga/register_types.h b/modules/tga/register_types.h new file mode 100644 index 0000000000..079b7bf291 --- /dev/null +++ b/modules/tga/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_tga_types(); +void unregister_tga_types(); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 5839bc9243..941668d474 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1011,7 +1011,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_position(members->get_global_position() + pos.pos + Vector2(0, pos.size.y)); + new_function_menu->set_position(members->get_global_position() + pos.position + Vector2(0, pos.size.y)); new_function_menu->popup(); return; } else if (p_button == 0) { @@ -2240,6 +2240,10 @@ void VisualScriptEditor::add_callback(const String &p_function, PoolStringArray //undo_redo->clear_history(); } +bool VisualScriptEditor::show_members_overview() { + return false; +} + void VisualScriptEditor::update_settings() { _update_graph(); diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index bb832431a0..92f31f20da 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -248,6 +248,7 @@ public: virtual void get_breakpoints(List<int> *p_breakpoints); virtual void add_callback(const String &p_function, PoolStringArray p_args); virtual void update_settings(); + virtual bool show_members_overview(); virtual void set_debugger_active(bool p_active); virtual void set_tooltip_request_func(String p_method, Object *p_obj); virtual Control *get_edit_menu(); |