From 291d3aaabefa86b4e102fa7385bcf7aacd240d72 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 25 Jul 2022 00:15:20 +0200 Subject: Improve null and object printing to avoid confusion with arrays - Use different syntax for object printing to avoid confusion with arrays. - Print null as `` to avoid confusion with a string `"null"`. - Display `` in editor resource pickers to avoid confusion with array-based properties. --- core/variant/variant.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/variant') diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index a5bc6c229d..b280fc9fe3 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -1787,7 +1787,7 @@ String stringify_vector(const T &vec, int recursion_count) { String Variant::stringify(int recursion_count) const { switch (type) { case NIL: - return "null"; + return ""; case BOOL: return _data._bool ? "true" : "false"; case INT: @@ -1904,12 +1904,12 @@ String Variant::stringify(int recursion_count) const { case OBJECT: { if (_get_obj().obj) { if (!_get_obj().id.is_ref_counted() && ObjectDB::get_instance(_get_obj().id) == nullptr) { - return "[Freed Object]"; + return ""; } return _get_obj().obj->to_string(); } else { - return "[Object:null]"; + return ""; } } break; @@ -1926,7 +1926,7 @@ String Variant::stringify(int recursion_count) const { return "RID(" + itos(s.get_id()) + ")"; } break; default: { - return "[" + get_type_name(type) + "]"; + return "<" + get_type_name(type) + ">"; } } -- cgit v1.2.3