From df2a2ae0fc4b240ae1a7afadc9b22286377b891a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Mon, 9 Mar 2020 10:51:17 +0100 Subject: [PATCH] DocData: Fix serialization of Variant default values Co-authored-by: Bojidar Marinov (cherry picked from commit 788765709dfa5e0185cbecffad637dbb545a89aa) --- doc/classes/Array.xml | 8 ++++---- doc/classes/Basis.xml | 2 +- doc/classes/Color.xml | 4 ++-- doc/classes/Dictionary.xml | 4 ++-- doc/classes/Plane.xml | 2 +- doc/classes/Rect2.xml | 2 +- doc/classes/String.xml | 14 +++++++------- editor/doc/doc_data.cpp | 9 +++++---- 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index ca7ab36df43..3b3239e9d8b 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -107,7 +107,7 @@ - + Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [code]before[/code] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. @@ -123,7 +123,7 @@ - + Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a [code]before[/code] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return [code]true[/code] if the first argument is less than the second, and return [code]false[/code] otherwise. @@ -147,7 +147,7 @@ - + Returns a copy of the array. @@ -319,7 +319,7 @@ - + Duplicates the subset described in the function and returns it in an array, deeply copying the array if [code]deep[/code] is [code]true[/code]. Lower and upper index are inclusive, with the [code]step[/code] describing the change between indices while slicing. diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index b0842e8f576..dcfd68eca75 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -100,7 +100,7 @@ - + Returns [code]true[/code] if this basis and [code]b[/code] are approximately equal, by calling [code]is_equal_approx[/code] on each component. diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index e3608ad93e8..6471545bc95 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -119,7 +119,7 @@ - + Constructs a color from an HSV profile. [code]h[/code], [code]s[/code], and [code]v[/code] are values between 0 and 1. @@ -236,7 +236,7 @@ - + Returns the color's HTML hexadecimal color string in ARGB format (ex: [code]ff34f822[/code]). diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 010f87d23b1..9526bc8da18 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -73,7 +73,7 @@ - + Creates a copy of the dictionary, and returns it. @@ -100,7 +100,7 @@ - + Returns the current value for the specified key in the [Dictionary]. If the key does not exist, the method returns the value of the optional default argument, or [code]null[/code] if it is omitted. diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index 908d2960a3f..5209c62ef49 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -77,7 +77,7 @@ - + Returns [code]true[/code] if [code]point[/code] is inside the plane (by a very minimum [code]epsilon[/code] threshold). diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index f4956479151..d3624031ec5 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -133,7 +133,7 @@ - + Returns [code]true[/code] if the [Rect2] overlaps with [code]b[/code] (i.e. they have at least one point in common). diff --git a/doc/classes/String.xml b/doc/classes/String.xml index e0bb2139120..fd44ae5ca32 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -366,7 +366,7 @@ - + Formats the string by replacing all occurrences of [code]placeholder[/code] with [code]values[/code]. @@ -512,7 +512,7 @@ - + Returns [code]true[/code] if this string contains a valid hexadecimal number. If [code]with_prefix[/code] is [code]true[/code], then a validity of the hexadecimal number is determined by [code]0x[/code] prefix, for instance: [code]0xDEADC0DE[/code]. @@ -736,7 +736,7 @@ - + @@ -805,7 +805,7 @@ - + @@ -827,7 +827,7 @@ - + Splits the string in floats by using a delimiter string and returns an array of the substrings. @@ -837,9 +837,9 @@ - + - + Returns a copy of the string stripped of any non-printable character (including tabulations, spaces and line breaks) at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively. diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp index 5bb5313d606..3e6f5f76ddc 100644 --- a/editor/doc/doc_data.cpp +++ b/editor/doc/doc_data.cpp @@ -553,9 +553,11 @@ void DocData::generate(bool p_basic_types) { argument_doc_from_arginfo(ad, mi.arguments[j]); ad.name = arginfo.name; - int defarg = mi.default_arguments.size() - mi.arguments.size() + j; - if (defarg >= 0) - ad.default_value = mi.default_arguments[defarg]; + int darg_idx = mi.default_arguments.size() - mi.arguments.size() + j; + if (darg_idx >= 0) { + Variant default_arg = mi.default_arguments[darg_idx]; + ad.default_value = default_arg.get_construct_string(); + } method.arguments.push_back(ad); } @@ -671,7 +673,6 @@ void DocData::generate(bool p_basic_types) { argument_doc_from_arginfo(ad, mi.arguments[j]); int darg_idx = j - (mi.arguments.size() - mi.default_arguments.size()); - if (darg_idx >= 0) { Variant default_arg = E->get().default_arguments[darg_idx]; ad.default_value = default_arg.get_construct_string();