-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
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
Write Object variants with '\n' between properties #92102
base: master
Are you sure you want to change the base?
Conversation
Old ui_accept Example
ui_accept={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
]
} New ui_accept Example
ui_accept={
"deadzone": 0.5,
"events": [Object(
InputEventKey,
"resource_local_to_scene":false,
"resource_name":"",
"device":0,
"window_id":0,
"alt_pressed":false,
"shift_pressed":false,
"ctrl_pressed":false,
"meta_pressed":false,
"pressed":false,
"keycode":4194309,
"physical_keycode":0,
"key_label":0,
"unicode":0,
"location":0,
"echo":false,
"script":null
), Object(
InputEventKey,
"resource_local_to_scene":false,
"resource_name":"",
"device":0,
"window_id":0,
"alt_pressed":false,
"shift_pressed":false,
"ctrl_pressed":false,
"meta_pressed":false,
"pressed":false,
"keycode":4194310,
"physical_keycode":0,
"key_label":0,
"unicode":0,
"location":0,
"echo":false,
"script":null
), Object(
InputEventKey,
"resource_local_to_scene":false,
"resource_name":"",
"device":0,
"window_id":0,
"alt_pressed":false,
"shift_pressed":false,
"ctrl_pressed":false,
"meta_pressed":false,
"pressed":false,
"keycode":32,
"physical_keycode":0,
"key_label":0,
"unicode":32,
"location":0,
"echo":false,
"script":null
), Object(
InputEventJoypadButton,
"resource_local_to_scene":false,
"resource_name":"",
"device":-1,
"button_index":0,
"pressure":0.0,
"pressed":false,
"script":null
)]
} |
You need to change this part of the GDScript tests to compensate for the new newlines: diff --git a/modules/gdscript/tests/scripts/runtime/features/metatypes.gd b/modules/gdscript/tests/scripts/runtime/features/metatypes.gd
index 6c5df32ffe..8a57127271 100644
--- a/modules/gdscript/tests/scripts/runtime/features/metatypes.gd
+++ b/modules/gdscript/tests/scripts/runtime/features/metatypes.gd
@@ -12,7 +12,7 @@ var test_class := MyClass
var test_enum := MyEnum
func check_gdscript_native_class(value: Variant) -> void:
- print(var_to_str(value).get_slice(",", 0).trim_prefix("Object("))
+ print(var_to_str(value).get_slice(",", 0).trim_prefix("Object(\n"))
func check_gdscript(value: GDScript) -> void:
print(value.get_class()) |
This would also be a good opportunity to add a space between the key and value (i.e. add a space after |
Also it matches how ✅ Done :) |
Example serialized object with spaces after Object(
InputEventKey,
"resource_local_to_scene": false,
"resource_name": "",
"device": 0,
"window_id": 0,
"alt_pressed": false,
"shift_pressed": false,
"ctrl_pressed": false,
"meta_pressed": false,
"pressed": false,
"keycode": 4194309,
"physical_keycode": 0,
"key_label": 0,
"unicode": 0,
"location": 0,
"echo": false,
"script": null
) |
Adds line feeds '\n' after commas for each property in an
Object
.This mirroring the format for
Dictionary
variants incore/variant/variant_parser.cpp
lines 2054-2066Before
After
This makes reading the diff easier. It will likely help auto-merge conflicts when a different properties in an
Object
are changed at the same time.Proposal