From 9889641bae20571dd133668a0df6c5f2bf59301b 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. (cherry picked from commit 227f12478d2d29fc3884388d973a4de654d6651f) --- doc/classes/Color.xml | 3 ++- doc/classes/Vector2.xml | 1 + doc/classes/Vector3.xml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index e8761d6f12d..b54911b1873 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 0ee727acaa8..feb468b4a41 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -5,6 +5,7 @@ 2-element structure that can be used to represent positions in 2D space or any other pair of numeric values. + [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/Vector3.xml b/doc/classes/Vector3.xml index 8b6b6970497..5d192008263 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -5,6 +5,7 @@ 3-element structure that can be used to represent positions in 3D space or any other pair of numeric values. + [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