diff --git a/classes/class_@gdscript.rst b/classes/class_@gdscript.rst index 637da62db00..7772c35b32e 100644 --- a/classes/class_@gdscript.rst +++ b/classes/class_@gdscript.rst @@ -17,9 +17,9 @@ Built-in GDScript constants, functions, and annotations. Description ----------- -A list of GDScript-specific utility functions and annotations accessible from any script. +A list of utility functions and annotations accessible from any script written in GDScript. -For the list of the global functions and constants see :ref:`@GlobalScope`. +For the list of global functions and constants that can be accessed in any scripting language, see :ref:`@GlobalScope`. .. rst-class:: classref-introduction-group @@ -43,7 +43,7 @@ Methods +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`char`\ (\ char\: :ref:`int`\ ) | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Variant` | :ref:`convert`\ (\ what\: :ref:`Variant`, type\: :ref:`int`\ ) | + | :ref:`Variant` | :ref:`convert`\ (\ what\: :ref:`Variant`, type\: :ref:`Variant.Type`\ ) | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`dict_to_inst`\ (\ dictionary\: :ref:`Dictionary`\ ) | +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -705,7 +705,67 @@ See also :ref:`@GlobalScope.PROPERTY_USAGE_SUBGROUP`, icon\: :ref:`String` = ""\ ) :ref:`🔗` + +Export a :ref:`Callable` property as a clickable button with the label ``text``. When the button is pressed, the callable is called. + +If ``icon`` is specified, it is used to fetch an icon for the button via :ref:`Control.get_theme_icon`, from the ``"EditorIcons"`` theme type. If ``icon`` is omitted, the default ``"Callable"`` icon is used instead. + +Consider using the :ref:`EditorUndoRedoManager` to allow the action to be reverted safely. + +See also :ref:`@GlobalScope.PROPERTY_HINT_TOOL_BUTTON`. + +:: + + @tool + extends Sprite2D + + @export_tool_button("Hello") var hello_action = hello + @export_tool_button("Randomize the color!", "ColorRect") + var randomize_color_action = randomize_color + + func hello(): + print("Hello world!") + + func randomize_color(): + var undo_redo = EditorInterface.get_editor_undo_redo() + undo_redo.create_action("Randomized Sprite2D Color") + undo_redo.add_do_property(self, &"self_modulate", Color(randf(), randf(), randf())) + undo_redo.add_undo_property(self, &"self_modulate", self_modulate) + undo_redo.commit_action() + +\ **Note:** The property is exported without the :ref:`@GlobalScope.PROPERTY_USAGE_STORAGE` flag because a :ref:`Callable` cannot be properly serialized and stored in a file. + +\ **Note:** In an exported project neither :ref:`EditorInterface` nor :ref:`EditorUndoRedoManager` exist, which may cause some scripts to break. To prevent this, you can use :ref:`Engine.get_singleton` and omit the static type from the variable declaration: + +:: + + var undo_redo = Engine.get_singleton(&"EditorInterface").get_editor_undo_redo() + +\ **Note:** Avoid storing lambda callables in member variables of :ref:`RefCounted`-based classes (e.g. resources), as this can lead to memory leaks. Use only method callables and optionally :ref:`Callable.bind` or :ref:`Callable.unbind`. .. rst-class:: classref-item-separator @@ -899,9 +959,9 @@ Returns a single character (as a :ref:`String`) of the given Unico :: - a = char(65) # a is "A" - a = char(65 + 32) # a is "a" - a = char(8364) # a is "€" + var upper = char(65) # upper is "A" + var lower = char(65 + 32) # lower is "a" + var euro = char(8364) # euro is "€" .. rst-class:: classref-item-separator @@ -911,7 +971,7 @@ Returns a single character (as a :ref:`String`) of the given Unico .. rst-class:: classref-method -:ref:`Variant` **convert**\ (\ what\: :ref:`Variant`, type\: :ref:`int`\ ) :ref:`🔗` +:ref:`Variant` **convert**\ (\ what\: :ref:`Variant`, type\: :ref:`Variant.Type`\ ) :ref:`🔗` **Deprecated:** Use :ref:`@GlobalScope.type_convert` instead. @@ -1020,7 +1080,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:**\ :: @@ -1047,10 +1107,10 @@ Returns the length of the given Variant ``var``. The length can be the character :: - a = [1, 2, 3, 4] + var a = [1, 2, 3, 4] len(a) # Returns 4 - b = "Hello!" + var b = "Hello!" len(b) # Returns 6 .. rst-class:: classref-item-separator @@ -1166,7 +1226,7 @@ Returns an array with the given range. :ref:`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:**\ :: diff --git a/classes/class_@globalscope.rst b/classes/class_@globalscope.rst index 2e072c6768f..3009c6c4ff2 100644 --- a/classes/class_@globalscope.rst +++ b/classes/class_@globalscope.rst @@ -21,7 +21,7 @@ A list of global scope enumerated constants and built-in functions. This is all Singletons are also documented here, since they can be accessed from anywhere. -For the entries related to GDScript which can be accessed in any script see :ref:`@GDScript`. +For the entries that can only be accessed from scripts written in GDScript, see :ref:`@GDScript`. .. note:: @@ -3045,9 +3045,7 @@ enum **Error**: :ref:`🔗` Methods that return :ref:`Error` return :ref:`OK` when no error occurred. -Since :ref:`OK` has value 0, and all other error constants are positive integers, it can also be used in boolean checks. - -\ **Example:**\ +Since :ref:`OK` has value ``0``, and all other error constants are positive integers, it can also be used in boolean checks. :: @@ -3702,7 +3700,7 @@ If a property is :ref:`Array`, hints the editor how to show element -Examples: +\ **Examples:**\ .. tabs:: @@ -3806,6 +3804,14 @@ Hints that an :ref:`int` property is a pointer. Used by GDExtension. Hints that a property is an :ref:`Array` with the stored type specified in the hint string. +.. _class_@GlobalScope_constant_PROPERTY_HINT_DICTIONARY_TYPE: + +.. rst-class:: classref-enumeration-constant + +:ref:`PropertyHint` **PROPERTY_HINT_DICTIONARY_TYPE** = ``38`` + +Hints that a property is a :ref:`Dictionary` with the stored types specified in the hint string. + .. _class_@GlobalScope_constant_PROPERTY_HINT_LOCALE_ID: .. rst-class:: classref-enumeration-constant @@ -3846,11 +3852,26 @@ Hints that a quaternion property should disable the temporary euler editor. Hints that a string property is a password, and every character is replaced with the secret character. +.. _class_@GlobalScope_constant_PROPERTY_HINT_TOOL_BUTTON: + +.. rst-class:: classref-enumeration-constant + +:ref:`PropertyHint` **PROPERTY_HINT_TOOL_BUTTON** = ``39`` + +Hints that a :ref:`Callable` property should be displayed as a clickable button. When the button is pressed, the callable is called. The hint string specifies the button text and optionally an icon from the ``"EditorIcons"`` theme type. + +.. code:: text + + "Click me!" - A button with the text "Click me!" and the default "Callable" icon. + "Click me!,ColorRect" - A button with the text "Click me!" and the "ColorRect" icon. + +\ **Note:** A :ref:`Callable` cannot be properly serialized and stored in a file, so it is recommended to use :ref:`PROPERTY_USAGE_EDITOR` instead of :ref:`PROPERTY_USAGE_DEFAULT`. + .. _class_@GlobalScope_constant_PROPERTY_HINT_MAX: .. rst-class:: classref-enumeration-constant -:ref:`PropertyHint` **PROPERTY_HINT_MAX** = ``38`` +:ref:`PropertyHint` **PROPERTY_HINT_MAX** = ``40`` Represents the size of the :ref:`PropertyHint` enum. @@ -3966,7 +3987,7 @@ Editing the property prompts the user for restarting the editor. :ref:`PropertyUsageFlags` **PROPERTY_USAGE_SCRIPT_VARIABLE** = ``4096`` -The property is a script variable which should be serialized and saved in the scene file. +The property is a script variable. :ref:`PROPERTY_USAGE_SCRIPT_VARIABLE` can be used to distinguish between exported script variables from built-in variables (which don't have this usage flag). By default, :ref:`PROPERTY_USAGE_SCRIPT_VARIABLE` is **not** applied to variables that are created by overriding :ref:`Object._get_property_list` in a script. .. _class_@GlobalScope_constant_PROPERTY_USAGE_STORE_IF_NULL: @@ -4000,7 +4021,7 @@ If this property is modified, all inspector fields will be refreshed. :ref:`PropertyUsageFlags` **PROPERTY_USAGE_CLASS_IS_ENUM** = ``65536`` -The property is an enum, i.e. it only takes named integer constants from its associated enumeration. +The property is a variable of enum type, i.e. it only takes named integer constants from its associated enumeration. .. _class_@GlobalScope_constant_PROPERTY_USAGE_NIL_IS_VARIANT: @@ -5322,7 +5343,7 @@ Returns the hyperbolic arc (also called inverse) cosine of ``x``, returning a va :ref:`float` **angle_difference**\ (\ from\: :ref:`float`, to\: :ref:`float`\ ) :ref:`🔗` -Returns the difference between the two angles, in the range of ``[-PI, +PI]``. When ``from`` and ``to`` are opposite, returns ``-PI`` if ``from`` is smaller than ``to``, or ``PI`` otherwise. +Returns the difference between the two angles (in radians), in the range of ``[-PI, +PI]``. When ``from`` and ``to`` are opposite, returns ``-PI`` if ``from`` is smaller than ``to``, or ``PI`` otherwise. .. rst-class:: classref-item-separator @@ -6084,9 +6105,9 @@ This function is faster than using :ref:`is_equal_approx` **lerp**\ (\ from\: :ref:`Variant`, to\: :ref:`Variant`, weight\: :ref:`Variant`\ ) :ref:`🔗` -Linearly interpolates between two values by the factor defined in ``weight``. To perform interpolation, ``weight`` should be between ``0.0`` and ``1.0`` (inclusive). However, values outside this range are allowed and can be used to perform *extrapolation*. If this is not desired, use :ref:`clamp` on the result of this function. +Linearly interpolates between two values by the factor defined in ``weight``. To perform interpolation, ``weight`` should be between ``0.0`` and ``1.0`` (inclusive). However, values outside this range are allowed and can be used to perform *extrapolation*. If this is not desired, use :ref:`clampf` to limit ``weight``. -Both ``from`` and ``to`` must be the same type. Supported types: :ref:`int`, :ref:`float`, :ref:`Vector2`, :ref:`Vector3`, :ref:`Vector4`, :ref:`Color`, :ref:`Quaternion`, :ref:`Basis`. +Both ``from`` and ``to`` must be the same type. Supported types: :ref:`int`, :ref:`float`, :ref:`Vector2`, :ref:`Vector3`, :ref:`Vector4`, :ref:`Color`, :ref:`Quaternion`, :ref:`Basis`, :ref:`Transform2D`, :ref:`Transform3D`. :: @@ -6094,7 +6115,7 @@ Both ``from`` and ``to`` must be the same type. Supported types: :ref:`int` which performs the reverse of this operation. To perform eased interpolation with :ref:`lerp`, combine it with :ref:`ease` or :ref:`smoothstep`. See also :ref:`remap` to map a continuous series of values to another. -\ **Note:** For better type safety, use :ref:`lerpf`, :ref:`Vector2.lerp`, :ref:`Vector3.lerp`, :ref:`Vector4.lerp`, :ref:`Color.lerp`, :ref:`Quaternion.slerp` or :ref:`Basis.slerp`. +\ **Note:** For better type safety, use :ref:`lerpf`, :ref:`Vector2.lerp`, :ref:`Vector3.lerp`, :ref:`Vector4.lerp`, :ref:`Color.lerp`, :ref:`Quaternion.slerp`, :ref:`Basis.slerp`, :ref:`Transform2D.interpolate_with`, or :ref:`Transform3D.interpolate_with`. .. rst-class:: classref-item-separator @@ -6150,15 +6171,12 @@ See also :ref:`inverse_lerp` which perfo :ref:`float` **linear_to_db**\ (\ lin\: :ref:`float`\ ) :ref:`🔗` -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` 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 @@ -6431,7 +6449,7 @@ Converts one or more arguments of any type to string in the best way possible an -\ **Note:** Consider using :ref:`push_error` and :ref:`push_warning` to print error and warning messages instead of :ref:`print` or :ref:`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. +\ **Note:** Consider using :ref:`push_error` and :ref:`push_warning` to print error and warning messages instead of :ref:`print` or :ref:`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. See also :ref:`Engine.print_to_stdout` and :ref:`ProjectSettings.application/run/disable_stdout`. .. rst-class:: classref-item-separator @@ -6680,8 +6698,8 @@ Given a ``seed``, returns a :ref:`PackedInt64Array` of s var a = rand_from_seed(4) - print(a[0]) # Prints 2879024997 - print(a[1]) # Prints 4 + print(a[0]) # Prints 2879024997 + print(a[1]) # Prints 4 .. rst-class:: classref-item-separator @@ -7020,7 +7038,7 @@ Returns ``-1.0`` if ``x`` is negative, ``1.0`` if ``x`` is positive, and ``0.0`` :ref:`int` **signi**\ (\ x\: :ref:`int`\ ) :ref:`🔗` -Returns ``-1`` if ``x`` is negative, ``1`` if ``x`` is positive, and ``0`` if if ``x`` is zero. +Returns ``-1`` if ``x`` is negative, ``1`` if ``x`` is positive, and ``0`` if ``x`` is zero. :: @@ -7072,9 +7090,11 @@ Returns the hyperbolic sine of ``x``. :ref:`float` **smoothstep**\ (\ from\: :ref:`float`, to\: :ref:`float`, x\: :ref:`float`\ ) :ref:`🔗` -Returns the result of smoothly interpolating the value of ``x`` between ``0`` and ``1``, based on the where ``x`` lies with respect to the edges ``from`` and ``to``. +Returns a smooth cubic Hermite interpolation between ``0`` and ``1``. -The return value is ``0`` if ``x <= from``, and ``1`` if ``x >= to``. If ``x`` lies between ``from`` and ``to``, the returned value follows an S-shaped curve that maps ``x`` between ``0`` and ``1``. +For positive ranges (when ``from <= to``) the return value is ``0`` when ``x <= from``, and ``1`` when ``x >= to``. If ``x`` lies between ``from`` and ``to``, the return value follows an S-shaped curve that smoothly transitions from ``0`` to ``1``. + +For negative ranges (when ``from > to``) the function is mirrored and returns ``1`` when ``x <= to`` and ``0`` when ``x >= from``. This S-shaped curve is the cubic Hermite interpolator, given by ``f(y) = 3*y^2 - 2*y^3`` where ``y = (x-from) / (to-from)``. @@ -7087,7 +7107,9 @@ This S-shaped curve is the cubic Hermite interpolator, given by ``f(y) = 3*y^2 - Compared to :ref:`ease` with a curve value of ``-1.6521``, :ref:`smoothstep` returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use :ref:`Tween` or :ref:`AnimationPlayer`. -\ `Comparison between smoothstep() and ease(x, -1.6521) return values `__ +\ `Comparison between smoothstep() and ease(x, -1.6521) return values `__\ + +\ `Smoothstep() return values with positive, zero, and negative ranges `__ .. rst-class:: classref-item-separator diff --git a/classes/class_aabb.rst b/classes/class_aabb.rst index 4c35ba984c8..16261e2cf9b 100644 --- a/classes/class_aabb.rst +++ b/classes/class_aabb.rst @@ -103,7 +103,7 @@ Methods +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_shortest_axis_size`\ (\ ) |const| | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Vector3` | :ref:`get_support`\ (\ dir\: :ref:`Vector3`\ ) |const| | + | :ref:`Vector3` | :ref:`get_support`\ (\ direction\: :ref:`Vector3`\ ) |const| | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_volume`\ (\ ) |const| | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -502,7 +502,7 @@ For an example, see :ref:`get_shortest_axis .. rst-class:: classref-method -:ref:`Vector3` **get_support**\ (\ dir\: :ref:`Vector3`\ ) |const| :ref:`🔗` +:ref:`Vector3` **get_support**\ (\ direction\: :ref:`Vector3`\ ) |const| :ref:`🔗` Returns the vertex's position of this bounding box that's the farthest in the given direction. This point is commonly known as the support point in collision detection algorithms. @@ -692,7 +692,7 @@ The segment begins at ``from`` and ends at ``to``. :ref:`bool` **is_equal_approx**\ (\ aabb\: :ref:`AABB`\ ) |const| :ref:`🔗` -Returns ``true`` if this bounding box and ``aabb`` are approximately equal, by calling :ref:`Vector2.is_equal_approx` on the :ref:`position` and the :ref:`size`. +Returns ``true`` if this bounding box and ``aabb`` are approximately equal, by calling :ref:`Vector3.is_equal_approx` on the :ref:`position` and the :ref:`size`. .. rst-class:: classref-item-separator @@ -704,7 +704,7 @@ Returns ``true`` if this bounding box and ``aabb`` are approximately equal, by c :ref:`bool` **is_finite**\ (\ ) |const| :ref:`🔗` -Returns ``true`` if this bounding box's values are finite, by calling :ref:`Vector2.is_finite` on the :ref:`position` and the :ref:`size`. +Returns ``true`` if this bounding box's values are finite, by calling :ref:`Vector3.is_finite` on the :ref:`position` and the :ref:`size`. .. rst-class:: classref-item-separator diff --git a/classes/class_animatedsprite2d.rst b/classes/class_animatedsprite2d.rst index 8c909164789..dc63037b2c0 100644 --- a/classes/class_animatedsprite2d.rst +++ b/classes/class_animatedsprite2d.rst @@ -413,18 +413,15 @@ This method is a shorthand for :ref:`play` w |void| **set_frame_and_progress**\ (\ frame\: :ref:`int`, progress\: :ref:`float`\ ) :ref:`🔗` -The setter of :ref:`frame` resets the :ref:`frame_progress` to ``0.0`` implicitly, but this method avoids that. +Sets :ref:`frame` the :ref:`frame_progress` to the given values. Unlike setting :ref:`frame`, this method does not reset the :ref:`frame_progress` to ``0.0`` implicitly. -This is useful when you want to carry over the current :ref:`frame_progress` to another :ref:`frame`. - -\ **Example:**\ +\ **Example:** Change the animation while keeping the same :ref:`frame` and :ref:`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") diff --git a/classes/class_animatedsprite3d.rst b/classes/class_animatedsprite3d.rst index 46feb6c7589..744c7ff23bb 100644 --- a/classes/class_animatedsprite3d.rst +++ b/classes/class_animatedsprite3d.rst @@ -333,18 +333,15 @@ This method is a shorthand for :ref:`play` w |void| **set_frame_and_progress**\ (\ frame\: :ref:`int`, progress\: :ref:`float`\ ) :ref:`🔗` -The setter of :ref:`frame` resets the :ref:`frame_progress` to ``0.0`` implicitly, but this method avoids that. +Sets :ref:`frame` the :ref:`frame_progress` to the given values. Unlike setting :ref:`frame`, this method does not reset the :ref:`frame_progress` to ``0.0`` implicitly. -This is useful when you want to carry over the current :ref:`frame_progress` to another :ref:`frame`. - -\ **Example:**\ +\ **Example:** Change the animation while keeping the same :ref:`frame` and :ref:`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") diff --git a/classes/class_animation.rst b/classes/class_animation.rst index c977ca1a26e..94979b016c0 100644 --- a/classes/class_animation.rst +++ b/classes/class_animation.rst @@ -85,6 +85,8 @@ Methods .. table:: :widths: auto + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`add_marker`\ (\ name\: :ref:`StringName`, time\: :ref:`float`\ ) | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`add_track`\ (\ type\: :ref:`TrackType`, at_position\: :ref:`int` = -1\ ) | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -140,16 +142,34 @@ Methods +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`find_track`\ (\ path\: :ref:`NodePath`, type\: :ref:`TrackType`\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`StringName` | :ref:`get_marker_at_time`\ (\ time\: :ref:`float`\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Color` | :ref:`get_marker_color`\ (\ name\: :ref:`StringName`\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`PackedStringArray` | :ref:`get_marker_names`\ (\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`get_marker_time`\ (\ name\: :ref:`StringName`\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`StringName` | :ref:`get_next_marker`\ (\ time\: :ref:`float`\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`StringName` | :ref:`get_prev_marker`\ (\ time\: :ref:`float`\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_track_count`\ (\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`has_marker`\ (\ name\: :ref:`StringName`\ ) |const| | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`method_track_get_name`\ (\ track_idx\: :ref:`int`, key_idx\: :ref:`int`\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`method_track_get_params`\ (\ track_idx\: :ref:`int`, key_idx\: :ref:`int`\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`optimize`\ (\ allowed_velocity_err\: :ref:`float` = 0.01, allowed_angular_err\: :ref:`float` = 0.01, precision\: :ref:`int` = 3\ ) | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`position_track_insert_key`\ (\ track_idx\: :ref:`int`, time\: :ref:`float`, position\: :ref:`Vector3`\ ) | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`position_track_interpolate`\ (\ track_idx\: :ref:`int`, time_sec\: :ref:`float`, backward\: :ref:`bool` = false\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`remove_marker`\ (\ name\: :ref:`StringName`\ ) | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`remove_track`\ (\ track_idx\: :ref:`int`\ ) | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`rotation_track_insert_key`\ (\ track_idx\: :ref:`int`, time\: :ref:`float`, rotation\: :ref:`Quaternion`\ ) | @@ -160,6 +180,8 @@ Methods +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`scale_track_interpolate`\ (\ track_idx\: :ref:`int`, time_sec\: :ref:`float`, backward\: :ref:`bool` = false\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_marker_color`\ (\ name\: :ref:`StringName`, color\: :ref:`Color`\ ) | + +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`track_find_key`\ (\ track_idx\: :ref:`int`, time\: :ref:`float`, find_mode\: :ref:`FindMode` = 0, limit\: :ref:`bool` = false, backward\: :ref:`bool` = false\ ) |const| | +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`track_get_interpolation_loop_wrap`\ (\ track_idx\: :ref:`int`\ ) |const| | @@ -581,6 +603,18 @@ The animation step value. Method Descriptions ------------------- +.. _class_Animation_method_add_marker: + +.. rst-class:: classref-method + +|void| **add_marker**\ (\ name\: :ref:`StringName`, time\: :ref:`float`\ ) :ref:`🔗` + +Adds a marker to this Animation. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_add_track: .. rst-class:: classref-method @@ -915,6 +949,78 @@ Returns the index of the specified track. If the track is not found, return -1. ---- +.. _class_Animation_method_get_marker_at_time: + +.. rst-class:: classref-method + +:ref:`StringName` **get_marker_at_time**\ (\ time\: :ref:`float`\ ) |const| :ref:`🔗` + +Returns the name of the marker located at the given time. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Animation_method_get_marker_color: + +.. rst-class:: classref-method + +:ref:`Color` **get_marker_color**\ (\ name\: :ref:`StringName`\ ) |const| :ref:`🔗` + +Returns the given marker's color. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Animation_method_get_marker_names: + +.. rst-class:: classref-method + +:ref:`PackedStringArray` **get_marker_names**\ (\ ) |const| :ref:`🔗` + +Returns every marker in this Animation, sorted ascending by time. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Animation_method_get_marker_time: + +.. rst-class:: classref-method + +:ref:`float` **get_marker_time**\ (\ name\: :ref:`StringName`\ ) |const| :ref:`🔗` + +Returns the given marker's time. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Animation_method_get_next_marker: + +.. rst-class:: classref-method + +:ref:`StringName` **get_next_marker**\ (\ time\: :ref:`float`\ ) |const| :ref:`🔗` + +Returns the closest marker that comes after the given time. If no such marker exists, an empty string is returned. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Animation_method_get_prev_marker: + +.. rst-class:: classref-method + +:ref:`StringName` **get_prev_marker**\ (\ time\: :ref:`float`\ ) |const| :ref:`🔗` + +Returns the closest marker that comes before the given time. If no such marker exists, an empty string is returned. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_get_track_count: .. rst-class:: classref-method @@ -927,6 +1033,18 @@ Returns the amount of tracks in the animation. ---- +.. _class_Animation_method_has_marker: + +.. rst-class:: classref-method + +:ref:`bool` **has_marker**\ (\ name\: :ref:`StringName`\ ) |const| :ref:`🔗` + +Returns ``true`` if this Animation contains a marker with the given name. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_method_track_get_name: .. rst-class:: classref-method @@ -951,6 +1069,18 @@ Returns the arguments values to be called on a method track for a given key in a ---- +.. _class_Animation_method_optimize: + +.. rst-class:: classref-method + +|void| **optimize**\ (\ allowed_velocity_err\: :ref:`float` = 0.01, allowed_angular_err\: :ref:`float` = 0.01, precision\: :ref:`int` = 3\ ) :ref:`🔗` + +Optimize the animation and all its tracks in-place. This will preserve only as many keys as are necessary to keep the animation within the specified bounds. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_position_track_insert_key: .. rst-class:: classref-method @@ -975,6 +1105,18 @@ Returns the interpolated position value at the given time (in seconds). The ``tr ---- +.. _class_Animation_method_remove_marker: + +.. rst-class:: classref-method + +|void| **remove_marker**\ (\ name\: :ref:`StringName`\ ) :ref:`🔗` + +Removes the marker with the given name from this Animation. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_remove_track: .. rst-class:: classref-method @@ -1035,6 +1177,18 @@ Returns the interpolated scale value at the given time (in seconds). The ``track ---- +.. _class_Animation_method_set_marker_color: + +.. rst-class:: classref-method + +|void| **set_marker_color**\ (\ name\: :ref:`StringName`, color\: :ref:`Color`\ ) :ref:`🔗` + +Sets the given marker's color. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_track_find_key: .. rst-class:: classref-method diff --git a/classes/class_animationmixer.rst b/classes/class_animationmixer.rst index 42d15af41cb..918f870a69b 100644 --- a/classes/class_animationmixer.rst +++ b/classes/class_animationmixer.rst @@ -25,6 +25,13 @@ Base class for :ref:`AnimationPlayer` and :ref:`Animation After instantiating the playback information data within the extended class, the blending is processed by the **AnimationMixer**. +.. rst-class:: classref-introduction-group + +Tutorials +--------- + +- `Migrating Animations from Godot 4.0 to 4.3 `__ + .. rst-class:: classref-reftable-group Properties @@ -295,7 +302,31 @@ An :ref:`Animation.UPDATE_CONTINUOUS Always treat the :ref:`Animation.UPDATE_DISCRETE` track value as :ref:`Animation.UPDATE_CONTINUOUS` with :ref:`Animation.INTERPOLATION_NEAREST`. This is the default behavior for :ref:`AnimationTree`. -If a value track has non-numeric type key values, it is internally converted to use :ref:`ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE` with :ref:`Animation.UPDATE_DISCRETE`. +If a value track has un-interpolatable type key values, it is internally converted to use :ref:`ANIMATION_CALLBACK_MODE_DISCRETE_RECESSIVE` with :ref:`Animation.UPDATE_DISCRETE`. + +Un-interpolatable type list: + +- :ref:`@GlobalScope.TYPE_NIL`\ + +- :ref:`@GlobalScope.TYPE_NODE_PATH`\ + +- :ref:`@GlobalScope.TYPE_RID`\ + +- :ref:`@GlobalScope.TYPE_OBJECT`\ + +- :ref:`@GlobalScope.TYPE_CALLABLE`\ + +- :ref:`@GlobalScope.TYPE_SIGNAL`\ + +- :ref:`@GlobalScope.TYPE_DICTIONARY`\ + +- :ref:`@GlobalScope.TYPE_PACKED_BYTE_ARRAY`\ + +\ :ref:`@GlobalScope.TYPE_BOOL` and :ref:`@GlobalScope.TYPE_INT` are treated as :ref:`@GlobalScope.TYPE_FLOAT` during blending and rounded when the result is retrieved. + +It is same for arrays and vectors with them such as :ref:`@GlobalScope.TYPE_PACKED_INT32_ARRAY` or :ref:`@GlobalScope.TYPE_VECTOR2I`, they are treated as :ref:`@GlobalScope.TYPE_PACKED_FLOAT32_ARRAY` or :ref:`@GlobalScope.TYPE_VECTOR2`. Also note that for arrays, the size is also interpolated. + +\ :ref:`@GlobalScope.TYPE_STRING` and :ref:`@GlobalScope.TYPE_STRING_NAME` are interpolated between character codes and lengths, but note that there is a difference in algorithm between interpolation between keys and interpolation by blending. .. rst-class:: classref-section-separator @@ -665,7 +696,7 @@ The most basic example is applying position to :ref:`CharacterBody3D`, you can apply the root motion position more correctly to account for the rotation of the node. +By using this in combination with :ref:`get_root_motion_rotation_accumulator`, you can apply the root motion position more correctly to account for the rotation of the node. .. tabs:: diff --git a/classes/class_animationnode.rst b/classes/class_animationnode.rst index 4131ee692e4..1729eb027d8 100644 --- a/classes/class_animationnode.rst +++ b/classes/class_animationnode.rst @@ -77,7 +77,7 @@ Methods +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`_is_parameter_read_only`\ (\ parameter\: :ref:`StringName`\ ) |virtual| |const| | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`float` | :ref:`_process`\ (\ time\: :ref:`float`, seek\: :ref:`bool`, is_external_seeking\: :ref:`bool`, test_only\: :ref:`bool`\ ) |virtual| |const| | + | :ref:`float` | :ref:`_process`\ (\ time\: :ref:`float`, seek\: :ref:`bool`, is_external_seeking\: :ref:`bool`, test_only\: :ref:`bool`\ ) |virtual| | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`add_input`\ (\ name\: :ref:`String`\ ) | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -313,7 +313,7 @@ When inheriting from :ref:`AnimationRootNode`, implemen .. rst-class:: classref-method -:ref:`float` **_process**\ (\ time\: :ref:`float`, seek\: :ref:`bool`, is_external_seeking\: :ref:`bool`, test_only\: :ref:`bool`\ ) |virtual| |const| :ref:`🔗` +:ref:`float` **_process**\ (\ time\: :ref:`float`, seek\: :ref:`bool`, is_external_seeking\: :ref:`bool`, test_only\: :ref:`bool`\ ) |virtual| :ref:`🔗` **Deprecated:** Currently this is mostly useless as there is a lack of many APIs to extend AnimationNode by GDScript. It is planned that a more flexible API using structures will be provided in the future. diff --git a/classes/class_animationnodeanimation.rst b/classes/class_animationnodeanimation.rst index 734212e8862..7f25c8bfb4d 100644 --- a/classes/class_animationnodeanimation.rst +++ b/classes/class_animationnodeanimation.rst @@ -40,6 +40,8 @@ Properties .. table:: :widths: auto + +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`advance_on_start` | ``false`` | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`StringName` | :ref:`animation` | ``&""`` | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ @@ -96,6 +98,25 @@ Plays animation in backward direction. Property Descriptions --------------------- +.. _class_AnimationNodeAnimation_property_advance_on_start: + +.. rst-class:: classref-property + +:ref:`bool` **advance_on_start** = ``false`` :ref:`🔗` + +.. rst-class:: classref-property-setget + +- |void| **set_advance_on_start**\ (\ value\: :ref:`bool`\ ) +- :ref:`bool` **is_advance_on_start**\ (\ ) + +If ``true``, on receiving a request to play an animation from the start, the first frame is not drawn, but only processed, and playback starts from the next frame. + +See also the notes of :ref:`AnimationPlayer.play`. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationNodeAnimation_property_animation: .. rst-class:: classref-property @@ -126,6 +147,8 @@ Animation to use as an output. It is one of the animations provided by :ref:`Ani If :ref:`use_custom_timeline` is ``true``, override the loop settings of the original :ref:`Animation` resource with the value. +\ **Note:** If the :ref:`Animation.loop_mode` isn't set to looping, the :ref:`Animation.track_set_interpolation_loop_wrap` option will not be respected. If you cannot get the expected behavior, consider duplicating the :ref:`Animation` resource and changing the loop settings. + .. rst-class:: classref-item-separator ---- diff --git a/classes/class_animationnodeblendspace2d.rst b/classes/class_animationnodeblendspace2d.rst index 506b47bff25..c107fffa9f8 100644 --- a/classes/class_animationnodeblendspace2d.rst +++ b/classes/class_animationnodeblendspace2d.rst @@ -21,7 +21,7 @@ Description A resource used by :ref:`AnimationNodeBlendTree`. -\ :ref:`AnimationNodeBlendSpace1D` represents a virtual 2D space on which :ref:`AnimationRootNode`\ s are placed. Outputs the linear blend of the three adjacent animations using a :ref:`Vector2` weight. Adjacent in this context means the three :ref:`AnimationRootNode`\ s making up the triangle that contains the current value. +\ **AnimationNodeBlendSpace2D** represents a virtual 2D space on which :ref:`AnimationRootNode`\ s are placed. Outputs the linear blend of the three adjacent animations using a :ref:`Vector2` weight. Adjacent in this context means the three :ref:`AnimationRootNode`\ s making up the triangle that contains the current value. You can add vertices to the blend space with :ref:`add_blend_point` and automatically triangulate it by setting :ref:`auto_triangles` to ``true``. Otherwise, use :ref:`add_triangle` and :ref:`remove_triangle` to triangulate the blend space by hand. @@ -426,7 +426,7 @@ Changes the :ref:`AnimationNode` referenced by the point at |void| **set_blend_point_position**\ (\ point\: :ref:`int`, pos\: :ref:`Vector2`\ ) :ref:`🔗` -Updates the position of the point at index ``point`` on the blend axis. +Updates the position of the point at index ``point`` in the blend space. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` diff --git a/classes/class_animationnodestatemachine.rst b/classes/class_animationnodestatemachine.rst index f567081cc0b..d5e14462efa 100644 --- a/classes/class_animationnodestatemachine.rst +++ b/classes/class_animationnodestatemachine.rst @@ -21,8 +21,6 @@ Description Contains multiple :ref:`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` object from the :ref:`AnimationTree` node to control it programmatically. -\ **Example:**\ - .. tabs:: diff --git a/classes/class_animationnodestatemachineplayback.rst b/classes/class_animationnodestatemachineplayback.rst index 221d1f62aa3..c1490a096e9 100644 --- a/classes/class_animationnodestatemachineplayback.rst +++ b/classes/class_animationnodestatemachineplayback.rst @@ -21,8 +21,6 @@ Description Allows control of :ref:`AnimationTree` state machines created with :ref:`AnimationNodeStateMachine`. Retrieve with ``$AnimationTree.get("parameters/playback")``. -\ **Example:**\ - .. tabs:: diff --git a/classes/class_animationnodestatemachinetransition.rst b/classes/class_animationnodestatemachinetransition.rst index 1a4973608e7..3bc8ed56d4e 100644 --- a/classes/class_animationnodestatemachinetransition.rst +++ b/classes/class_animationnodestatemachinetransition.rst @@ -146,7 +146,7 @@ Only use this transition during :ref:`AnimationNodeStateMachinePlayback.travel` **ADVANCE_MODE_AUTO** = ``2`` -Automatically use this transition if the :ref:`advance_condition` and :ref:`advance_expression` checks are true (if assigned). +Automatically use this transition if the :ref:`advance_condition` and :ref:`advance_expression` checks are ``true`` (if assigned). .. rst-class:: classref-section-separator @@ -215,7 +215,7 @@ Use an expression as a condition for state machine transitions. It is possible t - |void| **set_advance_mode**\ (\ value\: :ref:`AdvanceMode`\ ) - :ref:`AdvanceMode` **get_advance_mode**\ (\ ) -Determines whether the transition should disabled, enabled when using :ref:`AnimationNodeStateMachinePlayback.travel`, or traversed automatically if the :ref:`advance_condition` and :ref:`advance_expression` checks are true (if assigned). +Determines whether the transition should be disabled, enabled when using :ref:`AnimationNodeStateMachinePlayback.travel`, or traversed automatically if the :ref:`advance_condition` and :ref:`advance_expression` checks are ``true`` (if assigned). .. rst-class:: classref-item-separator diff --git a/classes/class_animationplayer.rst b/classes/class_animationplayer.rst index ffa39105dba..c43c0d34d58 100644 --- a/classes/class_animationplayer.rst +++ b/classes/class_animationplayer.rst @@ -99,6 +99,12 @@ Methods +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`NodePath` | :ref:`get_root`\ (\ ) |const| | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`get_section_end_time`\ (\ ) |const| | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`get_section_start_time`\ (\ ) |const| | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`has_section`\ (\ ) |const| | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_playing`\ (\ ) |const| | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`pause`\ (\ ) | @@ -107,10 +113,20 @@ Methods +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`play_backwards`\ (\ name\: :ref:`StringName` = &"", custom_blend\: :ref:`float` = -1\ ) | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`play_section`\ (\ name\: :ref:`StringName` = &"", start_time\: :ref:`float` = -1, end_time\: :ref:`float` = -1, custom_blend\: :ref:`float` = -1, custom_speed\: :ref:`float` = 1.0, from_end\: :ref:`bool` = false\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`play_section_backwards`\ (\ name\: :ref:`StringName` = &"", start_time\: :ref:`float` = -1, end_time\: :ref:`float` = -1, custom_blend\: :ref:`float` = -1\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`play_section_with_markers`\ (\ name\: :ref:`StringName` = &"", start_marker\: :ref:`StringName` = &"", end_marker\: :ref:`StringName` = &"", custom_blend\: :ref:`float` = -1, custom_speed\: :ref:`float` = 1.0, from_end\: :ref:`bool` = false\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`play_section_with_markers_backwards`\ (\ name\: :ref:`StringName` = &"", start_marker\: :ref:`StringName` = &"", end_marker\: :ref:`StringName` = &"", custom_blend\: :ref:`float` = -1\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`play_with_capture`\ (\ name\: :ref:`StringName` = &"", duration\: :ref:`float` = -1.0, custom_blend\: :ref:`float` = -1, custom_speed\: :ref:`float` = 1.0, from_end\: :ref:`bool` = false, trans_type\: :ref:`TransitionType` = 0, ease_type\: :ref:`EaseType` = 0\ ) | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`queue`\ (\ name\: :ref:`StringName`\ ) | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`reset_section`\ (\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`seek`\ (\ seconds\: :ref:`float`, update\: :ref:`bool` = false, update_only\: :ref:`bool` = false\ ) | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_blend_time`\ (\ animation_from\: :ref:`StringName`, animation_to\: :ref:`StringName`, sec\: :ref:`float`\ ) | @@ -121,6 +137,10 @@ Methods +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_root`\ (\ path\: :ref:`NodePath`\ ) | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_section`\ (\ start_time\: :ref:`float` = -1, end_time\: :ref:`float` = -1\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_section_with_markers`\ (\ start_marker\: :ref:`StringName` = &"", end_marker\: :ref:`StringName` = &""\ ) | + +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`stop`\ (\ keep_state\: :ref:`bool` = false\ ) | +--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -572,6 +592,42 @@ Returns the node which node path references will travel from. ---- +.. _class_AnimationPlayer_method_get_section_end_time: + +.. rst-class:: classref-method + +:ref:`float` **get_section_end_time**\ (\ ) |const| :ref:`🔗` + +Returns the end time of the section currently being played. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationPlayer_method_get_section_start_time: + +.. rst-class:: classref-method + +:ref:`float` **get_section_start_time**\ (\ ) |const| :ref:`🔗` + +Returns the start time of the section currently being played. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationPlayer_method_has_section: + +.. rst-class:: classref-method + +:ref:`bool` **has_section**\ (\ ) |const| :ref:`🔗` + +Returns ``true`` if an animation is currently playing with section. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationPlayer_method_is_playing: .. rst-class:: classref-method @@ -630,6 +686,62 @@ This method is a shorthand for :ref:`play` wi ---- +.. _class_AnimationPlayer_method_play_section: + +.. rst-class:: classref-method + +|void| **play_section**\ (\ name\: :ref:`StringName` = &"", start_time\: :ref:`float` = -1, end_time\: :ref:`float` = -1, custom_blend\: :ref:`float` = -1, custom_speed\: :ref:`float` = 1.0, from_end\: :ref:`bool` = false\ ) :ref:`🔗` + +Plays the animation with key ``name`` and the section starting from ``start_time`` and ending on ``end_time``. See also :ref:`play`. + +Setting ``start_time`` to a value outside the range of the animation means the start of the animation will be used instead, and setting ``end_time`` to a value outside the range of the animation means the end of the animation will be used instead. ``start_time`` cannot be equal to ``end_time``. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationPlayer_method_play_section_backwards: + +.. rst-class:: classref-method + +|void| **play_section_backwards**\ (\ name\: :ref:`StringName` = &"", start_time\: :ref:`float` = -1, end_time\: :ref:`float` = -1, custom_blend\: :ref:`float` = -1\ ) :ref:`🔗` + +Plays the animation with key ``name`` and the section starting from ``start_time`` and ending on ``end_time`` in reverse. + +This method is a shorthand for :ref:`play_section` with ``custom_speed = -1.0`` and ``from_end = true``, see its description for more information. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationPlayer_method_play_section_with_markers: + +.. rst-class:: classref-method + +|void| **play_section_with_markers**\ (\ name\: :ref:`StringName` = &"", start_marker\: :ref:`StringName` = &"", end_marker\: :ref:`StringName` = &"", custom_blend\: :ref:`float` = -1, custom_speed\: :ref:`float` = 1.0, from_end\: :ref:`bool` = false\ ) :ref:`🔗` + +Plays the animation with key ``name`` and the section starting from ``start_marker`` and ending on ``end_marker``. + +If the start marker is empty, the section starts from the beginning of the animation. If the end marker is empty, the section ends on the end of the animation. See also :ref:`play`. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationPlayer_method_play_section_with_markers_backwards: + +.. rst-class:: classref-method + +|void| **play_section_with_markers_backwards**\ (\ name\: :ref:`StringName` = &"", start_marker\: :ref:`StringName` = &"", end_marker\: :ref:`StringName` = &"", custom_blend\: :ref:`float` = -1\ ) :ref:`🔗` + +Plays the animation with key ``name`` and the section starting from ``start_marker`` and ending on ``end_marker`` in reverse. + +This method is a shorthand for :ref:`play_section_with_markers` with ``custom_speed = -1.0`` and ``from_end = true``, see its description for more information. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationPlayer_method_play_with_capture: .. rst-class:: classref-method @@ -661,7 +773,7 @@ If ``duration`` is a negative value, the duration is set to the interval between |void| **queue**\ (\ name\: :ref:`StringName`\ ) :ref:`🔗` -Queues an animation for playback once the current one is done. +Queues an animation for playback once the current animation and all previously queued animations are done. \ **Note:** If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow. @@ -669,6 +781,18 @@ Queues an animation for playback once the current one is done. ---- +.. _class_AnimationPlayer_method_reset_section: + +.. rst-class:: classref-method + +|void| **reset_section**\ (\ ) :ref:`🔗` + +Resets the current section if section is set. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationPlayer_method_seek: .. rst-class:: classref-method @@ -739,6 +863,32 @@ Sets the node which node path references will travel from. ---- +.. _class_AnimationPlayer_method_set_section: + +.. rst-class:: classref-method + +|void| **set_section**\ (\ start_time\: :ref:`float` = -1, end_time\: :ref:`float` = -1\ ) :ref:`🔗` + +Changes the start and end times of the section being played. The current playback position will be clamped within the new section. See also :ref:`play_section`. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationPlayer_method_set_section_with_markers: + +.. rst-class:: classref-method + +|void| **set_section_with_markers**\ (\ start_marker\: :ref:`StringName` = &"", end_marker\: :ref:`StringName` = &""\ ) :ref:`🔗` + +Changes the start and end markers of the section being played. The current playback position will be clamped within the new section. See also :ref:`play_section_with_markers`. + +If the argument is empty, the section uses the beginning or end of the animation. If both are empty, it means that the section is not set. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationPlayer_method_stop: .. rst-class:: classref-method diff --git a/classes/class_area2d.rst b/classes/class_area2d.rst index a47df40ffed..e06699e42d5 100644 --- a/classes/class_area2d.rst +++ b/classes/class_area2d.rst @@ -146,7 +146,7 @@ Emitted when a :ref:`Shape2D` of the received ``area`` enters a s \ ``local_shape_index`` and ``area_shape_index`` contain indices of the interacting shapes from this area and the other area, respectively. ``area_rid`` contains the :ref:`RID` of the other area. These values can be used with the :ref:`PhysicsServer2D`. -\ **Example of getting the** :ref:`CollisionShape2D` **node from the shape index:**\ +\ **Example:** Get the :ref:`CollisionShape2D` node from the shape index: .. tabs:: @@ -213,7 +213,7 @@ Emitted when a :ref:`Shape2D` of the received ``body`` enters a s \ ``local_shape_index`` and ``body_shape_index`` contain indices of the interacting shapes from this area and the interacting body, respectively. ``body_rid`` contains the :ref:`RID` of the body. These values can be used with the :ref:`PhysicsServer2D`. -\ **Example of getting the** :ref:`CollisionShape2D` **node from the shape index:**\ +\ **Example:** Get the :ref:`CollisionShape2D` node from the shape index: .. tabs:: diff --git a/classes/class_area3d.rst b/classes/class_area3d.rst index 67d979f8775..9c0b2aaf80c 100644 --- a/classes/class_area3d.rst +++ b/classes/class_area3d.rst @@ -160,7 +160,7 @@ Emitted when a :ref:`Shape3D` of the received ``area`` enters a s \ ``local_shape_index`` and ``area_shape_index`` contain indices of the interacting shapes from this area and the other area, respectively. ``area_rid`` contains the :ref:`RID` of the other area. These values can be used with the :ref:`PhysicsServer3D`. -\ **Example of getting the** :ref:`CollisionShape3D` **node from the shape index:**\ +\ **Example:** Get the :ref:`CollisionShape3D` node from the shape index: .. tabs:: @@ -227,7 +227,7 @@ Emitted when a :ref:`Shape3D` of the received ``body`` enters a s \ ``local_shape_index`` and ``body_shape_index`` contain indices of the interacting shapes from this area and the interacting body, respectively. ``body_rid`` contains the :ref:`RID` of the body. These values can be used with the :ref:`PhysicsServer3D`. -\ **Example of getting the** :ref:`CollisionShape3D` **node from the shape index:**\ +\ **Example:** Get the :ref:`CollisionShape3D` node from the shape index: .. tabs:: diff --git a/classes/class_array.rst b/classes/class_array.rst index aba6bcbb539..bb14c5a11be 100644 --- a/classes/class_array.rst +++ b/classes/class_array.rst @@ -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` 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` 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:: @@ -133,8 +131,12 @@ Methods +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`find`\ (\ what\: :ref:`Variant`, from\: :ref:`int` = 0\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`find_custom`\ (\ method\: :ref:`Callable`, from\: :ref:`int` = 0\ ) |const| | + +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`front`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Variant` | :ref:`get`\ (\ index\: :ref:`int`\ ) |const| | + +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_typed_builtin`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`get_typed_class_name`\ (\ ) |const| | @@ -185,6 +187,10 @@ Methods +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`rfind`\ (\ what\: :ref:`Variant`, from\: :ref:`int` = -1\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`rfind_custom`\ (\ method\: :ref:`Callable`, from\: :ref:`int` = -1\ ) |const| | + +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set`\ (\ index\: :ref:`int`, value\: :ref:`Variant`\ ) | + +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`shuffle`\ (\ ) | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`size`\ (\ ) |const| | @@ -522,7 +528,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 @@ -641,6 +647,8 @@ Removes all elements from the array. This is equivalent to using :ref:`resize`. + .. rst-class:: classref-item-separator ---- @@ -751,6 +759,35 @@ Returns the index of the **first** occurrence of ``what`` in this array, or ``-1 \ **Note:** For performance reasons, the search is affected by ``what``'s :ref:`Variant.Type`. For example, ``7`` (:ref:`int`) and ``7.0`` (:ref:`float`) are not considered equal for this method. +.. rst-class:: classref-item-separator + +---- + +.. _class_Array_method_find_custom: + +.. rst-class:: classref-method + +:ref:`int` **find_custom**\ (\ method\: :ref:`Callable`, from\: :ref:`int` = 0\ ) |const| :ref:`🔗` + +Returns the index of the **first** element in the array that causes ``method`` to return ``true``, or ``-1`` if there are none. The search's start can be specified with ``from``, continuing to the end of the array. + +\ ``method`` is a callable that takes an element of the array, and returns a :ref:`bool`. + +\ **Note:** If you just want to know whether the array contains *anything* that satisfies ``method``, use :ref:`any`. + + +.. tabs:: + + .. code-tab:: gdscript + + func is_even(number): + return number % 2 == 0 + + func _ready(): + print([1, 3, 4, 7].find_custom(is_even.bind())) # prints 2 + + + .. rst-class:: classref-item-separator ---- @@ -769,6 +806,18 @@ Returns the first element of the array. If the array is empty, fails and returns ---- +.. _class_Array_method_get: + +.. rst-class:: classref-method + +:ref:`Variant` **get**\ (\ index\: :ref:`int`\ ) |const| :ref:`🔗` + +Returns the element at the given ``index`` in the array. This is the same as using the ``[]`` operator (``array[index]``). + +.. rst-class:: classref-item-separator + +---- + .. _class_Array_method_get_typed_builtin: .. rst-class:: classref-method @@ -1131,6 +1180,19 @@ If :ref:`max` is not desirable, this method may also be func is_length_greater(a, b): return a.length() > b.length() +This method can also be used to count how many elements in an array satisfy a certain condition, similar to :ref:`count`: + +:: + + func is_even(number): + return number % 2 == 0 + + func _ready(): + var arr = [1, 2, 3, 4, 5] + # Increment count if it's even, else leaves count the same. + var even_count = arr.reduce(func(count, next): return count + 1 if is_even(next) else count, 0) + print(even_count) # Prints 2 + See also :ref:`map`, :ref:`filter`, :ref:`any` and :ref:`all`. .. rst-class:: classref-item-separator @@ -1195,6 +1257,30 @@ Returns the index of the **last** occurrence of ``what`` in this array, or ``-1` ---- +.. _class_Array_method_rfind_custom: + +.. rst-class:: classref-method + +:ref:`int` **rfind_custom**\ (\ method\: :ref:`Callable`, from\: :ref:`int` = -1\ ) |const| :ref:`🔗` + +Returns the index of the **last** element of the array that causes ``method`` to return ``true``, or ``-1`` if there are none. The search's start can be specified with ``from``, continuing to the beginning of the array. This method is the reverse of :ref:`find_custom`. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Array_method_set: + +.. rst-class:: classref-method + +|void| **set**\ (\ index\: :ref:`int`, value\: :ref:`Variant`\ ) :ref:`🔗` + +Sets the value of the element at the given ``index`` to the given ``value``. This will not change the size of the array, it only changes the value at an index already in the array. This is the same as using the ``[]`` operator (``array[index] = value``). + +.. rst-class:: classref-item-separator + +---- + .. _class_Array_method_shuffle: .. rst-class:: classref-method @@ -1256,7 +1342,7 @@ If ``deep`` is ``true``, all nested **Array** and :ref:`Dictionary` -Sorts the array in ascending order. The final order is dependent on the "less than" (``>``) comparison between elements. +Sorts the array in ascending order. The final order is dependent on the "less than" (``<``) comparison between elements. .. tabs:: @@ -1289,7 +1375,7 @@ Sorts the array in ascending order. The final order is dependent on the "less th Sorts the array using a custom :ref:`Callable`. -\ ``func`` is called as many times as necessary, receiving two array elements as arguments. The function should return ``true`` if the first element should be moved *behind* the second one, otherwise it should return ``false``. +\ ``func`` is called as many times as necessary, receiving two array elements as arguments. The function should return ``true`` if the first element should be moved *before* the second one, otherwise it should return ``false``. :: @@ -1304,7 +1390,7 @@ Sorts the array using a custom :ref:`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`, as in the following example: diff --git a/classes/class_arraymesh.rst b/classes/class_arraymesh.rst index 629392dde74..a1769807e4f 100644 --- a/classes/class_arraymesh.rst +++ b/classes/class_arraymesh.rst @@ -197,7 +197,9 @@ Overrides the :ref:`AABB` with one defined by user for use with frus - |void| **set_shadow_mesh**\ (\ value\: :ref:`ArrayMesh`\ ) - :ref:`ArrayMesh` **get_shadow_mesh**\ (\ ) -An optional mesh which is used for rendering shadows and can be used for the depth prepass. Can be used to increase performance of shadow rendering by using a mesh that only contains vertex position data (without normals, UVs, colors, etc.). +An optional mesh which can be used for rendering shadows and the depth prepass. Can be used to increase performance by supplying a mesh with fused vertices and only vertex position data (without normals, UVs, colors, etc.). + +\ **Note:** This mesh must have exactly the same vertex positions as the source mesh (including the source mesh's LODs, if present). If vertex positions differ, then the mesh will not draw correctly. .. rst-class:: classref-section-separator diff --git a/classes/class_astar2d.rst b/classes/class_astar2d.rst index 91eef236561..0d09e9b4711 100644 --- a/classes/class_astar2d.rst +++ b/classes/class_astar2d.rst @@ -34,7 +34,7 @@ Methods +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_compute_cost`\ (\ from_id\: :ref:`int`, to_id\: :ref:`int`\ ) |virtual| |const| | +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`float` | :ref:`_estimate_cost`\ (\ from_id\: :ref:`int`, to_id\: :ref:`int`\ ) |virtual| |const| | + | :ref:`float` | :ref:`_estimate_cost`\ (\ from_id\: :ref:`int`, end_id\: :ref:`int`\ ) |virtual| |const| | +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_point`\ (\ id\: :ref:`int`, position\: :ref:`Vector2`, weight_scale\: :ref:`float` = 1.0\ ) | +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -110,7 +110,7 @@ Note that this function is hidden in the default **AStar2D** class. .. rst-class:: classref-method -:ref:`float` **_estimate_cost**\ (\ from_id\: :ref:`int`, to_id\: :ref:`int`\ ) |virtual| |const| :ref:`🔗` +:ref:`float` **_estimate_cost**\ (\ from_id\: :ref:`int`, end_id\: :ref:`int`\ ) |virtual| |const| :ref:`🔗` Called when estimating the cost between a point and the path's ending point. @@ -289,6 +289,8 @@ Returns an array with the IDs of the points that form the path found by AStar2D If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached. +\ **Note:** When ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish. + .. tabs:: @@ -319,7 +321,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] @@ -376,7 +378,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] @@ -420,6 +422,8 @@ If there is no valid path to the target, and ``allow_partial_path`` is ``true``, \ **Note:** This method is not thread-safe. If called from a :ref:`Thread`, it will return an empty array and will print an error message. +Additionally, when ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish. + .. rst-class:: classref-item-separator ---- @@ -490,7 +494,7 @@ Removes the point associated with the given ``id`` from the points pool. |void| **reserve_space**\ (\ num_nodes\: :ref:`int`\ ) :ref:`🔗` -Reserves space internally for ``num_nodes`` points, useful if you're adding a known large number of points at once, such as points on a grid. New capacity must be greater or equals to old capacity. +Reserves space internally for ``num_nodes`` points. Useful if you're adding a known large number of points at once, such as points on a grid. The new capacity must be greater or equal to the old capacity. .. rst-class:: classref-item-separator diff --git a/classes/class_astar3d.rst b/classes/class_astar3d.rst index 68a00d86253..6fbb98bc0a6 100644 --- a/classes/class_astar3d.rst +++ b/classes/class_astar3d.rst @@ -71,7 +71,7 @@ Methods +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_compute_cost`\ (\ from_id\: :ref:`int`, to_id\: :ref:`int`\ ) |virtual| |const| | +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`float` | :ref:`_estimate_cost`\ (\ from_id\: :ref:`int`, to_id\: :ref:`int`\ ) |virtual| |const| | + | :ref:`float` | :ref:`_estimate_cost`\ (\ from_id\: :ref:`int`, end_id\: :ref:`int`\ ) |virtual| |const| | +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`add_point`\ (\ id\: :ref:`int`, position\: :ref:`Vector3`, weight_scale\: :ref:`float` = 1.0\ ) | +-----------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -147,7 +147,7 @@ Note that this function is hidden in the default **AStar3D** class. .. rst-class:: classref-method -:ref:`float` **_estimate_cost**\ (\ from_id\: :ref:`int`, to_id\: :ref:`int`\ ) |virtual| |const| :ref:`🔗` +:ref:`float` **_estimate_cost**\ (\ from_id\: :ref:`int`, end_id\: :ref:`int`\ ) |virtual| |const| :ref:`🔗` Called when estimating the cost between a point and the path's ending point. @@ -326,6 +326,8 @@ Returns an array with the IDs of the points that form the path found by AStar3D If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached. +\ **Note:** When ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish. + .. tabs:: @@ -355,7 +357,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] @@ -411,7 +413,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] @@ -455,6 +457,8 @@ If there is no valid path to the target, and ``allow_partial_path`` is ``true``, \ **Note:** This method is not thread-safe. If called from a :ref:`Thread`, it will return an empty array and will print an error message. +Additionally, when ``allow_partial_path`` is ``true`` and ``to_id`` is disabled the search may take an unusually long time to finish. + .. rst-class:: classref-item-separator ---- diff --git a/classes/class_astargrid2d.rst b/classes/class_astargrid2d.rst index 770356dc125..91a5427f25e 100644 --- a/classes/class_astargrid2d.rst +++ b/classes/class_astargrid2d.rst @@ -84,39 +84,41 @@ Methods .. table:: :widths: auto - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`float` | :ref:`_compute_cost`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`\ ) |virtual| |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`float` | :ref:`_estimate_cost`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`\ ) |virtual| |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`clear`\ (\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`fill_solid_region`\ (\ region\: :ref:`Rect2i`, solid\: :ref:`bool` = true\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`fill_weight_scale_region`\ (\ region\: :ref:`Rect2i`, weight_scale\: :ref:`float`\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Array`\[:ref:`Vector2i`\] | :ref:`get_id_path`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`, allow_partial_path\: :ref:`bool` = false\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`PackedVector2Array` | :ref:`get_point_path`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`, allow_partial_path\: :ref:`bool` = false\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Vector2` | :ref:`get_point_position`\ (\ id\: :ref:`Vector2i`\ ) |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`float` | :ref:`get_point_weight_scale`\ (\ id\: :ref:`Vector2i`\ ) |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`is_dirty`\ (\ ) |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`is_in_bounds`\ (\ x\: :ref:`int`, y\: :ref:`int`\ ) |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`is_in_boundsv`\ (\ id\: :ref:`Vector2i`\ ) |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`is_point_solid`\ (\ id\: :ref:`Vector2i`\ ) |const| | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`set_point_solid`\ (\ id\: :ref:`Vector2i`, solid\: :ref:`bool` = true\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`set_point_weight_scale`\ (\ id\: :ref:`Vector2i`, weight_scale\: :ref:`float`\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`update`\ (\ ) | - +--------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`_compute_cost`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`\ ) |virtual| |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`_estimate_cost`\ (\ from_id\: :ref:`Vector2i`, end_id\: :ref:`Vector2i`\ ) |virtual| |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`clear`\ (\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`fill_solid_region`\ (\ region\: :ref:`Rect2i`, solid\: :ref:`bool` = true\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`fill_weight_scale_region`\ (\ region\: :ref:`Rect2i`, weight_scale\: :ref:`float`\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Array`\[:ref:`Vector2i`\] | :ref:`get_id_path`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`, allow_partial_path\: :ref:`bool` = false\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Array`\[:ref:`Dictionary`\] | :ref:`get_point_data_in_region`\ (\ region\: :ref:`Rect2i`\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`PackedVector2Array` | :ref:`get_point_path`\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`, allow_partial_path\: :ref:`bool` = false\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Vector2` | :ref:`get_point_position`\ (\ id\: :ref:`Vector2i`\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`get_point_weight_scale`\ (\ id\: :ref:`Vector2i`\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_dirty`\ (\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_in_bounds`\ (\ x\: :ref:`int`, y\: :ref:`int`\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_in_boundsv`\ (\ id\: :ref:`Vector2i`\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_point_solid`\ (\ id\: :ref:`Vector2i`\ ) |const| | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_point_solid`\ (\ id\: :ref:`Vector2i`, solid\: :ref:`bool` = true\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_point_weight_scale`\ (\ id\: :ref:`Vector2i`, weight_scale\: :ref:`float`\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`update`\ (\ ) | + +------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -483,7 +485,7 @@ Note that this function is hidden in the default **AStarGrid2D** class. .. rst-class:: classref-method -:ref:`float` **_estimate_cost**\ (\ from_id\: :ref:`Vector2i`, to_id\: :ref:`Vector2i`\ ) |virtual| |const| :ref:`🔗` +:ref:`float` **_estimate_cost**\ (\ from_id\: :ref:`Vector2i`, end_id\: :ref:`Vector2i`\ ) |virtual| |const| :ref:`🔗` Called when estimating the cost between a point and the path's ending point. @@ -543,6 +545,20 @@ Returns an array with the IDs of the points that form the path found by AStar2D If there is no valid path to the target, and ``allow_partial_path`` is ``true``, returns a path to the point closest to the target that can be reached. +\ **Note:** When ``allow_partial_path`` is ``true`` and ``to_id`` is solid the search may take an unusually long time to finish. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AStarGrid2D_method_get_point_data_in_region: + +.. rst-class:: classref-method + +:ref:`Array`\[:ref:`Dictionary`\] **get_point_data_in_region**\ (\ region\: :ref:`Rect2i`\ ) |const| :ref:`🔗` + +Returns an array of dictionaries with point data (``id``: :ref:`Vector2i`, ``position``: :ref:`Vector2`, ``solid``: :ref:`bool`, ``weight_scale``: :ref:`float`) within a ``region``. + .. rst-class:: classref-item-separator ---- @@ -559,6 +575,8 @@ If there is no valid path to the target, and ``allow_partial_path`` is ``true``, \ **Note:** This method is not thread-safe. If called from a :ref:`Thread`, it will return an empty array and will print an error message. +Additionally, when ``allow_partial_path`` is ``true`` and ``to_id`` is solid the search may take an unusually long time to finish. + .. rst-class:: classref-item-separator ---- diff --git a/classes/class_atlastexture.rst b/classes/class_atlastexture.rst index 70457128a5c..ff3384aa790 100644 --- a/classes/class_atlastexture.rst +++ b/classes/class_atlastexture.rst @@ -23,7 +23,7 @@ Description Multiple **AtlasTexture** resources can be cropped from the same :ref:`atlas`. Packing many smaller textures into a singular large texture helps to optimize video memory costs and render calls. -\ **Note:** **AtlasTexture** cannot be used in an :ref:`AnimatedTexture`, and may not tile properly in nodes such as :ref:`TextureRect`, when inside other **AtlasTexture** resources. +\ **Note:** **AtlasTexture** cannot be used in an :ref:`AnimatedTexture`, and will not tile properly in nodes such as :ref:`TextureRect` or :ref:`Sprite2D`. To tile an **AtlasTexture**, modify its :ref:`region` instead. .. rst-class:: classref-reftable-group diff --git a/classes/class_audioeffectfilter.rst b/classes/class_audioeffectfilter.rst index b3d55990523..11e939b6640 100644 --- a/classes/class_audioeffectfilter.rst +++ b/classes/class_audioeffectfilter.rst @@ -69,11 +69,7 @@ enum **FilterDB**: :ref:`🔗` :ref:`FilterDB` **FILTER_6DB** = ``0`` -.. container:: contribute - - There is currently no description for this enum. Please help us by :ref:`contributing one `! - - +Cutting off at 6dB per octave. .. _class_AudioEffectFilter_constant_FILTER_12DB: @@ -81,11 +77,7 @@ enum **FilterDB**: :ref:`🔗` :ref:`FilterDB` **FILTER_12DB** = ``1`` -.. container:: contribute - - There is currently no description for this enum. Please help us by :ref:`contributing one `! - - +Cutting off at 12dB per octave. .. _class_AudioEffectFilter_constant_FILTER_18DB: @@ -93,11 +85,7 @@ enum **FilterDB**: :ref:`🔗` :ref:`FilterDB` **FILTER_18DB** = ``2`` -.. container:: contribute - - There is currently no description for this enum. Please help us by :ref:`contributing one `! - - +Cutting off at 18dB per octave. .. _class_AudioEffectFilter_constant_FILTER_24DB: @@ -105,11 +93,7 @@ enum **FilterDB**: :ref:`🔗` :ref:`FilterDB` **FILTER_24DB** = ``3`` -.. container:: contribute - - There is currently no description for this enum. Please help us by :ref:`contributing one `! - - +Cutting off at 24dB per octave. .. rst-class:: classref-section-separator @@ -148,9 +132,7 @@ Threshold frequency for the filter, in Hz. - |void| **set_db**\ (\ value\: :ref:`FilterDB`\ ) - :ref:`FilterDB` **get_db**\ (\ ) -.. container:: contribute - - There is currently no description for this property. Please help us by :ref:`contributing one `! +Steepness of the cutoff curve in dB per octave, also known as the order of the filter. Higher orders have a more aggressive cutoff. .. rst-class:: classref-item-separator diff --git a/classes/class_audioeffectspectrumanalyzer.rst b/classes/class_audioeffectspectrumanalyzer.rst index 2a862c5c0f3..4e01dc5d26d 100644 --- a/classes/class_audioeffectspectrumanalyzer.rst +++ b/classes/class_audioeffectspectrumanalyzer.rst @@ -21,7 +21,7 @@ Description This audio effect does not affect sound output, but can be used for real-time audio visualizations. -This resource configures an :ref:`AudioEffectSpectrumAnalyzerInstance`, which performs the actual analysis at runtime. An instance can be acquired with :ref:`AudioServer.get_bus_effect_instance`. +This resource configures an :ref:`AudioEffectSpectrumAnalyzerInstance`, which performs the actual analysis at runtime. An instance can be obtained with :ref:`AudioServer.get_bus_effect_instance`. See also :ref:`AudioStreamGenerator` for procedurally generating sounds. diff --git a/classes/class_audioeffectspectrumanalyzerinstance.rst b/classes/class_audioeffectspectrumanalyzerinstance.rst index 68c533dcf73..00f953b3935 100644 --- a/classes/class_audioeffectspectrumanalyzerinstance.rst +++ b/classes/class_audioeffectspectrumanalyzerinstance.rst @@ -21,7 +21,7 @@ Description The runtime part of an :ref:`AudioEffectSpectrumAnalyzer`, which can be used to query the magnitude of a frequency range on its host bus. -An instance of this class can be acquired with :ref:`AudioServer.get_bus_effect_instance`. +An instance of this class can be obtained with :ref:`AudioServer.get_bus_effect_instance`. .. rst-class:: classref-introduction-group diff --git a/classes/class_audioeffectstereoenhance.rst b/classes/class_audioeffectstereoenhance.rst index ed98852e81e..2b4b2015ef0 100644 --- a/classes/class_audioeffectstereoenhance.rst +++ b/classes/class_audioeffectstereoenhance.rst @@ -64,7 +64,7 @@ Property Descriptions - |void| **set_pan_pullout**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_pan_pullout**\ (\ ) -Values greater than 1.0 increase intensity of any panning on audio passing through this effect, whereas values less than 1.0 will decrease the panning intensity. A value of 0.0 will downmix audio to mono. +Amplifies the difference between stereo channels, increasing or decreasing existing panning. A value of 0.0 will downmix stereo to mono. Does not affect a mono signal. .. rst-class:: classref-item-separator @@ -81,9 +81,7 @@ Values greater than 1.0 increase intensity of any panning on audio passing throu - |void| **set_surround**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_surround**\ (\ ) -.. container:: contribute - - There is currently no description for this property. Please help us by :ref:`contributing one `! +Widens sound stage through phase shifting in conjunction with :ref:`time_pullout_ms`. Just pans sound to the left channel if :ref:`time_pullout_ms` is 0. .. rst-class:: classref-item-separator @@ -100,9 +98,7 @@ Values greater than 1.0 increase intensity of any panning on audio passing throu - |void| **set_time_pullout**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_time_pullout**\ (\ ) -.. container:: contribute - - There is currently no description for this property. Please help us by :ref:`contributing one `! +Widens sound stage through phase shifting in conjunction with :ref:`surround`. Just delays the right channel if :ref:`surround` is 0. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` diff --git a/classes/class_audioserver.rst b/classes/class_audioserver.rst index 5a10f28eec9..aa74e69a2e9 100644 --- a/classes/class_audioserver.rst +++ b/classes/class_audioserver.rst @@ -87,8 +87,12 @@ Methods +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_bus_volume_db`\ (\ bus_idx\: :ref:`int`\ ) |const| | +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`String` | :ref:`get_driver_name`\ (\ ) |const| | + +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_input_device_list`\ (\ ) | +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`get_input_mix_rate`\ (\ ) |const| | + +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_mix_rate`\ (\ ) |const| | +-------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`get_output_device_list`\ (\ ) | @@ -514,6 +518,18 @@ Returns the volume of the bus at index ``bus_idx`` in dB. ---- +.. _class_AudioServer_method_get_driver_name: + +.. rst-class:: classref-method + +:ref:`String` **get_driver_name**\ (\ ) |const| :ref:`🔗` + +Returns the name of the current audio driver. The default usually depends on the operating system, but may be overridden via the ``--audio-driver`` :doc:`command line argument <../tutorials/editor/command_line_tutorial>`. ``--headless`` also automatically sets the audio driver to ``Dummy``. See also :ref:`ProjectSettings.audio/driver/driver`. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioServer_method_get_input_device_list: .. rst-class:: classref-method @@ -528,6 +544,18 @@ Returns the names of all audio input devices detected on the system. ---- +.. _class_AudioServer_method_get_input_mix_rate: + +.. rst-class:: classref-method + +:ref:`float` **get_input_mix_rate**\ (\ ) |const| :ref:`🔗` + +Returns the sample rate at the input of the **AudioServer**. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioServer_method_get_mix_rate: .. rst-class:: classref-method diff --git a/classes/class_audiostreaminteractive.rst b/classes/class_audiostreaminteractive.rst index 02e2635cee1..544b64695f4 100644 --- a/classes/class_audiostreaminteractive.rst +++ b/classes/class_audiostreaminteractive.rst @@ -19,7 +19,7 @@ Audio stream that can playback music interactively, combining clips and a transi Description ----------- -This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and the transition rules via the :ref:`add_transition`. Additionally, this stream export a property parameter to control the playback via :ref:`AudioStreamPlayer`, :ref:`AudioStreamPlayer2D`, or :ref:`AudioStreamPlayer3D`. +This is an audio stream that can playback music interactively, combining clips and a transition table. Clips must be added first, and then the transition rules via the :ref:`add_transition`. Additionally, this stream exports a property parameter to control the playback via :ref:`AudioStreamPlayer`, :ref:`AudioStreamPlayer2D`, or :ref:`AudioStreamPlayer3D`. The way this is used is by filling a number of clips, then configuring the transition table. From there, clips are selected for playback and the music will smoothly go from the current to the new one while using the corresponding transition rule defined in the transition table. @@ -471,7 +471,7 @@ Return the destination time position for a transition (see :ref:`add_transition< :ref:`bool` **has_transition**\ (\ from_clip\: :ref:`int`, to_clip\: :ref:`int`\ ) |const| :ref:`🔗` -Return true if a given transition exists (was added via :ref:`add_transition`). +Returns ``true`` if a given transition exists (was added via :ref:`add_transition`). .. rst-class:: classref-item-separator diff --git a/classes/class_audiostreamplayback.rst b/classes/class_audiostreamplayback.rst index 76f12f3987b..57a1105990f 100644 --- a/classes/class_audiostreamplayback.rst +++ b/classes/class_audiostreamplayback.rst @@ -59,10 +59,24 @@ Methods +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`_tag_used_streams`\ (\ ) |virtual| | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`get_loop_count`\ (\ ) |const| | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`float` | :ref:`get_playback_position`\ (\ ) |const| | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AudioSamplePlayback` | :ref:`get_sample_playback`\ (\ ) |const| | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_playing`\ (\ ) |const| | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`PackedVector2Array` | :ref:`mix_audio`\ (\ rate_scale\: :ref:`float`, frames\: :ref:`int`\ ) | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`seek`\ (\ time\: :ref:`float` = 0.0\ ) | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_sample_playback`\ (\ playback_sample\: :ref:`AudioSamplePlayback`\ ) | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`start`\ (\ from_pos\: :ref:`float` = 0.0\ ) | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`stop`\ (\ ) | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -195,6 +209,30 @@ Overridable method. Called whenever the audio stream is mixed if the playback is ---- +.. _class_AudioStreamPlayback_method_get_loop_count: + +.. rst-class:: classref-method + +:ref:`int` **get_loop_count**\ (\ ) |const| :ref:`🔗` + +Returns the number of times the stream has looped. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AudioStreamPlayback_method_get_playback_position: + +.. rst-class:: classref-method + +:ref:`float` **get_playback_position**\ (\ ) |const| :ref:`🔗` + +Returns the current position in the stream, in seconds. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioStreamPlayback_method_get_sample_playback: .. rst-class:: classref-method @@ -209,6 +247,46 @@ Returns the :ref:`AudioSamplePlayback` associated wit ---- +.. _class_AudioStreamPlayback_method_is_playing: + +.. rst-class:: classref-method + +:ref:`bool` **is_playing**\ (\ ) |const| :ref:`🔗` + +Returns ``true`` if the stream is playing. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AudioStreamPlayback_method_mix_audio: + +.. rst-class:: classref-method + +:ref:`PackedVector2Array` **mix_audio**\ (\ rate_scale\: :ref:`float`, frames\: :ref:`int`\ ) :ref:`🔗` + +Mixes up to ``frames`` of audio from the stream from the current position, at a rate of ``rate_scale``, advancing the stream. + +Returns a :ref:`PackedVector2Array` where each element holds the left and right channel volume levels of each frame. + +\ **Note:** Can return fewer frames than requested, make sure to use the size of the return value. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AudioStreamPlayback_method_seek: + +.. rst-class:: classref-method + +|void| **seek**\ (\ time\: :ref:`float` = 0.0\ ) :ref:`🔗` + +Seeks the stream at the given ``time``, in seconds. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioStreamPlayback_method_set_sample_playback: .. rst-class:: classref-method @@ -219,6 +297,30 @@ Returns the :ref:`AudioSamplePlayback` associated wit Associates :ref:`AudioSamplePlayback` to this **AudioStreamPlayback** for playing back the audio sample of this stream. +.. rst-class:: classref-item-separator + +---- + +.. _class_AudioStreamPlayback_method_start: + +.. rst-class:: classref-method + +|void| **start**\ (\ from_pos\: :ref:`float` = 0.0\ ) :ref:`🔗` + +Starts the stream from the given ``from_pos``, in seconds. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AudioStreamPlayback_method_stop: + +.. rst-class:: classref-method + +|void| **stop**\ (\ ) :ref:`🔗` + +Stops the stream. + .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` diff --git a/classes/class_audiostreamplaybackpolyphonic.rst b/classes/class_audiostreamplaybackpolyphonic.rst index c6d5c216ea8..7ca1d3ce91a 100644 --- a/classes/class_audiostreamplaybackpolyphonic.rst +++ b/classes/class_audiostreamplaybackpolyphonic.rst @@ -73,7 +73,7 @@ Method Descriptions :ref:`bool` **is_stream_playing**\ (\ stream\: :ref:`int`\ ) |const| :ref:`🔗` -Return true whether the stream associated with an integer ID is still playing. Check :ref:`play_stream` for information on when this ID becomes invalid. +Returns ``true`` if the stream associated with the given integer ID is still playing. Check :ref:`play_stream` for information on when this ID becomes invalid. .. rst-class:: classref-item-separator diff --git a/classes/class_audiostreamplayer.rst b/classes/class_audiostreamplayer.rst index 9f709e104b4..5e8de34ce13 100644 --- a/classes/class_audiostreamplayer.rst +++ b/classes/class_audiostreamplayer.rst @@ -24,7 +24,7 @@ Description The **AudioStreamPlayer** node plays an audio stream non-positionally. It is ideal for user interfaces, menus, or background music. -To use this node, :ref:`stream` needs to be set to a valid :ref:`AudioStream` resource. Playing more than one sound at the time is also supported, see :ref:`max_polyphony`. +To use this node, :ref:`stream` needs to be set to a valid :ref:`AudioStream` resource. Playing more than one sound at the same time is also supported, see :ref:`max_polyphony`. If you need to play audio at a specific position, use :ref:`AudioStreamPlayer2D` or :ref:`AudioStreamPlayer3D` instead. @@ -276,6 +276,7 @@ The playback type of the stream player. If set other than to the default value, .. rst-class:: classref-property-setget +- |void| **set_playing**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_playing**\ (\ ) If ``true``, this node is playing sounds. Setting this property has the same effect as :ref:`play` and :ref:`stop`. diff --git a/classes/class_audiostreamplayer2d.rst b/classes/class_audiostreamplayer2d.rst index ac52ce133d0..d21a37e4428 100644 --- a/classes/class_audiostreamplayer2d.rst +++ b/classes/class_audiostreamplayer2d.rst @@ -286,6 +286,7 @@ The playback type of the stream player. If set other than to the default value, .. rst-class:: classref-property-setget +- |void| **set_playing**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_playing**\ (\ ) If ``true``, audio is playing or is queued to be played (see :ref:`play`). diff --git a/classes/class_audiostreamplayer3d.rst b/classes/class_audiostreamplayer3d.rst index 1160b7cd272..9ac194f2a98 100644 --- a/classes/class_audiostreamplayer3d.rst +++ b/classes/class_audiostreamplayer3d.rst @@ -502,6 +502,7 @@ The playback type of the stream player. If set other than to the default value, .. rst-class:: classref-property-setget +- |void| **set_playing**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_playing**\ (\ ) If ``true``, audio is playing or is queued to be played (see :ref:`play`). diff --git a/classes/class_audiostreamsynchronized.rst b/classes/class_audiostreamsynchronized.rst index a83a29f5c6f..914abe5cb97 100644 --- a/classes/class_audiostreamsynchronized.rst +++ b/classes/class_audiostreamsynchronized.rst @@ -66,7 +66,7 @@ Constants **MAX_STREAMS** = ``32`` :ref:`🔗` -Maximum amount of streams that can be synchrohized. +Maximum amount of streams that can be synchronized. .. rst-class:: classref-section-separator diff --git a/classes/class_audiostreamwav.rst b/classes/class_audiostreamwav.rst index fb21bcccfb9..e61b8c68c31 100644 --- a/classes/class_audiostreamwav.rst +++ b/classes/class_audiostreamwav.rst @@ -87,7 +87,7 @@ enum **Format**: :ref:`🔗` :ref:`Format` **FORMAT_8_BITS** = ``0`` -8-bit audio codec. +8-bit PCM audio codec. .. _class_AudioStreamWAV_constant_FORMAT_16_BITS: @@ -95,7 +95,7 @@ enum **Format**: :ref:`🔗` :ref:`Format` **FORMAT_16_BITS** = ``1`` -16-bit audio codec. +16-bit PCM audio codec. .. _class_AudioStreamWAV_constant_FORMAT_IMA_ADPCM: @@ -103,7 +103,7 @@ enum **Format**: :ref:`🔗` :ref:`Format` **FORMAT_IMA_ADPCM** = ``2`` -Audio is compressed using IMA ADPCM. +Audio is lossily compressed as IMA ADPCM. .. _class_AudioStreamWAV_constant_FORMAT_QOA: @@ -111,7 +111,7 @@ Audio is compressed using IMA ADPCM. :ref:`Format` **FORMAT_QOA** = ``3`` -Audio is compressed as QOA (`Quite OK Audio `__). +Audio is lossily compressed as `Quite OK Audio `__. .. rst-class:: classref-item-separator @@ -177,7 +177,9 @@ Property Descriptions Contains the audio data in bytes. -\ **Note:** This property expects signed PCM8 data. To convert unsigned PCM8 to signed PCM8, subtract 128 from each byte. +\ **Note:** If :ref:`format` is set to :ref:`FORMAT_8_BITS`, this property expects signed 8-bit PCM data. To convert from unsigned 8-bit PCM, subtract 128 from each byte. + +\ **Note:** If :ref:`format` is set to :ref:`FORMAT_QOA`, this property expects data from a full QOA file. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedByteArray` for more details. @@ -213,7 +215,7 @@ Audio format. See :ref:`Format` constants for values - |void| **set_loop_begin**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_loop_begin**\ (\ ) -The loop start point (in number of samples, relative to the beginning of the stream). This information will be imported automatically from the WAV file if present. +The loop start point (in number of samples, relative to the beginning of the stream). .. rst-class:: classref-item-separator @@ -230,7 +232,7 @@ The loop start point (in number of samples, relative to the beginning of the str - |void| **set_loop_end**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_loop_end**\ (\ ) -The loop end point (in number of samples, relative to the beginning of the stream). This information will be imported automatically from the WAV file if present. +The loop end point (in number of samples, relative to the beginning of the stream). .. rst-class:: classref-item-separator @@ -247,7 +249,7 @@ The loop end point (in number of samples, relative to the beginning of the strea - |void| **set_loop_mode**\ (\ value\: :ref:`LoopMode`\ ) - :ref:`LoopMode` **get_loop_mode**\ (\ ) -The loop mode. This information will be imported automatically from the WAV file if present. See :ref:`LoopMode` constants for values. +The loop mode. See :ref:`LoopMode` constants for values. .. rst-class:: classref-item-separator @@ -302,7 +304,7 @@ Method Descriptions :ref:`Error` **save_to_wav**\ (\ path\: :ref:`String`\ ) :ref:`🔗` -Saves the AudioStreamWAV as a WAV file to ``path``. Samples with IMA ADPCM or QOA formats can't be saved. +Saves the AudioStreamWAV as a WAV file to ``path``. Samples with IMA ADPCM or Quite OK Audio formats can't be saved. \ **Note:** A ``.wav`` extension is automatically appended to ``path`` if it is missing. diff --git a/classes/class_backbuffercopy.rst b/classes/class_backbuffercopy.rst index 0b3ac0b753a..2e5e4324920 100644 --- a/classes/class_backbuffercopy.rst +++ b/classes/class_backbuffercopy.rst @@ -23,6 +23,13 @@ Node for back-buffering the currently-displayed screen. The region defined in th \ **Note:** Since this node inherits from :ref:`Node2D` (and not :ref:`Control`), anchors and margins won't apply to child :ref:`Control`-derived nodes. This can be problematic when resizing the window. To avoid this, add :ref:`Control`-derived nodes as *siblings* to the **BackBufferCopy** node instead of adding them as children. +.. rst-class:: classref-introduction-group + +Tutorials +--------- + +- :doc:`Screen-reading shaders <../tutorials/shaders/screen-reading_shaders>` + .. rst-class:: classref-reftable-group Properties diff --git a/classes/class_basebutton.rst b/classes/class_basebutton.rst index acb2d2a0be8..b5f9ec04a12 100644 --- a/classes/class_basebutton.rst +++ b/classes/class_basebutton.rst @@ -288,7 +288,7 @@ To allow both left-click and right-click, use ``MOUSE_BUTTON_MASK_LEFT | MOUSE_B If ``true``, the button's state is pressed. Means the button is pressed down or toggled (if :ref:`toggle_mode` is active). Only works if :ref:`toggle_mode` is ``true``. -\ **Note:** Setting :ref:`button_pressed` will result in :ref:`toggled` to be emitted. If you want to change the pressed state without emitting that signal, use :ref:`set_pressed_no_signal`. +\ **Note:** Changing the value of :ref:`button_pressed` will result in :ref:`toggled` to be emitted. If you want to change the pressed state without emitting that signal, use :ref:`set_pressed_no_signal`. .. rst-class:: classref-item-separator @@ -377,6 +377,8 @@ If ``true``, the button will highlight for a short amount of time when its short If ``true``, the button will add information about its shortcut in the tooltip. +\ **Note:** This property does nothing when the tooltip control is customized using :ref:`Control._make_custom_tooltip`. + .. rst-class:: classref-item-separator ---- diff --git a/classes/class_basematerial3d.rst b/classes/class_basematerial3d.rst index 02634ebaf45..fd7161937ec 100644 --- a/classes/class_basematerial3d.rst +++ b/classes/class_basematerial3d.rst @@ -645,7 +645,7 @@ The object will be shaded per pixel. Useful for realistic shading effects. :ref:`ShadingMode` **SHADING_MODE_PER_VERTEX** = ``2`` -The object will be shaded per vertex. Useful when you want cheaper shaders and do not care about visual quality. Not implemented yet (this mode will act like :ref:`SHADING_MODE_PER_PIXEL`). +The object will be shaded per vertex. Useful when you want cheaper shaders and do not care about visual quality. .. _class_BaseMaterial3D_constant_SHADING_MODE_MAX: @@ -2929,8 +2929,6 @@ Specifies the channel of the :ref:`roughness_texture`. +\ **Note:** In C#, this constructs a **Basis** with all of its components set to :ref:`Vector3.ZERO`. + .. rst-class:: classref-item-separator ---- @@ -716,7 +718,7 @@ The basis matrix's rows are multiplied by ``scale``'s components. This operation Performs a spherical-linear interpolation with the ``to`` basis, given a ``weight``. Both this basis and ``to`` should represent a rotation. -\ **Example:** Smoothly rotate a :ref:`Node3D` to the target basis over time, with a :ref:`Tween`. +\ **Example:** Smoothly rotate a :ref:`Node3D` to the target basis over time, with a :ref:`Tween`: :: diff --git a/classes/class_boneattachment3d.rst b/classes/class_boneattachment3d.rst index 5b5475a34a4..94b63075d7e 100644 --- a/classes/class_boneattachment3d.rst +++ b/classes/class_boneattachment3d.rst @@ -48,17 +48,19 @@ Methods .. table:: :widths: auto - +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`NodePath` | :ref:`get_external_skeleton`\ (\ ) |const| | - +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`get_use_external_skeleton`\ (\ ) |const| | - +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`on_skeleton_update`\ (\ ) | - +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`set_external_skeleton`\ (\ external_skeleton\: :ref:`NodePath`\ ) | - +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ - | |void| | :ref:`set_use_external_skeleton`\ (\ use_external_skeleton\: :ref:`bool`\ ) | - +---------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`NodePath` | :ref:`get_external_skeleton`\ (\ ) |const| | + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Skeleton3D` | :ref:`get_skeleton`\ (\ ) | + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`get_use_external_skeleton`\ (\ ) |const| | + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`on_skeleton_update`\ (\ ) | + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_external_skeleton`\ (\ external_skeleton\: :ref:`NodePath`\ ) | + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_use_external_skeleton`\ (\ use_external_skeleton\: :ref:`bool`\ ) | + +-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -139,6 +141,18 @@ Returns the :ref:`NodePath` to the external :ref:`Skeleton3D` **get_skeleton**\ (\ ) :ref:`🔗` + +Get parent or external :ref:`Skeleton3D` node if found. + +.. rst-class:: classref-item-separator + +---- + .. _class_BoneAttachment3D_method_get_use_external_skeleton: .. rst-class:: classref-method diff --git a/classes/class_button.rst b/classes/class_button.rst index 6d617ac223f..477654634be 100644 --- a/classes/class_button.rst +++ b/classes/class_button.rst @@ -23,7 +23,7 @@ Description **Button** is the standard themed button. It can contain text and an icon, and it will display them according to the current :ref:`Theme`. -\ **Example of creating a button and assigning an action when pressed by code:**\ +\ **Example:** Create a button and connect a method that will be called when the button is pressed: .. tabs:: @@ -33,7 +33,7 @@ Description func _ready(): var button = Button.new() button.text = "Click me" - button.pressed.connect(self._button_pressed) + button.pressed.connect(_button_pressed) add_child(button) func _button_pressed(): @@ -58,7 +58,7 @@ Description See also :ref:`BaseButton` which contains common properties and methods associated with this node. -\ **Note:** Buttons do not interpret touch input and therefore don't support multitouch, since mouse emulation can only press one button at a given time. Use :ref:`TouchScreenButton` for buttons that trigger gameplay movement or actions. +\ **Note:** Buttons do not detect touch input and therefore don't support multitouch, since mouse emulation can only press one button at a given time. Use :ref:`TouchScreenButton` for buttons that trigger gameplay movement or actions. .. rst-class:: classref-introduction-group @@ -144,6 +144,8 @@ Theme Properties +-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+ | :ref:`int` | :ref:`icon_max_width` | ``0`` | +-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+ + | :ref:`int` | :ref:`line_spacing` | ``0`` | + +-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+ | :ref:`int` | :ref:`outline_size` | ``0`` | +-----------------------------------+-----------------------------------------------------------------------------------------+-------------------------------------+ | :ref:`Font` | :ref:`font` | | @@ -587,6 +589,18 @@ The maximum allowed width of the **Button**'s icon. This limit is applied on top ---- +.. _class_Button_theme_constant_line_spacing: + +.. rst-class:: classref-themeproperty + +:ref:`int` **line_spacing** = ``0`` :ref:`🔗` + +Additional vertical spacing between lines (in pixels), spacing is added to line descent. This value can be negative. + +.. rst-class:: classref-item-separator + +---- + .. _class_Button_theme_constant_outline_size: .. rst-class:: classref-themeproperty diff --git a/classes/class_callable.rst b/classes/class_callable.rst index 691f4482ef9..4e6bcfbd1ad 100644 --- a/classes/class_callable.rst +++ b/classes/class_callable.rst @@ -19,8 +19,6 @@ Description **Callable** is a built-in :ref:`Variant` type that represents a function. It can either be a method within an :ref:`Object` instance, or a custom callable used for different purposes (see :ref:`is_custom`). Like all :ref:`Variant` types, it can be stored in variables and passed to other functions. It is most commonly used for signal callbacks. -\ **Example:**\ - .. tabs:: @@ -141,6 +139,8 @@ Methods +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_object_id`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`get_unbound_arguments_count`\ (\ ) |const| | + +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`hash`\ (\ ) |const| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_custom`\ (\ ) |const| | @@ -337,7 +337,15 @@ Returns the total number of arguments this **Callable** should take, including o :ref:`Array` **get_bound_arguments**\ (\ ) |const| :ref:`🔗` -Return the bound arguments (as long as :ref:`get_bound_arguments_count` is greater than zero), or empty (if :ref:`get_bound_arguments_count` is less than or equal to zero). +Returns the array of arguments bound via successive :ref:`bind` or :ref:`unbind` calls. These arguments will be added *after* the arguments passed to the call, from which :ref:`get_unbound_arguments_count` arguments on the right have been previously excluded. + +:: + + func get_effective_arguments(callable, call_args): + assert(call_args.size() - callable.get_unbound_arguments_count() >= 0) + var result = call_args.slice(0, call_args.size() - callable.get_unbound_arguments_count()) + result.append_array(callable.get_bound_arguments()) + return result .. rst-class:: classref-item-separator @@ -349,7 +357,9 @@ Return the bound arguments (as long as :ref:`get_bound_arguments_count` **get_bound_arguments_count**\ (\ ) |const| :ref:`🔗` -Returns the total amount of arguments bound (or unbound) via successive :ref:`bind` or :ref:`unbind` calls. If the amount of arguments unbound is greater than the ones bound, this function returns a value less than zero. +Returns the total amount of arguments bound via successive :ref:`bind` or :ref:`unbind` calls. This is the same as the size of the array returned by :ref:`get_bound_arguments`. See :ref:`get_bound_arguments` for details. + +\ **Note:** The :ref:`get_bound_arguments_count` and :ref:`get_unbound_arguments_count` methods can both return positive values. .. rst-class:: classref-item-separator @@ -391,6 +401,20 @@ Returns the ID of this **Callable**'s object (see :ref:`Object.get_instance_id` **get_unbound_arguments_count**\ (\ ) |const| :ref:`🔗` + +Returns the total amount of arguments unbound via successive :ref:`bind` or :ref:`unbind` calls. See :ref:`get_bound_arguments` for details. + +\ **Note:** The :ref:`get_bound_arguments_count` and :ref:`get_unbound_arguments_count` methods can both return positive values. + +.. rst-class:: classref-item-separator + +---- + .. _class_Callable_method_hash: .. rst-class:: classref-method @@ -431,7 +455,9 @@ Returns ``true`` if this **Callable** is a custom callable. Custom callables are :ref:`bool` **is_null**\ (\ ) |const| :ref:`🔗` -Returns ``true`` if this **Callable** has no target to call the method on. +Returns ``true`` if this **Callable** has no target to call the method on. Equivalent to ``callable == Callable()``. + +\ **Note:** This is *not* the same as ``not is_valid()`` and using ``not is_null()`` will *not* guarantee that this callable can be called. Use :ref:`is_valid` instead. .. rst-class:: classref-item-separator diff --git a/classes/class_callbacktweener.rst b/classes/class_callbacktweener.rst index b78d9c67348..b65c79a4565 100644 --- a/classes/class_callbacktweener.rst +++ b/classes/class_callbacktweener.rst @@ -54,12 +54,12 @@ Method Descriptions Makes the callback call delayed by given time in seconds. -\ **Example:**\ +\ **Example:** Call :ref:`Node.queue_free` after 2 seconds: :: var tween = get_tree().create_tween() - tween.tween_callback(queue_free).set_delay(2) #this will call queue_free() after 2 seconds + tween.tween_callback(queue_free).set_delay(2) .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` diff --git a/classes/class_cameraattributes.rst b/classes/class_cameraattributes.rst index 2bbe852e8b0..386753ab34e 100644 --- a/classes/class_cameraattributes.rst +++ b/classes/class_cameraattributes.rst @@ -137,7 +137,11 @@ Multiplier for the exposure amount. A higher value results in a brighter image. - |void| **set_exposure_sensitivity**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_exposure_sensitivity**\ (\ ) -Sensitivity of camera sensors, measured in ISO. A higher sensitivity results in a brighter image. Only available when :ref:`ProjectSettings.rendering/lights_and_shadows/use_physical_light_units` is enabled. When :ref:`auto_exposure_enabled` this can be used as a method of exposure compensation, doubling the value will increase the exposure value (measured in EV100) by 1 stop. +Sensitivity of camera sensors, measured in ISO. A higher sensitivity results in a brighter image. + +If :ref:`auto_exposure_enabled` is ``true``, this can be used as a method of exposure compensation, doubling the value will increase the exposure value (measured in EV100) by 1 stop. + +\ **Note:** Only available when :ref:`ProjectSettings.rendering/lights_and_shadows/use_physical_light_units` is enabled. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` diff --git a/classes/class_cameraattributesphysical.rst b/classes/class_cameraattributesphysical.rst index 1399d5f135c..89be06443f1 100644 --- a/classes/class_cameraattributesphysical.rst +++ b/classes/class_cameraattributesphysical.rst @@ -109,7 +109,7 @@ The maximum luminance (in EV100) used when calculating auto exposure. When calcu - |void| **set_auto_exposure_min_exposure_value**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_auto_exposure_min_exposure_value**\ (\ ) -The minimum luminance luminance (in EV100) used when calculating auto exposure. When calculating scene average luminance, color values will be clamped to at least this value. This limits the auto-exposure from exposing above a certain brightness, resulting in a cut off point where the scene will remain dark. +The minimum luminance (in EV100) used when calculating auto exposure. When calculating scene average luminance, color values will be clamped to at least this value. This limits the auto-exposure from exposing above a certain brightness, resulting in a cut off point where the scene will remain dark. .. rst-class:: classref-item-separator diff --git a/classes/class_camerafeed.rst b/classes/class_camerafeed.rst index 5774048fbc9..c3bb9c13ffe 100644 --- a/classes/class_camerafeed.rst +++ b/classes/class_camerafeed.rst @@ -36,6 +36,8 @@ Properties +---------------------------------------+-----------------------------------------------------------------+------------------------------------+ | :ref:`Transform2D` | :ref:`feed_transform` | ``Transform2D(1, 0, 0, -1, 0, 1)`` | +---------------------------------------+-----------------------------------------------------------------+------------------------------------+ + | :ref:`Array` | :ref:`formats` | ``[]`` | + +---------------------------------------+-----------------------------------------------------------------+------------------------------------+ .. rst-class:: classref-reftable-group @@ -45,15 +47,58 @@ Methods .. table:: :widths: auto - +---------------------------------------------------+-------------------------------------------------------------------------+ - | :ref:`FeedDataType` | :ref:`get_datatype`\ (\ ) |const| | - +---------------------------------------------------+-------------------------------------------------------------------------+ - | :ref:`int` | :ref:`get_id`\ (\ ) |const| | - +---------------------------------------------------+-------------------------------------------------------------------------+ - | :ref:`String` | :ref:`get_name`\ (\ ) |const| | - +---------------------------------------------------+-------------------------------------------------------------------------+ - | :ref:`FeedPosition` | :ref:`get_position`\ (\ ) |const| | - +---------------------------------------------------+-------------------------------------------------------------------------+ + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`FeedDataType` | :ref:`get_datatype`\ (\ ) |const| | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`get_id`\ (\ ) |const| | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`String` | :ref:`get_name`\ (\ ) |const| | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`FeedPosition` | :ref:`get_position`\ (\ ) |const| | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`get_texture_tex_id`\ (\ feed_image_type\: :ref:`FeedImage`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_external`\ (\ width\: :ref:`int`, height\: :ref:`int`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`set_format`\ (\ index\: :ref:`int`, parameters\: :ref:`Dictionary`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_name`\ (\ name\: :ref:`String`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_position`\ (\ position\: :ref:`FeedPosition`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_rgb_image`\ (\ rgb_image\: :ref:`Image`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + | |void| | :ref:`set_ycbcr_image`\ (\ ycbcr_image\: :ref:`Image`\ ) | + +---------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+ + +.. rst-class:: classref-section-separator + +---- + +.. rst-class:: classref-descriptions-group + +Signals +------- + +.. _class_CameraFeed_signal_format_changed: + +.. rst-class:: classref-signal + +**format_changed**\ (\ ) :ref:`🔗` + +Emitted when the format has changed. + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_signal_frame_changed: + +.. rst-class:: classref-signal + +**frame_changed**\ (\ ) :ref:`🔗` + +Emitted when a new frame is available. .. rst-class:: classref-section-separator @@ -102,6 +147,14 @@ Feed supplies YCbCr images that need to be converted to RGB. Feed supplies separate Y and CbCr images that need to be combined and converted to RGB. +.. _class_CameraFeed_constant_FEED_EXTERNAL: + +.. rst-class:: classref-enumeration-constant + +:ref:`FeedDataType` **FEED_EXTERNAL** = ``4`` + +Feed supplies external image. + .. rst-class:: classref-item-separator ---- @@ -175,6 +228,22 @@ If ``true``, the feed is active. The transform applied to the camera's image. +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_property_formats: + +.. rst-class:: classref-property + +:ref:`Array` **formats** = ``[]`` :ref:`🔗` + +.. rst-class:: classref-property-setget + +- :ref:`Array` **get_formats**\ (\ ) + +Formats supported by the feed. Each entry is a :ref:`Dictionary` describing format parameters. + .. rst-class:: classref-section-separator ---- @@ -228,6 +297,96 @@ Returns the camera's name. Returns the position of camera on the device. +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_get_texture_tex_id: + +.. rst-class:: classref-method + +:ref:`int` **get_texture_tex_id**\ (\ feed_image_type\: :ref:`FeedImage`\ ) :ref:`🔗` + +Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data). + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_set_external: + +.. rst-class:: classref-method + +|void| **set_external**\ (\ width\: :ref:`int`, height\: :ref:`int`\ ) :ref:`🔗` + +Sets the feed as external feed provided by another library. + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_set_format: + +.. rst-class:: classref-method + +:ref:`bool` **set_format**\ (\ index\: :ref:`int`, parameters\: :ref:`Dictionary`\ ) :ref:`🔗` + +Sets the feed format parameters for the given index in the :ref:`formats` array. Returns ``true`` on success. By default YUYV encoded stream is transformed to FEED_RGB. YUYV encoded stream output format can be changed with ``parameters``.output value: + +\ ``separate`` will result in FEED_YCBCR_SEP + +\ ``grayscale`` will result in desaturated FEED_RGB + +\ ``copy`` will result in FEED_YCBCR + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_set_name: + +.. rst-class:: classref-method + +|void| **set_name**\ (\ name\: :ref:`String`\ ) :ref:`🔗` + +Sets the camera's name. + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_set_position: + +.. rst-class:: classref-method + +|void| **set_position**\ (\ position\: :ref:`FeedPosition`\ ) :ref:`🔗` + +Sets the position of this camera. + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_set_rgb_image: + +.. rst-class:: classref-method + +|void| **set_rgb_image**\ (\ rgb_image\: :ref:`Image`\ ) :ref:`🔗` + +Sets RGB image for this feed. + +.. rst-class:: classref-item-separator + +---- + +.. _class_CameraFeed_method_set_ycbcr_image: + +.. rst-class:: classref-method + +|void| **set_ycbcr_image**\ (\ ycbcr_image\: :ref:`Image`\ ) :ref:`🔗` + +Sets YCbCr image for this feed. + .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` diff --git a/classes/class_cameraserver.rst b/classes/class_cameraserver.rst index 9d3800bbf74..e662f71daac 100644 --- a/classes/class_cameraserver.rst +++ b/classes/class_cameraserver.rst @@ -23,7 +23,7 @@ The **CameraServer** keeps track of different cameras accessible in Godot. These It is notably used to provide AR modules with a video feed from the camera. -\ **Note:** This class is currently only implemented on macOS and iOS. To get a :ref:`CameraFeed` on iOS, the camera plugin from `godot-ios-plugins `__ is required. On other platforms, no :ref:`CameraFeed`\ s will be available. +\ **Note:** This class is currently only implemented on Linux, macOS, and iOS, on other platforms no :ref:`CameraFeed`\ s will be available. To get a :ref:`CameraFeed` on iOS, the camera plugin from `godot-ios-plugins `__ is required. .. rst-class:: classref-reftable-group diff --git a/classes/class_canvasitem.rst b/classes/class_canvasitem.rst index d5412e78e24..64e59fcab6b 100644 --- a/classes/class_canvasitem.rst +++ b/classes/class_canvasitem.rst @@ -191,7 +191,7 @@ Methods +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_visible_in_tree`\ (\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`Vector2` | :ref:`make_canvas_position_local`\ (\ screen_point\: :ref:`Vector2`\ ) |const| | + | :ref:`Vector2` | :ref:`make_canvas_position_local`\ (\ viewport_point\: :ref:`Vector2`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`InputEvent` | :ref:`make_input_local`\ (\ event\: :ref:`InputEvent`\ ) |const| | +---------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -237,7 +237,7 @@ Emitted when the **CanvasItem** must redraw, *after* the related :ref:`NOTIFICAT **hidden**\ (\ ) :ref:`🔗` -Emitted when becoming hidden. +Emitted when the **CanvasItem** is hidden, i.e. it's no longer visible in the tree (see :ref:`is_visible_in_tree`). .. rst-class:: classref-item-separator @@ -249,7 +249,7 @@ Emitted when becoming hidden. **item_rect_changed**\ (\ ) :ref:`🔗` -Emitted when the item's :ref:`Rect2` boundaries (position or size) have changed, or when an action is taking place that may have impacted these boundaries (e.g. changing :ref:`Sprite2D.texture`). +Emitted when the **CanvasItem**'s boundaries (position or size) change, or when an action took place that may have affected these boundaries (e.g. changing :ref:`Sprite2D.texture`). .. rst-class:: classref-item-separator @@ -261,7 +261,7 @@ Emitted when the item's :ref:`Rect2` boundaries (position or size) **visibility_changed**\ (\ ) :ref:`🔗` -Emitted when the visibility (hidden/visible) changes. +Emitted when the **CanvasItem**'s visibility changes, either because its own :ref:`visible` property changed or because its visibility in the tree changed (see :ref:`is_visible_in_tree`). .. rst-class:: classref-section-separator @@ -529,6 +529,8 @@ Property Descriptions Allows the current node to clip child nodes, essentially acting as a mask. +\ **Note:** Clipping nodes cannot be nested or placed within :ref:`CanvasGroup`\ s. If an ancestor of this node clips its children or is a :ref:`CanvasGroup`, then this node's clip mode should be set to :ref:`CLIP_CHILDREN_DISABLED` to avoid unexpected behavior. + .. rst-class:: classref-item-separator ---- @@ -716,7 +718,7 @@ The rendering layer in which this **CanvasItem** is rendered by :ref:`Viewport`\ ) - :ref:`bool` **is_visible**\ (\ ) -If ``true``, this **CanvasItem** is drawn. The node is only visible if all of its ancestors are visible as well (in other words, :ref:`is_visible_in_tree` must return ``true``). +If ``true``, this **CanvasItem** may be drawn. Whether this **CanvasItem** is actually drawn depends on the visibility of all of its **CanvasItem** ancestors. In other words: this **CanvasItem** will be drawn when :ref:`is_visible_in_tree` returns ``true`` and all **CanvasItem** ancestors share at least one :ref:`visibility_layer` with this **CanvasItem**. \ **Note:** For controls that inherit :ref:`Popup`, the correct way to make them visible is to call one of the multiple ``popup*()`` functions instead. @@ -737,7 +739,7 @@ If ``true``, this **CanvasItem** is drawn. The node is only visible if all of it If ``true``, this and child **CanvasItem** nodes with a higher Y position are rendered in front of nodes with a lower Y position. If ``false``, this and child **CanvasItem** nodes are rendered normally in scene tree order. -With Y-sorting enabled on a parent node ('A') but disabled on a child node ('B'), the child node ('B') is sorted but its children ('C1', 'C2', etc) render together on the same Y position as the child node ('B'). This allows you to organize the render order of a scene without changing the scene tree. +With Y-sorting enabled on a parent node ('A') but disabled on a child node ('B'), the child node ('B') is sorted but its children ('C1', 'C2', etc.) render together on the same Y position as the child node ('B'). This allows you to organize the render order of a scene without changing the scene tree. Nodes sort relative to each other only if they are on the same :ref:`z_index`. @@ -880,6 +882,8 @@ If ``antialiased`` is ``true``, half transparent "feathers" will be attached to Draws a colored polygon of any number of points, convex or concave. Unlike :ref:`draw_polygon`, a single color must be specified for the whole polygon. +\ **Note:** If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with :ref:`Geometry2D.triangulate_polygon` and using :ref:`draw_mesh`, :ref:`draw_multimesh`, or :ref:`RenderingServer.canvas_item_add_triangle_array`. + .. rst-class:: classref-item-separator ---- @@ -1053,6 +1057,8 @@ Draws a :ref:`MultiMesh` in 2D with the provided texture. See : Draws a solid polygon of any number of points, convex or concave. Unlike :ref:`draw_colored_polygon`, each point's color can be changed individually. See also :ref:`draw_polyline` and :ref:`draw_polyline_colors`. If you need more flexibility (such as being able to use bones), use :ref:`RenderingServer.canvas_item_add_triangle_array` instead. +\ **Note:** If you frequently redraw the same polygon with a large number of vertices, consider pre-calculating the triangulation with :ref:`Geometry2D.triangulate_polygon` and using :ref:`draw_mesh`, :ref:`draw_multimesh`, or :ref:`RenderingServer.canvas_item_add_triangle_array`. + .. rst-class:: classref-item-separator ---- @@ -1151,7 +1157,7 @@ Sets a custom transform for drawing via matrix. Anything drawn afterwards will b Draws ``text`` using the specified ``font`` at the ``pos`` (bottom-left corner using the baseline of the font). The text will have its color multiplied by ``modulate``. If ``width`` is greater than or equal to 0, the text will be clipped if it exceeds the specified width. -\ **Example using the default project font:**\ +\ **Example:** Draw "Hello world", using the project's default font: .. tabs:: @@ -1472,6 +1478,8 @@ Returns ``true`` if the node is present in the :ref:`SceneTree` Visibility is checked only in parent nodes that inherit from **CanvasItem**, :ref:`CanvasLayer`, and :ref:`Window`. If the parent is of any other type (such as :ref:`Node`, :ref:`AnimationPlayer`, or :ref:`Node3D`), it is assumed to be visible. +\ **Note:** This method does not take :ref:`visibility_layer` into account, so even if this method returns ``true`` the node might end up not being rendered. + .. rst-class:: classref-item-separator ---- @@ -1480,9 +1488,15 @@ Visibility is checked only in parent nodes that inherit from **CanvasItem**, :re .. rst-class:: classref-method -:ref:`Vector2` **make_canvas_position_local**\ (\ screen_point\: :ref:`Vector2`\ ) |const| :ref:`🔗` +:ref:`Vector2` **make_canvas_position_local**\ (\ viewport_point\: :ref:`Vector2`\ ) |const| :ref:`🔗` + +Transforms ``viewport_point`` from the viewport's coordinates to this node's local coordinates. + +For the opposite operation, use :ref:`get_global_transform_with_canvas`. + +:: -Assigns ``screen_point`` as this node's new local transform. + var viewport_point = get_global_transform_with_canvas() * local_point .. rst-class:: classref-item-separator diff --git a/classes/class_canvasmodulate.rst b/classes/class_canvasmodulate.rst index a90a5687fcf..42a739cb129 100644 --- a/classes/class_canvasmodulate.rst +++ b/classes/class_canvasmodulate.rst @@ -24,6 +24,13 @@ Description **CanvasModulate** applies a color tint to all nodes on a canvas. Only one can be used to tint a canvas, but :ref:`CanvasLayer`\ s can be used to render things independently. +.. rst-class:: classref-introduction-group + +Tutorials +--------- + +- :doc:`2D lights and shadows <../tutorials/2d/2d_lights_and_shadows>` + .. rst-class:: classref-reftable-group Properties diff --git a/classes/class_characterbody2d.rst b/classes/class_characterbody2d.rst index ea56c53059b..078c9009f22 100644 --- a/classes/class_characterbody2d.rst +++ b/classes/class_characterbody2d.rst @@ -574,7 +574,7 @@ Returns the current real velocity since the last call to :ref:`move_and_slide`, which contains information about a collision that occurred during the last call to :ref:`move_and_slide`. Since the body can collide several times in a single call to :ref:`move_and_slide`, you must specify the index of the collision in the range 0 to (:ref:`get_slide_collision_count` - 1). -\ **Example usage:**\ +\ **Example:** Iterate through the collisions with a ``for`` loop: .. tabs:: diff --git a/classes/class_charfxtransform.rst b/classes/class_charfxtransform.rst index 25c6eebf6fd..fc3d18859e5 100644 --- a/classes/class_charfxtransform.rst +++ b/classes/class_charfxtransform.rst @@ -28,8 +28,6 @@ Tutorials - :doc:`BBCode in RichTextLabel <../tutorials/ui/bbcode_in_richtextlabel>` -- `RichTextEffect test project (third-party) `__ - .. rst-class:: classref-reftable-group Properties diff --git a/classes/class_classdb.rst b/classes/class_classdb.rst index 9c5b481cd22..14724e0be5c 100644 --- a/classes/class_classdb.rst +++ b/classes/class_classdb.rst @@ -32,8 +32,12 @@ Methods +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`can_instantiate`\ (\ class\: :ref:`StringName`\ ) |const| | +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`Variant` | :ref:`class_call_static`\ (\ class\: :ref:`StringName`, method\: :ref:`StringName`, ...\ ) |vararg| | + +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`class_exists`\ (\ class\: :ref:`StringName`\ ) |const| | +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`APIType` | :ref:`class_get_api_type`\ (\ class\: :ref:`StringName`\ ) |const| | + +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`class_get_enum_constants`\ (\ class\: :ref:`StringName`, enum\: :ref:`StringName`, no_inheritance\: :ref:`bool` = false\ ) |const| | +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedStringArray` | :ref:`class_get_enum_list`\ (\ class\: :ref:`StringName`, no_inheritance\: :ref:`bool` = false\ ) |const| | @@ -52,8 +56,12 @@ Methods +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`class_get_property_default_value`\ (\ class\: :ref:`StringName`, property\: :ref:`StringName`\ ) |const| | +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`StringName` | :ref:`class_get_property_getter`\ (\ class\: :ref:`StringName`, property\: :ref:`StringName`\ ) | + +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`Dictionary`\] | :ref:`class_get_property_list`\ (\ class\: :ref:`StringName`, no_inheritance\: :ref:`bool` = false\ ) |const| | +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`StringName` | :ref:`class_get_property_setter`\ (\ class\: :ref:`StringName`, property\: :ref:`StringName`\ ) | + +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Dictionary` | :ref:`class_get_signal`\ (\ class\: :ref:`StringName`, signal\: :ref:`StringName`\ ) |const| | +------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array`\[:ref:`Dictionary`\] | :ref:`class_get_signal_list`\ (\ class\: :ref:`StringName`, no_inheritance\: :ref:`bool` = false\ ) |const| | @@ -89,6 +97,61 @@ Methods .. rst-class:: classref-descriptions-group +Enumerations +------------ + +.. _enum_ClassDB_APIType: + +.. rst-class:: classref-enumeration + +enum **APIType**: :ref:`🔗` + +.. _class_ClassDB_constant_API_CORE: + +.. rst-class:: classref-enumeration-constant + +:ref:`APIType` **API_CORE** = ``0`` + +Native Core class type. + +.. _class_ClassDB_constant_API_EDITOR: + +.. rst-class:: classref-enumeration-constant + +:ref:`APIType` **API_EDITOR** = ``1`` + +Native Editor class type. + +.. _class_ClassDB_constant_API_EXTENSION: + +.. rst-class:: classref-enumeration-constant + +:ref:`APIType` **API_EXTENSION** = ``2`` + +GDExtension class type. + +.. _class_ClassDB_constant_API_EDITOR_EXTENSION: + +.. rst-class:: classref-enumeration-constant + +:ref:`APIType` **API_EDITOR_EXTENSION** = ``3`` + +GDExtension Editor class type. + +.. _class_ClassDB_constant_API_NONE: + +.. rst-class:: classref-enumeration-constant + +:ref:`APIType` **API_NONE** = ``4`` + +Unknown class type. + +.. rst-class:: classref-section-separator + +---- + +.. rst-class:: classref-descriptions-group + Method Descriptions ------------------- @@ -104,6 +167,18 @@ Returns ``true`` if objects can be instantiated from the specified ``class``, ot ---- +.. _class_ClassDB_method_class_call_static: + +.. rst-class:: classref-method + +:ref:`Variant` **class_call_static**\ (\ class\: :ref:`StringName`, method\: :ref:`StringName`, ...\ ) |vararg| :ref:`🔗` + +Calls a static method on a class. + +.. rst-class:: classref-item-separator + +---- + .. _class_ClassDB_method_class_exists: .. rst-class:: classref-method @@ -116,6 +191,18 @@ Returns whether the specified ``class`` is available or not. ---- +.. _class_ClassDB_method_class_get_api_type: + +.. rst-class:: classref-method + +:ref:`APIType` **class_get_api_type**\ (\ class\: :ref:`StringName`\ ) |const| :ref:`🔗` + +Returns the API type of ``class``. See :ref:`APIType`. + +.. rst-class:: classref-item-separator + +---- + .. _class_ClassDB_method_class_get_enum_constants: .. rst-class:: classref-method @@ -226,6 +313,18 @@ Returns the default value of ``property`` of ``class`` or its ancestor classes. ---- +.. _class_ClassDB_method_class_get_property_getter: + +.. rst-class:: classref-method + +:ref:`StringName` **class_get_property_getter**\ (\ class\: :ref:`StringName`, property\: :ref:`StringName`\ ) :ref:`🔗` + +Returns the getter method name of ``property`` of ``class``. + +.. rst-class:: classref-item-separator + +---- + .. _class_ClassDB_method_class_get_property_list: .. rst-class:: classref-method @@ -238,6 +337,18 @@ Returns an array with all the properties of ``class`` or its ancestry if ``no_in ---- +.. _class_ClassDB_method_class_get_property_setter: + +.. rst-class:: classref-method + +:ref:`StringName` **class_get_property_setter**\ (\ class\: :ref:`StringName`, property\: :ref:`StringName`\ ) :ref:`🔗` + +Returns the setter method name of ``property`` of ``class``. + +.. rst-class:: classref-item-separator + +---- + .. _class_ClassDB_method_class_get_signal: .. rst-class:: classref-method diff --git a/classes/class_codeedit.rst b/classes/class_codeedit.rst index 5cfb6a2dc7a..53aea592f48 100644 --- a/classes/class_codeedit.rst +++ b/classes/class_codeedit.rst @@ -280,6 +280,8 @@ Theme Properties +-----------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`can_fold_code_region` | | +-----------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ + | :ref:`Texture2D` | :ref:`completion_color_bg` | | + +-----------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`executing_line` | | +-----------------------------------+----------------------------------------------------------------------------------------------------+-----------------------------------+ | :ref:`Texture2D` | :ref:`folded` | | @@ -1978,6 +1980,18 @@ Sets a custom :ref:`Texture2D` to draw in the line folding gutt ---- +.. _class_CodeEdit_theme_icon_completion_color_bg: + +.. rst-class:: classref-themeproperty + +:ref:`Texture2D` **completion_color_bg** :ref:`🔗` + +Background panel for the color preview box in autocompletion (visible when the color is translucent). + +.. rst-class:: classref-item-separator + +---- + .. _class_CodeEdit_theme_icon_executing_line: .. rst-class:: classref-themeproperty diff --git a/classes/class_color.rst b/classes/class_color.rst index f91df07a16d..8c5b5ffbf9f 100644 --- a/classes/class_color.rst +++ b/classes/class_color.rst @@ -48,29 +48,35 @@ Properties .. table:: :widths: auto - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`a` | ``1.0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`int` | :ref:`a8` | ``255`` | - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`b` | ``0.0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`int` | :ref:`b8` | ``0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`g` | ``0.0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`int` | :ref:`g8` | ``0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`h` | ``0.0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`r` | ``0.0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`int` | :ref:`r8` | ``0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`s` | ``0.0`` | - +---------------------------+------------------------------------+---------+ - | :ref:`float` | :ref:`v` | ``0.0`` | - +---------------------------+------------------------------------+---------+ + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`a` | ``1.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`int` | :ref:`a8` | ``255`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`b` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`int` | :ref:`b8` | ``0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`g` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`int` | :ref:`g8` | ``0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`h` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`ok_hsl_h` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`ok_hsl_l` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`ok_hsl_s` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`r` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`int` | :ref:`r8` | ``0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`s` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ + | :ref:`float` | :ref:`v` | ``0.0`` | + +---------------------------+------------------------------------------------+---------+ .. rst-class:: classref-reftable-group @@ -1462,6 +1468,42 @@ The HSV hue of this color, on the range 0 to 1. ---- +.. _class_Color_property_ok_hsl_h: + +.. rst-class:: classref-property + +:ref:`float` **ok_hsl_h** = ``0.0`` :ref:`🔗` + +The OKHSL hue of this color, on the range 0 to 1. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Color_property_ok_hsl_l: + +.. rst-class:: classref-property + +:ref:`float` **ok_hsl_l** = ``0.0`` :ref:`🔗` + +The OKHSL lightness of this color, on the range 0 to 1. + +.. rst-class:: classref-item-separator + +---- + +.. _class_Color_property_ok_hsl_s: + +.. rst-class:: classref-property + +:ref:`float` **ok_hsl_s** = ``0.0`` :ref:`🔗` + +The OKHSL saturation of this color, on the range 0 to 1. + +.. rst-class:: classref-item-separator + +---- + .. _class_Color_property_r: .. rst-class:: classref-property @@ -1523,7 +1565,7 @@ Constructor Descriptions Constructs a default **Color** from opaque black. This is the same as :ref:`BLACK`. -\ **Note:** in C#, constructs an empty color with all of its components set to ``0.0`` (transparent black). +\ **Note:** In C#, this constructs a **Color** with all of its components set to ``0.0`` (transparent black). .. rst-class:: classref-item-separator @@ -1771,6 +1813,8 @@ Decodes a **Color** from an RGBE9995 format integer. See :ref:`Image.FORMAT_RGBE Creates a **Color** from the given string, which can be either an HTML color code or a named color (case-insensitive). Returns ``default`` if the color cannot be inferred from the string. +If you want to create a color from String in a constant expression, use the equivalent constructor instead (i.e. ``Color("color string")``). + .. rst-class:: classref-item-separator ---- @@ -1816,6 +1860,8 @@ In GDScript and C#, the :ref:`int` is best visualized with hexadecima +If you want to use hex notation in a constant expression, use the equivalent constructor instead (i.e. ``Color(0xRRGGBBAA)``). + .. rst-class:: classref-item-separator ---- diff --git a/classes/class_compositor.rst b/classes/class_compositor.rst index ec0e40c519f..31533f286bf 100644 --- a/classes/class_compositor.rst +++ b/classes/class_compositor.rst @@ -23,6 +23,13 @@ Description The compositor resource stores attributes used to customize how a :ref:`Viewport` is rendered. +.. rst-class:: classref-introduction-group + +Tutorials +--------- + +- :doc:`The Compositor <../tutorials/rendering/compositor>` + .. rst-class:: classref-reftable-group Properties diff --git a/classes/class_compositoreffect.rst b/classes/class_compositoreffect.rst index fc44b84775d..e1a8d1dc7d1 100644 --- a/classes/class_compositoreffect.rst +++ b/classes/class_compositoreffect.rst @@ -21,7 +21,14 @@ This resource allows for creating a custom rendering effect. Description ----------- -This resource defines a custom rendering effect that can be applied to :ref:`Viewport`\ s through the viewports' :ref:`Environment`. You can implement a callback that is called during rendering at a given stage of the rendering pipeline and allows you to insert additional passes. Note that this callback happens on the rendering thread. +This resource defines a custom rendering effect that can be applied to :ref:`Viewport`\ s through the viewports' :ref:`Environment`. You can implement a callback that is called during rendering at a given stage of the rendering pipeline and allows you to insert additional passes. Note that this callback happens on the rendering thread. CompositorEffect is an abstract base class and must be extended to implement specific rendering logic. + +.. rst-class:: classref-introduction-group + +Tutorials +--------- + +- :doc:`The Compositor <../tutorials/rendering/compositor>` .. rst-class:: classref-reftable-group @@ -112,7 +119,7 @@ The callback is called before our transparent rendering pass, but after our sky :ref:`EffectCallbackType` **EFFECT_CALLBACK_TYPE_POST_TRANSPARENT** = ``4`` -The callback is called after our transparent rendering pass, but before any build in post effects and output to our render target. +The callback is called after our transparent rendering pass, but before any built-in post-processing effects and output to our render target. .. _class_CompositorEffect_constant_EFFECT_CALLBACK_TYPE_MAX: @@ -257,6 +264,19 @@ If ``true`` this triggers normal and roughness data to be output during our dept var render_scene_buffers : RenderSceneBuffersRD = render_data.get_render_scene_buffers() var roughness_buffer = render_scene_buffers.get_texture("forward_clustered", "normal_roughness") +The raw normal and roughness buffer is stored in an optimized format, different than the one available in Spatial shaders. When sampling the buffer, a conversion function must be applied. Use this function, copied from `here `__: + +:: + + vec4 normal_roughness_compatibility(vec4 p_normal_roughness) { + float roughness = p_normal_roughness.w; + if (roughness > 0.5) { + roughness = 1.0 - roughness; + } + roughness /= (127.0 / 255.0); + return vec4(normalize(p_normal_roughness.xyz * 2.0 - 1.0) * 0.5 + 0.5, roughness); + } + .. rst-class:: classref-item-separator ---- diff --git a/classes/class_control.rst b/classes/class_control.rst index c6177e1a018..52429b732b9 100644 --- a/classes/class_control.rst +++ b/classes/class_control.rst @@ -143,6 +143,8 @@ Properties +---------------------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+ | :ref:`StringName` | :ref:`theme_type_variation` | ``&""`` | +---------------------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+ + | :ref:`AutoTranslateMode` | :ref:`tooltip_auto_translate_mode` | ``0`` | + +---------------------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+ | :ref:`String` | :ref:`tooltip_text` | ``""`` | +---------------------------------------------------------------------+----------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+ @@ -894,7 +896,7 @@ enum **MouseFilter**: :ref:`🔗` :ref:`MouseFilter` **MOUSE_FILTER_STOP** = ``0`` -The control will receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input`. And the control will receive the :ref:`mouse_entered` and :ref:`mouse_exited` signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls. +The control will receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input`. The control will also receive the :ref:`mouse_entered` and :ref:`mouse_exited` signals. These events are automatically marked as handled, and they will not propagate further to other controls. This also results in blocking signals in other controls. .. _class_Control_constant_MOUSE_FILTER_PASS: @@ -902,7 +904,9 @@ The control will receive mouse movement input events and mouse button input even :ref:`MouseFilter` **MOUSE_FILTER_PASS** = ``1`` -The control will receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input`. And the control will receive the :ref:`mouse_entered` and :ref:`mouse_exited` signals. If this control does not handle the event, the parent control (if any) will be considered, and so on until there is no more parent control to potentially handle it. This also allows signals to fire in other controls. If no control handled it, the event will be passed to :ref:`Node._shortcut_input` for further processing. +The control will receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input`. The control will also receive the :ref:`mouse_entered` and :ref:`mouse_exited` signals. + +If this control does not handle the event, the event will propagate up to its parent control if it has one. The event is bubbled up the node hierarchy until it reaches a non-:ref:`CanvasItem`, a control with :ref:`MOUSE_FILTER_STOP`, or a :ref:`CanvasItem` with :ref:`CanvasItem.top_level` enabled. This will allow signals to fire in all controls it reaches. If no control handled it, the event will be passed to :ref:`Node._shortcut_input` for further processing. .. _class_Control_constant_MOUSE_FILTER_IGNORE: @@ -910,7 +914,7 @@ The control will receive mouse movement input events and mouse button input even :ref:`MouseFilter` **MOUSE_FILTER_IGNORE** = ``2`` -The control will not receive mouse movement input events and mouse button input events if clicked on through :ref:`_gui_input`. The control will also not receive the :ref:`mouse_entered` nor :ref:`mouse_exited` signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically. +The control will not receive any mouse movement input events nor mouse button input events through :ref:`_gui_input`. The control will also not receive the :ref:`mouse_entered` nor :ref:`mouse_exited` signals. This will not block other controls from receiving these events or firing the signals. Ignored events will not be handled automatically. If a child has :ref:`MOUSE_FILTER_PASS` and an event was passed to this control, the event will further propagate up to the control's parent. \ **Note:** If the control has received :ref:`mouse_entered` but not :ref:`mouse_exited`, changing the :ref:`mouse_filter` to :ref:`MOUSE_FILTER_IGNORE` will cause :ref:`mouse_exited` to be emitted. @@ -992,11 +996,11 @@ enum **LayoutDirection**: :ref:`🔗` Automatic layout direction, determined from the parent control layout direction. -.. _class_Control_constant_LAYOUT_DIRECTION_LOCALE: +.. _class_Control_constant_LAYOUT_DIRECTION_APPLICATION_LOCALE: .. rst-class:: classref-enumeration-constant -:ref:`LayoutDirection` **LAYOUT_DIRECTION_LOCALE** = ``1`` +:ref:`LayoutDirection` **LAYOUT_DIRECTION_APPLICATION_LOCALE** = ``1`` Automatic layout direction, determined from the current locale. @@ -1016,6 +1020,32 @@ Left-to-right layout direction. Right-to-left layout direction. +.. _class_Control_constant_LAYOUT_DIRECTION_SYSTEM_LOCALE: + +.. rst-class:: classref-enumeration-constant + +:ref:`LayoutDirection` **LAYOUT_DIRECTION_SYSTEM_LOCALE** = ``4`` + +Automatic layout direction, determined from the system locale. + +.. _class_Control_constant_LAYOUT_DIRECTION_MAX: + +.. rst-class:: classref-enumeration-constant + +:ref:`LayoutDirection` **LAYOUT_DIRECTION_MAX** = ``5`` + +Represents the size of the :ref:`LayoutDirection` enum. + +.. _class_Control_constant_LAYOUT_DIRECTION_LOCALE: + +.. rst-class:: classref-enumeration-constant + +:ref:`LayoutDirection` **LAYOUT_DIRECTION_LOCALE** = ``1`` + +**Deprecated:** Use :ref:`LAYOUT_DIRECTION_APPLICATION_LOCALE` instead. + + + .. rst-class:: classref-item-separator ---- @@ -1581,10 +1611,12 @@ Controls whether the control will be able to receive mouse button input events t - |void| **set_force_pass_scroll_events**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_force_pass_scroll_events**\ (\ ) -When enabled, scroll wheel events processed by :ref:`_gui_input` will be passed to the parent control even if :ref:`mouse_filter` is set to :ref:`MOUSE_FILTER_STOP`. As it defaults to true, this allows nested scrollable containers to work out of the box. +When enabled, scroll wheel events processed by :ref:`_gui_input` will be passed to the parent control even if :ref:`mouse_filter` is set to :ref:`MOUSE_FILTER_STOP`. You should disable it on the root of your UI if you do not want scroll events to go to the :ref:`Node._unhandled_input` processing. +\ **Note:** Because this property defaults to ``true``, this allows nested scrollable containers to work out of the box. + .. rst-class:: classref-item-separator ---- @@ -1883,6 +1915,25 @@ When set, this property gives the highest priority to the type of the specified ---- +.. _class_Control_property_tooltip_auto_translate_mode: + +.. rst-class:: classref-property + +:ref:`AutoTranslateMode` **tooltip_auto_translate_mode** = ``0`` :ref:`🔗` + +.. rst-class:: classref-property-setget + +- |void| **set_tooltip_auto_translate_mode**\ (\ value\: :ref:`AutoTranslateMode`\ ) +- :ref:`AutoTranslateMode` **get_tooltip_auto_translate_mode**\ (\ ) + +Defines if tooltip text should automatically change to its translated version depending on the current locale. Uses the same auto translate mode as this control when set to :ref:`Node.AUTO_TRANSLATE_MODE_INHERIT`. + +\ **Note:** Tooltips customized using :ref:`_make_custom_tooltip` do not use this auto translate mode automatically. + +.. rst-class:: classref-item-separator + +---- + .. _class_Control_property_tooltip_text: .. rst-class:: classref-property @@ -1988,7 +2039,7 @@ Godot calls this method to pass you the ``data`` from a control's :ref:`_get_dra public override bool _CanDropData(Vector2 atPosition, Variant data) { - return data.VariantType == Variant.Type.Dictionary && dict.AsGodotDictionary().ContainsKey("color"); + return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().ContainsKey("color"); } public override void _DropData(Vector2 atPosition, Variant data) @@ -2073,9 +2124,9 @@ Virtual method to be implemented by the user. Returns the tooltip text for the p |void| **_gui_input**\ (\ event\: :ref:`InputEvent`\ ) |virtual| :ref:`🔗` -Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See :ref:`accept_event`. +Virtual method to be implemented by the user. Override this method to handle and accept inputs on UI elements. See also :ref:`accept_event`. -\ **Example usage for clicking a control:**\ +\ **Example:** Click on the control to print a message: .. tabs:: @@ -2102,19 +2153,19 @@ Virtual method to be implemented by the user. Use this method to process and acc -The event won't trigger if: +If the ``event`` inherits :ref:`InputEventMouse`, this method will **not** be called when: -\* clicking outside the control (see :ref:`_has_point`); +- the control's :ref:`mouse_filter` is set to :ref:`MOUSE_FILTER_IGNORE`; -\* control has :ref:`mouse_filter` set to :ref:`MOUSE_FILTER_IGNORE`; +- the control is obstructed by another control on top, that doesn't have :ref:`mouse_filter` set to :ref:`MOUSE_FILTER_IGNORE`; -\* control is obstructed by another **Control** on top of it, which doesn't have :ref:`mouse_filter` set to :ref:`MOUSE_FILTER_IGNORE`; +- the control's parent has :ref:`mouse_filter` set to :ref:`MOUSE_FILTER_STOP` or has accepted the event; -\* control's parent has :ref:`mouse_filter` set to :ref:`MOUSE_FILTER_STOP` or has accepted the event; +- the control's parent has :ref:`clip_contents` enabled and the ``event``'s position is outside the parent's rectangle; -\* it happens outside the parent's rectangle and the parent has either :ref:`clip_contents` enabled. +- the ``event``'s position is outside the control (see :ref:`_has_point`). -\ **Note:** Event position is relative to the control origin. +\ **Note:** The ``event``'s position is relative to this control's origin. .. rst-class:: classref-item-separator @@ -2150,9 +2201,9 @@ The returned node will be added as child to a :ref:`PopupPanel \ **Note:** The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its :ref:`custom_minimum_size` to some non-zero value. -\ **Note:** The node (and any relevant children) should be :ref:`CanvasItem.visible` when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably. +\ **Note:** The node (and any relevant children) should have their :ref:`CanvasItem.visible` set to ``true`` when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably. -\ **Example of usage with a custom-constructed node:**\ +\ **Example:** Use a constructed node as a tooltip: .. tabs:: @@ -2175,7 +2226,7 @@ The returned node will be added as child to a :ref:`PopupPanel -\ **Example of usage with a custom scene instance:**\ +\ **Example:** Usa a scene instance as a tooltip: .. tabs:: @@ -2240,7 +2291,7 @@ Creates a local override for a theme :ref:`Color` with the specifie See also :ref:`get_theme_color`. -\ **Example of overriding a label's color and resetting it later:**\ +\ **Example:** Override a :ref:`Label`'s color and reset it later: .. tabs:: @@ -2335,14 +2386,14 @@ Creates a local override for a theme :ref:`StyleBox` with the sp See also :ref:`get_theme_stylebox`. -\ **Example of modifying a property in a StyleBox by duplicating it:**\ +\ **Example:** Modify a property in a :ref:`StyleBox` by duplicating it: .. tabs:: .. code-tab:: gdscript - # The snippet below assumes the child node MyButton has a StyleBoxFlat assigned. + # The snippet below assumes the child node "MyButton" has a StyleBoxFlat assigned. # Resources are shared across instances, so we need to duplicate it # to avoid modifying the appearance of all other buttons. var new_stylebox_normal = $MyButton.get_theme_stylebox("normal").duplicate() @@ -2354,7 +2405,7 @@ See also :ref:`get_theme_stylebox`. .. code-tab:: csharp - // The snippet below assumes the child node MyButton has a StyleBoxFlat assigned. + // The snippet below assumes the child node "MyButton" has a StyleBoxFlat assigned. // Resources are shared across instances, so we need to duplicate it // to avoid modifying the appearance of all other buttons. StyleBoxFlat newStyleboxNormal = GetNode