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

[GDScript] Add 'sort' and 'has' methods to pooled arrays #55650

Merged
merged 1 commit into from
Jul 7, 2022

Conversation

kdiduk
Copy link
Contributor

@kdiduk kdiduk commented Dec 5, 2021

This is a backport from 4.0 to 3.x that adds 'sort' and 'has' methods to the following types in GDScript and GDNative:

  • PoolByteArray
  • PoolIntArray
  • PoolRealArray
  • PoolStringArray
  • PoolVector2Array
  • PoolVector3Array
  • PoolColorArray

The method has was already implemented in GDScript before (see #60856), so in this PR it has been only exposed to GDNative API.

The method sort is implemented using the existing class Sorter.

The both has and sort methods of the Pooled Array classes are exposed to the GDNative CORE API 1.3

The classes documentation is updated.

Pooled arrays in 4.0 are rewritten, that's why this backport is not completely identical to the original PR made for 4.0 (see #32144).

Bugsquad edit: This closes #5202.

@kdiduk kdiduk requested review from a team as code owners December 5, 2021 22:17
@Calinou Calinou added this to the 3.5 milestone Dec 5, 2021
@kdiduk kdiduk force-pushed the pooled-arrays branch 5 times, most recently from bfd5d70 to b1ba738 Compare December 7, 2021 11:38
@akien-mga akien-mga force-pushed the 3.x branch 2 times, most recently from 71cb8d3 to c58391c Compare January 6, 2022 22:40
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Should be fine to merge if rebased soon to add the new methods to the Core API 1.3 we opened for 3.5.

This is a backport from 4.0 to 3.x that adds 'sort' and 'has' methods
to the following types:
- PoolByteArray
- PoolIntArray
- PoolRealArray
- PoolStringArray
- PoolVector2Array
- PoolVector3Array
- PoolColorArray

For all the types above, the methods 'sort' and 'has' have been
exposed to the GDNative API (v. 1.3)

Since the method 'has' was already implemented in GDScript before,
in this commit it has been only exposed to GDNative API.

The classes documentation is updated.

The method 'sort' uses the exisging class "Sorter".

Pooled arrays in 4.0 are rewritten, that's why this backport is not
completely indentical to the original PR made for 4.0 (see godotengine#32144).
@akien-mga akien-mga merged commit f05cecd into godotengine:3.x Jul 7, 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
None yet
Development

Successfully merging this pull request may close these issues.

3 participants