Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GDNative] Add missing join method for PoolStringArray class #55826

Merged
merged 1 commit into from
Jul 2, 2022

Conversation

kdiduk
Copy link
Contributor

@kdiduk kdiduk commented Dec 11, 2021

The class PoolStringArray in GDScript has join method, and it even has documentation.
However, the corresponding definition of this method in GDNative headers were missing.

In this PR, the missing GDNative definition of join method has been added to the corresponding source files.

This PR fixes #53116

@kdiduk kdiduk requested a review from a team as a code owner December 11, 2021 15:30
@YeldhamDev YeldhamDev added this to the 3.5 milestone Dec 11, 2021
@YeldhamDev YeldhamDev linked an issue Dec 11, 2021 that may be closed by this pull request
Comment on lines 2100 to 2107
{
"name": "godot_pool_string_array_join",
"return_type": "godot_string",
"arguments": [
["godot_pool_string_array *", "p_self"],
["const godot_string *", "p_delimiter"]
]
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Could you also check this PR: #55650 ? I guess I need to do the same there?..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've updated gdnative_api.json. I've added new CORE API 1.3 and put newly added method within it.

Please, review 🙂

@kdiduk kdiduk force-pushed the gdnative-poolstringarray-join branch from 5dafc2c to b67a36a Compare June 8, 2022 12:01
…ay class

The class PoolStringArray in GDScript has `join` method, and it even has documentation.
However, the corresponding definition of this method in GDNative headers were missing.

In this commit, the missing GDNative definition of `join` method has been added.
A new CORE API version 1.3 has been added with the new metod `join`.
@kdiduk kdiduk force-pushed the gdnative-poolstringarray-join branch from b67a36a to bf60d65 Compare June 8, 2022 13:00
@akien-mga akien-mga requested a review from a team June 10, 2022 12:33
@akien-mga
Copy link
Member

Looks good to me overall. I'm not super familiar with GDNative so I don't know all the consequences of opening up a new CORE API. Would be good if @BastiaanOlij or other folks familiar with GDNative could have a look.

If we do decide to add this as CORE API 1.3, we should merge this soon before the 3.5-stable release, so that this 1.3 API can match the 3.5 Godot release.

There might also be more core type methods which have been added to the engine but not exposed to GDNative. If we do open up CORE API 1.3 for 3.5, we might as well want to make sure that we include those other missing methods.

One such example is Dictionary.merge() which I cherry-picked yesterday, but did not add to GDNative: #59883

@akien-mga
Copy link
Member

So I finally went through the list of all Variant methods in core/variant_call.cpp to see what is missing in the GDNative headers.

Here's the full list of methods in core/variant_call.cpp formatted to be grep-able in GDNative headers:

All Variant methods (minus constructors and operators)
godot_string_casecmp_to
godot_string_nocasecmp_to
godot_string_naturalnocasecmp_to
godot_string_length
godot_string_count
godot_string_countn
godot_string_substr
godot_string_get_slice
godot_string_find
godot_string_find_last
godot_string_findn
godot_string_rfind
godot_string_rfindn
godot_string_match
godot_string_matchn
godot_string_begins_with
godot_string_ends_with
godot_string_is_subsequence_of
godot_string_is_subsequence_ofi
godot_string_bigrams
godot_string_similarity
godot_string_format
godot_string_replace
godot_string_replacen
godot_string_repeat
godot_string_insert
godot_string_capitalize
godot_string_split
godot_string_rsplit
godot_string_split_floats
godot_string_join
godot_string_to_upper
godot_string_to_lower
godot_string_left
godot_string_right
godot_string_indent
godot_string_dedent
godot_string_strip_edges
godot_string_strip_escapes
godot_string_lstrip
godot_string_rstrip
godot_string_get_extension
godot_string_get_basename
godot_string_plus_file
godot_string_ord_at
godot_string_erase
godot_string_hash
godot_string_md5_text
godot_string_sha1_text
godot_string_sha256_text
godot_string_md5_buffer
godot_string_sha1_buffer
godot_string_sha256_buffer
godot_string_empty
godot_string_humanize_size
godot_string_is_abs_path
godot_string_simplify_path
godot_string_is_rel_path
godot_string_get_base_dir
godot_string_get_file
godot_string_xml_escape
godot_string_xml_unescape
godot_string_http_escape
godot_string_http_unescape
godot_string_c_escape
godot_string_c_unescape
godot_string_json_escape
godot_string_percent_encode
godot_string_percent_decode
godot_string_validate_node_name
godot_string_is_valid_identifier
godot_string_is_valid_integer
godot_string_is_valid_float
godot_string_is_valid_hex_number
godot_string_is_valid_html_color
godot_string_is_valid_ip_address
godot_string_is_valid_filename
godot_string_to_int
godot_string_to_float
godot_string_hex_to_int
godot_string_pad_decimals
godot_string_pad_zeros
godot_string_trim_prefix
godot_string_trim_suffix
godot_string_to_ascii
godot_string_to_utf8
godot_string_to_wchar

godot_vector2_distance_to
godot_vector2_distance_squared_to
godot_vector2_length
godot_vector2_length_squared
godot_vector2_normalized
godot_vector2_is_normalized
godot_vector2_is_equal_approx
godot_vector2_posmod
godot_vector2_posmodv
godot_vector2_project
godot_vector2_angle_to
godot_vector2_angle_to_point
godot_vector2_direction_to
godot_vector2_linear_interpolate
godot_vector2_slerp
godot_vector2_cubic_interpolate
godot_vector2_move_toward
godot_vector2_rotated
godot_vector2_tangent
godot_vector2_floor
godot_vector2_ceil
godot_vector2_round
godot_vector2_snapped
godot_vector2_aspect
godot_vector2_dot
godot_vector2_slide
godot_vector2_bounce
godot_vector2_reflect
godot_vector2_angle
godot_vector2_cross
godot_vector2_abs
godot_vector2_clamped
godot_vector2_limit_length
godot_vector2_sign

godot_rect2_get_area
godot_rect2_get_center
godot_rect2_has_no_area
godot_rect2_has_point
godot_rect2_is_equal_approx
godot_rect2_intersects
godot_rect2_encloses
godot_rect2_clip
godot_rect2_merge
godot_rect2_expand
godot_rect2_grow
godot_rect2_grow_margin
godot_rect2_grow_individual
godot_rect2_abs

godot_vector3_min_axis
godot_vector3_max_axis
godot_vector3_distance_to
godot_vector3_distance_squared_to
godot_vector3_length
godot_vector3_length_squared
godot_vector3_normalized
godot_vector3_is_normalized
godot_vector3_is_equal_approx
godot_vector3_inverse
godot_vector3_snapped
godot_vector3_rotated
godot_vector3_linear_interpolate
godot_vector3_slerp
godot_vector3_cubic_interpolate
godot_vector3_move_toward
godot_vector3_dot
godot_vector3_cross
godot_vector3_outer
godot_vector3_to_diagonal_matrix
godot_vector3_abs
godot_vector3_floor
godot_vector3_ceil
godot_vector3_round
godot_vector3_posmod
godot_vector3_posmodv
godot_vector3_project
godot_vector3_angle_to
godot_vector3_signed_angle_to
godot_vector3_direction_to
godot_vector3_slide
godot_vector3_bounce
godot_vector3_reflect
godot_vector3_limit_length
godot_vector3_sign

godot_plane_normalized
godot_plane_center
godot_plane_get_any_point
godot_plane_is_equal_approx
godot_plane_is_point_over
godot_plane_distance_to
godot_plane_has_point
godot_plane_project
godot_plane_intersect_3
godot_plane_intersects_ray
godot_plane_intersects_segment

godot_quat_length
godot_quat_length_squared
godot_quat_normalized
godot_quat_is_normalized
godot_quat_is_equal_approx
godot_quat_inverse
godot_quat_angle_to
godot_quat_dot
godot_quat_xform
godot_quat_slerp
godot_quat_slerpni
godot_quat_cubic_slerp
godot_quat_get_euler
godot_quat_set_euler
godot_quat_set_axis_angle

godot_color_to_argb32
godot_color_to_abgr32
godot_color_to_rgba32
godot_color_to_argb64
godot_color_to_abgr64
godot_color_to_rgba64
godot_color_gray
godot_color_get_luminance
godot_color_inverted
godot_color_contrasted
godot_color_linear_interpolate
godot_color_blend
godot_color_lightened
godot_color_darkened
godot_color_to_html
godot_color_from_hsv
godot_color_is_equal_approx

godot_rid_get_id

godot_node_path_is_absolute
godot_node_path_get_name_count
godot_node_path_get_name
godot_node_path_get_subname_count
godot_node_path_get_subname
godot_node_path_get_concatenated_subnames
godot_node_path_get_as_property_path
godot_node_path_is_empty

godot_dictionary_size
godot_dictionary_empty
godot_dictionary_clear
godot_dictionary_merge
godot_dictionary_has
godot_dictionary_has_all
godot_dictionary_erase
godot_dictionary_hash
godot_dictionary_keys
godot_dictionary_values
godot_dictionary_duplicate
godot_dictionary_get

godot_pool_byte_array_get_string_from_ascii
godot_pool_byte_array_get_string_from_utf8
godot_pool_byte_array_compress
godot_pool_byte_array_decompress
godot_pool_byte_array_decompress_dynamic
godot_pool_byte_array_hex_encode

godot_pool_byte_array_size
godot_pool_byte_array_empty
godot_pool_byte_array_set
godot_pool_byte_array_get
godot_pool_byte_array_push_back
godot_pool_byte_array_fill
godot_pool_byte_array_resize
godot_pool_byte_array_insert
godot_pool_byte_array_remove
godot_pool_byte_array_append
godot_pool_byte_array_append_array
godot_pool_byte_array_invert
godot_pool_byte_array_subarray
godot_pool_byte_array_find
godot_pool_byte_array_rfind
godot_pool_byte_array_count
godot_pool_byte_array_has

godot_pool_int_array_size
godot_pool_int_array_empty
godot_pool_int_array_set
godot_pool_int_array_get
godot_pool_int_array_push_back
godot_pool_int_array_fill
godot_pool_int_array_resize
godot_pool_int_array_insert
godot_pool_int_array_remove
godot_pool_int_array_append
godot_pool_int_array_append_array
godot_pool_int_array_invert
godot_pool_int_array_find
godot_pool_int_array_rfind
godot_pool_int_array_count
godot_pool_int_array_has

godot_pool_real_array_size
godot_pool_real_array_empty
godot_pool_real_array_set
godot_pool_real_array_get
godot_pool_real_array_push_back
godot_pool_real_array_fill
godot_pool_real_array_resize
godot_pool_real_array_insert
godot_pool_real_array_remove
godot_pool_real_array_append
godot_pool_real_array_append_array
godot_pool_real_array_invert
godot_pool_real_array_find
godot_pool_real_array_rfind
godot_pool_real_array_count
godot_pool_real_array_has

godot_pool_string_array_size
godot_pool_string_array_empty
godot_pool_string_array_set
godot_pool_string_array_get
godot_pool_string_array_push_back
godot_pool_string_array_fill
godot_pool_string_array_resize
godot_pool_string_array_insert
godot_pool_string_array_remove
godot_pool_string_array_append
godot_pool_string_array_append_array
godot_pool_string_array_invert
godot_pool_string_array_join
godot_pool_string_array_find
godot_pool_string_array_rfind
godot_pool_string_array_count
godot_pool_string_array_has

godot_pool_vector2_array_size
godot_pool_vector2_array_empty
godot_pool_vector2_array_set
godot_pool_vector2_array_get
godot_pool_vector2_array_push_back
godot_pool_vector2_array_fill
godot_pool_vector2_array_resize
godot_pool_vector2_array_insert
godot_pool_vector2_array_remove
godot_pool_vector2_array_append
godot_pool_vector2_array_append_array
godot_pool_vector2_array_invert
godot_pool_vector2_array_find
godot_pool_vector2_array_rfind
godot_pool_vector2_array_count
godot_pool_vector2_array_has

godot_pool_vector3_array_size
godot_pool_vector3_array_empty
godot_pool_vector3_array_set
godot_pool_vector3_array_get
godot_pool_vector3_array_push_back
godot_pool_vector3_array_fill
godot_pool_vector3_array_resize
godot_pool_vector3_array_insert
godot_pool_vector3_array_remove
godot_pool_vector3_array_append
godot_pool_vector3_array_append_array
godot_pool_vector3_array_invert
godot_pool_vector3_array_find
godot_pool_vector3_array_rfind
godot_pool_vector3_array_count
godot_pool_vector3_array_has

godot_pool_color_array_size
godot_pool_color_array_empty
godot_pool_color_array_set
godot_pool_color_array_get
godot_pool_color_array_push_back
godot_pool_color_array_fill
godot_pool_color_array_resize
godot_pool_color_array_insert
godot_pool_color_array_remove
godot_pool_color_array_append
godot_pool_color_array_append_array
godot_pool_color_array_invert
godot_pool_color_array_find
godot_pool_color_array_rfind
godot_pool_color_array_count
godot_pool_color_array_has

godot_aabb_abs
godot_aabb_get_area
godot_aabb_get_center
godot_aabb_has_no_area
godot_aabb_has_no_surface
godot_aabb_has_point
godot_aabb_is_equal_approx
godot_aabb_intersects
godot_aabb_encloses
godot_aabb_intersects_plane
godot_aabb_intersects_segment
godot_aabb_intersection
godot_aabb_merge
godot_aabb_expand
godot_aabb_grow
godot_aabb_get_support
godot_aabb_get_longest_axis
godot_aabb_get_longest_axis_index
godot_aabb_get_longest_axis_size
godot_aabb_get_shortest_axis
godot_aabb_get_shortest_axis_index
godot_aabb_get_shortest_axis_size
godot_aabb_get_endpoint

godot_transform2d_inverse
godot_transform2d_affine_inverse
godot_transform2d_get_rotation
godot_transform2d_get_origin
godot_transform2d_get_scale
godot_transform2d_orthonormalized
godot_transform2d_rotated
godot_transform2d_scaled
godot_transform2d_translated
godot_transform2d_interpolate_with
godot_transform2d_is_equal_approx
godot_transform2d_xform
godot_transform2d_xform_inv
godot_transform2d_basis_xform
godot_transform2d_basis_xform_inv

godot_basis_inverse
godot_basis_transposed
godot_basis_determinant
godot_basis_rotated
godot_basis_scaled
godot_basis_get_scale
godot_basis_get_euler
godot_basis_get_euler_xyz
godot_basis_set_euler_xyz
godot_basis_get_euler_xzy
godot_basis_set_euler_xzy
godot_basis_get_euler_yzx
godot_basis_set_euler_yzx
godot_basis_get_euler_yxz
godot_basis_set_euler_yxz
godot_basis_get_euler_zxy
godot_basis_set_euler_zxy
godot_basis_get_euler_zyx
godot_basis_set_euler_zyx
godot_basis_tdotx
godot_basis_tdoty
godot_basis_tdotz
godot_basis_xform
godot_basis_xform_inv
godot_basis_get_orthogonal_index
godot_basis_orthonormalized
godot_basis_slerp
godot_basis_is_equal_approx
godot_basis_get_rotation_quat

godot_transform_inverse
godot_transform_affine_inverse
godot_transform_rotated
godot_transform_scaled
godot_transform_translated
godot_transform_orthonormalized
godot_transform_looking_at
godot_transform_interpolate_with
godot_transform_is_equal_approx
godot_transform_xform
godot_transform_xform_inv

I then grepped all methods from that list in modules/gdnative/include/gdnative/*.h to see which methods are missing, and found:

$ for func in $(cat variant_call_methods.txt); do if ! grep -q $func modules/gdnative/include/gdnative/*.h; then echo $func; fi; done
godot_string_repeat
godot_string_join
godot_string_indent
godot_string_lstrip
godot_string_sha1_text
godot_string_sha1_buffer
godot_string_validate_node_name
godot_string_is_valid_filename
godot_string_to_ascii
godot_string_to_utf8
godot_string_to_wchar
godot_vector2_is_equal_approx
godot_vector2_posmod
godot_vector2_posmodv
godot_vector2_project
godot_vector2_slerp
godot_vector2_ceil
godot_vector2_round
godot_vector2_cross
godot_vector2_limit_length
godot_vector2_sign
godot_rect2_get_center
godot_rect2_is_equal_approx
godot_vector3_is_equal_approx
godot_vector3_slerp
godot_vector3_round
godot_vector3_posmod
godot_vector3_posmodv
godot_vector3_project
godot_vector3_signed_angle_to
godot_vector3_limit_length
godot_vector3_sign
godot_plane_is_equal_approx
godot_quat_is_equal_approx
godot_quat_angle_to
godot_quat_get_euler
godot_quat_set_euler
godot_color_get_luminance
godot_color_is_equal_approx
godot_dictionary_merge
godot_pool_byte_array_get_string_from_ascii
godot_pool_byte_array_get_string_from_utf8
godot_pool_byte_array_compress
godot_pool_byte_array_decompress
godot_pool_byte_array_decompress_dynamic
godot_pool_byte_array_hex_encode
godot_pool_byte_array_fill
godot_pool_byte_array_subarray
godot_pool_byte_array_find
godot_pool_byte_array_rfind
godot_pool_byte_array_count
godot_pool_byte_array_has
godot_pool_int_array_fill
godot_pool_int_array_find
godot_pool_int_array_rfind
godot_pool_int_array_count
godot_pool_int_array_has
godot_pool_real_array_fill
godot_pool_real_array_find
godot_pool_real_array_rfind
godot_pool_real_array_count
godot_pool_real_array_has
godot_pool_string_array_fill
godot_pool_string_array_find
godot_pool_string_array_rfind
godot_pool_string_array_count
godot_pool_string_array_has
godot_pool_vector2_array_fill
godot_pool_vector2_array_find
godot_pool_vector2_array_rfind
godot_pool_vector2_array_count
godot_pool_vector2_array_has
godot_pool_vector3_array_fill
godot_pool_vector3_array_find
godot_pool_vector3_array_rfind
godot_pool_vector3_array_count
godot_pool_vector3_array_has
godot_pool_color_array_fill
godot_pool_color_array_find
godot_pool_color_array_rfind
godot_pool_color_array_count
godot_pool_color_array_has
godot_aabb_abs
godot_aabb_get_center
godot_aabb_is_equal_approx
godot_transform2d_is_equal_approx
godot_basis_get_euler_xyz
godot_basis_set_euler_xyz
godot_basis_get_euler_xzy
godot_basis_set_euler_xzy
godot_basis_get_euler_yzx
godot_basis_set_euler_yzx
godot_basis_get_euler_yxz
godot_basis_set_euler_yxz
godot_basis_get_euler_zxy
godot_basis_set_euler_zxy
godot_basis_get_euler_zyx
godot_basis_set_euler_zyx
godot_basis_is_equal_approx
godot_basis_get_rotation_quat
godot_transform_interpolate_with
godot_transform_is_equal_approx

So there's quite a few! There's more than I expected and while that would be nice to have, I think implementing all those in a few days for Core API 1.3 in time for 3.5-stable would be a bit difficult. And since this is solved in Godot 4.0 (no longer needs manual reimplementation of those methods with GDExtension), I think we can keep it on an on-demand basis.

So I think we can merge this PR and just have this tiny addition in Core API 1.3 for 3.5. And we can open Core API 1.4 for 3.6 if there's demand for more of these methods.

Directly relevant to this PR though, implementing godot_string_join too might make sense?

@kdiduk
Copy link
Contributor Author

kdiduk commented Jul 2, 2022

Directly relevant to this PR though, implementing godot_string_join too might make sense?

I can add join method to String class as well. I can do that either in this PR. Or if this one is merged soon, I can create a new PR (that would be better IMHO).

Also, there is related PR #55650, but it has some merge conflicts that I have to resolve. If this PR is merged, I can put the methods in #55650 in the Core API 1.3 as well.

So, if we merge this PR soon, we can still add some other methods in 1.3 😄

@akien-mga
Copy link
Member

Alright, let's do that :)

@akien-mga akien-mga merged commit ef29a22 into godotengine:3.x Jul 2, 2022
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

join function is missing from PoolStringArray in GDNative headers
3 participants