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

[3.0.0] Suggest to change size format #226

Open
Nordsoft91 opened this issue Aug 6, 2024 · 1 comment
Open

[3.0.0] Suggest to change size format #226

Nordsoft91 opened this issue Aug 6, 2024 · 1 comment
Labels
enhancement New feature or request V3

Comments

@Nordsoft91
Copy link

I checked out 3.0.0 branch, hopefully you have time to release it eventually!

Instead of having size in this format "size": "Vector2i(2, 2)", here are 2 alternatives:
"size": [2, 2]
or
"size": {"width": 2, "height": 2}

Using "Vector2i" forces to have assumption that other types are supported. Also, it's counter-intuitive, that expected value is string, parsed as some function.

@Nordsoft91 Nordsoft91 changed the title Suggest to change size format for 3.0.0 [3.0.0] Suggest to change size format Aug 6, 2024
@peter-kish
Copy link
Owner

peter-kish commented Aug 9, 2024

The main reason why Vector2i(x, y) is used for item sizes is because var_to_str and str_to_var are used for serialization and deserialization of all item properties. Despite that, it is still possible to use a different format for item sizes, but that would make it inconsistent with other property types (e.g. Color, Quaternion etc.`).

"size": [2, 2]
"size": {"width": 2, "height": 2}

I'm afraid these would cause even more confusion because [2, 2] represents an array and {"width": 2, "height": 2} represents a dictionary. On the other hand, Vector2i(2, 2) is at least consistent with the type the plugin uses internally.

it's counter-intuitive, that expected value is string, parsed as some function

Unfortunately, that's a JSON limitation because it only supports numbers, strings, bools, arrays and objects (dictionaries). You can't really do something like "size": Vector2i(2, 2) in JSON.

hopefully you have time to release it eventually!

I hope that too 🙂 I've been quite busy lately and didn't have much time to work on the plugin 😬.

@peter-kish peter-kish added the enhancement New feature or request label Aug 9, 2024
@peter-kish peter-kish added the V3 label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request V3
Projects
None yet
Development

No branches or pull requests

2 participants