From 227f12478d2d29fc3884388d973a4de654d6651f Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 21 Jun 2020 17:16:10 +0200 Subject: [PATCH] Document how Vector2, Vector3 and Color behave in a boolean context See #39731. --- doc/classes/Color.xml | 3 ++- doc/classes/Vector2.xml | 3 ++- doc/classes/Vector2i.xml | 3 ++- doc/classes/Vector3.xml | 3 ++- doc/classes/Vector3i.xml | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index b35d4fb36a9..17b474531ee 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -5,8 +5,9 @@ A color is represented by red, green, and blue [code](r, g, b)[/code] components. Additionally, [code]a[/code] represents the alpha component, often used for transparency. Values are in floating-point and usually range from 0 to 1. Some properties (such as [member CanvasItem.modulate]) may accept values greater than 1. - You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. + You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. + [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 64ebc1fa09c..7f4a212679e 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -5,7 +5,8 @@ 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. - It uses floating point coordinates. + It uses floating-point coordinates. See [Vector2i] for its integer counterpart. + [b]Note:[/b] In a boolean context, a Vector2 will evaluate to [code]false[/code] if it's equal to [code]Vector2(0, 0)[/code]. Otherwise, a Vector2 will always evaluate to [code]true[/code]. https://docs.godotengine.org/en/latest/tutorials/math/index.html diff --git a/doc/classes/Vector2i.xml b/doc/classes/Vector2i.xml index 71c7aaa4e5c..2f7ca985b2e 100644 --- a/doc/classes/Vector2i.xml +++ b/doc/classes/Vector2i.xml @@ -5,7 +5,8 @@ 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. - It uses integer coordinates. + It uses integer coordinates and is therefore preferable to [Vector2] when exact precision is required. + [b]Note:[/b] In a boolean context, a Vector2i will evaluate to [code]false[/code] if it's equal to [code]Vector2i(0, 0)[/code]. Otherwise, a Vector2i will always evaluate to [code]true[/code]. https://docs.godotengine.org/en/latest/tutorials/math/index.html diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 29222bb4d12..0c861e5ee2f 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -5,7 +5,8 @@ 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. - It uses floating point coordinates. + It uses floating-point coordinates. See [Vector3i] for its integer counterpart. + [b]Note:[/b] In a boolean context, a Vector3 will evaluate to [code]false[/code] if it's equal to [code]Vector3(0, 0, 0)[/code]. Otherwise, a Vector3 will always evaluate to [code]true[/code]. https://docs.godotengine.org/en/latest/tutorials/math/index.html diff --git a/doc/classes/Vector3i.xml b/doc/classes/Vector3i.xml index c5aa3d03472..91d64ea609b 100644 --- a/doc/classes/Vector3i.xml +++ b/doc/classes/Vector3i.xml @@ -5,7 +5,8 @@ 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. - It uses integer coordinates. + It uses integer coordinates and is therefore preferable to [Vector3] when exact precision is required. + [b]Note:[/b] In a boolean context, a Vector3i will evaluate to [code]false[/code] if it's equal to [code]Vector3i(0, 0, 0)[/code]. Otherwise, a Vector3i will always evaluate to [code]true[/code]. https://docs.godotengine.org/en/latest/tutorials/math/index.html