gloot icon indicating copy to clipboard operation
gloot copied to clipboard

[3.0.0] Suggest to change size format

Open Nordsoft91 opened this issue 1 year ago • 1 comments

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 avatar Aug 06 '24 20:08 Nordsoft91

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 avatar Aug 09 '24 19:08 peter-kish