diff options
Diffstat (limited to 'doc/classes')
64 files changed, 1577 insertions, 281 deletions
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index cbc04ca672..faa380ff33 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -4,7 +4,9 @@ Axis-Aligned Bounding Box. </brief_description> <description> - AABB consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + [AABB] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. + It uses floating-point coordinates. The 2D counterpart to [AABB] is [Rect2]. + [b]Note:[/b] Unlike [Rect2], [AABB] does not have a variant that uses integer coordinates. </description> <tutorials> <link title="Math tutorial index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/AESContext.xml b/doc/classes/AESContext.xml index ff433370bd..f577bab992 100644 --- a/doc/classes/AESContext.xml +++ b/doc/classes/AESContext.xml @@ -5,7 +5,8 @@ </brief_description> <description> This class provides access to AES encryption/decryption of raw data. Both AES-ECB and AES-CBC mode are supported. - [codeblock] + [codeblocks] + [gdscript] extends Node var aes = AESContext.new() @@ -35,7 +36,45 @@ aes.finish() # Check CBC assert(decrypted == data.to_utf8()) - [/codeblock] + [/gdscript] + [csharp] + using Godot; + using System; + using System.Diagnostics; + + public class Example : Node + { + public 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(); + // Decrypt ECB + Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8()); + byte[] decrypted = Aes.Update(encrypted); + Aes.Finish(); + // Check ECB + 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(); + // Decrypt CBC + Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8(), iv.ToUTF8()); + decrypted = Aes.Update(encrypted); + Aes.Finish(); + // Check CBC + Debug.Assert(decrypted == data.ToUTF8()); + } + } + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> diff --git a/doc/classes/AStar.xml b/doc/classes/AStar.xml index 2695e86f47..0cd7d3dc25 100644 --- a/doc/classes/AStar.xml +++ b/doc/classes/AStar.xml @@ -7,7 +7,8 @@ A* (A star) is a computer algorithm that is widely used in pathfinding and graph traversal, the process of plotting short paths among vertices (points), passing through a given set of edges (segments). It enjoys widespread use due to its performance and accuracy. Godot's A* implementation uses points in three-dimensional space and Euclidean distances by default. You must add points manually with [method add_point] and create segments manually with [method connect_points]. Then you can test if there is a path between two points with the [method are_points_connected] function, get a path containing indices by [method get_id_path], or one containing actual coordinates with [method get_point_path]. It is also possible to use non-Euclidean distances. To do so, create a class that extends [code]AStar[/code] and override methods [method _compute_cost] and [method _estimate_cost]. Both take two indices and return a length, as is shown in the following example. - [codeblock] + [codeblocks] + [gdscript] class MyAStar: extends AStar @@ -16,7 +17,21 @@ func _estimate_cost(u, v): return min(0, abs(u - v) - 1) - [/codeblock] + [/gdscript] + [csharp] + public class MyAStar : AStar + { + public override float _ComputeCost(int u, int v) + { + return Mathf.Abs(u - v); + } + public override float _EstimateCost(int u, int v) + { + return Mathf.Min(0, Mathf.Abs(u - v) - 1); + } + } + [/csharp] + [/codeblocks] [method _estimate_cost] should return a lower bound of the distance, i.e. [code]_estimate_cost(u, v) <= _compute_cost(u, v)[/code]. This serves as a hint to the algorithm because the custom [code]_compute_cost[/code] might be computation-heavy. If this is not the case, make [method _estimate_cost] return the same value as [method _compute_cost] to provide the algorithm with the most accurate information. </description> <tutorials> @@ -57,10 +72,16 @@ </argument> <description> Adds a new point at the given position with the given identifier. The algorithm prefers points with lower [code]weight_scale[/code] to form a path. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 1 or larger. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar.new() astar.add_point(1, Vector3(1, 0, 0), 4) # Adds the point (1, 0, 0) with weight_scale 4 and id 1 - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar(); + astar.AddPoint(1, new Vector3(1, 0, 0), 4); // Adds the point (1, 0, 0) with weight_scale 4 and id 1 + [/csharp] + [/codeblocks] If there already exists a point for the given [code]id[/code], its position and weight scale are updated to the given values. </description> </method> @@ -95,12 +116,20 @@ </argument> <description> Creates a segment between the given points. If [code]bidirectional[/code] is [code]false[/code], only movement from [code]id[/code] to [code]to_id[/code] is allowed, not the reverse direction. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar.new() astar.add_point(1, Vector3(1, 1, 0)) astar.add_point(2, Vector3(0, 5, 0)) astar.connect_points(1, 2, false) - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar(); + astar.AddPoint(1, new Vector3(1, 1, 0)); + astar.AddPoint(2, new Vector3(0, 5, 0)); + astar.ConnectPoints(1, 2, false); + [/csharp] + [/codeblocks] </description> </method> <method name="disconnect_points"> @@ -142,13 +171,22 @@ </argument> <description> Returns the closest position to [code]to_position[/code] that resides inside a segment between two connected points. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar.new() astar.add_point(1, Vector3(0, 0, 0)) astar.add_point(2, Vector3(0, 5, 0)) astar.connect_points(1, 2) var res = astar.get_closest_position_in_segment(Vector3(3, 3, 0)) # Returns (0, 3, 0) - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar(); + astar.AddPoint(1, new Vector3(0, 0, 0)); + astar.AddPoint(2, new Vector3(0, 5, 0)); + astar.ConnectPoints(1, 2); + Vector3 res = astar.GetClosestPositionInSegment(new Vector3(3, 3, 0)); // Returns (0, 3, 0) + [/csharp] + [/codeblocks] The result is in the segment that goes from [code]y = 0[/code] to [code]y = 5[/code]. It's the closest position in the segment to the given point. </description> </method> @@ -161,7 +199,8 @@ </argument> <description> Returns an array with the IDs of the points that form the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar.new() astar.add_point(1, Vector3(0, 0, 0)) astar.add_point(2, Vector3(0, 1, 0), 1) # Default weight is 1 @@ -174,7 +213,20 @@ astar.connect_points(1, 4, false) var res = astar.get_id_path(1, 3) # Returns [1, 2, 3] - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar(); + astar.AddPoint(1, new Vector3(0, 0, 0)); + astar.AddPoint(2, new Vector3(0, 1, 0), 1); // Default weight is 1 + astar.AddPoint(3, new Vector3(1, 1, 0)); + astar.AddPoint(4, new Vector3(2, 0, 0)); + astar.ConnectPoints(1, 2, false); + astar.ConnectPoints(2, 3, false); + astar.ConnectPoints(4, 3, false); + astar.ConnectPoints(1, 4, false); + int[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3] + [/csharp] + [/codeblocks] If you change the 2nd point's weight to 3, then the result will be [code][1, 4, 3][/code] instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2. </description> </method> @@ -192,7 +244,8 @@ </argument> <description> Returns an array with the IDs of the points that form the connection with the given point. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar.new() astar.add_point(1, Vector3(0, 0, 0)) astar.add_point(2, Vector3(0, 1, 0)) @@ -203,7 +256,19 @@ astar.connect_points(1, 3, true) var neighbors = astar.get_point_connections(1) # Returns [2, 3] - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar(); + astar.AddPoint(1, new Vector3(0, 0, 0)); + astar.AddPoint(2, new Vector3(0, 1, 0)); + astar.AddPoint(3, new Vector3(1, 1, 0)); + astar.AddPoint(4, new Vector3(2, 0, 0)); + astar.ConnectPoints(1, 2, true); + astar.ConnectPoints(1, 3, true); + + int[] neighbors = astar.GetPointConnections(1); // Returns [2, 3] + [/csharp] + [/codeblocks] </description> </method> <method name="get_point_count" qualifiers="const"> diff --git a/doc/classes/AStar2D.xml b/doc/classes/AStar2D.xml index 622d336ef6..1540d8dacc 100644 --- a/doc/classes/AStar2D.xml +++ b/doc/classes/AStar2D.xml @@ -44,10 +44,16 @@ </argument> <description> Adds a new point at the given position with the given identifier. The algorithm prefers points with lower [code]weight_scale[/code] to form a path. The [code]id[/code] must be 0 or larger, and the [code]weight_scale[/code] must be 1 or larger. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar2D.new() astar.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1 - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar2D(); + astar.AddPoint(1, new Vector2(1, 0), 4); // Adds the point (1, 0) with weight_scale 4 and id 1 + [/csharp] + [/codeblocks] If there already exists a point for the given [code]id[/code], its position and weight scale are updated to the given values. </description> </method> @@ -80,12 +86,20 @@ </argument> <description> Creates a segment between the given points. If [code]bidirectional[/code] is [code]false[/code], only movement from [code]id[/code] to [code]to_id[/code] is allowed, not the reverse direction. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar2D.new() astar.add_point(1, Vector2(1, 1)) astar.add_point(2, Vector2(0, 5)) astar.connect_points(1, 2, false) - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar2D(); + astar.AddPoint(1, new Vector2(1, 1)); + astar.AddPoint(2, new Vector2(0, 5)); + astar.ConnectPoints(1, 2, false); + [/csharp] + [/codeblocks] </description> </method> <method name="disconnect_points"> @@ -125,13 +139,22 @@ </argument> <description> Returns the closest position to [code]to_position[/code] that resides inside a segment between two connected points. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar2D.new() astar.add_point(1, Vector2(0, 0)) astar.add_point(2, Vector2(0, 5)) astar.connect_points(1, 2) var res = astar.get_closest_position_in_segment(Vector2(3, 3)) # Returns (0, 3) - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar2D(); + astar.AddPoint(1, new Vector2(0, 0)); + astar.AddPoint(2, new Vector2(0, 5)); + astar.ConnectPoints(1, 2); + Vector2 res = astar.GetClosestPositionInSegment(new Vector2(3, 3)); // Returns (0, 3) + [/csharp] + [/codeblocks] The result is in the segment that goes from [code]y = 0[/code] to [code]y = 5[/code]. It's the closest position in the segment to the given point. </description> </method> @@ -144,7 +167,8 @@ </argument> <description> Returns an array with the IDs of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar2D.new() astar.add_point(1, Vector2(0, 0)) astar.add_point(2, Vector2(0, 1), 1) # Default weight is 1 @@ -157,7 +181,21 @@ astar.connect_points(1, 4, false) var res = astar.get_id_path(1, 3) # Returns [1, 2, 3] - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar2D(); + astar.AddPoint(1, new Vector2(0, 0)); + astar.AddPoint(2, new Vector2(0, 1), 1); // Default weight is 1 + astar.AddPoint(3, new Vector2(1, 1)); + astar.AddPoint(4, new Vector2(2, 0)); + + astar.ConnectPoints(1, 2, false); + astar.ConnectPoints(2, 3, false); + astar.ConnectPoints(4, 3, false); + astar.ConnectPoints(1, 4, false); + int[] res = astar.GetIdPath(1, 3); // Returns [1, 2, 3] + [/csharp] + [/codeblocks] If you change the 2nd point's weight to 3, then the result will be [code][1, 4, 3][/code] instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2. </description> </method> @@ -175,7 +213,8 @@ </argument> <description> Returns an array with the IDs of the points that form the connection with the given point. - [codeblock] + [codeblocks] + [gdscript] var astar = AStar2D.new() astar.add_point(1, Vector2(0, 0)) astar.add_point(2, Vector2(0, 1)) @@ -186,7 +225,20 @@ astar.connect_points(1, 3, true) var neighbors = astar.get_point_connections(1) # Returns [2, 3] - [/codeblock] + [/gdscript] + [csharp] + var astar = new AStar2D(); + astar.AddPoint(1, new Vector2(0, 0)); + astar.AddPoint(2, new Vector2(0, 1)); + astar.AddPoint(3, new Vector2(1, 1)); + astar.AddPoint(4, new Vector2(2, 0)); + + astar.ConnectPoints(1, 2, true); + astar.ConnectPoints(1, 3, true); + + int[] neighbors = astar.GetPointConnections(1); // Returns [2, 3] + [/csharp] + [/codeblocks] </description> </method> <method name="get_point_count" qualifiers="const"> diff --git a/doc/classes/AcceptDialog.xml b/doc/classes/AcceptDialog.xml index 6b1864b679..e5eb216062 100644 --- a/doc/classes/AcceptDialog.xml +++ b/doc/classes/AcceptDialog.xml @@ -76,6 +76,7 @@ <signals> <signal name="cancelled"> <description> + Emitted when the dialog is closed or the button created with [method add_cancel] is pressed. </description> </signal> <signal name="confirmed"> diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index 0a2925e6d5..9529c60771 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -5,7 +5,8 @@ </brief_description> <description> An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track. - [codeblock] + [codeblocks] + [gdscript] # This creates an animation that makes the node "Enemy" move to the right by # 100 pixels in 0.5 seconds. var animation = Animation.new() @@ -13,7 +14,17 @@ animation.track_set_path(track_index, "Enemy:position:x") animation.track_insert_key(track_index, 0.0, 0) animation.track_insert_key(track_index, 0.5, 100) - [/codeblock] + [/gdscript] + [csharp] + // This creates an animation that makes the node "Enemy" move to the right by + // 100 pixels in 0.5 seconds. + var animation = new Animation(); + int trackIndex = animation.AddTrack(Animation.TrackType.Value); + animation.TrackSetPath(trackIndex, "Enemy:position:x"); + animation.TrackInsertKey(trackIndex, 0.0f, 0); + animation.TrackInsertKey(trackIndex, 0.5f, 100); + [/csharp] + [/codeblocks] Animations are just data containers, and must be added to nodes such as an [AnimationPlayer] to be played back. Animation tracks have different types, each with its own set of dedicated methods. Check [enum TrackType] to see available types. </description> <tutorials> diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml index 9ea83d2c5e..e08e288c59 100644 --- a/doc/classes/AnimationNodeStateMachine.xml +++ b/doc/classes/AnimationNodeStateMachine.xml @@ -6,10 +6,16 @@ <description> Contains multiple nodes representing animation states, connected in a graph. Node transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the [AnimationNodeStateMachinePlayback] object from the [AnimationTree] node to control it programmatically. [b]Example:[/b] - [codeblock] + [codeblocks] + [gdscript] var state_machine = $AnimationTree.get("parameters/playback") state_machine.travel("some_state") - [/codeblock] + [/gdscript] + [csharp] + var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback; + stateMachine.Travel("some_state"); + [/csharp] + [/codeblocks] </description> <tutorials> <link title="AnimationTree">https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html</link> diff --git a/doc/classes/AnimationNodeStateMachinePlayback.xml b/doc/classes/AnimationNodeStateMachinePlayback.xml index fec68d5b74..60ff425cdb 100644 --- a/doc/classes/AnimationNodeStateMachinePlayback.xml +++ b/doc/classes/AnimationNodeStateMachinePlayback.xml @@ -6,10 +6,16 @@ <description> Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. Retrieve with [code]$AnimationTree.get("parameters/playback")[/code]. [b]Example:[/b] - [codeblock] + [codeblocks] + [gdscript] var state_machine = $AnimationTree.get("parameters/playback") state_machine.travel("some_state") - [/codeblock] + [/gdscript] + [csharp] + var stateMachine = GetNode<AnimationTree>("AnimationTree").Get("parameters/playback") as AnimationNodeStateMachinePlayback; + stateMachine.Travel("some_state"); + [/csharp] + [/codeblocks] </description> <tutorials> <link title="AnimationTree">https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html</link> diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index fe0154acad..2f0ebd7de6 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -12,9 +12,14 @@ <members> <member name="advance_condition" type="StringName" setter="set_advance_condition" getter="get_advance_condition" default="@"""> Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the [AnimationTree] that can be controlled from code (see [url=https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code][/url]). For example, if [member AnimationTree.tree_root] is an [AnimationNodeStateMachine] and [member advance_condition] is set to [code]"idle"[/code]: - [codeblock] - $animation_tree["parameters/conditions/idle"] = is_on_floor and (linear_velocity.x == 0) - [/codeblock] + [codeblocks] + [gdscript] + $animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0)) + [/gdscript] + [csharp] + GetNode<AnimationTree>("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.x == 0)); + [/csharp] + [/codeblocks] </member> <member name="auto_advance" type="bool" setter="set_auto_advance" getter="has_auto_advance" default="false"> Turn on the transition automatically when this state is reached. This works best with [constant SWITCH_MODE_AT_END]. diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 20579e0159..87b7443a8a 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -6,20 +6,38 @@ <description> Generic array which can contain several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 the second to last, etc.). [b]Example:[/b] - [codeblock] + [codeblocks] + [gdscript] var array = ["One", 2, 3, "Four"] print(array[0]) # One. print(array[2]) # 3. print(array[-1]) # Four. array[2] = "Three" print(array[-2]) # Three. - [/codeblock] + [/gdscript] + [csharp] + var array = new Godot.Collections.Array{"One", 2, 3, "Four"}; + GD.Print(array[0]); // One. + GD.Print(array[2]); // 3. + GD.Print(array[array.Count - 1]); // Four. + array[2] = "Three"; + GD.Print(array[array.Count - 2]); // Three. + [/csharp] + [/codeblocks] Arrays can be concatenated using the [code]+[/code] operator: - [codeblock] + [codeblocks] + [gdscript] var array1 = ["One", 2] var array2 = [3, "Four"] print(array1 + array2) # ["One", 2, 3, "Four"] - [/codeblock] + [/gdscript] + [csharp] + // Array concatenation is not possible with C# arrays, but is with Godot.Collections.Array. + var array1 = new Godot.Collections.Array("One", 2); + var array2 = new Godot.Collections.Array(3, "Four"); + GD.Print(array1 + array2); // Prints [One, 2, 3, Four] + [/csharp] + [/codeblocks] [b]Note:[/b] Arrays are always passed by reference. To get a copy of an array which can be modified independently of the original array, use [method duplicate]. </description> <tutorials> @@ -228,18 +246,39 @@ </argument> <description> Returns [code]true[/code] if the array contains the given value. - [codeblock] + [codeblocks] + [gdscript] print(["inside", 7].has("inside")) # True print(["inside", 7].has("outside")) # False print(["inside", 7].has(7)) # True print(["inside", 7].has("7")) # False - [/codeblock] + [/gdscript] + [csharp] + 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 + GD.Print(arr.Contains(7)); // True + GD.Print(arr.Contains("7")); // False + [/csharp] + [/codeblocks] + [b]Note:[/b] This is equivalent to using the [code]in[/code] operator as follows: - [codeblock] + [codeblocks] + [gdscript] # Will evaluate to `true`. if 2 in [2, 4, 6, 8]: - pass - [/codeblock] + print("Containes!") + [/gdscript] + [csharp] + // As there is no "in" keyword in C#, you have to use Contains + var array = new Godot.Collections.Array{2, 4, 6, 8}; + if (array.Contains(2)) + { + GD.Print("Containes!"); + } + [/csharp] + [/codeblocks] </description> </method> <method name="hash"> @@ -292,7 +331,7 @@ <return type="Variant"> </return> <description> - Removes and returns the first element of the array. Returns [code]null[/code] if the array is empty, wwithout printing an error message. + Removes and returns the first element of the array. Returns [code]null[/code] if the array is empty, without printing an error message. </description> </method> <method name="push_back"> @@ -377,11 +416,16 @@ <description> Sorts the array. [b]Note:[/b] Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. Consider the following example: - [codeblock] + [codeblocks] + [gdscript] var strings = ["string1", "string2", "string10", "string11"] strings.sort() print(strings) # Prints [string1, string10, string11, string2] - [/codeblock] + [/gdscript] + [csharp] + // There is no sort support for Godot.Collections.Array + [/csharp] + [/codeblocks] </description> </method> <method name="sort_custom"> @@ -394,7 +438,8 @@ <description> Sorts the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return either [code]true[/code] or [code]false[/code]. [b]Note:[/b] you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior. - [codeblock] + [codeblocks] + [gdscript] class MyCustomSorter: static func sort_ascending(a, b): if a[0] < b[0]: @@ -404,7 +449,11 @@ var my_items = [[5, "Potato"], [9, "Rice"], [4, "Tomato"]] my_items.sort_custom(MyCustomSorter, "sort_ascending") print(my_items) # Prints [[4, Tomato], [5, Potato], [9, Rice]]. - [/codeblock] + [/gdscript] + [csharp] + // There is no custom sort support for Godot.Collections.Array + [/csharp] + [/codeblocks] </description> </method> </methods> diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 4ec39ecc2f..4edf69ccb2 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -6,21 +6,42 @@ <description> The [ArrayMesh] is used to construct a [Mesh] by specifying the attributes as arrays. The most basic example is the creation of a single triangle: - [codeblock] + [codeblocks] + [gdscript] var vertices = PackedVector3Array() vertices.push_back(Vector3(0, 1, 0)) vertices.push_back(Vector3(1, 0, 0)) vertices.push_back(Vector3(0, 0, 1)) + # Initialize the ArrayMesh. var arr_mesh = ArrayMesh.new() var arrays = [] arrays.resize(ArrayMesh.ARRAY_MAX) arrays[ArrayMesh.ARRAY_VERTEX] = vertices + # Create the Mesh. arr_mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arrays) var m = MeshInstance3D.new() m.mesh = arr_mesh - [/codeblock] + [/gdscript] + [csharp] + var vertices = new Godot.Collections.Array<Vector3>(); + vertices.Add(new Vector3(0, 1, 0)); + vertices.Add(new Vector3(1, 0, 0)); + vertices.Add(new Vector3(0, 0, 1)); + + // Initialize the ArrayMesh. + var arrMesh = new ArrayMesh(); + var arrays = new Godot.Collections.Array(); + arrays.Resize((int)ArrayMesh.ArrayType.Max); + arrays[(int)ArrayMesh.ArrayType.Vertex] = vertices; + + // Create the Mesh. + arrMesh.AddSurfaceFromArrays(Mesh.PrimitiveType.Triangles, arrays); + var m = new MeshInstance(); + m.Mesh = arrMesh; + [/csharp] + [/codeblocks] The [MeshInstance3D] is ready to be added to the [SceneTree] to be shown. See also [ImmediateGeometry3D], [MeshDataTool] and [SurfaceTool] for procedural geometry generation. [b]Note:[/b] Godot uses clockwise [url=https://learnopengl.com/Advanced-OpenGL/Face-culling]winding order[/url] for front faces of triangle primitive modes. diff --git a/doc/classes/AudioEffectDistortion.xml b/doc/classes/AudioEffectDistortion.xml index 3cfeaadb23..24a145b0f3 100644 --- a/doc/classes/AudioEffectDistortion.xml +++ b/doc/classes/AudioEffectDistortion.xml @@ -2,13 +2,14 @@ <class name="AudioEffectDistortion" inherits="AudioEffect" version="4.0"> <brief_description> Adds a distortion audio effect to an Audio bus. - Modify the sound to make it dirty. + Modify the sound to make it distorted. </brief_description> <description> - Modify the sound and make it dirty. Different types are available: clip, tan, lo-fi (bit crushing), overdrive, or waveshape. + Different types are available: clip, tan, lo-fi (bit crushing), overdrive, or waveshape. By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently. </description> <tutorials> + <link title="Audio buses">https://docs.godotengine.org/en/latest/tutorials/audio/audio_buses.html</link> </tutorials> <methods> </methods> diff --git a/doc/classes/AudioEffectFilter.xml b/doc/classes/AudioEffectFilter.xml index f548fb49cc..293848d204 100644 --- a/doc/classes/AudioEffectFilter.xml +++ b/doc/classes/AudioEffectFilter.xml @@ -7,6 +7,7 @@ Allows frequencies other than the [member cutoff_hz] to pass. </description> <tutorials> + <link title="Audio buses">https://docs.godotengine.org/en/latest/tutorials/audio/audio_buses.html</link> </tutorials> <methods> </methods> @@ -20,7 +21,7 @@ Gain amount of the frequencies after the filter. </member> <member name="resonance" type="float" setter="set_resonance" getter="get_resonance" default="0.5"> - Amount of boost in the overtones near the cutoff frequency. + Amount of boost in the frequency range near the cutoff frequency. </member> </members> <constants> diff --git a/doc/classes/AudioEffectHighShelfFilter.xml b/doc/classes/AudioEffectHighShelfFilter.xml index cf620e4417..4ba31f9fc8 100644 --- a/doc/classes/AudioEffectHighShelfFilter.xml +++ b/doc/classes/AudioEffectHighShelfFilter.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectHighShelfFilter" inherits="AudioEffectFilter" version="4.0"> <brief_description> + Reduces all frequencies above the [member AudioEffectFilter.cutoff_hz]. </brief_description> <description> </description> <tutorials> + <link title="Audio buses">https://docs.godotengine.org/en/latest/tutorials/audio/audio_buses.html</link> </tutorials> <methods> </methods> diff --git a/doc/classes/AudioEffectLowShelfFilter.xml b/doc/classes/AudioEffectLowShelfFilter.xml index 7cf09b0f05..078e7bf1a1 100644 --- a/doc/classes/AudioEffectLowShelfFilter.xml +++ b/doc/classes/AudioEffectLowShelfFilter.xml @@ -1,10 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="AudioEffectLowShelfFilter" inherits="AudioEffectFilter" version="4.0"> <brief_description> + Reduces all frequencies below the [member AudioEffectFilter.cutoff_hz]. </brief_description> <description> </description> <tutorials> + <link title="Audio buses">https://docs.godotengine.org/en/latest/tutorials/audio/audio_buses.html</link> </tutorials> <methods> </methods> diff --git a/doc/classes/Button.xml b/doc/classes/Button.xml index de05cfcd13..e0ccda957f 100644 --- a/doc/classes/Button.xml +++ b/doc/classes/Button.xml @@ -6,7 +6,8 @@ <description> Button is the standard themed button. It can contain text and an icon, and will display them according to the current [Theme]. [b]Example of creating a button and assigning an action when pressed by code:[/b] - [codeblock] + [codeblocks] + [gdscript] func _ready(): var button = Button.new() button.text = "Click me" @@ -15,8 +16,24 @@ func _button_pressed(): print("Hello world!") - [/codeblock] + [/gdscript] + [csharp] + public override void _Ready() + { + var button = new Button(); + button.Text = "Click me"; + button.Connect("pressed", this, nameof(ButtonPressed)); + AddChild(button); + } + + private void ButtonPressed() + { + GD.Print("Hello world!"); + } + [/csharp] + [/codeblocks] Buttons (like all Control nodes) can also be created in the editor, but some situations may require creating them from code. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 3cc74beb58..3bbee993ac 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -6,15 +6,32 @@ <description> [Callable] is a first class object which can be held in variables and passed to functions. It represents a given method in an [Object], and is typically used for signal callbacks. [b]Example:[/b] - [codeblock] + [codeblocks] + [gdscript] var callable = Callable(self, "print_args") func print_args(arg1, arg2, arg3 = ""): prints(arg1, arg2, arg3) + func test(): callable.call("hello", "world") # Prints "hello world". callable.call(Vector2.UP, 42, callable) # Prints "(0, -1) 42 Node(Node.gd)::print_args". callable.call("invalid") # Invalid call, should have at least 2 arguments. - [/codeblock] + [/gdscript] + [csharp] + Callable callable = new Callable(this, "print_args"); + public void PrintArgs(object arg1, object arg2, object arg3 = "") + { + GD.PrintS(arg1, arg2, arg3); + } + + public void Test() + { + callable.Call("hello", "world"); // Prints "hello world". + callable.Call(Vector2.Up, 42, callable); // Prints "(0, -1) 42 Node(Node.gd)::print_args". + callable.Call("invalid"); // Invalid call, should have at least 2 arguments. + } + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index 0eecada4fe..946c4f8988 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -318,13 +318,22 @@ <description> Draws [code]text[/code] using the specified [code]font[/code] at the [code]position[/code] (top-left corner). The text will have its color multiplied by [code]modulate[/code]. If [code]clip_w[/code] is greater than or equal to 0, the text will be clipped if it exceeds the specified width. [b]Example using the default project font:[/b] - [codeblock] + [codeblocks] + [gdscript] # If using this method in a script that redraws constantly, move the # `default_font` declaration to a member variable assigned in `_ready()` # so the Control is only created once. var default_font = Control.new().get_font("font") draw_string(default_font, Vector2(64, 64), "Hello world") - [/codeblock] + [/gdscript] + [csharp] + // If using this method in a script that redraws constantly, move the + // `default_font` declaration to a member variable assigned in `_ready()` + // so the Control is only created once. + Font defaultFont = new Control().GetFont("font"); + DrawString(defaultFont, new Vector2(64, 64), "Hello world"); + [/csharp] + [/codeblocks] See also [method Font.draw]. </description> </method> diff --git a/doc/classes/CharFXTransform.xml b/doc/classes/CharFXTransform.xml index a988035c36..d1759adf30 100644 --- a/doc/classes/CharFXTransform.xml +++ b/doc/classes/CharFXTransform.xml @@ -18,11 +18,18 @@ </member> <member name="character" type="int" setter="set_character" getter="get_character" default="0"> The Unicode codepoint the character will use. This only affects non-whitespace characters. [method @GDScript.ord] can be useful here. For example, the following will replace all characters with asterisks: - [codeblock] + [codeblocks] + [gdscript] # `char_fx` is the CharFXTransform parameter from `_process_custom_fx()`. # See the RichTextEffect documentation for details. char_fx.character = ord("*") - [/codeblock] + [/gdscript] + [csharp] + // `char_fx` is the CharFXTransform parameter from `_process_custom_fx()`. + // See the RichTextEffect documentation for details. + charFx.Character = char.GetNumericValue('*'); + [/csharp] + [/codeblocks] </member> <member name="color" type="Color" setter="set_color" getter="get_color" default="Color( 0, 0, 0, 1 )"> The color the character will be drawn with. diff --git a/doc/classes/CheckBox.xml b/doc/classes/CheckBox.xml index 9c42091eb8..f912bb98c9 100644 --- a/doc/classes/CheckBox.xml +++ b/doc/classes/CheckBox.xml @@ -5,6 +5,7 @@ </brief_description> <description> A checkbox allows the user to make a binary choice (choosing only one of two possible options). It's similar to [CheckButton] in functionality, but it has a different appearance. To follow established UX patterns, it's recommended to use CheckBox when toggling it has [b]no[/b] immediate effect on something. For instance, it should be used when toggling it will only do something once a confirmation button is pressed. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/CheckButton.xml b/doc/classes/CheckButton.xml index 514ff9a691..b4f91cf3a8 100644 --- a/doc/classes/CheckButton.xml +++ b/doc/classes/CheckButton.xml @@ -5,6 +5,7 @@ </brief_description> <description> CheckButton is a toggle button displayed as a check field. It's similar to [CheckBox] in functionality, but it has a different appearance. To follow established UX patterns, it's recommended to use CheckButton when toggling it has an [b]immediate[/b] effect on something. For instance, it should be used if toggling it enables/disables a setting without requiring the user to press a confirmation button. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/CodeEdit.xml b/doc/classes/CodeEdit.xml new file mode 100644 index 0000000000..f6bc9e2cca --- /dev/null +++ b/doc/classes/CodeEdit.xml @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="CodeEdit" inherits="TextEdit" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + <method name="clear_bookmarked_lines"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="clear_breakpointed_lines"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="clear_executing_lines"> + <return type="void"> + </return> + <description> + </description> + </method> + <method name="get_bookmarked_lines" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> + <method name="get_breakpointed_lines" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> + <method name="get_executing_lines" qualifiers="const"> + <return type="Array"> + </return> + <description> + </description> + </method> + <method name="is_line_bookmarked" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_line_breakpointed" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_line_executing" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <description> + </description> + </method> + <method name="set_line_as_bookmarked"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="bookmarked" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_line_as_breakpoint"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="breakpointed" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_line_as_executing"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="executing" type="bool"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="draw_bookmarks" type="bool" setter="set_draw_bookmarks_gutter" getter="is_drawing_bookmarks_gutter" default="false"> + </member> + <member name="draw_breakpoints_gutter" type="bool" setter="set_draw_breakpoints_gutter" getter="is_drawing_breakpoints_gutter" default="false"> + </member> + <member name="draw_executing_lines" type="bool" setter="set_draw_executing_lines_gutter" getter="is_drawing_executing_lines_gutter" default="false"> + </member> + <member name="draw_fold_gutter" type="bool" setter="set_draw_fold_gutter" getter="is_drawing_fold_gutter" default="false"> + </member> + <member name="draw_line_numbers" type="bool" setter="set_draw_line_numbers" getter="is_draw_line_numbers_enabled" default="false"> + </member> + <member name="zero_pad_line_numbers" type="bool" setter="set_line_numbers_zero_padded" getter="is_line_numbers_zero_padded" default="false"> + </member> + </members> + <signals> + <signal name="breakpoint_toggled"> + <argument index="0" name="line" type="int"> + </argument> + <description> + </description> + </signal> + </signals> + <constants> + </constants> + <theme_items> + <theme_item name="background_color" type="Color" default="Color( 0, 0, 0, 0 )"> + </theme_item> + <theme_item name="bookmark" type="Texture2D"> + </theme_item> + <theme_item name="bookmark_color" type="Color" default="Color( 0.5, 0.64, 1, 0.8 )"> + </theme_item> + <theme_item name="brace_mismatch_color" type="Color" default="Color( 1, 0.2, 0.2, 1 )"> + </theme_item> + <theme_item name="breakpoint" type="Texture2D"> + </theme_item> + <theme_item name="breakpoint_color" type="Color" default="Color( 0.9, 0.29, 0.3, 1 )"> + </theme_item> + <theme_item name="can_fold" type="Texture2D"> + </theme_item> + <theme_item name="caret_background_color" type="Color" default="Color( 0, 0, 0, 1 )"> + </theme_item> + <theme_item name="caret_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )"> + </theme_item> + <theme_item name="code_folding_color" type="Color" default="Color( 0.8, 0.8, 0.8, 0.8 )"> + </theme_item> + <theme_item name="completion" type="StyleBox"> + </theme_item> + <theme_item name="completion_background_color" type="Color" default="Color( 0.17, 0.16, 0.2, 1 )"> + </theme_item> + <theme_item name="completion_existing_color" type="Color" default="Color( 0.87, 0.87, 0.87, 0.13 )"> + </theme_item> + <theme_item name="completion_font_color" type="Color" default="Color( 0.67, 0.67, 0.67, 1 )"> + </theme_item> + <theme_item name="completion_lines" type="int" default="7"> + </theme_item> + <theme_item name="completion_max_width" type="int" default="50"> + </theme_item> + <theme_item name="completion_scroll_color" type="Color" default="Color( 1, 1, 1, 1 )"> + </theme_item> + <theme_item name="completion_scroll_width" type="int" default="3"> + </theme_item> + <theme_item name="completion_selected_color" type="Color" default="Color( 0.26, 0.26, 0.27, 1 )"> + </theme_item> + <theme_item name="current_line_color" type="Color" default="Color( 0.25, 0.25, 0.26, 0.8 )"> + </theme_item> + <theme_item name="executing_line" type="Texture2D"> + </theme_item> + <theme_item name="executing_line_color" type="Color" default="Color( 0.98, 0.89, 0.27, 1 )"> + </theme_item> + <theme_item name="focus" type="StyleBox"> + </theme_item> + <theme_item name="folded" type="Texture2D"> + </theme_item> + <theme_item name="font" type="Font"> + </theme_item> + <theme_item name="font_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )"> + </theme_item> + <theme_item name="font_color_readonly" type="Color" default="Color( 0.88, 0.88, 0.88, 0.5 )"> + </theme_item> + <theme_item name="font_color_selected" type="Color" default="Color( 0, 0, 0, 1 )"> + </theme_item> + <theme_item name="line_number_color" type="Color" default="Color( 0.67, 0.67, 0.67, 0.4 )"> + </theme_item> + <theme_item name="line_spacing" type="int" default="4"> + </theme_item> + <theme_item name="mark_color" type="Color" default="Color( 1, 0.4, 0.4, 0.4 )"> + </theme_item> + <theme_item name="normal" type="StyleBox"> + </theme_item> + <theme_item name="read_only" type="StyleBox"> + </theme_item> + <theme_item name="safe_line_number_color" type="Color" default="Color( 0.67, 0.78, 0.67, 0.6 )"> + </theme_item> + <theme_item name="selection_color" type="Color" default="Color( 0.49, 0.49, 0.49, 1 )"> + </theme_item> + <theme_item name="space" type="Texture2D"> + </theme_item> + <theme_item name="tab" type="Texture2D"> + </theme_item> + <theme_item name="word_highlighted_color" type="Color" default="Color( 0.8, 0.9, 0.9, 0.15 )"> + </theme_item> + </theme_items> +</class> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index fcaba99eb7..1d249a253c 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -8,6 +8,7 @@ You can also create a color from standardized color names by using [method @GDScript.ColorN] or directly using the color constants defined here. The standardized color set is based on the [url=https://en.wikipedia.org/wiki/X11_color_names]X11 color names[/url]. If you want to supply values in a range of 0 to 255, you should use [method @GDScript.Color8]. [b]Note:[/b] In a boolean context, a Color will evaluate to [code]false[/code] if it's equal to [code]Color(0, 0, 0, 1)[/code] (opaque black). Otherwise, a Color will always evaluate to [code]true[/code]. + [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/color_constants.png]Color constants cheatsheet[/url] </description> <tutorials> </tutorials> @@ -19,21 +20,39 @@ </argument> <description> Constructs a color from an HTML hexadecimal color string in RGB or RGBA format. See also [method @GDScript.ColorN]. - [codeblock] + [codeblocks] + [gdscript] # Each of the following creates the same color RGBA(178, 217, 10, 255). var c3 = Color("#b2d90a") # RGB format with "#". var c4 = Color("b2d90a") # RGB format. var c1 = Color("#b2d90aff") # RGBA format with "#". var c2 = Color("b2d90aff") # RGBA format. - [/codeblock] + [/gdscript] + [csharp] + // Each of the following creates the same color RGBA(178, 217, 10, 255). + var c3 = new Color("#b2d90a"); + var c4 = new Color("b2d90a"); // RGB format. + var c1 = new Color("#b2d90aff"); + var c2 = new Color("b2d90aff"); // RGBA format. + [/csharp] + [/codeblocks] You can also use the "web color" short-hand form by only using 3 or 4 digits. - [codeblock] + [codeblocks] + [gdscript] # Each of the following creates the same color RGBA(17, 34, 51, 255). var c3 = Color("#123") # RGB format with "#". var c4 = Color("123") # RGB format. var c1 = Color("#123f") # RGBA format with "#". var c2 = Color("123f") # RGBA format. - [/codeblock] + [/gdscript] + [csharp] + // Each of the following creates the same color RGBA(17, 34, 51, 255). + var c3 = new Color("#123"); + var c4 = new Color("123"); // RGB format. + var c1 = new Color("#123f"); + var c2 = new Color("123f"); // RGBA format. + [/csharp] + [/codeblocks] </description> </method> <method name="Color"> @@ -43,9 +62,14 @@ </argument> <description> Constructs a color from a 32-bit integer (each byte represents a component of the RGBA profile). - [codeblock] + [codeblocks] + [gdscript] var c = Color(274) # Equivalent to RGBA(0, 0, 1, 18) - [/codeblock] + [/gdscript] + [csharp] + var c = new Color(274); // Equivalent to RGBA(0, 0, 1, 18) + [/csharp] + [/codeblocks] </description> </method> <method name="Color"> @@ -57,9 +81,14 @@ </argument> <description> Constructs a color from an existing color, but with a custom alpha value. - [codeblock] + [codeblocks] + [gdscript] var red = Color(Color.red, 0.5) # 50% transparent red. - [/codeblock] + [/gdscript] + [csharp] + var red = new Color(Colors.Red, 0.5f); // 50% transparent red. + [/csharp] + [/codeblocks] </description> </method> <method name="Color"> @@ -73,9 +102,14 @@ </argument> <description> Constructs a color from an RGB profile using values between 0 and 1. Alpha will always be 1. - [codeblock] - var c = Color(0.2, 1.0, 0.7) # Equivalent to RGBA(51, 255, 178, 255) - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(0.2, 1.0, 0.7) # Equivalent to RGBA(51, 255, 178, 255) + [/gdscript] + [csharp] + var color = new Color(0.2f, 1.0f, 0.7f); // Equivalent to RGBA(51, 255, 178, 255) + [/csharp] + [/codeblocks] </description> </method> <method name="Color"> @@ -91,9 +125,14 @@ </argument> <description> Constructs a color from an RGBA profile using values between 0 and 1. - [codeblock] - var c = Color(0.2, 1.0, 0.7, 0.8) # Equivalent to RGBA(51, 255, 178, 204) - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(0.2, 1.0, 0.7, 0.8) # Equivalent to RGBA(51, 255, 178, 204) + [/gdscript] + [csharp] + var color = new Color(0.2f, 1.0f, 0.7f, 0.8f); // Equivalent to RGBA(51, 255, 178, 255, 204) + [/csharp] + [/codeblocks] </description> </method> <method name="blend"> @@ -103,11 +142,18 @@ </argument> <description> Returns a new color resulting from blending this color over another. If the color is opaque, the result is also opaque. The second color may have a range of alpha values. - [codeblock] + [codeblocks] + [gdscript] var bg = Color(0.0, 1.0, 0.0, 0.5) # Green with alpha of 50% var fg = Color(1.0, 0.0, 0.0, 0.5) # Red with alpha of 50% var blended_color = bg.blend(fg) # Brown with alpha of 75% - [/codeblock] + [/gdscript] + [csharp] + var bg = new Color(0.0f, 1.0f, 0.0f, 0.5f); // Green with alpha of 50% + var fg = new Color(1.0f, 0.0f, 0.0f, 0.5f); // Red with alpha of 50% + Color blendedColor = bg.Blend(fg); // Brown with alpha of 75% + [/csharp] + [/codeblocks] </description> </method> <method name="contrasted"> @@ -115,10 +161,16 @@ </return> <description> Returns the most contrasting color. - [codeblock] - var c = Color(0.3, 0.4, 0.9) - var contrasted_color = c.contrasted() # Equivalent to RGBA(204, 229, 102, 255) - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(0.3, 0.4, 0.9) + var contrasted_color = color.contrasted() # Equivalent to RGBA(204, 229, 102, 255) + [/gdscript] + [csharp] + var color = new Color(0.3f, 0.4f, 0.9f); + Color contrastedColor = color.Contrasted(); // Equivalent to RGBA(204, 229, 102, 255) + [/csharp] + [/codeblocks] </description> </method> <method name="darkened"> @@ -128,10 +180,16 @@ </argument> <description> Returns a new color resulting from making this color darker by the specified percentage (ratio from 0 to 1). - [codeblock] + [codeblocks] + [gdscript] var green = Color(0.0, 1.0, 0.0) var darkgreen = green.darkened(0.2) # 20% darker than regular green - [/codeblock] + [/gdscript] + [csharp] + var green = new Color(0.0f, 1.0f, 0.0f); + Color darkgreen = green.Darkened(0.2f); // 20% darker than regular green + [/csharp] + [/codeblocks] </description> </method> <method name="from_hsv"> @@ -147,9 +205,14 @@ </argument> <description> Constructs a color from an HSV profile. [code]h[/code], [code]s[/code], and [code]v[/code] are values between 0 and 1. - [codeblock] - var c = Color.from_hsv(0.58, 0.5, 0.79, 0.8) # Equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8) - [/codeblock] + [codeblocks] + [gdscript] + var color = Color.from_hsv(0.58, 0.5, 0.79, 0.8) # Equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8) + [/gdscript] + [csharp] + Color color = Color.FromHsv(0.58f, 0.5f, 0.79f, 0.8f); // Equivalent to HSV(210, 50, 79, 0.8) or Color8(100, 151, 201, 0.8) + [/csharp] + [/codeblocks] </description> </method> <method name="inverted"> @@ -157,10 +220,16 @@ </return> <description> Returns the inverted color [code](1 - r, 1 - g, 1 - b, a)[/code]. - [codeblock] - var c = Color(0.3, 0.4, 0.9) - var inverted_color = c.inverted() # A color of an RGBA(178, 153, 26, 255) - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(0.3, 0.4, 0.9) + var inverted_color = color.inverted() # A color of an RGBA(178, 153, 26, 255) + [/gdscript] + [csharp] + var color = new Color(0.3f, 0.4f, 0.9f); + Color invertedColor = color.Inverted(); // A color of an RGBA(178, 153, 26, 255) + [/csharp] + [/codeblocks] </description> </method> <method name="is_equal_approx"> @@ -181,11 +250,18 @@ </argument> <description> Returns the linear interpolation with another color. The interpolation factor [code]t[/code] is between 0 and 1. - [codeblock] + [codeblocks] + [gdscript] var c1 = Color(1.0, 0.0, 0.0) var c2 = Color(0.0, 1.0, 0.0) - var li_c = c1.lerp(c2, 0.5) # A color of an RGBA(128, 128, 0, 255) - [/codeblock] + var lerp_color = c1.lerp(c2, 0.5) # A color of an RGBA(128, 128, 0, 255) + [/gdscript] + [csharp] + var c1 = new Color(1.0f, 0.0f, 0.0f); + var c2 = new Color(0.0f, 1.0f, 0.0f); + Color lerpColor = c1.Lerp(c2, 0.5f); // A color of an RGBA(128, 128, 0, 255) + [/csharp] + [/codeblocks] </description> </method> <method name="lightened"> @@ -195,10 +271,16 @@ </argument> <description> Returns a new color resulting from making this color lighter by the specified percentage (ratio from 0 to 1). - [codeblock] + [codeblocks] + [gdscript] var green = Color(0.0, 1.0, 0.0) var lightgreen = green.lightened(0.2) # 20% lighter than regular green - [/codeblock] + [/gdscript] + [csharp] + var green = new Color(0.0f, 1.0f, 0.0f); + Color lightgreen = green.Lightened(0.2f); // 20% lighter than regular green + [/csharp] + [/codeblocks] </description> </method> <method name="to_abgr32"> @@ -206,10 +288,16 @@ </return> <description> Returns the color's 32-bit integer in ABGR format (each byte represents a component of the ABGR profile). ABGR is the reversed version of the default format. - [codeblock] - var c = Color(1, 0.5, 0.2) - print(c.to_abgr32()) # Prints 4281565439 - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 0.5, 0.2) + print(color.to_abgr32()) # Prints 4281565439 + [/gdscript] + [csharp] + var color = new Color(1.0f, 0.5f, 0.2f); + GD.Print(color.ToAbgr32()); // Prints 4281565439 + [/csharp] + [/codeblocks] </description> </method> <method name="to_abgr64"> @@ -217,10 +305,16 @@ </return> <description> Returns the color's 64-bit integer in ABGR format (each word represents a component of the ABGR profile). ABGR is the reversed version of the default format. - [codeblock] - var c = Color(1, 0.5, 0.2) - print(c.to_abgr64()) # Prints -225178692812801 - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 0.5, 0.2) + print(color.to_abgr64()) # Prints -225178692812801 + [/gdscript] + [csharp] + var color = new Color(1.0f, 0.5f, 0.2f); + GD.Print(color.ToAbgr64()); // Prints -225178692812801 + [/csharp] + [/codeblocks] </description> </method> <method name="to_argb32"> @@ -228,10 +322,16 @@ </return> <description> Returns the color's 32-bit integer in ARGB format (each byte represents a component of the ARGB profile). ARGB is more compatible with DirectX. - [codeblock] - var c = Color(1, 0.5, 0.2) - print(c.to_argb32()) # Prints 4294934323 - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 0.5, 0.2) + print(color.to_argb32()) # Prints 4294934323 + [/gdscript] + [csharp] + var color = new Color(1.0f, 0.5f, 0.2f); + GD.Print(color.ToArgb32()); // Prints 4294934323 + [/csharp] + [/codeblocks] </description> </method> <method name="to_argb64"> @@ -239,10 +339,16 @@ </return> <description> Returns the color's 64-bit integer in ARGB format (each word represents a component of the ARGB profile). ARGB is more compatible with DirectX. - [codeblock] - var c = Color(1, 0.5, 0.2) - print(c.to_argb64()) # Prints -2147470541 - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 0.5, 0.2) + print(color.to_argb64()) # Prints -2147470541 + [/gdscript] + [csharp] + var color = new Color(1.0f, 0.5f, 0.2f); + GD.Print(color.ToArgb64()); // Prints -2147470541 + [/csharp] + [/codeblocks] </description> </method> <method name="to_html"> @@ -253,11 +359,18 @@ <description> Returns the color's HTML hexadecimal color string in RGBA format (ex: [code]ff34f822[/code]). Setting [code]with_alpha[/code] to [code]false[/code] excludes alpha from the hexadecimal string (and uses RGB instead of RGBA format). - [codeblock] - var c = Color(1, 1, 1, 0.5) - var s1 = c.to_html() # Returns "ffffff7f" - var s2 = c.to_html(false) # Returns "ffffff" - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 1, 1, 0.5) + var with_alpha = color.to_html() # Returns "ffffff7f" + var without_alpha = color.to_html(false) # Returns "ffffff" + [/gdscript] + [csharp] + var color = new Color(1, 1, 1, 0.5f); + String withAlpha = color.ToHtml(); // Returns "ffffff7f" + String withoutAlpha = color.ToHtml(false); // Returns "ffffff" + [/csharp] + [/codeblocks] </description> </method> <method name="to_rgba32"> @@ -265,10 +378,16 @@ </return> <description> Returns the color's 32-bit integer in RGBA format (each byte represents a component of the RGBA profile). RGBA is Godot's default format. - [codeblock] - var c = Color(1, 0.5, 0.2) - print(c.to_rgba32()) # Prints 4286526463 - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 0.5, 0.2) + print(color.to_rgba32()) # Prints 4286526463 + [/gdscript] + [csharp] + var color = new Color(1, 0.5f, 0.2f); + GD.Print(color.ToRgba32()); // Prints 4286526463 + [/csharp] + [/codeblocks] </description> </method> <method name="to_rgba64"> @@ -276,10 +395,16 @@ </return> <description> Returns the color's 64-bit integer in RGBA format (each word represents a component of the RGBA profile). RGBA is Godot's default format. - [codeblock] - var c = Color(1, 0.5, 0.2) - print(c.to_rgba64()) # Prints -140736629309441 - [/codeblock] + [codeblocks] + [gdscript] + var color = Color(1, 0.5, 0.2) + print(color.to_rgba64()) # Prints -140736629309441 + [/gdscript] + [csharp] + var color = new Color(1, 0.5f, 0.2f); + GD.Print(color.ToRgba64()); // Prints -140736629309441 + [/csharp] + [/codeblocks] </description> </method> </methods> diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 67f64c8a66..36f7880060 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -5,6 +5,7 @@ </brief_description> <description> Encapsulates a [ColorPicker] making it accessible by pressing a button. Pressing the button will toggle the [ColorPicker] visibility. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/ColorRect.xml b/doc/classes/ColorRect.xml index 92f42b6dd3..9bfcf5071d 100644 --- a/doc/classes/ColorRect.xml +++ b/doc/classes/ColorRect.xml @@ -13,9 +13,14 @@ <members> <member name="color" type="Color" setter="set_frame_color" getter="get_frame_color" default="Color( 1, 1, 1, 1 )"> The fill color. - [codeblock] + [codeblocks] + [gdscript] $ColorRect.color = Color(1, 0, 0, 1) # Set ColorRect's color to red. - [/codeblock] + [/gdscript] + [csharp] + GetNode<ColorRect>("ColorRect").Color = new Color(1, 0, 0, 1); // Set ColorRect's color to red. + [/csharp] + [/codeblocks] </member> </members> <constants> diff --git a/doc/classes/ConfigFile.xml b/doc/classes/ConfigFile.xml index 522d484131..da17d993e3 100644 --- a/doc/classes/ConfigFile.xml +++ b/doc/classes/ConfigFile.xml @@ -13,7 +13,8 @@ [/codeblock] The stored data can be saved to or parsed from a file, though ConfigFile objects can also be used directly without accessing the filesystem. The following example shows how to parse an INI-style file from the system, read its contents and store new values in it: - [codeblock] + [codeblocks] + [gdscript] var config = ConfigFile.new() var err = config.load("user://settings.cfg") if err == OK: # If not, something went wrong with the file loading @@ -24,7 +25,24 @@ config.set_value("audio", "mute", false) # Save the changes by overwriting the previous file config.save("user://settings.cfg") - [/codeblock] + [/gdscript] + [csharp] + var config = new ConfigFile(); + Error err = config.Load("user://settings.cfg"); + if (err == Error.Ok) // If not, something went wrong with the file loading + { + // Look for the display/width pair, and default to 1024 if missing + int screenWidth = (int)config.GetValue("display", "width", 1024); + // Store a variable if and only if it hasn't been defined yet + if (!config.HasSectionKey("audio", "mute")) + { + config.SetValue("audio", "mute", false); + } + // Save the changes by overwriting the previous file + config.Save("user://settings.cfg"); + } + [/csharp] + [/codeblocks] Keep in mind that section and property names can't contain spaces. Anything after a space will be ignored on save and on load. ConfigFiles can also contain manually written comment lines starting with a semicolon ([code];[/code]). Those lines will be ignored when parsing the file. Note that comments will be lost when saving the ConfigFile. This can still be useful for dedicated server configuration files, which are typically never overwritten without explicit user action. </description> diff --git a/doc/classes/ConfirmationDialog.xml b/doc/classes/ConfirmationDialog.xml index 6d5871508b..a850afdd9f 100644 --- a/doc/classes/ConfirmationDialog.xml +++ b/doc/classes/ConfirmationDialog.xml @@ -6,9 +6,14 @@ <description> Dialog for confirmation of actions. This dialog inherits from [AcceptDialog], but has by default an OK and Cancel button (in host OS order). To get cancel action, you can use: - [codeblock] + [codeblocks] + [gdscript] get_cancel().connect("pressed", self, "cancelled") - [/codeblock]. + [/gdscript] + [csharp] + GetCancel().Connect("pressed", this, nameof(Cancelled)); + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index c8e37d7d7b..bb00ac33bf 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -44,12 +44,27 @@ <description> Virtual method to be implemented by the user. Use this method to process and accept inputs on UI elements. See [method accept_event]. Example: clicking a control. - [codeblock] + [codeblocks] + [gdscript] func _gui_input(event): if event is InputEventMouseButton: if event.button_index == BUTTON_LEFT and event.pressed: print("I've been clicked D:") - [/codeblock] + [/gdscript] + [csharp] + public override void _GuiInput(InputEvent @event) + { + if (@event is InputEventMouseButton) + { + var mb = @event as InputEventMouseButton; + if (mb.ButtonIndex == (int)ButtonList.Left && mb.Pressed) + { + GD.Print("I've been clicked D:"); + } + } + } + [/csharp] + [/codeblocks] The event won't trigger if: * clicking outside the control (see [method has_point]); * control has [member mouse_filter] set to [constant MOUSE_FILTER_IGNORE]; @@ -68,19 +83,39 @@ The returned node must be of type [Control] or Control-derieved. It can have child nodes of any type. It is freed when the tooltip disappears, so make sure you always provide a new instance, not e.g. a node from scene. When [code]null[/code] or non-Control node is returned, the default tooltip will be used instead. [b]Note:[/b] The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its [member rect_min_size] to some non-zero value. Example of usage with custom-constructed node: - [codeblock] + [codeblocks] + [gdscript] func _make_custom_tooltip(for_text): var label = Label.new() label.text = for_text return label - [/codeblock] + [/gdscript] + [csharp] + public override Godot.Object _MakeCustomTooltip(String forText) + { + var label = new Label(); + label.Text = forText; + return label; + } + [/csharp] + [/codeblocks] Example of usage with custom scene instance: - [codeblock] + [codeblocks] + [gdscript] func _make_custom_tooltip(for_text): var tooltip = preload("SomeTooltipScene.tscn").instance() tooltip.get_node("Label").text = for_text return tooltip - [/codeblock] + [/gdscript] + [csharp] + public override Godot.Object _MakeCustomTooltip(String forText) + { + Node tooltip = ResourceLoader.Load<PackedScene>("SomeTooltipScene.tscn").Instance(); + tooltip.GetNode<Label>("Label").Text = forText; + return tooltip; + } + [/csharp] + [/codeblocks] </description> </method> <method name="accept_event"> @@ -101,14 +136,22 @@ Overrides the [Color] with given [code]name[/code] in the [member theme] resource the control uses. [b]Note:[/b] Unlike other theme overrides, there is no way to undo a color override without manually assigning the previous color. [b]Example of overriding a label's color and resetting it later:[/b] - [codeblock] + [codeblocks] + [gdscript] # Override the child node "MyLabel"'s font color to orange. $MyLabel.add_theme_color_override("font_color", Color(1, 0.5, 0)) - # Reset the color by creating a new node to get the default value: var default_label_color = Label.new().get_theme_color("font_color") $MyLabel.add_theme_color_override("font_color", default_label_color) - [/codeblock] + [/gdscript] + [csharp] + // Override the child node "MyLabel"'s font color to orange. + GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0)); + // Reset the color by creating a new node to get the default value: + var defaultLabelColor = new Label().GetThemeColor("font_color"); + GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", defaultLabelColor); + [/csharp] + [/codeblocks] </description> </method> <method name="add_theme_constant_override"> @@ -165,7 +208,8 @@ <description> Overrides the [StyleBox] with given [code]name[/code] in the [member theme] resource the control uses. If [code]stylebox[/code] is empty or invalid, the override is cleared and the [StyleBox] from assigned [Theme] is used. [b]Example of modifying a property in a StyleBox by duplicating it:[/b] - [codeblock] + [codeblocks] + [gdscript] # The snippet below assumes the child node MyButton has a StyleBoxFlat assigned. # Resources are shared across instances, so we need to duplicate it # to avoid modifying the appearance of all other buttons. @@ -173,10 +217,21 @@ new_stylebox_normal.border_width_top = 3 new_stylebox_normal.border_color = Color(0, 1, 0.5) $MyButton.add_theme_stylebox_override("normal", new_stylebox_normal) - # Remove the stylebox override: $MyButton.add_theme_stylebox_override("normal", null) - [/codeblock] + [/gdscript] + [csharp] + // The snippet below assumes the child node MyButton has a StyleBoxFlat assigned. + // Resources are shared across instances, so we need to duplicate it + // to avoid modifying the appearance of all other buttons. + StyleBoxFlat newStyleboxNormal = GetNode<Button>("MyButton").GetThemeStylebox("normal").Duplicate() as StyleBoxFlat; + newStyleboxNormal.BorderWidthTop = 3; + newStyleboxNormal.BorderColor = new Color(0, 1, 0.5f); + GetNode<Button>("MyButton").AddThemeStyleboxOverride("normal", newStyleboxNormal); + // Remove the stylebox override: + GetNode<Button>("MyButton").AddThemeStyleboxOverride("normal", null); + [/csharp] + [/codeblocks] </description> </method> <method name="can_drop_data" qualifiers="virtual"> @@ -189,12 +244,22 @@ <description> Godot calls this method to test if [code]data[/code] from a control's [method get_drag_data] can be dropped at [code]position[/code]. [code]position[/code] is local to this control. This method should only be used to test the data. Process the data in [method drop_data]. - [codeblock] + [codeblocks] + [gdscript] func can_drop_data(position, data): # Check position if it is relevant to you # Otherwise, just check data return typeof(data) == TYPE_DICTIONARY and data.has("expected") - [/codeblock] + [/gdscript] + [csharp] + public override bool CanDropData(Vector2 position, object 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"); + } + [/csharp] + [/codeblocks] </description> </method> <method name="drop_data" qualifiers="virtual"> @@ -206,13 +271,24 @@ </argument> <description> Godot calls this method to pass you the [code]data[/code] from a control's [method get_drag_data] result. Godot first calls [method can_drop_data] to test if [code]data[/code] is allowed to drop at [code]position[/code] where [code]position[/code] is local to this control. - [codeblock] + [codeblocks] + [gdscript] func can_drop_data(position, data): return typeof(data) == TYPE_DICTIONARY and data.has("color") - func drop_data(position, data): - color = data["color"] - [/codeblock] + var color = data["color"] + [/gdscript] + [csharp] + public override bool CanDropData(Vector2 position, object data) + { + return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("color"); + } + public override void DropData(Vector2 position, object data) + { + Color color = (Color)(data as Godot.Collections.Dictionary)["color"]; + } + [/csharp] + [/codeblocks] </description> </method> <method name="force_drag"> @@ -267,12 +343,22 @@ <description> Godot calls this method to get data that can be dragged and dropped onto controls that expect drop data. Returns [code]null[/code] if there is no data to drag. Controls that want to receive drop data should implement [method can_drop_data] and [method drop_data]. [code]position[/code] is local to this control. Drag may be forced with [method force_drag]. A preview that will follow the mouse that should represent the data can be set with [method set_drag_preview]. A good time to set the preview is in this method. - [codeblock] + [codeblocks] + [gdscript] func get_drag_data(position): - var mydata = make_data() - set_drag_preview(make_preview(mydata)) + var mydata = make_data() # This is your custom method generating the drag data. + set_drag_preview(make_preview(mydata)) # This is your custom method generating the preview of the drag data. return mydata - [/codeblock] + [/gdscript] + [csharp] + public override object GetDragData(Vector2 position) + { + 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; + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_end" qualifiers="const"> @@ -358,10 +444,18 @@ </argument> <description> Returns a color from assigned [Theme] with given [code]name[/code] and associated with [Control] of given [code]type[/code]. - [codeblock] + [codeblocks] + [gdscript] func _ready(): modulate = get_theme_color("font_color", "Button") #get the color defined for button fonts - [/codeblock] + [/gdscript] + [csharp] + public override void _Ready() + { + Modulate = GetThemeColor("font_color", "Button"); //get the color defined for button fonts + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_theme_constant" qualifiers="const"> @@ -422,10 +516,18 @@ </return> <description> Creates an [InputEventMouseButton] that attempts to click the control. If the event is received, the control acquires focus. - [codeblock] + [codeblocks] + [gdscript] func _process(delta): grab_click_focus() #when clicking another Control node, this node will be clicked instead - [/codeblock] + [/gdscript] + [csharp] + public override void _Process(float delta) + { + GrabClickFocus(); //when clicking another Control node, this node will be clicked instead + } + [/csharp] + [/codeblocks] </description> </method> <method name="grab_focus"> @@ -652,24 +754,61 @@ Forwarding can be implemented in the target control similar to the methods [method get_drag_data], [method can_drop_data], and [method drop_data] but with two differences: 1. The function name must be suffixed with [b]_fw[/b] 2. The function must take an extra argument that is the control doing the forwarding - [codeblock] + [codeblocks] + [gdscript] # ThisControl.gd extends Control + export(Control) var target_control + func _ready(): set_drag_forwarding(target_control) # TargetControl.gd extends Control + func can_drop_data_fw(position, data, from_control): return true func drop_data_fw(position, data, from_control): - my_handle_data(data) + my_handle_data(data) # Your handler method. func get_drag_data_fw(position, from_control): set_drag_preview(my_preview) return my_data() - [/codeblock] + [/gdscript] + [csharp] + // ThisControl.cs + public class ThisControl : Control + { + [Export] + public Control TargetControl { get; set; } + public override void _Ready() + { + SetDragForwarding(TargetControl); + } + } + + // TargetControl.cs + public class TargetControl : Control + { + public void CanDropDataFw(Vector2 position, object data, Control fromControl) + { + return true; + } + + public void DropDataFw(Vector2 position, object data, Control fromControl) + { + MyHandleData(data); // Your handler method. + } + + public void GetDragDataFw(Vector2 position, Control fromControl) + { + SetDragPreview(MyPreview); + return MyData(); + } + } + [/csharp] + [/codeblocks] </description> </method> <method name="set_drag_preview"> @@ -679,7 +818,8 @@ </argument> <description> Shows the given control at the mouse pointer. A good time to call this method is in [method get_drag_data]. The control must not be in the scene tree. - [codeblock] + [codeblocks] + [gdscript] export (Color, RGBA) var color = Color(1, 0, 0, 1) func get_drag_data(position): @@ -689,7 +829,22 @@ cpb.rect_size = Vector2(50, 50) set_drag_preview(cpb) return color - [/codeblock] + [/gdscript] + [csharp] + [Export] + public Color Color = new Color(1, 0, 0, 1); + + public override object GetDragData(Vector2 position) + { + // Use a control that is not in the tree + var cpb = new ColorPickerButton(); + cpb.Color = Color; + cpb.RectSize = new Vector2(50, 50); + SetDragPreview(cpb); + return Color; + } + [/csharp] + [/codeblocks] </description> </method> <method name="set_end"> diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml index 4edb3eda0a..b3bbbae94f 100644 --- a/doc/classes/Crypto.xml +++ b/doc/classes/Crypto.xml @@ -6,13 +6,12 @@ <description> The Crypto class allows you to access some more advanced cryptographic functionalities in Godot. For now, this includes generating cryptographically secure random bytes, RSA keys and self-signed X509 certificates generation, asymmetric key encryption/decryption, and signing/verification. - [codeblock] + [codeblocks] + [gdscript] extends Node - var crypto = Crypto.new() var key = CryptoKey.new() var cert = X509Certificate.new() - func _ready(): # Generate new RSA key. key = crypto.generate_rsa(4096) @@ -33,7 +32,42 @@ # Checks assert(verified) assert(data.to_utf8() == decrypted) - [/codeblock] + [/gdscript] + [csharp] + using Godot; + using System; + using System.Diagnostics; + + public class CryptoNode : Node + { + public Crypto Crypto = new Crypto(); + public CryptoKey Key = new CryptoKey(); + public X509Certificate Cert = new X509Certificate(); + public override void _Ready() + { + // Generate new RSA key. + Key = Crypto.GenerateRsa(4096); + // Generate new self-signed certificate with the given key. + Cert = Crypto.GenerateSelfSignedCertificate(Key, "CN=mydomain.com,O=My Game Company,C=IT"); + // Save key and certificate in the user folder. + Key.Save("user://generated.key"); + Cert.Save("user://generated.crt"); + // Encryption + string data = "Some data"; + byte[] encrypted = Crypto.Encrypt(Key, data.ToUTF8()); + // Decryption + byte[] decrypted = Crypto.Decrypt(Key, encrypted); + // Signing + byte[] signature = Crypto.Sign(HashingContext.HashType.Sha256, Data.SHA256Buffer(), Key); + // Verifying + bool verified = Crypto.Verify(HashingContext.HashType.Sha256, Data.SHA256Buffer(), signature, Key); + // Checks + Debug.Assert(verified); + Debug.Assert(data.ToUTF8() == decrypted); + } + } + [/csharp] + [/codeblocks] [b]Note:[/b] Not available in HTML5 exports. </description> <tutorials> @@ -95,13 +129,22 @@ <description> Generates a self-signed [X509Certificate] from the given [CryptoKey] and [code]issuer_name[/code]. The certificate validity will be defined by [code]not_before[/code] and [code]not_after[/code] (first valid date and last valid date). The [code]issuer_name[/code] must contain at least "CN=" (common name, i.e. the domain name), "O=" (organization, i.e. your company name), "C=" (country, i.e. 2 lettered ISO-3166 code of the country the organization is based in). A small example to generate an RSA key and a X509 self-signed certificate. - [codeblock] + [codeblocks] + [gdscript] var crypto = Crypto.new() # Generate 4096 bits RSA key. var key = crypto.generate_rsa(4096) # Generate self-signed certificate using the given key. var cert = crypto.generate_self_signed_certificate(key, "CN=example.com,O=A Game Company,C=IT") - [/codeblock] + [/gdscript] + [csharp] + var crypto = new Crypto(); + // Generate 4096 bits RSA key. + CryptoKey key = crypto.GenerateRsa(4096); + // Generate self-signed certificate using the given key. + X509Certificate cert = crypto.GenerateSelfSignedCertificate(key, "CN=mydomain.com,O=My Game Company,C=IT"); + [/csharp] + [/codeblocks] </description> </method> <method name="sign"> diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 814c232668..28194587ab 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -901,6 +901,30 @@ <description> </description> </method> + <method name="window_set_mouse_passthrough"> + <return type="void"> + </return> + <argument index="0" name="region" type="PackedVector2Array"> + </argument> + <argument index="1" name="window_id" type="int" default="0"> + </argument> + <description> + Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through. + Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior). + [codeblock] + # Set region, using Path2D node. + DisplayServer.window_set_mouse_passthrough($Path2D.curve.get_baked_points()) + + # Set region, using Polygon2D node. + DisplayServer.window_set_mouse_passthrough($Polygon2D.polygon) + + # Reset region to default. + DisplayServer.window_set_mouse_passthrough([]) + [/codeblock] + [b]Note:[/b] On Windows, the portion of a window that lies outside the region is not drawn, while on Linux and macOS it is. + [b]Note:[/b] This method is implemented on Linux, macOS and Windows. + </description> + </method> <method name="window_set_position"> <return type="void"> </return> diff --git a/doc/classes/File.xml b/doc/classes/File.xml index 1982406993..f1b9106d35 100644 --- a/doc/classes/File.xml +++ b/doc/classes/File.xml @@ -21,6 +21,7 @@ return content [/codeblock] In the example above, the file will be saved in the user data folder as specified in the [url=https://docs.godotengine.org/en/latest/tutorials/io/data_paths.html]Data paths[/url] documentation. + [b]Note:[/b] To access project resources once exported, it is recommended to use [ResourceLoader] instead of the [File] API, as some files are converted to engine-specific formats and their original source files might not be present in the exported PCK package. </description> <tutorials> <link title="File system">https://docs.godotengine.org/en/latest/getting_started/step_by_step/filesystem.html</link> @@ -48,7 +49,7 @@ </argument> <description> Returns [code]true[/code] if the file exists in the given path. - [b]Note:[/b] Many resources types are imported (e.g. textures or sound files), and that their source asset will not be included in the exported game, as only the imported version is used (in the [code]res://.import[/code] folder). To check for the existence of such resources while taking into account the remapping to their imported location, use [method ResourceLoader.exists]. Typically, using [code]File.file_exists[/code] on an imported resource would work while you are developing in the editor (the source asset is present in [code]res://[/code], but fail when exported). + [b]Note:[/b] Many resources types are imported (e.g. textures or sound files), and their source asset will not be included in the exported game, as only the imported version is used. See [method ResourceLoader.exists] for an alternative approach that takes resource remapping into account. </description> </method> <method name="get_16" qualifiers="const"> diff --git a/doc/classes/GPUParticles3D.xml b/doc/classes/GPUParticles3D.xml index 3fc9e73ccf..8444610f49 100644 --- a/doc/classes/GPUParticles3D.xml +++ b/doc/classes/GPUParticles3D.xml @@ -18,6 +18,22 @@ Returns the axis-aligned bounding box that contains all the particles that are active in the current frame. </description> </method> + <method name="emit_particle"> + <return type="void"> + </return> + <argument index="0" name="xform" type="Transform"> + </argument> + <argument index="1" name="velocity" type="Vector3"> + </argument> + <argument index="2" name="color" type="Color"> + </argument> + <argument index="3" name="custom" type="Color"> + </argument> + <argument index="4" name="flags" type="int"> + </argument> + <description> + </description> + </method> <method name="get_draw_pass_mesh" qualifiers="const"> <return type="Mesh"> </return> @@ -101,6 +117,8 @@ <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> Speed scaling ratio. A value of [code]0[/code] can be used to pause the particles. </member> + <member name="sub_emitter" type="NodePath" setter="set_sub_emitter" getter="get_sub_emitter" default="NodePath("")"> + </member> <member name="visibility_aabb" type="AABB" setter="set_visibility_aabb" getter="get_visibility_aabb" default="AABB( -4, -4, -4, 8, 8, 8 )"> The [AABB] that determines the area of the world part of which needs to be visible on screen for the particle system to be active. </member> @@ -115,6 +133,16 @@ <constant name="DRAW_ORDER_VIEW_DEPTH" value="2" enum="DrawOrder"> Particles are drawn in order of depth. </constant> + <constant name="EMIT_FLAG_POSITION" value="1" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_ROTATION_SCALE" value="2" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_VELOCITY" value="4" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_COLOR" value="8" enum="EmitFlags"> + </constant> + <constant name="EMIT_FLAG_CUSTOM" value="16" enum="EmitFlags"> + </constant> <constant name="MAX_DRAW_PASSES" value="4"> Maximum number of draw passes supported. </constant> diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 2ba2249d21..8cc7ecfbe3 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -135,7 +135,7 @@ </argument> <argument index="3" name="method" type="int" enum="HTTPClient.Method" default="0"> </argument> - <argument index="4" name="request_data_raw" type="PackedByteArray" default="PackedByteArray()"> + <argument index="4" name="request_data_raw" type="PackedByteArray" default="PackedByteArray( )"> </argument> <description> Creates request on the underlying [HTTPClient] using a raw array of bytes for the request body. If there is no configuration errors, it tries to connect using [method HTTPClient.connect_to_host] and passes parameters onto [method HTTPClient.request]. @@ -144,6 +144,12 @@ </method> </methods> <members> + <member name="accept_gzip" type="bool" setter="set_accept_gzip" getter="is_accepting_gzip" default="true"> + If [code]true[/code], this header will be added to each request: [code]Accept-Encoding: gzip, deflate[/code] telling servers that it's okay to compress response bodies. + Any Response body declaring a [code]Content-Encoding[/code] of either [code]gzip[/code] or [code]deflate[/code] will then be automatically decompressed, and the uncompressed bytes will be delivered via [code]request_completed[/code]. + If the user has specified their own [code]Accept-Encoding[/code] header, then no header will be added regaurdless of [code]accept_gzip[/code]. + If [code]false[/code] no header will be added, and no decompression will be performed on response bodies. The raw bytes of the response body will be returned via [code]request_completed[/code]. + </member> <member name="body_size_limit" type="int" setter="set_body_size_limit" getter="get_body_size_limit" default="-1"> Maximum allowed size for response bodies. If the response body is compressed, this will be used as the maximum allowed size for the decompressed body. </member> @@ -162,12 +168,6 @@ <member name="use_threads" type="bool" setter="set_use_threads" getter="is_using_threads" default="false"> If [code]true[/code], multithreading is used to improve performance. </member> - <member name="accept_gzip" type="bool" setter="set_accept_gzip" getter="is_accepting_gzip" default="true"> - If [code]true[/code], this header will be added to each request: [code]Accept-Encoding: gzip, deflate[/code] telling servers that it's okay to compress response bodies. - Any Reponse body declaring a [code]Content-Encoding[/code] of either [code]gzip[/code] or [code]deflate[/code] will then be automatically decompressed, and the uncompressed bytes will be delivered via [code]request_completed[/code]. - If the user has specified their own [code]Accept-Encoding[/code] header, then no header will be added regaurdless of [code]accept_gzip[/code]. - If [code]false[/code] no header will be added, and no decompression will be performed on response bodies. The raw bytes of the response body will be returned via [code]request_completed[/code]. - </member> </members> <signals> <signal name="request_completed"> @@ -208,19 +208,21 @@ <constant name="RESULT_BODY_SIZE_LIMIT_EXCEEDED" value="7" enum="Result"> Request exceeded its maximum size limit, see [member body_size_limit]. </constant> - <constant name="RESULT_REQUEST_FAILED" value="8" enum="Result"> + <constant name="RESULT_BODY_DECOMPRESS_FAILED" value="8" enum="Result"> + </constant> + <constant name="RESULT_REQUEST_FAILED" value="9" enum="Result"> Request failed (currently unused). </constant> - <constant name="RESULT_DOWNLOAD_FILE_CANT_OPEN" value="9" enum="Result"> + <constant name="RESULT_DOWNLOAD_FILE_CANT_OPEN" value="10" enum="Result"> HTTPRequest couldn't open the download file. </constant> - <constant name="RESULT_DOWNLOAD_FILE_WRITE_ERROR" value="10" enum="Result"> + <constant name="RESULT_DOWNLOAD_FILE_WRITE_ERROR" value="11" enum="Result"> HTTPRequest couldn't write to the download file. </constant> - <constant name="RESULT_REDIRECT_LIMIT_REACHED" value="11" enum="Result"> + <constant name="RESULT_REDIRECT_LIMIT_REACHED" value="12" enum="Result"> Request reached its maximum redirect limit, see [member max_redirects]. </constant> - <constant name="RESULT_TIMEOUT" value="12" enum="Result"> + <constant name="RESULT_TIMEOUT" value="13" enum="Result"> </constant> </constants> </class> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 5aa5de1dae..20be20db34 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -233,7 +233,7 @@ <return type="PackedByteArray"> </return> <description> - Returns the image's raw data. + Returns a copy of the image's raw data. </description> </method> <method name="get_format" qualifiers="const"> diff --git a/doc/classes/ImageTexture3D.xml b/doc/classes/ImageTexture3D.xml new file mode 100644 index 0000000000..d05082487d --- /dev/null +++ b/doc/classes/ImageTexture3D.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ImageTexture3D" inherits="Texture3D" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + <method name="create"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="format" type="int" enum="Image.Format"> + </argument> + <argument index="1" name="width" type="int"> + </argument> + <argument index="2" name="height" type="int"> + </argument> + <argument index="3" name="depth" type="int"> + </argument> + <argument index="4" name="use_mipmaps" type="bool"> + </argument> + <argument index="5" name="data" type="Image[]"> + </argument> + <description> + </description> + </method> + <method name="update"> + <return type="void"> + </return> + <argument index="0" name="data" type="Image[]"> + </argument> + <description> + </description> + </method> + </methods> + <constants> + </constants> +</class> diff --git a/doc/classes/JavaScript.xml b/doc/classes/JavaScript.xml index d2cb558385..c707a72ee8 100644 --- a/doc/classes/JavaScript.xml +++ b/doc/classes/JavaScript.xml @@ -5,6 +5,7 @@ </brief_description> <description> The JavaScript singleton is implemented only in the HTML5 export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. + [b]Note:[/b] This singleton can be disabled at build-time to improve security. By default, the JavaScript singleton is enabled. Official export templates also have the JavaScript singleton enabled. See [url=https://docs.godotengine.org/en/latest/development/compiling/compiling_for_web.html]Compiling for the Web[/url] in the documentation for more information. </description> <tutorials> <link title="Exporting for the Web: Calling JavaScript from script">https://docs.godotengine.org/en/latest/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script</link> diff --git a/doc/classes/LinkButton.xml b/doc/classes/LinkButton.xml index 13d3355da5..fed936cc2f 100644 --- a/doc/classes/LinkButton.xml +++ b/doc/classes/LinkButton.xml @@ -5,6 +5,7 @@ </brief_description> <description> This kind of button is primarily used when the interaction with the button causes a context change (like linking to a web page). + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/MenuButton.xml b/doc/classes/MenuButton.xml index 316315f777..cf1fdb5ba6 100644 --- a/doc/classes/MenuButton.xml +++ b/doc/classes/MenuButton.xml @@ -6,6 +6,7 @@ <description> Special button that brings up a [PopupMenu] when clicked. New items can be created inside this [PopupMenu] using [code]get_popup().add_item("My Item Name")[/code]. You can also create them directly from the editor. To do so, select the [MenuButton] node, then in the toolbar at the top of the 2D editor, click [b]Items[/b] then click [b]Add[/b] in the popup. You will be able to give each items new properties. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index 367099e455..1efa72a2b2 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -44,7 +44,7 @@ <return type="AABB"> </return> <description> - Returns the smallest [AABB] enclosing this mesh. Not affected by [code]custom_aabb[/code]. + Returns the smallest [AABB] enclosing this mesh in local space. Not affected by [code]custom_aabb[/code]. See also [method VisualInstance3D.get_transformed_aabb]. [b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh]. </description> </method> diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml index 8a6c560cdd..e1b3ffa2e4 100644 --- a/doc/classes/MultiMesh.xml +++ b/doc/classes/MultiMesh.xml @@ -18,7 +18,7 @@ <return type="AABB"> </return> <description> - Returns the visibility axis-aligned bounding box. + Returns the visibility axis-aligned bounding box in local space. See also [method VisualInstance3D.get_transformed_aabb]. </description> </method> <method name="get_instance_color" qualifiers="const"> diff --git a/doc/classes/NavigationMesh.xml b/doc/classes/NavigationMesh.xml index 6deca4394f..a2fa31bf65 100644 --- a/doc/classes/NavigationMesh.xml +++ b/doc/classes/NavigationMesh.xml @@ -80,14 +80,17 @@ <member name="agent/height" type="float" setter="set_agent_height" getter="get_agent_height" default="2.0"> </member> <member name="agent/max_climb" type="float" setter="set_agent_max_climb" getter="get_agent_max_climb" default="0.9"> + The maximum height difference between two areas for navigation to be generated between them. </member> <member name="agent/max_slope" type="float" setter="set_agent_max_slope" getter="get_agent_max_slope" default="45.0"> + The maximum angle a slope can be at for navigation to be generated on it. </member> <member name="agent/radius" type="float" setter="set_agent_radius" getter="get_agent_radius" default="0.6"> </member> <member name="cell/height" type="float" setter="set_cell_height" getter="get_cell_height" default="0.2"> </member> <member name="cell/size" type="float" setter="set_cell_size" getter="get_cell_size" default="0.3"> + The size of cells in the [NavigationMesh]. </member> <member name="detail/sample_distance" type="float" setter="set_detail_sample_distance" getter="get_detail_sample_distance" default="6.0"> </member> @@ -104,18 +107,25 @@ <member name="filter/low_hanging_obstacles" type="bool" setter="set_filter_low_hanging_obstacles" getter="get_filter_low_hanging_obstacles" default="false"> </member> <member name="geometry/collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask"> + The physics layers used to generate the [NavigationMesh]. </member> <member name="geometry/parsed_geometry_type" type="int" setter="set_parsed_geometry_type" getter="get_parsed_geometry_type" default="0"> + What kind of geomerty is used to generate the [NavigationMesh]. </member> <member name="geometry/source_geometry_mode" type="int" setter="set_source_geometry_mode" getter="get_source_geometry_mode" default="0"> + Which geometry is used to generate the [NavigationMesh]. </member> <member name="geometry/source_group_name" type="StringName" setter="set_source_group_name" getter="get_source_group_name"> + The name of the group that is used to generate the [NavigationMesh]. </member> <member name="polygon/verts_per_poly" type="float" setter="set_verts_per_poly" getter="get_verts_per_poly" default="6.0"> + The number of vertices to use per polygon. Higher values will improve performance at the cost of lower precision. </member> <member name="region/merge_size" type="float" setter="set_region_merge_size" getter="get_region_merge_size" default="20.0"> + If two adjacent regions' edges are separated by a distance lower than this value, the regions will be merged together. </member> <member name="region/min_size" type="float" setter="set_region_min_size" getter="get_region_min_size" default="8.0"> + The minimum size of a region for it to be created. </member> <member name="sample_partition_type/sample_partition_type" type="int" setter="set_sample_partition_type" getter="get_sample_partition_type" default="0"> </member> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index b342fc0813..1548800901 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -525,7 +525,7 @@ ┠╴Menu ┃ ┠╴Label ┃ ┖╴Camera2D - ┖-SplashScreen + ┖╴SplashScreen ┖╴Camera2D [/codeblock] </description> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 2395ccd211..50d91c7943 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -395,7 +395,7 @@ <argument index="0" name="name" type="String"> </argument> <description> - Removes a given entry from the object's metadata. + Removes a given entry from the object's metadata. See also [method set_meta]. </description> </method> <method name="set"> @@ -464,7 +464,8 @@ <argument index="1" name="value" type="Variant"> </argument> <description> - Adds or changes a given entry in the object's metadata. Metadata are serialized, and can take any [Variant] value. + Adds, changes or removes a given entry in the object's metadata. Metadata are serialized and can take any [Variant] value. + To remove a given entry from the object's metadata, use [method remove_meta]. Metadata is also removed if its value is set to [code]null[/code]. This means you can also use [code]set_meta("name", null)[/code] to remove metadata for [code]"name"[/code]. </description> </method> <method name="set_script"> diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 8c4bbd6716..510f952fea 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -5,6 +5,7 @@ </brief_description> <description> OptionButton is a type button that provides a selectable list of items when pressed. The item selected becomes the "current" item and is displayed as the button text. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index 7bfc502fbb..0b43522bce 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -60,15 +60,14 @@ <method name="decompress_dynamic"> <return type="PackedByteArray"> </return> - <argument index="0" name="max_output_size" type="int" default="0"> + <argument index="0" name="max_output_size" type="int"> </argument> <argument index="1" name="compression_mode" type="int" default="0"> </argument> <description> Returns a new [PackedByteArray] with the data decompressed. Set the compression mode using one of [enum File.CompressionMode]'s constants. [b]This method only accepts gzip and deflate compression modes.[/b] - This method is potentially slower than [code]decompress[/code], as it may have to re-allocate it's output buffer multiple times while decompressing, where as [code]decompress[/code] knows it's output buffer size from the begining. - - GZIP has a maximal compression ratio of 1032:1, meaning it's very possible for a small compressed payload to decompress to a potentially very large output. To guard against this, you may provide a maximum size this function is allowed to allocate in bytes via [code]max_output_size[/code]. Passing -1 will allow for unbounded output. If any positive value is passed, and the decompression exceeds that ammount in bytes, then an error will be returned. + This method is potentially slower than [code]decompress[/code], as it may have to re-allocate it's output buffer multiple times while decompressing, where as [code]decompress[/code] knows it's output buffer size from the beginning. + GZIP has a maximal compression ratio of 1032:1, meaning it's very possible for a small compressed payload to decompress to a potentially very large output. To guard against this, you may provide a maximum size this function is allowed to allocate in bytes via [code]max_output_size[/code]. Passing -1 will allow for unbounded output. If any positive value is passed, and the decompression exceeds that amount in bytes, then an error will be returned. </description> </method> <method name="empty"> @@ -89,21 +88,21 @@ <return type="String"> </return> <description> - Converts UTF-16 encoded array to [String]. If the BOM is missing, system endianness is assumed. Returns empty string if source array is not vaild UTF-16 string. + Converts UTF-16 encoded array to [String]. If the BOM is missing, system endianness is assumed. Returns empty string if source array is not valid UTF-16 string. </description> </method> <method name="get_string_from_utf32"> <return type="String"> </return> <description> - Converts UTF-32 encoded array to [String]. System endianness is assumed. Returns empty string if source array is not vaild UTF-32 string. + Converts UTF-32 encoded array to [String]. System endianness is assumed. Returns empty string if source array is not valid UTF-32 string. </description> </method> <method name="get_string_from_utf8"> <return type="String"> </return> <description> - Converts UTF-8 encoded array to [String]. Slower than [method get_string_from_ascii] but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred. Returns empty string if source array is not vaild UTF-8 string. + Converts UTF-8 encoded array to [String]. Slower than [method get_string_from_ascii] but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred. Returns empty string if source array is not valid UTF-8 string. </description> </method> <method name="has"> diff --git a/doc/classes/ParticlesMaterial.xml b/doc/classes/ParticlesMaterial.xml index d04ac5bdce..f6fa3cf38b 100644 --- a/doc/classes/ParticlesMaterial.xml +++ b/doc/classes/ParticlesMaterial.xml @@ -243,6 +243,14 @@ <member name="spread" type="float" setter="set_spread" getter="get_spread" default="45.0"> Each particle's initial direction range from [code]+spread[/code] to [code]-spread[/code] degrees. Applied to X/Z plane and Y/Z planes. </member> + <member name="sub_emitter_amount_at_end" type="int" setter="set_sub_emitter_amount_at_end" getter="get_sub_emitter_amount_at_end"> + </member> + <member name="sub_emitter_frequency" type="float" setter="set_sub_emitter_frequency" getter="get_sub_emitter_frequency"> + </member> + <member name="sub_emitter_keep_velocity" type="bool" setter="set_sub_emitter_keep_velocity" getter="get_sub_emitter_keep_velocity" default="false"> + </member> + <member name="sub_emitter_mode" type="int" setter="set_sub_emitter_mode" getter="get_sub_emitter_mode" enum="ParticlesMaterial.SubEmitterMode" default="0"> + </member> <member name="tangential_accel" type="float" setter="set_param" getter="get_param" default="0.0"> Tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity giving the particles a swirling motion. </member> @@ -252,15 +260,6 @@ <member name="tangential_accel_random" type="float" setter="set_param_randomness" getter="get_param_randomness" default="0.0"> Tangential acceleration randomness ratio. </member> - <member name="trail_color_modifier" type="GradientTexture" setter="set_trail_color_modifier" getter="get_trail_color_modifier"> - Trail particles' color will vary along this [GradientTexture]. - </member> - <member name="trail_divisor" type="int" setter="set_trail_divisor" getter="get_trail_divisor" default="1"> - Emitter will emit [code]amount[/code] divided by [code]trail_divisor[/code] particles. The remaining particles will be used as trail(s). - </member> - <member name="trail_size_modifier" type="CurveTexture" setter="set_trail_size_modifier" getter="get_trail_size_modifier"> - Trail particles' size will vary along this [CurveTexture]. - </member> </members> <constants> <constant name="PARAM_INITIAL_LINEAR_VELOCITY" value="0" enum="Parameter"> @@ -332,5 +331,15 @@ <constant name="EMISSION_SHAPE_MAX" value="5" enum="EmissionShape"> Represents the size of the [enum EmissionShape] enum. </constant> + <constant name="SUB_EMITTER_DISABLED" value="0" enum="SubEmitterMode"> + </constant> + <constant name="SUB_EMITTER_CONSTANT" value="1" enum="SubEmitterMode"> + </constant> + <constant name="SUB_EMITTER_AT_END" value="2" enum="SubEmitterMode"> + </constant> + <constant name="SUB_EMITTER_AT_COLLISION" value="3" enum="SubEmitterMode"> + </constant> + <constant name="SUB_EMITTER_MAX" value="4" enum="SubEmitterMode"> + </constant> </constants> </class> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 38d65f6338..ed8eddda07 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -873,7 +873,7 @@ Size of the hash table used for the broad-phase 2D hash grid algorithm. </member> <member name="physics/2d/cell_size" type="int" setter="" getter="" default="128"> - Cell size used for the broad-phase 2D hash grid algorithm. + Cell size used for the broad-phase 2D hash grid algorithm (in pixels). </member> <member name="physics/2d/default_angular_damp" type="float" setter="" getter="" default="1.0"> The default angular damp in 2D. @@ -1199,7 +1199,7 @@ <member name="rendering/vulkan/staging_buffer/texture_upload_region_size_px" type="int" setter="" getter="" default="64"> </member> <member name="world/2d/cell_size" type="int" setter="" getter="" default="100"> - Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses. + Cell size used for the 2D hash grid that [VisibilityNotifier2D] uses (in pixels). </member> </members> <constants> diff --git a/doc/classes/RayCast2D.xml b/doc/classes/RayCast2D.xml index 5fc5b09833..e30d7df63f 100644 --- a/doc/classes/RayCast2D.xml +++ b/doc/classes/RayCast2D.xml @@ -123,9 +123,6 @@ </method> </methods> <members> - <member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2( 0, 50 )"> - The ray's destination point, relative to the RayCast's [code]position[/code]. - </member> <member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false"> If [code]true[/code], collision with [Area2D]s will be reported. </member> @@ -141,6 +138,9 @@ <member name="exclude_parent" type="bool" setter="set_exclude_parent_body" getter="get_exclude_parent_body" default="true"> If [code]true[/code], the parent node will be excluded from collision detection. </member> + <member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2( 0, 50 )"> + The ray's destination point, relative to the RayCast's [code]position[/code]. + </member> </members> <constants> </constants> diff --git a/doc/classes/RayCast3D.xml b/doc/classes/RayCast3D.xml index d8bff65bff..1d8edf0adb 100644 --- a/doc/classes/RayCast3D.xml +++ b/doc/classes/RayCast3D.xml @@ -126,9 +126,6 @@ </method> </methods> <members> - <member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3( 0, -1, 0 )"> - The ray's destination point, relative to the RayCast's [code]position[/code]. - </member> <member name="collide_with_areas" type="bool" setter="set_collide_with_areas" getter="is_collide_with_areas_enabled" default="false"> If [code]true[/code], collision with [Area3D]s will be reported. </member> @@ -144,6 +141,9 @@ <member name="exclude_parent" type="bool" setter="set_exclude_parent_body" getter="get_exclude_parent_body" default="true"> If [code]true[/code], collisions will be ignored for this RayCast3D's immediate parent. </member> + <member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3( 0, -1, 0 )"> + The ray's destination point, relative to the RayCast's [code]position[/code]. + </member> </members> <constants> </constants> diff --git a/doc/classes/Rect2.xml b/doc/classes/Rect2.xml index fe05f14fa1..2d1685871d 100644 --- a/doc/classes/Rect2.xml +++ b/doc/classes/Rect2.xml @@ -5,7 +5,8 @@ </brief_description> <description> [Rect2] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. - It uses floating point coordinates. + It uses floating-point coordinates. If you need integer coordinates, use [Rect2i] instead. + The 3D counterpart to [Rect2] is [AABB]. </description> <tutorials> <link title="Math tutorial index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml index 2fdfe7c24b..809f385f6e 100644 --- a/doc/classes/Rect2i.xml +++ b/doc/classes/Rect2i.xml @@ -5,7 +5,7 @@ </brief_description> <description> [Rect2i] consists of a position, a size, and several utility functions. It is typically used for fast overlap tests. - It uses integer coordinates. + It uses integer coordinates. If you need floating-point coordinates, use [Rect2] instead. </description> <tutorials> <link title="Math tutorial index">https://docs.godotengine.org/en/latest/tutorials/math/index.html</link> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index dc3c7c7dc0..050f1aab25 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -44,6 +44,7 @@ </argument> <description> Parses [code]bbcode[/code] and adds tags to the tag stack as needed. Returns the result of the parsing, [constant OK] if successful. + [b]Note:[/b] Using this method, you can't close a tag that was opened in a previous [method append_bbcode] call. This is done to improve performance, especially when updating large RichTextLabels since rebuilding the whole BBCode every time would be slower. If you absolutely need to close a tag in a future method call, append the [member bbcode_text] instead of using [method append_bbcode]. </description> </method> <method name="clear"> @@ -289,7 +290,7 @@ </member> <member name="bbcode_text" type="String" setter="set_bbcode" getter="get_bbcode" default=""""> The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited. - [b]Note:[/b] It is unadvised to use [code]+=[/code] operator with [code]bbcode_text[/code] (e.g. [code]bbcode_text += "some string"[/code]) as it replaces the whole text and can cause slowdowns. Use [method append_bbcode] for adding text instead. + [b]Note:[/b] It is unadvised to use the [code]+=[/code] operator with [code]bbcode_text[/code] (e.g. [code]bbcode_text += "some string"[/code]) as it replaces the whole text and can cause slowdowns. Use [method append_bbcode] for adding text instead, unless you absolutely need to close a tag that was opened in an earlier method call. </member> <member name="custom_effects" type="Array" setter="set_effects" getter="get_effects" default="[ ]"> The currently installed custom effects. This is an array of [RichTextEffect]s. diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index 20b0750431..d5a32dd20c 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -86,6 +86,7 @@ <argument index="1" name="base_path" type="String"> </argument> <description> + Opens the script create dialog. The script will extend [code]base_name[/code]. The file extension can be omitted from [code]base_path[/code]. It will be added based on the selected scripting language. </description> </method> <method name="register_syntax_highlighter"> diff --git a/doc/classes/SpriteFrames.xml b/doc/classes/SpriteFrames.xml index f7c9be7900..1c7d84c5a2 100644 --- a/doc/classes/SpriteFrames.xml +++ b/doc/classes/SpriteFrames.xml @@ -54,7 +54,7 @@ <argument index="0" name="anim" type="StringName"> </argument> <description> - Returns [code]true[/code] if the given animation is configured to loop when it finishes playing. Otherwise, returns [code]false[/code]. + Returns [code]true[/code] if the given animation is configured to loop when it finishes playing. Otherwise, returns [code]false[/code]. </description> </method> <method name="get_animation_names" qualifiers="const"> diff --git a/doc/classes/StreamTexture3D.xml b/doc/classes/StreamTexture3D.xml new file mode 100644 index 0000000000..7054a4ee99 --- /dev/null +++ b/doc/classes/StreamTexture3D.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="StreamTexture3D" inherits="Texture3D" version="4.0"> + <brief_description> + </brief_description> + <description> + </description> + <tutorials> + </tutorials> + <methods> + <method name="load"> + <return type="int" enum="Error"> + </return> + <argument index="0" name="path" type="String"> + </argument> + <description> + </description> + </method> + </methods> + <members> + <member name="load_path" type="String" setter="load" getter="get_load_path" default=""""> + </member> + </members> + <constants> + </constants> +</class> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index ccc99dc8e3..a23a4936f8 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -9,6 +9,14 @@ <tutorials> </tutorials> <methods> + <method name="add_gutter"> + <return type="void"> + </return> + <argument index="0" name="at" type="int" default="-1"> + </argument> + <description> + </description> + </method> <method name="can_fold" qualifiers="const"> <return type="bool"> </return> @@ -112,11 +120,34 @@ Folds the given line, if possible (see [method can_fold]). </description> </method> - <method name="get_breakpoints" qualifiers="const"> - <return type="Array"> + <method name="get_gutter_count" qualifiers="const"> + <return type="int"> + </return> + <description> + </description> + </method> + <method name="get_gutter_name" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_gutter_type" qualifiers="const"> + <return type="int" enum="TextEdit.GutterType"> </return> + <argument index="0" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_gutter_width" qualifiers="const"> + <return type="int"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> <description> - Returns an array containing the line number of each breakpoint. </description> </method> <method name="get_line" qualifiers="const"> @@ -135,6 +166,46 @@ Returns the amount of total lines in the text. </description> </method> + <method name="get_line_gutter_icon" qualifiers="const"> + <return type="Texture2D"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_line_gutter_item_color"> + <return type="Color"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_line_gutter_metadata" qualifiers="const"> + <return type="Variant"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="get_line_gutter_text" qualifiers="const"> + <return type="String"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <description> + </description> + </method> <method name="get_menu" qualifiers="const"> <return type="PopupMenu"> </return> @@ -202,6 +273,40 @@ Returns whether the line at the specified index is folded or not. </description> </method> + <method name="is_gutter_clickable" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_gutter_drawn" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_gutter_overwritable" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <description> + </description> + </method> + <method name="is_line_gutter_clickable" qualifiers="const"> + <return type="bool"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <description> + </description> + </method> <method name="is_line_hidden" qualifiers="const"> <return type="bool"> </return> @@ -241,11 +346,12 @@ Perform redo operation. </description> </method> - <method name="remove_breakpoints"> + <method name="remove_gutter"> <return type="void"> </return> + <argument index="0" name="gutter" type="int"> + </argument> <description> - Removes all the breakpoints. This will not fire the [signal breakpoint_toggled] signal. </description> </method> <method name="search" qualifiers="const"> @@ -295,6 +401,78 @@ If [member selecting_enabled] is [code]false[/code], no selection will occur. </description> </method> + <method name="set_gutter_clickable"> + <return type="void"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <argument index="1" name="clickable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_gutter_custom_draw"> + <return type="void"> + </return> + <argument index="0" name="column" type="int"> + </argument> + <argument index="1" name="object" type="Object"> + </argument> + <argument index="2" name="callback" type="StringName"> + </argument> + <description> + </description> + </method> + <method name="set_gutter_draw"> + <return type="void"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <argument index="1" name="draw" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_gutter_name"> + <return type="void"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <argument index="1" name="name" type="String"> + </argument> + <description> + </description> + </method> + <method name="set_gutter_overwritable"> + <return type="void"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <argument index="1" name="overwritable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_gutter_type"> + <return type="void"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <argument index="1" name="type" type="int" enum="TextEdit.GutterType"> + </argument> + <description> + </description> + </method> + <method name="set_gutter_width"> + <return type="void"> + </return> + <argument index="0" name="gutter" type="int"> + </argument> + <argument index="1" name="width" type="int"> + </argument> + <description> + </description> + </method> <method name="set_line"> <return type="void"> </return> @@ -317,6 +495,66 @@ If [code]true[/code], hides the line of the specified index. </description> </method> + <method name="set_line_gutter_clickable"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <argument index="2" name="clickable" type="bool"> + </argument> + <description> + </description> + </method> + <method name="set_line_gutter_icon"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <argument index="2" name="icon" type="Texture2D"> + </argument> + <description> + </description> + </method> + <method name="set_line_gutter_item_color"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <argument index="2" name="color" type="Color"> + </argument> + <description> + </description> + </method> + <method name="set_line_gutter_metadata"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <argument index="2" name="metadata" type="Variant"> + </argument> + <description> + </description> + </method> + <method name="set_line_gutter_text"> + <return type="void"> + </return> + <argument index="0" name="line" type="int"> + </argument> + <argument index="1" name="gutter" type="int"> + </argument> + <argument index="2" name="text" type="String"> + </argument> + <description> + </description> + </method> <method name="toggle_fold_line"> <return type="void"> </return> @@ -351,9 +589,6 @@ </method> </methods> <members> - <member name="breakpoint_gutter" type="bool" setter="set_breakpoint_gutter_enabled" getter="is_breakpoint_gutter_enabled" default="false"> - If [code]true[/code], the breakpoint gutter is visible. - </member> <member name="caret_blink" type="bool" setter="cursor_set_blink_enabled" getter="cursor_get_blink_enabled" default="false"> If [code]true[/code], the caret (visual cursor) blinks. </member> @@ -378,9 +613,6 @@ If [code]true[/code], the "tab" character will have a visible representation. </member> <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" override="true" enum="Control.FocusMode" default="2" /> - <member name="fold_gutter" type="bool" setter="set_draw_fold_gutter" getter="is_drawing_fold_gutter" default="false"> - If [code]true[/code], the fold gutter is visible. This enables folding groups of indented lines. - </member> <member name="hiding_enabled" type="bool" setter="set_hiding_enabled" getter="is_hiding_enabled" default="false"> If [code]true[/code], all lines that have been set to hidden by [method set_line_as_hidden], will not be visible. </member> @@ -416,9 +648,6 @@ <member name="shortcut_keys_enabled" type="bool" setter="set_shortcut_keys_enabled" getter="is_shortcut_keys_enabled" default="true"> If [code]true[/code], shortcut keys for context menu items are enabled, even if the context menu is disabled. </member> - <member name="show_line_numbers" type="bool" setter="set_show_line_numbers" getter="is_show_line_numbers_enabled" default="false"> - If [code]true[/code], line numbers are displayed to the left of the text. - </member> <member name="smooth_scrolling" type="bool" setter="set_smooth_scroll_enable" getter="is_smooth_scroll_enabled" default="false"> If [code]true[/code], sets the [code]step[/code] of the scrollbars to [code]0.25[/code] which results in smoother scrolling. </member> @@ -438,29 +667,31 @@ </member> </members> <signals> - <signal name="breakpoint_toggled"> - <argument index="0" name="row" type="int"> - </argument> + <signal name="cursor_changed"> <description> - Emitted when a breakpoint is placed via the breakpoint gutter. + Emitted when the cursor changes. </description> </signal> - <signal name="cursor_changed"> + <signal name="gutter_added"> <description> - Emitted when the cursor changes. </description> </signal> - <signal name="info_clicked"> - <argument index="0" name="row" type="int"> + <signal name="gutter_clicked"> + <argument index="0" name="line" type="int"> </argument> - <argument index="1" name="info" type="String"> + <argument index="1" name="gutter" type="int"> </argument> <description> - Emitted when the info icon is clicked. </description> </signal> - <signal name="line_edited_from"> - <argument index="0" name="line" type="int"> + <signal name="gutter_removed"> + <description> + </description> + </signal> + <signal name="lines_edited_from"> + <argument index="0" name="from_line" type="int"> + </argument> + <argument index="1" name="to_line" type="int"> </argument> <description> </description> @@ -501,6 +732,12 @@ <constant name="SEARCH_BACKWARDS" value="4" enum="SearchFlags"> Search from end to beginning. </constant> + <constant name="GUTTER_TYPE_STRING" value="0" enum="GutterType"> + </constant> + <constant name="GUTTER_TPYE_ICON" value="1" enum="GutterType"> + </constant> + <constant name="GUTTER_TPYE_CUSTOM" value="2" enum="GutterType"> + </constant> <constant name="MENU_CUT" value="0" enum="MenuItems"> Cuts (copies and clears) the selected text. </constant> @@ -530,14 +767,8 @@ <theme_item name="background_color" type="Color" default="Color( 0, 0, 0, 0 )"> Sets the background [Color] of this [TextEdit]. [member syntax_highlighting] has to be enabled. </theme_item> - <theme_item name="bookmark_color" type="Color" default="Color( 0.08, 0.49, 0.98, 1 )"> - Sets the [Color] of the bookmark marker. [member syntax_highlighting] has to be enabled. - </theme_item> <theme_item name="brace_mismatch_color" type="Color" default="Color( 1, 0.2, 0.2, 1 )"> </theme_item> - <theme_item name="breakpoint_color" type="Color" default="Color( 0.8, 0.8, 0.4, 0.2 )"> - Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled. - </theme_item> <theme_item name="caret_background_color" type="Color" default="Color( 0, 0, 0, 1 )"> </theme_item> <theme_item name="caret_color" type="Color" default="Color( 0.88, 0.88, 0.88, 1 )"> @@ -565,14 +796,8 @@ <theme_item name="current_line_color" type="Color" default="Color( 0.25, 0.25, 0.26, 0.8 )"> Sets the [Color] of the breakpoints. [member breakpoint_gutter] has to be enabled. </theme_item> - <theme_item name="executing_line_color" type="Color" default="Color( 0.2, 0.8, 0.2, 0.4 )"> - </theme_item> <theme_item name="focus" type="StyleBox"> </theme_item> - <theme_item name="fold" type="Texture2D"> - </theme_item> - <theme_item name="folded" type="Texture2D"> - </theme_item> <theme_item name="font" type="Font"> Sets the default [Font]. </theme_item> @@ -584,9 +809,6 @@ <theme_item name="font_color_selected" type="Color" default="Color( 0, 0, 0, 1 )"> Sets the [Color] of the selected text. [member override_selected_font_color] has to be enabled. </theme_item> - <theme_item name="line_number_color" type="Color" default="Color( 0.67, 0.67, 0.67, 0.4 )"> - Sets the [Color] of the line numbers. [member show_line_numbers] has to be enabled. - </theme_item> <theme_item name="line_spacing" type="int" default="4"> Sets the spacing between the lines. </theme_item> @@ -599,8 +821,6 @@ <theme_item name="read_only" type="StyleBox"> Sets the [StyleBox] of this [TextEdit] when [member readonly] is enabled. </theme_item> - <theme_item name="safe_line_number_color" type="Color" default="Color( 0.67, 0.78, 0.67, 0.6 )"> - </theme_item> <theme_item name="selection_color" type="Color" default="Color( 0.49, 0.49, 0.49, 1 )"> Sets the highlight [Color] of text selections. </theme_item> diff --git a/doc/classes/TextureButton.xml b/doc/classes/TextureButton.xml index a5172586fe..46b008c018 100644 --- a/doc/classes/TextureButton.xml +++ b/doc/classes/TextureButton.xml @@ -6,6 +6,7 @@ <description> [TextureButton] has the same functionality as [Button], except it uses sprites instead of Godot's [Theme] resource. It is faster to create, but it doesn't support localization like more complex [Control]s. The "normal" state must contain a texture ([member texture_normal]); other textures are optional. + See also [BaseButton] which contains common properties and methods associated with this node. </description> <tutorials> </tutorials> diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index 52d719b6f7..44398cabbf 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -182,7 +182,7 @@ <return type="bool"> </return> <description> - Returns [code]true[/code] if the vector is normalized, and false otherwise. + Returns [code]true[/code] if the vector is normalized, [code]false[/code] otherwise. </description> </method> <method name="length"> diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml index 608b976f6f..df5d4f150e 100644 --- a/doc/classes/Vector3.xml +++ b/doc/classes/Vector3.xml @@ -157,7 +157,7 @@ <return type="bool"> </return> <description> - Returns [code]true[/code] if the vector is normalized, and false otherwise. + Returns [code]true[/code] if the vector is normalized, [code]false[/code] otherwise. </description> </method> <method name="length"> diff --git a/doc/classes/VideoPlayer.xml b/doc/classes/VideoPlayer.xml index 91c8ad0a77..60f0a40159 100644 --- a/doc/classes/VideoPlayer.xml +++ b/doc/classes/VideoPlayer.xml @@ -5,7 +5,7 @@ </brief_description> <description> Control node for playing video streams using [VideoStream] resources. - Supported video formats are [url=https://www.webmproject.org/]WebM[/url] ([VideoStreamWebm]), [url=https://www.theora.org/]Ogg Theora[/url] ([VideoStreamTheora]), and any format exposed via a GDNative plugin using [VideoStreamGDNative]. + Supported video formats are [url=https://www.webmproject.org/]WebM[/url] ([code].webm[/code], [VideoStreamWebm]), [url=https://www.theora.org/]Ogg Theora[/url] ([code].ogv[/code], [VideoStreamTheora]), and any format exposed via a GDNative plugin using [VideoStreamGDNative]. </description> <tutorials> </tutorials> diff --git a/doc/classes/VisualInstance3D.xml b/doc/classes/VisualInstance3D.xml index 6451b3f330..01d569d9c8 100644 --- a/doc/classes/VisualInstance3D.xml +++ b/doc/classes/VisualInstance3D.xml @@ -13,7 +13,7 @@ <return type="AABB"> </return> <description> - Returns the [AABB] (also known as the bounding box) for this [VisualInstance3D]. + Returns the [AABB] (also known as the bounding box) for this [VisualInstance3D]. See also [method get_transformed_aabb]. </description> </method> <method name="get_base" qualifiers="const"> @@ -44,7 +44,7 @@ </return> <description> Returns the transformed [AABB] (also known as the bounding box) for this [VisualInstance3D]. - Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Node3D]'s [Transform]. + Transformed in this case means the [AABB] plus the position, rotation, and scale of the [Node3D]'s [Transform]. See also [method get_aabb]. </description> </method> <method name="set_base"> diff --git a/doc/classes/VisualShader.xml b/doc/classes/VisualShader.xml index 12954beb43..f03550bd5e 100644 --- a/doc/classes/VisualShader.xml +++ b/doc/classes/VisualShader.xml @@ -209,10 +209,13 @@ <constant name="TYPE_LIGHT" value="2" enum="Type"> A shader for light calculations. </constant> - <constant name="TYPE_COMPUTE" value="3" enum="Type"> - A compute shader, to use the GPU for abstract computation. + <constant name="TYPE_EMIT" value="3" enum="Type"> </constant> - <constant name="TYPE_MAX" value="4" enum="Type"> + <constant name="TYPE_PROCESS" value="4" enum="Type"> + </constant> + <constant name="TYPE_END" value="5" enum="Type"> + </constant> + <constant name="TYPE_MAX" value="6" enum="Type"> Represents the size of the [enum Type] enum. </constant> <constant name="NODE_ID_INVALID" value="-1"> diff --git a/doc/classes/VisualShaderNode.xml b/doc/classes/VisualShaderNode.xml index 6327ab534f..3bb527f3d4 100644 --- a/doc/classes/VisualShaderNode.xml +++ b/doc/classes/VisualShaderNode.xml @@ -57,6 +57,12 @@ Emitted when the node requests an editor refresh. Currently called only in setter of [member VisualShaderNodeTexture.source], [VisualShaderNodeTexture], and [VisualShaderNodeCubemap] (and their derivatives). </description> </signal> + <signal name="show_port_preview"> + <argument index="0" name="port_id" type="int"> + </argument> + <description> + </description> + </signal> </signals> <constants> <constant name="PORT_TYPE_SCALAR" value="0" enum="PortType"> diff --git a/doc/classes/bool.xml b/doc/classes/bool.xml index 869fc14d40..ce4d000a9b 100644 --- a/doc/classes/bool.xml +++ b/doc/classes/bool.xml @@ -6,36 +6,87 @@ <description> Boolean is a built-in type. There are two boolean values: [code]true[/code] and [code]false[/code]. You can think of it as an switch with on or off (1 or 0) setting. Booleans are used in programming for logic in condition statements, like [code]if[/code] statements. Booleans can be directly used in [code]if[/code] statements. The code below demonstrates this on the [code]if can_shoot:[/code] line. You don't need to use [code]== true[/code], you only need [code]if can_shoot:[/code]. Similarly, use [code]if not can_shoot:[/code] rather than [code]== false[/code]. - [codeblock] - var can_shoot = true + [codeblocks] + [gdscript] + var _can_shoot = true func shoot(): - if can_shoot: + if _can_shoot: pass # Perform shooting actions here. - [/codeblock] + [/gdscript] + [csharp] + private bool _canShoot = true; + + public void Shoot() + { + if (_canShoot) + { + // Perform shooting actions here. + } + } + [/csharp] + [/codeblocks] The following code will only create a bullet if both conditions are met: action "shoot" is pressed and if [code]can_shoot[/code] is [code]true[/code]. [b]Note:[/b] [code]Input.is_action_pressed("shoot")[/code] is also a boolean that is [code]true[/code] when "shoot" is pressed and [code]false[/code] when "shoot" isn't pressed. - [codeblock] - var can_shoot = true + [codeblocks] + [gdscript] + var _can_shoot = true func shoot(): - if can_shoot and Input.is_action_pressed("shoot"): + if _can_shoot and Input.is_action_pressed("shoot"): create_bullet() - [/codeblock] + [/gdscript] + [csharp] + private bool _canShoot = true; + + public void Shoot() + { + if (_canShoot && Input.IsActionPressed("shoot")) + { + CreateBullet(); + } + } + [/csharp] + [/codeblocks] The following code will set [code]can_shoot[/code] to [code]false[/code] and start a timer. This will prevent player from shooting until the timer runs out. Next [code]can_shoot[/code] will be set to [code]true[/code] again allowing player to shoot once again. - [codeblock] - var can_shoot = true - onready var cool_down = $CoolDownTimer + [gdscript] + var _can_shoot = true + onready var _cool_down = $CoolDownTimer func shoot(): - if can_shoot and Input.is_action_pressed("shoot"): + if _can_shoot and Input.is_action_pressed("shoot"): create_bullet() - can_shoot = false - cool_down.start() + _can_shoot = false + _cool_down.start() func _on_CoolDownTimer_timeout(): - can_shoot = true - [/codeblock] + _can_shoot = true + [/gdscript] + [csharp] + private bool _canShoot = true; + private Timer _coolDown; + + public override void _Ready() + { + _coolDown = GetNode<Timer>("CoolDownTimer"); + } + + public void Shoot() + { + if (_canShoot && Input.IsActionPressed("shoot")) + { + CreateBullet(); + _canShoot = false; + _coolDown.Start(); + } + } + + public void OnCoolDownTimerTimeout() + { + _canShoot = true; + } + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> |