Skip to content

Commit 268c602

Browse files
author
Godot Organization
committed
classref: Sync with current master branch (ebc36a7)
1 parent 7e59155 commit 268c602

File tree

63 files changed

+339
-189
lines changed

Some content is hidden

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

63 files changed

+339
-189
lines changed

classes/[email protected]

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,37 @@ Positive floating-point infinity. This is the result of floating-point division
124124
Annotations
125125
-----------
126126

127+
.. _class_@GDScript_annotation_@abstract:
128+
129+
.. rst-class:: classref-annotation
130+
131+
**@abstract**\ (\ ) :ref:`🔗<class_@GDScript_annotation_@abstract>`
132+
133+
Marks a class or a method as abstract.
134+
135+
An abstract class is a class that cannot be instantiated directly. Instead, it is meant to be inherited by other classes. Attempting to instantiate an abstract class will result in an error.
136+
137+
An abstract method is a method that has no implementation. Therefore, a newline or a semicolon is expected after the function header. This defines a contract that inheriting classes must conform to, because the method signature must be compatible when overriding.
138+
139+
Inheriting classes must either provide implementations for all abstract methods, or the inheriting class must be marked as abstract. If a class has at least one abstract method (either its own or an unimplemented inherited one), then it must also be marked as abstract. However, the reverse is not true: an abstract class is allowed to have no abstract methods.
140+
141+
::
142+
143+
@abstract class Shape:
144+
@abstract func draw()
145+
146+
class Circle extends Shape:
147+
func draw():
148+
print("Drawing a circle.")
149+
150+
class Square extends Shape:
151+
func draw():
152+
print("Drawing a square.")
153+
154+
.. rst-class:: classref-item-separator
155+
156+
----
157+
127158
.. _class_@GDScript_annotation_@export:
128159

129160
.. rst-class:: classref-annotation
@@ -856,6 +887,8 @@ The order of ``mode``, ``sync`` and ``transfer_mode`` does not matter, but value
856887
@rpc("authority", "call_remote", "unreliable", 0) # Equivalent to @rpc
857888
func fn_default(): pass
858889

890+
\ **Note:** Methods annotated with :ref:`@rpc<class_@GDScript_annotation_@rpc>` cannot receive objects which define required parameters in :ref:`Object._init()<class_Object_private_method__init>`. See :ref:`Object._init()<class_Object_private_method__init>` for more details.
891+
859892
.. rst-class:: classref-item-separator
860893

861894
----
@@ -1073,7 +1106,7 @@ Converts a ``dictionary`` (created with :ref:`inst_to_dict()<class_@GDScript_met
10731106

10741107
:ref:`Array<class_Array>` **get_stack**\ (\ ) :ref:`🔗<class_@GDScript_method_get_stack>`
10751108

1076-
Returns an array of dictionaries representing the current call stack. See also :ref:`print_stack()<class_@GDScript_method_print_stack>`.
1109+
Returns an array of dictionaries representing the current call stack.
10771110

10781111
::
10791112

@@ -1092,9 +1125,9 @@ Starting from ``_ready()``, ``bar()`` would print:
10921125
10931126
[{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}]
10941127
1095-
\ **Note:** This function only works if the running instance is connected to a debugging server (i.e. an editor instance). :ref:`get_stack()<class_@GDScript_method_get_stack>` will not work in projects exported in release mode, or in projects exported in debug mode if not connected to a debugging server.
1128+
See also :ref:`print_debug()<class_@GDScript_method_print_debug>`, :ref:`print_stack()<class_@GDScript_method_print_stack>`, and :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
10961129

1097-
\ **Note:** Calling this function from a :ref:`Thread<class_Thread>` is not supported. Doing so will return an empty array.
1130+
\ **Note:** By default, backtraces are only available in editor builds and debug builds. To enable them for release builds as well, you need to enable :ref:`ProjectSettings.debug/settings/gdscript/always_track_call_stacks<class_ProjectSettings_property_debug/settings/gdscript/always_track_call_stacks>`.
10981131

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

@@ -1268,7 +1301,9 @@ The output in the console may look like the following:
12681301
Test print
12691302
At: res://test.gd:15:_process()
12701303
1271-
\ **Note:** Calling this function from a :ref:`Thread<class_Thread>` is not supported. Doing so will instead print the thread ID.
1304+
See also :ref:`print_stack()<class_@GDScript_method_print_stack>`, :ref:`get_stack()<class_@GDScript_method_get_stack>`, and :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
1305+
1306+
\ **Note:** By default, backtraces are only available in editor builds and debug builds. To enable them for release builds as well, you need to enable :ref:`ProjectSettings.debug/settings/gdscript/always_track_call_stacks<class_ProjectSettings_property_debug/settings/gdscript/always_track_call_stacks>`.
12721307

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

@@ -1280,17 +1315,17 @@ The output in the console may look like the following:
12801315

12811316
|void| **print_stack**\ (\ ) :ref:`🔗<class_@GDScript_method_print_stack>`
12821317

1283-
Prints a stack trace at the current code location. See also :ref:`get_stack()<class_@GDScript_method_get_stack>`.
1318+
Prints a stack trace at the current code location.
12841319

12851320
The output in the console may look like the following:
12861321

12871322
.. code:: text
12881323
12891324
Frame 0 - res://test.gd:16 in function '_process'
12901325
1291-
\ **Note:** This function only works if the running instance is connected to a debugging server (i.e. an editor instance). :ref:`print_stack()<class_@GDScript_method_print_stack>` will not work in projects exported in release mode, or in projects exported in debug mode if not connected to a debugging server.
1326+
See also :ref:`print_debug()<class_@GDScript_method_print_debug>`, :ref:`get_stack()<class_@GDScript_method_get_stack>`, and :ref:`Engine.capture_script_backtraces()<class_Engine_method_capture_script_backtraces>`.
12921327

1293-
\ **Note:** Calling this function from a :ref:`Thread<class_Thread>` is not supported. Doing so will instead print the thread ID.
1328+
\ **Note:** By default, backtraces are only available in editor builds and debug builds. To enable them for release builds as well, you need to enable :ref:`ProjectSettings.debug/settings/gdscript/always_track_call_stacks<class_ProjectSettings_property_debug/settings/gdscript/always_track_call_stacks>`.
12941329

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

classes/[email protected]

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,9 +3887,9 @@ Hints that a property will be changed on its own after setting, such as :ref:`Au
38873887

38883888
:ref:`PropertyHint<enum_@GlobalScope_PropertyHint>` **PROPERTY_HINT_GROUP_ENABLE** = ``42``
38893889

3890-
Hints that a boolean property will enable the feature associated with the group that it occurs in. Only works within a group or subgroup. Use the optional hint string ``"feature"`` when the group only has properties that are meaningful when the feature is enabled.
3890+
Hints that a boolean property will enable the feature associated with the group that it occurs in. The property will be displayed as a checkbox on the group header. Only works within a group or subgroup.
38913891

3892-
\ **Note:** The ``"feature"`` hint string does not modify or reset any values.
3892+
By default, disabling the property hides all properties in the group. Use the optional hint string ``"checkbox_only"`` to disable this behavior.
38933893

38943894
.. _class_@GlobalScope_constant_PROPERTY_HINT_INPUT_NAME:
38953895

classes/class_aabb.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ It uses floating-point coordinates. The 2D counterpart to **AABB** is :ref:`Rect
2323

2424
\ **Note:** Negative values for :ref:`size<class_AABB_property_size>` are not supported. With negative size, most **AABB** methods do not work correctly. Use :ref:`abs()<class_AABB_method_abs>` to get an equivalent **AABB** with a non-negative size.
2525

26-
\ **Note:** In a boolean context, a **AABB** evaluates to ``false`` if both :ref:`position<class_AABB_property_position>` and :ref:`size<class_AABB_property_size>` are zero (equal to :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`). Otherwise, it always evaluates to ``true``.
26+
\ **Note:** In a boolean context, an **AABB** evaluates to ``false`` if both :ref:`position<class_AABB_property_position>` and :ref:`size<class_AABB_property_size>` are zero (equal to :ref:`Vector3.ZERO<class_Vector3_constant_ZERO>`). Otherwise, it always evaluates to ``true``.
2727

2828
.. note::
2929

@@ -366,7 +366,7 @@ Returns the center point of the bounding box. This is the same as ``position + (
366366

367367
:ref:`Vector3<class_Vector3>` **get_endpoint**\ (\ idx\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_AABB_method_get_endpoint>`
368368

369-
Returns the position of one of the 8 vertices that compose this bounding box. With a ``idx`` of ``0`` this is the same as :ref:`position<class_AABB_property_position>`, and a ``idx`` of ``7`` is the same as :ref:`end<class_AABB_property_end>`.
369+
Returns the position of one of the 8 vertices that compose this bounding box. With an ``idx`` of ``0`` this is the same as :ref:`position<class_AABB_property_position>`, and an ``idx`` of ``7`` is the same as :ref:`end<class_AABB_property_end>`.
370370

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

classes/class_array.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ If ``deep`` is ``true``, a **deep** copy is returned: all nested arrays and dict
679679

680680
Duplicates this array, deeply, like :ref:`duplicate()<class_Array_method_duplicate>`\ ``(true)``, with extra control over how subresources are handled.
681681

682-
\ ``deep_subresources_mode`` must be one of the values from :ref:`ResourceDeepDuplicateMode<enum_Resource_ResourceDeepDuplicateMode>`. By default, only internal resources will be duplicated (recursively).
682+
\ ``deep_subresources_mode`` must be one of the values from :ref:`DeepDuplicateMode<enum_Resource_DeepDuplicateMode>`. By default, only internal resources will be duplicated (recursively).
683683

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

classes/class_bitmap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Method Descriptions
7272

7373
:ref:`Image<class_Image>` **convert_to_image**\ (\ ) |const| :ref:`🔗<class_BitMap_method_convert_to_image>`
7474

75-
Returns an image of the same size as the bitmap and with a :ref:`Format<enum_Image_Format>` of type :ref:`Image.FORMAT_L8<class_Image_constant_FORMAT_L8>`. ``true`` bits of the bitmap are being converted into white pixels, and ``false`` bits into black.
75+
Returns an image of the same size as the bitmap and with an :ref:`Format<enum_Image_Format>` of type :ref:`Image.FORMAT_L8<class_Image_constant_FORMAT_L8>`. ``true`` bits of the bitmap are being converted into white pixels, and ``false`` bits into black.
7676

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

classes/class_capsulemesh.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Property Descriptions
6161

6262
Total height of the capsule mesh (including the hemispherical ends).
6363

64+
\ **Note:** The :ref:`height<class_CapsuleMesh_property_height>` of a capsule must be at least twice its :ref:`radius<class_CapsuleMesh_property_radius>`. Otherwise, the capsule becomes a circle. If the :ref:`height<class_CapsuleMesh_property_height>` is less than twice the :ref:`radius<class_CapsuleMesh_property_radius>`, the properties adjust to a valid value.
65+
6466
.. rst-class:: classref-item-separator
6567

6668
----
@@ -95,6 +97,8 @@ Number of radial segments on the capsule mesh.
9597

9698
Radius of the capsule mesh.
9799

100+
\ **Note:** The :ref:`radius<class_CapsuleMesh_property_radius>` of a capsule cannot be greater than half of its :ref:`height<class_CapsuleMesh_property_height>`. Otherwise, the capsule becomes a circle. If the :ref:`radius<class_CapsuleMesh_property_radius>` is greater than half of the :ref:`height<class_CapsuleMesh_property_height>`, the properties adjust to a valid value.
101+
98102
.. rst-class:: classref-item-separator
99103

100104
----

classes/class_capsuleshape2d.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Property Descriptions
6161

6262
The capsule's full height, including the semicircles.
6363

64+
\ **Note:** The :ref:`height<class_CapsuleShape2D_property_height>` of a capsule must be at least twice its :ref:`radius<class_CapsuleShape2D_property_radius>`. Otherwise, the capsule becomes a circle. If the :ref:`height<class_CapsuleShape2D_property_height>` is less than twice the :ref:`radius<class_CapsuleShape2D_property_radius>`, the properties adjust to a valid value.
65+
6466
.. rst-class:: classref-item-separator
6567

6668
----
@@ -95,6 +97,8 @@ The capsule's height, excluding the semicircles. This is the height of the centr
9597

9698
The capsule's radius.
9799

100+
\ **Note:** The :ref:`radius<class_CapsuleShape2D_property_radius>` of a capsule cannot be greater than half of its :ref:`height<class_CapsuleShape2D_property_height>`. Otherwise, the capsule becomes a circle. If the :ref:`radius<class_CapsuleShape2D_property_radius>` is greater than half of the :ref:`height<class_CapsuleShape2D_property_height>`, the properties adjust to a valid value.
101+
98102
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
99103
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
100104
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`

classes/class_capsuleshape3d.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Property Descriptions
6868

6969
The capsule's full height, including the hemispheres.
7070

71+
\ **Note:** The :ref:`height<class_CapsuleShape3D_property_height>` of a capsule must be at least twice its :ref:`radius<class_CapsuleShape3D_property_radius>`. Otherwise, the capsule becomes a sphere. If the :ref:`height<class_CapsuleShape3D_property_height>` is less than twice the :ref:`radius<class_CapsuleShape3D_property_radius>`, the properties adjust to a valid value.
72+
7173
.. rst-class:: classref-item-separator
7274

7375
----
@@ -102,6 +104,8 @@ The capsule's height, excluding the hemispheres. This is the height of the centr
102104

103105
The capsule's radius.
104106

107+
\ **Note:** The :ref:`radius<class_CapsuleShape3D_property_radius>` of a capsule cannot be greater than half of its :ref:`height<class_CapsuleShape3D_property_height>`. Otherwise, the capsule becomes a sphere. If the :ref:`radius<class_CapsuleShape3D_property_radius>` is greater than half of the :ref:`height<class_CapsuleShape3D_property_height>`, the properties adjust to a valid value.
108+
105109
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
106110
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
107111
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`

classes/class_codeedit.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ Override this method to define how the selected entry should be inserted. If ``r
892892

893893
Override this method to define what items in ``candidates`` should be displayed.
894894

895-
Both ``candidates`` and the return is a :ref:`Array<class_Array>` of :ref:`Dictionary<class_Dictionary>`, see :ref:`get_code_completion_option()<class_CodeEdit_method_get_code_completion_option>` for :ref:`Dictionary<class_Dictionary>` content.
895+
Both ``candidates`` and the return is an :ref:`Array<class_Array>` of :ref:`Dictionary<class_Dictionary>`, see :ref:`get_code_completion_option()<class_CodeEdit_method_get_code_completion_option>` for :ref:`Dictionary<class_Dictionary>` content.
896896

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

classes/class_cubemaparray.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The expected image order is X+, X-, Y+, Y-, Z+, Z- (in Godot's coordinate system
3737

3838
- `6×1 cubemap template <https://raw.githubusercontent.com/godotengine/godot-docs/master/tutorials/assets_pipeline/img/cubemap_template_6x1.webp>`__\
3939

40-
Multiple layers are stacked on top of each other when using the default vertical import option (with the first layer at the top). Alternatively, you can choose an horizontal layout in the import options (with the first layer at the left).
40+
Multiple layers are stacked on top of each other when using the default vertical import option (with the first layer at the top). Alternatively, you can choose a horizontal layout in the import options (with the first layer at the left).
4141

4242
\ **Note:** **CubemapArray** is not supported in the Compatibility renderer due to graphics API limitations.
4343

0 commit comments

Comments
 (0)