summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/Animation.xml2
-rw-r--r--doc/classes/OS.xml59
-rw-r--r--doc/classes/UndoRedo.xml29
3 files changed, 62 insertions, 28 deletions
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index d26c0e8605..9720405ffd 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -168,7 +168,7 @@
<argument index="2" name="stream" type="Resource">
</argument>
<description>
- Sets the stream of the key identified by [code]key_idx[/code] to value [code]offset[/code]. The [code]track_idx[/code] must be the index of an Audio Track.
+ Sets the stream of the key identified by [code]key_idx[/code] to value [code]stream[/code]. The [code]track_idx[/code] must be the index of an Audio Track.
</description>
</method>
<method name="bezier_track_get_key_in_handle" qualifiers="const">
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 65a815a603..ed94f9d90f 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -25,6 +25,29 @@
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
</method>
+ <method name="create_process">
+ <return type="int">
+ </return>
+ <argument index="0" name="path" type="String">
+ </argument>
+ <argument index="1" name="arguments" type="PackedStringArray">
+ </argument>
+ <description>
+ Creates a new process that runs independently of Godot. It will not terminate if Godot terminates. The file specified in [code]path[/code] must exist and be executable. Platform path resolution will be used. The [code]arguments[/code] are used in the given order and separated by a space.
+ If the process creation succeeds, the method will return the new process ID, which you can use to monitor the process (and potentially terminate it with [method kill]). If the process creation fails, the method will return [code]-1[/code].
+ For example, running another instance of the project:
+ [codeblocks]
+ [gdscript]
+ var pid = OS.create_process(OS.get_executable_path(), [])
+ [/gdscript]
+ [csharp]
+ var pid = OS.CreateProcess(OS.GetExecutablePath(), new string[] {});
+ [/csharp]
+ [/codeblocks]
+ See [method execute] if you wish to run an external command and retrieve the results.
+ [b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows.
+ </description>
+ </method>
<method name="delay_msec" qualifiers="const">
<return type="void">
</return>
@@ -71,48 +94,34 @@
</argument>
<argument index="1" name="arguments" type="PackedStringArray">
</argument>
- <argument index="2" name="blocking" type="bool" default="true">
- </argument>
- <argument index="3" name="output" type="Array" default="[ ]">
+ <argument index="2" name="output" type="Array" default="[ ]">
</argument>
- <argument index="4" name="read_stderr" type="bool" default="false">
+ <argument index="3" name="read_stderr" type="bool" default="false">
</argument>
<description>
- 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.
- The arguments are used in the given order and separated by a space, so [code]OS.execute("ping", ["-w", "3", "godotengine.org"], false)[/code] will resolve to [code]ping -w 3 godotengine.org[/code] in the system's shell.
- This method has slightly different behavior based on whether the [code]blocking[/code] mode is enabled.
- If [code]blocking[/code] is [code]true[/code], 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 [code]output[/code] array as a single string. When the process terminates, the Godot thread will resume execution.
- If [code]blocking[/code] is [code]false[/code], the Godot thread will continue while the new process runs. It is not possible to retrieve the shell output in non-blocking mode, so [code]output[/code] will be empty.
- The return value also depends on the blocking mode. When blocking, the method will return an exit code of the process. When non-blocking, the method returns a process ID, which you can use to monitor the process (and potentially terminate it with [method kill]). If the process forking (non-blocking) or opening (blocking) fails, the method will return [code]-1[/code] or another exit code.
- Example of blocking mode and retrieving the shell output:
+ Executes a command. The file specified in [code]path[/code] must exist and be executable. Platform path resolution will be used. The [code]arguments[/code] are used in the given order and separated by a space. If an [code]output[/code] [Array] is provided, the complete shell output of the process will be appended as a single [String] element in [code]output[/code]. If [code]read_stderr[/code] is [code]true[/code], the output to the standard error stream will be included too.
+ If the command is successfully executed, the method will return the exit code of the command, or [code]-1[/code] if it fails.
+ [b]Note:[/b] The Godot thread will pause its execution until the executed command terminates. Use [Thread] to create a separate thread that will not pause the Godot thread, or use [method create_process] to create a completely independent process.
+ For example, to retrieve a list of the working directory's contents:
[codeblocks]
[gdscript]
var output = []
- var exit_code = OS.execute("ls", ["-l", "/tmp"], true, output)
+ var exit_code = OS.execute("ls", ["-l", "/tmp"], output)
[/gdscript]
[csharp]
var output = new Godot.Collections.Array();
- int exitCode = OS.Execute("ls", new string[] {"-l", "/tmp"}, true, output);
- [/csharp]
- [/codeblocks]
- Example of non-blocking mode, running another instance of the project and storing its process ID:
- [codeblocks]
- [gdscript]
- var pid = OS.execute(OS.get_executable_path(), [], false)
- [/gdscript]
- [csharp]
- var pid = OS.Execute(OS.GetExecutablePath(), new string[] {}, false);
+ int exitCode = OS.Execute("ls", new string[] {"-l", "/tmp"}, output);
[/csharp]
[/codeblocks]
- If you wish to access a shell built-in or perform a composite command, a platform-specific shell can be invoked. For example:
+ To execute a composite command, a platform-specific shell can be invoked. For example:
[codeblocks]
[gdscript]
var output = []
- OS.execute("CMD.exe", ["/C", "cd %TEMP% &amp;&amp; dir"], true, output)
+ OS.execute("CMD.exe", ["/C", "cd %TEMP% &amp;&amp; dir"], output)
[/gdscript]
[csharp]
var output = new Godot.Collections.Array();
- OS.Execute("CMD.exe", new string[] {"/C", "cd %TEMP% &amp;&amp; dir"}, true, output);
+ OS.Execute("CMD.exe", new string[] {"/C", "cd %TEMP% &amp;&amp; dir"}, output);
[/csharp]
[/codeblocks]
[b]Note:[/b] This method is implemented on Android, iOS, Linux, macOS and Windows.
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml
index 2cc3e974e2..0e4a76a1a9 100644
--- a/doc/classes/UndoRedo.xml
+++ b/doc/classes/UndoRedo.xml
@@ -110,8 +110,10 @@
<method name="commit_action">
<return type="void">
</return>
+ <argument index="0" name="execute" type="bool" default="true">
+ </argument>
<description>
- Commit the action. All "do" methods/properties are called/set when this function is called.
+ Commit the action. If [code]execute[/code] is true (default), all "do" methods/properties are called/set when this function is called.
</description>
</method>
<method name="create_action">
@@ -126,11 +128,34 @@
The way actions are merged is dictated by the [code]merge_mode[/code] argument. See [enum MergeMode] for details.
</description>
</method>
+ <method name="get_action_name">
+ <return type="String">
+ </return>
+ <argument index="0" name="arg0" type="int">
+ </argument>
+ <description>
+ Gets the action name from its index.
+ </description>
+ </method>
+ <method name="get_current_action">
+ <return type="int">
+ </return>
+ <description>
+ Gets the index of the current action.
+ </description>
+ </method>
<method name="get_current_action_name" qualifiers="const">
<return type="String">
</return>
<description>
- Gets the name of the current action.
+ Gets the name of the current action, equivalent to [code]get_action_name(get_current_action())[/code].
+ </description>
+ </method>
+ <method name="get_history_count">
+ <return type="int">
+ </return>
+ <description>
+ Return how many element are in the history.
</description>
</method>
<method name="get_version" qualifiers="const">