Skip to content

Commit 6febc8e

Browse files
author
Godot Organization
committed
classref: Sync with current master branch (c64afeb)
1 parent 0757559 commit 6febc8e

File tree

274 files changed

+16441
-4432
lines changed

Some content is hidden

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

274 files changed

+16441
-4432
lines changed

classes/class_@gdscript.rst

+41-7
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Mark the following property as exported (editable in the Inspector dock and save
133133
@export var string = ""
134134
@export var int_number = 5
135135
@export var float_number: float = 5
136-
@export var image : Image
136+
@export var image: Image
137137

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

@@ -173,7 +173,7 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_COLOR_NO_ALPHA<class_@GlobalScope_cons
173173

174174
::
175175

176-
@export_color_no_alpha var dye_color : Color
176+
@export_color_no_alpha var dye_color: Color
177177

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

@@ -418,6 +418,24 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_LAYERS_3D_RENDER<class_@GlobalScope_co
418418

419419
----
420420

421+
.. _class_@GDScript_annotation_@export_flags_avoidance:
422+
423+
.. rst-class:: classref-annotation
424+
425+
**@export_flags_avoidance** **(** **)**
426+
427+
Export an integer property as a bit flag field for navigation avoidance layers. The widget in the Inspector dock will use the layer names defined in :ref:`ProjectSettings.layer_names/avoidance/layer_1<class_ProjectSettings_property_layer_names/avoidance/layer_1>`.
428+
429+
See also :ref:`@GlobalScope.PROPERTY_HINT_LAYERS_AVOIDANCE<class_@GlobalScope_constant_PROPERTY_HINT_LAYERS_AVOIDANCE>`.
430+
431+
::
432+
433+
@export_flags_avoidance var avoidance_layers: int
434+
435+
.. rst-class:: classref-item-separator
436+
437+
----
438+
421439
.. _class_@GDScript_annotation_@export_global_dir:
422440

423441
.. rst-class:: classref-annotation
@@ -465,7 +483,7 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_GLOBAL_FILE<class_@GlobalScope_constan
465483

466484
Define a new group for the following exported properties. This helps to organize properties in the Inspector dock. Groups can be added with an optional ``prefix``, which would make group to only consider properties that have this prefix. The grouping will break on the first property that doesn't have a prefix. The prefix is also removed from the property's name in the Inspector dock.
467485

468-
If no ``prefix`` is provided, the every following property is added to the group. The group ends when then next group or category is defined. You can also force end a group by using this annotation with empty strings for parameters, ``@export_group("", "")``.
486+
If no ``prefix`` is provided, then every following property will be added to the group. The group ends when then next group or category is defined. You can also force end a group by using this annotation with empty strings for parameters, ``@export_group("", "")``.
469487

470488
Groups cannot be nested, use :ref:`@export_subgroup<class_@GDScript_annotation_@export_subgroup>` to add subgroups within groups.
471489

@@ -662,6 +680,18 @@ The order of ``mode``, ``sync`` and ``transfer_mode`` does not matter and all ar
662680

663681
----
664682

683+
.. _class_@GDScript_annotation_@static_unload:
684+
685+
.. rst-class:: classref-annotation
686+
687+
**@static_unload** **(** **)**
688+
689+
Make a script with static variables to not persist after all references are lost. If the script is loaded again the static variables will revert to their default values.
690+
691+
.. rst-class:: classref-item-separator
692+
693+
----
694+
665695
.. _class_@GDScript_annotation_@tool:
666696

667697
.. rst-class:: classref-annotation
@@ -712,14 +742,16 @@ Method Descriptions
712742

713743
:ref:`Color<class_Color>` **Color8** **(** :ref:`int<class_int>` r8, :ref:`int<class_int>` g8, :ref:`int<class_int>` b8, :ref:`int<class_int>` a8=255 **)**
714744

715-
Returns a :ref:`Color<class_Color>` constructed from red (``r8``), green (``g8``), blue (``b8``), and optionally alpha (``a8``) integer channels, each divided by ``255.0`` for their final value.
745+
Returns a :ref:`Color<class_Color>` constructed from red (``r8``), green (``g8``), blue (``b8``), and optionally alpha (``a8``) integer channels, each divided by ``255.0`` for their final value. Using :ref:`Color8<class_@GDScript_method_Color8>` instead of the standard :ref:`Color<class_Color>` constructor is useful when you need to match exact color values in an :ref:`Image<class_Image>`.
716746

717747
::
718748

719749
var red = Color8(255, 0, 0) # Same as Color(1, 0, 0).
720750
var dark_blue = Color8(0, 0, 51) # Same as Color(0, 0, 0.2).
721751
var my_color = Color8(306, 255, 0, 102) # Same as Color(1.2, 1, 0, 0.4).
722752

753+
\ **Note:** Due to the lower precision of :ref:`Color8<class_@GDScript_method_Color8>` compared to the standard :ref:`Color<class_Color>` constructor, a color created with :ref:`Color8<class_@GDScript_method_Color8>` will generally not be equal to the same color created with the standard :ref:`Color<class_Color>` constructor. Use :ref:`Color.is_equal_approx<class_Color_method_is_equal_approx>` for comparisons to avoid issues with floating-point precision error.
754+
723755
.. rst-class:: classref-item-separator
724756

725757
----
@@ -887,7 +919,7 @@ Examples:
887919
print(is_instance_of(a, MyClass))
888920
print(is_instance_of(a, MyClass.InnerClass))
889921

890-
\ **Note:** If ``value`` and/or ``type`` are freed objects (see :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>`), or ``type`` is not one of the above options, this method will raise an runtime error.
922+
\ **Note:** If ``value`` and/or ``type`` are freed objects (see :ref:`@GlobalScope.is_instance_valid<class_@GlobalScope_method_is_instance_valid>`), or ``type`` is not one of the above options, this method will raise a runtime error.
891923

892924
See also :ref:`@GlobalScope.typeof<class_@GlobalScope_method_typeof>`, :ref:`type_exists<class_@GDScript_method_type_exists>`, :ref:`Array.is_same_typed<class_Array_method_is_same_typed>` (and other :ref:`Array<class_Array>` methods).
893925

@@ -936,6 +968,8 @@ This function is a simplified version of :ref:`ResourceLoader.load<class_Resourc
936968

937969
\ **Note:** Files have to be imported into the engine first to load them using this function. If you want to load :ref:`Image<class_Image>`\ s at run-time, you may use :ref:`Image.load<class_Image_method_load>`. If you want to import audio files, you can use the snippet described in :ref:`AudioStreamMP3.data<class_AudioStreamMP3_property_data>`.
938970

971+
\ **Note:** If :ref:`ProjectSettings.editor/export/convert_text_resources_to_binary<class_ProjectSettings_property_editor/export/convert_text_resources_to_binary>` is ``true``, :ref:`load<class_@GDScript_method_load>` will not be able to read converted files in an exported project. If you rely on run-time loading of files present within the PCK, set :ref:`ProjectSettings.editor/export/convert_text_resources_to_binary<class_ProjectSettings_property_editor/export/convert_text_resources_to_binary>` to ``false``.
972+
939973
.. rst-class:: classref-item-separator
940974

941975
----
@@ -1034,8 +1068,8 @@ To iterate over an :ref:`Array<class_Array>` backwards, use:
10341068
::
10351069

10361070
var array = [3, 6, 9]
1037-
for i in range(array.size(), 0, -1):
1038-
print(array[i - 1])
1071+
for i in range(array.size() - 1, -1, -1):
1072+
print(array[i])
10391073

10401074
Output:
10411075

classes/class_@globalscope.rst

+45-21
Original file line numberDiff line numberDiff line change
@@ -3509,6 +3509,14 @@ Hints that an :ref:`int<class_int>` property is a bitmask using the optionally n
35093509

35103510
Hints that an :ref:`int<class_int>` property is a bitmask using the optionally named 3D navigation layers.
35113511

3512+
.. _class_@GlobalScope_constant_PROPERTY_HINT_LAYERS_AVOIDANCE:
3513+
3514+
.. rst-class:: classref-enumeration-constant
3515+
3516+
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_LAYERS_AVOIDANCE** = ``37``
3517+
3518+
Hints that an integer property is a bitmask using the optionally named avoidance layers.
3519+
35123520
.. _class_@GlobalScope_constant_PROPERTY_HINT_FILE:
35133521

35143522
.. rst-class:: classref-enumeration-constant
@@ -3714,7 +3722,7 @@ Hints that a string property is a password, and every character is replaced with
37143722

37153723
.. rst-class:: classref-enumeration-constant
37163724

3717-
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_MAX** = ``37``
3725+
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_MAX** = ``38``
37183726

37193727
Represents the size of the :ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` enum.
37203728

@@ -3758,7 +3766,7 @@ The property is shown in the :ref:`EditorInspector<class_EditorInspector>` (defa
37583766

37593767
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` **PROPERTY_USAGE_INTERNAL** = ``8``
37603768

3761-
3769+
The property is excluded from the class reference.
37623770

37633771
.. _class_@GlobalScope_constant_PROPERTY_USAGE_CHECKABLE:
37643772

@@ -3960,6 +3968,14 @@ The property is only shown in the editor if modern renderers are supported (the
39603968

39613969
The property is read-only in the :ref:`EditorInspector<class_EditorInspector>`.
39623970

3971+
.. _class_@GlobalScope_constant_PROPERTY_USAGE_SECRET:
3972+
3973+
.. rst-class:: classref-enumeration-constant
3974+
3975+
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` **PROPERTY_USAGE_SECRET** = ``536870912``
3976+
3977+
An export preset property with this flag contains confidential information and is stored separately from the rest of the export preset configuration.
3978+
39633979
.. _class_@GlobalScope_constant_PROPERTY_USAGE_DEFAULT:
39643980

39653981
.. rst-class:: classref-enumeration-constant
@@ -5114,7 +5130,7 @@ Returns the absolute value of int parameter ``x`` (i.e. positive value).
51145130

51155131
:ref:`float<class_float>` **acos** **(** :ref:`float<class_float>` x **)**
51165132

5117-
Returns the arc cosine of ``x`` in radians. Use to get the angle of cosine ``x``. ``x`` must be between ``-1.0`` and ``1.0`` (inclusive), otherwise, :ref:`acos<class_@GlobalScope_method_acos>` will return :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`.
5133+
Returns the arc cosine of ``x`` in radians. Use to get the angle of cosine ``x``. ``x`` will be clamped between ``-1.0`` and ``1.0`` (inclusive), in order to prevent :ref:`acos<class_@GlobalScope_method_acos>` from returning :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`.
51185134

51195135
::
51205136

@@ -5131,7 +5147,7 @@ Returns the arc cosine of ``x`` in radians. Use to get the angle of cosine ``x``
51315147

51325148
:ref:`float<class_float>` **asin** **(** :ref:`float<class_float>` x **)**
51335149

5134-
Returns the arc sine of ``x`` in radians. Use to get the angle of sine ``x``. ``x`` must be between ``-1.0`` and ``1.0`` (inclusive), otherwise, :ref:`asin<class_@GlobalScope_method_asin>` will return :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`.
5150+
Returns the arc sine of ``x`` in radians. Use to get the angle of sine ``x``. ``x`` will be clamped between ``-1.0`` and ``1.0`` (inclusive), in order to prevent :ref:`asin<class_@GlobalScope_method_asin>` from returning :ref:`@GDScript.NAN<class_@GDScript_constant_NAN>`.
51355151

51365152
::
51375153

@@ -5904,7 +5920,7 @@ Linearly interpolates between two values by the factor defined in ``weight``. To
59045920

59055921
::
59065922

5907-
lerp(0, 4, 0.75) # Returns 3.0
5923+
lerpf(0, 4, 0.75) # Returns 3.0
59085924

59095925
See also :ref:`inverse_lerp<class_@GlobalScope_method_inverse_lerp>` which performs the reverse of this operation. To perform eased interpolation with :ref:`lerp<class_@GlobalScope_method_lerp>`, combine it with :ref:`ease<class_@GlobalScope_method_ease>` or :ref:`smoothstep<class_@GlobalScope_method_smoothstep>`.
59105926

@@ -5939,9 +5955,9 @@ Converts from linear energy to decibels (audio). This can be used to implement v
59395955

59405956
:ref:`float<class_float>` **log** **(** :ref:`float<class_float>` x **)**
59415957

5942-
Returns the natural logarithm of ``x``. This is the amount of time needed to reach a certain level of continuous growth.
5958+
Returns the `natural logarithm <https://en.wikipedia.org/wiki/Natural_logarithm>`__ of ``x`` (base `[i]e[/i] <https://en.wikipedia.org/wiki/E_(mathematical_constant)>`__, with *e* being approximately 2.71828). This is the amount of time needed to reach a certain level of continuous growth.
59435959

5944-
\ **Note:** This is not the same as the "log" function on most calculators, which uses a base 10 logarithm.
5960+
\ **Note:** This is not the same as the "log" function on most calculators, which uses a base 10 logarithm. To use base 10 logarithm, use ``log(x) / log(10)``.
59455961

59465962
::
59475963

@@ -6208,25 +6224,33 @@ Converts one or more arguments of any type to string in the best way possible an
62086224

62096225
void **print_rich** **(** ... **)** |vararg|
62106226

6211-
Converts one or more arguments of any type to string in the best way possible and prints them to the console. The following BBCode tags are supported: b, i, u, s, indent, code, url, center, right, color, bgcolor, fgcolor. Color tags only support named colors such as ``red``, *not* hexadecimal color codes. Unsupported tags will be left as-is in standard output.
6227+
Converts one or more arguments of any type to string in the best way possible and prints them to the console.
6228+
6229+
The following BBCode tags are supported: ``b``, ``i``, ``u``, ``s``, ``indent``, ``code``, ``url``, ``center``, ``right``, ``color``, ``bgcolor``, ``fgcolor``.
62126230

6213-
When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Displaying ANSI escape codes is currently only supported on Linux and macOS. Support for ANSI escape codes may vary across terminal emulators, especially for italic and strikethrough.
6231+
Color tags only support the following named colors: ``black``, ``red``, ``green``, ``yellow``, ``blue``, ``magenta``, ``pink``, ``purple``, ``cyan``, ``white``, ``orange``, ``gray``. Hexadecimal color codes are not supported.
6232+
6233+
URL tags only support URLs wrapped by an URL tag, not URLs with a different title.
6234+
6235+
When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Support for ANSI escape codes varies across terminal emulators, especially for italic and strikethrough. In standard output, ``code`` is represented with faint text but without any font change. Unsupported tags are left as-is in standard output.
62146236

62156237

62166238
.. tabs::
62176239

62186240
.. code-tab:: gdscript
62196241

6220-
print_rich("[code][b]Hello world![/b][/code]") # Prints out: [b]Hello world![/b]
6242+
print_rich("[color=green][b]Hello world![/b][/color]") # Prints out "Hello world!" in green with a bold font
62216243

62226244
.. code-tab:: csharp
62236245

6224-
GD.PrintRich("[code][b]Hello world![/b][/code]"); // Prints out: [b]Hello world![/b]
6246+
GD.PrintRich("[color=green][b]Hello world![/b][/color]"); // Prints out "Hello world!" in green with a bold font
62256247

62266248

62276249

62286250
\ **Note:** Consider using :ref:`push_error<class_@GlobalScope_method_push_error>` and :ref:`push_warning<class_@GlobalScope_method_push_warning>` to print error and warning messages instead of :ref:`print<class_@GlobalScope_method_print>` or :ref:`print_rich<class_@GlobalScope_method_print_rich>`. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed.
62296251

6252+
\ **Note:** On Windows, only Windows 10 and later correctly displays ANSI escape codes in standard output.
6253+
62306254
.. rst-class:: classref-item-separator
62316255

62326256
----
@@ -6735,9 +6759,9 @@ Returns ``-1.0`` if ``x`` is negative, ``1.0`` if ``x`` is positive, and ``0.0``
67356759

67366760
::
67376761

6738-
sign(-6.5) # Returns -1.0
6739-
sign(0.0) # Returns 0.0
6740-
sign(6.5) # Returns 1.0
6762+
signf(-6.5) # Returns -1.0
6763+
signf(0.0) # Returns 0.0
6764+
signf(6.5) # Returns 1.0
67416765

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

@@ -6753,9 +6777,9 @@ Returns ``-1`` if ``x`` is negative, ``1`` if ``x`` is positive, and ``0`` if if
67536777

67546778
::
67556779

6756-
sign(-6) # Returns -1
6757-
sign(0) # Returns 0
6758-
sign(6) # Returns 1
6780+
signi(-6) # Returns -1
6781+
signi(0) # Returns 0
6782+
signi(6) # Returns 1
67596783

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

@@ -6859,8 +6883,8 @@ A type-safe version of :ref:`snapped<class_@GlobalScope_method_snapped>`, return
68596883

68606884
::
68616885

6862-
snapped(32.0, 2.5) # Returns 32.5
6863-
snapped(3.14159, 0.01) # Returns 3.14
6886+
snappedf(32.0, 2.5) # Returns 32.5
6887+
snappedf(3.14159, 0.01) # Returns 3.14
68646888

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

@@ -6878,8 +6902,8 @@ A type-safe version of :ref:`snapped<class_@GlobalScope_method_snapped>`, return
68786902

68796903
::
68806904

6881-
snapped(53, 16) # Returns 48
6882-
snapped(4096, 100) # Returns 4100
6905+
snappedi(53, 16) # Returns 48
6906+
snappedi(4096, 100) # Returns 4100
68836907

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

classes/class_aabb.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ Returns ``true`` if the **AABB** is on both sides of a plane.
502502

503503
:ref:`Variant<class_Variant>` **intersects_ray** **(** :ref:`Vector3<class_Vector3>` from, :ref:`Vector3<class_Vector3>` dir **)** |const|
504504

505-
Returns ``true`` if the given ray intersects with this **AABB**. Ray length is infinite.
505+
Returns the point of intersection of the given ray with this **AABB** or ``null`` if there is no intersection. Ray length is infinite.
506506

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

@@ -514,7 +514,7 @@ Returns ``true`` if the given ray intersects with this **AABB**. Ray length is i
514514

515515
:ref:`Variant<class_Variant>` **intersects_segment** **(** :ref:`Vector3<class_Vector3>` from, :ref:`Vector3<class_Vector3>` to **)** |const|
516516

517-
Returns ``true`` if the **AABB** intersects the line segment between ``from`` and ``to``.
517+
Returns the point of intersection between ``from`` and ``to`` with this **AABB** or ``null`` if there is no intersection.
518518

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

@@ -567,7 +567,7 @@ Operator Descriptions
567567

568568
:ref:`bool<class_bool>` **operator !=** **(** :ref:`AABB<class_AABB>` right **)**
569569

570-
Returns ``true`` if the vectors are not equal.
570+
Returns ``true`` if the AABBs are not equal.
571571

572572
\ **Note:** Due to floating-point precision errors, consider using :ref:`is_equal_approx<class_AABB_method_is_equal_approx>` instead, which is more reliable.
573573

0 commit comments

Comments
 (0)