Skip to content

Commit 3006f76

Browse files
author
Godot Organization
committed
classref: Sync with current master branch (16a9356)
1 parent dac6f82 commit 3006f76

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+667
-237
lines changed

classes/[email protected]

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,8 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_NODE_PATH_VALID_TYPES<class_@GlobalSco
538538

539539
@export_node_path("Button", "TouchScreenButton") var some_button
540540

541+
\ **Note:** The type must be a native class or a globally registered script (using the ``class_name`` keyword) that inherits :ref:`Node<class_Node>`.
542+
541543
.. rst-class:: classref-item-separator
542544

543545
----
@@ -665,7 +667,7 @@ Mark the following method for remote procedure calls. See :doc:`High-level multi
665667

666668
If ``mode`` is set as ``"any_peer"``, allows any peer to call this RPC function. Otherwise, only the authority peer is allowed to call it and ``mode`` should be kept as ``"authority"``. When configuring functions as RPCs with :ref:`Node.rpc_config<class_Node_method_rpc_config>`, each of these modes respectively corresponds to the :ref:`MultiplayerAPI.RPC_MODE_AUTHORITY<class_MultiplayerAPI_constant_RPC_MODE_AUTHORITY>` and :ref:`MultiplayerAPI.RPC_MODE_ANY_PEER<class_MultiplayerAPI_constant_RPC_MODE_ANY_PEER>` RPC modes. See :ref:`RPCMode<enum_MultiplayerAPI_RPCMode>`. If a peer that is not the authority tries to call a function that is only allowed for the authority, the function will not be executed. If the error can be detected locally (when the RPC configuration is consistent between the local and the remote peer), an error message will be displayed on the sender peer. Otherwise, the remote peer will detect the error and print an error there.
667669

668-
If ``sync`` is set as ``"call_remote"``, the function will only be executed on the remote peer, but not locally. To run this function locally too, set ``sync`` to ``"call_local"``. When configuring functions as RPCs with :ref:`Node.rpc_config<class_Node_method_rpc_config>`, this is equivalent to setting `call_local` to `true`.
670+
If ``sync`` is set as ``"call_remote"``, the function will only be executed on the remote peer, but not locally. To run this function locally too, set ``sync`` to ``"call_local"``. When configuring functions as RPCs with :ref:`Node.rpc_config<class_Node_method_rpc_config>`, this is equivalent to setting ``call_local`` to ``true``.
669671

670672
The ``transfer_mode`` accepted values are ``"unreliable"``, ``"unreliable_ordered"``, or ``"reliable"``. It sets the transfer mode of the underlying :ref:`MultiplayerPeer<class_MultiplayerPeer>`. See :ref:`MultiplayerPeer.transfer_mode<class_MultiplayerPeer_property_transfer_mode>`.
671673

classes/[email protected]

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5598,9 +5598,9 @@ Returns a human-readable name for the given :ref:`Error<enum_@GlobalScope_Error>
55985598

55995599
:ref:`float<class_float>` **exp** **(** :ref:`float<class_float>` x **)**
56005600

5601-
The natural exponential function. It raises the mathematical constant **e** to the power of ``x`` and returns it.
5601+
The natural exponential function. It raises the mathematical constant *e* to the power of ``x`` and returns it.
56025602

5603-
\ **e** has an approximate value of 2.71828, and can be obtained with ``exp(1)``.
5603+
\ *e* has an approximate value of 2.71828, and can be obtained with ``exp(1)``.
56045604

56055605
For exponents to other bases use the method :ref:`pow<class_@GlobalScope_method_pow>`.
56065606

classes/class_area3d.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Description
2323

2424
This node can also locally alter or override physics parameters (gravity, damping) and route audio to custom audio buses.
2525

26-
\ **Warning:** Using a :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` inside a :ref:`CollisionShape3D<class_CollisionShape3D>` child of this node (created e.g. by using the *Create Trimesh Collision Sibling* option in the *Mesh* menu that appears when selecting a :ref:`MeshInstance3D<class_MeshInstance3D>` node) may give unexpected results, since this collision shape is hollow. If this is not desired, it has to be split into multiple :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>`\ s or primitive shapes like :ref:`BoxShape3D<class_BoxShape3D>`, or in some cases it may be replaceable by a :ref:`CollisionPolygon3D<class_CollisionPolygon3D>`.
26+
\ **Warning:** Using a :ref:`ConcavePolygonShape3D<class_ConcavePolygonShape3D>` inside a :ref:`CollisionShape3D<class_CollisionShape3D>` child of this node (created e.g. by using the **Create Trimesh Collision Sibling** option in the **Mesh** menu that appears when selecting a :ref:`MeshInstance3D<class_MeshInstance3D>` node) may give unexpected results, since this collision shape is hollow. If this is not desired, it has to be split into multiple :ref:`ConvexPolygonShape3D<class_ConvexPolygonShape3D>`\ s or primitive shapes like :ref:`BoxShape3D<class_BoxShape3D>`, or in some cases it may be replaceable by a :ref:`CollisionPolygon3D<class_CollisionPolygon3D>`.
2727

2828
.. rst-class:: classref-introduction-group
2929

classes/class_astargrid2d.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ Methods
8989
+-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
9090
| void | :ref:`clear<class_AStarGrid2D_method_clear>` **(** **)** |
9191
+-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
92+
| void | :ref:`fill_solid_region<class_AStarGrid2D_method_fill_solid_region>` **(** :ref:`Rect2i<class_Rect2i>` region, :ref:`bool<class_bool>` solid=true **)** |
93+
+-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
94+
| void | :ref:`fill_weight_scale_region<class_AStarGrid2D_method_fill_weight_scale_region>` **(** :ref:`Rect2i<class_Rect2i>` region, :ref:`float<class_float>` weight_scale **)** |
95+
+-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
9296
| :ref:`Vector2i[]<class_Vector2i>` | :ref:`get_id_path<class_AStarGrid2D_method_get_id_path>` **(** :ref:`Vector2i<class_Vector2i>` from_id, :ref:`Vector2i<class_Vector2i>` to_id **)** |
9397
+-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
9498
| :ref:`PackedVector2Array<class_PackedVector2Array>` | :ref:`get_point_path<class_AStarGrid2D_method_get_point_path>` **(** :ref:`Vector2i<class_Vector2i>` from_id, :ref:`Vector2i<class_Vector2i>` to_id **)** |
@@ -440,6 +444,34 @@ Clears the grid and sets the :ref:`region<class_AStarGrid2D_property_region>` to
440444

441445
----
442446

447+
.. _class_AStarGrid2D_method_fill_solid_region:
448+
449+
.. rst-class:: classref-method
450+
451+
void **fill_solid_region** **(** :ref:`Rect2i<class_Rect2i>` region, :ref:`bool<class_bool>` solid=true **)**
452+
453+
Fills the given ``region`` on the grid with the specified value for the solid flag.
454+
455+
\ **Note:** Calling :ref:`update<class_AStarGrid2D_method_update>` is not needed after the call of this function.
456+
457+
.. rst-class:: classref-item-separator
458+
459+
----
460+
461+
.. _class_AStarGrid2D_method_fill_weight_scale_region:
462+
463+
.. rst-class:: classref-method
464+
465+
void **fill_weight_scale_region** **(** :ref:`Rect2i<class_Rect2i>` region, :ref:`float<class_float>` weight_scale **)**
466+
467+
Fills the given ``region`` on the grid with the specified value for the weight scale.
468+
469+
\ **Note:** Calling :ref:`update<class_AStarGrid2D_method_update>` is not needed after the call of this function.
470+
471+
.. rst-class:: classref-item-separator
472+
473+
----
474+
443475
.. _class_AStarGrid2D_method_get_id_path:
444476

445477
.. rst-class:: classref-method

classes/class_audioeffectdelay.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Feedback delay time in milliseconds.
137137
- void **set_feedback_level_db** **(** :ref:`float<class_float>` value **)**
138138
- :ref:`float<class_float>` **get_feedback_level_db** **(** **)**
139139

140-
Sound level for ``tap1``.
140+
Sound level for feedback.
141141

142142
.. rst-class:: classref-item-separator
143143

@@ -171,7 +171,7 @@ Low-pass filter for feedback, in Hz. Frequencies below this value are filtered o
171171
- void **set_tap1_active** **(** :ref:`bool<class_bool>` value **)**
172172
- :ref:`bool<class_bool>` **is_tap1_active** **(** **)**
173173

174-
If ``true``, ``tap1`` will be enabled.
174+
If ``true``, the first tap will be enabled.
175175

176176
.. rst-class:: classref-item-separator
177177

@@ -188,7 +188,7 @@ If ``true``, ``tap1`` will be enabled.
188188
- void **set_tap1_delay_ms** **(** :ref:`float<class_float>` value **)**
189189
- :ref:`float<class_float>` **get_tap1_delay_ms** **(** **)**
190190

191-
``tap1`` delay time in milliseconds.
191+
First tap delay time in milliseconds.
192192

193193
.. rst-class:: classref-item-separator
194194

@@ -205,7 +205,7 @@ If ``true``, ``tap1`` will be enabled.
205205
- void **set_tap1_level_db** **(** :ref:`float<class_float>` value **)**
206206
- :ref:`float<class_float>` **get_tap1_level_db** **(** **)**
207207

208-
Sound level for ``tap1``.
208+
Sound level for the first tap.
209209

210210
.. rst-class:: classref-item-separator
211211

@@ -222,7 +222,7 @@ Sound level for ``tap1``.
222222
- void **set_tap1_pan** **(** :ref:`float<class_float>` value **)**
223223
- :ref:`float<class_float>` **get_tap1_pan** **(** **)**
224224

225-
Pan position for ``tap1``. Value can range from -1 (fully left) to 1 (fully right).
225+
Pan position for the first tap. Value can range from -1 (fully left) to 1 (fully right).
226226

227227
.. rst-class:: classref-item-separator
228228

@@ -239,7 +239,7 @@ Pan position for ``tap1``. Value can range from -1 (fully left) to 1 (fully righ
239239
- void **set_tap2_active** **(** :ref:`bool<class_bool>` value **)**
240240
- :ref:`bool<class_bool>` **is_tap2_active** **(** **)**
241241

242-
If ``true``, ``tap2`` will be enabled.
242+
If ``true``, the second tap will be enabled.
243243

244244
.. rst-class:: classref-item-separator
245245

@@ -256,7 +256,7 @@ If ``true``, ``tap2`` will be enabled.
256256
- void **set_tap2_delay_ms** **(** :ref:`float<class_float>` value **)**
257257
- :ref:`float<class_float>` **get_tap2_delay_ms** **(** **)**
258258

259-
**Tap2** delay time in milliseconds.
259+
Second tap delay time in milliseconds.
260260

261261
.. rst-class:: classref-item-separator
262262

@@ -273,7 +273,7 @@ If ``true``, ``tap2`` will be enabled.
273273
- void **set_tap2_level_db** **(** :ref:`float<class_float>` value **)**
274274
- :ref:`float<class_float>` **get_tap2_level_db** **(** **)**
275275

276-
Sound level for ``tap2``.
276+
Sound level for the second tap.
277277

278278
.. rst-class:: classref-item-separator
279279

@@ -290,7 +290,7 @@ Sound level for ``tap2``.
290290
- void **set_tap2_pan** **(** :ref:`float<class_float>` value **)**
291291
- :ref:`float<class_float>` **get_tap2_pan** **(** **)**
292292

293-
Pan position for ``tap2``. Value can range from -1 (fully left) to 1 (fully right).
293+
Pan position for the second tap. Value can range from -1 (fully left) to 1 (fully right).
294294

295295
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
296296
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`

classes/class_audioserver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ Returns the names of all audio output devices detected on the system.
488488

489489
:ref:`float<class_float>` **get_output_latency** **(** **)** |const|
490490

491-
Returns the audio driver's output latency.
491+
Returns the audio driver's output latency. This can be expensive, it is not recommended to call this every frame.
492492

493493
.. rst-class:: classref-item-separator
494494

classes/class_basebutton.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Methods
6666
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
6767
| void | :ref:`_pressed<class_BaseButton_method__pressed>` **(** **)** |virtual| |
6868
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
69-
| void | :ref:`_toggled<class_BaseButton_method__toggled>` **(** :ref:`bool<class_bool>` button_pressed **)** |virtual| |
69+
| void | :ref:`_toggled<class_BaseButton_method__toggled>` **(** :ref:`bool<class_bool>` toggled_on **)** |virtual| |
7070
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
7171
| :ref:`DrawMode<enum_BaseButton_DrawMode>` | :ref:`get_draw_mode<class_BaseButton_method_get_draw_mode>` **(** **)** |const| |
7272
+-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------+
@@ -126,9 +126,9 @@ If you need to know the button's pressed state (and :ref:`toggle_mode<class_Base
126126

127127
.. rst-class:: classref-signal
128128

129-
**toggled** **(** :ref:`bool<class_bool>` button_pressed **)**
129+
**toggled** **(** :ref:`bool<class_bool>` toggled_on **)**
130130

131-
Emitted when the button was just toggled between pressed and normal states (only if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active). The new state is contained in the ``button_pressed`` argument.
131+
Emitted when the button was just toggled between pressed and normal states (only if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active). The new state is contained in the ``toggled_on`` argument.
132132

133133
.. rst-class:: classref-section-separator
134134

@@ -419,7 +419,7 @@ Called when the button is pressed. If you need to know the button's pressed stat
419419

420420
.. rst-class:: classref-method
421421

422-
void **_toggled** **(** :ref:`bool<class_bool>` button_pressed **)** |virtual|
422+
void **_toggled** **(** :ref:`bool<class_bool>` toggled_on **)** |virtual|
423423

424424
Called when the button is toggled (only if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active).
425425

classes/class_bone2d.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ void **set_bone_angle** **(** :ref:`float<class_float>` angle **)**
192192

193193
Sets the bone angle for the **Bone2D**. This is typically set to the rotation from the **Bone2D** to a child **Bone2D** node.
194194

195-
\ **Note:** **Note:** This is different from the **Bone2D**'s rotation. The bone's angle is the rotation of the bone shown by the gizmo, which is unaffected by the **Bone2D**'s :ref:`Node2D.transform<class_Node2D_property_transform>`.
195+
\ **Note:** This is different from the **Bone2D**'s rotation. The bone's angle is the rotation of the bone shown by the gizmo, which is unaffected by the **Bone2D**'s :ref:`Node2D.transform<class_Node2D_property_transform>`.
196196

197197
.. rst-class:: classref-item-separator
198198

classes/class_bool.rst

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,56 +17,62 @@ A built-in boolean type.
1717
Description
1818
-----------
1919

20-
A **bool** is always one of two values: ``true`` or ``false``, similar to a switch that is either on or off. Booleans are used in programming for logic in condition statements.
20+
The **bool** is a built-in :ref:`Variant<class_Variant>` type that may only store one of two values: ``true`` or ``false``. You can imagine it as a switch that can be either turned on or off, or as a binary digit that can either be 1 or 0.
2121

22-
Booleans can be directly used in ``if`` and ``elif`` statements. You don't need to add ``== true`` or ``== false``:
22+
Booleans can be directly used in ``if``, and other conditional statements:
2323

2424

2525
.. tabs::
2626

2727
.. code-tab:: gdscript
2828

29+
var can_shoot = true
2930
if can_shoot:
3031
launch_bullet()
3132

3233
.. code-tab:: csharp
3334

35+
bool canShoot = true;
3436
if (canShoot)
3537
{
36-
launchBullet();
38+
LaunchBullet();
3739
}
3840

3941

4042

41-
Many common methods and operations return **bool**\ s, for example, ``shooting_cooldown <= 0.0`` may evaluate to ``true`` or ``false`` depending on the number's value.
43+
All comparison operators return booleans (``==``, ``>``, ``<=``, etc.). As such, it is not necessary to compare booleans themselves. You do not need to add ``== true`` or ``== false``.
4244

43-
\ **bool**\ s are usually used with the logical operators ``and``, ``or``, and ``not`` to create complex conditions:
45+
Booleans can be combined with the logical operators ``and``, ``or``, ``not`` to create complex conditions:
4446

4547

4648
.. tabs::
4749

4850
.. code-tab:: gdscript
4951

50-
if bullets > 0 and not is_reloading:
52+
if bullets > 0 and not is_reloading():
5153
launch_bullet()
5254

53-
if bullets == 0 or is_reloading:
55+
if bullets == 0 or is_reloading():
5456
play_clack_sound()
5557

5658
.. code-tab:: csharp
5759

58-
if (bullets > 0 && !isReloading)
60+
if (bullets > 0 && !IsReloading())
5961
{
60-
launchBullet();
62+
LaunchBullet();
6163
}
6264

63-
if (bullets == 0 || isReloading)
65+
if (bullets == 0 || IsReloading())
6466
{
65-
playClackSound();
67+
PlayClackSound();
6668
}
6769

6870

6971

72+
\ **Note:** In modern programming languages, logical operators are evaluated in order. All remaining conditions are skipped if their result would have no effect on the final value. This concept is known as `short-circuit evaluation <https://en.wikipedia.org/wiki/Short-circuit_evaluation>`__ and can be useful to avoid evaluating expensive conditions in some performance-critical cases.
73+
74+
\ **Note:** By convention, built-in methods and properties that return booleans are usually defined as yes-no questions, single adjectives, or similar (:ref:`String.is_empty<class_String_method_is_empty>`, :ref:`Node.can_process<class_Node_method_can_process>`, :ref:`Camera2D.enabled<class_Camera2D_property_enabled>`, etc.).
75+
7076
.. rst-class:: classref-reftable-group
7177

7278
Constructors
@@ -118,7 +124,7 @@ Constructor Descriptions
118124

119125
:ref:`bool<class_bool>` **bool** **(** **)**
120126

121-
Constructs a default-initialized **bool** set to ``false``.
127+
Constructs a **bool** set to ``false``.
122128

123129
.. rst-class:: classref-item-separator
124130

@@ -138,7 +144,7 @@ Constructs a **bool** as a copy of the given **bool**.
138144

139145
:ref:`bool<class_bool>` **bool** **(** :ref:`float<class_float>` from **)**
140146

141-
Cast a :ref:`float<class_float>` value to a boolean value. This method will return ``false`` if ``0.0`` is passed in, and ``true`` for all other values.
147+
Cast a :ref:`float<class_float>` value to a boolean value. Returns ``false`` if ``from`` is equal to ``0.0`` (including ``-0.0``), and ``true`` for all other values (including :ref:`@GDScript.INF<class_@GDScript_constant_INF>` and :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`).
142148

143149
.. rst-class:: classref-item-separator
144150

@@ -148,7 +154,7 @@ Cast a :ref:`float<class_float>` value to a boolean value. This method will retu
148154

149155
:ref:`bool<class_bool>` **bool** **(** :ref:`int<class_int>` from **)**
150156

151-
Cast an :ref:`int<class_int>` value to a boolean value. This method will return ``false`` if ``0`` is passed in, and ``true`` for all other values.
157+
Cast an :ref:`int<class_int>` value to a boolean value. Returns ``false`` if ``from`` is equal to ``0``, and ``true`` for all other values.
152158

153159
.. rst-class:: classref-section-separator
154160

@@ -165,7 +171,7 @@ Operator Descriptions
165171

166172
:ref:`bool<class_bool>` **operator !=** **(** :ref:`bool<class_bool>` right **)**
167173

168-
Returns ``true`` if two bools are different, i.e. one is ``true`` and the other is ``false``.
174+
Returns ``true`` if the two booleans are not equal. That is, one is ``true`` and the other is ``false``. This operation can be seen as a logical XOR.
169175

170176
.. rst-class:: classref-item-separator
171177

@@ -189,7 +195,7 @@ Returns ``true`` if the left operand is ``false`` and the right operand is ``tru
189195

190196
:ref:`bool<class_bool>` **operator ==** **(** :ref:`bool<class_bool>` right **)**
191197

192-
Returns ``true`` if two bools are equal, i.e. both are ``true`` or both are ``false``.
198+
Returns ``true`` if the two booleans are equal. That is, both are ``true`` or both are ``false``. This operation can be seen as a logical EQ or XNOR.
193199

194200
.. rst-class:: classref-item-separator
195201

0 commit comments

Comments
 (0)