Document how Vector2, Vector3 and Color behave in a boolean context
See #39731.
(cherry picked from commit 227f12478d
)
This commit is contained in:
parent
d9beab34c5
commit
9889641bae
|
@ -7,6 +7,7 @@
|
||||||
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.
|
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].
|
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].
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
|
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].
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
|
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
3-element structure that can be used to represent positions in 3D space or any other pair of numeric values.
|
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].
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
|
<link>https://docs.godotengine.org/en/latest/tutorials/math/index.html</link>
|
||||||
|
|
Loading…
Reference in New Issue