Skip to content

Commit 227f124

Browse files
committed
Document how Vector2, Vector3 and Color behave in a boolean context
See godotengine#39731.
1 parent 277d2f1 commit 227f124

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

doc/classes/Color.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
</brief_description>
66
<description>
77
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.
8-
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].
8+
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].
99
If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8].
10+
[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].
1011
</description>
1112
<tutorials>
1213
</tutorials>

doc/classes/Vector2.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
</brief_description>
66
<description>
77
2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
8-
It uses floating point coordinates.
8+
It uses floating-point coordinates. See [Vector2i] for its integer counterpart.
9+
[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].
910
</description>
1011
<tutorials>
1112
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>

doc/classes/Vector2i.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
</brief_description>
66
<description>
77
2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
8-
It uses integer coordinates.
8+
It uses integer coordinates and is therefore preferable to [Vector2] when exact precision is required.
9+
[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].
910
</description>
1011
<tutorials>
1112
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>

doc/classes/Vector3.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
</brief_description>
66
<description>
77
3-element structure that can be used to represent positions in 3D space or any other pair of numeric values.
8-
It uses floating point coordinates.
8+
It uses floating-point coordinates. See [Vector3i] for its integer counterpart.
9+
[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].
910
</description>
1011
<tutorials>
1112
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>

doc/classes/Vector3i.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
</brief_description>
66
<description>
77
3-element structure that can be used to represent positions in 3D space or any other pair of numeric values.
8-
It uses integer coordinates.
8+
It uses integer coordinates and is therefore preferable to [Vector3] when exact precision is required.
9+
[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].
910
</description>
1011
<tutorials>
1112
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>

0 commit comments

Comments
 (0)