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

Unify Pool*Array printing output #53655

Merged

Conversation

YuriSizov
Copy link
Contributor

@YuriSizov YuriSizov commented Oct 10, 2021

Basically a backport of #53588, sans the tests.


The original OP Currently the byte array is only displayed by its name if you try to print it, unlike int and real arrays. This adds a case to print `PoolByteArray`'s content the same way as ints and floats are printed.

This is already the case in master, where all packed arrays are printed the same way.

cc @akien-mga

@YuriSizov YuriSizov added this to the 3.4 milestone Oct 10, 2021
@YuriSizov YuriSizov requested a review from a team as a code owner October 10, 2021 22:58
@YuriSizov
Copy link
Contributor Author

From a discussion on RC: we can probably backport #53588 fully, including supporting PoolColorArray and using a template for uniformity.

@YuriSizov YuriSizov marked this pull request as draft October 12, 2021 15:25
@YuriSizov YuriSizov force-pushed the core-print-bytearray-contents-3.x branch from 785e476 to c210672 Compare October 12, 2021 19:31
@YuriSizov
Copy link
Contributor Author

YuriSizov commented Oct 12, 2021

Unified printing after #53588.

PoolVector2Array:
[(0, 0), (1, 1), (0, 1)]
PoolVector3Array:
[(0, 0, 0), (1, 1, 1), (0, -1, 0)]
PoolColorArray:
[1,0,0,1, 0,1,0,1, 0,0,1,1]
PoolStringArray:
[Godot, Game, Engine]
PoolByteArray:
[0, 1, 2, 3, 4]
PoolIntArray:
[0, 1, 2, 3, 4]
PoolRealArray:
[0.1, 1.2, 2.3, 3.4]
Array:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

Maybe colors should be stringified akin to vectors, with parentheses? That's not a part of this PR, but it may make sense in general.

@YuriSizov YuriSizov marked this pull request as ready for review October 12, 2021 19:31
@YuriSizov YuriSizov changed the title Display PoolByteArray's content in print Unify Pool*Array printing output Oct 12, 2021
@akien-mga
Copy link
Member

Maybe colors should be stringified akin to vectors, with parentheses? That's not a part of this PR, but it may make sense in general.

That might be too compat breaking for 3.x, given that people might have written their own logic to handle the current format. It's fixed in master so that might be good as is. (Technically this PR also breaks compat but I don't think anyone relied on PoolByteArray and PoolColorArray being stringified as [PoolByteArray] and [PoolColorArray] when no other Pool*Array was.

@akien-mga akien-mga merged commit 8bdeee0 into godotengine:3.x Oct 13, 2021
@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.

2 participants