Przeglądaj źródła

Sync classref with current source

Rémi Verschelde 5 lat temu
rodzic
commit
79727af98b

+ 24 - 0
classes/[email protected]

@@ -1559,3 +1559,27 @@ From the caller, call :ref:`GDScriptFunctionState.resume<class_GDScriptFunctionS
 
 If passed an object and a signal, the execution is resumed when the object emits the given signal. In this case, ``yield()`` returns the argument passed to ``emit_signal()`` if the signal takes only one argument, or an array containing all the arguments passed to ``emit_signal()`` if the signal takes multiple arguments.
 
+You can also use ``yield`` to wait for a function to finish:
+
+::
+
+    func _ready():
+        yield(do_something(), "completed")
+        yield(do_something_else(), "completed")
+        print("All functions are done!")
+    
+    func do_something():
+        print("Something is done!")
+    
+    func do_something_else():
+        print("Something else is done!")
+    
+    # prints:
+    # Something is done!
+    # Something else is done!
+    # All functions are done!
+
+When yielding on a function, the ``completed`` signal will be emitted automatically when the function returns. It can, therefore, be used as the ``signal`` parameter of the ``yield`` method to resume.
+
+If you are planning on calling the same function within a loop, you should consider using ``yield(get_tree(), "idle_frame")`` also.
+

+ 3 - 3
classes/class_environment.rst

@@ -692,7 +692,7 @@ Defines the mode of background.
 | *Getter*  | get_sky_orientation()              |
 +-----------+------------------------------------+
 
-:ref:`Sky<class_Sky>` resource's rotation expressed as a :ref:`Basis<class_Basis>`
+:ref:`Sky<class_Sky>` resource's rotation expressed as a :ref:`Basis<class_Basis>`.
 
 ----
 
@@ -708,7 +708,7 @@ Defines the mode of background.
 | *Getter*  | get_sky_rotation()      |
 +-----------+-------------------------+
 
-:ref:`Sky<class_Sky>` resource's rotation expressed as euler angles in radians
+:ref:`Sky<class_Sky>` resource's rotation expressed as Euler angles in radians.
 
 ----
 
@@ -724,7 +724,7 @@ Defines the mode of background.
 | *Getter*  | get_sky_rotation_degrees()      |
 +-----------+---------------------------------+
 
-:ref:`Sky<class_Sky>` resource's rotation expressed as euler angles in degrees
+:ref:`Sky<class_Sky>` resource's rotation expressed as Euler angles in degrees.
 
 ----
 

+ 0 - 16
classes/class_gridmap.rst

@@ -40,8 +40,6 @@ Properties
 +---------------------------------------+------------------------------------------------------------------+--------------------+
 | :ref:`MeshLibrary<class_MeshLibrary>` | :ref:`mesh_library<class_GridMap_property_mesh_library>`         |                    |
 +---------------------------------------+------------------------------------------------------------------+--------------------+
-| :ref:`MeshLibrary<class_MeshLibrary>` | :ref:`theme<class_GridMap_property_theme>`                       |                    |
-+---------------------------------------+------------------------------------------------------------------+--------------------+
 
 Methods
 -------
@@ -251,20 +249,6 @@ The dimensions of the grid's cells.
 
 The assigned :ref:`MeshLibrary<class_MeshLibrary>`.
 
-----
-
-.. _class_GridMap_property_theme:
-
-- :ref:`MeshLibrary<class_MeshLibrary>` **theme**
-
-+----------+------------------+
-| *Setter* | set_theme(value) |
-+----------+------------------+
-| *Getter* | get_theme()      |
-+----------+------------------+
-
-Deprecated, use :ref:`mesh_library<class_GridMap_property_mesh_library>` instead.
-
 Method Descriptions
 -------------------
 

+ 18 - 10
classes/class_httpclient.rst

@@ -26,6 +26,8 @@ Properties
 +-------------------------------------+-------------------------------------------------------------------------------+-------+
 | :ref:`StreamPeer<class_StreamPeer>` | :ref:`connection<class_HTTPClient_property_connection>`                       |       |
 +-------------------------------------+-------------------------------------------------------------------------------+-------+
+| :ref:`int<class_int>`               | :ref:`read_chunk_size<class_HTTPClient_property_read_chunk_size>`             | 4096  |
++-------------------------------------+-------------------------------------------------------------------------------+-------+
 
 Methods
 -------
@@ -59,8 +61,6 @@ Methods
 +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | :ref:`Error<enum_@GlobalScope_Error>`         | :ref:`request_raw<class_HTTPClient_method_request_raw>` **(** :ref:`Method<enum_HTTPClient_Method>` method, :ref:`String<class_String>` url, :ref:`PoolStringArray<class_PoolStringArray>` headers, :ref:`PoolByteArray<class_PoolByteArray>` body **)** |
 +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| void                                          | :ref:`set_read_chunk_size<class_HTTPClient_method_set_read_chunk_size>` **(** :ref:`int<class_int>` bytes **)**                                                                                                                                          |
-+-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 
 Enumerations
 ------------
@@ -454,6 +454,22 @@ If ``true``, execution will block until all data is read from the response.
 
 The connection to use for this client.
 
+----
+
+.. _class_HTTPClient_property_read_chunk_size:
+
+- :ref:`int<class_int>` **read_chunk_size**
+
++-----------+----------------------------+
+| *Default* | 4096                       |
++-----------+----------------------------+
+| *Setter*  | set_read_chunk_size(value) |
++-----------+----------------------------+
+| *Getter*  | get_read_chunk_size()      |
++-----------+----------------------------+
+
+The size of the buffer used and maximum bytes to read per iteration. See :ref:`read_response_body_chunk<class_HTTPClient_method_read_response_body_chunk>`.
+
 Method Descriptions
 -------------------
 
@@ -613,11 +629,3 @@ Headers are HTTP request headers. For available HTTP methods, see ``METHOD_*``.
 
 Sends the body data raw, as a byte array and does not encode it in any way.
 
-----
-
-.. _class_HTTPClient_method_set_read_chunk_size:
-
-- void **set_read_chunk_size** **(** :ref:`int<class_int>` bytes **)**
-
-Sets the size of the buffer used and maximum bytes to read per iteration. See :ref:`read_response_body_chunk<class_HTTPClient_method_read_response_body_chunk>`.
-

+ 31 - 11
classes/class_httprequest.rst

@@ -21,17 +21,19 @@ A node with the ability to send HTTP(S) requests.
 Properties
 ----------
 
-+-----------------------------+--------------------------------------------------------------------+-------+
-| :ref:`int<class_int>`       | :ref:`body_size_limit<class_HTTPRequest_property_body_size_limit>` | -1    |
-+-----------------------------+--------------------------------------------------------------------+-------+
-| :ref:`String<class_String>` | :ref:`download_file<class_HTTPRequest_property_download_file>`     | ""    |
-+-----------------------------+--------------------------------------------------------------------+-------+
-| :ref:`int<class_int>`       | :ref:`max_redirects<class_HTTPRequest_property_max_redirects>`     | 8     |
-+-----------------------------+--------------------------------------------------------------------+-------+
-| :ref:`int<class_int>`       | :ref:`timeout<class_HTTPRequest_property_timeout>`                 | 0     |
-+-----------------------------+--------------------------------------------------------------------+-------+
-| :ref:`bool<class_bool>`     | :ref:`use_threads<class_HTTPRequest_property_use_threads>`         | false |
-+-----------------------------+--------------------------------------------------------------------+-------+
++-----------------------------+----------------------------------------------------------------------------+-------+
+| :ref:`int<class_int>`       | :ref:`body_size_limit<class_HTTPRequest_property_body_size_limit>`         | -1    |
++-----------------------------+----------------------------------------------------------------------------+-------+
+| :ref:`int<class_int>`       | :ref:`download_chunk_size<class_HTTPRequest_property_download_chunk_size>` | 4096  |
++-----------------------------+----------------------------------------------------------------------------+-------+
+| :ref:`String<class_String>` | :ref:`download_file<class_HTTPRequest_property_download_file>`             | ""    |
++-----------------------------+----------------------------------------------------------------------------+-------+
+| :ref:`int<class_int>`       | :ref:`max_redirects<class_HTTPRequest_property_max_redirects>`             | 8     |
++-----------------------------+----------------------------------------------------------------------------+-------+
+| :ref:`int<class_int>`       | :ref:`timeout<class_HTTPRequest_property_timeout>`                         | 0     |
++-----------------------------+----------------------------------------------------------------------------+-------+
+| :ref:`bool<class_bool>`     | :ref:`use_threads<class_HTTPRequest_property_use_threads>`                 | false |
++-----------------------------+----------------------------------------------------------------------------+-------+
 
 Methods
 -------
@@ -180,6 +182,24 @@ Maximum allowed size for response bodies.
 
 ----
 
+.. _class_HTTPRequest_property_download_chunk_size:
+
+- :ref:`int<class_int>` **download_chunk_size**
+
++-----------+--------------------------------+
+| *Default* | 4096                           |
++-----------+--------------------------------+
+| *Setter*  | set_download_chunk_size(value) |
++-----------+--------------------------------+
+| *Getter*  | get_download_chunk_size()      |
++-----------+--------------------------------+
+
+The size of the buffer used and maximum bytes to read per iteration. See :ref:`HTTPClient.read_chunk_size<class_HTTPClient_property_read_chunk_size>`.
+
+Set this to a higher value (e.g. 65536 for 64 KiB) when downloading large files to achieve better speeds at the cost of memory.
+
+----
+
 .. _class_HTTPRequest_property_download_file:
 
 - :ref:`String<class_String>` **download_file**

+ 18 - 0
classes/class_networkedmultiplayerenet.rst

@@ -30,6 +30,8 @@ Properties
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+--------------+
 | :ref:`bool<class_bool>`                                               | refuse_new_connections                                                            | **O:** false |
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+--------------+
+| :ref:`bool<class_bool>`                                               | :ref:`server_relay<class_NetworkedMultiplayerENet_property_server_relay>`         | true         |
++-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+--------------+
 | :ref:`int<class_int>`                                                 | :ref:`transfer_channel<class_NetworkedMultiplayerENet_property_transfer_channel>` | -1           |
 +-----------------------------------------------------------------------+-----------------------------------------------------------------------------------+--------------+
 | :ref:`TransferMode<enum_NetworkedMultiplayerPeer_TransferMode>`       | transfer_mode                                                                     | **O:** 2     |
@@ -148,6 +150,22 @@ The compression method used for network packets. These have different tradeoffs
 
 ----
 
+.. _class_NetworkedMultiplayerENet_property_server_relay:
+
+- :ref:`bool<class_bool>` **server_relay**
+
++-----------+---------------------------------+
+| *Default* | true                            |
++-----------+---------------------------------+
+| *Setter*  | set_server_relay_enabled(value) |
++-----------+---------------------------------+
+| *Getter*  | is_server_relay_enabled()       |
++-----------+---------------------------------+
+
+Enable or disable the server feature that notifies clients of other peers' connection/disconnection, and relays messages between them. When this option is ``false``, clients won't be automatically notified of other peers and won't be able to send them packets through the server.
+
+----
+
 .. _class_NetworkedMultiplayerENet_property_transfer_channel:
 
 - :ref:`int<class_int>` **transfer_channel**

+ 2 - 2
classes/class_node.rst

@@ -823,7 +823,7 @@ Returns the peer ID of the network master for this node. See :ref:`set_network_m
 
 - :ref:`Node<class_Node>` **get_node** **(** :ref:`NodePath<class_NodePath>` path **)** const
 
-Fetches a node. The :ref:`NodePath<class_NodePath>` can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, a ``null instance`` is returned and attempts to access it will result in an "Attempt to call <method> on a null instance." error.
+Fetches a node. The :ref:`NodePath<class_NodePath>` can be either a relative path (from the current node) or an absolute path (in the scene tree) to a node. If the path does not exist, a ``null instance`` is returned and an error is logged. Attempts to access methods on the return value will result in an "Attempt to call <method> on a null instance." error.
 
 **Note:** Fetching absolute paths only works when the node is inside the scene tree (see :ref:`is_inside_tree<class_Node_method_is_inside_tree>`).
 
@@ -873,7 +873,7 @@ For example, assuming that ``Area2D/CollisionShape2D`` is a valid node and that
 
 - :ref:`Node<class_Node>` **get_node_or_null** **(** :ref:`NodePath<class_NodePath>` path **)** const
 
-Similar to :ref:`get_node<class_Node_method_get_node>`, but does not raise an error if ``path`` does not point to a valid ``Node``.
+Similar to :ref:`get_node<class_Node_method_get_node>`, but does not log an error if ``path`` does not point to a valid ``Node``.
 
 ----
 

+ 1 - 1
classes/class_popup.rst

@@ -77,7 +77,7 @@ Constants
 Description
 -----------
 
-Popup is a base :ref:`Control<class_Control>` used to show dialogs and popups. It's a subwindow and modal by default (see :ref:`Control<class_Control>`) and has helpers for custom popup behavior.
+Popup is a base :ref:`Control<class_Control>` used to show dialogs and popups. It's a subwindow and modal by default (see :ref:`Control<class_Control>`) and has helpers for custom popup behavior. All popup methods ensure correct placement within the viewport.
 
 Property Descriptions
 ---------------------

+ 2 - 0
classes/class_viewport.rst

@@ -949,6 +949,8 @@ Returns ``true`` if there are visible modals on-screen.
 
 - :ref:`bool<class_bool>` **gui_is_dragging** **(** **)** const
 
+Returns ``true`` if the viewport is currently performing a drag operation.
+
 ----
 
 .. _class_Viewport_method_input:

+ 6 - 0
classes/class_viewportcontainer.rst

@@ -63,3 +63,9 @@ If ``true``, the viewport will be scaled to the control's size.
 | *Getter*  | get_stretch_shrink()      |
 +-----------+---------------------------+
 
+Divides the viewport's effective resolution by this value while preserving its scale. This can be used to speed up rendering.
+
+For example, a 1280×720 viewport with :ref:`stretch_shrink<class_ViewportContainer_property_stretch_shrink>` set to ``2`` will be rendered at 640×360 while occupying the same size in the container.
+
+**Note:** :ref:`stretch<class_ViewportContainer_property_stretch>` must be ``true`` for this property to work.
+