diff --git a/core/doc_data.h b/core/doc_data.h index 19dec719273..c75cdfcde5b 100644 --- a/core/doc_data.h +++ b/core/doc_data.h @@ -140,7 +140,9 @@ public: String brief_description; String description; Vector tutorials; + Vector constructors; Vector methods; + Vector operators; Vector signals; Vector constants; Map enums; diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index 1be6d5a4400..d7b7a309ad7 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -13,28 +13,30 @@ https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html https://docs.godotengine.org/en/latest/tutorials/math/vectors_advanced.html - - + + Constructs a default-initialized [AABB] with default (zero) values of [member position] and [member size]. - - + + Constructs an [AABB] as a copy of the given [AABB]. - - + + Constructs an [AABB] from a position and size. - + + + @@ -193,34 +195,6 @@ Returns a larger [AABB] that contains both this [AABB] and [code]with[/code]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -234,4 +208,34 @@ If the size is negative, you can use [method abs] to fix it. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 8898a59036e..275b217247e 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -44,83 +44,85 @@ - - + + Constructs an empty [Array]. - - + + Constructs an [Array] as a copy of the given [Array]. - - + + Constructs an array from a [PackedByteArray]. - - + + Constructs an array from a [PackedColorArray]. - - + + Constructs an array from a [PackedFloat32Array]. - - + + Constructs an array from a [PackedFloat64Array]. - - + + Constructs an array from a [PackedInt32Array]. - - + + Constructs an array from a [PackedInt64Array]. - - + + Constructs an array from a [PackedStringArray]. - - + + Constructs an array from a [PackedVector2Array]. - - + + Constructs an array from a [PackedVector3Array]. - + + + @@ -345,64 +347,6 @@ Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -550,4 +494,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml index 6215c658c3d..8ef9cd2e7cc 100644 --- a/doc/classes/Basis.xml +++ b/doc/classes/Basis.xml @@ -18,36 +18,36 @@ https://godotengine.org/asset-library/asset/676 https://godotengine.org/asset-library/asset/583 - - + + Constructs a default-initialized [Basis] set to [constant IDENTITY]. - - + + Constructs a [Basis] as a copy of the given [Basis]. - - + + Constructs a pure rotation basis matrix, rotated around the given [code]axis[/code] by [code]phi[/code], in radians. The axis must be a normalized vector. - - + + Constructs a pure rotation basis matrix from the given quaternion. - - + + @@ -55,7 +55,9 @@ Constructs a basis matrix from 3 axis vectors (matrix columns). - + + + @@ -125,60 +127,6 @@ The up axis (+Y) points as close to the [code]up[/code] vector as possible while staying perpendicular to the forward axis. The resulting Basis is orthonormalized. The [code]target[/code] and [code]up[/code] vectors cannot be zero, and cannot be parallel to each other. - - - - - - - - - - - - - - - - - - - - - - - - - - - - This operator multiplies all components of the [Basis], which scales it uniformly. - - - - - - - This operator multiplies all components of the [Basis], which scales it uniformly. - - - - - - - - - - - - - - - - - - - @@ -274,4 +222,60 @@ The basis that will flip something along the Z axis when used in a transformation. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This operator multiplies all components of the [Basis], which scales it uniformly. + + + + + + + This operator multiplies all components of the [Basis], which scales it uniformly. + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 0a95836e964..2d3571e36cc 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -35,28 +35,30 @@ - - + + Constructs a null [Callable] with no object nor method bound. - - + + Constructs a [Callable] as a copy of the given [Callable]. - - + + Creates a new [Callable] for the method called [code]method[/code] in the specified [code]object[/code]. - + + + @@ -123,30 +125,6 @@ Returns [code]true[/code] if the object exists and has a valid function assigned, or is a custom callable. - - - - - - - - - - Returns [code]true[/code] if both [Callable]s invoke different targets. - - - - - - - - - - - - Returns [code]true[/code] if both [Callable]s invoke the same custom target. - - @@ -168,4 +146,30 @@ + + + + + + + + + + + Returns [code]true[/code] if both [Callable]s invoke different targets. + + + + + + + + + + + + Returns [code]true[/code] if both [Callable]s invoke the same custom target. + + + diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index c85bc775c72..71ec225cf68 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -15,21 +15,14 @@ https://godotengine.org/asset-library/asset/146 https://godotengine.org/asset-library/asset/133 - - + + Constructs a default-initialized [Color] with all components set to [code]0[/code]. - - - - - - Constructs a [Color] as a copy of the given [Color]. - - - + + @@ -44,23 +37,47 @@ [/csharp] [/codeblocks] - - + + + + + + Constructs a [Color] as a copy of the given [Color]. + + + Constructs a [Color] either from an HTML color code or from a standardized color name. Supported color names are the same as the constants. - - + + Constructs a [Color] either from an HTML color code or from a standardized color name, with [code]alpha[/code] on the range of 0 to 1. Supported color names are the same as the constants. - - + + + + + + + + Constructs a [Color] from RGB values, typically between 0 and 1. Alpha will be 1. + [codeblocks] + [gdscript] + var color = Color(0.2, 1.0, 0.7) # Similar to `Color8(51, 255, 178, 255)` + [/gdscript] + [csharp] + var color = new Color(0.2f, 1.0f, 0.7f); // Similar to `Color.Color8(51, 255, 178, 255)` + [/csharp] + [/codeblocks] + + + @@ -77,24 +94,9 @@ [/csharp] [/codeblocks] - - - - - - - - Constructs a [Color] from RGB values, typically between 0 and 1. Alpha will be 1. - [codeblocks] - [gdscript] - var color = Color(0.2, 1.0, 0.7) # Similar to `Color8(51, 255, 178, 255)` - [/gdscript] - [csharp] - var color = new Color(0.2f, 1.0f, 0.7f); // Similar to `Color.Color8(51, 255, 178, 255)` - [/csharp] - [/codeblocks] - - + + + @@ -259,92 +261,6 @@ [/codeblocks] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -937,4 +853,92 @@ Yellow green color. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index bab1a261ab6..d661da5dd04 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -181,20 +181,22 @@ https://godotengine.org/asset-library/asset/676 https://godotengine.org/asset-library/asset/677 - - + + Constructs an empty [Dictionary]. - - + + Constructs a [Dictionary] as a copy of the given [Dictionary]. - + + + @@ -288,34 +290,6 @@ Returns the list of keys in the [Dictionary]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -329,4 +303,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/NodePath.xml b/doc/classes/NodePath.xml index 17c6ba38b74..e2772a3ee00 100644 --- a/doc/classes/NodePath.xml +++ b/doc/classes/NodePath.xml @@ -25,21 +25,21 @@ https://godotengine.org/asset-library/asset/520 - - + + Constructs an empty [NodePath]. - - + + Constructs a [NodePath] as a copy of the given [NodePath]. - - + + @@ -61,7 +61,9 @@ "/root/Level/Path2D" [/codeblock] - + + + @@ -166,27 +168,29 @@ Returns [code]true[/code] if the node path is empty. - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index 39733baf407..f951df1eb7a 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -8,27 +8,29 @@ - - + + Constructs an empty [PackedByteArray]. - - + + Constructs a [PackedByteArray] as a copy of the given [PackedByteArray]. - - + + Constructs a new [PackedByteArray]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -323,40 +325,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -445,4 +413,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index 00e670646d5..4aa8a19630d 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -8,27 +8,29 @@ - - + + Constructs an empty [PackedColorArray]. - - + + Constructs a [PackedColorArray] as a copy of the given [PackedColorArray]. - - + + Constructs a new [PackedColorArray]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -86,40 +88,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -180,4 +148,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index 2ee2ac44dfb..68fb45a62a6 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -9,27 +9,29 @@ - - + + Constructs an empty [PackedFloat32Array]. - - + + Constructs a [PackedFloat32Array] as a copy of the given [PackedFloat32Array]. - - + + Constructs a new [PackedFloat32Array]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -87,40 +89,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -183,4 +151,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index 7414bc72fcb..740591a0c0d 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -9,27 +9,29 @@ - - + + Constructs an empty [PackedFloat64Array]. - - + + Constructs a [PackedFloat64Array] as a copy of the given [PackedFloat64Array]. - - + + Constructs a new [PackedFloat64Array]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -87,40 +89,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -183,4 +151,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index 8ecf4a70aec..7a01bb6c7c1 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -9,27 +9,29 @@ - - + + Constructs an empty [PackedInt32Array]. - - + + Constructs a [PackedInt32Array] as a copy of the given [PackedInt32Array]. - - + + Constructs a new [PackedInt32Array]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -87,40 +89,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -183,4 +151,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index b82ce790090..c7b69d4ad52 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -9,27 +9,29 @@ - - + + Constructs an empty [PackedInt64Array]. - - + + Constructs a [PackedInt64Array] as a copy of the given [PackedInt64Array]. - - + + Constructs a new [PackedInt64Array]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -87,40 +89,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -183,4 +151,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index 353bbfb827d..dfebfb718b4 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -9,27 +9,29 @@ https://godotengine.org/asset-library/asset/677 - - + + Constructs an empty [PackedStringArray]. - - + + Constructs a [PackedStringArray] as a copy of the given [PackedStringArray]. - - + + Constructs a new [PackedStringArray]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -87,40 +89,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -181,4 +149,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 7b7df221e75..bf9b7e97d47 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -9,27 +9,29 @@ https://godotengine.org/asset-library/asset/519 - - + + Constructs an empty [PackedVector2Array]. - - + + Constructs a [PackedVector2Array] as a copy of the given [PackedVector2Array]. - - + + Constructs a new [PackedVector2Array]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -87,46 +89,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -187,4 +149,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index efbf2169fda..b439f8f2174 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -8,27 +8,29 @@ - - + + Constructs an empty [PackedVector3Array]. - - + + Constructs a [PackedVector3Array] as a copy of the given [PackedVector3Array]. - - + + Constructs a new [PackedVector3Array]. Optionally, you can pass in a generic [Array] that will be converted. - + + + @@ -86,46 +88,6 @@ Returns [code]true[/code] if the array is empty. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -186,4 +148,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Plane.xml b/doc/classes/Plane.xml index f7a68e6a24d..a20607d0a7e 100644 --- a/doc/classes/Plane.xml +++ b/doc/classes/Plane.xml @@ -9,21 +9,21 @@ https://docs.godotengine.org/en/latest/tutorials/math/index.html - - + + Constructs a default-initialized [Plane] with all components set to [code]0[/code]. - - + + Constructs a [Plane] as a copy of the given [Plane]. - - + + @@ -32,31 +32,31 @@ Creates a plane from the four parameters. The three components of the resulting plane's [member normal] are [code]a[/code], [code]b[/code] and [code]c[/code], and the plane has a distance of [code]d[/code] from the origin. - - - - - - - Creates a plane from the normal vector and a point in the plane. - - - - - - - - Creates a plane from the normal vector and the plane's distance to the origin. - - - + + Creates a plane from the normal vector. The plane will intersect the origin. - - + + + + + + + Creates a plane from the normal vector and the plane's distance from the origin. + + + + + + + + Creates a plane from the normal vector and a point on the plane. + + + @@ -64,7 +64,9 @@ Creates a plane from the three points, given in clockwise order. - + + + @@ -130,38 +132,6 @@ Returns a copy of the plane, normalized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -200,4 +170,38 @@ A plane that extends in the X and Y axes (normal vector points +Z). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Quaternion.xml b/doc/classes/Quaternion.xml index 9c948ca21aa..95b2316bf3c 100644 --- a/doc/classes/Quaternion.xml +++ b/doc/classes/Quaternion.xml @@ -12,49 +12,49 @@ https://docs.godotengine.org/en/latest/tutorials/3d/using_transforms.html#interpolating-with-quaternions https://godotengine.org/asset-library/asset/678 - - + + Constructs a default-initialized quaternion with all components set to [code]0[/code]. - - + + Constructs a [Quaternion] as a copy of the given [Quaternion]. - - + + - - + + Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector. - - + + - - + + Constructs a quaternion from the given [Basis]. - - + + @@ -63,7 +63,9 @@ Constructs a quaternion defined by the given values. - + + + @@ -142,92 +144,6 @@ Returns a copy of the quaternion, normalized to unit length. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -269,4 +185,92 @@ The identity quaternion, representing no rotation. Equivalent to an identity [Basis] matrix. If a vector is transformed by an identity quaternion, it will not change. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/RID.xml b/doc/classes/RID.xml index b4ba74f7e57..695b0933fa7 100644 --- a/doc/classes/RID.xml +++ b/doc/classes/RID.xml @@ -8,71 +8,75 @@ - - + + Constructs an empty [RID] with the invalid ID [code]0[/code]. - - + + Constructs a [RID] as a copy of the given [RID]. - + + + Returns the ID of the referenced resource. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index a6bb81b5895..01bec10ed80 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -13,36 +13,36 @@ https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html https://docs.godotengine.org/en/latest/tutorials/math/vectors_advanced.html - - + + Constructs a default-initialized [Rect2] with default (zero) values of [member position] and [member size]. - - + + Constructs a [Rect2] as a copy of the given [Rect2]. - - + + Constructs a [Rect2] from a [Rect2i]. - - + + Constructs a [Rect2] by position and size. - - + + @@ -51,7 +51,9 @@ Constructs a [Rect2] by x, y, width, and height. - + + + @@ -153,34 +155,6 @@ Returns a larger [Rect2] that contains this [Rect2] and [code]b[/code]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -194,4 +168,34 @@ If the size is negative, you can use [method abs] to fix it. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml index 0ba013caded..fc27c64fa5a 100644 --- a/doc/classes/Rect2i.xml +++ b/doc/classes/Rect2i.xml @@ -11,36 +11,36 @@ https://docs.godotengine.org/en/latest/tutorials/math/index.html https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html - - + + Constructs a default-initialized [Rect2i] with default (zero) values of [member position] and [member size]. - - + + Constructs a [Rect2i] as a copy of the given [Rect2i]. - - + + Constructs a new [Rect2i] from [Rect2]. The floating point coordinates will be truncated. - - + + Constructs a [Rect2i] by position and size. - - + + @@ -49,7 +49,9 @@ Constructs a [Rect2i] by x, y, width, and height. - + + + @@ -144,28 +146,6 @@ Returns a larger [Rect2i] that contains this [Rect2i] and [code]b[/code]. - - - - - - - - - - - - - - - - - - - - - - @@ -179,4 +159,28 @@ If the size is negative, you can use [method abs] to fix it. + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml index f78266a20c4..79d6ba8768d 100644 --- a/doc/classes/Signal.xml +++ b/doc/classes/Signal.xml @@ -7,28 +7,30 @@ - - + + Constructs a null [Signal] with no object nor signal name bound. - - + + Constructs a [Signal] as a copy of the given [Signal]. - - + + Creates a new [Signal] with the name [code]signal[/code] in the specified [code]object[/code]. - + + + @@ -93,27 +95,29 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/String.xml b/doc/classes/String.xml index abb68e0d056..1190d90190d 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -9,34 +9,36 @@ https://docs.godotengine.org/en/latest/tutorials/scripting/gdscript/gdscript_format_string.html - - + + Constructs an empty [String] ([code]""[/code]). - - + + Constructs a [String] as a copy of the given [String]. - - + + Constructs a new String from the given [NodePath]. - - + + Constructs a new String from the given [StringName]. - + + + @@ -443,82 +445,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -843,4 +769,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index 113195d91cc..b32665a09f1 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -8,60 +8,62 @@ - - + + Constructs an empty [StringName]. - - + + Constructs a [StringName] as a copy of the given [StringName]. - - + + Creates a new [StringName] from the given [String]. - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/doc/classes/Transform2D.xml b/doc/classes/Transform2D.xml index d64752a00f1..ab7632e08e4 100644 --- a/doc/classes/Transform2D.xml +++ b/doc/classes/Transform2D.xml @@ -13,29 +13,29 @@ https://godotengine.org/asset-library/asset/584 https://godotengine.org/asset-library/asset/583 - - + + Constructs a default-initialized [Transform2D] set to [constant IDENTITY]. - - + + Constructs a [Transform2D] as a copy of the given [Transform2D]. - - + + Constructs the transform from a given angle (in radians) and position. - - + + @@ -44,8 +44,8 @@ Constructs the transform from a given angle (in radians), scale, skew (in radians) and position. - - + + @@ -53,7 +53,9 @@ Constructs the transform from 3 [Vector2] values representing [member x], [member y], and the [member origin] (the three column vectors). - + + + @@ -129,72 +131,6 @@ Operations take place in global space. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly. - - - - - - - This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly. - - - - - - - - - - - - - - - - - - - @@ -267,4 +203,72 @@ The [Transform2D] that will flip something along the Y axis. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly. + + + + + + + This operator multiplies all components of the [Transform2D], including the origin vector, which scales it uniformly. + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Transform3D.xml b/doc/classes/Transform3D.xml index 63a7746328b..8c4965abb47 100644 --- a/doc/classes/Transform3D.xml +++ b/doc/classes/Transform3D.xml @@ -15,29 +15,29 @@ https://godotengine.org/asset-library/asset/125 https://godotengine.org/asset-library/asset/583 - - + + Constructs a default-initialized [Transform3D] set to [constant IDENTITY]. - - + + Constructs a [Transform3D] as a copy of the given [Transform3D]. - - + + Constructs a Transform3D from a [Basis] and [Vector3]. - - + + @@ -46,7 +46,9 @@ Constructs a Transform3D from four [Vector3] values (matrix columns). Each axis corresponds to local basis vectors (some of which may be scaled). - + + + @@ -83,66 +85,6 @@ The up axis (+Y) points as close to the [code]up[/code] vector as possible while staying perpendicular to the forward axis. The resulting transform is orthonormalized. The existing rotation, scale, and skew information from the original transform is discarded. The [code]target[/code] and [code]up[/code] vectors cannot be zero, cannot be parallel to each other, and are defined in global/parent space. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly. - - - - - - - This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly. - - - - - - - - - - - - - @@ -195,4 +137,66 @@ [Transform3D] with mirroring applied perpendicular to the XY plane. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly. + + + + + + + This operator multiplies all components of the [Transform3D], including the origin vector, which scales it uniformly. + + + + + + + + + + + + + + diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 4035fb0ad26..eaaf41561ac 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -16,35 +16,37 @@ https://godotengine.org/asset-library/asset/584 https://github.com/godotengine/godot-demo-projects/tree/master/2d - - + + Constructs a default-initialized [Vector2] with all components set to [code]0[/code]. - - + + Constructs a [Vector2] as a copy of the given [Vector2]. - - + + Constructs a new [Vector2] from [Vector2i]. - - + + Constructs a new [Vector2] from the given [code]x[/code] and [code]y[/code]. - + + + @@ -225,122 +227,6 @@ Returns the vector scaled to unit length. Equivalent to [code]v / v.length()[/code]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -455,4 +341,122 @@ Down unit vector. Y is down in 2D, so this vector points +Y. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index 52fd8c6780d..71882e5b0cf 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -13,35 +13,37 @@ https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab - - + + Constructs a default-initialized [Vector2i] with all components set to [code]0[/code]. - - + + Constructs a [Vector2i] as a copy of the given [Vector2i]. - - + + Constructs a new [Vector2i] from [Vector2]. The floating point coordinates will be truncated. - - + + Constructs a new [Vector2i] from the given [code]x[/code] and [code]y[/code]. - + + + @@ -62,128 +64,6 @@ Returns a new vector with all components clamped between the components of [code]min[/code] and [code]max[/code], by running [method @GlobalScope.clamp] on each component. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -225,4 +105,128 @@ Down unit vector. Y is down in 2D, so this vector points +Y. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 078ba1e1a46..a94cc0086f4 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -16,28 +16,28 @@ https://godotengine.org/asset-library/asset/584 https://github.com/godotengine/godot-demo-projects/tree/master/3d - - + + Constructs a default-initialized [Vector3] with all components set to [code]0[/code]. - - + + Constructs a [Vector3] as a copy of the given [Vector3]. - - + + Constructs a new [Vector3] from [Vector3i]. - - + + @@ -45,7 +45,9 @@ Returns a [Vector3] with the given components. - + + + @@ -219,134 +221,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -483,4 +357,134 @@ Back unit vector. Represents the local direction of back, and the global direction of south. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml index 2a7ee1ffb89..5cd458a2beb 100644 --- a/doc/classes/Vector3i.xml +++ b/doc/classes/Vector3i.xml @@ -13,28 +13,28 @@ https://docs.godotengine.org/en/latest/tutorials/math/vector_math.html https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab - - + + Constructs a default-initialized [Vector3i] with all components set to [code]0[/code]. - - + + Constructs a [Vector3i] as a copy of the given [Vector3i]. - - + + Constructs a new [Vector3i] from [Vector3]. The floating point coordinates will be truncated. - - + + @@ -42,7 +42,9 @@ Returns a [Vector3i] with the given components. - + + + @@ -68,128 +70,6 @@ Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z]. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -243,4 +123,128 @@ Back unit vector. Represents the local direction of back, and the global direction of south. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml index 39e34a7b964..49f2d2dd7f6 100644 --- a/doc/classes/bool.xml +++ b/doc/classes/bool.xml @@ -91,71 +91,74 @@ - - + + Constructs a default-initialized [bool] set to [code]false[/code]. - - + + Constructs a [bool] as a copy of the given [bool]. - - + + Cast a [float] value to a boolean value, this method will return [code]false[/code] if [code]0.0[/code] is passed in, and [code]true[/code] for all other floats. - - + + Cast an [int] value to a boolean value, this method will return [code]false[/code] if [code]0[/code] is passed in, and [code]true[/code] for all other ints. - - + + + + - - + + Returns [code]true[/code] if two bools are different, i.e. one is [code]true[/code] and the other is [code]false[/code]. - - + + - Returns [code]true[/code] if left operand is [code]false[/code] and right operand is [code]true[/code]. + Returns [code]true[/code] if the left operand is [code]false[/code] and the right operand is [code]true[/code]. - - + + + Returns [code]true[/code] if two bools are equal, i.e. both are [code]true[/code] or both are [code]false[/code]. - - + + Returns [code]true[/code] if two bools are equal, i.e. both are [code]true[/code] or both are [code]false[/code]. - - + + - Returns [code]true[/code] if left operand is [code]true[/code] and right operand is [code]false[/code]. + Returns [code]true[/code] if the left operand is [code]true[/code] and the right operand is [code]false[/code]. - - + + diff --git a/doc/classes/float.xml b/doc/classes/float.xml index b45cdd2099c..8231173bace 100644 --- a/doc/classes/float.xml +++ b/doc/classes/float.xml @@ -12,61 +12,70 @@ https://en.wikipedia.org/wiki/Double-precision_floating-point_format https://en.wikipedia.org/wiki/Single-precision_floating-point_format - - + + Constructs a default-initialized [float] set to [code]0.0[/code]. - - + + Constructs a [float] as a copy of the given [float]. - - + + Cast a [bool] value to a floating-point value, [code]float(true)[/code] will be equal to 1.0 and [code]float(false)[/code] will be equal to 0.0. - - + + Cast an [int] value to a floating-point value, [code]float(1)[/code] will be equal to [code]1.0[/code]. - - + + + + - - + + Returns [code]true[/code] if two floats are different from each other. - - + + Returns [code]true[/code] if the integer has different value than the float. - - + + Multiplies two [float]s. - - + + + + + + Multiplies each component of the [Quaternion] by the given [float]. + + + @@ -75,8 +84,8 @@ print(2.5 * Vector2(1, 1)) # Vector2(2.5, 2.5) [/codeblock] - - + + @@ -85,29 +94,22 @@ print(2.0 * Vector2i(1, 1)) # Vector2i(2.0, 2.0) [/codeblock] - - + + Multiplies each component of the [Vector3] by the given [float]. - - + + Multiplies each component of the [Vector3i] by the given [float]. - - - - - - Multiplies each component of the [Quaternion] by the given [float]. - - - + + @@ -116,143 +118,143 @@ print(1.5 * Color(0.5, 0.5, 0.5)) # Color(0.75, 0.75, 0.75) [/codeblock] - - + + Multiplies a [float] and an [int]. The result is a [float]. - - + + Adds two floats. - - + + Adds a [float] and an [int]. The result is a [float]. - - + + Subtracts a float from a float. - - + + Subtracts an [int] from a [float]. The result is a [float]. - - + + Divides two floats. - - + + Divides a [float] by an [int]. The result is a [float]. - - + + Returns [code]true[/code] the left float is less than the right one. - - + + Returns [code]true[/code] if this [float] is less than the given [int]. - - + + Returns [code]true[/code] the left integer is less than or equal to the right one. - - + + Returns [code]true[/code] if this [float] is less than or equal to the given [int]. - - + + - - + + Returns [code]true[/code] if both floats are exactly equal. [b]Note:[/b] Due to floating-point precision errors, consider using [method @GlobalScope.is_equal_approx] or [method @GlobalScope.is_zero_approx] instead, which are more reliable. - - + + Returns [code]true[/code] if the [float] and the given [int] are equal. - - + + Returns [code]true[/code] the left float is greater than the right one. - - + + Returns [code]true[/code] if this [float] is greater than the given [int]. - - + + Returns [code]true[/code] the left float is greater than or equal to the right one. - - + + Returns [code]true[/code] if this [float] is greater than or equal to the given [int]. - - + + Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable. - - + + Returns the negative value of the [float]. If positive, turns the number negative. If negative, turns the number positive. With floats, the number zero can be either positive or negative. - - + + diff --git a/doc/classes/int.xml b/doc/classes/int.xml index a75d11ba4a1..94c2601e4a2 100644 --- a/doc/classes/int.xml +++ b/doc/classes/int.xml @@ -38,54 +38,56 @@ - - + + Constructs a default-initialized [int] set to [code]0[/code]. - - + + Constructs an [int] as a copy of the given [int]. - - + + Cast a [bool] value to an integer value, [code]int(true)[/code] will be equals to 1 and [code]int(false)[/code] will be equals to 0. - - + + Cast a float value to an integer value, this method simply removes the number fractions (i.e. rounds [code]from[/code] towards zero), so for example [code]int(2.7)[/code] will be equals to 2, [code]int(0.1)[/code] will be equals to 0 and [code]int(-2.7)[/code] will be equals to -2. This operation is also called truncation. - - + + + + - - + + Returns [code]true[/code] if operands are different from each other. - - + + Returns [code]true[/code] if operands are different from each other. - - + + @@ -96,8 +98,8 @@ print(12 % 2) # 2 [/codeblock] - - + + @@ -114,98 +116,93 @@ do_stuff() [/codeblock] - - + + + + + + + + + + + + + + Multiplies two [int]s. - - + + Multiplies an [int] and a [float]. The result is a [float]. - - + + - Multiplies each component of the vector by the given integer. + Multiplies each component of the [Vector2] by the given [int]. [codeblock] print(2 * Vector2(1, 1)) # Vector2(2, 2) [/codeblock] - - + + - Multiplies each component of the integer vector by the given integer. + Multiplies each component of the [Vector2i] by the given [int]. - - + + - Multiplies each component of the vector by the given integer. + Multiplies each component of the [Vector3] by the given [int]. - - + + - Multiplies each component of the integer vector by the given integer. + Multiplies each component of the [Vector3i] by the given [int]. - - - - + + + + - Multiplies each component of the quaternion by the given integer. + Adds an [int] and a [float]. The result is a [float]. - - - - - - Multiplies each component of the color by the given integer. - [codeblock] - print(2 * Color(0.5, 0.5, 0.5)) # Color(1, 1, 1) - [/codeblock] - - - + + Adds two integers. - - - - - - Adds an [int] to a [float]. The result is a [float]. - - - + + Subtracts a [float] from an [int]. The result is a [float]. - - + + Subtracts two integers. - - + + @@ -214,8 +211,8 @@ print(10 / 3.0) # 3.333... [/codeblock] - - + + @@ -225,22 +222,22 @@ print(10 / 3) # 3 [/codeblock] - - + + Returns [code]true[/code] if this [int] is less than the given [float]. - - + + Returns [code]true[/code] the left integer is less than the right one. - - + + @@ -250,69 +247,69 @@ print(10 << 4) # 160 [/codeblock] - - + + Returns [code]true[/code] if this [int] is less than or equal to the given [float]. - - + + Returns [code]true[/code] the left integer is less than or equal to the right one. - - + + - - + + Returns [code]true[/code] if the integer is equal to the given [float]. - - + + Returns [code]true[/code] if both integers are equal. - - + + Returns [code]true[/code] if this [int] is greater than the given [float]. - - + + Returns [code]true[/code] the left integer is greater than the right one. - - + + Returns [code]true[/code] if this [int] is greater than or equal to the given [float]. - - + + Returns [code]true[/code] the left integer is greater than or equal to the right one. - - + + @@ -322,8 +319,8 @@ print(10 >> 2) # 2 [/codeblock] - - + + @@ -333,20 +330,20 @@ print(4 ^ 7) # 3 [/codeblock] - - + + Returns the same value as if the [code]+[/code] was not there. Unary [code]+[/code] does nothing, but sometimes it can make your code more readable. - - + + Returns the negated value of the [int]. If positive, turns the number negative. If negative, turns the number positive. If zero, does nothing. - - + + @@ -363,8 +360,8 @@ flags |= 4 [/codeblock] - - + + Returns the result of bitwise [code]NOT[/code] operation for the integer. It's effectively equal to [code]-int + 1[/code]. @@ -373,6 +370,6 @@ print(~7) # -6 [/codeblock] - - + + diff --git a/editor/doc_tools.cpp b/editor/doc_tools.cpp index beead74c537..61cc6dbd4a2 100644 --- a/editor/doc_tools.cpp +++ b/editor/doc_tools.cpp @@ -57,25 +57,21 @@ void DocTools::merge_from(const DocTools &p_data) { c.brief_description = cf.brief_description; c.tutorials = cf.tutorials; - for (int i = 0; i < c.methods.size(); i++) { - DocData::MethodDoc &m = c.methods.write[i]; + for (int i = 0; i < c.constructors.size(); i++) { + DocData::MethodDoc &m = c.constructors.write[i]; - for (int j = 0; j < cf.methods.size(); j++) { - if (cf.methods[j].name != m.name) { + for (int j = 0; j < cf.constructors.size(); j++) { + if (cf.constructors[j].name != m.name) { continue; } - const char *operator_prefix = "operator "; // Operators use a space at the end, making this prefix an invalid identifier (and differentiating from methods). - - if (cf.methods[j].name == c.name || cf.methods[j].name.begins_with(operator_prefix)) { - // Since constructors and operators can repeat, we need to check the type of + { + // Since constructors can repeat, we need to check the type of // the arguments so we make sure they are different. - - if (cf.methods[j].arguments.size() != m.arguments.size()) { + if (cf.constructors[j].arguments.size() != m.arguments.size()) { continue; } - - int arg_count = cf.methods[j].arguments.size(); + int arg_count = cf.constructors[j].arguments.size(); Vector arg_used; arg_used.resize(arg_count); for (int l = 0; l < arg_count; ++l) { @@ -85,7 +81,7 @@ void DocTools::merge_from(const DocTools &p_data) { // have to check one by one so we make sure we have an exact match for (int k = 0; k < arg_count; ++k) { for (int l = 0; l < arg_count; ++l) { - if (cf.methods[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) { + if (cf.constructors[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) { arg_used.write[l] = true; break; } @@ -102,6 +98,21 @@ void DocTools::merge_from(const DocTools &p_data) { } } + const DocData::MethodDoc &mf = cf.constructors[j]; + + m.description = mf.description; + break; + } + } + + for (int i = 0; i < c.methods.size(); i++) { + DocData::MethodDoc &m = c.methods.write[i]; + + for (int j = 0; j < cf.methods.size(); j++) { + if (cf.methods[j].name != m.name) { + continue; + } + const DocData::MethodDoc &mf = cf.methods[j]; m.description = mf.description; @@ -165,6 +176,54 @@ void DocTools::merge_from(const DocTools &p_data) { } } + for (int i = 0; i < c.operators.size(); i++) { + DocData::MethodDoc &m = c.operators.write[i]; + + for (int j = 0; j < cf.operators.size(); j++) { + if (cf.operators[j].name != m.name) { + continue; + } + + { + // Since operators can repeat, we need to check the type of + // the arguments so we make sure they are different. + if (cf.operators[j].arguments.size() != m.arguments.size()) { + continue; + } + int arg_count = cf.operators[j].arguments.size(); + Vector arg_used; + arg_used.resize(arg_count); + for (int l = 0; l < arg_count; ++l) { + arg_used.write[l] = false; + } + // also there is no guarantee that argument ordering will match, so we + // have to check one by one so we make sure we have an exact match + for (int k = 0; k < arg_count; ++k) { + for (int l = 0; l < arg_count; ++l) { + if (cf.operators[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) { + arg_used.write[l] = true; + break; + } + } + } + bool not_the_same = false; + for (int l = 0; l < arg_count; ++l) { + if (!arg_used[l]) { // at least one of the arguments was different + not_the_same = true; + } + } + if (not_the_same) { + continue; + } + } + + const DocData::MethodDoc &mf = cf.operators[j]; + + m.description = mf.description; + break; + } + } + #ifndef MODULE_MONO_ENABLED // The Mono module defines some properties that we want to keep when // re-generating docs with a non-Mono build, to prevent pointless diffs @@ -650,11 +709,6 @@ void DocTools::generate(bool p_basic_types) { DocData::MethodDoc method; method.name = mi.name; - if (method.name == cname) { - method.qualifiers = "constructor"; - } else if (method.name.begins_with("operator")) { - method.qualifiers = "operator"; - } for (int j = 0; j < mi.arguments.size(); j++) { PropertyInfo arginfo = mi.arguments[j]; @@ -694,7 +748,13 @@ void DocTools::generate(bool p_basic_types) { method.qualifiers += "static"; } - c.methods.push_back(method); + if (method.name == cname) { + c.constructors.push_back(method); + } else if (method.name.begins_with("operator")) { + c.operators.push_back(method); + } else { + c.methods.push_back(method); + } } List properties; @@ -916,7 +976,7 @@ static Error _parse_methods(Ref &parser, Vector & methods.push_back(method); } else { - ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + parser->get_node_name() + "."); + ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + parser->get_node_name() + ", expected " + element + "."); } } else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == section) { @@ -1044,10 +1104,15 @@ Error DocTools::_load(Ref parser) { break; // End of . } } + } else if (name2 == "constructors") { + Error err2 = _parse_methods(parser, c.constructors); + ERR_FAIL_COND_V(err2, err2); } else if (name2 == "methods") { Error err2 = _parse_methods(parser, c.methods); ERR_FAIL_COND_V(err2, err2); - + } else if (name2 == "operators") { + Error err2 = _parse_methods(parser, c.operators); + ERR_FAIL_COND_V(err2, err2); } else if (name2 == "signals") { Error err2 = _parse_methods(parser, c.signals); ERR_FAIL_COND_V(err2, err2); @@ -1269,6 +1334,8 @@ Error DocTools::save_classes(const String &p_default_path, const Map"); + _write_method_doc(f, "constructor", c.constructors); + _write_method_doc(f, "method", c.methods); if (!c.properties.is_empty()) { @@ -1344,6 +1411,8 @@ Error DocTools::save_classes(const String &p_default_path, const Map"); } + _write_method_doc(f, "operator", c.operators); + _write_string(f, 0, ""); } diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index c049db8ef6e..8c3569df075 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -330,6 +330,153 @@ Error EditorHelp::_goto_desc(const String &p_class, int p_vscr) { return OK; } +void EditorHelp::_update_method_list(const Vector p_methods, bool &r_method_descrpitons) { + Ref doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); + class_desc->pop(); + class_desc->pop(); + + class_desc->add_newline(); + class_desc->push_font(doc_code_font); + class_desc->push_indent(1); + class_desc->push_table(2); + class_desc->set_table_column_expand(1, true); + + bool any_previous = false; + for (int pass = 0; pass < 2; pass++) { + Vector m; + + for (int i = 0; i < p_methods.size(); i++) { + const String &q = p_methods[i].qualifiers; + if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) { + m.push_back(p_methods[i]); + } + } + + if (any_previous && !m.is_empty()) { + class_desc->push_cell(); + class_desc->pop(); //cell + class_desc->push_cell(); + class_desc->pop(); //cell + } + + String group_prefix; + for (int i = 0; i < m.size(); i++) { + const String new_prefix = m[i].name.substr(0, 3); + bool is_new_group = false; + + if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) { + is_new_group = i > 0; + group_prefix = new_prefix; + } else if (group_prefix != "" && new_prefix != group_prefix) { + is_new_group = true; + group_prefix = ""; + } + + if (is_new_group && pass == 1) { + class_desc->push_cell(); + class_desc->pop(); //cell + class_desc->push_cell(); + class_desc->pop(); //cell + } + + if (m[i].description != "" || m[i].errors_returned.size() > 0) { + r_method_descrpitons = true; + } + + _add_method(m[i], true); + } + + any_previous = !m.is_empty(); + } + + class_desc->pop(); //table + class_desc->pop(); + class_desc->pop(); // font + class_desc->add_newline(); + class_desc->add_newline(); +} + +void EditorHelp::_update_method_descriptions(const DocData::ClassDoc p_classdoc, const Vector p_methods, const String &p_method_type) { + Ref doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); + Ref doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts")); + Ref doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); + String link_color_text = title_color.to_html(false); + class_desc->pop(); + class_desc->pop(); + + class_desc->add_newline(); + class_desc->add_newline(); + + for (int pass = 0; pass < 2; pass++) { + Vector methods_filtered; + + for (int i = 0; i < p_methods.size(); i++) { + const String &q = p_methods[i].qualifiers; + if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) { + methods_filtered.push_back(p_methods[i]); + } + } + + for (int i = 0; i < methods_filtered.size(); i++) { + class_desc->push_font(doc_code_font); + _add_method(methods_filtered[i], false); + class_desc->pop(); + + class_desc->add_newline(); + class_desc->add_newline(); + + class_desc->push_color(text_color); + class_desc->push_font(doc_font); + class_desc->push_indent(1); + if (methods_filtered[i].errors_returned.size()) { + class_desc->append_text(TTR("Error codes returned:")); + class_desc->add_newline(); + class_desc->push_list(0, RichTextLabel::LIST_DOTS, false); + for (int j = 0; j < methods_filtered[i].errors_returned.size(); j++) { + if (j > 0) { + class_desc->add_newline(); + } + int val = methods_filtered[i].errors_returned[j]; + String text = itos(val); + for (int k = 0; k < CoreConstants::get_global_constant_count(); k++) { + if (CoreConstants::get_global_constant_value(k) == val && CoreConstants::get_global_constant_enum(k) == SNAME("Error")) { + text = CoreConstants::get_global_constant_name(k); + break; + } + } + + class_desc->push_bold(); + class_desc->append_text(text); + class_desc->pop(); + } + class_desc->pop(); + class_desc->add_newline(); + class_desc->add_newline(); + } + if (!methods_filtered[i].description.strip_edges().is_empty()) { + _add_text(DTR(methods_filtered[i].description)); + } else { + class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); + class_desc->add_text(" "); + class_desc->push_color(comment_color); + if (p_classdoc.is_script_doc) { + class_desc->append_text(TTR("There is currently no description for this " + p_method_type + ".")); + } else { + class_desc->append_text(TTR("There is currently no description for this " + p_method_type + ". Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); + } + class_desc->pop(); + } + + class_desc->pop(); + class_desc->pop(); + class_desc->pop(); + class_desc->add_newline(); + class_desc->add_newline(); + class_desc->add_newline(); + } + } +} + void EditorHelp::_update_doc() { if (!doc->class_list.has(edited_class)) { return; @@ -622,7 +769,9 @@ void EditorHelp::_update_doc() { } // Methods overview - bool method_descr = false; + bool constructor_descriptions = false; + bool method_descriptions = false; + bool operator_descriptions = false; bool sort_methods = EditorSettings::get_singleton()->get("text_editor/help/sort_functions_alphabetically"); Vector methods; @@ -640,81 +789,43 @@ void EditorHelp::_update_doc() { methods.push_back(cd.methods[i]); } - if (methods.size()) { + if (!cd.constructors.is_empty()) { + if (sort_methods) { + cd.constructors.sort(); + } + + section_line.push_back(Pair(TTR("Constructors"), class_desc->get_line_count() - 2)); + class_desc->push_color(title_color); + class_desc->push_font(doc_title_font); + class_desc->add_text(TTR("Constructors")); + _update_method_list(cd.constructors, constructor_descriptions); + } + + if (!methods.is_empty()) { if (sort_methods) { methods.sort(); } - section_line.push_back(Pair(TTR("Methods"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Methods")); - class_desc->pop(); - class_desc->pop(); + _update_method_list(methods, method_descriptions); + } - class_desc->add_newline(); - class_desc->push_font(doc_code_font); - class_desc->push_indent(1); - class_desc->push_table(2); - class_desc->set_table_column_expand(1, true); - - bool any_previous = false; - for (int pass = 0; pass < 2; pass++) { - Vector m; - - for (int i = 0; i < methods.size(); i++) { - const String &q = methods[i].qualifiers; - if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) { - m.push_back(methods[i]); - } - } - - if (any_previous && !m.is_empty()) { - class_desc->push_cell(); - class_desc->pop(); //cell - class_desc->push_cell(); - class_desc->pop(); //cell - } - - String group_prefix; - for (int i = 0; i < m.size(); i++) { - const String new_prefix = m[i].name.substr(0, 3); - bool is_new_group = false; - - if (i < m.size() - 1 && new_prefix == m[i + 1].name.substr(0, 3) && new_prefix != group_prefix) { - is_new_group = i > 0; - group_prefix = new_prefix; - } else if (group_prefix != "" && new_prefix != group_prefix) { - is_new_group = true; - group_prefix = ""; - } - - if (is_new_group && pass == 1) { - class_desc->push_cell(); - class_desc->pop(); //cell - class_desc->push_cell(); - class_desc->pop(); //cell - } - - if (m[i].description != "" || m[i].errors_returned.size() > 0) { - method_descr = true; - } - - _add_method(m[i], true); - } - - any_previous = !m.is_empty(); + if (!cd.operators.is_empty()) { + if (sort_methods) { + cd.operators.sort(); } - class_desc->pop(); //table - class_desc->pop(); - class_desc->pop(); // font - class_desc->add_newline(); - class_desc->add_newline(); + section_line.push_back(Pair(TTR("Operators"), class_desc->get_line_count() - 2)); + class_desc->push_color(title_color); + class_desc->push_font(doc_title_font); + class_desc->add_text(TTR("Operators")); + _update_method_list(cd.operators, operator_descriptions); } // Theme properties - if (cd.theme_properties.size()) { + if (!cd.theme_properties.is_empty()) { section_line.push_back(Pair(TTR("Theme Properties"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); @@ -775,7 +886,7 @@ void EditorHelp::_update_doc() { } // Signals - if (cd.signals.size()) { + if (!cd.signals.is_empty()) { if (sort_methods) { cd.signals.sort(); } @@ -844,7 +955,7 @@ void EditorHelp::_update_doc() { } // Constants and enums - if (cd.constants.size()) { + if (!cd.constants.is_empty()) { Map> enums; Vector constants; @@ -1195,86 +1306,31 @@ void EditorHelp::_update_doc() { } } + // Constructor descriptions + if (constructor_descriptions) { + section_line.push_back(Pair(TTR("Constructor Descriptions"), class_desc->get_line_count() - 2)); + class_desc->push_color(title_color); + class_desc->push_font(doc_title_font); + class_desc->add_text(TTR("Constructor Descriptions")); + _update_method_descriptions(cd, cd.constructors, "constructor"); + } + // Method descriptions - if (method_descr) { + if (method_descriptions) { section_line.push_back(Pair(TTR("Method Descriptions"), class_desc->get_line_count() - 2)); class_desc->push_color(title_color); class_desc->push_font(doc_title_font); class_desc->add_text(TTR("Method Descriptions")); - class_desc->pop(); - class_desc->pop(); + _update_method_descriptions(cd, methods, "method"); + } - class_desc->add_newline(); - class_desc->add_newline(); - - for (int pass = 0; pass < 2; pass++) { - Vector methods_filtered; - - for (int i = 0; i < methods.size(); i++) { - const String &q = methods[i].qualifiers; - if ((pass == 0 && q.find("virtual") != -1) || (pass == 1 && q.find("virtual") == -1)) { - methods_filtered.push_back(methods[i]); - } - } - - for (int i = 0; i < methods_filtered.size(); i++) { - class_desc->push_font(doc_code_font); - _add_method(methods_filtered[i], false); - class_desc->pop(); - - class_desc->add_newline(); - class_desc->add_newline(); - - class_desc->push_color(text_color); - class_desc->push_font(doc_font); - class_desc->push_indent(1); - if (methods_filtered[i].errors_returned.size()) { - class_desc->append_text(TTR("Error codes returned:")); - class_desc->add_newline(); - class_desc->push_list(0, RichTextLabel::LIST_DOTS, false); - for (int j = 0; j < methods_filtered[i].errors_returned.size(); j++) { - if (j > 0) { - class_desc->add_newline(); - } - int val = methods_filtered[i].errors_returned[j]; - String text = itos(val); - for (int k = 0; k < CoreConstants::get_global_constant_count(); k++) { - if (CoreConstants::get_global_constant_value(k) == val && CoreConstants::get_global_constant_enum(k) == SNAME("Error")) { - text = CoreConstants::get_global_constant_name(k); - break; - } - } - - class_desc->push_bold(); - class_desc->append_text(text); - class_desc->pop(); - } - class_desc->pop(); - class_desc->add_newline(); - class_desc->add_newline(); - } - if (!methods_filtered[i].description.strip_edges().is_empty()) { - _add_text(DTR(methods_filtered[i].description)); - } else { - class_desc->add_image(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); - class_desc->add_text(" "); - class_desc->push_color(comment_color); - if (cd.is_script_doc) { - class_desc->append_text(TTR("There is currently no description for this method.")); - } else { - class_desc->append_text(TTR("There is currently no description for this method. Please help us by [color=$color][url=$url]contributing one[/url][/color]!").replace("$url", CONTRIBUTE_URL).replace("$color", link_color_text)); - } - class_desc->pop(); - } - - class_desc->pop(); - class_desc->pop(); - class_desc->pop(); - class_desc->add_newline(); - class_desc->add_newline(); - class_desc->add_newline(); - } - } + // Operator descriptions + if (operator_descriptions) { + section_line.push_back(Pair(TTR("Operator Descriptions"), class_desc->get_line_count() - 2)); + class_desc->push_color(title_color); + class_desc->push_font(doc_title_font); + class_desc->add_text(TTR("Operator Descriptions")); + _update_method_descriptions(cd, cd.operators, "operator"); } scroll_locked = false; } diff --git a/editor/editor_help.h b/editor/editor_help.h index 46605b67637..c0f3f66505c 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -152,6 +152,8 @@ class EditorHelp : public VBoxContainer { Error _goto_desc(const String &p_class, int p_vscr = -1); //void _update_history_buttons(); + void _update_method_list(const Vector p_methods, bool &r_method_descrpitons); + void _update_method_descriptions(const DocData::ClassDoc p_classdoc, const Vector p_methods, const String &p_method_type); void _update_doc(); void _request_help(const String &p_string); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index e56b10720dc..8504745b035 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -226,7 +226,9 @@ EditorHelpSearch::EditorHelpSearch() { filter_combo->add_item(TTR("Display All"), SEARCH_ALL); filter_combo->add_separator(); filter_combo->add_item(TTR("Classes Only"), SEARCH_CLASSES); + filter_combo->add_item(TTR("Constructors Only"), SEARCH_CONSTRUCTORS); filter_combo->add_item(TTR("Methods Only"), SEARCH_METHODS); + filter_combo->add_item(TTR("Operators Only"), SEARCH_OPERATORS); filter_combo->add_item(TTR("Signals Only"), SEARCH_SIGNALS); filter_combo->add_item(TTR("Constants Only"), SEARCH_CONSTANTS); filter_combo->add_item(TTR("Properties Only"), SEARCH_PROPERTIES); @@ -334,6 +336,17 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { // Match members if the term is long enough. if (term.length() > 1) { + if (search_flags & SEARCH_CONSTRUCTORS) { + for (int i = 0; i < class_doc.constructors.size(); i++) { + String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.constructors[i].name : class_doc.constructors[i].name.to_lower(); + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.substr(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { + match.constructors.push_back(const_cast(&class_doc.constructors[i])); + } + } + } if (search_flags & SEARCH_METHODS) { for (int i = 0; i < class_doc.methods.size(); i++) { String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.methods[i].name : class_doc.methods[i].name.to_lower(); @@ -345,6 +358,17 @@ bool EditorHelpSearch::Runner::_phase_match_classes() { } } } + if (search_flags & SEARCH_OPERATORS) { + for (int i = 0; i < class_doc.operators.size(); i++) { + String method_name = (search_flags & SEARCH_CASE_SENSITIVE) ? class_doc.operators[i].name : class_doc.operators[i].name.to_lower(); + if (method_name.find(term) > -1 || + (term.begins_with(".") && method_name.begins_with(term.substr(1))) || + (term.ends_with("(") && method_name.ends_with(term.left(term.length() - 1).strip_edges())) || + (term.begins_with(".") && term.ends_with("(") && method_name == term.substr(1, term.length() - 2).strip_edges())) { + match.operators.push_back(const_cast(&class_doc.operators[i])); + } + } + } if (search_flags & SEARCH_SIGNALS) { for (int i = 0; i < class_doc.signals.size(); i++) { if (_match_string(term, class_doc.signals[i].name)) { diff --git a/editor/editor_help_search.h b/editor/editor_help_search.h index bc57c0e3c6a..7285f76c019 100644 --- a/editor/editor_help_search.h +++ b/editor/editor_help_search.h @@ -43,12 +43,14 @@ class EditorHelpSearch : public ConfirmationDialog { enum SearchFlags { SEARCH_CLASSES = 1 << 0, - SEARCH_METHODS = 1 << 1, - SEARCH_SIGNALS = 1 << 2, - SEARCH_CONSTANTS = 1 << 3, - SEARCH_PROPERTIES = 1 << 4, - SEARCH_THEME_ITEMS = 1 << 5, - SEARCH_ALL = SEARCH_CLASSES | SEARCH_METHODS | SEARCH_SIGNALS | SEARCH_CONSTANTS | SEARCH_PROPERTIES | SEARCH_THEME_ITEMS, + SEARCH_CONSTRUCTORS = 1 << 1, + SEARCH_METHODS = 1 << 2, + SEARCH_OPERATORS = 1 << 3, + SEARCH_SIGNALS = 1 << 4, + SEARCH_CONSTANTS = 1 << 5, + SEARCH_PROPERTIES = 1 << 6, + SEARCH_THEME_ITEMS = 1 << 7, + SEARCH_ALL = SEARCH_CLASSES | SEARCH_CONSTRUCTORS | SEARCH_METHODS | SEARCH_OPERATORS | SEARCH_SIGNALS | SEARCH_CONSTANTS | SEARCH_PROPERTIES | SEARCH_THEME_ITEMS, SEARCH_CASE_SENSITIVE = 1 << 29, SEARCH_SHOW_HIERARCHY = 1 << 30 }; @@ -99,7 +101,9 @@ class EditorHelpSearch::Runner : public RefCounted { struct ClassMatch { DocData::ClassDoc *doc; bool name = false; + Vector constructors; Vector methods; + Vector operators; Vector signals; Vector constants; Vector properties; diff --git a/modules/gdscript/language_server/gdscript_workspace.cpp b/modules/gdscript/language_server/gdscript_workspace.cpp index 371e3de4191..932bfb2caa2 100644 --- a/modules/gdscript/language_server/gdscript_workspace.cpp +++ b/modules/gdscript/language_server/gdscript_workspace.cpp @@ -338,7 +338,9 @@ Error GDScriptWorkspace::initialize() { } Vector methods_signals; + methods_signals.append_array(class_data.constructors); methods_signals.append_array(class_data.methods); + methods_signals.append_array(class_data.operators); const int signal_start_idx = methods_signals.size(); methods_signals.append_array(class_data.signals);