Kaynağa Gözat

Sync classref with current source

Rémi Verschelde 7 yıl önce
ebeveyn
işleme
b592ef1e38

+ 2 - 2
classes/class_editorinspectorplugin.rst

@@ -26,7 +26,7 @@ Member Functions
 +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | void                     | :ref:`add_property_editor_for_multiple_properties<class_EditorInspectorPlugin_add_property_editor_for_multiple_properties>` **(** :ref:`String<class_string>` label, :ref:`PoolStringArray<class_poolstringarray>` properties, :ref:`Control<class_control>` editor **)**              |
 +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| void                     | :ref:`can_handle<class_EditorInspectorPlugin_can_handle>` **(** :ref:`Object<class_object>` object **)** virtual                                                                                                                                                                       |
+| :ref:`bool<class_bool>`  | :ref:`can_handle<class_EditorInspectorPlugin_can_handle>` **(** :ref:`Object<class_object>` object **)** virtual                                                                                                                                                                       |
 +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | void                     | :ref:`parse_begin<class_EditorInspectorPlugin_parse_begin>` **(** :ref:`Object<class_object>` object **)** virtual                                                                                                                                                                     |
 +--------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -54,7 +54,7 @@ Member Function Description
 
 .. _class_EditorInspectorPlugin_can_handle:
 
-- void **can_handle** **(** :ref:`Object<class_object>` object **)** virtual
+- :ref:`bool<class_bool>` **can_handle** **(** :ref:`Object<class_object>` object **)** virtual
 
 .. _class_EditorInspectorPlugin_parse_begin:
 

+ 17 - 0
classes/class_multiplayerapi.rst

@@ -91,6 +91,23 @@ Member Variables
 - :ref:`bool<class_bool>` **refuse_new_network_connections** - If ``true`` the MultiplayerAPI's :ref:`network_peer<class_MultiplayerAPI_network_peer>` refuses new incoming connections.
 
 
+Enums
+-----
+
+  .. _enum_MultiplayerAPI_RPCMode:
+
+enum **RPCMode**
+
+- **RPC_MODE_DISABLED** = **0** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
+- **RPC_MODE_REMOTE** = **1** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the ``remote`` keyword. Calls and property changes are accepted from all remote peers, no matter if they are node's master or slaves.
+- **RPC_MODE_SYNC** = **2** --- Behave like constant RPC_MODE_REMOTE but also make the call or property change locally. Analogous to the ``sync`` keyword.
+- **RPC_MODE_MASTER** = **3** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the network master for this node. Analogous to the ``master`` keyword. Only accepts calls or property changes from the node's network slaves, see :ref:`Node.set_network_master<class_Node_set_network_master>`.
+- **RPC_MODE_SLAVE** = **4** --- Used with :ref:`Node.rpc_config<class_Node_rpc_config>` or :ref:`Node.rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on slaves for this node. Analogous to the ``slave`` keyword. Only accepts calls or property changes from the node's network master, see :ref:`Node.set_network_master<class_Node_set_network_master>`.
+- **RPC_MODE_REMOTESYNC** = **5** --- Behave like ``RPC_MODE_REMOTE`` but also make the call or property change locally. Same as constant RPC_MODE_SYNC which is only kept for compatibility. Analogous to the ``remotesync`` keyword.
+- **RPC_MODE_MASTERSYNC** = **6** --- Behave like ``RPC_MODE_MASTER`` but also make the call or property change locally. Analogous to the ``mastersync`` keyword.
+- **RPC_MODE_SLAVESYNC** = **7** --- Behave like ``RPC_MODE_SLAVE`` but also make the call or property change locally. Analogous to the ``slavesync`` keyword.
+
+
 Description
 -----------
 

+ 6 - 16
classes/class_node.rst

@@ -142,7 +142,7 @@ Member Functions
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | :ref:`Variant<class_variant>`      | :ref:`rpc<class_Node_rpc>` **(** :ref:`String<class_string>` method **)** vararg                                                                                                             |
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| void                               | :ref:`rpc_config<class_Node_rpc_config>` **(** :ref:`String<class_string>` method, :ref:`RPCMode<enum_node_rpcmode>` mode **)**                                                              |
+| void                               | :ref:`rpc_config<class_Node_rpc_config>` **(** :ref:`String<class_string>` method, :ref:`RPCMode<enum_multiplayerapi_rpcmode>` mode **)**                                                    |
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | :ref:`Variant<class_variant>`      | :ref:`rpc_id<class_Node_rpc_id>` **(** :ref:`int<class_int>` peer_id, :ref:`String<class_string>` method **)** vararg                                                                        |
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -152,7 +152,7 @@ Member Functions
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | void                               | :ref:`rset<class_Node_rset>` **(** :ref:`String<class_string>` property, :ref:`Variant<class_variant>` value **)**                                                                           |
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| void                               | :ref:`rset_config<class_Node_rset_config>` **(** :ref:`String<class_string>` property, :ref:`RPCMode<enum_node_rpcmode>` mode **)**                                                          |
+| void                               | :ref:`rset_config<class_Node_rset_config>` **(** :ref:`String<class_string>` property, :ref:`RPCMode<enum_multiplayerapi_rpcmode>` mode **)**                                                |
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
 | void                               | :ref:`rset_id<class_Node_rset_id>` **(** :ref:`int<class_int>` peer_id, :ref:`String<class_string>` property, :ref:`Variant<class_variant>` value **)**                                      |
 +------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
@@ -275,16 +275,6 @@ enum **PauseMode**
 - **PAUSE_MODE_STOP** = **1** --- Stop processing when the :ref:`SceneTree<class_scenetree>` is paused.
 - **PAUSE_MODE_PROCESS** = **2** --- Continue to process regardless of the :ref:`SceneTree<class_scenetree>` pause state.
 
-  .. _enum_Node_RPCMode:
-
-enum **RPCMode**
-
-- **RPC_MODE_DISABLED** = **0** --- Used with :ref:`rpc_config<class_Node_rpc_config>` or :ref:`rset_config<class_Node_rset_config>` to disable a method or property for all RPC calls, making it unavailable. Default for all methods.
-- **RPC_MODE_REMOTE** = **1** --- Used with :ref:`rpc_config<class_Node_rpc_config>` or :ref:`rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the remote end, not locally. Analogous to the ``remote`` keyword.
-- **RPC_MODE_SYNC** = **2** --- Used with :ref:`rpc_config<class_Node_rpc_config>` or :ref:`rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed both on the remote end and locally. Analogous to the ``sync`` keyword.
-- **RPC_MODE_MASTER** = **3** --- Used with :ref:`rpc_config<class_Node_rpc_config>` or :ref:`rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on the network master for this node. Analogous to the ``master`` keyword. See :ref:`set_network_master<class_Node_set_network_master>`.
-- **RPC_MODE_SLAVE** = **4** --- Used with :ref:`rpc_config<class_Node_rpc_config>` or :ref:`rset_config<class_Node_rset_config>` to set a method to be called or a property to be changed only on slaves for this node. Analogous to the ``slave`` keyword. See :ref:`set_network_master<class_Node_set_network_master>`.
-
   .. _enum_Node_DuplicateFlags:
 
 enum **DuplicateFlags**
@@ -763,9 +753,9 @@ Sends a remote procedure call request for the given ``method`` to peers on the n
 
 .. _class_Node_rpc_config:
 
-- void **rpc_config** **(** :ref:`String<class_string>` method, :ref:`RPCMode<enum_node_rpcmode>` mode **)**
+- void **rpc_config** **(** :ref:`String<class_string>` method, :ref:`RPCMode<enum_multiplayerapi_rpcmode>` mode **)**
 
-Changes the RPC mode for the given ``method`` to the given ``mode``. See :ref:`RPCMode<enum_@globalscope_rpcmode>`. An alternative is annotating methods and properties with the corresponding keywords (``remote``, ``sync``, ``master``, ``slave``). By default, methods are not exposed to networking (and RPCs). Also see :ref:`rset<class_Node_rset>` and :ref:`rset_config<class_Node_rset_config>` for properties.
+Changes the RPC mode for the given ``method`` to the given ``mode``. See :ref:`RPCMode<enum_multiplayerapi_rpcmode>`. An alternative is annotating methods and properties with the corresponding keywords (``remote``, ``sync``, ``master``, ``slave``). By default, methods are not exposed to networking (and RPCs). Also see :ref:`rset<class_Node_rset>` and :ref:`rset_config<class_Node_rset_config>` for properties.
 
 .. _class_Node_rpc_id:
 
@@ -793,9 +783,9 @@ Remotely changes a property's value on other peers (and locally). Behaviour depe
 
 .. _class_Node_rset_config:
 
-- void **rset_config** **(** :ref:`String<class_string>` property, :ref:`RPCMode<enum_node_rpcmode>` mode **)**
+- void **rset_config** **(** :ref:`String<class_string>` property, :ref:`RPCMode<enum_multiplayerapi_rpcmode>` mode **)**
 
-Changes the RPC mode for the given ``property`` to the given ``mode``. See :ref:`RPCMode<enum_@globalscope_rpcmode>`. An alternative is annotating methods and properties with the corresponding keywords (``remote``, ``sync``, ``master``, ``slave``). By default, properties are not exposed to networking (and RPCs). Also see :ref:`rpc<class_Node_rpc>` and :ref:`rpc_config<class_Node_rpc_config>` for methods.
+Changes the RPC mode for the given ``property`` to the given ``mode``. See :ref:`RPCMode<enum_multiplayerapi_rpcmode>`. An alternative is annotating methods and properties with the corresponding keywords (``remote``, ``sync``, ``master``, ``slave``). By default, properties are not exposed to networking (and RPCs). Also see :ref:`rpc<class_Node_rpc>` and :ref:`rpc_config<class_Node_rpc_config>` for methods.
 
 .. _class_Node_rset_id:
 

+ 22 - 8
classes/class_os.rst

@@ -379,24 +379,36 @@ At the end of the file is a statistic of all used Resource Types.
 
 - :ref:`int<class_int>` **execute** **(** :ref:`String<class_string>` path, :ref:`PoolStringArray<class_poolstringarray>` arguments, :ref:`bool<class_bool>` blocking, :ref:`Array<class_array>` output=[  ] **)**
 
-Execute the file at the given path, optionally blocking until it returns.
+Execute the file at the given path with the arguments passed as an array of strings. Platform path resolution will take place. The resolved file must exist and be executable.
 
-Platform path resolution will take place.  The resolved file must exist and be executable.
+The arguments are used in the given order and separated by a space, so ``OS.execute('ping', ['-c', '3', 'godotengine.org'])`` will resolve to ``ping -c 3 godotengine.org`` in the system's shell.
 
-Returns a process id.
+This method has slightly different behaviour based on whether the ``blocking`` mode is enabled.
 
-For example:
+When ``blocking`` is enabled, the Godot thread will pause its execution while waiting for the process to terminate. The shell output of the process will be written to the ``output`` array as a single string. When the process terminates, the Godot thread will resume execution.
+
+When ``blocking`` is disabled, the Godot thread will continue while the new process runs. It is not possible to retrieve the shell output in non-blocking mode, so ``output`` will be empty.
+
+The return value also depends on the blocking mode. When blocking, the method will return -2 (no process ID information is available in blocking mode). When non-blocking, the method returns a process ID, which you can use to monitor the process (and potentially terminate it with :ref:`kill<class_OS_kill>`). If the process forking (non-blocking) or opening (blocking) fails, the method will return -1.
+
+Example of blocking mode and retrieving the shell output:
 
 ::
 
     var output = []
-    var pid = OS.execute('ls', [], true, output)
+    OS.execute('ls', ['-l', '/tmp'], true, output)
+
+Example of non-blocking mode, running another instance of the project and storing its process ID:
 
-If you wish to access a shell built-in or perform a composite command, a platform specific shell can be invoked.  For example:
+::
+
+    var pid = OS.execute(OS.get_executable_path(), [], false)
+
+If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example:
 
 ::
 
-    var pid = OS.execute('CMD.exe', ['/C', 'cd %TEMP% && dir'], true, output)
+    OS.execute('CMD.exe', ['/C', 'cd %TEMP% && dir'], true, output)
 
 .. _class_OS_find_scancode_from_string:
 
@@ -744,7 +756,9 @@ Returns ``true`` if the window should always be on top of other windows.
 
 - :ref:`Error<enum_@globalscope_error>` **kill** **(** :ref:`int<class_int>` pid **)**
 
-Kill a process ID (this method can be used to kill processes that were not spawned by the game).
+Kill (terminate) the process identified by the given process ID (``pid``), e.g. the one returned by :ref:`execute<class_OS_execute>` in non-blocking mode.
+
+Note that this method can also be used to kill processes that were not spawned by the game.
 
 .. _class_OS_native_video_is_playing: