From fc314262d1c22b04df16fcfec6d17116023d3a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 7 Feb 2023 17:52:34 +0100 Subject: [PATCH] classref: Sync with current master branch (929333fe2) --- classes/class_@gdscript.rst | 55 +- classes/class_@globalscope.rst | 11 +- classes/class_aescontext.rst | 33 +- classes/class_animation.rst | 28 + classes/class_animationnode.rst | 64 +- classes/class_animationnodeblendspace1d.rst | 80 ++- classes/class_animationnodestatemachine.rst | 34 + classes/class_animationnodetransition.rst | 82 +-- classes/class_animationplayer.rst | 21 + classes/class_animationtree.rst | 37 +- classes/class_area2d.rst | 74 +- classes/class_area3d.rst | 102 +-- classes/class_array.rst | 94 +-- classes/class_astar3d.rst | 11 +- classes/class_audioserver.rst | 64 +- classes/class_audiostreammp3.rst | 8 +- classes/class_audiostreamplayer.rst | 14 + classes/class_audiostreamplayer2d.rst | 14 + classes/class_audiostreamplayer3d.rst | 14 + classes/class_callable.rst | 4 +- classes/class_camera2d.rst | 68 +- classes/class_canvasgroup.rst | 1 + classes/class_color.rst | 14 +- classes/class_control.rst | 61 +- classes/class_crypto.rst | 30 +- classes/class_decal.rst | 40 +- classes/class_dictionary.rst | 8 +- classes/class_diraccess.rst | 4 +- classes/class_displayserver.rst | 658 +++++++++--------- classes/class_dtlsserver.rst | 81 +-- classes/class_editorimportplugin.rst | 108 +-- classes/class_editorinspectorplugin.rst | 40 +- classes/class_editorplugin.rst | 37 +- classes/class_editorscenepostimport.rst | 7 +- classes/class_editorscript.rst | 3 +- classes/class_editorsettings.rst | 18 +- .../class_editortranslationparserplugin.rst | 27 +- classes/class_enetconnection.rst | 12 +- classes/class_expression.rst | 10 +- classes/class_fileaccess.rst | 4 +- classes/class_fogvolume.rst | 46 +- classes/class_fontfile.rst | 44 +- classes/class_fontvariation.rst | 10 +- classes/class_geometry2d.rst | 7 +- classes/class_gltfdocument.rst | 36 +- classes/class_gltfdocumentextension.rst | 32 +- classes/class_gltfstate.rst | 12 +- classes/class_gpuparticlesattractorbox3d.rst | 16 +- ...ass_gpuparticlesattractorvectorfield3d.rst | 14 +- classes/class_gpuparticlescollisionbox3d.rst | 16 +- ...ass_gpuparticlescollisionheightfield3d.rst | 38 +- classes/class_gpuparticlescollisionsdf3d.rst | 40 +- classes/class_graphedit.rst | 5 +- classes/class_hashingcontext.rst | 27 +- classes/class_hmaccontext.rst | 19 +- classes/class_httpclient.rst | 23 +- classes/class_httprequest.rst | 68 +- classes/class_image.rst | 270 ++++--- classes/class_inputeventmidi.rst | 20 +- classes/class_label3d.rst | 65 ++ classes/class_mainloop.rst | 15 +- classes/class_multiplayerapiextension.rst | 16 +- classes/class_mutex.rst | 18 +- classes/class_navigationagent2d.rst | 145 +++- classes/class_navigationagent3d.rst | 134 +++- classes/class_navigationserver2d.rst | 20 +- classes/class_navigationserver3d.rst | 8 +- classes/class_node.rst | 4 +- classes/class_noise.rst | 38 +- classes/class_noisetexture2d.rst | 21 + classes/class_object.rst | 22 +- classes/class_omnilight3d.rst | 2 + classes/class_openxrinterface.rst | 48 +- classes/class_os.rst | 6 +- classes/class_packedscene.rst | 4 +- classes/class_packetpeerdtls.rst | 22 +- .../class_physicspointqueryparameters2d.rst | 2 + classes/class_physicsserver2d.rst | 24 +- classes/class_physicsserver3d.rst | 32 +- classes/class_primitivemesh.rst | 4 +- classes/class_projectsettings.rst | 240 +++++-- classes/class_refcounted.rst | 2 +- classes/class_reflectionprobe.rst | 58 +- classes/class_renderingdevice.rst | 75 +- classes/class_renderingserver.rst | 258 +++---- classes/class_resource.rst | 2 +- classes/class_resourceformatloader.rst | 4 +- classes/class_resourceformatsaver.rst | 4 +- classes/class_richtexteffect.rst | 2 +- classes/class_richtextlabel.rst | 93 +++ classes/class_scenetree.rst | 4 +- classes/class_scenetreetimer.rst | 4 +- classes/class_semaphore.rst | 18 +- classes/class_signal.rst | 8 +- classes/class_spotlight3d.rst | 2 + classes/class_sprite2d.rst | 6 +- classes/class_spritebase3d.rst | 150 +++- classes/class_streampeer.rst | 2 +- classes/class_streampeertls.rst | 72 +- classes/class_string.rst | 2 +- classes/class_subviewport.rst | 2 + classes/class_subviewportcontainer.rst | 2 + classes/class_tiledata.rst | 10 +- classes/class_tilemap.rst | 8 +- classes/class_tileset.rst | 28 + classes/class_tlsoptions.rst | 112 +++ classes/class_tree.rst | 12 - classes/class_tween.rst | 8 +- classes/class_udpserver.rst | 54 +- classes/class_undoredo.rst | 16 +- classes/class_variant.rst | 35 +- classes/class_videostream.rst | 65 ++ classes/class_videostreamplayback.rst | 240 +++++++ classes/class_videostreamtheora.rst | 43 -- classes/class_viewport.rst | 21 + classes/class_visualshadernodecustom.rst | 68 +- classes/class_voxelgi.rst | 14 +- classes/class_voxelgidata.rst | 4 +- classes/class_websocketmultiplayerpeer.rst | 30 +- classes/class_websocketpeer.rst | 70 +- classes/class_window.rst | 14 + classes/class_xrinterface.rst | 80 +++ classes/class_xrinterfaceextension.rst | 148 ++-- classes/index.rst | 2 + 124 files changed, 3532 insertions(+), 2028 deletions(-) create mode 100644 classes/class_tlsoptions.rst create mode 100644 classes/class_videostreamplayback.rst diff --git a/classes/class_@gdscript.rst b/classes/class_@gdscript.rst index 7a8b4344e..9e650387e 100644 --- a/classes/class_@gdscript.rst +++ b/classes/class_@gdscript.rst @@ -63,8 +63,6 @@ Methods +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`range` **(** ... **)** |vararg| | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`String` | :ref:`str` **(** ... **)** |vararg| | - +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`type_exists` **(** :ref:`StringName` type **)** | +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -201,15 +199,28 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_DIR` names, ... **)** |vararg| -Export a :ref:`String` or integer property as an enumerated list of options. If the property is an integer field, then the index of the value is stored, in the same order the values are provided. You can add specific identifiers for allowed values using a colon. +Export an :ref:`int` or :ref:`String` property as an enumerated list of options. If the property is an :ref:`int`, then the index of the value is stored, in the same order the values are provided. You can add specific identifiers for allowed values using a colon. If the property is a :ref:`String`, then the value is stored. See also :ref:`@GlobalScope.PROPERTY_HINT_ENUM`. :: - @export_enum("Rebecca", "Mary", "Leah") var character_name: String @export_enum("Warrior", "Magician", "Thief") var character_class: int @export_enum("Slow:30", "Average:60", "Very Fast:200") var character_speed: int + @export_enum("Rebecca", "Mary", "Leah") var character_name: String + +If you want to set an initial value, you must specify it explicitly: + +:: + + @export_enum("Rebecca", "Mary", "Leah") var character_name: String = "Rebecca" + +If you want to use named GDScript enums, then use :ref:`@export` instead: + +:: + + enum CharacterName {REBECCA, MARY, LEAH} + @export var character_name: CharacterName .. rst-class:: classref-item-separator @@ -512,7 +523,7 @@ See also :ref:`@GlobalScope.PROPERTY_HINT_PLACEHOLDER_TEXT` min, :ref:`float` max, :ref:`float` step=1.0, :ref:`String` extra_hints="", ... **)** |vararg| -Export a numeric property as a range value. The range must be defined by ``min`` and ``max``, as well as an optional ``step`` and a variety of extra hints. The ``step`` defaults to ``1`` for integer properties. For floating-point numbers this value depends on your ``EditorSettings.interface/inspector/default_float_step`` setting. +Export an :ref:`int` or :ref:`float` property as a range value. The range must be defined by ``min`` and ``max``, as well as an optional ``step`` and a variety of extra hints. The ``step`` defaults to ``1`` for integer properties. For floating-point numbers this value depends on your ``EditorSettings.interface/inspector/default_float_step`` setting. If hints ``"or_greater"`` and ``"or_less"`` are provided, the editor widget will not cap the value at range boundaries. The ``"exp"`` hint will make the edited values on range to change exponentially. The ``"hide_slider"`` hint will hide the slider element of the editor widget. @@ -579,6 +590,8 @@ Add a custom icon to the current script. The script must be registered as a glob \ **Note:** As annotations describe their subject, the ``@icon`` annotation must be placed before the class definition and inheritance. +\ **Note:** Unlike other annotations, the argument of the ``@icon`` annotation must be a string literal (constant expressions are not supported). + .. rst-class:: classref-item-separator ---- @@ -603,13 +616,22 @@ Mark the following property as assigned on :ref:`Node`'s ready state .. rst-class:: classref-annotation -**@rpc** **(** :ref:`String` mode="", :ref:`String` sync="", :ref:`String` transfer_mode="", :ref:`int` transfer_channel=0, ... **)** |vararg| +**@rpc** **(** :ref:`String` mode="authority", :ref:`String` sync="call_remote", :ref:`String` transfer_mode="unreliable", :ref:`int` transfer_channel=0, ... **)** |vararg| Mark the following method for remote procedure calls. See :doc:`High-level multiplayer <../tutorials/networking/high_level_multiplayer>`. +The order of ``mode``, ``sync`` and ``transfer_mode`` does not matter and all arguments can be omitted, but ``transfer_channel`` always has to be the last argument. The accepted values for ``mode`` are ``"any_peer"`` or ``"authority"``, for ``sync`` are ``"call_remote"`` or ``"call_local"`` and for ``transfer_mode`` are ``"unreliable"``, ``"unreliable_ordered"`` or ``"reliable"``. + :: - @rpc() + @rpc + func fn(): pass + + @rpc("any_peer", "unreliable_ordered") + func fn_update_pos(): pass + + @rpc("authority", "call_remote", "unreliable", 0) # Equivalent to @rpc + func fn_default(): pass .. rst-class:: classref-item-separator @@ -984,25 +1006,6 @@ Output: ---- -.. _class_@GDScript_method_str: - -.. rst-class:: classref-method - -:ref:`String` **str** **(** ... **)** |vararg| - -Converts one or more arguments to a :ref:`String` in the best way possible. - -:: - - var a = [10, 20, 30] - var b = str(a); - len(a) # Returns 3 - len(b) # Returns 12 - -.. rst-class:: classref-item-separator - ----- - .. _class_@GDScript_method_type_exists: .. rst-class:: classref-method diff --git a/classes/class_@globalscope.rst b/classes/class_@globalscope.rst index 4b87641a9..392dae68e 100644 --- a/classes/class_@globalscope.rst +++ b/classes/class_@globalscope.rst @@ -3417,7 +3417,7 @@ Additionally, other keywords can be included: ``"exp"`` for exponential range ed :ref:`PropertyHint` **PROPERTY_HINT_ENUM** = ``2`` -Hints that an :ref:`int`, :ref:`float`, or :ref:`String` property is an enumerated value to pick in a list specified via a hint string. +Hints that an :ref:`int` or :ref:`String` property is an enumerated value to pick in a list specified via a hint string. The hint string is a comma separated list of names such as ``"Hello,Something,Else"``. Whitespaces are **not** removed from either end of a name. For integer and float properties, the first name in the list has value 0, the next 1, and so on. Explicit values can also be specified by appending ``:integer`` to the name, e.g. ``"Zero,One,Three:3,Four,Six:6"``. @@ -6922,7 +6922,14 @@ Returns the position of the first non-zero digit, after the decimal point. Note :ref:`String` **str** **(** ... **)** |vararg| -Converts one or more arguments of any :ref:`Variant` type to :ref:`String` in the best way possible. +Converts one or more arguments of any :ref:`Variant` type to a :ref:`String` in the best way possible. + +:: + + var a = [10, 20, 30] + var b = str(a) + print(len(a)) # Prints 3 (the number of elements in the array). + print(len(b)) # Prints 12 (the length of the string "[10, 20, 30]"). .. rst-class:: classref-item-separator diff --git a/classes/class_aescontext.rst b/classes/class_aescontext.rst index ca2c1a42c..9a2f1fdc8 100644 --- a/classes/class_aescontext.rst +++ b/classes/class_aescontext.rst @@ -59,39 +59,38 @@ This class provides access to AES encryption/decryption of raw data. Both AES-EC .. code-tab:: csharp using Godot; - using System; using System.Diagnostics; - public class Example : Node + public partial class MyNode : Node { - public AESContext Aes = new AESContext(); + private AesContext _aes = new AesContext(); public override void _Ready() { string key = "My secret key!!!"; // Key must be either 16 or 32 bytes. string data = "My secret text!!"; // Data size must be multiple of 16 bytes, apply padding if needed. // Encrypt ECB - Aes.Start(AESContext.Mode.EcbEncrypt, key.ToUTF8()); - byte[] encrypted = Aes.Update(data.ToUTF8()); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8()); + byte[] encrypted = _aes.Update(data.ToUtf8()); + _aes.Finish(); // Decrypt ECB - Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8()); - byte[] decrypted = Aes.Update(encrypted); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8()); + byte[] decrypted = _aes.Update(encrypted); + _aes.Finish(); // Check ECB - Debug.Assert(decrypted == data.ToUTF8()); + Debug.Assert(decrypted == data.ToUtf8()); string iv = "My secret iv!!!!"; // IV must be of exactly 16 bytes. // Encrypt CBC - Aes.Start(AESContext.Mode.EcbEncrypt, key.ToUTF8(), iv.ToUTF8()); - encrypted = Aes.Update(data.ToUTF8()); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8(), iv.ToUtf8()); + encrypted = _aes.Update(data.ToUtf8()); + _aes.Finish(); // Decrypt CBC - Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8(), iv.ToUTF8()); - decrypted = Aes.Update(encrypted); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8(), iv.ToUtf8()); + decrypted = _aes.Update(encrypted); + _aes.Finish(); // Check CBC - Debug.Assert(decrypted == data.ToUTF8()); + Debug.Assert(decrypted == data.ToUtf8()); } } diff --git a/classes/class_animation.rst b/classes/class_animation.rst index abaadd3dd..d422d511e 100644 --- a/classes/class_animation.rst +++ b/classes/class_animation.rst @@ -98,12 +98,16 @@ Methods +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`audio_track_insert_key` **(** :ref:`int` track_idx, :ref:`float` time, :ref:`Resource` stream, :ref:`float` start_offset=0, :ref:`float` end_offset=0 **)** | +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`audio_track_is_use_blend` **(** :ref:`int` track_idx **)** |const| | + +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`audio_track_set_key_end_offset` **(** :ref:`int` track_idx, :ref:`int` key_idx, :ref:`float` offset **)** | +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`audio_track_set_key_start_offset` **(** :ref:`int` track_idx, :ref:`int` key_idx, :ref:`float` offset **)** | +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`audio_track_set_key_stream` **(** :ref:`int` track_idx, :ref:`int` key_idx, :ref:`Resource` stream **)** | +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`audio_track_set_use_blend` **(** :ref:`int` track_idx, :ref:`bool` enable **)** | + +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`bezier_track_get_key_in_handle` **(** :ref:`int` track_idx, :ref:`int` key_idx **)** |const| | +------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`bezier_track_get_key_out_handle` **(** :ref:`int` track_idx, :ref:`int` key_idx **)** |const| | @@ -651,6 +655,18 @@ Inserts an Audio Track key at the given ``time`` in seconds. The ``track_idx`` m ---- +.. _class_Animation_method_audio_track_is_use_blend: + +.. rst-class:: classref-method + +:ref:`bool` **audio_track_is_use_blend** **(** :ref:`int` track_idx **)** |const| + +Returns ``true`` if the track at ``idx`` will be blended with other animations. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_audio_track_set_key_end_offset: .. rst-class:: classref-method @@ -687,6 +703,18 @@ Sets the stream of the key identified by ``key_idx`` to value ``stream``. The `` ---- +.. _class_Animation_method_audio_track_set_use_blend: + +.. rst-class:: classref-method + +void **audio_track_set_use_blend** **(** :ref:`int` track_idx, :ref:`bool` enable **)** + +Sets whether the track will be blended with other animations. If ``true``, the audio playback volume changes depending on the blend value. + +.. rst-class:: classref-item-separator + +---- + .. _class_Animation_method_bezier_track_get_key_in_handle: .. rst-class:: classref-method diff --git a/classes/class_animationnode.rst b/classes/class_animationnode.rst index e798e9e39..223eab5fb 100644 --- a/classes/class_animationnode.rst +++ b/classes/class_animationnode.rst @@ -69,7 +69,7 @@ Methods +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`_process` **(** :ref:`float` time, :ref:`bool` seek, :ref:`bool` is_external_seeking **)** |virtual| |const| | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`add_input` **(** :ref:`String` name **)** | + | :ref:`bool` | :ref:`add_input` **(** :ref:`String` name **)** | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`blend_animation` **(** :ref:`StringName` animation, :ref:`float` time, :ref:`float` delta, :ref:`bool` seeked, :ref:`bool` is_external_seeking, :ref:`float` blend, :ref:`LoopedFlag` looped_flag=0 **)** | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -77,9 +77,11 @@ Methods +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`blend_node` **(** :ref:`StringName` name, :ref:`AnimationNode` node, :ref:`float` time, :ref:`bool` seek, :ref:`bool` is_external_seeking, :ref:`float` blend, :ref:`FilterAction` filter=0, :ref:`bool` sync=true **)** | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`int` | :ref:`find_input` **(** :ref:`String` name **)** |const| | + +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_input_count` **(** **)** |const| | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`String` | :ref:`get_input_name` **(** :ref:`int` input **)** | + | :ref:`String` | :ref:`get_input_name` **(** :ref:`int` input **)** |const| | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_parameter` **(** :ref:`StringName` name **)** |const| | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -89,6 +91,8 @@ Methods +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_filter_path` **(** :ref:`NodePath` path, :ref:`bool` enable **)** | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`set_input_name` **(** :ref:`int` input, :ref:`String` name **)** | + +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_parameter` **(** :ref:`StringName` name, :ref:`Variant` value **)** | +-------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -101,13 +105,37 @@ Methods Signals ------- +.. _class_AnimationNode_signal_animation_node_removed: + +.. rst-class:: classref-signal + +**animation_node_removed** **(** :ref:`int` object_id, :ref:`String` name **)** + +Emitted by nodes that inherit from this class and that have an internal tree when one of their nodes removes. The nodes that emit this signal are :ref:`AnimationNodeBlendSpace1D`, :ref:`AnimationNodeBlendSpace2D`, :ref:`AnimationNodeStateMachine`, and :ref:`AnimationNodeBlendTree`. + +.. rst-class:: classref-item-separator + +---- + +.. _class_AnimationNode_signal_animation_node_renamed: + +.. rst-class:: classref-signal + +**animation_node_renamed** **(** :ref:`int` object_id, :ref:`String` old_name, :ref:`String` new_name **)** + +Emitted by nodes that inherit from this class and that have an internal tree when one of their node names changes. The nodes that emit this signal are :ref:`AnimationNodeBlendSpace1D`, :ref:`AnimationNodeBlendSpace2D`, :ref:`AnimationNodeStateMachine`, and :ref:`AnimationNodeBlendTree`. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationNode_signal_tree_changed: .. rst-class:: classref-signal **tree_changed** **(** **)** -Emitted by nodes that inherit from this class and that have an internal tree when one of their nodes changes. The nodes that emit this signal are :ref:`AnimationNodeBlendSpace1D`, :ref:`AnimationNodeBlendSpace2D`, :ref:`AnimationNodeStateMachine`, and :ref:`AnimationNodeBlendTree`. +Emitted by nodes that inherit from this class and that have an internal tree when one of their nodes changes. The nodes that emit this signal are :ref:`AnimationNodeBlendSpace1D`, :ref:`AnimationNodeBlendSpace2D`, :ref:`AnimationNodeStateMachine`, :ref:`AnimationNodeBlendTree` and :ref:`AnimationNodeTransition`. .. rst-class:: classref-section-separator @@ -291,9 +319,9 @@ This function should return the time left for the current animation to finish (i .. rst-class:: classref-method -void **add_input** **(** :ref:`String` name **)** +:ref:`bool` **add_input** **(** :ref:`String` name **)** -Adds an input to the node. This is only useful for nodes created for use in an :ref:`AnimationNodeBlendTree`. +Adds an input to the node. This is only useful for nodes created for use in an :ref:`AnimationNodeBlendTree`. If the addition fails, returns ``false``. .. rst-class:: classref-item-separator @@ -337,6 +365,18 @@ Blend another animation node (in case this node contains children animation node ---- +.. _class_AnimationNode_method_find_input: + +.. rst-class:: classref-method + +:ref:`int` **find_input** **(** :ref:`String` name **)** |const| + +Returns the input index which corresponds to ``name``. If not found, returns ``-1``. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationNode_method_get_input_count: .. rst-class:: classref-method @@ -353,7 +393,7 @@ Amount of inputs in this node, only useful for nodes that go into :ref:`Animatio .. rst-class:: classref-method -:ref:`String` **get_input_name** **(** :ref:`int` input **)** +:ref:`String` **get_input_name** **(** :ref:`int` input **)** |const| Gets the name of an input by index. @@ -409,6 +449,18 @@ Adds or removes a path for the filter. ---- +.. _class_AnimationNode_method_set_input_name: + +.. rst-class:: classref-method + +:ref:`bool` **set_input_name** **(** :ref:`int` input, :ref:`String` name **)** + +Sets the name of the input at the given ``input`` index. If the setting fails, returns ``false``. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationNode_method_set_parameter: .. rst-class:: classref-method diff --git a/classes/class_animationnodeblendspace1d.rst b/classes/class_animationnodeblendspace1d.rst index 272a6f38d..6b1efe8ee 100644 --- a/classes/class_animationnodeblendspace1d.rst +++ b/classes/class_animationnodeblendspace1d.rst @@ -42,17 +42,19 @@ Properties .. table:: :widths: auto - +-----------------------------+--------------------------------------------------------------------------+-------------+ - | :ref:`float` | :ref:`max_space` | ``1.0`` | - +-----------------------------+--------------------------------------------------------------------------+-------------+ - | :ref:`float` | :ref:`min_space` | ``-1.0`` | - +-----------------------------+--------------------------------------------------------------------------+-------------+ - | :ref:`float` | :ref:`snap` | ``0.1`` | - +-----------------------------+--------------------------------------------------------------------------+-------------+ - | :ref:`bool` | :ref:`sync` | ``false`` | - +-----------------------------+--------------------------------------------------------------------------+-------------+ - | :ref:`String` | :ref:`value_label` | ``"value"`` | - +-----------------------------+--------------------------------------------------------------------------+-------------+ + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ + | :ref:`BlendMode` | :ref:`blend_mode` | ``0`` | + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ + | :ref:`float` | :ref:`max_space` | ``1.0`` | + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ + | :ref:`float` | :ref:`min_space` | ``-1.0`` | + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ + | :ref:`float` | :ref:`snap` | ``0.1`` | + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ + | :ref:`bool` | :ref:`sync` | ``false`` | + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ + | :ref:`String` | :ref:`value_label` | ``"value"`` | + +------------------------------------------------------------+--------------------------------------------------------------------------+-------------+ .. rst-class:: classref-reftable-group @@ -84,9 +86,65 @@ Methods .. rst-class:: classref-descriptions-group +Enumerations +------------ + +.. _enum_AnimationNodeBlendSpace1D_BlendMode: + +.. rst-class:: classref-enumeration + +enum **BlendMode**: + +.. _class_AnimationNodeBlendSpace1D_constant_BLEND_MODE_INTERPOLATED: + +.. rst-class:: classref-enumeration-constant + +:ref:`BlendMode` **BLEND_MODE_INTERPOLATED** = ``0`` + +The interpolation between animations is linear. + +.. _class_AnimationNodeBlendSpace1D_constant_BLEND_MODE_DISCRETE: + +.. rst-class:: classref-enumeration-constant + +:ref:`BlendMode` **BLEND_MODE_DISCRETE** = ``1`` + +The blend space plays the animation of the node the blending position is closest to. Useful for frame-by-frame 2D animations. + +.. _class_AnimationNodeBlendSpace1D_constant_BLEND_MODE_DISCRETE_CARRY: + +.. rst-class:: classref-enumeration-constant + +:ref:`BlendMode` **BLEND_MODE_DISCRETE_CARRY** = ``2`` + +Similar to :ref:`BLEND_MODE_DISCRETE`, but starts the new animation at the last animation's playback position. + +.. rst-class:: classref-section-separator + +---- + +.. rst-class:: classref-descriptions-group + Property Descriptions --------------------- +.. _class_AnimationNodeBlendSpace1D_property_blend_mode: + +.. rst-class:: classref-property + +:ref:`BlendMode` **blend_mode** = ``0`` + +.. rst-class:: classref-property-setget + +- void **set_blend_mode** **(** :ref:`BlendMode` value **)** +- :ref:`BlendMode` **get_blend_mode** **(** **)** + +Controls the interpolation between animations. See :ref:`BlendMode` constants. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationNodeBlendSpace1D_property_max_space: .. rst-class:: classref-property diff --git a/classes/class_animationnodestatemachine.rst b/classes/class_animationnodestatemachine.rst index f7d7afb4e..b9af0a4ea 100644 --- a/classes/class_animationnodestatemachine.rst +++ b/classes/class_animationnodestatemachine.rst @@ -47,6 +47,18 @@ Tutorials .. rst-class:: classref-reftable-group +Properties +---------- + +.. table:: + :widths: auto + + +-------------------------+----------------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`allow_transition_to_self` | ``false`` | + +-------------------------+----------------------------------------------------------------------------------------------------+-----------+ + +.. rst-class:: classref-reftable-group + Methods ------- @@ -99,6 +111,28 @@ Methods .. rst-class:: classref-descriptions-group +Property Descriptions +--------------------- + +.. _class_AnimationNodeStateMachine_property_allow_transition_to_self: + +.. rst-class:: classref-property + +:ref:`bool` **allow_transition_to_self** = ``false`` + +.. rst-class:: classref-property-setget + +- void **set_allow_transition_to_self** **(** :ref:`bool` value **)** +- :ref:`bool` **is_allow_transition_to_self** **(** **)** + +If ``true``, allows teleport to the self state with :ref:`AnimationNodeStateMachinePlayback.travel`. When the reset option is enabled in :ref:`AnimationNodeStateMachinePlayback.travel`, the animation is restarted. If ``false``, nothing happens on the teleportation to the self state. + +.. rst-class:: classref-section-separator + +---- + +.. rst-class:: classref-descriptions-group + Method Descriptions ------------------- diff --git a/classes/class_animationnodetransition.rst b/classes/class_animationnodetransition.rst index 109ff2934..1ddd011f2 100644 --- a/classes/class_animationnodetransition.rst +++ b/classes/class_animationnodetransition.rst @@ -40,15 +40,15 @@ Properties .. table:: :widths: auto - +---------------------------+------------------------------------------------------------------------------+----------+ - | :ref:`int` | :ref:`enabled_inputs` | ``0`` | - +---------------------------+------------------------------------------------------------------------------+----------+ - | :ref:`bool` | :ref:`reset` | ``true`` | - +---------------------------+------------------------------------------------------------------------------+----------+ - | :ref:`Curve` | :ref:`xfade_curve` | | - +---------------------------+------------------------------------------------------------------------------+----------+ - | :ref:`float` | :ref:`xfade_time` | ``0.0`` | - +---------------------------+------------------------------------------------------------------------------+----------+ + +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ + | :ref:`bool` | :ref:`allow_transition_to_self` | ``false`` | + +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ + | :ref:`int` | :ref:`input_count` | ``0`` | + +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ + | :ref:`Curve` | :ref:`xfade_curve` | | + +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ + | :ref:`float` | :ref:`xfade_time` | ``0.0`` | + +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group @@ -58,17 +58,15 @@ Methods .. table:: :widths: auto - +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`int` | :ref:`find_input_caption` **(** :ref:`String` caption **)** |const| | - +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`String` | :ref:`get_input_caption` **(** :ref:`int` input **)** |const| | - +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`is_input_set_as_auto_advance` **(** :ref:`int` input **)** |const| | - +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_input_as_auto_advance` **(** :ref:`int` input, :ref:`bool` enable **)** | - +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_input_caption` **(** :ref:`int` input, :ref:`String` caption **)** | - +-----------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_input_reset` **(** :ref:`int` input **)** |const| | + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_input_set_as_auto_advance` **(** :ref:`int` input **)** |const| | + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_input_as_auto_advance` **(** :ref:`int` input, :ref:`bool` enable **)** | + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`set_input_reset` **(** :ref:`int` input, :ref:`bool` enable **)** | + +-------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -79,35 +77,35 @@ Methods Property Descriptions --------------------- -.. _class_AnimationNodeTransition_property_enabled_inputs: +.. _class_AnimationNodeTransition_property_allow_transition_to_self: .. rst-class:: classref-property -:ref:`int` **enabled_inputs** = ``0`` +:ref:`bool` **allow_transition_to_self** = ``false`` .. rst-class:: classref-property-setget -- void **set_enabled_inputs** **(** :ref:`int` value **)** -- :ref:`int` **get_enabled_inputs** **(** **)** +- void **set_allow_transition_to_self** **(** :ref:`bool` value **)** +- :ref:`bool` **is_allow_transition_to_self** **(** **)** -The number of enabled input ports for this node. The maximum is ``31``. +If ``true``, allows transition to the self state. When the reset option is enabled in input, the animation is restarted. If ``false``, nothing happens on the transition to the self state. .. rst-class:: classref-item-separator ---- -.. _class_AnimationNodeTransition_property_reset: +.. _class_AnimationNodeTransition_property_input_count: .. rst-class:: classref-property -:ref:`bool` **reset** = ``true`` +:ref:`int` **input_count** = ``0`` .. rst-class:: classref-property-setget -- void **set_reset** **(** :ref:`bool` value **)** -- :ref:`bool` **is_reset** **(** **)** +- void **set_input_count** **(** :ref:`int` value **)** +- :ref:`int` **get_input_count** **(** **)** -If ``true``, the destination animation is played back from the beginning when switched. +The number of enabled input ports for this node. .. rst-class:: classref-item-separator @@ -152,25 +150,13 @@ Cross-fading time (in seconds) between each animation connected to the inputs. Method Descriptions ------------------- -.. _class_AnimationNodeTransition_method_find_input_caption: +.. _class_AnimationNodeTransition_method_is_input_reset: .. rst-class:: classref-method -:ref:`int` **find_input_caption** **(** :ref:`String` caption **)** |const| +:ref:`bool` **is_input_reset** **(** :ref:`int` input **)** |const| -Returns the input index which corresponds to ``caption``. If not found, returns ``-1``. - -.. rst-class:: classref-item-separator - ----- - -.. _class_AnimationNodeTransition_method_get_input_caption: - -.. rst-class:: classref-method - -:ref:`String` **get_input_caption** **(** :ref:`int` input **)** |const| - -Returns the name of the input at the given ``input`` index. This name is displayed in the editor next to the node input. +Returns whether the animation restarts when the animation transitions from the other animation. .. rst-class:: classref-item-separator @@ -200,13 +186,13 @@ Enables or disables auto-advance for the given ``input`` index. If enabled, stat ---- -.. _class_AnimationNodeTransition_method_set_input_caption: +.. _class_AnimationNodeTransition_method_set_input_reset: .. rst-class:: classref-method -void **set_input_caption** **(** :ref:`int` input, :ref:`String` caption **)** +void **set_input_reset** **(** :ref:`int` input, :ref:`bool` enable **)** -Sets the name of the input at the given ``input`` index. This name is displayed in the editor next to the node input. +If ``true``, the destination animation is restarted when the animation transitions. .. |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_animationplayer.rst b/classes/class_animationplayer.rst index 4cfd75784..4631df46f 100644 --- a/classes/class_animationplayer.rst +++ b/classes/class_animationplayer.rst @@ -49,6 +49,8 @@ Properties +--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+--------------------+ | :ref:`String` | :ref:`assigned_animation` | | +--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+--------------------+ + | :ref:`int` | :ref:`audio_max_polyphony` | ``32`` | + +--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+--------------------+ | :ref:`String` | :ref:`autoplay` | ``""`` | +--------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+--------------------+ | :ref:`String` | :ref:`current_animation` | ``""`` | @@ -312,6 +314,25 @@ If playing, the the current animation's key, otherwise, the animation last playe ---- +.. _class_AnimationPlayer_property_audio_max_polyphony: + +.. rst-class:: classref-property + +:ref:`int` **audio_max_polyphony** = ``32`` + +.. rst-class:: classref-property-setget + +- void **set_audio_max_polyphony** **(** :ref:`int` value **)** +- :ref:`int` **get_audio_max_polyphony** **(** **)** + +The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers. + +For example, if this value is ``32`` and the animation has two audio tracks, the two :ref:`AudioStreamPlayer`\ s assigned can play simultaneously up to ``32`` voices each. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationPlayer_property_autoplay: .. rst-class:: classref-property diff --git a/classes/class_animationtree.rst b/classes/class_animationtree.rst index 08a2d096b..9d1d40f16 100644 --- a/classes/class_animationtree.rst +++ b/classes/class_animationtree.rst @@ -47,6 +47,8 @@ Properties +------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------+ | :ref:`NodePath` | :ref:`anim_player` | ``NodePath("")`` | +------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------+ + | :ref:`int` | :ref:`audio_max_polyphony` | ``32`` | + +------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------+ | :ref:`AnimationProcessCallback` | :ref:`process_callback` | ``1`` | +------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------+-------------------+ | :ref:`NodePath` | :ref:`root_motion_track` | ``NodePath("")`` | @@ -73,8 +75,6 @@ Methods +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`get_root_motion_scale` **(** **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`rename_parameter` **(** :ref:`String` old_name, :ref:`String` new_name **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator @@ -220,6 +220,25 @@ The path to the :ref:`AnimationPlayer` used for animating ---- +.. _class_AnimationTree_property_audio_max_polyphony: + +.. rst-class:: classref-property + +:ref:`int` **audio_max_polyphony** = ``32`` + +.. rst-class:: classref-property-setget + +- void **set_audio_max_polyphony** **(** :ref:`int` value **)** +- :ref:`int` **get_audio_max_polyphony** **(** **)** + +The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers. + +For example, if this value is ``32`` and the animation has two audio tracks, the two :ref:`AudioStreamPlayer`\ s assigned can play simultaneously up to ``32`` voices each. + +.. rst-class:: classref-item-separator + +---- + .. _class_AnimationTree_property_process_callback: .. rst-class:: classref-property @@ -399,20 +418,6 @@ The most basic example is applying scale to :ref:`CharacterBody3D` old_name, :ref:`String` new_name **)** - -.. container:: contribute - - There is currently no description for this method. Please help us by :ref:`contributing one `! - .. |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_area2d.rst b/classes/class_area2d.rst index aa3a31ba7..db9682540 100644 --- a/classes/class_area2d.rst +++ b/classes/class_area2d.rst @@ -46,37 +46,37 @@ Properties .. table:: :widths: auto - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`float` | :ref:`angular_damp` | ``1.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`SpaceOverride` | :ref:`angular_damp_space_override` | ``0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`StringName` | :ref:`audio_bus_name` | ``&"Master"`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`bool` | :ref:`audio_bus_override` | ``false`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`float` | :ref:`gravity` | ``980.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`Vector2` | :ref:`gravity_direction` | ``Vector2(0, 1)`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`bool` | :ref:`gravity_point` | ``false`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`Vector2` | :ref:`gravity_point_center` | ``Vector2(0, 1)`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`float` | :ref:`gravity_point_distance_scale` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`SpaceOverride` | :ref:`gravity_space_override` | ``0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`float` | :ref:`linear_damp` | ``0.1`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`SpaceOverride` | :ref:`linear_damp_space_override` | ``0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`bool` | :ref:`monitorable` | ``true`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`bool` | :ref:`monitoring` | ``true`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ - | :ref:`float` | :ref:`priority` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-------------------+ + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`float` | :ref:`angular_damp` | ``1.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`SpaceOverride` | :ref:`angular_damp_space_override` | ``0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`StringName` | :ref:`audio_bus_name` | ``&"Master"`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`bool` | :ref:`audio_bus_override` | ``false`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`float` | :ref:`gravity` | ``980.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`Vector2` | :ref:`gravity_direction` | ``Vector2(0, 1)`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`bool` | :ref:`gravity_point` | ``false`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`Vector2` | :ref:`gravity_point_center` | ``Vector2(0, 1)`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`float` | :ref:`gravity_point_unit_distance` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`SpaceOverride` | :ref:`gravity_space_override` | ``0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`float` | :ref:`linear_damp` | ``0.1`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`SpaceOverride` | :ref:`linear_damp_space_override` | ``0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`bool` | :ref:`monitorable` | ``true`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`bool` | :ref:`monitoring` | ``true`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`float` | :ref:`priority` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ .. rst-class:: classref-reftable-group @@ -441,18 +441,20 @@ If gravity is a point (see :ref:`gravity_point` **gravity_point_distance_scale** = ``0.0`` +:ref:`float` **gravity_point_unit_distance** = ``0.0`` .. rst-class:: classref-property-setget -- void **set_gravity_point_distance_scale** **(** :ref:`float` value **)** -- :ref:`float` **get_gravity_point_distance_scale** **(** **)** +- void **set_gravity_point_unit_distance** **(** :ref:`float` value **)** +- :ref:`float` **get_gravity_point_unit_distance** **(** **)** -The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance. +The distance at which the gravity strength is equal to :ref:`gravity`. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the :ref:`gravity` to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. + +The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance. .. rst-class:: classref-item-separator diff --git a/classes/class_area3d.rst b/classes/class_area3d.rst index 26e85d9e7..dcb4d1082 100644 --- a/classes/class_area3d.rst +++ b/classes/class_area3d.rst @@ -44,51 +44,51 @@ Properties .. table:: :widths: auto - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`angular_damp` | ``0.1`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`SpaceOverride` | :ref:`angular_damp_space_override` | ``0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`StringName` | :ref:`audio_bus_name` | ``&"Master"`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`bool` | :ref:`audio_bus_override` | ``false`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`gravity` | ``9.8`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`Vector3` | :ref:`gravity_direction` | ``Vector3(0, -1, 0)`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`bool` | :ref:`gravity_point` | ``false`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`Vector3` | :ref:`gravity_point_center` | ``Vector3(0, -1, 0)`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`gravity_point_distance_scale` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`SpaceOverride` | :ref:`gravity_space_override` | ``0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`linear_damp` | ``0.1`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`SpaceOverride` | :ref:`linear_damp_space_override` | ``0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`bool` | :ref:`monitorable` | ``true`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`bool` | :ref:`monitoring` | ``true`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`priority` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`reverb_bus_amount` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`bool` | :ref:`reverb_bus_enabled` | ``false`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`StringName` | :ref:`reverb_bus_name` | ``&"Master"`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`reverb_bus_uniformity` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`wind_attenuation_factor` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`float` | :ref:`wind_force_magnitude` | ``0.0`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ - | :ref:`NodePath` | :ref:`wind_source_path` | ``NodePath("")`` | - +-------------------------------------------------+-----------------------------------------------------------------------------------------+-----------------------+ + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`angular_damp` | ``0.1`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`SpaceOverride` | :ref:`angular_damp_space_override` | ``0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`StringName` | :ref:`audio_bus_name` | ``&"Master"`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`bool` | :ref:`audio_bus_override` | ``false`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`gravity` | ``9.8`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`Vector3` | :ref:`gravity_direction` | ``Vector3(0, -1, 0)`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`bool` | :ref:`gravity_point` | ``false`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`Vector3` | :ref:`gravity_point_center` | ``Vector3(0, -1, 0)`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`gravity_point_unit_distance` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`SpaceOverride` | :ref:`gravity_space_override` | ``0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`linear_damp` | ``0.1`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`SpaceOverride` | :ref:`linear_damp_space_override` | ``0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`bool` | :ref:`monitorable` | ``true`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`bool` | :ref:`monitoring` | ``true`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`priority` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`reverb_bus_amount` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`bool` | :ref:`reverb_bus_enabled` | ``false`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`StringName` | :ref:`reverb_bus_name` | ``&"Master"`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`reverb_bus_uniformity` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`wind_attenuation_factor` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`float` | :ref:`wind_force_magnitude` | ``0.0`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ + | :ref:`NodePath` | :ref:`wind_source_path` | ``NodePath("")`` | + +-------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+ .. rst-class:: classref-reftable-group @@ -453,18 +453,20 @@ If gravity is a point (see :ref:`gravity_point` **gravity_point_distance_scale** = ``0.0`` +:ref:`float` **gravity_point_unit_distance** = ``0.0`` .. rst-class:: classref-property-setget -- void **set_gravity_point_distance_scale** **(** :ref:`float` value **)** -- :ref:`float` **get_gravity_point_distance_scale** **(** **)** +- void **set_gravity_point_unit_distance** **(** :ref:`float` value **)** +- :ref:`float` **get_gravity_point_unit_distance** **(** **)** -The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance. +The distance at which the gravity strength is equal to :ref:`gravity`. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set the :ref:`gravity` to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on. + +The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance. .. rst-class:: classref-item-separator diff --git a/classes/class_array.rst b/classes/class_array.rst index a2604fc4b..101ddf128 100644 --- a/classes/class_array.rst +++ b/classes/class_array.rst @@ -123,11 +123,13 @@ Methods +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`append_array` **(** :ref:`Array` array **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`assign` **(** :ref:`Array` array **)** | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`back` **(** **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`int` | :ref:`bsearch` **(** :ref:`Variant` value, :ref:`bool` before=true **)** | + | :ref:`int` | :ref:`bsearch` **(** :ref:`Variant` value, :ref:`bool` before=true **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`int` | :ref:`bsearch_custom` **(** :ref:`Variant` value, :ref:`Callable` func, :ref:`bool` before=true **)** | + | :ref:`int` | :ref:`bsearch_custom` **(** :ref:`Variant` value, :ref:`Callable` func, :ref:`bool` before=true **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear` **(** **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -161,6 +163,8 @@ Methods +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_read_only` **(** **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_same_typed` **(** :ref:`Array` array **)** |const| | + +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_typed` **(** **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`make_read_only` **(** **)** | @@ -193,8 +197,6 @@ Methods +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`rfind` **(** :ref:`Variant` what, :ref:`int` from=-1 **)** |const| | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | void | :ref:`set_typed` **(** :ref:`int` type, :ref:`StringName` class_name, :ref:`Variant` script **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`shuffle` **(** **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`size` **(** **)** |const| | @@ -205,8 +207,6 @@ Methods +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`sort_custom` **(** :ref:`Callable` func **)** | +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`typed_assign` **(** :ref:`Array` array **)** | - +-------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-reftable-group @@ -259,7 +259,7 @@ Constructs an empty **Array**. :ref:`Array` **Array** **(** :ref:`Array` base, :ref:`int` type, :ref:`StringName` class_name, :ref:`Variant` script **)** -Creates a typed array from the ``base`` array. The base array can't be already typed. See :ref:`set_typed` for more details. +Creates a typed array from the ``base`` array. .. rst-class:: classref-item-separator @@ -269,7 +269,7 @@ Creates a typed array from the ``base`` array. The base array can't be already t :ref:`Array` **Array** **(** :ref:`Array` from **)** -Constructs an **Array** as a copy of the given **Array**. +Returns the same array as ``from``. If you need a copy of the array, use :ref:`duplicate`. .. rst-class:: classref-item-separator @@ -467,6 +467,18 @@ Appends another array at the end of this array. ---- +.. _class_Array_method_assign: + +.. rst-class:: classref-method + +void **assign** **(** :ref:`Array` array **)** + +Assigns elements of another ``array`` into the array. Resizes the array to match ``array``. Performs type conversions if the array is typed. + +.. rst-class:: classref-item-separator + +---- + .. _class_Array_method_back: .. rst-class:: classref-method @@ -485,7 +497,7 @@ Returns the last element of the array. Prints an error and returns ``null`` if t .. rst-class:: classref-method -:ref:`int` **bsearch** **(** :ref:`Variant` value, :ref:`bool` before=true **)** +:ref:`int` **bsearch** **(** :ref:`Variant` value, :ref:`bool` before=true **)** |const| Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a ``before`` specifier can be passed. If ``false``, the returned index comes after all existing entries of the value in the array. @@ -499,7 +511,7 @@ Finds the index of an existing value (or the insertion index that maintains sort .. rst-class:: classref-method -:ref:`int` **bsearch_custom** **(** :ref:`Variant` value, :ref:`Callable` func, :ref:`bool` before=true **)** +:ref:`int` **bsearch_custom** **(** :ref:`Variant` value, :ref:`Callable` func, :ref:`bool` before=true **)** |const| Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a ``before`` specifier can be passed. If ``false``, the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return ``true`` if the first argument is less than the second, and return ``false`` otherwise. @@ -584,7 +596,7 @@ Assigns the given value to all elements in the array. This can typically be used .. code-tab:: csharp - var array = new Godot.Collections.Array{}; + var array = new Godot.Collections.Array(); array.Resize(10); array.Fill(0); // Initialize the 10 elements to 0. @@ -703,7 +715,7 @@ Returns ``true`` if the array contains the given value. .. code-tab:: csharp - var arr = new Godot.Collections.Array{"inside", 7}; + var arr = new Godot.Collections.Array { "inside", 7 }; // has is renamed to Contains GD.Print(arr.Contains("inside")); // True GD.Print(arr.Contains("outside")); // False @@ -726,7 +738,7 @@ Returns ``true`` if the array contains the given value. .. code-tab:: csharp // As there is no "in" keyword in C#, you have to use Contains - var array = new Godot.Collections.Array{2, 4, 6, 8}; + var array = new Godot.Collections.Array { 2, 4, 6, 8 }; if (array.Contains(2)) { GD.Print("Contains!"); @@ -792,6 +804,18 @@ Returns ``true`` if the array is read-only. See :ref:`make_read_only` **is_same_typed** **(** :ref:`Array` array **)** |const| + +Returns ``true`` if the array is typed the same as ``array``. + +.. rst-class:: classref-item-separator + +---- + .. _class_Array_method_is_typed: .. rst-class:: classref-method @@ -873,11 +897,21 @@ Returns the minimum value contained in the array if all elements are of comparab Returns a random value from the target array. -:: + +.. tabs:: + + .. code-tab:: gdscript var array: Array[int] = [1, 2, 3, 4] print(array.pick_random()) # Prints either of the four numbers. + .. code-tab:: csharp + + var array = new Godot.Collections.Array { 1, 2, 3, 4 }; + GD.Print(array.PickRandom()); // Prints either of the four numbers. + + + .. rst-class:: classref-item-separator ---- @@ -1025,20 +1059,6 @@ Searches the array in reverse order. Optionally, a start search index can be pas ---- -.. _class_Array_method_set_typed: - -.. rst-class:: classref-method - -void **set_typed** **(** :ref:`int` type, :ref:`StringName` class_name, :ref:`Variant` script **)** - -Makes the **Array** typed. The ``type`` should be one of the :ref:`Variant.Type` constants. ``class_name`` is optional and can only be provided for :ref:`@GlobalScope.TYPE_OBJECT`. ``script`` can only be provided if ``class_name`` is not empty. - -The method fails if an array is already typed. - -.. rst-class:: classref-item-separator - ----- - .. _class_Array_method_shuffle: .. rst-class:: classref-method @@ -1075,7 +1095,7 @@ The absolute value of ``begin`` and ``end`` will be clamped to the array size, s If either ``begin`` or ``end`` are negative, they will be relative to the end of the array (i.e. ``arr.slice(0, -2)`` is a shorthand for ``arr.slice(0, arr.size() - 2)``). -If specified, ``step`` is the relative index between source elements. It can be negative, then ``begin`` must be higher than ``end``. For example, ``[0, 1, 2, 3, 4, 5].slice(5, 1, -2)`` returns ``[5, 3]``). +If specified, ``step`` is the relative index between source elements. It can be negative, then ``begin`` must be higher than ``end``. For example, ``[0, 1, 2, 3, 4, 5].slice(5, 1, -2)`` returns ``[5, 3]``. If ``deep`` is true, each element will be copied by value rather than by reference. @@ -1106,7 +1126,9 @@ Sorts the array. .. code-tab:: csharp - // There is no sort support for Godot.Collections.Array + var strings = new Godot.Collections.Array { "string1", "string2", "string10", "string11" }; + strings.Sort(); + GD.Print(strings); // Prints [string1, string10, string11, string2] @@ -1159,18 +1181,6 @@ Sorts the array using a custom method. The custom method receives two arguments -.. rst-class:: classref-item-separator - ----- - -.. _class_Array_method_typed_assign: - -.. rst-class:: classref-method - -:ref:`bool` **typed_assign** **(** :ref:`Array` array **)** - -Assigns a different **Array** to this array reference. It the array is typed, the new array's type must be compatible and its elements will be automatically converted. - .. rst-class:: classref-section-separator ---- diff --git a/classes/class_astar3d.rst b/classes/class_astar3d.rst index aafcecf13..eeb2a5cc4 100644 --- a/classes/class_astar3d.rst +++ b/classes/class_astar3d.rst @@ -41,15 +41,16 @@ It is also possible to use non-Euclidean distances. To do so, create a class tha .. code-tab:: csharp - public class MyAStar : AStar3D + public partial class MyAStar : AStar3D { - public override float _ComputeCost(int u, int v) + public override float _ComputeCost(long fromId, long toId) { - return Mathf.Abs(u - v); + return Mathf.Abs((int)(fromId - toId)); } - public override float _EstimateCost(int u, int v) + + public override float _EstimateCost(long fromId, long toId) { - return Mathf.Min(0, Mathf.Abs(u - v) - 1); + return Mathf.Min(0, Mathf.Abs((int)(fromId - toId)) - 1); } } diff --git a/classes/class_audioserver.rst b/classes/class_audioserver.rst index 05f55848a..9b6118ed6 100644 --- a/classes/class_audioserver.rst +++ b/classes/class_audioserver.rst @@ -45,9 +45,9 @@ Properties +-----------------------------+------------------------------------------------------------------------------+---------------+ | :ref:`int` | :ref:`bus_count` | ``1`` | +-----------------------------+------------------------------------------------------------------------------+---------------+ - | :ref:`String` | :ref:`capture_device` | ``"Default"`` | + | :ref:`String` | :ref:`input_device` | ``"Default"`` | +-----------------------------+------------------------------------------------------------------------------+---------------+ - | :ref:`String` | :ref:`device` | ``"Default"`` | + | :ref:`String` | :ref:`output_device` | ``"Default"`` | +-----------------------------+------------------------------------------------------------------------------+---------------+ | :ref:`float` | :ref:`playback_speed_scale` | ``1.0`` | +-----------------------------+------------------------------------------------------------------------------+---------------+ @@ -65,8 +65,6 @@ Methods +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_bus_effect` **(** :ref:`int` bus_idx, :ref:`AudioEffect` effect, :ref:`int` at_position=-1 **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`PackedStringArray` | :ref:`capture_get_device_list` **(** **)** | - +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`AudioBusLayout` | :ref:`generate_bus_layout` **(** **)** |const| | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bus_channels` **(** :ref:`int` bus_idx **)** |const| | @@ -89,10 +87,12 @@ Methods +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_bus_volume_db` **(** :ref:`int` bus_idx **)** |const| | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`PackedStringArray` | :ref:`get_device_list` **(** **)** | + | :ref:`PackedStringArray` | :ref:`get_input_device_list` **(** **)** | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_mix_rate` **(** **)** |const| | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`PackedStringArray` | :ref:`get_output_device_list` **(** **)** | + +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_output_latency` **(** **)** |const| | +-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`SpeakerMode` | :ref:`get_speaker_mode` **(** **)** |const| | @@ -230,18 +230,18 @@ Number of available audio buses. ---- -.. _class_AudioServer_property_capture_device: +.. _class_AudioServer_property_input_device: .. rst-class:: classref-property -:ref:`String` **capture_device** = ``"Default"`` +:ref:`String` **input_device** = ``"Default"`` .. rst-class:: classref-property-setget -- void **capture_set_device** **(** :ref:`String` value **)** -- :ref:`String` **capture_get_device** **(** **)** +- void **set_input_device** **(** :ref:`String` value **)** +- :ref:`String` **get_input_device** **(** **)** -Name of the current device for audio input (see :ref:`capture_get_device_list`). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value ``"Default"`` will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to ``"Default"``. +Name of the current device for audio input (see :ref:`get_input_device_list`). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value ``"Default"`` will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to ``"Default"``. \ **Note:** :ref:`ProjectSettings.audio/driver/enable_input` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. @@ -249,18 +249,18 @@ Name of the current device for audio input (see :ref:`capture_get_device_list` **device** = ``"Default"`` +:ref:`String` **output_device** = ``"Default"`` .. rst-class:: classref-property-setget -- void **set_device** **(** :ref:`String` value **)** -- :ref:`String` **get_device** **(** **)** +- void **set_output_device** **(** :ref:`String` value **)** +- :ref:`String` **get_output_device** **(** **)** -Name of the current device for audio output (see :ref:`get_device_list`). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value ``"Default"`` will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to ``"Default"``. +Name of the current device for audio output (see :ref:`get_output_device_list`). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value ``"Default"`` will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to ``"Default"``. .. rst-class:: classref-item-separator @@ -312,20 +312,6 @@ Adds an :ref:`AudioEffect` effect to the bus ``bus_idx`` at ` ---- -.. _class_AudioServer_method_capture_get_device_list: - -.. rst-class:: classref-method - -:ref:`PackedStringArray` **capture_get_device_list** **(** **)** - -Returns the names of all audio input devices detected on the system. - -\ **Note:** :ref:`ProjectSettings.audio/driver/enable_input` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. - -.. rst-class:: classref-item-separator - ----- - .. _class_AudioServer_method_generate_bus_layout: .. rst-class:: classref-method @@ -458,13 +444,15 @@ Returns the volume of the bus at index ``bus_idx`` in dB. ---- -.. _class_AudioServer_method_get_device_list: +.. _class_AudioServer_method_get_input_device_list: .. rst-class:: classref-method -:ref:`PackedStringArray` **get_device_list** **(** **)** +:ref:`PackedStringArray` **get_input_device_list** **(** **)** -Returns the names of all audio devices detected on the system. +Returns the names of all audio input devices detected on the system. + +\ **Note:** :ref:`ProjectSettings.audio/driver/enable_input` must be ``true`` for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. .. rst-class:: classref-item-separator @@ -482,6 +470,18 @@ Returns the sample rate at the output of the **AudioServer**. ---- +.. _class_AudioServer_method_get_output_device_list: + +.. rst-class:: classref-method + +:ref:`PackedStringArray` **get_output_device_list** **(** **)** + +Returns the names of all audio output devices detected on the system. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioServer_method_get_output_latency: .. rst-class:: classref-method diff --git a/classes/class_audiostreammp3.rst b/classes/class_audiostreammp3.rst index 977a6b56f..4a60dee9e 100644 --- a/classes/class_audiostreammp3.rst +++ b/classes/class_audiostreammp3.rst @@ -130,22 +130,18 @@ You can load a file without having to import it beforehand using the code snippe .. code-tab:: gdscript func load_mp3(path): - var file = File.new() - file.open(path, File.READ) + var file = FileAccess.open(path, FileAccess.READ) var sound = AudioStreamMP3.new() sound.data = file.get_buffer(file.get_length()) - file.close() return sound .. code-tab:: csharp public AudioStreamMP3 LoadMP3(string path) { - var file = new File(); - file.Open(path, File.READ); + using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read); var sound = new AudioStreamMP3(); sound.Data = file.GetBuffer(file.GetLength()); - file.Close(); return sound; } diff --git a/classes/class_audiostreamplayer.rst b/classes/class_audiostreamplayer.rst index be0027639..ea37740f2 100644 --- a/classes/class_audiostreamplayer.rst +++ b/classes/class_audiostreamplayer.rst @@ -81,6 +81,8 @@ Methods +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+ | :ref:`AudioStreamPlayback` | :ref:`get_stream_playback` **(** **)** | +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`has_stream_playback` **(** **)** | + +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`float` from_position=0.0 **)** | +-------------------------------------------------------+----------------------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`float` to_position **)** | @@ -336,6 +338,18 @@ Returns the :ref:`AudioStreamPlayback` object associa ---- +.. _class_AudioStreamPlayer_method_has_stream_playback: + +.. rst-class:: classref-method + +:ref:`bool` **has_stream_playback** **(** **)** + +Returns whether the **AudioStreamPlayer** can return the :ref:`AudioStreamPlayback` object or not. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioStreamPlayer_method_play: .. rst-class:: classref-method diff --git a/classes/class_audiostreamplayer2d.rst b/classes/class_audiostreamplayer2d.rst index 2be6788e6..02e5ba92f 100644 --- a/classes/class_audiostreamplayer2d.rst +++ b/classes/class_audiostreamplayer2d.rst @@ -81,6 +81,8 @@ Methods +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | :ref:`AudioStreamPlayback` | :ref:`get_stream_playback` **(** **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`has_stream_playback` **(** **)** | + +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`float` from_position=0.0 **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`float` to_position **)** | @@ -348,6 +350,18 @@ Returns the :ref:`AudioStreamPlayback` object associa ---- +.. _class_AudioStreamPlayer2D_method_has_stream_playback: + +.. rst-class:: classref-method + +:ref:`bool` **has_stream_playback** **(** **)** + +Returns whether the :ref:`AudioStreamPlayer` can return the :ref:`AudioStreamPlayback` object or not. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioStreamPlayer2D_method_play: .. rst-class:: classref-method diff --git a/classes/class_audiostreamplayer3d.rst b/classes/class_audiostreamplayer3d.rst index 23c90a362..cf435d489 100644 --- a/classes/class_audiostreamplayer3d.rst +++ b/classes/class_audiostreamplayer3d.rst @@ -97,6 +97,8 @@ Methods +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | :ref:`AudioStreamPlayback` | :ref:`get_stream_playback` **(** **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`has_stream_playback` **(** **)** | + +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`play` **(** :ref:`float` from_position=0.0 **)** | +-------------------------------------------------------+------------------------------------------------------------------------------------------------------------+ | void | :ref:`seek` **(** :ref:`float` to_position **)** | @@ -581,6 +583,18 @@ Returns the :ref:`AudioStreamPlayback` object associa ---- +.. _class_AudioStreamPlayer3D_method_has_stream_playback: + +.. rst-class:: classref-method + +:ref:`bool` **has_stream_playback** **(** **)** + +Returns whether the :ref:`AudioStreamPlayer` can return the :ref:`AudioStreamPlayback` object or not. + +.. rst-class:: classref-item-separator + +---- + .. _class_AudioStreamPlayer3D_method_play: .. rst-class:: classref-method diff --git a/classes/class_callable.rst b/classes/class_callable.rst index 73b31706c..3465cdce8 100644 --- a/classes/class_callable.rst +++ b/classes/class_callable.rst @@ -383,7 +383,7 @@ Returns ``true`` if the callable's object exists and has a valid method name ass void **rpc** **(** ... **)** |vararg| |const| -Perform an RPC (Remote Procedure Call). This is used for multiplayer and is normally not available, unless the function being called has been marked as *RPC*. Calling this method on unsupported functions will result in an error. +Perform an RPC (Remote Procedure Call). This is used for multiplayer and is normally not available, unless the function being called has been marked as *RPC*. Calling this method on unsupported functions will result in an error. See :ref:`Node.rpc`. .. rst-class:: classref-item-separator @@ -395,7 +395,7 @@ Perform an RPC (Remote Procedure Call). This is used for multiplayer and is norm void **rpc_id** **(** :ref:`int` peer_id, ... **)** |vararg| |const| -Perform an RPC (Remote Procedure Call) on a specific peer ID (see multiplayer documentation for reference). This is used for multiplayer and is normally not available unless the function being called has been marked as *RPC*. Calling this method on unsupported functions will result in an error. +Perform an RPC (Remote Procedure Call) on a specific peer ID (see multiplayer documentation for reference). This is used for multiplayer and is normally not available unless the function being called has been marked as *RPC*. Calling this method on unsupported functions will result in an error. See :ref:`Node.rpc_id`. .. rst-class:: classref-item-separator diff --git a/classes/class_camera2d.rst b/classes/class_camera2d.rst index ea2bd9bcb..86260087f 100644 --- a/classes/class_camera2d.rst +++ b/classes/class_camera2d.rst @@ -49,8 +49,6 @@ Properties +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ | :ref:`AnchorMode` | :ref:`anchor_mode` | ``1`` | +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ - | :ref:`bool` | :ref:`current` | ``false`` | - +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ | :ref:`Node` | :ref:`custom_viewport` | | +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ | :ref:`float` | :ref:`drag_bottom_margin` | ``0.2`` | @@ -75,6 +73,8 @@ Properties +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ | :ref:`bool` | :ref:`editor_draw_screen` | ``true`` | +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ + | :ref:`bool` | :ref:`enabled` | ``true`` | + +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ | :ref:`bool` | :ref:`ignore_rotation` | ``true`` | +-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+ | :ref:`int` | :ref:`limit_bottom` | ``10000000`` | @@ -123,6 +123,10 @@ Methods +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`get_target_position` **(** **)** |const| | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | :ref:`bool` | :ref:`is_current` **(** **)** |const| | + +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ + | void | :ref:`make_current` **(** **)** | + +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`reset_smoothing` **(** **)** | +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_drag_margin` **(** :ref:`Side` margin, :ref:`float` drag_margin **)** | @@ -213,23 +217,6 @@ The Camera2D's anchor point. See :ref:`AnchorMode` con ---- -.. _class_Camera2D_property_current: - -.. rst-class:: classref-property - -:ref:`bool` **current** = ``false`` - -.. rst-class:: classref-property-setget - -- void **set_current** **(** :ref:`bool` value **)** -- :ref:`bool` **is_current** **(** **)** - -If ``true``, the camera acts as the active camera for its :ref:`Viewport` ancestor. Only one camera can be current in a given viewport, so setting a different camera in the same viewport ``current`` will disable whatever camera was already active in that viewport. - -.. rst-class:: classref-item-separator - ----- - .. _class_Camera2D_property_custom_viewport: .. rst-class:: classref-property @@ -438,6 +425,25 @@ If ``true``, draws the camera's screen rectangle in the editor. ---- +.. _class_Camera2D_property_enabled: + +.. rst-class:: classref-property + +:ref:`bool` **enabled** = ``true`` + +.. rst-class:: classref-property-setget + +- void **set_enabled** **(** :ref:`bool` value **)** +- :ref:`bool` **is_enabled** **(** **)** + +Controls whether the camera can be active or not. If ``true``, the **Camera2D** will become the main camera when it enters the scene tree and there is no active camera currently (see :ref:`Viewport.get_camera_2d`). + +When the camera is currently active and :ref:`enabled` is set to ``false``, the next enabled **Camera2D** in the scene tree will become active. + +.. rst-class:: classref-item-separator + +---- + .. _class_Camera2D_property_ignore_rotation: .. rst-class:: classref-property @@ -746,6 +752,30 @@ Returns this camera's target position, in global coordinates. ---- +.. _class_Camera2D_method_is_current: + +.. rst-class:: classref-method + +:ref:`bool` **is_current** **(** **)** |const| + +Returns ``true`` if this **Camera2D** is the active camera (see :ref:`Viewport.get_camera_2d`). + +.. rst-class:: classref-item-separator + +---- + +.. _class_Camera2D_method_make_current: + +.. rst-class:: classref-method + +void **make_current** **(** **)** + +Forces this **Camera2D** to become the current active one. :ref:`enabled` must be ``true``. + +.. rst-class:: classref-item-separator + +---- + .. _class_Camera2D_method_reset_smoothing: .. rst-class:: classref-method diff --git a/classes/class_canvasgroup.rst b/classes/class_canvasgroup.rst index 9cf069871..290623b79 100644 --- a/classes/class_canvasgroup.rst +++ b/classes/class_canvasgroup.rst @@ -26,6 +26,7 @@ Child :ref:`CanvasItem` nodes of a **CanvasGroup** are drawn a :: shader_type canvas_item; + render_mode unshaded; uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; diff --git a/classes/class_color.rst b/classes/class_color.rst index f1a5fd47d..f22e3cf51 100644 --- a/classes/class_color.rst +++ b/classes/class_color.rst @@ -1840,8 +1840,6 @@ Returns a new color from ``rgba``, an HTML hexadecimal color string. ``rgba`` is \ ``rgba`` must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If ``rgba`` does not contain an alpha channel value, an alpha channel value of 1.0 is applied. If ``rgba`` is invalid, returns an empty color. -\ **Note:** In C#, this method is not implemented. The same functionality is provided by the Color constructor. - .. tabs:: @@ -1886,13 +1884,13 @@ Returns ``true`` if ``color`` is a valid HTML hexadecimal color string. The stri .. code-tab:: csharp - Color.IsHtmlValid("#55AAFF"); // Returns true - Color.IsHtmlValid("#55AAFF20"); // Returns true - Color.IsHtmlValid("55AAFF"); // Returns true - Color.IsHtmlValid("#F2C"); // Returns true + Color.HtmlIsValid("#55AAFF"); // Returns true + Color.HtmlIsValid("#55AAFF20"); // Returns true + Color.HtmlIsValid("55AAFF"); // Returns true + Color.HtmlIsValid("#F2C"); // Returns true - Color.IsHtmlValid("#AABBC"); // Returns false - Color.IsHtmlValid("#55aaFF5"); // Returns false + Color.HtmlIsValid("#AABBC"); // Returns false + Color.HtmlIsValid("#55aaFF5"); // Returns false diff --git a/classes/class_control.rst b/classes/class_control.rst index 66554bdd2..fa5729a3a 100644 --- a/classes/class_control.rst +++ b/classes/class_control.rst @@ -161,7 +161,7 @@ Methods +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`_gui_input` **(** :ref:`InputEvent` event **)** |virtual| | +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ - | :ref:`bool` | :ref:`_has_point` **(** :ref:`Vector2` position **)** |virtual| |const| | + | :ref:`bool` | :ref:`_has_point` **(** :ref:`Vector2` point **)** |virtual| |const| | +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Object` | :ref:`_make_custom_tooltip` **(** :ref:`String` for_text **)** |virtual| |const| | +----------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -1888,11 +1888,11 @@ This method should only be used to test the data. Process the data in :ref:`_dro .. code-tab:: csharp - public override bool CanDropData(Vector2 position, object data) + public override bool _CanDropData(Vector2 atPosition, Variant data) { // Check position if it is relevant to you // Otherwise, just check data - return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("expected"); + return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().Contains("expected"); } @@ -1916,18 +1916,20 @@ Godot calls this method to pass you the ``data`` from a control's :ref:`_get_dra func _can_drop_data(position, data): return typeof(data) == TYPE_DICTIONARY and data.has("color") + func _drop_data(position, data): var color = data["color"] .. code-tab:: csharp - public override bool CanDropData(Vector2 position, object data) + public override bool _CanDropData(Vector2 atPosition, Variant data) { - return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("color"); + return data.VariantType == Variant.Type.Dictionary && dict.AsGodotDictionary().Contains("color"); } - public override void DropData(Vector2 position, object data) + + public override void _DropData(Vector2 atPosition, Variant data) { - Color color = (Color)(data as Godot.Collections.Dictionary)["color"]; + Color color = data.AsGodotDictionary()["color"].AsColor(); } @@ -1958,11 +1960,11 @@ A preview that will follow the mouse that should represent the data can be set w .. code-tab:: csharp - public override object GetDragData(Vector2 position) + public override Variant _GetDragData(Vector2 atPosition) { - object mydata = MakeData(); // This is your custom method generating the drag data. - SetDragPreview(MakePreview(mydata)); // This is your custom method generating the preview of the drag data. - return mydata; + var myData = MakeData(); // This is your custom method generating the drag data. + SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data. + return myData; } @@ -2011,10 +2013,9 @@ Virtual method to be implemented by the user. Use this method to process and acc public override void _GuiInput(InputEvent @event) { - if (@event is InputEventMouseButton) + if (@event is InputEventMouseButton mb) { - var mb = @event as InputEventMouseButton; - if (mb.ButtonIndex == (int)ButtonList.Left && mb.Pressed) + if (mb.ButtonIndex == MouseButton.Left && mb.Pressed) { GD.Print("I've been clicked D:"); } @@ -2045,13 +2046,13 @@ The event won't trigger if: .. rst-class:: classref-method -:ref:`bool` **_has_point** **(** :ref:`Vector2` position **)** |virtual| |const| +:ref:`bool` **_has_point** **(** :ref:`Vector2` point **)** |virtual| |const| -Virtual method to be implemented by the user. Returns whether the given ``position`` is inside this control. +Virtual method to be implemented by the user. Returns whether the given ``point`` is inside this control. If not overridden, default behavior is checking if the point is within control's Rect. -\ **Note:** If you want to check if a point is inside the control, you can use ``get_rect().has_point(point)``. +\ **Note:** If you want to check if a point is inside the control, you can use ``Rect2(Vector2.ZERO, size).has_point(point)``. .. rst-class:: classref-item-separator @@ -2087,7 +2088,7 @@ The returned node will be added as child to a :ref:`PopupPanel .. code-tab:: csharp - public override Godot.Control _MakeCustomTooltip(String forText) + public override Control _MakeCustomTooltip(string forText) { var label = new Label(); label.Text = forText; @@ -2110,7 +2111,7 @@ The returned node will be added as child to a :ref:`PopupPanel .. code-tab:: csharp - public override Godot.Control _MakeCustomTooltip(String forText) + public override Control _MakeCustomTooltip(string forText) { Node tooltip = ResourceLoader.Load("res://some_tooltip_scene.tscn").Instantiate(); tooltip.GetNode