Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ Returns ``true`` if ``value`` is an instance of ``type``. The ``type`` value mus

Unlike the right operand of the ``is`` operator, ``type`` can be a non-constant value. The ``is`` operator supports more features (such as typed arrays). Use the operator instead of this method if you do not need dynamic type checking.

Examples:
\ **Examples:**\

::

Expand Down Expand Up @@ -1166,7 +1166,7 @@ Returns an array with the given range. :ref:`range<class_@GDScript_method_range>

\ **Note:** Returns an empty array if no value meets the value constraint (e.g. ``range(2, 5, -1)`` or ``range(5, 5, 1)``).

Examples:
\ **Examples:**\

::

Expand Down
13 changes: 4 additions & 9 deletions classes/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3045,9 +3045,7 @@ enum **Error**: :ref:`🔗<enum_@GlobalScope_Error>`

Methods that return :ref:`Error<enum_@GlobalScope_Error>` return :ref:`OK<class_@GlobalScope_constant_OK>` when no error occurred.

Since :ref:`OK<class_@GlobalScope_constant_OK>` has value 0, and all other error constants are positive integers, it can also be used in boolean checks.

\ **Example:**\
Since :ref:`OK<class_@GlobalScope_constant_OK>` has value ``0``, and all other error constants are positive integers, it can also be used in boolean checks.

::

Expand Down Expand Up @@ -3702,7 +3700,7 @@ If a property is :ref:`Array<class_Array>`, hints the editor how to show element



Examples:
\ **Examples:**\


.. tabs::
Expand Down Expand Up @@ -6150,15 +6148,12 @@ See also :ref:`inverse_lerp<class_@GlobalScope_method_inverse_lerp>` which perfo

:ref:`float<class_float>` **linear_to_db**\ (\ lin\: :ref:`float<class_float>`\ ) :ref:`🔗<class_@GlobalScope_method_linear_to_db>`

Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear).
Converts from linear energy to decibels (audio). Since volume is not normally linear, this can be used to implement volume sliders that behave as expected.

\ **Example:**\
\ **Example:** Change the Master bus's volume through a :ref:`Slider<class_Slider>` node, which ranges from ``0.0`` to ``1.0``:

::

# "Slider" refers to a node that inherits Range such as HSlider or VSlider.
# Its range must be configured to go from 0 to 1.
# Change the bus name if you'd like to change the volume of a specific bus only.
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db($Slider.value))

.. rst-class:: classref-item-separator
Expand Down
7 changes: 2 additions & 5 deletions classes/class_animatedsprite2d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -413,18 +413,15 @@ This method is a shorthand for :ref:`play<class_AnimatedSprite2D_method_play>` w

|void| **set_frame_and_progress**\ (\ frame\: :ref:`int<class_int>`, progress\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimatedSprite2D_method_set_frame_and_progress>`

The setter of :ref:`frame<class_AnimatedSprite2D_property_frame>` resets the :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` to ``0.0`` implicitly, but this method avoids that.
Sets :ref:`frame<class_AnimatedSprite2D_property_frame>` the :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` to the given values. Unlike setting :ref:`frame<class_AnimatedSprite2D_property_frame>`, this method does not reset the :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` to ``0.0`` implicitly.

This is useful when you want to carry over the current :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>` to another :ref:`frame<class_AnimatedSprite2D_property_frame>`.

\ **Example:**\
\ **Example:** Change the animation while keeping the same :ref:`frame<class_AnimatedSprite2D_property_frame>` and :ref:`frame_progress<class_AnimatedSprite2D_property_frame_progress>`.


.. tabs::

.. code-tab:: gdscript

# Change the animation with keeping the frame index and progress.
var current_frame = animated_sprite.get_frame()
var current_progress = animated_sprite.get_frame_progress()
animated_sprite.play("walk_another_skin")
Expand Down
7 changes: 2 additions & 5 deletions classes/class_animatedsprite3d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -333,18 +333,15 @@ This method is a shorthand for :ref:`play<class_AnimatedSprite3D_method_play>` w

|void| **set_frame_and_progress**\ (\ frame\: :ref:`int<class_int>`, progress\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimatedSprite3D_method_set_frame_and_progress>`

The setter of :ref:`frame<class_AnimatedSprite3D_property_frame>` resets the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to ``0.0`` implicitly, but this method avoids that.
Sets :ref:`frame<class_AnimatedSprite3D_property_frame>` the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to the given values. Unlike setting :ref:`frame<class_AnimatedSprite3D_property_frame>`, this method does not reset the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to ``0.0`` implicitly.

This is useful when you want to carry over the current :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to another :ref:`frame<class_AnimatedSprite3D_property_frame>`.

\ **Example:**\
\ **Example:** Change the animation while keeping the same :ref:`frame<class_AnimatedSprite3D_property_frame>` and :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>`.


.. tabs::

.. code-tab:: gdscript

# Change the animation with keeping the frame index and progress.
var current_frame = animated_sprite.get_frame()
var current_progress = animated_sprite.get_frame_progress()
animated_sprite.play("walk_another_skin")
Expand Down
2 changes: 0 additions & 2 deletions classes/class_animationnodestatemachine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Description

Contains multiple :ref:`AnimationRootNode<class_AnimationRootNode>`\ s representing animation states, connected in a graph. State transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the :ref:`AnimationNodeStateMachinePlayback<class_AnimationNodeStateMachinePlayback>` object from the :ref:`AnimationTree<class_AnimationTree>` node to control it programmatically.

\ **Example:**\


.. tabs::

Expand Down
2 changes: 0 additions & 2 deletions classes/class_animationnodestatemachineplayback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Description

Allows control of :ref:`AnimationTree<class_AnimationTree>` state machines created with :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>`. Retrieve with ``$AnimationTree.get("parameters/playback")``.

\ **Example:**\


.. tabs::

Expand Down
8 changes: 3 additions & 5 deletions classes/class_array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ A built-in data structure that holds a sequence of elements.
Description
-----------

An array data structure that can contain a sequence of elements of any :ref:`Variant<class_Variant>` type. Elements are accessed by a numerical index starting at 0. Negative indices are used to count from the back (-1 is the last element, -2 is the second to last, etc.).

\ **Example:**\
An array data structure that can contain a sequence of elements of any :ref:`Variant<class_Variant>` type. Elements are accessed by a numerical index starting at ``0``. Negative indices are used to count from the back (``-1`` is the last element, ``-2`` is the second to last, etc.).


.. tabs::
Expand Down Expand Up @@ -522,7 +520,7 @@ Appends another ``array`` at the end of this array.
var numbers = [1, 2, 3]
var extra = [4, 5, 6]
numbers.append_array(extra)
print(nums) # Prints [1, 2, 3, 4, 5, 6]
print(numbers) # Prints [1, 2, 3, 4, 5, 6]

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

Expand Down Expand Up @@ -1304,7 +1302,7 @@ Sorts the array using a custom :ref:`Callable<class_Callable>`.
print(my_items) # Prints [["Rice", 4], ["Tomato", 5], ["Apple", 9]]

# Sort descending, using a lambda function.
my_items.sort_custom(func(a, b): return a[0] > b[0])
my_items.sort_custom(func(a, b): return a[1] > b[1])
print(my_items) # Prints [["Apple", 9], ["Tomato", 5], ["Rice", 4]]

It may also be necessary to use this method to sort strings by natural order, with :ref:`String.naturalnocasecmp_to<class_String_method_naturalnocasecmp_to>`, as in the following example:
Expand Down
8 changes: 4 additions & 4 deletions classes/class_astar2d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Methods
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_compute_cost<class_AStar2D_private_method__compute_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar2D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar2D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_point<class_AStar2D_method_add_point>`\ (\ id\: :ref:`int<class_int>`, position\: :ref:`Vector2<class_Vector2>`, weight_scale\: :ref:`float<class_float>` = 1.0\ ) |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -110,7 +110,7 @@ Note that this function is hidden in the default **AStar2D** class.

.. rst-class:: classref-method

:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar2D_private_method__estimate_cost>`
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar2D_private_method__estimate_cost>`

Called when estimating the cost between a point and the path's ending point.

Expand Down Expand Up @@ -319,7 +319,7 @@ If there is no valid path to the target, and ``allow_partial_path`` is ``true``,
astar.ConnectPoints(2, 3, false);
astar.ConnectPoints(4, 3, false);
astar.ConnectPoints(1, 4, false);
int[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3]
long[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3]



Expand Down Expand Up @@ -376,7 +376,7 @@ Returns an array with the IDs of the points that form the connection with the gi
astar.ConnectPoints(1, 2, true);
astar.ConnectPoints(1, 3, true);

int[] neighbors = astar.GetPointConnections(1); // Returns [2, 3]
long[] neighbors = astar.GetPointConnections(1); // Returns [2, 3]



Expand Down
8 changes: 4 additions & 4 deletions classes/class_astar3d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Methods
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_compute_cost<class_AStar3D_private_method__compute_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
| :ref:`float<class_float>` | :ref:`_estimate_cost<class_AStar3D_private_method__estimate_cost>`\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`add_point<class_AStar3D_method_add_point>`\ (\ id\: :ref:`int<class_int>`, position\: :ref:`Vector3<class_Vector3>`, weight_scale\: :ref:`float<class_float>` = 1.0\ ) |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -147,7 +147,7 @@ Note that this function is hidden in the default **AStar3D** class.

.. rst-class:: classref-method

:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, to_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar3D_private_method__estimate_cost>`
:ref:`float<class_float>` **_estimate_cost**\ (\ from_id\: :ref:`int<class_int>`, end_id\: :ref:`int<class_int>`\ ) |virtual| |const| :ref:`🔗<class_AStar3D_private_method__estimate_cost>`

Called when estimating the cost between a point and the path's ending point.

Expand Down Expand Up @@ -355,7 +355,7 @@ If there is no valid path to the target, and ``allow_partial_path`` is ``true``,
astar.ConnectPoints(2, 3, false);
astar.ConnectPoints(4, 3, false);
astar.ConnectPoints(1, 4, false);
int[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3]
long[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3]



Expand Down Expand Up @@ -411,7 +411,7 @@ Returns an array with the IDs of the points that form the connection with the gi
astar.ConnectPoints(1, 2, true);
astar.ConnectPoints(1, 3, true);

int[] neighbors = astar.GetPointConnections(1); // Returns [2, 3]
long[] neighbors = astar.GetPointConnections(1); // Returns [2, 3]



Expand Down
Loading