diff options
Diffstat (limited to 'doc')
128 files changed, 1729 insertions, 837 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 2be15d5100..3b2e260dcb 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -442,9 +442,14 @@ <param index="0" name="variable" type="Variant" /> <description> Returns the integer hash of the passed [param variable]. - [codeblock] + [codeblocks] + [gdscript] print(hash("a")) # Prints 177670 - [/codeblock] + [/gdscript] + [csharp] + GD.Print(GD.Hash("a")); // Prints 177670 + [/csharp] + [/codeblocks] </description> </method> <method name="instance_from_id"> @@ -452,13 +457,29 @@ <param index="0" name="instance_id" type="int" /> <description> Returns the [Object] that corresponds to [param instance_id]. All Objects have a unique instance ID. See also [method Object.get_instance_id]. - [codeblock] + [codeblocks] + [gdscript] var foo = "bar" + func _ready(): var id = get_instance_id() var inst = instance_from_id(id) print(inst.foo) # Prints bar - [/codeblock] + [/gdscript] + [csharp] + public partial class MyNode : Node + { + public string Foo { get; set; } = "bar"; + + public override void _Ready() + { + ulong id = GetInstanceId(); + var inst = (MyNode)InstanceFromId(Id); + GD.Print(inst.Foo); // Prints bar + } + } + [/csharp] + [/codeblocks] </description> </method> <method name="inverse_lerp"> @@ -525,6 +546,31 @@ Returns [code]true[/code] if [param x] is a NaN ("Not a Number" or invalid) value. </description> </method> + <method name="is_same"> + <return type="bool" /> + <param index="0" name="a" type="Variant" /> + <param index="1" name="b" type="Variant" /> + <description> + Returns [code]true[/code], for value types, if [param a] and [param b] share the same value. Returns [code]true[/code], for reference types, if the references of [param a] and [param b] are the same. + [codeblock] + # Vector2 is a value type + var vec2_a = Vector2(0, 0) + var vec2_b = Vector2(0, 0) + var vec2_c = Vector2(1, 1) + is_same(vec2_a, vec2_a) # true + is_same(vec2_a, vec2_b) # true + is_same(vec2_a, vec2_c) # false + + # Array is a reference type + var arr_a = [] + var arr_b = [] + is_same(arr_a, arr_a) # true + is_same(arr_a, arr_b) # false + [/codeblock] + These are [Variant] value types: [code]null[/code], [bool], [int], [float], [String], [StringName], [Vector2], [Vector2i], [Vector3], [Vector3i], [Vector4], [Vector4i], [Rect2], [Rect2i], [Transform2D], [Transform3D], [Plane], [Quaternion], [AABB], [Basis], [Projection], [Color], [NodePath], [RID], [Callable] and [Signal]. + These are [Variant] reference types: [Object], [Dictionary], [Array], [PackedByteArray], [PackedInt32Array], [PackedInt64Array], [PackedFloat32Array], [PackedFloat64Array], [PackedStringArray], [PackedVector2Array], [PackedVector3Array] and [PackedColorArray]. + </description> + </method> <method name="is_zero_approx"> <return type="bool" /> <param index="0" name="x" type="float" /> @@ -764,10 +810,16 @@ <method name="print" qualifiers="vararg"> <description> Converts one or more arguments of any type to string in the best way possible and prints them to the console. - [codeblock] + [codeblocks] + [gdscript] var a = [1, 2, 3] print("a", "b", a) # Prints ab[1, 2, 3] - [/codeblock] + [/gdscript] + [csharp] + var a = new Godot.Collections.Array { 1, 2, 3 }; + GD.Print("a", "b", a); // Prints ab[1, 2, 3] + [/csharp] + [/codeblocks] [b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. </description> </method> @@ -775,9 +827,14 @@ <description> Converts one or more arguments of any type to string in the best way possible and prints them to the console. The following BBCode tags are supported: b, i, u, s, indent, code, url, center, right, color, bgcolor, fgcolor. Color tags only support named colors such as [code]red[/code], [i]not[/i] hexadecimal color codes. Unsupported tags will be left as-is in standard output. When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Displaying ANSI escape codes is currently only supported on Linux and macOS. Support for ANSI escape codes may vary across terminal emulators, especially for italic and strikethrough. - [codeblock] + [codeblocks] + [gdscript] print_rich("[code][b]Hello world![/b][/code]") # Prints out: [b]Hello world![/b] - [/codeblock] + [/gdscript] + [csharp] + GD.PrintRich("[code][b]Hello world![/b][/code]"); // Prints out: [b]Hello world![/b] + [/csharp] + [/codeblocks] [b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. </description> </method> @@ -789,53 +846,86 @@ <method name="printerr" qualifiers="vararg"> <description> Prints one or more arguments to strings in the best way possible to standard error line. - [codeblock] + [codeblocks] + [gdscript] printerr("prints to stderr") - [/codeblock] + [/gdscript] + [csharp] + GD.PrintErr("prints to stderr"); + [/csharp] + [/codeblocks] </description> </method> <method name="printraw" qualifiers="vararg"> <description> Prints one or more arguments to strings in the best way possible to the OS terminal. Unlike [method print], no newline is automatically added at the end. - [codeblock] + [codeblocks] + [gdscript] printraw("A") printraw("B") printraw("C") # Prints ABC to terminal - [/codeblock] + [/gdscript] + [csharp] + GD.PrintRaw("A"); + GD.PrintRaw("B"); + GD.PrintRaw("C"); + // Prints ABC to terminal + [/csharp] + [/codeblocks] </description> </method> <method name="prints" qualifiers="vararg"> <description> Prints one or more arguments to the console with a space between each argument. - [codeblock] + [codeblocks] + [gdscript] prints("A", "B", "C") # Prints A B C - [/codeblock] + [/gdscript] + [csharp] + GD.PrintS("A", "B", "C"); // Prints A B C + [/csharp] + [/codeblocks] </description> </method> <method name="printt" qualifiers="vararg"> <description> Prints one or more arguments to the console with a tab between each argument. - [codeblock] + [codeblocks] + [gdscript] printt("A", "B", "C") # Prints A B C - [/codeblock] + [/gdscript] + [csharp] + GD.PrintT("A", "B", "C"); // Prints A B C + [/csharp] + [/codeblocks] </description> </method> <method name="push_error" qualifiers="vararg"> <description> Pushes an error message to Godot's built-in debugger and to the OS terminal. - [codeblock] + [codeblocks] + [gdscript] push_error("test error") # Prints "test error" to debugger and terminal as error call - [/codeblock] + [/gdscript] + [csharp] + GD.PushError("test error"); // Prints "test error" to debugger and terminal as error call + [/csharp] + [/codeblocks] [b]Note:[/b] This function does not pause project execution. To print an error message and pause project execution in debug builds, use [code]assert(false, "test error")[/code] instead. </description> </method> <method name="push_warning" qualifiers="vararg"> <description> Pushes a warning message to Godot's built-in debugger and to the OS terminal. - [codeblock] + [codeblocks] + [gdscript] push_warning("test warning") # Prints "test warning" to debugger and terminal as warning call - [/codeblock] + [/gdscript] + [csharp] + GD.PushWarning("test warning"); // Prints "test warning" to debugger and terminal as warning call + [/csharp] + [/codeblocks] </description> </method> <method name="rad_to_deg"> @@ -868,9 +958,14 @@ <return type="float" /> <description> Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive). - [codeblock] + [codeblocks] + [gdscript] randf() # Returns e.g. 0.375671 - [/codeblock] + [/gdscript] + [csharp] + GD.Randf(); // Returns e.g. 0.375671 + [/csharp] + [/codeblocks] </description> </method> <method name="randf_range"> @@ -879,10 +974,16 @@ <param index="1" name="to" type="float" /> <description> Returns a random floating point value between [param from] and [param to] (inclusive). - [codeblock] + [codeblocks] + [gdscript] randf_range(0, 20.5) # Returns e.g. 7.45315 randf_range(-10, 10) # Returns e.g. -3.844535 - [/codeblock] + [/gdscript] + [csharp] + GD.RandRange(0.0, 20.5); // Returns e.g. 7.45315 + GD.RandRange(-10.0, 10.0); // Returns e.g. -3.844535 + [/csharp] + [/codeblocks] </description> </method> <method name="randfn"> @@ -897,12 +998,20 @@ <return type="int" /> <description> Returns a random unsigned 32-bit integer. Use remainder to obtain a random value in the interval [code][0, N - 1][/code] (where N is smaller than 2^32). - [codeblock] + [codeblocks] + [gdscript] randi() # Returns random integer between 0 and 2^32 - 1 randi() % 20 # Returns random integer between 0 and 19 randi() % 100 # Returns random integer between 0 and 99 randi() % 100 + 1 # Returns random integer between 1 and 100 - [/codeblock] + [/gdscript] + [csharp] + GD.Randi(); // Returns random integer between 0 and 2^32 - 1 + GD.Randi() % 20; // Returns random integer between 0 and 19 + GD.Randi() % 100; // Returns random integer between 0 and 99 + GD.Randi() % 100 + 1; // Returns random integer between 1 and 100 + [/csharp] + [/codeblocks] </description> </method> <method name="randi_range"> @@ -911,10 +1020,16 @@ <param index="1" name="to" type="int" /> <description> Returns a random signed 32-bit integer between [param from] and [param to] (inclusive). If [param to] is lesser than [param from], they are swapped. - [codeblock] + [codeblocks] + [gdscript] randi_range(0, 1) # Returns either 0 or 1 randi_range(-10, 1000) # Returns random integer between -10 and 1000 - [/codeblock] + [/gdscript] + [csharp] + GD.RandRange(0, 1); // Returns either 0 or 1 + GD.RandRange(-10, 1000); // Returns random integer between -10 and 1000 + [/csharp] + [/codeblocks] </description> </method> <method name="randomize"> @@ -985,14 +1100,24 @@ <param index="0" name="base" type="int" /> <description> Sets the seed for the random number generator to [param base]. Setting the seed manually can ensure consistent, repeatable results for most random functions. - [codeblock] + [codeblocks] + [gdscript] var my_seed = "Godot Rocks".hash() seed(my_seed) var a = randf() + randi() seed(my_seed) var b = randf() + randi() # a and b are now identical - [/codeblock] + [/gdscript] + [csharp] + ulong mySeed = (ulong)GD.Hash("Godot Rocks"); + GD.Seed(mySeed); + var a = GD.Randf() + GD.Randi(); + GD.Seed(mySeed); + var b = GD.Randf() + GD.Randi(); + // a and b are now identical + [/csharp] + [/codeblocks] </description> </method> <method name="sign"> @@ -1146,7 +1271,13 @@ <method name="str" qualifiers="vararg"> <return type="String" /> <description> - Converts one or more arguments of any [Variant] type to [String] in the best way possible. + Converts one or more arguments of any [Variant] type to a [String] in the best way possible. + [codeblock] + var a = [10, 20, 30] + var b = str(a) + print(len(a)) # Prints 3 (the number of elements in the array). + print(len(b)) # Prints 12 (the length of the string "[10, 20, 30]"). + [/codeblock] </description> </method> <method name="str_to_var"> @@ -1154,11 +1285,18 @@ <param index="0" name="string" type="String" /> <description> Converts a formatted [param string] that was returned by [method var_to_str] to the original [Variant]. - [codeblock] + [codeblocks] + [gdscript] var a = '{ "a": 1, "b": 2 }' # a is a String var b = str_to_var(a) # b is a Dictionary print(b["a"]) # Prints 1 - [/codeblock] + [/gdscript] + [csharp] + string a = "{ \"a\": 1, \"b\": 2 }"; // a is a string + var b = GD.StrToVar(a).AsGodotDictionary(); // b is a Dictionary + GD.Print(b["a"]); // Prints 1 + [/csharp] + [/codeblocks] </description> </method> <method name="tan"> @@ -1218,15 +1356,21 @@ <param index="0" name="variable" type="Variant" /> <description> Converts a [Variant] [param variable] to a formatted [String] that can then be parsed using [method str_to_var]. - [codeblock] - a = { "a": 1, "b": 2 } + [codeblocks] + [gdscript] + var a = { "a": 1, "b": 2 } print(var_to_str(a)) - [/codeblock] + [/gdscript] + [csharp] + var a = new Godot.Collections.Dictionary { ["a"] = 1, ["b"] = 2 }; + GD.Print(GD.VarToStr(a)); + [/csharp] + [/codeblocks] Prints: [codeblock] { - "a": 1, - "b": 2 + "a": 1, + "b": 2 } [/codeblock] </description> @@ -2509,7 +2653,7 @@ Additionally, other keywords can be included: [code]"exp"[/code] for exponential range editing, [code]"radians"[/code] for editing radian angles in degrees, [code]"degrees"[/code] to hint at an angle and [code]"hide_slider"[/code] to hide the slider. </constant> <constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint"> - Hints that an [int], [float], or [String] property is an enumerated value to pick in a list specified via a hint string. + Hints that an [int] or [String] property is an enumerated value to pick in a list specified via a hint string. The hint string is a comma separated list of names such as [code]"Hello,Something,Else"[/code]. Whitespaces are [b]not[/b] removed from either end of a name. For integer and float properties, the first name in the list has value 0, the next 1, and so on. Explicit values can also be specified by appending [code]:integer[/code] to the name, e.g. [code]"Zero,One,Three:3,Four,Six:6"[/code]. </constant> <constant name="PROPERTY_HINT_ENUM_SUGGESTION" value="3" enum="PropertyHint"> @@ -2664,25 +2808,28 @@ <constant name="PROPERTY_USAGE_ARRAY" value="262144" enum="PropertyUsageFlags" is_bitfield="true"> The property is an array. </constant> - <constant name="PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE" value="524288" enum="PropertyUsageFlags" is_bitfield="true"> - If the property is a [Resource], a new copy of it is always created when calling [method Node.duplicate] or [method Resource.duplicate]. + <constant name="PROPERTY_USAGE_ALWAYS_DUPLICATE" value="524288" enum="PropertyUsageFlags" is_bitfield="true"> + When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should always be duplicated, regardless of the [code]subresources[/code] bool parameter. + </constant> + <constant name="PROPERTY_USAGE_NEVER_DUPLICATE" value="1048576" enum="PropertyUsageFlags" is_bitfield="true"> + When duplicating a resource with [method Resource.duplicate], and this flag is set on a property of that resource, the property should never be duplicated, regardless of the [code]subresources[/code] bool parameter. </constant> - <constant name="PROPERTY_USAGE_HIGH_END_GFX" value="1048576" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_HIGH_END_GFX" value="2097152" enum="PropertyUsageFlags" is_bitfield="true"> The property is only shown in the editor if modern renderers are supported (GLES3 is excluded). </constant> - <constant name="PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" value="2097152" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT" value="4194304" enum="PropertyUsageFlags" is_bitfield="true"> </constant> - <constant name="PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" value="4194304" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT" value="8388608" enum="PropertyUsageFlags" is_bitfield="true"> </constant> - <constant name="PROPERTY_USAGE_KEYING_INCREMENTS" value="8388608" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_KEYING_INCREMENTS" value="16777216" enum="PropertyUsageFlags" is_bitfield="true"> </constant> - <constant name="PROPERTY_USAGE_DEFERRED_SET_RESOURCE" value="16777216" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_DEFERRED_SET_RESOURCE" value="33554432" enum="PropertyUsageFlags" is_bitfield="true"> </constant> - <constant name="PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" value="33554432" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT" value="67108864" enum="PropertyUsageFlags" is_bitfield="true"> </constant> - <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="67108864" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="134217728" enum="PropertyUsageFlags" is_bitfield="true"> </constant> - <constant name="PROPERTY_USAGE_READ_ONLY" value="134217728" enum="PropertyUsageFlags" is_bitfield="true"> + <constant name="PROPERTY_USAGE_READ_ONLY" value="268435456" enum="PropertyUsageFlags" is_bitfield="true"> The property is read-only in the [EditorInspector]. </constant> <constant name="PROPERTY_USAGE_DEFAULT" value="6" enum="PropertyUsageFlags" is_bitfield="true"> diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index ca454cafa3..2c5337eea3 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -66,7 +66,7 @@ [/gdscript] [csharp] // position (-3, 2, 0), size (1, 1, 1) - var box = new AABB(new Vector3(-3, 2, 0), new Vector3(1, 1, 1)); + var box = new Aabb(new Vector3(-3, 2, 0), new Vector3(1, 1, 1)); // position (-3, -1, 0), size (3, 4, 2), so we fit both the original AABB and Vector3(0, -1, 2) var box2 = box.Expand(new Vector3(0, -1, 2)); [/csharp] diff --git a/doc/classes/AESContext.xml b/doc/classes/AESContext.xml index 7f582e4be7..747968ea91 100644 --- a/doc/classes/AESContext.xml +++ b/doc/classes/AESContext.xml @@ -39,39 +39,38 @@ [/gdscript] [csharp] using Godot; - using System; using System.Diagnostics; - public class Example : Node + public partial class MyNode : Node { - public AESContext Aes = new AESContext(); + private AesContext _aes = new AesContext(); public override void _Ready() { string key = "My secret key!!!"; // Key must be either 16 or 32 bytes. string data = "My secret text!!"; // Data size must be multiple of 16 bytes, apply padding if needed. // Encrypt ECB - Aes.Start(AESContext.Mode.EcbEncrypt, key.ToUTF8()); - byte[] encrypted = Aes.Update(data.ToUTF8()); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8()); + byte[] encrypted = _aes.Update(data.ToUtf8()); + _aes.Finish(); // Decrypt ECB - Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8()); - byte[] decrypted = Aes.Update(encrypted); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8()); + byte[] decrypted = _aes.Update(encrypted); + _aes.Finish(); // Check ECB - Debug.Assert(decrypted == data.ToUTF8()); + Debug.Assert(decrypted == data.ToUtf8()); string iv = "My secret iv!!!!"; // IV must be of exactly 16 bytes. // Encrypt CBC - Aes.Start(AESContext.Mode.EcbEncrypt, key.ToUTF8(), iv.ToUTF8()); - encrypted = Aes.Update(data.ToUTF8()); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbEncrypt, key.ToUtf8(), iv.ToUtf8()); + encrypted = _aes.Update(data.ToUtf8()); + _aes.Finish(); // Decrypt CBC - Aes.Start(AESContext.Mode.EcbDecrypt, key.ToUTF8(), iv.ToUTF8()); - decrypted = Aes.Update(encrypted); - Aes.Finish(); + _aes.Start(AesContext.Mode.EcbDecrypt, key.ToUtf8(), iv.ToUtf8()); + decrypted = _aes.Update(encrypted); + _aes.Finish(); // Check CBC - Debug.Assert(decrypted == data.ToUTF8()); + Debug.Assert(decrypted == data.ToUtf8()); } } [/csharp] diff --git a/doc/classes/AStar3D.xml b/doc/classes/AStar3D.xml index 4e8394195d..f0481c1745 100644 --- a/doc/classes/AStar3D.xml +++ b/doc/classes/AStar3D.xml @@ -19,15 +19,16 @@ return min(0, abs(u - v) - 1) [/gdscript] [csharp] - public class MyAStar : AStar3D + public partial class MyAStar : AStar3D { - public override float _ComputeCost(int u, int v) + public override float _ComputeCost(long fromId, long toId) { - return Mathf.Abs(u - v); + return Mathf.Abs((int)(fromId - toId)); } - public override float _EstimateCost(int u, int v) + + public override float _EstimateCost(long fromId, long toId) { - return Mathf.Min(0, Mathf.Abs(u - v) - 1); + return Mathf.Min(0, Mathf.Abs((int)(fromId - toId)) - 1); } } [/csharp] diff --git a/doc/classes/AStarGrid2D.xml b/doc/classes/AStarGrid2D.xml index 32599d7f7d..b253a33377 100644 --- a/doc/classes/AStarGrid2D.xml +++ b/doc/classes/AStarGrid2D.xml @@ -17,11 +17,11 @@ [/gdscript] [csharp] AStarGrid2D astarGrid = new AStarGrid2D(); - astarGrid.Size = new Vector2i(32, 32); - astarGrid.CellSize = new Vector2i(16, 16); + astarGrid.Size = new Vector2I(32, 32); + astarGrid.CellSize = new Vector2I(16, 16); astarGrid.Update(); - GD.Print(astarGrid.GetIdPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) - GD.Print(astarGrid.GetPointPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) + GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) + GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) [/csharp] [/codeblocks] </description> diff --git a/doc/classes/AnimatedSprite2D.xml b/doc/classes/AnimatedSprite2D.xml index cd9c0cee98..9872c59990 100644 --- a/doc/classes/AnimatedSprite2D.xml +++ b/doc/classes/AnimatedSprite2D.xml @@ -5,34 +5,82 @@ </brief_description> <description> [AnimatedSprite2D] is similar to the [Sprite2D] node, except it carries multiple textures as animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. - After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor. - To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time. </description> <tutorials> <link title="2D Sprite animation">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link> <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link> </tutorials> <methods> + <method name="get_playing_speed" qualifiers="const"> + <return type="float" /> + <description> + Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns a negative value if the current animation is playing backwards. + </description> + </method> + <method name="is_playing" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]). + </description> + </method> + <method name="pause"> + <return type="void" /> + <description> + Pauses the currently playing animation. The [member frame] and [member frame_progress] will be kept and calling [method play] or [method play_backwards] without arguments will resume the animation from the current playback position. + See also [method stop]. + </description> + </method> <method name="play"> <return type="void" /> - <param index="0" name="anim" type="StringName" default="&""" /> - <param index="1" name="backwards" type="bool" default="false" /> + <param index="0" name="name" type="StringName" default="&""" /> + <param index="1" name="custom_speed" type="float" default="1.0" /> + <param index="2" name="from_end" type="bool" default="false" /> + <description> + Plays the animation with key [param name]. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). + If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. + </description> + </method> + <method name="play_backwards"> + <return type="void" /> + <param index="0" name="name" type="StringName" default="&""" /> + <description> + Plays the animation with key [param name] in reverse. + This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information. + </description> + </method> + <method name="set_frame_and_progress"> + <return type="void" /> + <param index="0" name="frame" type="int" /> + <param index="1" name="progress" type="float" /> <description> - Plays the animation named [param anim]. If no [param anim] is provided, the current animation is played. If [param backwards] is [code]true[/code], the animation is played in reverse. - [b]Note:[/b] If [member speed_scale] is negative, the animation direction specified by [param backwards] will be inverted. + The setter of [member frame] resets the [member frame_progress] to [code]0.0[/code] implicitly, but this method avoids that. + This is useful when you want to carry over the current [member frame_progress] to another [member frame]. + [b]Example:[/b] + [codeblocks] + [gdscript] + # Change the animation with keeping the frame index and progress. + var current_frame = animated_sprite.get_frame() + var current_progress = animated_sprite.get_frame_progress() + animated_sprite.play("walk_another_skin") + animated_sprite.set_frame_and_progress(current_frame, current_progress) + [/gdscript] + [/codeblocks] </description> </method> <method name="stop"> <return type="void" /> <description> - Stops the current [member animation] at the current [member frame]. - [b]Note:[/b] This method resets the current frame's elapsed time and removes the [code]backwards[/code] flag from the current [member animation] (if it was previously set by [method play]). If this behavior is undesired, set [member playing] to [code]false[/code] instead. + Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. </description> </method> </methods> <members> <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"default""> - The current animation from the [member frames] resource. If this value changes, the [code]frame[/code] counter is reset. + The current animation from the [member sprite_frames] resource. If this value is changed, the [member frame] counter and the [member frame_progress] are reset. + </member> + <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default=""""> + The key of the animation to play when the scene loads. </member> <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true"> If [code]true[/code], texture will be centered. @@ -44,32 +92,46 @@ If [code]true[/code], texture is flipped vertically. </member> <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> - The displayed animation frame's index. + The displayed animation frame's index. Setting this property also resets [member frame_progress]. If this is not desired, use [method set_frame_and_progress]. </member> - <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> - The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource. + <member name="frame_progress" type="float" setter="set_frame_progress" getter="get_frame_progress" default="0.0"> + The progress value between [code]0.0[/code] and [code]1.0[/code] until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from [code]1.0[/code] to [code]0.0[/code]. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)"> The texture's drawing offset. </member> - <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false"> - If [code]true[/code], the [member animation] is currently playing. Setting this property to [code]false[/code] pauses the current animation. Use [method stop] to stop the animation at the current frame instead. - [b]Note:[/b] Unlike [method stop], changing this property to [code]false[/code] preserves the current frame's elapsed time and the [code]backwards[/code] flag of the current [member animation] (if it was previously set by [method play]). - [b]Note:[/b] After a non-looping animation finishes, the property still remains [code]true[/code]. - </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> - The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation is paused, preserving the current frame's elapsed time. + The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed. + If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance. + </member> + <member name="sprite_frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> + The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource. </member> </members> <signals> + <signal name="animation_changed"> + <description> + Emitted when [member animation] changes. + </description> + </signal> <signal name="animation_finished"> <description> - Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop. + Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback. + </description> + </signal> + <signal name="animation_looped"> + <description> + Emitted when the animation loops. </description> </signal> <signal name="frame_changed"> <description> - Emitted when [member frame] changed. + Emitted when [member frame] changes. + </description> + </signal> + <signal name="sprite_frames_changed"> + <description> + Emitted when [member sprite_frames] changes. </description> </signal> </signals> diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml index 4837ae715f..c39bb99827 100644 --- a/doc/classes/AnimatedSprite3D.xml +++ b/doc/classes/AnimatedSprite3D.xml @@ -4,59 +4,121 @@ 2D sprite node in 3D world, that can use multiple 2D textures for animation. </brief_description> <description> - [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as animation [member frames]. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. - After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor. - To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time. + [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as animation [member sprite_frames]. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. </description> <tutorials> <link title="2D Sprite animation (also applies to 3D)">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link> </tutorials> <methods> + <method name="get_playing_speed" qualifiers="const"> + <return type="float" /> + <description> + Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns a negative value if the current animation is playing backwards. + </description> + </method> + <method name="is_playing" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]). + </description> + </method> + <method name="pause"> + <return type="void" /> + <description> + Pauses the currently playing animation. The [member frame] and [member frame_progress] will be kept and calling [method play] or [method play_backwards] without arguments will resume the animation from the current playback position. + See also [method stop]. + </description> + </method> <method name="play"> <return type="void" /> - <param index="0" name="anim" type="StringName" default="&""" /> - <param index="1" name="backwards" type="bool" default="false" /> + <param index="0" name="name" type="StringName" default="&""" /> + <param index="1" name="custom_speed" type="float" default="1.0" /> + <param index="2" name="from_end" type="bool" default="false" /> + <description> + Plays the animation with key [param name]. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). + If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. + </description> + </method> + <method name="play_backwards"> + <return type="void" /> + <param index="0" name="name" type="StringName" default="&""" /> + <description> + Plays the animation with key [param name] in reverse. + This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information. + </description> + </method> + <method name="set_frame_and_progress"> + <return type="void" /> + <param index="0" name="frame" type="int" /> + <param index="1" name="progress" type="float" /> <description> - Plays the animation named [param anim]. If no [param anim] is provided, the current animation is played. If [param backwards] is [code]true[/code], the animation is played in reverse. - [b]Note:[/b] If [member speed_scale] is negative, the animation direction specified by [param backwards] will be inverted. + The setter of [member frame] resets the [member frame_progress] to [code]0.0[/code] implicitly, but this method avoids that. + This is useful when you want to carry over the current [member frame_progress] to another [member frame]. + [b]Example:[/b] + [codeblocks] + [gdscript] + # Change the animation with keeping the frame index and progress. + var current_frame = animated_sprite.get_frame() + var current_progress = animated_sprite.get_frame_progress() + animated_sprite.play("walk_another_skin") + animated_sprite.set_frame_and_progress(current_frame, current_progress) + [/gdscript] + [/codeblocks] </description> </method> <method name="stop"> <return type="void" /> <description> - Stops the current [member animation] at the current [member frame]. - [b]Note:[/b] This method resets the current frame's elapsed time and removes the [code]backwards[/code] flag from the current [member animation] (if it was previously set by [method play]). If this behavior is undesired, set [member playing] to [code]false[/code] instead. + Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. </description> </method> </methods> <members> <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"default""> - The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset. + The current animation from the [member sprite_frames] resource. If this value is changed, the [member frame] counter and the [member frame_progress] are reset. </member> - <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> - The displayed animation frame's index. + <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default=""""> + The key of the animation to play when the scene loads. </member> - <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> - The [SpriteFrames] resource containing the animation(s). + <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> + The displayed animation frame's index. Setting this property also resets [member frame_progress]. If this is not desired, use [method set_frame_and_progress]. </member> - <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false"> - If [code]true[/code], the [member animation] is currently playing. Setting this property to [code]false[/code] pauses the current animation. Use [method stop] to stop the animation at the current frame instead. - [b]Note:[/b] Unlike [method stop], changing this property to [code]false[/code] preserves the current frame's elapsed time and the [code]backwards[/code] flag of the current [member animation] (if it was previously set by [method play]). - [b]Note:[/b] After a non-looping animation finishes, the property still remains [code]true[/code]. + <member name="frame_progress" type="float" setter="set_frame_progress" getter="get_frame_progress" default="0.0"> + The progress value between [code]0.0[/code] and [code]1.0[/code] until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from [code]1.0[/code] to [code]0.0[/code]. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> - The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation is paused, preserving the current frame's elapsed time. + The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed. + If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance. + </member> + <member name="sprite_frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> + The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource. </member> </members> <signals> + <signal name="animation_changed"> + <description> + Emitted when [member animation] changes. + </description> + </signal> <signal name="animation_finished"> <description> - Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop. + Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback. + </description> + </signal> + <signal name="animation_looped"> + <description> + Emitted when the animation loops. </description> </signal> <signal name="frame_changed"> <description> - Emitted when [member frame] changed. + Emitted when [member frame] changes. + </description> + </signal> + <signal name="sprite_frames_changed"> + <description> + Emitted when [member sprite_frames] changes. </description> </signal> </signals> diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index c0626dcfe4..74ee13a3d2 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -104,6 +104,13 @@ [param stream] is the [AudioStream] resource to play. [param start_offset] is the number of seconds cut off at the beginning of the audio stream, while [param end_offset] is at the ending. </description> </method> + <method name="audio_track_is_use_blend" qualifiers="const"> + <return type="bool" /> + <param index="0" name="track_idx" type="int" /> + <description> + Returns [code]true[/code] if the track at [code]idx[/code] will be blended with other animations. + </description> + </method> <method name="audio_track_set_key_end_offset"> <return type="void" /> <param index="0" name="track_idx" type="int" /> @@ -131,6 +138,14 @@ Sets the stream of the key identified by [param key_idx] to value [param stream]. The [param track_idx] must be the index of an Audio Track. </description> </method> + <method name="audio_track_set_use_blend"> + <return type="void" /> + <param index="0" name="track_idx" type="int" /> + <param index="1" name="enable" type="bool" /> + <description> + Sets whether the track will be blended with other animations. If [code]true[/code], the audio playback volume changes depending on the blend value. + </description> + </method> <method name="bezier_track_get_key_in_handle" qualifiers="const"> <return type="Vector2" /> <param index="0" name="track_idx" type="int" /> diff --git a/doc/classes/AnimationNode.xml b/doc/classes/AnimationNode.xml index 6e3345b675..bc65e6013b 100644 --- a/doc/classes/AnimationNode.xml +++ b/doc/classes/AnimationNode.xml @@ -68,10 +68,10 @@ </description> </method> <method name="add_input"> - <return type="void" /> + <return type="bool" /> <param index="0" name="name" type="String" /> <description> - Adds an input to the node. This is only useful for nodes created for use in an [AnimationNodeBlendTree]. + Adds an input to the node. This is only useful for nodes created for use in an [AnimationNodeBlendTree]. If the addition fails, returns [code]false[/code]. </description> </method> <method name="blend_animation"> @@ -115,13 +115,20 @@ Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from [AnimationRootNode] instead, else editors will not display your node for addition. </description> </method> + <method name="find_input" qualifiers="const"> + <return type="int" /> + <param index="0" name="name" type="String" /> + <description> + Returns the input index which corresponds to [param name]. If not found, returns [code]-1[/code]. + </description> + </method> <method name="get_input_count" qualifiers="const"> <return type="int" /> <description> Amount of inputs in this node, only useful for nodes that go into [AnimationNodeBlendTree]. </description> </method> - <method name="get_input_name"> + <method name="get_input_name" qualifiers="const"> <return type="String" /> <param index="0" name="input" type="int" /> <description> @@ -157,6 +164,14 @@ Adds or removes a path for the filter. </description> </method> + <method name="set_input_name"> + <return type="bool" /> + <param index="0" name="input" type="int" /> + <param index="1" name="name" type="String" /> + <description> + Sets the name of the input at the given [param input] index. If the setting fails, returns [code]false[/code]. + </description> + </method> <method name="set_parameter"> <return type="void" /> <param index="0" name="name" type="StringName" /> diff --git a/doc/classes/AnimationNodeBlendSpace1D.xml b/doc/classes/AnimationNodeBlendSpace1D.xml index 0f1ce127cd..9a7872f50e 100644 --- a/doc/classes/AnimationNodeBlendSpace1D.xml +++ b/doc/classes/AnimationNodeBlendSpace1D.xml @@ -67,6 +67,9 @@ </method> </methods> <members> + <member name="blend_mode" type="int" setter="set_blend_mode" getter="get_blend_mode" enum="AnimationNodeBlendSpace1D.BlendMode" default="0"> + Controls the interpolation between animations. See [enum BlendMode] constants. + </member> <member name="max_space" type="float" setter="set_max_space" getter="get_max_space" default="1.0"> The blend space's axis's upper limit for the points' position. See [method add_blend_point]. </member> @@ -84,4 +87,15 @@ Label of the virtual axis of the blend space. </member> </members> + <constants> + <constant name="BLEND_MODE_INTERPOLATED" value="0" enum="BlendMode"> + The interpolation between animations is linear. + </constant> + <constant name="BLEND_MODE_DISCRETE" value="1" enum="BlendMode"> + The blend space plays the animation of the node the blending position is closest to. Useful for frame-by-frame 2D animations. + </constant> + <constant name="BLEND_MODE_DISCRETE_CARRY" value="2" enum="BlendMode"> + Similar to [constant BLEND_MODE_DISCRETE], but starts the new animation at the last animation's playback position. + </constant> + </constants> </class> diff --git a/doc/classes/AnimationNodeStateMachine.xml b/doc/classes/AnimationNodeStateMachine.xml index 0fb789875f..95891a9061 100644 --- a/doc/classes/AnimationNodeStateMachine.xml +++ b/doc/classes/AnimationNodeStateMachine.xml @@ -161,4 +161,9 @@ </description> </method> </methods> + <members> + <member name="allow_transition_to_self" type="bool" setter="set_allow_transition_to_self" getter="is_allow_transition_to_self" default="false"> + If [code]true[/code], allows teleport to the self state with [method AnimationNodeStateMachinePlayback.travel]. When the reset option is enabled in [method AnimationNodeStateMachinePlayback.travel], the animation is restarted. If [code]false[/code], nothing happens on the teleportation to the self state. + </member> + </members> </class> diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index eee25fad7c..bccab4613a 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -15,7 +15,7 @@ $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)); + GetNode<AnimationTree>("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.X == 0)); [/csharp] [/codeblocks] </member> diff --git a/doc/classes/AnimationNodeTransition.xml b/doc/classes/AnimationNodeTransition.xml index bca94a568a..bc3e5716dd 100644 --- a/doc/classes/AnimationNodeTransition.xml +++ b/doc/classes/AnimationNodeTransition.xml @@ -12,22 +12,18 @@ <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <methods> - <method name="find_input_caption" qualifiers="const"> - <return type="int" /> - <param index="0" name="caption" type="String" /> - <description> - </description> - </method> - <method name="get_input_caption" qualifiers="const"> - <return type="String" /> + <method name="is_input_reset" qualifiers="const"> + <return type="bool" /> <param index="0" name="input" type="int" /> <description> + Returns whether the animation restarts when the animation transitions from the other animation. </description> </method> <method name="is_input_set_as_auto_advance" qualifiers="const"> <return type="bool" /> <param index="0" name="input" type="int" /> <description> + Returns [code]true[/code] if auto-advance is enabled for the given [param input] index. </description> </method> <method name="set_input_as_auto_advance"> @@ -35,24 +31,27 @@ <param index="0" name="input" type="int" /> <param index="1" name="enable" type="bool" /> <description> + Enables or disables auto-advance for the given [param input] index. If enabled, state changes to the next input after playing the animation once. If enabled for the last input state, it loops to the first. </description> </method> - <method name="set_input_caption"> + <method name="set_input_reset"> <return type="void" /> <param index="0" name="input" type="int" /> - <param index="1" name="caption" type="String" /> + <param index="1" name="enable" type="bool" /> <description> + If [code]true[/code], the destination animation is restarted when the animation transitions. </description> </method> </methods> <members> - <member name="enabled_inputs" type="int" setter="set_enabled_inputs" getter="get_enabled_inputs" default="0"> - The number of enabled input ports for this node. + <member name="allow_transition_to_self" type="bool" setter="set_allow_transition_to_self" getter="is_allow_transition_to_self" default="false"> + If [code]true[/code], allows transition to the self state. When the reset option is enabled in input, the animation is restarted. If [code]false[/code], nothing happens on the transition to the self state. </member> - <member name="reset" type="bool" setter="set_reset" getter="is_reset" default="true"> - If [code]true[/code], the destination animation is played back from the beginning when switched. + <member name="input_count" type="int" setter="set_input_count" getter="get_input_count" default="0"> + The number of enabled input ports for this node. </member> <member name="xfade_curve" type="Curve" setter="set_xfade_curve" getter="get_xfade_curve"> + Determines how cross-fading between animations is eased. If empty, the transition will be linear. </member> <member name="xfade_time" type="float" setter="set_xfade_time" getter="get_xfade_time" default="0.0"> Cross-fading time (in seconds) between each animation connected to the inputs. diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index 304caeef43..25e4a4549d 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -15,6 +15,17 @@ <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <methods> + <method name="_post_process_key_value" qualifiers="virtual const"> + <return type="Variant" /> + <param index="0" name="animation" type="Animation" /> + <param index="1" name="track" type="int" /> + <param index="2" name="value" type="Variant" /> + <param index="3" name="object" type="Object" /> + <param index="4" name="object_idx" type="int" /> + <description> + A virtual function for processing after key getting during playback. + </description> + </method> <method name="add_animation_library"> <return type="int" enum="Error" /> <param index="0" name="name" type="StringName" /> @@ -102,13 +113,14 @@ <param index="0" name="anim_from" type="StringName" /> <param index="1" name="anim_to" type="StringName" /> <description> - Gets the blend time (in seconds) between two animations, referenced by their keys. + Returns the blend time (in seconds) between two animations, referenced by their keys. </description> </method> <method name="get_playing_speed" qualifiers="const"> <return type="float" /> <description> - Gets the actual playing speed of current animation or 0 if not playing. This speed is the [member playback_speed] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns a negative value if the current animation is playing backwards. </description> </method> <method name="get_queue"> @@ -134,7 +146,7 @@ <method name="is_playing" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if playing an animation. + Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]). </description> </method> <method name="pause"> @@ -152,7 +164,7 @@ <param index="3" name="from_end" type="bool" default="false" /> <description> Plays the animation with key [param name]. Custom blend times and speed can be set. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). - The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused, or restart if it was stopped (see [method stop] for both pause and stop). If the animation was already playing, it will keep playing. + The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. [b]Note:[/b] The animation will be updated the next time the [AnimationPlayer] is processed. If other variables are updated at the same time this is called, they may be updated too early. To perform the update immediately, call [code]advance(0)[/code]. </description> </method> @@ -210,7 +222,7 @@ <return type="void" /> <param index="0" name="keep_state" type="bool" default="false" /> <description> - Stops the currently playing animation. The animation position is reset to [code]0[/code] and the playback speed is reset to [code]1.0[/code]. See also [method pause]. + Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. If [param keep_state] is [code]true[/code], the animation state is not updated visually. [b]Note:[/b] The method / audio / animation playback tracks will not be processed by this method. </description> @@ -220,6 +232,10 @@ <member name="assigned_animation" type="String" setter="set_assigned_animation" getter="get_assigned_animation"> If playing, the the current animation's key, otherwise, the animation last played. When set, this changes the animation, but will not play it unless already playing. See also [member current_animation]. </member> + <member name="audio_max_polyphony" type="int" setter="set_audio_max_polyphony" getter="get_audio_max_polyphony" default="32"> + The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers. + For example, if this value is [code]32[/code] and the animation has two audio tracks, the two [AudioStreamPlayer]s assigned can play simultaneously up to [code]32[/code] voices each. + </member> <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default=""""> The key of the animation to play when the scene loads. </member> @@ -249,9 +265,6 @@ <member name="playback_process_mode" type="int" setter="set_process_callback" getter="get_process_callback" enum="AnimationPlayer.AnimationProcessCallback" default="1"> The process notification in which to update animations. </member> - <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> - The speed scaling ratio. For example, if this value is 1, then the animation plays at normal speed. If it's 0.5, then it plays at half speed. If it's 2, then it plays at double speed. - </member> <member name="reset_on_save" type="bool" setter="set_reset_on_save_enabled" getter="is_reset_on_save_enabled" default="true"> This is used by the editor. If set to [code]true[/code], the scene will be saved with the effects of the reset animation (the animation with the key [code]"RESET"[/code]) applied as if it had been seeked to time 0, with the editor keeping the values that the scene had before saving. This makes it more convenient to preview and edit animations in the editor, as changes to the scene will not be saved as long as they are set in the reset animation. @@ -259,6 +272,10 @@ <member name="root_node" type="NodePath" setter="set_root" getter="get_root" default="NodePath("..")"> The node from which node path references will travel. </member> + <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> + The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed. + If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance. + </member> </members> <signals> <signal name="animation_changed"> diff --git a/doc/classes/AnimationTree.xml b/doc/classes/AnimationTree.xml index 49bc4ee6af..86562c340d 100644 --- a/doc/classes/AnimationTree.xml +++ b/doc/classes/AnimationTree.xml @@ -12,6 +12,17 @@ <link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link> </tutorials> <methods> + <method name="_post_process_key_value" qualifiers="virtual const"> + <return type="Variant" /> + <param index="0" name="animation" type="Animation" /> + <param index="1" name="track" type="int" /> + <param index="2" name="value" type="Variant" /> + <param index="3" name="object" type="Object" /> + <param index="4" name="object_idx" type="int" /> + <description> + A virtual function for processing after key getting during playback. + </description> + </method> <method name="advance"> <return type="void" /> <param index="0" name="delta" type="float" /> @@ -99,6 +110,10 @@ <member name="anim_player" type="NodePath" setter="set_animation_player" getter="get_animation_player" default="NodePath("")"> The path to the [AnimationPlayer] used for animating. </member> + <member name="audio_max_polyphony" type="int" setter="set_audio_max_polyphony" getter="get_audio_max_polyphony" default="32"> + The number of possible simultaneous sounds for each of the assigned AudioStreamPlayers. + For example, if this value is [code]32[/code] and the animation has two audio tracks, the two [AudioStreamPlayer]s assigned can play simultaneously up to [code]32[/code] voices each. + </member> <member name="process_callback" type="int" setter="set_process_callback" getter="get_process_callback" enum="AnimationTree.AnimationProcessCallback" default="1"> The process mode of this [AnimationTree]. See [enum AnimationProcessCallback] for available modes. </member> diff --git a/doc/classes/Area2D.xml b/doc/classes/Area2D.xml index 3f76cc16ec..8a98921a60 100644 --- a/doc/classes/Area2D.xml +++ b/doc/classes/Area2D.xml @@ -87,8 +87,9 @@ <member name="gravity_point_center" type="Vector2" setter="set_gravity_point_center" getter="get_gravity_point_center" default="Vector2(0, 1)"> If gravity is a point (see [member gravity_point]), this will be the point of attraction. </member> - <member name="gravity_point_distance_scale" type="float" setter="set_gravity_point_distance_scale" getter="get_gravity_point_distance_scale" default="0.0"> - The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance. + <member name="gravity_point_unit_distance" type="float" setter="set_gravity_point_unit_distance" getter="get_gravity_point_unit_distance" default="0.0"> + The distance at which the gravity strength is equal to [member gravity]. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the [member gravity] to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. + The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance. </member> <member name="gravity_space_override" type="int" setter="set_gravity_space_override_mode" getter="get_gravity_space_override_mode" enum="Area2D.SpaceOverride" default="0"> Override mode for gravity calculations within this area. See [enum SpaceOverride] for possible values. diff --git a/doc/classes/Area3D.xml b/doc/classes/Area3D.xml index d40bca99d8..bd046b7cb8 100644 --- a/doc/classes/Area3D.xml +++ b/doc/classes/Area3D.xml @@ -86,8 +86,9 @@ <member name="gravity_point_center" type="Vector3" setter="set_gravity_point_center" getter="get_gravity_point_center" default="Vector3(0, -1, 0)"> If gravity is a point (see [member gravity_point]), this will be the point of attraction. </member> - <member name="gravity_point_distance_scale" type="float" setter="set_gravity_point_distance_scale" getter="get_gravity_point_distance_scale" default="0.0"> - The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance. + <member name="gravity_point_unit_distance" type="float" setter="set_gravity_point_unit_distance" getter="get_gravity_point_unit_distance" default="0.0"> + The distance at which the gravity strength is equal to [member gravity]. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set the [member gravity] to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on. + The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance. </member> <member name="gravity_space_override" type="int" setter="set_gravity_space_override_mode" getter="get_gravity_space_override_mode" enum="Area3D.SpaceOverride" default="0"> Override mode for gravity calculations within this area. See [enum SpaceOverride] for possible values. diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index ce4d7693d8..213a2254af 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -59,14 +59,14 @@ <param index="2" name="class_name" type="StringName" /> <param index="3" name="script" type="Variant" /> <description> - Creates a typed array from the [param base] array. The base array can't be already typed. See [method set_typed] for more details. + Creates a typed array from the [param base] array. </description> </constructor> <constructor name="Array"> <return type="Array" /> <param index="0" name="from" type="Array" /> <description> - Constructs an [Array] as a copy of the given [Array]. + Returns the same array as [param from]. If you need a copy of the array, use [method duplicate]. </description> </constructor> <constructor name="Array"> @@ -200,6 +200,13 @@ [/codeblock] </description> </method> + <method name="assign"> + <return type="void" /> + <param index="0" name="array" type="Array" /> + <description> + Assigns elements of another [param array] into the array. Resizes the array to match [param array]. Performs type conversions if the array is typed. + </description> + </method> <method name="back" qualifiers="const"> <return type="Variant" /> <description> @@ -392,7 +399,14 @@ <method name="is_read_only" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if the array is read-only. See [method set_read_only]. Arrays are automatically read-only if declared with [code]const[/code] keyword. + Returns [code]true[/code] if the array is read-only. See [method make_read_only]. Arrays are automatically read-only if declared with [code]const[/code] keyword. + </description> + </method> + <method name="is_same_typed" qualifiers="const"> + <return type="bool" /> + <param index="0" name="array" type="Array" /> + <description> + Returns [code]true[/code] if the array is typed the same as [param array]. </description> </method> <method name="is_typed" qualifiers="const"> @@ -401,6 +415,12 @@ Returns [code]true[/code] if the array is typed. Typed arrays can only store elements of their associated type and provide type safety for the [code][][/code] operator. Methods of typed array still return [Variant]. </description> </method> + <method name="make_read_only"> + <return type="void" /> + <description> + Makes the array read-only, i.e. disabled modifying of the array's elements. Does not apply to nested content, e.g. content of nested arrays. + </description> + </method> <method name="map" qualifiers="const"> <return type="Array" /> <param index="0" name="method" type="Callable" /> @@ -524,23 +544,6 @@ Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. </description> </method> - <method name="set_read_only"> - <return type="void" /> - <param index="0" name="enable" type="bool" /> - <description> - Makes the [Array] read-only, i.e. disabled modifying of the array's elements. Does not apply to nested content, e.g. content of nested arrays. - </description> - </method> - <method name="set_typed"> - <return type="void" /> - <param index="0" name="type" type="int" /> - <param index="1" name="class_name" type="StringName" /> - <param index="2" name="script" type="Variant" /> - <description> - Makes the [Array] typed. The [param type] should be one of the [enum Variant.Type] constants. [param class_name] is optional and can only be provided for [constant TYPE_OBJECT]. [param script] can only be provided if [param class_name] is not empty. - The method fails if an array is already typed. - </description> - </method> <method name="shuffle"> <return type="void" /> <description> @@ -620,13 +623,6 @@ [/codeblocks] </description> </method> - <method name="typed_assign"> - <return type="bool" /> - <param index="0" name="array" type="Array" /> - <description> - Assigns a different [Array] to this array reference. It the array is typed, the new array's type must be compatible and its elements will be automatically converted. - </description> - </method> </methods> <operators> <operator name="operator !="> diff --git a/doc/classes/ArrayMesh.xml b/doc/classes/ArrayMesh.xml index 7b86afcc4c..6dc66194b8 100644 --- a/doc/classes/ArrayMesh.xml +++ b/doc/classes/ArrayMesh.xml @@ -206,6 +206,7 @@ Overrides the [AABB] with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices. </member> <member name="shadow_mesh" type="ArrayMesh" setter="set_shadow_mesh" getter="get_shadow_mesh"> + An optional mesh which is used for rendering shadows and can be used for the depth prepass. Can be used to increase performance of shadow rendering by using a mesh that only contains vertex position data (without normals, UVs, colors, etc.). </member> </members> </class> diff --git a/doc/classes/AudioServer.xml b/doc/classes/AudioServer.xml index 36f12dd5c4..ae331f8491 100644 --- a/doc/classes/AudioServer.xml +++ b/doc/classes/AudioServer.xml @@ -29,13 +29,6 @@ Adds an [AudioEffect] effect to the bus [param bus_idx] at [param at_position]. </description> </method> - <method name="capture_get_device_list"> - <return type="PackedStringArray" /> - <description> - Returns the names of all audio input devices detected on the system. - [b]Note:[/b] [member ProjectSettings.audio/driver/enable_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. - </description> - </method> <method name="generate_bus_layout" qualifiers="const"> <return type="AudioBusLayout" /> <description> @@ -117,10 +110,11 @@ Returns the volume of the bus at index [param bus_idx] in dB. </description> </method> - <method name="get_device_list"> + <method name="get_input_device_list"> <return type="PackedStringArray" /> <description> - Returns the names of all audio devices detected on the system. + Returns the names of all audio input devices detected on the system. + [b]Note:[/b] [member ProjectSettings.audio/driver/enable_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. </description> </method> <method name="get_mix_rate" qualifiers="const"> @@ -129,6 +123,12 @@ Returns the sample rate at the output of the [AudioServer]. </description> </method> + <method name="get_output_device_list"> + <return type="PackedStringArray" /> + <description> + Returns the names of all audio output devices detected on the system. + </description> + </method> <method name="get_output_latency" qualifiers="const"> <return type="float" /> <description> @@ -302,12 +302,12 @@ <member name="bus_count" type="int" setter="set_bus_count" getter="get_bus_count" default="1"> Number of available audio buses. </member> - <member name="capture_device" type="String" setter="capture_set_device" getter="capture_get_device" default=""Default""> - Name of the current device for audio input (see [method capture_get_device_list]). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value [code]"Default"[/code] will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code]. + <member name="input_device" type="String" setter="set_input_device" getter="get_input_device" default=""Default""> + Name of the current device for audio input (see [method get_input_device_list]). On systems with multiple audio inputs (such as analog, USB and HDMI audio), this can be used to select the audio input device. The value [code]"Default"[/code] will record audio on the system-wide default audio input. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code]. [b]Note:[/b] [member ProjectSettings.audio/driver/enable_input] must be [code]true[/code] for audio input to work. See also that setting's description for caveats related to permissions and operating system privacy settings. </member> - <member name="device" type="String" setter="set_device" getter="get_device" default=""Default""> - Name of the current device for audio output (see [method get_device_list]). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value [code]"Default"[/code] will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code]. + <member name="output_device" type="String" setter="set_output_device" getter="get_output_device" default=""Default""> + Name of the current device for audio output (see [method get_output_device_list]). On systems with multiple audio outputs (such as analog, USB and HDMI audio), this can be used to select the audio output device. The value [code]"Default"[/code] will play audio on the system-wide default audio output. If an invalid device name is set, the value will be reverted back to [code]"Default"[/code]. </member> <member name="playback_speed_scale" type="float" setter="set_playback_speed_scale" getter="get_playback_speed_scale" default="1.0"> Scales the rate at which audio is played (i.e. setting it to [code]0.5[/code] will make the audio be played at half its speed). diff --git a/doc/classes/AudioStreamPlayer.xml b/doc/classes/AudioStreamPlayer.xml index 06e183f4e2..9b3a4f7bba 100644 --- a/doc/classes/AudioStreamPlayer.xml +++ b/doc/classes/AudioStreamPlayer.xml @@ -28,6 +28,12 @@ Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer]. </description> </method> + <method name="has_stream_playback"> + <return type="bool" /> + <description> + Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not. + </description> + </method> <method name="play"> <return type="void" /> <param index="0" name="from_position" type="float" default="0.0" /> diff --git a/doc/classes/AudioStreamPlayer2D.xml b/doc/classes/AudioStreamPlayer2D.xml index 81755b580f..18869e87cb 100644 --- a/doc/classes/AudioStreamPlayer2D.xml +++ b/doc/classes/AudioStreamPlayer2D.xml @@ -25,6 +25,12 @@ Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer2D]. </description> </method> + <method name="has_stream_playback"> + <return type="bool" /> + <description> + Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not. + </description> + </method> <method name="play"> <return type="void" /> <param index="0" name="from_position" type="float" default="0.0" /> diff --git a/doc/classes/AudioStreamPlayer3D.xml b/doc/classes/AudioStreamPlayer3D.xml index f711210ca1..d5a06dcad6 100644 --- a/doc/classes/AudioStreamPlayer3D.xml +++ b/doc/classes/AudioStreamPlayer3D.xml @@ -25,6 +25,12 @@ Returns the [AudioStreamPlayback] object associated with this [AudioStreamPlayer3D]. </description> </method> + <method name="has_stream_playback"> + <return type="bool" /> + <description> + Returns whether the [AudioStreamPlayer] can return the [AudioStreamPlayback] object or not. + </description> + </method> <method name="play"> <return type="void" /> <param index="0" name="from_position" type="float" default="0.0" /> diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 79e65f3472..8fc44d7536 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -18,17 +18,19 @@ callable.call("invalid") # Invalid call, should have at least 2 arguments. [/gdscript] [csharp] - public void PrintArgs(object arg1, object arg2, object arg3 = null) + // Default parameter values are not supported. + public void PrintArgs(Variant arg1, Variant arg2, Variant arg3 = default) { GD.PrintS(arg1, arg2, arg3); } public void Test() { - Callable callable = new Callable(this, nameof(PrintArgs)); - callable.Call("hello", "world"); // Prints "hello world null". + // Invalid calls fail silently. + Callable callable = new Callable(this, MethodName.PrintArgs); + callable.Call("hello", "world"); // Default parameter values are not supported, should have 3 arguments. callable.Call(Vector2.Up, 42, callable); // Prints "(0, -1) 42 Node(Node.cs)::PrintArgs". - callable.Call("invalid"); // Invalid call, should have at least 2 arguments. + callable.Call("invalid"); // Invalid call, should have 3 arguments. } [/csharp] [/codeblocks] diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index 9315a85e1f..4156c9451a 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -55,6 +55,18 @@ [b]Note:[/b] The returned value is not the same as [member Node2D.global_position], as it is affected by the drag properties. It is also not the same as the current position if [member position_smoothing_enabled] is [code]true[/code] (see [method get_screen_center_position]). </description> </method> + <method name="is_current" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if this [Camera2D] is the active camera (see [method Viewport.get_camera_2d]). + </description> + </method> + <method name="make_current"> + <return type="void" /> + <description> + Forces this [Camera2D] to become the current active one. [member enabled] must be [code]true[/code]. + </description> + </method> <method name="reset_smoothing"> <return type="void" /> <description> @@ -83,9 +95,6 @@ <member name="anchor_mode" type="int" setter="set_anchor_mode" getter="get_anchor_mode" enum="Camera2D.AnchorMode" default="1"> The Camera2D's anchor point. See [enum AnchorMode] constants. </member> - <member name="current" type="bool" setter="set_current" getter="is_current" default="false"> - If [code]true[/code], the camera acts as the active camera for its [Viewport] ancestor. Only one camera can be current in a given viewport, so setting a different camera in the same viewport [code]current[/code] will disable whatever camera was already active in that viewport. - </member> <member name="custom_viewport" type="Node" setter="set_custom_viewport" getter="get_custom_viewport"> The custom [Viewport] node attached to the [Camera2D]. If [code]null[/code] or not a [Viewport], uses the default viewport instead. </member> @@ -124,6 +133,10 @@ <member name="editor_draw_screen" type="bool" setter="set_screen_drawing_enabled" getter="is_screen_drawing_enabled" default="true"> If [code]true[/code], draws the camera's screen rectangle in the editor. </member> + <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true"> + Controls whether the camera can be active or not. If [code]true[/code], the [Camera2D] will become the main camera when it enters the scene tree and there is no active camera currently (see [method Viewport.get_camera_2d]). + When the camera is currently active and [member enabled] is set to [code]false[/code], the next enabled [Camera2D] in the scene tree will become active. + </member> <member name="ignore_rotation" type="bool" setter="set_ignore_rotation" getter="is_ignoring_rotation" default="true"> If [code]true[/code], the camera's rendered view is not affected by its [member Node2D.rotation] and [member Node2D.global_rotation]. </member> diff --git a/doc/classes/Color.xml b/doc/classes/Color.xml index 57278d9241..cee0e3ef7d 100644 --- a/doc/classes/Color.xml +++ b/doc/classes/Color.xml @@ -233,7 +233,6 @@ <description> Returns a new color from [param rgba], an HTML hexadecimal color string. [param rgba] is not case-sensitive, and may be prefixed by a hash sign ([code]#[/code]). [param rgba] must be a valid three-digit or six-digit hexadecimal color string, and may contain an alpha channel value. If [param rgba] does not contain an alpha channel value, an alpha channel value of 1.0 is applied. If [param rgba] is invalid, returns an empty color. - [b]Note:[/b] In C#, this method is not implemented. The same functionality is provided by the Color constructor. [codeblocks] [gdscript] var blue = Color.html("#0000ff") # blue is Color(0.0, 0.0, 1.0, 1.0) @@ -264,13 +263,13 @@ Color.html_is_valid("#55aaFF5") # Returns false [/gdscript] [csharp] - Color.IsHtmlValid("#55AAFF"); // Returns true - Color.IsHtmlValid("#55AAFF20"); // Returns true - Color.IsHtmlValid("55AAFF"); // Returns true - Color.IsHtmlValid("#F2C"); // Returns true + Color.HtmlIsValid("#55AAFF"); // Returns true + Color.HtmlIsValid("#55AAFF20"); // Returns true + Color.HtmlIsValid("55AAFF"); // Returns true + Color.HtmlIsValid("#F2C"); // Returns true - Color.IsHtmlValid("#AABBC"); // Returns false - Color.IsHtmlValid("#55aaFF5"); // Returns false + Color.HtmlIsValid("#AABBC"); // Returns false + Color.HtmlIsValid("#55aaFF5"); // Returns false [/csharp] [/codeblocks] </description> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 7082eff97d..d74ddba369 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -37,11 +37,11 @@ return typeof(data) == TYPE_DICTIONARY and data.has("expected") [/gdscript] [csharp] - public override bool CanDropData(Vector2 position, object data) + public override bool _CanDropData(Vector2 atPosition, Variant data) { // Check position if it is relevant to you // Otherwise, just check data - return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("expected"); + return data.VariantType == Variant.Type.Dictionary && data.AsGodotDictionary().Contains("expected"); } [/csharp] [/codeblocks] @@ -57,17 +57,19 @@ [gdscript] func _can_drop_data(position, data): return typeof(data) == TYPE_DICTIONARY and data.has("color") + func _drop_data(position, data): var color = data["color"] [/gdscript] [csharp] - public override bool CanDropData(Vector2 position, object data) + public override bool _CanDropData(Vector2 atPosition, Variant data) { - return data is Godot.Collections.Dictionary && (data as Godot.Collections.Dictionary).Contains("color"); + return data.VariantType == Variant.Type.Dictionary && dict.AsGodotDictionary().Contains("color"); } - public override void DropData(Vector2 position, object data) + + public override void _DropData(Vector2 atPosition, Variant data) { - Color color = (Color)(data as Godot.Collections.Dictionary)["color"]; + Color color = data.AsGodotDictionary()["color"].AsColor(); } [/csharp] [/codeblocks] @@ -87,11 +89,11 @@ return mydata [/gdscript] [csharp] - public override object GetDragData(Vector2 position) + public override Variant _GetDragData(Vector2 atPosition) { - object mydata = MakeData(); // This is your custom method generating the drag data. - SetDragPreview(MakePreview(mydata)); // This is your custom method generating the preview of the drag data. - return mydata; + var myData = MakeData(); // This is your custom method generating the drag data. + SetDragPreview(MakePreview(myData)); // This is your custom method generating the preview of the drag data. + return myData; } [/csharp] [/codeblocks] @@ -121,10 +123,9 @@ [csharp] public override void _GuiInput(InputEvent @event) { - if (@event is InputEventMouseButton) + if (@event is InputEventMouseButton mb) { - var mb = @event as InputEventMouseButton; - if (mb.ButtonIndex == (int)ButtonList.Left && mb.Pressed) + if (mb.ButtonIndex == MouseButton.Left && mb.Pressed) { GD.Print("I've been clicked D:"); } @@ -168,7 +169,7 @@ return label [/gdscript] [csharp] - public override Godot.Control _MakeCustomTooltip(String forText) + public override Control _MakeCustomTooltip(string forText) { var label = new Label(); label.Text = forText; @@ -185,7 +186,7 @@ return tooltip [/gdscript] [csharp] - public override Godot.Control _MakeCustomTooltip(String forText) + public override Control _MakeCustomTooltip(string forText) { Node tooltip = ResourceLoader.Load<PackedScene>("res://some_tooltip_scene.tscn").Instantiate(); tooltip.GetNode<Label>("Label").Text = forText; @@ -229,11 +230,11 @@ [/gdscript] [csharp] // Given the child Label node "MyLabel", override its font color with a custom value. - GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0)) + GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", new Color(1, 0.5f, 0)); // Reset the font color of the child label. - GetNode<Label>("MyLabel").RemoveThemeColorOverride("font_color") + GetNode<Label>("MyLabel").RemoveThemeColorOverride("font_color"); // Alternatively it can be overridden with the default value from the Label type. - GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label")) + GetNode<Label>("MyLabel").AddThemeColorOverride("font_color", GetThemeColor("font_color", "Label")); [/csharp] [/codeblocks] </description> @@ -383,7 +384,9 @@ <method name="get_global_rect" qualifiers="const"> <return type="Rect2" /> <description> - Returns the position and size of the control relative to the [CanvasLayer]. See [member global_position] and [member size]. + Returns the position and size of the control relative to the containing canvas. See [member global_position] and [member size]. + [b]Note:[/b] If the node itself or any parent [CanvasItem] between the node and the canvas have a non default rotation or skew, the resulting size is likely not meaningful. + [b]Note:[/b] Setting [member Viewport.gui_snap_controls_to_pixels] to [code]true[/code] can lead to rounding inaccuracies between the displayed control and the returned [Rect2]. </description> </method> <method name="get_minimum_size" qualifiers="const"> @@ -414,7 +417,9 @@ <method name="get_rect" qualifiers="const"> <return type="Rect2" /> <description> - Returns the position and size of the control relative to the top-left corner of the parent Control. See [member position] and [member size]. + Returns the position and size of the control in the coordinate system of the containing node. See [member position], [member scale] and [member size]. + [b]Note:[/b] If [member rotation] is not the default rotation, the resulting size is not meaningful. + [b]Note:[/b] Setting [member Viewport.gui_snap_controls_to_pixels] to [code]true[/code] can lead to rounding inaccuracies between the displayed control and the returned [Rect2]. </description> </method> <method name="get_screen_position" qualifiers="const"> @@ -538,12 +543,12 @@ [codeblocks] [gdscript] func _process(delta): - grab_click_focus() #when clicking another Control node, this node will be clicked instead + grab_click_focus() # When clicking another Control node, this node will be clicked instead. [/gdscript] [csharp] - public override void _Process(float delta) + public override void _Process(double delta) { - GrabClickFocus(); //when clicking another Control node, this node will be clicked instead + GrabClickFocus(); // When clicking another Control node, this node will be clicked instead. } [/csharp] [/codeblocks] @@ -808,16 +813,16 @@ [/gdscript] [csharp] [Export] - public Color Color = new Color(1, 0, 0, 1); + private Color _color = new Color(1, 0, 0, 1); - public override object GetDragData(Vector2 position) + public override Variant _GetDragData(Vector2 atPosition) { // Use a control that is not in the tree var cpb = new ColorPickerButton(); - cpb.Color = Color; - cpb.RectSize = new Vector2(50, 50); + cpb.Color = _color; + cpb.Size = new Vector2(50, 50); SetDragPreview(cpb); - return Color; + return _color; } [/csharp] [/codeblocks] @@ -895,6 +900,7 @@ <param index="0" name="position" type="Vector2" /> <description> Moves the mouse cursor to [param position], relative to [member position] of this [Control]. + [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web. </description> </method> </methods> @@ -991,7 +997,7 @@ By default, the node's pivot is its top-left corner. When you change its [member rotation] or [member scale], it will rotate or scale around this pivot. Set this property to [member size] / 2 to pivot around the Control's center. </member> <member name="position" type="Vector2" setter="_set_position" getter="get_position" default="Vector2(0, 0)"> - The node's position, relative to its parent. It corresponds to the rectangle's top-left corner. The property is not affected by [member pivot_offset]. + The node's position, relative to its containing node. It corresponds to the rectangle's top-left corner. The property is not affected by [member pivot_offset]. </member> <member name="rotation" type="float" setter="set_rotation" getter="get_rotation" default="0.0"> The node's rotation around its pivot, in radians. See [member pivot_offset] to change the pivot's position. @@ -1008,7 +1014,7 @@ The [Node] which must be a parent of the focused [Control] for the shortcut to be activated. If [code]null[/code], the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused. </member> <member name="size" type="Vector2" setter="_set_size" getter="get_size" default="Vector2(0, 0)"> - The size of the node's bounding rectangle, in pixels. [Container] nodes update this property automatically. + The size of the node's bounding rectangle, in the node's coordinate system. [Container] nodes update this property automatically. </member> <member name="size_flags_horizontal" type="int" setter="set_h_size_flags" getter="get_h_size_flags" enum="Control.SizeFlags" default="1"> Tells the parent [Container] nodes how they should resize and place the node on the X axis. Use one of the [enum SizeFlags] constants to change the flags. See the constants to learn what each does. diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml index ade63225dc..a7e7e756c6 100644 --- a/doc/classes/Crypto.xml +++ b/doc/classes/Crypto.xml @@ -9,9 +9,11 @@ [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) @@ -35,35 +37,35 @@ [/gdscript] [csharp] using Godot; - using System; using System.Diagnostics; - public class CryptoNode : Node + public partial class MyNode : Node { - public Crypto Crypto = new Crypto(); - public CryptoKey Key = new CryptoKey(); - public X509Certificate Cert = new X509Certificate(); + private Crypto _crypto = new Crypto(); + private CryptoKey _key = new CryptoKey(); + private X509Certificate _cert = new X509Certificate(); + public override void _Ready() { // Generate new RSA key. - Key = Crypto.GenerateRsa(4096); + _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"); + _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"); + _key.Save("user://generated.key"); + _cert.Save("user://generated.crt"); // Encryption string data = "Some data"; - byte[] encrypted = Crypto.Encrypt(Key, data.ToUTF8()); + byte[] encrypted = _crypto.Encrypt(_key, data.ToUtf8()); // Decryption - byte[] decrypted = Crypto.Decrypt(Key, encrypted); + byte[] decrypted = _crypto.Decrypt(_key, encrypted); // Signing - byte[] signature = Crypto.Sign(HashingContext.HashType.Sha256, Data.SHA256Buffer(), Key); + byte[] signature = _crypto.Sign(HashingContext.HashType.Sha256, Data.Sha256Buffer(), _key); // Verifying - bool verified = Crypto.Verify(HashingContext.HashType.Sha256, Data.SHA256Buffer(), signature, Key); + bool verified = _crypto.Verify(HashingContext.HashType.Sha256, Data.Sha256Buffer(), signature, _key); // Checks Debug.Assert(verified); - Debug.Assert(data.ToUTF8() == decrypted); + Debug.Assert(data.ToUtf8() == decrypted); } } [/csharp] diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml index b5e75dff68..fe597d0955 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -162,6 +162,8 @@ <param index="0" name="max_stages" type="int" default="5" /> <param index="1" name="tolerance_length" type="float" default="20.0" /> <description> + Returns a list of points along the curve, with almost uniform density. [param max_stages] controls how many subdivisions a curve segment may face before it is considered approximate enough. Each subdivision splits the segment in half, so the default 5 stages may mean up to 32 subdivisions per curve segment. Increase with care! + [param tolerance_length] controls the maximal distance between two neighboring points, before the segment has to be subdivided. </description> </method> </methods> diff --git a/doc/classes/DTLSServer.xml b/doc/classes/DTLSServer.xml index 457513b8aa..ae1ba10ec7 100644 --- a/doc/classes/DTLSServer.xml +++ b/doc/classes/DTLSServer.xml @@ -38,45 +38,46 @@ p.put_packet("Hello DTLS client".to_utf8()) [/gdscript] [csharp] - using Godot; - using System; // ServerNode.cs - public class ServerNode : Node + using Godot; + + public partial class ServerNode : Node { - public DTLSServer Dtls = new DTLSServer(); - public UDPServer Server = new UDPServer(); - public Godot.Collections.Array<PacketPeerDTLS> Peers = new Godot.Collections.Array<PacketPeerDTLS>(); + private DtlsServer _dtls = new DtlsServer(); + private UdpServer _server = new UdpServer(); + private Godot.Collections.Array<PacketPeerDTLS> _peers = new Godot.Collections.Array<PacketPeerDTLS>(); + public override void _Ready() { - Server.Listen(4242); + _server.Listen(4242); var key = GD.Load<CryptoKey>("key.key"); // Your private key. var cert = GD.Load<X509Certificate>("cert.crt"); // Your X509 certificate. - Dtls.Setup(key, cert); + _dtls.Setup(key, cert); } - public override void _Process(float delta) + public override void _Process(double delta) { while (Server.IsConnectionAvailable()) { - PacketPeerUDP peer = Server.TakeConnection(); - PacketPeerDTLS dtlsPeer = Dtls.TakeConnection(peer); - if (dtlsPeer.GetStatus() != PacketPeerDTLS.Status.Handshaking) + PacketPeerUDP peer = _server.TakeConnection(); + PacketPeerDTLS dtlsPeer = _dtls.TakeConnection(peer); + if (dtlsPeer.GetStatus() != PacketPeerDtls.Status.Handshaking) { continue; // It is normal that 50% of the connections fails due to cookie exchange. } GD.Print("Peer connected!"); - Peers.Add(dtlsPeer); + _peers.Add(dtlsPeer); } - foreach (var p in Peers) + foreach (var p in _peers) { p.Poll(); // Must poll to update the state. - if (p.GetStatus() == PacketPeerDTLS.Status.Connected) + if (p.GetStatus() == PacketPeerDtls.Status.Connected) { while (p.GetAvailablePacketCount() > 0) { - GD.Print("Received Message From Client: " + p.GetPacket().GetStringFromUTF8()); - p.PutPacket("Hello Dtls Client".ToUTF8()); + GD.Print($"Received Message From Client: {p.GetPacket().GetStringFromUtf8()}"); + p.PutPacket("Hello DTLS Client".ToUtf8()); } } } @@ -108,34 +109,36 @@ connected = true [/gdscript] [csharp] + // ClientNode.cs using Godot; using System.Text; - // ClientNode.cs - public class ClientNode : Node + + public partial class ClientNode : Node { - public PacketPeerDTLS Dtls = new PacketPeerDTLS(); - public PacketPeerUDP Udp = new PacketPeerUDP(); - public bool Connected = false; + private PacketPeerDtls _dtls = new PacketPeerDtls(); + private PacketPeerUdp _udp = new PacketPeerUdp(); + private bool _connected = false; + public override void _Ready() { - Udp.ConnectToHost("127.0.0.1", 4242); - Dtls.ConnectToPeer(Udp, false); // Use true in production for certificate validation! + _udp.ConnectToHost("127.0.0.1", 4242); + _dtls.ConnectToPeer(_udp, validateCerts: false); // Use true in production for certificate validation! } - public override void _Process(float delta) + public override void _Process(double delta) { - Dtls.Poll(); - if (Dtls.GetStatus() == PacketPeerDTLS.Status.Connected) + _dtls.Poll(); + if (_dtls.GetStatus() == PacketPeerDtls.Status.Connected) { - if (!Connected) + if (!_connected) { // Try to contact server - Dtls.PutPacket("The Answer Is..42!".ToUTF8()); + _dtls.PutPacket("The Answer Is..42!".ToUtf8()); } - while (Dtls.GetAvailablePacketCount() > 0) + while (_dtls.GetAvailablePacketCount() > 0) { - GD.Print("Connected: " + Dtls.GetPacket().GetStringFromUTF8()); - Connected = true; + GD.Print($"Connected: {_dtls.GetPacket().GetStringFromUtf8()}"); + _connected = true; } } } @@ -148,11 +151,9 @@ <methods> <method name="setup"> <return type="int" enum="Error" /> - <param index="0" name="key" type="CryptoKey" /> - <param index="1" name="certificate" type="X509Certificate" /> - <param index="2" name="chain" type="X509Certificate" default="null" /> + <param index="0" name="server_options" type="TLSOptions" /> <description> - Setup the DTLS server to use the given [param key] and provide the given [param certificate] to clients. You can pass the optional [param chain] parameter to provide additional CA chain information along with the certificate. + Setup the DTLS server to use the given [param server_options]. See [method TLSOptions.server]. </description> </method> <method name="take_connection"> diff --git a/doc/classes/Decal.xml b/doc/classes/Decal.xml index b9d3f1d81e..fb8bc18c1a 100644 --- a/doc/classes/Decal.xml +++ b/doc/classes/Decal.xml @@ -75,9 +75,6 @@ <member name="emission_energy" type="float" setter="set_emission_energy" getter="get_emission_energy" default="1.0"> Energy multiplier for the emission texture. This will make the decal emit light at a higher or lower intensity, independently of the albedo color. See also [member modulate]. </member> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - Sets the size of the [AABB] used by the decal. The AABB goes from [code]-extents[/code] to [code]extents[/code]. - </member> <member name="lower_fade" type="float" setter="set_lower_fade" getter="get_lower_fade" default="0.3"> Sets the curve over which the decal will fade as the surface gets further from the center of the [AABB]. Only positive values are valid (negative values will be clamped to [code]0.0[/code]). See also [member upper_fade]. </member> @@ -88,6 +85,9 @@ Fades the Decal if the angle between the Decal's [AABB] and the target surface becomes too large. A value of [code]0[/code] projects the Decal regardless of angle, a value of [code]1[/code] limits the Decal to surfaces that are nearly perpendicular. [b]Note:[/b] Setting [member normal_fade] to a value greater than [code]0.0[/code] has a small performance cost due to the added normal angle computations. </member> + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + Sets the size of the [AABB] used by the decal. The AABB goes from [code]-size/2[/code] to [code]size/2[/code]. + </member> <member name="texture_albedo" type="Texture2D" setter="set_texture" getter="get_texture"> [Texture2D] with the base [Color] of the Decal. Either this or the [member texture_emission] must be set for the Decal to be visible. Use the alpha channel like a mask to smoothly blend the edges of the decal with the underlying object. [b]Note:[/b] Unlike [BaseMaterial3D] whose filter mode can be adjusted on a per-material basis, the filter mode for [Decal] textures is set globally with [member ProjectSettings.rendering/textures/decals/filter]. diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 5f99ba82b8..a5a50b4c6a 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -42,7 +42,7 @@ You can access a dictionary's value by referencing its corresponding key. In the above example, [code]points_dict["White"][/code] will return [code]50[/code]. You can also write [code]points_dict.White[/code], which is equivalent. However, you'll have to use the bracket syntax if the key you're accessing the dictionary with isn't a fixed string (such as a number or variable). [codeblocks] [gdscript] - @export(String, "White", "Yellow", "Orange") var my_color + @export_enum("White", "Yellow", "Orange") var my_color: String var points_dict = {"White": 50, "Yellow": 75, "Orange": 100} func _ready(): # We can't use dot syntax here as `my_color` is a variable. @@ -51,7 +51,7 @@ [csharp] [Export(PropertyHint.Enum, "White,Yellow,Orange")] public string MyColor { get; set; } - public Godot.Collections.Dictionary pointsDict = new Godot.Collections.Dictionary + private Godot.Collections.Dictionary _pointsDict = new Godot.Collections.Dictionary { {"White", 50}, {"Yellow", 75}, @@ -60,7 +60,7 @@ public override void _Ready() { - int points = (int)pointsDict[MyColor]; + int points = (int)_pointsDict[MyColor]; } [/csharp] [/codeblocks] @@ -153,7 +153,7 @@ <return type="Dictionary" /> <param index="0" name="from" type="Dictionary" /> <description> - Returns the same array as [param from]. If you need a copy of the array, use [method duplicate]. + Returns the same dictionary as [param from]. If you need a copy of the dictionary, use [method duplicate]. </description> </constructor> </constructors> @@ -271,12 +271,24 @@ Returns [code]true[/code] if the dictionary is empty (its size is [code]0[/code]). See also [method size]. </description> </method> + <method name="is_read_only" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the dictionary is read-only. See [method make_read_only]. Dictionaries are automatically read-only if declared with [code]const[/code] keyword. + </description> + </method> <method name="keys" qualifiers="const"> <return type="Array" /> <description> Returns the list of keys in the dictionary. </description> </method> + <method name="make_read_only"> + <return type="void" /> + <description> + Makes the dictionary read-only, i.e. disables modification of the dictionary's contents. Does not apply to nested content, e.g. content of nested dictionaries. + </description> + </method> <method name="merge"> <return type="void" /> <param index="0" name="dictionary" type="Dictionary" /> diff --git a/doc/classes/DirAccess.xml b/doc/classes/DirAccess.xml index 181d2eb485..27f2eb7f2f 100644 --- a/doc/classes/DirAccess.xml +++ b/doc/classes/DirAccess.xml @@ -44,11 +44,11 @@ { if (dir.CurrentIsDir()) { - GD.Print("Found directory: " + fileName); + GD.Print($"Found directory: {fileName}"); } else { - GD.Print("Found file: " + fileName); + GD.Print($"Found file: {fileName}"); } fileName = dir.GetNext(); } diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index b77ec4c517..6f4a7fc13d 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -190,6 +190,7 @@ <description> Adds a new checkable item with text [param label] to the global menu with ID [param menu_root]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -211,6 +212,7 @@ <description> Adds a new checkable item with text [param label] and icon [param icon] to the global menu with ID [param menu_root]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -232,6 +234,7 @@ <description> Adds a new item with text [param label] and icon [param icon] to the global menu with ID [param menu_root]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -254,6 +257,7 @@ Adds a new radio-checkable item with text [param label] and icon [param icon] to the global menu with ID [param menu_root]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. [b]Note:[/b] Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method global_menu_set_item_checked] for more info on how to control it. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -274,6 +278,7 @@ <description> Adds a new item with text [param label] to the global menu with ID [param menu_root]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -285,7 +290,7 @@ <method name="global_menu_add_multistate_item"> <return type="int" /> <param index="0" name="menu_root" type="String" /> - <param index="1" name="labe" type="String" /> + <param index="1" name="label" type="String" /> <param index="2" name="max_states" type="int" /> <param index="3" name="default_state" type="int" /> <param index="4" name="callback" type="Callable" /> @@ -294,10 +299,11 @@ <param index="7" name="accelerator" type="int" enum="Key" default="0" /> <param index="8" name="index" type="int" default="-1" /> <description> - Adds a new item with text [param labe] to the global menu with ID [param menu_root]. + Adds a new item with text [param label] to the global menu with ID [param menu_root]. Contrarily to normal binary items, multistate items can have more than two states, as defined by [param max_states]. Each press or activate of the item will increase the state by one. The default value is defined by [param default_state]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. [b]Note:[/b] By default, there's no indication of the current item state, it should be changed manually. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -319,6 +325,7 @@ Adds a new radio-checkable item with text [param label] to the global menu with ID [param menu_root]. Returns index of the inserted item, it's not guaranteed to be the same as [param index] value. [b]Note:[/b] Radio-checkable items just display a checkmark, but don't have any built-in checking behavior and must be checked/unchecked manually. See [method global_menu_set_item_checked] for more info on how to control it. + [b]Note:[/b] The [param callback] and [param key_callback] Callables need to accept exactly one Variant parameter, the parameter passed to the Callables will be the value passed to [param tag]. [b]Note:[/b] This method is implemented on macOS. [b]Supported system menu IDs:[/b] [codeblock] @@ -562,6 +569,7 @@ <param index="2" name="callback" type="Callable" /> <description> Sets the callback of the item at index [param idx]. Callback is emitted when an item is pressed. + [b]Note:[/b] The [param callback] Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created. [b]Note:[/b] This method is implemented on macOS. </description> </method> @@ -623,6 +631,7 @@ <param index="2" name="key_callback" type="Callable" /> <description> Sets the callback of the item at index [param idx]. Callback is emitted when its accelerator is activated. + [b]Note:[/b] The [param key_callback] Callable needs to accept exactly one Variant parameter, the parameter passed to the Callable will be the value passed to the tag parameter when the menu item was created. [b]Note:[/b] This method is implemented on macOS. </description> </method> @@ -1090,6 +1099,7 @@ <param index="0" name="position" type="Vector2i" /> <description> Sets the mouse cursor position to the given [param position] relative to an origin at the upper left corner of the currently focused game Window Manager window. + [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web. </description> </method> <method name="window_can_draw" qualifiers="const"> diff --git a/doc/classes/EditorCommandPalette.xml b/doc/classes/EditorCommandPalette.xml index 380c79fc1a..448a622ae4 100644 --- a/doc/classes/EditorCommandPalette.xml +++ b/doc/classes/EditorCommandPalette.xml @@ -16,7 +16,7 @@ [csharp] EditorCommandPalette commandPalette = GetEditorInterface().GetCommandPalette(); // ExternalCommand is a function that will be called with the command is executed. - Callable commandCallable = new Callable(this, nameof(ExternalCommand)); + Callable commandCallable = new Callable(this, MethodName.ExternalCommand); commandPalette.AddCommand("command", "test/command", commandCallable) [/csharp] [/codeblocks] diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index c395815117..6a976d218f 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -37,8 +37,8 @@ return [{"name": "my_option", "default_value": false}] func _import(source_file, save_path, options, platform_variants, gen_files): - var file = File.new() - if file.open(source_file, File.READ) != OK: + var file = FileAccess.open(source_file, FileAccess.READ) + if file == null: return FAILED var mesh = ArrayMesh.new() # Fill the Mesh with data read in "file", left as an exercise to the reader. @@ -48,61 +48,67 @@ [/gdscript] [csharp] using Godot; - using System; - public class MySpecialPlugin : EditorImportPlugin + public partial class MySpecialPlugin : EditorImportPlugin { - public override String GetImporterName() + public override string _GetImporterName() { return "my.special.plugin"; } - public override String GetVisibleName() + public override string _GetVisibleName() { return "Special Mesh"; } - public override Godot.Collections.Array GetRecognizedExtensions() + public override string[] _GetRecognizedExtensions() { - return new Godot.Collections.Array{"special", "spec"}; + return new string[] { "special", "spec" }; } - public override String GetSaveExtension() + public override string _GetSaveExtension() { return "mesh"; } - public override String GetResourceType() + public override string _GetResourceType() { return "Mesh"; } - public override int GetPresetCount() + public override int _GetPresetCount() { return 1; } - public override String GetPresetName(int i) + public override string _GetPresetName(int presetIndex) { return "Default"; } - public override Godot.Collections.Array GetImportOptions(int i) + public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetImportOptions(string path, int presetIndex) { - return new Godot.Collections.Array{new Godot.Collections.Dictionary{{"name", "myOption"}, {"defaultValue", false}}}; + return new Godot.Collections.Array<Godot.Collections.Dictionary> + { + new Godot.Collections.Dictionary + { + { "name", "myOption" }, + { "defaultValue", false }, + } + }; } - public override int Import(String sourceFile, String savePath, Godot.Collections.Dictionary options, Godot.Collections.Array platformVariants, Godot.Collections.Array genFiles) + public override int _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles) { - var file = new File(); - if (file.Open(sourceFile, File.ModeFlags.Read) != Error.Ok) + using var file = FileAccess.Open(sourceFile, FileAccess.ModeFlags.Read); + if (file.GetError() != Error.Ok) { return (int)Error.Failed; } var mesh = new ArrayMesh(); // Fill the Mesh with data read in "file", left as an exercise to the reader. - String filename = savePath + "." + GetSaveExtension(); + string filename = $"{savePath}.{_GetSaveExtension()}"; return (int)ResourceSaver.Save(mesh, filename); } } @@ -210,7 +216,7 @@ </description> </method> <method name="_import" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="source_file" type="String" /> <param index="1" name="save_path" type="String" /> <param index="2" name="options" type="Dictionary" /> diff --git a/doc/classes/EditorInspectorPlugin.xml b/doc/classes/EditorInspectorPlugin.xml index ba2f7b24bf..7ffd7f9426 100644 --- a/doc/classes/EditorInspectorPlugin.xml +++ b/doc/classes/EditorInspectorPlugin.xml @@ -56,11 +56,11 @@ <method name="_parse_property" qualifiers="virtual"> <return type="bool" /> <param index="0" name="object" type="Object" /> - <param index="1" name="type" type="int" /> + <param index="1" name="type" type="int" enum="Variant.Type" /> <param index="2" name="name" type="String" /> - <param index="3" name="hint_type" type="int" /> + <param index="3" name="hint_type" type="int" enum="PropertyHint" /> <param index="4" name="hint_string" type="String" /> - <param index="5" name="usage_flags" type="int" /> + <param index="5" name="usage_flags" type="int" enum="PropertyUsageFlags" /> <param index="6" name="wide" type="bool" /> <description> Called to allow adding property-specific editors to the property list for [param object]. The added editor control must extend [EditorProperty]. Returning [code]true[/code] removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one. diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 326c4f6456..f4b912de9e 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -69,21 +69,22 @@ return EditorPlugin.AFTER_GUI_INPUT_PASS [/gdscript] [csharp] - public override void _Forward3dDrawOverViewport(Godot.Control overlay) + public override void _Forward3DDrawOverViewport(Control viewportControl) { // Draw a circle at cursor position. - overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); + viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White); } - public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Godot.Camera3D camera, InputEvent @event) + public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D viewportCamera, InputEvent @event) { if (@event is InputEventMouseMotion) { // Redraw viewport when cursor is moved. UpdateOverlays(); - return EditorPlugin.AFTER_GUI_INPUT_STOP; + return EditorPlugin.AfterGuiInput.Stop; } - return EditorPlugin.AFTER_GUI_INPUT_PASS; + return EditorPlugin.AfterGuiInput.Pass; + } [/csharp] [/codeblocks] </description> @@ -111,9 +112,9 @@ [/gdscript] [csharp] // Prevents the InputEvent from reaching other Editor classes. - public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Camera3D camera, InputEvent @event) + public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event) { - return EditorPlugin.AFTER_GUI_INPUT_STOP; + return EditorPlugin.AfterGuiInput.Stop; } [/csharp] [/codeblocks] @@ -127,9 +128,9 @@ [/gdscript] [csharp] // Consumes InputEventMouseMotion and forwards other InputEvent types. - public override EditorPlugin.AfterGUIInput _Forward3dGuiInput(Camera3D camera, InputEvent @event) + public override EditorPlugin.AfterGuiInput _Forward3DGuiInput(Camera3D camera, InputEvent @event) { - return @event is InputEventMouseMotion ? EditorPlugin.AFTER_GUI_INPUT_STOP : EditorPlugin.AFTER_GUI_INPUT_PASS; + return @event is InputEventMouseMotion ? EditorPlugin.AfterGuiInput.Stop : EditorPlugin.AfterGuiInput.Pass; } [/csharp] [/codeblocks] @@ -154,13 +155,13 @@ return false [/gdscript] [csharp] - public override void ForwardCanvasDrawOverViewport(Godot.Control overlay) + public override void _ForwardCanvasDrawOverViewport(Control viewportControl) { // Draw a circle at cursor position. - overlay.DrawCircle(overlay.GetLocalMousePosition(), 64, Colors.White); + viewportControl.DrawCircle(viewportControl.GetLocalMousePosition(), 64, Colors.White); } - public override bool ForwardCanvasGuiInput(InputEvent @event) + public override bool _ForwardCanvasGuiInput(InputEvent @event) { if (@event is InputEventMouseMotion) { @@ -169,6 +170,7 @@ return true; } return false; + } [/csharp] [/codeblocks] </description> @@ -213,12 +215,13 @@ [/gdscript] [csharp] // Consumes InputEventMouseMotion and forwards other InputEvent types. - public override bool ForwardCanvasGuiInput(InputEvent @event) + public override bool _ForwardCanvasGuiInput(InputEvent @event) { - if (@event is InputEventMouseMotion) { + if (@event is InputEventMouseMotion) + { return true; } - return false + return false; } [/csharp] [/codeblocks] @@ -245,7 +248,7 @@ return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons") [/gdscript] [csharp] - public override Texture2D GetPluginIcon() + public override Texture2D _GetPluginIcon() { // You can use a custom icon: return ResourceLoader.Load<Texture2D>("res://addons/my_plugin/my_plugin_icon.svg"); @@ -409,6 +412,7 @@ <description> Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed. When a given node or resource is selected, the base type will be instantiated (e.g. "Node3D", "Control", "Resource"), then the script will be loaded and set to this object. + [b]Note:[/b] The base type is the base engine class which this type's class hierarchy inherits, not any custom type parent classes. You can use the virtual method [method _handles] to check if your custom object is being edited by checking the script or using the [code]is[/code] keyword. During run-time, this will be a simple object with a script so this function does not need to be called then. [b]Note:[/b] Custom types added this way are not true classes. They are just a helper to create a node with specific script. diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml index d2ad8d1bed..44bc72ea49 100644 --- a/doc/classes/EditorScenePostImport.xml +++ b/doc/classes/EditorScenePostImport.xml @@ -10,12 +10,14 @@ [gdscript] @tool # Needed so it runs in editor. extends EditorScenePostImport + # This sample changes all node names. # Called right after the scene is imported and gets the root node. func _post_import(scene): # Change all node names to "modified_[oldnodename]" iterate(scene) return scene # Remember to return the imported scene + func iterate(node): if node != null: node.name = "modified_" + node.name @@ -30,17 +32,18 @@ [Tool] public partial class NodeRenamer : EditorScenePostImport { - public override Object _PostImport(Node scene) + public override GodotObject _PostImport(Node scene) { // Change all node names to "modified_[oldnodename]" Iterate(scene); return scene; // Remember to return the imported scene } + public void Iterate(Node node) { if (node != null) { - node.Name = "modified_" + node.Name; + node.Name = $"modified_{node.Name}"; foreach (Node child in node.GetChildren()) { Iterate(child); diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml index a02fd215d8..33d2f40d0b 100644 --- a/doc/classes/EditorScript.xml +++ b/doc/classes/EditorScript.xml @@ -17,10 +17,9 @@ [/gdscript] [csharp] using Godot; - using System; [Tool] - public class HelloEditor : EditorScript + public partial class HelloEditor : EditorScript { public override void _Run() { diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 9015a12b43..1bf8cbf175 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -22,7 +22,7 @@ settings.SetSetting("some/property", Value); // `settings.get("some/property", value)` also works as this class overrides `_get()` internally. settings.GetSetting("some/property"); - Godot.Collections.Array listOfSettings = settings.GetPropertyList(); + Godot.Collections.Array<Godot.Collections.Dictionary> listOfSettings = settings.GetPropertyList(); [/csharp] [/codeblocks] [b]Note:[/b] This class shouldn't be instantiated directly. Instead, access the singleton using [method EditorInterface.get_editor_settings]. @@ -607,6 +607,10 @@ <member name="interface/theme/draw_extra_borders" type="bool" setter="" getter=""> If [code]true[/code], draws additional borders around interactive UI elements in the editor. This is automatically enabled when using the [b]Black (OLED)[/b] theme preset, as this theme preset uses a fully black background. </member> + <member name="interface/theme/enable_touchscreen_touch_area" type="bool" setter="" getter=""> + If [code]true[/code], increases the touch area for the UI elements to improve usability on touchscreen devices. + [b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices. + </member> <member name="interface/theme/icon_and_font_color" type="int" setter="" getter=""> The icon and font color scheme to use in the editor. - [b]Auto[/b] determines the color scheme to use automatically based on [member interface/theme/base_color]. diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml index df10c645ef..40b469de0a 100644 --- a/doc/classes/EditorTranslationParserPlugin.xml +++ b/doc/classes/EditorTranslationParserPlugin.xml @@ -15,8 +15,7 @@ extends EditorTranslationParserPlugin func _parse_file(path, msgids, msgids_context_plural): - var file = File.new() - file.open(path, File.READ) + var file = FileAccess.open(path, FileAccess.READ) var text = file.get_as_text() var split_strs = text.split(",", false) for s in split_strs: @@ -28,27 +27,25 @@ [/gdscript] [csharp] using Godot; - using System; [Tool] - public class CustomParser : EditorTranslationParserPlugin + public partial class CustomParser : EditorTranslationParserPlugin { - public override void ParseFile(string path, Godot.Collections.Array msgids, Godot.Collections.Array msgidsContextPlural) + public override void _ParseFile(string path, Godot.Collections.Array<string> msgids, Godot.Collections.Array<Godot.Collections.Array> msgidsContextPlural) { - var file = new File(); - file.Open(path, File.ModeFlags.Read); + using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read); string text = file.GetAsText(); - string[] splitStrs = text.Split(",", false); - foreach (var s in splitStrs) + string[] splitStrs = text.Split(",", allowEmpty: false); + foreach (string s in splitStrs) { msgids.Add(s); - //GD.Print("Extracted string: " + s) + //GD.Print($"Extracted string: {s}"); } } - public override Godot.Collections.Array GetRecognizedExtensions() + public override string[] _GetRecognizedExtensions() { - return new Godot.Collections.Array{"csv"}; + return new string[] { "csv" }; } } [/csharp] @@ -85,16 +82,16 @@ return ["gd"] [/gdscript] [csharp] - public override void ParseFile(string path, Godot.Collections.Array msgids, Godot.Collections.Array msgidsContextPlural) + public override void _ParseFile(string path, Godot.Collections.Array<string> msgids, Godot.Collections.Array<Godot.Collections.Array> msgidsContextPlural) { var res = ResourceLoader.Load<Script>(path, "Script"); string text = res.SourceCode; // Parsing logic. } - public override Godot.Collections.Array GetRecognizedExtensions() + public override string[] _GetRecognizedExtensions() { - return new Godot.Collections.Array{"gd"}; + return new string[] { "gd" }; } [/csharp] [/codeblocks] diff --git a/doc/classes/Expression.xml b/doc/classes/Expression.xml index 4670e0c382..fd5a921836 100644 --- a/doc/classes/Expression.xml +++ b/doc/classes/Expression.xml @@ -24,23 +24,23 @@ $LineEdit.text = str(result) [/gdscript] [csharp] - public Expression expression = new Expression(); + private Expression _expression = new Expression(); public override void _Ready() { - GetNode("LineEdit").TextSubmitted += OnTextEntered; + GetNode<LineEdit>("LineEdit").TextSubmitted += OnTextEntered; } private void OnTextEntered(string command) { - Error error = expression.Parse(command); + Error error = _expression.Parse(command); if (error != Error.Ok) { - GD.Print(expression.GetErrorText()); + GD.Print(_expression.GetErrorText()); return; } - object result = expression.Execute(); - if (!expression.HasExecuteFailed()) + Variant result = _expression.Execute(); + if (!_expression.HasExecuteFailed()) { GetNode<LineEdit>("LineEdit").Text = result.ToString(); } diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml index be0c8fd6ca..687a64b8ff 100644 --- a/doc/classes/FileAccess.xml +++ b/doc/classes/FileAccess.xml @@ -348,8 +348,8 @@ f.Seek(0); // Go back to start to read the stored value. ushort read1 = f.Get16(); // 65494 ushort read2 = f.Get16(); // 121 - short converted1 = BitConverter.ToInt16(BitConverter.GetBytes(read1), 0); // -42 - short converted2 = BitConverter.ToInt16(BitConverter.GetBytes(read2), 0); // 121 + short converted1 = (short)read1; // -42 + short converted2 = (short)read2; // 121 } [/csharp] [/codeblocks] diff --git a/doc/classes/FileSystemDock.xml b/doc/classes/FileSystemDock.xml index 00f5c7ddff..f76bc2c279 100644 --- a/doc/classes/FileSystemDock.xml +++ b/doc/classes/FileSystemDock.xml @@ -51,5 +51,10 @@ <description> </description> </signal> + <signal name="resource_removed"> + <param index="0" name="resource" type="Resource" /> + <description> + </description> + </signal> </signals> </class> diff --git a/doc/classes/FogVolume.xml b/doc/classes/FogVolume.xml index d9fa2e6ebb..e2f9038be5 100644 --- a/doc/classes/FogVolume.xml +++ b/doc/classes/FogVolume.xml @@ -11,16 +11,16 @@ <tutorials> </tutorials> <members> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - The size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX]. - [b]Note:[/b] Thin fog volumes may appear to flicker when the camera moves or rotates. This can be alleviated by increasing [member ProjectSettings.rendering/environment/volumetric_fog/volume_depth] (at a performance cost) or by decreasing [member Environment.volumetric_fog_length] (at no performance cost, but at the cost of lower fog range). Alternatively, the [FogVolume] can be made thicker and use a lower density in the [member material]. - [b]Note:[/b] If [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_CONE] or [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], the cone/cylinder will be adjusted to fit within the extents. Non-uniform scaling of cone/cylinder shapes via the [member extents] property is not supported, but you can scale the [FogVolume] node instead. - </member> <member name="material" type="Material" setter="set_material" getter="get_material"> The [Material] used by the [FogVolume]. Can be either a built-in [FogMaterial] or a custom [ShaderMaterial]. </member> <member name="shape" type="int" setter="set_shape" getter="get_shape" enum="RenderingServer.FogVolumeShape" default="3"> The shape of the [FogVolume]. This can be set to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD]. </member> + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + The size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX]. + [b]Note:[/b] Thin fog volumes may appear to flicker when the camera moves or rotates. This can be alleviated by increasing [member ProjectSettings.rendering/environment/volumetric_fog/volume_depth] (at a performance cost) or by decreasing [member Environment.volumetric_fog_length] (at no performance cost, but at the cost of lower fog range). Alternatively, the [FogVolume] can be made thicker and use a lower density in the [member material]. + [b]Note:[/b] If [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_CONE] or [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], the cone/cylinder will be adjusted to fit within the size. Non-uniform scaling of cone/cylinder shapes via the [member size] property is not supported, but you can scale the [FogVolume] node instead. + </member> </members> </class> diff --git a/doc/classes/GPUParticles2D.xml b/doc/classes/GPUParticles2D.xml index c7d10078e8..29779e4a77 100644 --- a/doc/classes/GPUParticles2D.xml +++ b/doc/classes/GPUParticles2D.xml @@ -5,7 +5,8 @@ </brief_description> <description> 2D particle node used to create a variety of particle systems and effects. [GPUParticles2D] features an emitter that generates some number of particles at a given rate. - Use the [code]process_material[/code] property to add a [ParticleProcessMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. + Use the [member process_material] property to add a [ParticleProcessMaterial] to configure particle appearance and behavior. Alternatively, you can add a [ShaderMaterial] which will be applied to all particles. + 2D particles can optionally collide with [LightOccluder2D] nodes (note: they don't collide with [PhysicsBody2D] nodes). </description> <tutorials> <link title="Particle systems (2D)">$DOCS_URL/tutorials/2d/particle_systems_2d.html</link> @@ -42,6 +43,7 @@ Number of particles emitted in one emission cycle. </member> <member name="collision_base_size" type="float" setter="set_collision_base_size" getter="get_collision_base_size" default="1.0"> + Multiplier for particle's collision radius. [code]1.0[/code] corresponds to the size of the sprite. </member> <member name="draw_order" type="int" setter="set_draw_order" getter="get_draw_order" enum="GPUParticles2D.DrawOrder" default="1"> Particle draw order. Uses [enum DrawOrder] values. diff --git a/doc/classes/GPUParticlesAttractorBox3D.xml b/doc/classes/GPUParticlesAttractorBox3D.xml index 6595428cc2..65a4c6d4a5 100644 --- a/doc/classes/GPUParticlesAttractorBox3D.xml +++ b/doc/classes/GPUParticlesAttractorBox3D.xml @@ -10,8 +10,8 @@ <tutorials> </tutorials> <members> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - The attractor box's extents in 3D units. + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + The attractor box's size in 3D units. </member> </members> </class> diff --git a/doc/classes/GPUParticlesAttractorVectorField3D.xml b/doc/classes/GPUParticlesAttractorVectorField3D.xml index aeadfaf4ab..12e6774471 100644 --- a/doc/classes/GPUParticlesAttractorVectorField3D.xml +++ b/doc/classes/GPUParticlesAttractorVectorField3D.xml @@ -11,12 +11,12 @@ <tutorials> </tutorials> <members> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - The extents of the vector field box in 3D units. + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + The size of the vector field box in 3D units. </member> <member name="texture" type="Texture3D" setter="set_texture" getter="get_texture"> The 3D texture to be used. Values are linearly interpolated between the texture's pixels. - [b]Note:[/b] To get better performance, the 3D texture's resolution should reflect the [member extents] of the attractor. Since particle attraction is usually low-frequency data, the texture can be kept at a low resolution such as 64×64×64. + [b]Note:[/b] To get better performance, the 3D texture's resolution should reflect the [member size] of the attractor. Since particle attraction is usually low-frequency data, the texture can be kept at a low resolution such as 64×64×64. </member> </members> </class> diff --git a/doc/classes/GPUParticlesCollisionBox3D.xml b/doc/classes/GPUParticlesCollisionBox3D.xml index 103be18bfd..737db0ba8a 100644 --- a/doc/classes/GPUParticlesCollisionBox3D.xml +++ b/doc/classes/GPUParticlesCollisionBox3D.xml @@ -11,8 +11,8 @@ <tutorials> </tutorials> <members> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - The collision box's extents in 3D units. + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + The collision box's size in 3D units. </member> </members> </class> diff --git a/doc/classes/GPUParticlesCollisionHeightField3D.xml b/doc/classes/GPUParticlesCollisionHeightField3D.xml index 6e996d5fbd..c8ed78b85e 100644 --- a/doc/classes/GPUParticlesCollisionHeightField3D.xml +++ b/doc/classes/GPUParticlesCollisionHeightField3D.xml @@ -13,9 +13,6 @@ <tutorials> </tutorials> <members> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - The collision heightmap's extents in 3D units. To improve heightmap quality, [member extents] should be set as small as possible while covering the parts of the scene you need. - </member> <member name="follow_camera_enabled" type="bool" setter="set_follow_camera_enabled" getter="is_follow_camera_enabled" default="false"> If [code]true[/code], the [GPUParticlesCollisionHeightField3D] will follow the current camera in global space. The [GPUParticlesCollisionHeightField3D] does not need to be a child of the [Camera3D] node for this to work. Following the camera has a performance cost, as it will force the heightmap to update whenever the camera moves. Consider lowering [member resolution] to improve performance if [member follow_camera_enabled] is [code]true[/code]. @@ -23,6 +20,9 @@ <member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionHeightField3D.Resolution" default="2"> Higher resolutions can represent small details more accurately in large scenes, at the cost of lower performance. If [member update_mode] is [constant UPDATE_MODE_ALWAYS], consider using the lowest resolution possible. </member> + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + The collision heightmap's size in 3D units. To improve heightmap quality, [member size] should be set as small as possible while covering the parts of the scene you need. + </member> <member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="GPUParticlesCollisionHeightField3D.UpdateMode" default="0"> The update policy to use for the generated heightmap. </member> diff --git a/doc/classes/GPUParticlesCollisionSDF3D.xml b/doc/classes/GPUParticlesCollisionSDF3D.xml index 8467cfdda1..dc4a4a2027 100644 --- a/doc/classes/GPUParticlesCollisionSDF3D.xml +++ b/doc/classes/GPUParticlesCollisionSDF3D.xml @@ -6,7 +6,7 @@ <description> Baked signed distance field 3D particle attractor affecting [GPUParticles3D] nodes. Signed distance fields (SDF) allow for efficiently representing approximate collision shapes for convex and concave objects of any shape. This is more flexible than [GPUParticlesCollisionHeightField3D], but it requires a baking step. - [b]Baking:[/b] The signed distance field texture can be baked by selecting the [GPUParticlesCollisionSDF3D] node in the editor, then clicking [b]Bake SDF[/b] at the top of the 3D viewport. Any [i]visible[/i] [MeshInstance3D]s touching the [member extents] will be taken into account for baking, regardless of their [member GeometryInstance3D.gi_mode]. + [b]Baking:[/b] The signed distance field texture can be baked by selecting the [GPUParticlesCollisionSDF3D] node in the editor, then clicking [b]Bake SDF[/b] at the top of the 3D viewport. Any [i]visible[/i] [MeshInstance3D]s within the [member size] will be taken into account for baking, regardless of their [member GeometryInstance3D.gi_mode]. [b]Note:[/b] Baking a [GPUParticlesCollisionSDF3D]'s [member texture] is only possible within the editor, as there is no bake method exposed for use in exported projects. However, it's still possible to load pre-baked [Texture3D]s into its [member texture] property in an exported project. [b]Note:[/b] [member ParticleProcessMaterial.collision_mode] must be [constant ParticleProcessMaterial.COLLISION_RIGID] or [constant ParticleProcessMaterial.COLLISION_HIDE_ON_CONTACT] on the [GPUParticles3D]'s process material for collision to work. [b]Note:[/b] Particle collision only affects [GPUParticles3D], not [CPUParticles3D]. @@ -34,12 +34,12 @@ <member name="bake_mask" type="int" setter="set_bake_mask" getter="get_bake_mask" default="4294967295"> The visual layers to account for when baking the particle collision SDF. Only [MeshInstance3D]s whose [member VisualInstance3D.layers] match with this [member bake_mask] will be included in the generated particle collision SDF. By default, all objects are taken into account for the particle collision SDF baking. </member> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)"> - The collision SDF's extents in 3D units. To improve SDF quality, the [member extents] should be set as small as possible while covering the parts of the scene you need. - </member> <member name="resolution" type="int" setter="set_resolution" getter="get_resolution" enum="GPUParticlesCollisionSDF3D.Resolution" default="2"> The bake resolution to use for the signed distance field [member texture]. The texture must be baked again for changes to the [member resolution] property to be effective. Higher resolutions have a greater performance cost and take more time to bake. Higher resolutions also result in larger baked textures, leading to increased VRAM and storage space requirements. To improve performance and reduce bake times, use the lowest resolution possible for the object you're representing the collision of. </member> + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(2, 2, 2)"> + The collision SDF's size in 3D units. To improve SDF quality, the [member size] should be set as small as possible while covering the parts of the scene you need. + </member> <member name="texture" type="Texture3D" setter="set_texture" getter="get_texture"> The 3D texture representing the signed distance field. </member> diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml index 0142018f1a..f015026bc1 100644 --- a/doc/classes/Geometry2D.xml +++ b/doc/classes/Geometry2D.xml @@ -160,14 +160,13 @@ var polygon = PackedVector2Array([Vector2(0, 0), Vector2(100, 0), Vector2(100, 100), Vector2(0, 100)]) var offset = Vector2(50, 50) polygon = Transform2D(0, offset) * polygon - print(polygon) # prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)] + print(polygon) # prints [(50, 50), (150, 50), (150, 150), (50, 150)] [/gdscript] [csharp] var polygon = new Vector2[] { new Vector2(0, 0), new Vector2(100, 0), new Vector2(100, 100), new Vector2(0, 100) }; var offset = new Vector2(50, 50); - // TODO: This code is not valid right now. Ping @aaronfranke about it before Godot 4.0 is out. - //polygon = (Vector2[]) new Transform2D(0, offset).Xform(polygon); - //GD.Print(polygon); // prints [Vector2(50, 50), Vector2(150, 50), Vector2(150, 150), Vector2(50, 150)] + polygon = new Transform2D(0, offset) * polygon; + GD.Print((Variant)polygon); // prints [(50, 50), (150, 50), (150, 150), (50, 150)] [/csharp] [/codeblocks] </description> diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index ea4e4b53ba..490637374d 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -72,8 +72,9 @@ return from != to [/gdscript] [csharp] - public override bool _IsNodeHoverValid(String from, int fromSlot, String to, int toSlot) { - return from != to; + public override bool _IsNodeHoverValid(StringName fromNode, int fromPort, StringName toNode, int toPort) + { + return fromNode != toNode; } [/csharp] [/codeblocks] diff --git a/doc/classes/HMACContext.xml b/doc/classes/HMACContext.xml index 706ee30963..fbdc6b5e64 100644 --- a/doc/classes/HMACContext.xml +++ b/doc/classes/HMACContext.xml @@ -26,25 +26,24 @@ [/gdscript] [csharp] using Godot; - using System; using System.Diagnostics; - public class CryptoNode : Node + public partial class MyNode : Node { - private HMACContext ctx = new HMACContext(); + private HmacContext _ctx = new HmacContext(); public override void _Ready() { - byte[] key = "supersecret".ToUTF8(); - Error err = ctx.Start(HashingContext.HashType.Sha256, key); + byte[] key = "supersecret".ToUtf8(); + Error err = _ctx.Start(HashingContext.HashType.Sha256, key); Debug.Assert(err == Error.Ok); - byte[] msg1 = "this is ".ToUTF8(); - byte[] msg2 = "super duper secret".ToUTF8(); - err = ctx.Update(msg1); + byte[] msg1 = "this is ".ToUtf8(); + byte[] msg2 = "super duper secret".ToUtf8(); + err = _ctx.Update(msg1); Debug.Assert(err == Error.Ok); - err = ctx.Update(msg2); + err = _ctx.Update(msg2); Debug.Assert(err == Error.Ok); - byte[] hmac = ctx.Finish(); + byte[] hmac = _ctx.Finish(); GD.Print(hmac.HexEncode()); } } diff --git a/doc/classes/HTTPClient.xml b/doc/classes/HTTPClient.xml index b3ed38d250..4973f3fddf 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -30,13 +30,10 @@ <return type="int" enum="Error" /> <param index="0" name="host" type="String" /> <param index="1" name="port" type="int" default="-1" /> - <param index="2" name="use_tls" type="bool" default="false" /> - <param index="3" name="verify_host" type="bool" default="true" /> + <param index="2" name="tls_options" type="TLSOptions" default="null" /> <description> Connects to a host. This needs to be done before any requests are sent. - The host should not have http:// prepended but will strip the protocol identifier if provided. - If no [param port] is specified (or [code]-1[/code] is used), it is automatically set to 80 for HTTP and 443 for HTTPS (if [param use_tls] is enabled). - [param verify_host] will check the TLS identity of the host if set to [code]true[/code]. + If no [param port] is specified (or [code]-1[/code] is used), it is automatically set to 80 for HTTP and 443 for HTTPS. You can pass the optional [param tls_options] parameter to customize the trusted certification authorities, or the common name verification when using HTTPS. See [method TLSOptions.client] and [method TLSOptions.client_unsafe]. </description> </method> <method name="get_response_body_length" qualifiers="const"> @@ -108,7 +105,7 @@ [/gdscript] [csharp] var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } }; - string queryString = new HTTPClient().QueryStringFromDict(fields); + string queryString = httpClient.QueryStringFromDict(fields); // Returns "username=user&password=pass" [/csharp] [/codeblocks] @@ -120,8 +117,13 @@ # Returns "single=123&not_valued&multiple=22&multiple=33&multiple=44" [/gdscript] [csharp] - var fields = new Godot.Collections.Dictionary{{"single", 123}, {"notValued", null}, {"multiple", new Godot.Collections.Array{22, 33, 44}}}; - string queryString = new HTTPClient().QueryStringFromDict(fields); + var fields = new Godot.Collections.Dictionary + { + { "single", 123 }, + { "notValued", default }, + { "multiple", new Godot.Collections.Array { 22, 33, 44 } }, + }; + string queryString = httpClient.QueryStringFromDict(fields); // Returns "single=123&not_valued&multiple=22&multiple=33&multiple=44" [/csharp] [/codeblocks] @@ -154,7 +156,7 @@ [csharp] var fields = new Godot.Collections.Dictionary { { "username", "user" }, { "password", "pass" } }; string queryString = new HTTPClient().QueryStringFromDict(fields); - string[] headers = {"Content-Type: application/x-www-form-urlencoded", "Content-Length: " + queryString.Length}; + string[] headers = { "Content-Type: application/x-www-form-urlencoded", $"Content-Length: {queryString.Length}" }; var result = new HTTPClient().Request(HTTPClient.Method.Post, "index.php", headers, queryString); [/csharp] [/codeblocks] diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index c504e26d58..5a0b12e198 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -57,7 +57,7 @@ // Perform a POST request. The URL below returns JSON as of writing. // Note: Don't make simultaneous requests using a single HTTPRequest node. // The snippet below is provided for reference only. - string body = new JSON().Stringify(new Godot.Collections.Dictionary + string body = new Json().Stringify(new Godot.Collections.Dictionary { { "name", "Godette" } }); @@ -69,14 +69,14 @@ } // Called when the HTTP request is completed. - private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body) + private void HttpRequestCompleted(long result, long responseCode, string[] headers, byte[] body) { - var json = new JSON(); - json.Parse(body.GetStringFromUTF8()); - var response = json.GetData() as Godot.Collections.Dictionary; + var json = new Json(); + json.Parse(body.GetStringFromUtf8()); + var response = json.GetData().AsGodotDictionary(); // Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org). - GD.Print((response["headers"] as Godot.Collections.Dictionary)["User-Agent"]); + GD.Print((response["headers"].AsGodotDictionary())["User-Agent"]); } [/csharp] [/codeblocks] @@ -128,9 +128,9 @@ } // Called when the HTTP request is completed. - private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body) + private void HttpRequestCompleted(long result, long responseCode, string[] headers, byte[] body) { - if (result != (int)HTTPRequest.Result.Success) + if (result != (long)HTTPRequest.Result.Success) { GD.PushError("Image couldn't be downloaded. Try a different image."); } @@ -187,9 +187,8 @@ <return type="int" enum="Error" /> <param index="0" name="url" type="String" /> <param index="1" name="custom_headers" type="PackedStringArray" default="PackedStringArray()" /> - <param index="2" name="tls_validate_domain" type="bool" default="true" /> - <param index="3" name="method" type="int" enum="HTTPClient.Method" default="0" /> - <param index="4" name="request_data" type="String" default="""" /> + <param index="2" name="method" type="int" enum="HTTPClient.Method" default="0" /> + <param index="3" name="request_data" type="String" default="""" /> <description> Creates request on the underlying [HTTPClient]. If there is no configuration errors, it tries to connect using [method HTTPClient.connect_to_host] and passes parameters onto [method HTTPClient.request]. Returns [constant OK] if request is successfully created. (Does not imply that the server has responded), [constant ERR_UNCONFIGURED] if not in the tree, [constant ERR_BUSY] if still processing previous request, [constant ERR_INVALID_PARAMETER] if given string is not a valid URL format, or [constant ERR_CANT_CONNECT] if not using thread and the [HTTPClient] cannot connect to host. @@ -201,9 +200,8 @@ <return type="int" enum="Error" /> <param index="0" name="url" type="String" /> <param index="1" name="custom_headers" type="PackedStringArray" default="PackedStringArray()" /> - <param index="2" name="tls_validate_domain" type="bool" default="true" /> - <param index="3" name="method" type="int" enum="HTTPClient.Method" default="0" /> - <param index="4" name="request_data_raw" type="PackedByteArray" default="PackedByteArray()" /> + <param index="2" name="method" type="int" enum="HTTPClient.Method" default="0" /> + <param index="3" name="request_data_raw" type="PackedByteArray" default="PackedByteArray()" /> <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]. Returns [constant OK] if request is successfully created. (Does not imply that the server has responded), [constant ERR_UNCONFIGURED] if not in the tree, [constant ERR_BUSY] if still processing previous request, [constant ERR_INVALID_PARAMETER] if given string is not a valid URL format, or [constant ERR_CANT_CONNECT] if not using thread and the [HTTPClient] cannot connect to host. @@ -227,6 +225,13 @@ The proxy server is unset if [param host] is empty or [param port] is -1. </description> </method> + <method name="set_tls_options"> + <return type="void" /> + <param index="0" name="client_options" type="TLSOptions" /> + <description> + Sets the [TLSOptions] to be used when connecting to an HTTPS server. See [method TLSOptions.client]. + </description> + </method> </methods> <members> <member name="accept_gzip" type="bool" setter="set_accept_gzip" getter="is_accepting_gzip" default="true"> diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index 6e3092e618..5223cbf52f 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -8,18 +8,17 @@ The [enum HashType] enum shows the supported hashing algorithms. [codeblocks] [gdscript] - const CHUNK_SIZE = 102 + const CHUNK_SIZE = 1024 func hash_file(path): - var ctx = HashingContext.new() - var file = File.new() - # Start a SHA-256 context. - ctx.start(HashingContext.HASH_SHA256) # Check that file exists. - if not file.file_exists(path): + if not FileAccess.file_exists(path): return + # Start a SHA-256 context. + var ctx = HashingContext.new() + ctx.start(HashingContext.HASH_SHA256) # Open the file to hash. - file.open(path, File.READ) + var file = FileAccess.open(path, FileAccess.READ) # Update the context after reading each chunk. while not file.eof_reached(): ctx.update(file.get_buffer(CHUNK_SIZE)) @@ -33,17 +32,16 @@ public void HashFile(string path) { - var ctx = new HashingContext(); - var file = new File(); - // Start a SHA-256 context. - ctx.Start(HashingContext.HashType.Sha256); // Check that file exists. - if (!file.FileExists(path)) + if (!FileAccess.FileExists(path)) { return; } + // Start a SHA-256 context. + var ctx = new HashingContext(); + ctx.Start(HashingContext.HashType.Sha256); // Open the file to hash. - file.Open(path, File.ModeFlags.Read); + using var file = FileAccess.Open(path, FileAccess.ModeFlags.Read); // Update the context after reading each chunk. while (!file.EofReached()) { @@ -52,8 +50,7 @@ // Get the computed hash. byte[] res = ctx.Finish(); // Print the result as hex string and array. - - GD.PrintT(res.HexEncode(), res); + GD.PrintT(res.HexEncode(), (Variant)res); } [/csharp] [/codeblocks] diff --git a/doc/classes/HeightMapShape3D.xml b/doc/classes/HeightMapShape3D.xml index 206981e547..f34870c500 100644 --- a/doc/classes/HeightMapShape3D.xml +++ b/doc/classes/HeightMapShape3D.xml @@ -14,10 +14,10 @@ Height map data, pool array must be of [member map_width] * [member map_depth] size. </member> <member name="map_depth" type="int" setter="set_map_depth" getter="get_map_depth" default="2"> - Depth of the height map data. Changing this will resize the [member map_data]. + Number of vertices in the depth of the height map. Changing this will resize the [member map_data]. </member> <member name="map_width" type="int" setter="set_map_width" getter="get_map_width" default="2"> - Width of the height map data. Changing this will resize the [member map_data]. + Number of vertices in the width of the height map. Changing this will resize the [member map_data]. </member> </members> </class> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 051e087611..5b07124b91 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -75,12 +75,10 @@ <return type="int" enum="Error" /> <param index="0" name="mode" type="int" enum="Image.CompressMode" /> <param index="1" name="source" type="int" enum="Image.CompressSource" default="0" /> - <param index="2" name="lossy_quality" type="float" default="0.7" /> - <param index="3" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" /> + <param index="2" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" /> <description> Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. The [param mode] parameter helps to pick the best compression method for DXT and ETC2 formats. It is ignored for ASTC compression. - The [param lossy_quality] parameter is optional for compressors that support it. For ASTC compression, the [param astc_format] parameter must be supplied. </description> </method> @@ -88,12 +86,10 @@ <return type="int" enum="Error" /> <param index="0" name="mode" type="int" enum="Image.CompressMode" /> <param index="1" name="channels" type="int" enum="Image.UsedChannels" /> - <param index="2" name="lossy_quality" type="float" default="0.7" /> - <param index="3" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" /> + <param index="2" name="astc_format" type="int" enum="Image.ASTCFormat" default="0" /> <description> Compresses the image to use less memory. Can not directly access pixel data while the image is compressed. Returns error if the chosen compression mode is not available. This is an alternative to [method compress] that lets the user supply the channels used in order for the compressor to pick the best DXT and ETC2 formats. For other formats (non DXT or ETC2), this argument is ignored. - The [param lossy_quality] parameter is optional for compressors that support it. For ASTC compression, the [param astc_format] parameter must be supplied. </description> </method> @@ -525,7 +521,7 @@ var img = new Image(); img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); - img.SetPixelv(new Vector2i(1, 2), Colors.Red); // Sets the color at (1, 2) to red. + img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red. [/csharp] [/codeblocks] This is the same as [method set_pixel], but with a [Vector2i] argument instead of two integer arguments. diff --git a/doc/classes/Input.xml b/doc/classes/Input.xml index 3b0cfb3825..70e629974d 100644 --- a/doc/classes/Input.xml +++ b/doc/classes/Input.xml @@ -375,6 +375,7 @@ <description> Sets the mouse position to the specified vector, provided in pixels and relative to an origin at the upper left corner of the currently focused Window Manager game window. Mouse position is clipped to the limits of the screen resolution, or to the limits of the game window if [enum MouseMode] is set to [constant MOUSE_MODE_CONFINED] or [constant MOUSE_MODE_CONFINED_HIDDEN]. + [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web. </description> </method> </methods> diff --git a/doc/classes/InputEventMIDI.xml b/doc/classes/InputEventMIDI.xml index 67e7ced2e8..e4ba380741 100644 --- a/doc/classes/InputEventMIDI.xml +++ b/doc/classes/InputEventMIDI.xml @@ -35,9 +35,9 @@ GD.Print(OS.GetConnectedMidiInputs()); } - public override void _Input(InputEvent inputEvent) + public override void _Input(InputEvent @event) { - if (inputEvent is InputEventMIDI midiEvent) + if (@event is InputEventMIDI midiEvent) { PrintMIDIInfo(midiEvent); } @@ -46,14 +46,14 @@ private void PrintMIDIInfo(InputEventMIDI midiEvent) { GD.Print(midiEvent); - GD.Print("Channel " + midiEvent.Channel); - GD.Print("Message " + midiEvent.Message); - GD.Print("Pitch " + midiEvent.Pitch); - GD.Print("Velocity " + midiEvent.Velocity); - GD.Print("Instrument " + midiEvent.Instrument); - GD.Print("Pressure " + midiEvent.Pressure); - GD.Print("Controller number: " + midiEvent.ControllerNumber); - GD.Print("Controller value: " + midiEvent.ControllerValue); + GD.Print($"Channel {midiEvent.Channel}"); + GD.Print($"Message {midiEvent.Message}"); + GD.Print($"Pitch {midiEvent.Pitch}"); + GD.Print($"Velocity {midiEvent.Velocity}"); + GD.Print($"Instrument {midiEvent.Instrument}"); + GD.Print($"Pressure {midiEvent.Pressure}"); + GD.Print($"Controller number: {midiEvent.ControllerNumber}"); + GD.Print($"Controller value: {midiEvent.ControllerValue}"); } [/csharp] [/codeblocks] diff --git a/doc/classes/Label3D.xml b/doc/classes/Label3D.xml index 0cbca2224e..cfb47ff4c3 100644 --- a/doc/classes/Label3D.xml +++ b/doc/classes/Label3D.xml @@ -32,9 +32,18 @@ </method> </methods> <members> + <member name="alpha_antialiasing_edge" type="float" setter="set_alpha_antialiasing_edge" getter="get_alpha_antialiasing_edge" default="0.0"> + Threshold at which antialiasing will be applied on the alpha channel. + </member> + <member name="alpha_antialiasing_mode" type="int" setter="set_alpha_antialiasing" getter="get_alpha_antialiasing" enum="BaseMaterial3D.AlphaAntiAliasing" default="0"> + The type of alpha antialiasing to apply. See [enum BaseMaterial3D.AlphaAntiAliasing]. + </member> <member name="alpha_cut" type="int" setter="set_alpha_cut_mode" getter="get_alpha_cut_mode" enum="Label3D.AlphaCutMode" default="0"> The alpha cutting mode to use for the sprite. See [enum AlphaCutMode] for possible values. </member> + <member name="alpha_hash_scale" type="float" setter="set_alpha_hash_scale" getter="get_alpha_hash_scale" default="1.0"> + The hashing scale for Alpha Hash. Recommended values between [code]0[/code] and [code]2[/code]. + </member> <member name="alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold" default="0.5"> Threshold at which the alpha scissor will discard values. </member> @@ -152,5 +161,8 @@ This mode draws fully opaque pixels in the depth prepass. This is slower than [constant ALPHA_CUT_DISABLED] or [constant ALPHA_CUT_DISCARD], but it allows displaying translucent areas and smooth edges while using proper sorting. [b]Note:[/b] When using text with overlapping glyphs (e.g., cursive scripts), this mode might have transparency sorting issues between the main text and the outline. </constant> + <constant name="ALPHA_CUT_HASH" value="3" enum="AlphaCutMode"> + This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque. + </constant> </constants> </class> diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index b8383aaed9..8ed8622030 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -61,6 +61,45 @@ <return type="PopupMenu" /> <description> Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit]. + You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example: + [codeblocks] + [gdscript] + func _ready(): + var menu = get_menu() + # Remove all items after "Redo". + menu.item_count = menu.get_item_index(MENU_REDO) + 1 + # Add custom items. + menu.add_separator() + menu.add_item("Insert Date", MENU_MAX + 1) + # Connect callback. + menu.id_pressed.connect(_on_item_pressed) + + func _on_item_pressed(id): + if id == MENU_MAX + 1: + insert_text_at_caret(Time.get_date_string_from_system()) + [/gdscript] + [csharp] + public override void _Ready() + { + var menu = GetMenu(); + // Remove all items after "Redo". + menu.ItemCount = menu.GetItemIndex(LineEdit.MenuItems.Redo) + 1; + // Add custom items. + menu.AddSeparator(); + menu.AddItem("Insert Date", LineEdit.MenuItems.Max + 1); + // Add event handler. + menu.IdPressed += OnItemPressed; + } + + public void OnItemPressed(int id) + { + if (id == LineEdit.MenuItems.Max + 1) + { + InsertTextAtCaret(Time.GetDateStringFromSystem()); + } + } + [/csharp] + [/codeblocks] [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property. </description> </method> @@ -296,70 +335,76 @@ <constant name="MENU_REDO" value="6" enum="MenuItems"> Reverse the last undo action. </constant> - <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems"> + <constant name="MENU_SUBMENU_TEXT_DIR" value="7" enum="MenuItems"> + ID of "Text Writing Direction" submenu. + </constant> + <constant name="MENU_DIR_INHERITED" value="8" enum="MenuItems"> Sets text direction to inherited. </constant> - <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems"> + <constant name="MENU_DIR_AUTO" value="9" enum="MenuItems"> Sets text direction to automatic. </constant> - <constant name="MENU_DIR_LTR" value="9" enum="MenuItems"> + <constant name="MENU_DIR_LTR" value="10" enum="MenuItems"> Sets text direction to left-to-right. </constant> - <constant name="MENU_DIR_RTL" value="10" enum="MenuItems"> + <constant name="MENU_DIR_RTL" value="11" enum="MenuItems"> Sets text direction to right-to-left. </constant> - <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems"> + <constant name="MENU_DISPLAY_UCC" value="12" enum="MenuItems"> Toggles control character display. </constant> - <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems"> + <constant name="MENU_SUBMENU_INSERT_UCC" value="13" enum="MenuItems"> + ID of "Insert Control Character" submenu. + </constant> + <constant name="MENU_INSERT_LRM" value="14" enum="MenuItems"> Inserts left-to-right mark (LRM) character. </constant> - <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems"> + <constant name="MENU_INSERT_RLM" value="15" enum="MenuItems"> Inserts right-to-left mark (RLM) character. </constant> - <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems"> + <constant name="MENU_INSERT_LRE" value="16" enum="MenuItems"> Inserts start of left-to-right embedding (LRE) character. </constant> - <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems"> + <constant name="MENU_INSERT_RLE" value="17" enum="MenuItems"> Inserts start of right-to-left embedding (RLE) character. </constant> - <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems"> + <constant name="MENU_INSERT_LRO" value="18" enum="MenuItems"> Inserts start of left-to-right override (LRO) character. </constant> - <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems"> + <constant name="MENU_INSERT_RLO" value="19" enum="MenuItems"> Inserts start of right-to-left override (RLO) character. </constant> - <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems"> + <constant name="MENU_INSERT_PDF" value="20" enum="MenuItems"> Inserts pop direction formatting (PDF) character. </constant> - <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems"> + <constant name="MENU_INSERT_ALM" value="21" enum="MenuItems"> Inserts Arabic letter mark (ALM) character. </constant> - <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems"> + <constant name="MENU_INSERT_LRI" value="22" enum="MenuItems"> Inserts left-to-right isolate (LRI) character. </constant> - <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems"> + <constant name="MENU_INSERT_RLI" value="23" enum="MenuItems"> Inserts right-to-left isolate (RLI) character. </constant> - <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems"> + <constant name="MENU_INSERT_FSI" value="24" enum="MenuItems"> Inserts first strong isolate (FSI) character. </constant> - <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems"> + <constant name="MENU_INSERT_PDI" value="25" enum="MenuItems"> Inserts pop direction isolate (PDI) character. </constant> - <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems"> + <constant name="MENU_INSERT_ZWJ" value="26" enum="MenuItems"> Inserts zero width joiner (ZWJ) character. </constant> - <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems"> + <constant name="MENU_INSERT_ZWNJ" value="27" enum="MenuItems"> Inserts zero width non-joiner (ZWNJ) character. </constant> - <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems"> + <constant name="MENU_INSERT_WJ" value="28" enum="MenuItems"> Inserts word joiner (WJ) character. </constant> - <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems"> + <constant name="MENU_INSERT_SHY" value="29" enum="MenuItems"> Inserts soft hyphen (SHY) character. </constant> - <constant name="MENU_MAX" value="28" enum="MenuItems"> + <constant name="MENU_MAX" value="30" enum="MenuItems"> Represents the size of the [enum MenuItems] enum. </constant> <constant name="KEYBOARD_TYPE_DEFAULT" value="0" enum="VirtualKeyboardType"> diff --git a/doc/classes/MainLoop.xml b/doc/classes/MainLoop.xml index 674adb1772..260efb0eab 100644 --- a/doc/classes/MainLoop.xml +++ b/doc/classes/MainLoop.xml @@ -29,29 +29,28 @@ [/gdscript] [csharp] using Godot; - using System; - public class CustomMainLoop : MainLoop + public partial class CustomMainLoop : MainLoop { - public float TimeElapsed = 0; + private double _timeElapsed = 0; public override void _Initialize() { GD.Print("Initialized:"); - GD.Print($" Starting Time: {TimeElapsed}"); + GD.Print($" Starting Time: {_timeElapsed}"); } - public override bool _Process(float delta) + public override bool _Process(double delta) { - TimeElapsed += delta; + _timeElapsed += delta; // Return true to end the main loop. - return Input.GetMouseButtonMask() != 0 || Input.IsKeyPressed((int)KeyList.Escape); + return Input.GetMouseButtonMask() != 0 || Input.IsKeyPressed(Key.Escape); } private void _Finalize() { GD.Print("Finalized:"); - GD.Print($" End Time: {TimeElapsed}"); + GD.Print($" End Time: {_timeElapsed}"); } } [/csharp] diff --git a/doc/classes/MultiplayerAPI.xml b/doc/classes/MultiplayerAPI.xml index 3ce6ce41b4..020ce4f468 100644 --- a/doc/classes/MultiplayerAPI.xml +++ b/doc/classes/MultiplayerAPI.xml @@ -138,10 +138,10 @@ Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods. </constant> <constant name="RPC_MODE_ANY_PEER" value="1" enum="RPCMode"> - Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc(any)[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not. + Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc("any")[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not. </constant> <constant name="RPC_MODE_AUTHORITY" value="2" enum="RPCMode"> - Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc(authority)[/code] annotation. See [method Node.set_multiplayer_authority]. + Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc("authority")[/code] annotation. See [method Node.set_multiplayer_authority]. </constant> </constants> </class> diff --git a/doc/classes/MultiplayerAPIExtension.xml b/doc/classes/MultiplayerAPIExtension.xml index c4012a920a..b853c32407 100644 --- a/doc/classes/MultiplayerAPIExtension.xml +++ b/doc/classes/MultiplayerAPIExtension.xml @@ -99,7 +99,7 @@ </description> </method> <method name="_object_configuration_add" qualifiers="virtual"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="object" type="Object" /> <param index="1" name="configuration" type="Variant" /> <description> @@ -107,7 +107,7 @@ </description> </method> <method name="_object_configuration_remove" qualifiers="virtual"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="object" type="Object" /> <param index="1" name="configuration" type="Variant" /> <description> @@ -115,13 +115,13 @@ </description> </method> <method name="_poll" qualifiers="virtual"> - <return type="int" /> + <return type="int" enum="Error" /> <description> Callback for [method MultiplayerAPI.poll]. </description> </method> <method name="_rpc" qualifiers="virtual"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="peer" type="int" /> <param index="1" name="object" type="Object" /> <param index="2" name="method" type="StringName" /> diff --git a/doc/classes/Mutex.xml b/doc/classes/Mutex.xml index 74f29bdc48..78694ce813 100644 --- a/doc/classes/Mutex.xml +++ b/doc/classes/Mutex.xml @@ -18,9 +18,9 @@ </description> </method> <method name="try_lock"> - <return type="int" enum="Error" /> + <return type="bool" /> <description> - Tries locking this [Mutex], but does not block. Returns [constant OK] on success, [constant ERR_BUSY] otherwise. + Tries locking this [Mutex], but does not block. Returns [code]true[/code] on success, [code]false[/code] otherwise. [b]Note:[/b] This function returns [constant OK] if the thread already has ownership of the mutex. </description> </method> diff --git a/doc/classes/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml index b561748b30..92fd8bcc6a 100644 --- a/doc/classes/NavigationAgent2D.xml +++ b/doc/classes/NavigationAgent2D.xml @@ -4,8 +4,8 @@ 2D Agent used in navigation for collision avoidance. </brief_description> <description> - 2D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent2D] is physics safe. - [b]Note:[/b] After setting [member target_location] it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node. + 2D Agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent2D] is physics safe. + [b]Note:[/b] After setting [member target_position] it is required to use the [method get_next_path_position] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node. </description> <tutorials> <link title="Using NavigationAgents">$DOCS_URL/tutorials/navigation/navigation_using_navigationagents.html</link> @@ -14,13 +14,13 @@ <method name="distance_to_target" qualifiers="const"> <return type="float" /> <description> - Returns the distance to the target location, using the agent's global position. The user must set [member target_location] in order for this to be accurate. + Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate. </description> </method> <method name="get_current_navigation_path" qualifiers="const"> <return type="PackedVector2Array" /> <description> - Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic. + Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic. </description> </method> <method name="get_current_navigation_path_index" qualifiers="const"> @@ -35,10 +35,10 @@ Returns the path query result for the path the agent is currently following. </description> </method> - <method name="get_final_location"> + <method name="get_final_position"> <return type="Vector2" /> <description> - Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame. + Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame. </description> </method> <method name="get_navigation_layer_value" qualifiers="const"> @@ -54,10 +54,10 @@ Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer. </description> </method> - <method name="get_next_location"> + <method name="get_next_path_position"> <return type="Vector2" /> <description> - Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent. + Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent. </description> </method> <method name="get_rid" qualifiers="const"> @@ -69,19 +69,19 @@ <method name="is_navigation_finished"> <return type="bool" /> <description> - Returns true if the navigation path's final location has been reached. + Returns true if the navigation path's final position has been reached. </description> </method> <method name="is_target_reachable"> <return type="bool" /> <description> - Returns true if [member target_location] is reachable. + Returns true if [member target_position] is reachable. </description> </method> <method name="is_target_reached" qualifiers="const"> <return type="bool" /> <description> - Returns true if [member target_location] is reached. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location]. + Returns true if [member target_position] is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See [method get_final_position]. </description> </method> <method name="set_navigation_layer_value"> @@ -111,6 +111,21 @@ <member name="avoidance_enabled" type="bool" setter="set_avoidance_enabled" getter="get_avoidance_enabled" default="false"> If [code]true[/code] the agent is registered for an RVO avoidance callback on the [NavigationServer2D]. When [method NavigationAgent2D.set_velocity] is used and the processing is completed a [code]safe_velocity[/code] Vector2 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it. </member> + <member name="debug_enabled" type="bool" setter="set_debug_enabled" getter="get_debug_enabled" default="false"> + If [code]true[/code] shows debug visuals for this agent. + </member> + <member name="debug_path_custom_color" type="Color" setter="set_debug_path_custom_color" getter="get_debug_path_custom_color" default="Color(1, 1, 1, 1)"> + If [member debug_use_custom] is [code]true[/code] uses this color for this agent instead of global color. + </member> + <member name="debug_path_custom_line_width" type="float" setter="set_debug_path_custom_line_width" getter="get_debug_path_custom_line_width" default="1.0"> + If [member debug_use_custom] is [code]true[/code] uses this line width for rendering paths for this agent instead of global line width. + </member> + <member name="debug_path_custom_point_size" type="float" setter="set_debug_path_custom_point_size" getter="get_debug_path_custom_point_size" default="4.0"> + If [member debug_use_custom] is [code]true[/code] uses this rasterized point size for rendering path points for this agent instead of global point size. + </member> + <member name="debug_use_custom" type="bool" setter="set_debug_use_custom" getter="get_debug_use_custom" default="false"> + If [code]true[/code] uses the defined [member debug_path_custom_color] for this agent instead of global color. + </member> <member name="max_neighbors" type="int" setter="set_max_neighbors" getter="get_max_neighbors" default="10"> The maximum number of neighbors for the agent to consider. </member> @@ -127,7 +142,7 @@ The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update. </member> <member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="100.0"> - The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. + The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. </member> <member name="path_metadata_flags" type="int" setter="set_path_metadata_flags" getter="get_path_metadata_flags" enum="NavigationPathQueryParameters2D.PathMetadataFlags" default="7"> Additional information to return with the navigation path. @@ -139,8 +154,8 @@ <member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="10.0"> The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update. </member> - <member name="target_location" type="Vector2" setter="set_target_location" getter="get_target_location" default="Vector2(0, 0)"> - The user-defined target location. Setting this property will clear the current navigation path. + <member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2(0, 0)"> + The user-defined target position. Setting this property will clear the current navigation path. </member> <member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="1.0"> The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. Must be positive. @@ -152,7 +167,7 @@ <description> Notifies when a navigation link has been reached. The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]: - - [code]location[/code]: The start location of the link that was reached. + - [code]position[/code]: The start position of the link that was reached. - [code]type[/code]: Always [constant NavigationPathQueryResult2D.PATH_SEGMENT_TYPE_LINK]. - [code]rid[/code]: The [RID] of the link. - [code]owner[/code]: The object which manages the link (usually [NavigationLink2D]). @@ -160,7 +175,7 @@ </signal> <signal name="navigation_finished"> <description> - Notifies when the final location is reached. + Notifies when the final position is reached. </description> </signal> <signal name="path_changed"> @@ -170,7 +185,7 @@ </signal> <signal name="target_reached"> <description> - Notifies when the player-defined [member target_location] is reached. + Notifies when the player-defined [member target_position] is reached. </description> </signal> <signal name="velocity_computed"> @@ -184,7 +199,7 @@ <description> Notifies when a waypoint along the path has been reached. The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]: - - [code]location[/code]: The location of the waypoint that was reached. + - [code]position[/code]: The position of the waypoint that was reached. - [code]type[/code]: The type of navigation primitive (region or link) that contains this waypoint. - [code]rid[/code]: The [RID] of the containing navigation primitive (region or link). - [code]owner[/code]: The object which manages the containing navigation primitive (region or link). diff --git a/doc/classes/NavigationAgent3D.xml b/doc/classes/NavigationAgent3D.xml index a1b007ee56..0ed11bc477 100644 --- a/doc/classes/NavigationAgent3D.xml +++ b/doc/classes/NavigationAgent3D.xml @@ -4,8 +4,8 @@ 3D Agent used in navigation for collision avoidance. </brief_description> <description> - 3D Agent that is used in navigation to reach a location while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent3D] is physics safe. - [b]Note:[/b] After setting [member target_location] it is required to use the [method get_next_location] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node. + 3D Agent that is used in navigation to reach a position while avoiding static and dynamic obstacles. The dynamic obstacles are avoided using RVO collision avoidance. The agent needs navigation data to work correctly. [NavigationAgent3D] is physics safe. + [b]Note:[/b] After setting [member target_position] it is required to use the [method get_next_path_position] function once every physics frame to update the internal path logic of the NavigationAgent. The returned vector position from this function should be used as the next movement position for the agent's parent Node. </description> <tutorials> <link title="Using NavigationAgents">$DOCS_URL/tutorials/navigation/navigation_using_navigationagents.html</link> @@ -14,13 +14,13 @@ <method name="distance_to_target" qualifiers="const"> <return type="float" /> <description> - Returns the distance to the target location, using the agent's global position. The user must set [member target_location] in order for this to be accurate. + Returns the distance to the target position, using the agent's global position. The user must set [member target_position] in order for this to be accurate. </description> </method> <method name="get_current_navigation_path" qualifiers="const"> <return type="PackedVector3Array" /> <description> - Returns this agent's current path from start to finish in global coordinates. The path only updates when the target location is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_location] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic. + Returns this agent's current path from start to finish in global coordinates. The path only updates when the target position is changed or the agent requires a repath. The path array is not intended to be used in direct path movement as the agent has its own internal path logic that would get corrupted by changing the path array manually. Use the intended [method get_next_path_position] once every physics frame to receive the next path point for the agents movement as this function also updates the internal path logic. </description> </method> <method name="get_current_navigation_path_index" qualifiers="const"> @@ -35,10 +35,10 @@ Returns the path query result for the path the agent is currently following. </description> </method> - <method name="get_final_location"> + <method name="get_final_position"> <return type="Vector3" /> <description> - Returns the reachable final location in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame. + Returns the reachable final position in global coordinates. This can change if the navigation path is altered in any way. Because of this, it would be best to check this each frame. </description> </method> <method name="get_navigation_layer_value" qualifiers="const"> @@ -54,10 +54,10 @@ Returns the [RID] of the navigation map for this NavigationAgent node. This function returns always the map set on the NavigationAgent node and not the map of the abstract agent on the NavigationServer. If the agent map is changed directly with the NavigationServer API the NavigationAgent node will not be aware of the map change. Use [method set_navigation_map] to change the navigation map for the NavigationAgent and also update the agent on the NavigationServer. </description> </method> - <method name="get_next_location"> + <method name="get_next_path_position"> <return type="Vector3" /> <description> - Returns the next location in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent. + Returns the next position in global coordinates that can be moved to, making sure that there are no static objects in the way. If the agent does not have a navigation path, it will return the position of the agent's parent. The use of this function once every physics frame is required to update the internal path logic of the NavigationAgent. </description> </method> <method name="get_rid" qualifiers="const"> @@ -69,19 +69,19 @@ <method name="is_navigation_finished"> <return type="bool" /> <description> - Returns true if the navigation path's final location has been reached. + Returns true if the navigation path's final position has been reached. </description> </method> <method name="is_target_reachable"> <return type="bool" /> <description> - Returns true if [member target_location] is reachable. + Returns true if [member target_position] is reachable. </description> </method> <method name="is_target_reached" qualifiers="const"> <return type="bool" /> <description> - Returns true if [member target_location] is reached. It may not always be possible to reach the target location. It should always be possible to reach the final location though. See [method get_final_location]. + Returns true if [member target_position] is reached. It may not always be possible to reach the target position. It should always be possible to reach the final position though. See [method get_final_position]. </description> </method> <method name="set_navigation_layer_value"> @@ -114,6 +114,18 @@ <member name="avoidance_enabled" type="bool" setter="set_avoidance_enabled" getter="get_avoidance_enabled" default="false"> If [code]true[/code] the agent is registered for an RVO avoidance callback on the [NavigationServer3D]. When [method NavigationAgent3D.set_velocity] is used and the processing is completed a [code]safe_velocity[/code] Vector3 is received with a signal connection to [signal velocity_computed]. Avoidance processing with many registered agents has a significant performance cost and should only be enabled on agents that currently require it. </member> + <member name="debug_enabled" type="bool" setter="set_debug_enabled" getter="get_debug_enabled" default="false"> + If [code]true[/code] shows debug visuals for this agent. + </member> + <member name="debug_path_custom_color" type="Color" setter="set_debug_path_custom_color" getter="get_debug_path_custom_color" default="Color(1, 1, 1, 1)"> + If [member debug_use_custom] is [code]true[/code] uses this color for this agent instead of global color. + </member> + <member name="debug_path_custom_point_size" type="float" setter="set_debug_path_custom_point_size" getter="get_debug_path_custom_point_size" default="4.0"> + If [member debug_use_custom] is [code]true[/code] uses this rasterized point size for rendering path points for this agent instead of global point size. + </member> + <member name="debug_use_custom" type="bool" setter="set_debug_use_custom" getter="get_debug_use_custom" default="false"> + If [code]true[/code] uses the defined [member debug_path_custom_color] for this agent instead of global color. + </member> <member name="ignore_y" type="bool" setter="set_ignore_y" getter="get_ignore_y" default="true"> Ignores collisions on the Y axis. Must be true to move on a horizontal plane. </member> @@ -133,7 +145,7 @@ The distance threshold before a path point is considered to be reached. This will allow an agent to not have to hit a path point on the path exactly, but in the area. If this value is set to high the NavigationAgent will skip points on the path which can lead to leaving the navigation mesh. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the next point on each physics frame update. </member> <member name="path_max_distance" type="float" setter="set_path_max_distance" getter="get_path_max_distance" default="3.0"> - The maximum distance the agent is allowed away from the ideal path to the final location. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. + The maximum distance the agent is allowed away from the ideal path to the final position. This can happen due to trying to avoid collisions. When the maximum distance is exceeded, it recalculates the ideal path. </member> <member name="path_metadata_flags" type="int" setter="set_path_metadata_flags" getter="get_path_metadata_flags" enum="NavigationPathQueryParameters3D.PathMetadataFlags" default="7"> Additional information to return with the navigation path. @@ -145,8 +157,8 @@ <member name="target_desired_distance" type="float" setter="set_target_desired_distance" getter="get_target_desired_distance" default="1.0"> The distance threshold before the final target point is considered to be reached. This will allow an agent to not have to hit the point of the final target exactly, but only the area. If this value is set to low the NavigationAgent will be stuck in a repath loop cause it will constantly overshoot or undershoot the distance to the final target point on each physics frame update. </member> - <member name="target_location" type="Vector3" setter="set_target_location" getter="get_target_location" default="Vector3(0, 0, 0)"> - The user-defined target location. Setting this property will clear the current navigation path. + <member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3(0, 0, 0)"> + The user-defined target position. Setting this property will clear the current navigation path. </member> <member name="time_horizon" type="float" setter="set_time_horizon" getter="get_time_horizon" default="5.0"> The minimal amount of time for which this agent's velocities, that are computed with the collision avoidance algorithm, are safe with respect to other agents. The larger the number, the sooner the agent will respond to other agents, but less freedom in choosing its velocities. Must be positive. @@ -158,7 +170,7 @@ <description> Notifies when a navigation link has been reached. The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]: - - [code]location[/code]: The start location of the link that was reached. + - [code]position[/code]: The start position of the link that was reached. - [code]type[/code]: Always [constant NavigationPathQueryResult3D.PATH_SEGMENT_TYPE_LINK]. - [code]rid[/code]: The [RID] of the link. - [code]owner[/code]: The object which manages the link (usually [NavigationLink3D]). @@ -166,7 +178,7 @@ </signal> <signal name="navigation_finished"> <description> - Notifies when the final location is reached. + Notifies when the final position is reached. </description> </signal> <signal name="path_changed"> @@ -176,7 +188,7 @@ </signal> <signal name="target_reached"> <description> - Notifies when the player-defined [member target_location] is reached. + Notifies when the player-defined [member target_position] is reached. </description> </signal> <signal name="velocity_computed"> @@ -190,7 +202,7 @@ <description> Notifies when a waypoint along the path has been reached. The details dictionary may contain the following keys depending on the value of [member path_metadata_flags]: - - [code]location[/code]: The location of the waypoint that was reached. + - [code]position[/code]: The position of the waypoint that was reached. - [code]type[/code]: The type of navigation primitive (region or link) that contains this waypoint. - [code]rid[/code]: The [RID] of the containing navigation primitive (region or link). - [code]owner[/code]: The object which manages the containing navigation primitive (region or link). diff --git a/doc/classes/NavigationLink2D.xml b/doc/classes/NavigationLink2D.xml index 44d2110a7c..b3f4367675 100644 --- a/doc/classes/NavigationLink2D.xml +++ b/doc/classes/NavigationLink2D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="NavigationLink2D" inherits="Node2D" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Creates a link between two locations that [NavigationServer2D] can route agents through. + Creates a link between two positions that [NavigationServer2D] can route agents through. </brief_description> <description> - Creates a link between two locations that [NavigationServer2D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps. + Creates a link between two positions that [NavigationServer2D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps. </description> <tutorials> <link title="Using NavigationLinks">$DOCS_URL/tutorials/navigation/navigation_using_navigationlinks.html</link> @@ -28,12 +28,12 @@ </methods> <members> <member name="bidirectional" type="bool" setter="set_bidirectional" getter="is_bidirectional" default="true"> - Whether this link can be traveled in both directions or only from [member start_location] to [member end_location]. + Whether this link can be traveled in both directions or only from [member start_position] to [member end_position]. </member> <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true"> Whether this link is currently active. If [code]false[/code], [method NavigationServer2D.map_get_path] will ignore this link. </member> - <member name="end_location" type="Vector2" setter="set_end_location" getter="get_end_location" default="Vector2(0, 0)"> + <member name="end_position" type="Vector2" setter="set_end_position" getter="get_end_position" default="Vector2(0, 0)"> Ending position of the link. This position will search out the nearest polygon in the navigation mesh to attach to. The distance the link will search is controlled by [method NavigationServer2D.map_set_link_connection_radius]. @@ -44,7 +44,7 @@ <member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1"> A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with [method NavigationServer2D.map_get_path]. </member> - <member name="start_location" type="Vector2" setter="set_start_location" getter="get_start_location" default="Vector2(0, 0)"> + <member name="start_position" type="Vector2" setter="set_start_position" getter="get_start_position" default="Vector2(0, 0)"> Starting position of the link. This position will search out the nearest polygon in the navigation mesh to attach to. The distance the link will search is controlled by [method NavigationServer2D.map_set_link_connection_radius]. diff --git a/doc/classes/NavigationLink3D.xml b/doc/classes/NavigationLink3D.xml index 4aa5801afb..4dff226042 100644 --- a/doc/classes/NavigationLink3D.xml +++ b/doc/classes/NavigationLink3D.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="NavigationLink3D" inherits="Node3D" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - Creates a link between two locations that [NavigationServer3D] can route agents through. + Creates a link between two positions that [NavigationServer3D] can route agents through. </brief_description> <description> - Creates a link between two locations that [NavigationServer3D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps. + Creates a link between two positions that [NavigationServer3D] can route agents through. Links can be used to express navigation methods that aren't just traveling along the surface of the navigation mesh, like zip-lines, teleporters, or jumping across gaps. </description> <tutorials> <link title="Using NavigationLinks">$DOCS_URL/tutorials/navigation/navigation_using_navigationlinks.html</link> @@ -28,12 +28,12 @@ </methods> <members> <member name="bidirectional" type="bool" setter="set_bidirectional" getter="is_bidirectional" default="true"> - Whether this link can be traveled in both directions or only from [member start_location] to [member end_location]. + Whether this link can be traveled in both directions or only from [member start_position] to [member end_position]. </member> <member name="enabled" type="bool" setter="set_enabled" getter="is_enabled" default="true"> Whether this link is currently active. If [code]false[/code], [method NavigationServer3D.map_get_path] will ignore this link. </member> - <member name="end_location" type="Vector3" setter="set_end_location" getter="get_end_location" default="Vector3(0, 0, 0)"> + <member name="end_position" type="Vector3" setter="set_end_position" getter="get_end_position" default="Vector3(0, 0, 0)"> Ending position of the link. This position will search out the nearest polygon in the navigation mesh to attach to. The distance the link will search is controlled by [method NavigationServer3D.map_set_link_connection_radius]. @@ -44,7 +44,7 @@ <member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1"> A bitfield determining all navigation layers the link belongs to. These navigation layers will be checked when requesting a path with [method NavigationServer3D.map_get_path]. </member> - <member name="start_location" type="Vector3" setter="set_start_location" getter="get_start_location" default="Vector3(0, 0, 0)"> + <member name="start_position" type="Vector3" setter="set_start_position" getter="get_start_position" default="Vector3(0, 0, 0)"> Starting position of the link. This position will search out the nearest polygon in the navigation mesh to attach to. The distance the link will search is controlled by [method NavigationServer3D.map_set_link_connection_radius]. diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 1ba949b294..7270a19b4d 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -41,12 +41,10 @@ <method name="agent_set_callback"> <return type="void" /> <param index="0" name="agent" type="RID" /> - <param index="1" name="object_id" type="int" /> - <param index="2" name="method" type="StringName" /> - <param index="3" name="userdata" type="Variant" default="null" /> + <param index="1" name="callback" type="Callable" /> <description> - Sets the callback [param object_id] and [param method] that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be dispatched with a signal to the object just before the physics calculations. - [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with a [code]0[/code] ObjectID as the [param object_id]. + Sets the callback that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be passed as the first parameter just before the physics calculations. + [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with an empty [Callable]. </description> </method> <method name="agent_set_map"> @@ -137,14 +135,14 @@ <method name="link_create"> <return type="RID" /> <description> - Create a new link between two locations on a map. + Create a new link between two positions on a map. </description> </method> - <method name="link_get_end_location" qualifiers="const"> + <method name="link_get_end_position" qualifiers="const"> <return type="Vector2" /> <param index="0" name="link" type="RID" /> <description> - Returns the ending location of this [code]link[/code]. + Returns the ending position of this [code]link[/code]. </description> </method> <method name="link_get_enter_cost" qualifiers="const"> @@ -175,11 +173,11 @@ Returns the [code]ObjectID[/code] of the object which manages this link. </description> </method> - <method name="link_get_start_location" qualifiers="const"> + <method name="link_get_start_position" qualifiers="const"> <return type="Vector2" /> <param index="0" name="link" type="RID" /> <description> - Returns the starting location of this [code]link[/code]. + Returns the starting position of this [code]link[/code]. </description> </method> <method name="link_get_travel_cost" qualifiers="const"> @@ -204,12 +202,12 @@ Sets whether this [code]link[/code] can be travelled in both directions. </description> </method> - <method name="link_set_end_location"> + <method name="link_set_end_position"> <return type="void" /> <param index="0" name="link" type="RID" /> - <param index="1" name="location" type="Vector2" /> + <param index="1" name="position" type="Vector2" /> <description> - Sets the exit location for the [code]link[/code]. + Sets the exit position for the [code]link[/code]. </description> </method> <method name="link_set_enter_cost"> @@ -244,12 +242,12 @@ Set the [code]ObjectID[/code] of the object which manages this link. </description> </method> - <method name="link_set_start_location"> + <method name="link_set_start_position"> <return type="void" /> <param index="0" name="link" type="RID" /> - <param index="1" name="location" type="Vector2" /> + <param index="1" name="position" type="Vector2" /> <description> - Sets the entry location for this [code]link[/code]. + Sets the entry position for this [code]link[/code]. </description> </method> <method name="link_set_travel_cost"> @@ -530,5 +528,10 @@ Emitted when a navigation map is updated, when a region moves or is modified. </description> </signal> + <signal name="navigation_debug_changed"> + <description> + Emitted when navigation debug settings are changed. Only available in debug builds. + </description> + </signal> </signals> </class> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index e007c71342..340821d41e 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -41,12 +41,10 @@ <method name="agent_set_callback"> <return type="void" /> <param index="0" name="agent" type="RID" /> - <param index="1" name="object_id" type="int" /> - <param index="2" name="method" type="StringName" /> - <param index="3" name="userdata" type="Variant" default="null" /> + <param index="1" name="callback" type="Callable" /> <description> - Sets the callback [param object_id] and [param method] that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be dispatched with a signal to the object just before the physics calculations. - [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with a [code]0[/code] ObjectID as the [param object_id]. + Sets the callback that gets called after each avoidance processing step for the [param agent]. The calculated [code]safe_velocity[/code] will be passed as the first parameter just before the physics calculations. + [b]Note:[/b] Created callbacks are always processed independently of the SceneTree state as long as the agent is on a navigation map and not freed. To disable the dispatch of a callback from an agent use [method agent_set_callback] again with an empty [Callable]. </description> </method> <method name="agent_set_map"> @@ -144,14 +142,14 @@ <method name="link_create"> <return type="RID" /> <description> - Create a new link between two locations on a map. + Create a new link between two positions on a map. </description> </method> - <method name="link_get_end_location" qualifiers="const"> + <method name="link_get_end_position" qualifiers="const"> <return type="Vector3" /> <param index="0" name="link" type="RID" /> <description> - Returns the ending location of this [code]link[/code]. + Returns the ending position of this [code]link[/code]. </description> </method> <method name="link_get_enter_cost" qualifiers="const"> @@ -182,11 +180,11 @@ Returns the [code]ObjectID[/code] of the object which manages this link. </description> </method> - <method name="link_get_start_location" qualifiers="const"> + <method name="link_get_start_position" qualifiers="const"> <return type="Vector3" /> <param index="0" name="link" type="RID" /> <description> - Returns the starting location of this [code]link[/code]. + Returns the starting position of this [code]link[/code]. </description> </method> <method name="link_get_travel_cost" qualifiers="const"> @@ -211,12 +209,12 @@ Sets whether this [code]link[/code] can be travelled in both directions. </description> </method> - <method name="link_set_end_location"> + <method name="link_set_end_position"> <return type="void" /> <param index="0" name="link" type="RID" /> - <param index="1" name="location" type="Vector3" /> + <param index="1" name="position" type="Vector3" /> <description> - Sets the exit location for the [code]link[/code]. + Sets the exit position for the [code]link[/code]. </description> </method> <method name="link_set_enter_cost"> @@ -251,12 +249,12 @@ Set the [code]ObjectID[/code] of the object which manages this link. </description> </method> - <method name="link_set_start_location"> + <method name="link_set_start_position"> <return type="void" /> <param index="0" name="link" type="RID" /> - <param index="1" name="location" type="Vector3" /> + <param index="1" name="position" type="Vector3" /> <description> - Sets the entry location for this [code]link[/code]. + Sets the entry position for this [code]link[/code]. </description> </method> <method name="link_set_travel_cost"> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 7b27f16d82..7c40c189c0 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -666,7 +666,7 @@ channel = 0, } [/codeblock] - See [enum MultiplayerAPI.RPCMode] and [enum MultiplayerPeer.TransferMode]. An alternative is annotating methods and properties with the corresponding annotation ([code]@rpc(any)[/code], [code]@rpc(authority)[/code]). By default, methods are not exposed to networking (and RPCs). + See [enum MultiplayerAPI.RPCMode] and [enum MultiplayerPeer.TransferMode]. An alternative is annotating methods and properties with the corresponding annotation ([code]@rpc("any")[/code], [code]@rpc("authority")[/code]). By default, methods are not exposed to networking (and RPCs). </description> </method> <method name="rpc_id" qualifiers="vararg"> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index 0058bf8a2f..04895c28a8 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -498,7 +498,7 @@ <description> Returns [code]true[/code] if the Godot binary used to run the project is a [i]debug[/i] export template, or when running in the editor. Returns [code]false[/code] if the Godot binary used to run the project is a [i]release[/i] export template. - To check whether the Godot binary used to run the project is an export template (debug or release), use [code]OS.has_feature("standalone")[/code] instead. + To check whether the Godot binary used to run the project is an export template (debug or release), use [code]OS.has_feature("template")[/code] instead. </description> </method> <method name="is_keycode_unicode" qualifiers="const"> diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 1a805007e6..e30ff6be19 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -110,7 +110,7 @@ [/gdscript] [csharp] [Tool] - public class MyNode2D : Node2D + public partial class MyNode2D : Node2D { private bool _holdingHammer; @@ -305,7 +305,7 @@ [/gdscript] [csharp] var node = new Node3D(); - node.Call("rotate", new Vector3(1f, 0f, 0f), 1.571f); + node.Call(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f); [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call. @@ -323,7 +323,7 @@ [/gdscript] [csharp] var node = new Node3D(); - node.CallDeferred("rotate", new Vector3(1f, 0f, 0f), 1.571f); + node.CallDeferred(Node3D.MethodName.Rotate, new Vector3(1f, 0f, 0f), 1.571f); [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call. @@ -342,7 +342,7 @@ [/gdscript] [csharp] var node = new Node3D(); - node.Callv("rotate", new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f }); + node.Callv(Node3D.MethodName.Rotate, new Godot.Collections.Array { new Vector3(1f, 0f, 0f), 1.571f }); [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param method] must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the [code]MethodName[/code] class to avoid allocating a new [StringName] on each call @@ -394,8 +394,8 @@ // This assumes that a `Player` class exists, which defines a `Hit` signal. var player = new Player(); - // Signals as events (`player.Hit += OnPlayerHit;`) do not support argument binding. You have to use: - player.Hit.Connect(OnPlayerHit, new Godot.Collections.Array {"sword", 100 }); + // We can use lambdas when we need to bind additional parameters. + player.Hit += () => OnPlayerHit("sword", 100); } private void OnButtonDown() @@ -405,7 +405,7 @@ private void OnPlayerHit(string weaponType, int damage) { - GD.Print(String.Format("Hit with weapon {0} for {1} damage.", weaponType, damage)); + GD.Print($"Hit with weapon {weaponType} for {damage} damage."); } [/csharp] [/codeblocks] @@ -431,16 +431,12 @@ public override void _Ready() { var button = new Button(); - // Option 1: Object.Connect() with an implicit Callable for the defined function. - button.Connect("button_down", OnButtonDown); - // Option 2: Object.connect() with a constructed Callable using a target object and method name. - button.Connect("button_down", new Callable(self, nameof(OnButtonDown))); - // Option 3: Signal.connect() with an implicit Callable for the defined function. - button.ButtonDown.Connect(OnButtonDown); - // Option 3b: In C#, we can use signals as events and connect with this more idiomatic syntax: + // Option 1: In C#, we can use signals as events and connect with this idiomatic syntax: button.ButtonDown += OnButtonDown; - // Option 4: Signal.connect() with a constructed Callable using a target object and method name. - button.ButtonDown.Connect(new Callable(self, nameof(OnButtonDown))); + // Option 2: GodotObject.Connect() with a constructed Callable from a method group. + button.Connect(Button.SignalName.ButtonDown, Callable.From(OnButtonDown)); + // Option 3: GodotObject.Connect() with a constructed Callable using a target object and method name. + button.Connect(Button.SignalName.ButtonDown, new Callable(this, MethodName.OnButtonDown)); } private void OnButtonDown() @@ -458,6 +454,7 @@ func _ready(): # This assumes that a `Player` class exists, which defines a `hit` signal. var player = Player.new() + # Using Callable.bind(). player.hit.connect(_on_player_hit.bind("sword", 100)) # Parameters added when emitting the signal are passed first. @@ -473,20 +470,19 @@ { // This assumes that a `Player` class exists, which defines a `Hit` signal. var player = new Player(); - // Option 1: Using Callable.Bind(). This way we can still use signals as events. - player.Hit += OnPlayerHit.Bind("sword", 100); - // Option 2: Using a `binds` Array in Signal.Connect(). - player.Hit.Connect(OnPlayerHit, new Godot.Collections.Array{ "sword", 100 }); + // Using lambda expressions that create a closure that captures the additional parameters. + // The lambda only receives the parameters defined by the signal's delegate. + player.Hit += (hitBy, level) => OnPlayerHit(hitBy, level, "sword", 100); // Parameters added when emitting the signal are passed first. - player.EmitSignal("hit", "Dark lord", 5); + player.EmitSignal(SignalName.Hit, "Dark lord", 5); } // We pass two arguments when emitting (`hit_by`, `level`), // and bind two more arguments when connecting (`weapon_type`, `damage`). private void OnPlayerHit(string hitBy, int level, string weaponType, int damage) { - GD.Print(String.Format("Hit by {0} (level {1}) with weapon {2} for {3} damage.", hitBy, level, weaponType, damage)); + GD.Print($"Hit by {hitBy} (level {level}) with weapon {weaponType} for {damage} damage."); } [/csharp] [/codeblocks] @@ -512,8 +508,8 @@ emit_signal("game_over") [/gdscript] [csharp] - EmitSignal("Hit", "sword", 100); - EmitSignal("GameOver"); + EmitSignal(SignalName.Hit, "sword", 100); + EmitSignal(SignalName.GameOver); [/csharp] [/codeblocks] [b]Note:[/b] In C#, [param signal] must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the [code]SignalName[/code] class to avoid allocating a new [StringName] on each call. @@ -581,7 +577,7 @@ var b = node.GetIndexed("position:y"); // b is -10 [/csharp] [/codeblocks] - [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. + [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new [StringName] on each call. [b]Note:[/b] This method does not support actual paths to nodes in the [SceneTree], only sub-property paths. In the context of nodes, use [method Node.get_node_and_resource] instead. </description> </method> @@ -704,10 +700,10 @@ sprite2d.is_class("Node3D") # Returns false [/gdscript] [csharp] - var sprite2d = new Sprite2D(); - sprite2d.IsClass("Sprite2D"); // Returns true - sprite2d.IsClass("Node"); // Returns true - sprite2d.IsClass("Node3D"); // Returns false + var sprite2D = new Sprite2D(); + sprite2D.IsClass("Sprite2D"); // Returns true + sprite2D.IsClass("Node"); // Returns true + sprite2D.IsClass("Node3D"); // Returns false [/csharp] [/codeblocks] [b]Note:[/b] This method ignores [code]class_name[/code] declarations in the object's script. @@ -751,10 +747,10 @@ player.SetScript(GD.Load("res://player.gd")); player.Notification(NotificationEnterTree); - // The call order is Object -> Node -> Node2D -> player.gd. + // The call order is GodotObject -> Node -> Node2D -> player.gd. - player.notification(NotificationEnterTree, true); - // The call order is player.gd -> Node2D -> Node -> Object. + player.Notification(NotificationEnterTree, true); + // The call order is player.gd -> Node2D -> Node -> GodotObject. [/csharp] [/codeblocks] </description> @@ -868,7 +864,7 @@ GD.Print(node.Position); // Prints (42, -10) [/csharp] [/codeblocks] - [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. + [b]Note:[/b] In C#, [param property_path] must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the [code]PropertyName[/code] class to avoid allocating a new [StringName] on each call. </description> </method> <method name="set_message_translation"> diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml index 7ca1d5d60d..493fc9e2a8 100644 --- a/doc/classes/PackedScene.xml +++ b/doc/classes/PackedScene.xml @@ -104,7 +104,7 @@ </method> </methods> <members> - <member name="_bundled" type="Dictionary" setter="_set_bundled_scene" getter="_get_bundled_scene" default="{ "conn_count": 0, "conns": PackedInt32Array(), "editable_instances": [], "names": PackedStringArray(), "node_count": 0, "node_paths": [], "nodes": PackedInt32Array(), "variants": [], "version": 2 }"> + <member name="_bundled" type="Dictionary" setter="_set_bundled_scene" getter="_get_bundled_scene" default="{ "conn_count": 0, "conns": PackedInt32Array(), "editable_instances": [], "names": PackedStringArray(), "node_count": 0, "node_paths": [], "nodes": PackedInt32Array(), "variants": [], "version": 3 }"> A dictionary representation of the scene contents. Available keys include "rnames" and "variants" for resources, "node_count", "nodes", "node_paths" for nodes, "editable_instances" for base scene children overrides, "conn_count" and "conns" for signal connections, and "version" for the format style of the PackedScene. </member> diff --git a/doc/classes/PacketPeerDTLS.xml b/doc/classes/PacketPeerDTLS.xml index db8403a56b..19c5d0e287 100644 --- a/doc/classes/PacketPeerDTLS.xml +++ b/doc/classes/PacketPeerDTLS.xml @@ -14,11 +14,10 @@ <method name="connect_to_peer"> <return type="int" enum="Error" /> <param index="0" name="packet_peer" type="PacketPeerUDP" /> - <param index="1" name="validate_certs" type="bool" default="true" /> - <param index="2" name="for_hostname" type="String" default="""" /> - <param index="3" name="valid_certificate" type="X509Certificate" default="null" /> + <param index="1" name="hostname" type="String" /> + <param index="2" name="client_options" type="TLSOptions" default="null" /> <description> - Connects a [param packet_peer] beginning the DTLS handshake using the underlying [PacketPeerUDP] which must be connected (see [method PacketPeerUDP.connect_to_host]). If [param validate_certs] is [code]true[/code], [PacketPeerDTLS] will validate that the certificate presented by the remote peer and match it with the [param for_hostname] argument. You can specify a custom [X509Certificate] to use for validation via the [param valid_certificate] argument. + Connects a [param packet_peer] beginning the DTLS handshake using the underlying [PacketPeerUDP] which must be connected (see [method PacketPeerUDP.connect_to_host]). You can optionally specify the [param client_options] to be used while verifying the TLS connections. See [method TLSOptions.client] and [method TLSOptions.client_unsafe]. </description> </method> <method name="disconnect_from_peer"> diff --git a/doc/classes/ParticleProcessMaterial.xml b/doc/classes/ParticleProcessMaterial.xml index d4050e3bd1..d046d52ed1 100644 --- a/doc/classes/ParticleProcessMaterial.xml +++ b/doc/classes/ParticleProcessMaterial.xml @@ -123,7 +123,8 @@ </member> <member name="collision_mode" type="int" setter="set_collision_mode" getter="get_collision_mode" enum="ParticleProcessMaterial.CollisionMode" default="0"> The particles' collision mode. - [b]Note:[/b] Particles can only collide with [GPUParticlesCollision3D] nodes, not [PhysicsBody3D] nodes. To make particles collide with various objects, you can add [GPUParticlesCollision3D] nodes as children of [PhysicsBody3D] nodes. + [b]Note:[/b] 3D Particles can only collide with [GPUParticlesCollision3D] nodes, not [PhysicsBody3D] nodes. To make particles collide with various objects, you can add [GPUParticlesCollision3D] nodes as children of [PhysicsBody3D] nodes. + [b]Note:[/b] 2D Particles can only collide with [LightOccluder2D] nodes, not [PhysicsBody2D] nodes. </member> <member name="collision_use_scale" type="bool" setter="set_collision_use_scale" getter="is_collision_using_scale" default="false"> Should collision take scale into account. diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml index 6b7daa534e..493af8aff2 100644 --- a/doc/classes/Performance.xml +++ b/doc/classes/Performance.xml @@ -45,7 +45,7 @@ [csharp] public override void _Ready() { - var monitorValue = new Callable(this, nameof(GetMonitorValue)); + var monitorValue = new Callable(this, MethodName.GetMonitorValue); // Adds monitor with name "MyName" to category "MyCategory". Performance.AddCustomMonitor("MyCategory/MyMonitor", monitorValue); diff --git a/doc/classes/PhysicsPointQueryParameters2D.xml b/doc/classes/PhysicsPointQueryParameters2D.xml index 76dc816dab..15102830f8 100644 --- a/doc/classes/PhysicsPointQueryParameters2D.xml +++ b/doc/classes/PhysicsPointQueryParameters2D.xml @@ -11,6 +11,7 @@ <members> <member name="canvas_instance_id" type="int" setter="set_canvas_instance_id" getter="get_canvas_instance_id" default="0"> If different from [code]0[/code], restricts the query to a specific canvas layer specified by its instance ID. See [method Object.get_instance_id]. + If [code]0[/code], restricts the query to the Viewport's default canvas layer. </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], the query will take [Area2D]s into account. diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index f1316fa991..93e88347d4 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -984,25 +984,23 @@ <constant name="AREA_PARAM_GRAVITY_IS_POINT" value="3" enum="AreaParameter"> Constant to set/get whether the gravity vector of an area is a direction, or a center point. </constant> - <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="4" enum="AreaParameter"> - Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance. + <constant name="AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE" value="4" enum="AreaParameter"> + Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. For example, on a planet 100 pixels in radius with a surface gravity of 4.0 px/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 pixels from the center the gravity will be 1.0 px/s² (twice the distance, 1/4th the gravity), at 50 pixels it will be 16.0 px/s² (half the distance, 4x the gravity), and so on. + The above is true only when the unit distance is a positive number. When the unit distance is set to 0.0, the gravity will be constant regardless of distance. </constant> - <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="5" enum="AreaParameter"> - This constant was used to set/get the falloff factor for point gravity. It has been superseded by [constant AREA_PARAM_GRAVITY_DISTANCE_SCALE]. - </constant> - <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="6" enum="AreaParameter"> + <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="5" enum="AreaParameter"> Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. </constant> - <constant name="AREA_PARAM_LINEAR_DAMP" value="7" enum="AreaParameter"> + <constant name="AREA_PARAM_LINEAR_DAMP" value="6" enum="AreaParameter"> Constant to set/get the linear damping factor of an area. </constant> - <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="8" enum="AreaParameter"> + <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="7" enum="AreaParameter"> Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. </constant> - <constant name="AREA_PARAM_ANGULAR_DAMP" value="9" enum="AreaParameter"> + <constant name="AREA_PARAM_ANGULAR_DAMP" value="8" enum="AreaParameter"> Constant to set/get the angular damping factor of an area. </constant> - <constant name="AREA_PARAM_PRIORITY" value="10" enum="AreaParameter"> + <constant name="AREA_PARAM_PRIORITY" value="9" enum="AreaParameter"> Constant to set/get the priority (order of processing) of an area. </constant> <constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0" enum="AreaSpaceOverrideMode"> diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index e62bda0dd3..5b261d8414 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -1315,37 +1315,35 @@ <constant name="AREA_PARAM_GRAVITY_IS_POINT" value="3" enum="AreaParameter"> Constant to set/get whether the gravity vector of an area is a direction, or a center point. </constant> - <constant name="AREA_PARAM_GRAVITY_DISTANCE_SCALE" value="4" enum="AreaParameter"> - Constant to set/get the falloff factor for point gravity of an area. The greater this value is, the faster the strength of gravity decreases with the square of distance. + <constant name="AREA_PARAM_GRAVITY_POINT_UNIT_DISTANCE" value="4" enum="AreaParameter"> + Constant to set/get the distance at which the gravity strength is equal to the gravity controlled by [constant AREA_PARAM_GRAVITY]. For example, on a planet 100 meters in radius with a surface gravity of 4.0 m/s², set the gravity to 4.0 and the unit distance to 100.0. The gravity will have falloff according to the inverse square law, so in the example, at 200 meters from the center the gravity will be 1.0 m/s² (twice the distance, 1/4th the gravity), at 50 meters it will be 16.0 m/s² (half the distance, 4x the gravity), and so on. + The above is true only when the unit distance is a positive number. When this is set to 0.0, the gravity will be constant regardless of distance. </constant> - <constant name="AREA_PARAM_GRAVITY_POINT_ATTENUATION" value="5" enum="AreaParameter"> - This constant was used to set/get the falloff factor for point gravity. It has been superseded by [constant AREA_PARAM_GRAVITY_DISTANCE_SCALE]. - </constant> - <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="6" enum="AreaParameter"> + <constant name="AREA_PARAM_LINEAR_DAMP_OVERRIDE_MODE" value="5" enum="AreaParameter"> Constant to set/get linear damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. </constant> - <constant name="AREA_PARAM_LINEAR_DAMP" value="7" enum="AreaParameter"> + <constant name="AREA_PARAM_LINEAR_DAMP" value="6" enum="AreaParameter"> Constant to set/get the linear damping factor of an area. </constant> - <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="8" enum="AreaParameter"> + <constant name="AREA_PARAM_ANGULAR_DAMP_OVERRIDE_MODE" value="7" enum="AreaParameter"> Constant to set/get angular damping override mode in an area. See [enum AreaSpaceOverrideMode] for possible values. </constant> - <constant name="AREA_PARAM_ANGULAR_DAMP" value="9" enum="AreaParameter"> + <constant name="AREA_PARAM_ANGULAR_DAMP" value="8" enum="AreaParameter"> Constant to set/get the angular damping factor of an area. </constant> - <constant name="AREA_PARAM_PRIORITY" value="10" enum="AreaParameter"> + <constant name="AREA_PARAM_PRIORITY" value="9" enum="AreaParameter"> Constant to set/get the priority (order of processing) of an area. </constant> - <constant name="AREA_PARAM_WIND_FORCE_MAGNITUDE" value="11" enum="AreaParameter"> + <constant name="AREA_PARAM_WIND_FORCE_MAGNITUDE" value="10" enum="AreaParameter"> Constant to set/get the magnitude of area-specific wind force. </constant> - <constant name="AREA_PARAM_WIND_SOURCE" value="12" enum="AreaParameter"> + <constant name="AREA_PARAM_WIND_SOURCE" value="11" enum="AreaParameter"> Constant to set/get the 3D vector that specifies the origin from which an area-specific wind blows. </constant> - <constant name="AREA_PARAM_WIND_DIRECTION" value="13" enum="AreaParameter"> + <constant name="AREA_PARAM_WIND_DIRECTION" value="12" enum="AreaParameter"> Constant to set/get the 3D vector that specifies the direction in which an area-specific wind blows. </constant> - <constant name="AREA_PARAM_WIND_ATTENUATION_FACTOR" value="14" enum="AreaParameter"> + <constant name="AREA_PARAM_WIND_ATTENUATION_FACTOR" value="13" enum="AreaParameter"> Constant to set/get the exponential rate at which wind force decreases with distance from its origin. </constant> <constant name="AREA_SPACE_OVERRIDE_DISABLED" value="0" enum="AreaSpaceOverrideMode"> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 84df014fa4..e429759e93 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -408,8 +408,11 @@ <member name="debug/gdscript/warnings/incompatible_ternary" type="int" setter="" getter="" default="1"> When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a ternary operator may emit values with incompatible types. </member> - <member name="debug/gdscript/warnings/int_assigned_to_enum" type="int" setter="" getter="" default="1"> - When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when trying to assign an integer to a variable that expects an enum value. + <member name="debug/gdscript/warnings/int_as_enum_without_cast" type="int" setter="" getter="" default="1"> + When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when trying to use an integer as an enum without an explicit cast. + </member> + <member name="debug/gdscript/warnings/int_as_enum_without_match" type="int" setter="" getter="" default="1"> + When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when trying to use an integer as an enum when there is no matching enum member for that numeric value. </member> <member name="debug/gdscript/warnings/integer_division" type="int" setter="" getter="" default="1"> When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when dividing an integer by another integer (the decimal part will be discarded). @@ -423,6 +426,9 @@ <member name="debug/gdscript/warnings/redundant_await" type="int" setter="" getter="" default="1"> When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a function that is not a coroutine is called with await. </member> + <member name="debug/gdscript/warnings/renamed_in_godot_4_hint" type="bool" setter="" getter="" default="1"> + When enabled, using a property, enum, or function that was renamed since Godot 3 will produce a hint if an error occurs. + </member> <member name="debug/gdscript/warnings/return_value_discarded" type="int" setter="" getter="" default="0"> When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when calling a function without using its return value (by assigning it to a variable or using it as a function argument). Such return values are sometimes used to denote possible errors using the [enum Error] enum. </member> @@ -471,6 +477,9 @@ <member name="debug/gdscript/warnings/unsafe_property_access" type="int" setter="" getter="" default="0"> When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when accessing a property whose presence is not guaranteed at compile-time in the class. </member> + <member name="debug/gdscript/warnings/unsafe_void_return" type="int" setter="" getter="" default="0"> + When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when returning a call from a [code]void[/code] function when such call cannot be guaranteed to be also [code]void[/code]. + </member> <member name="debug/gdscript/warnings/unused_local_constant" type="int" setter="" getter="" default="1"> When set to [code]warn[/code] or [code]error[/code], produces a warning or an error respectively when a local constant is never used. </member> @@ -519,9 +528,21 @@ <member name="debug/shapes/collision/shape_color" type="Color" setter="" getter="" default="Color(0, 0.6, 0.7, 0.42)"> Color of the collision shapes, visible when "Visible Collision Shapes" is enabled in the Debug menu. </member> + <member name="debug/shapes/navigation/agent_path_color" type="Color" setter="" getter="" default="Color(1, 0, 0, 1)"> + Color to display enabled navigation agent paths when an agent has debug enabled. + </member> + <member name="debug/shapes/navigation/agent_path_point_size" type="float" setter="" getter="" default="4.0"> + Rasterized size (pixel) used to render navigation agent path points when an agent has debug enabled. + </member> <member name="debug/shapes/navigation/edge_connection_color" type="Color" setter="" getter="" default="Color(1, 0, 1, 1)"> Color to display edge connections between navigation regions, visible when "Visible Navigation" is enabled in the Debug menu. </member> + <member name="debug/shapes/navigation/enable_agent_paths" type="bool" setter="" getter="" default="true"> + If enabled, displays navigation agent paths when an agent has debug enabled. + </member> + <member name="debug/shapes/navigation/enable_agent_paths_xray" type="bool" setter="" getter="" default="true"> + If enabled, displays navigation agent paths through geometry when an agent has debug enabled. + </member> <member name="debug/shapes/navigation/enable_edge_connections" type="bool" setter="" getter="" default="true"> If enabled, displays edge connections between navigation regions when "Visible Navigation" is enabled in the Debug menu. </member> @@ -698,10 +719,16 @@ <member name="editor/movie_writer/speaker_mode" type="int" setter="" getter="" default="0"> The speaker mode to use in the recorded audio when writing a movie. See [enum AudioServer.SpeakerMode] for possible values. </member> - <member name="editor/node_naming/name_casing" type="int" setter="" getter="" default="0"> + <member name="editor/naming/default_signal_callback_name" type="String" setter="" getter="" default=""_on_{node_name}_{signal_name}""> + The format of the default signal callback name (in the Signal Connection Dialog). The following substitutions are available: [code]{NodeName}[/code], [code]{nodeName}[/code], [code]{node_name}[/code], [code]{SignalName}[/code], [code]{signalName}[/code], and [code]{signal_name}[/code]. + </member> + <member name="editor/naming/default_signal_callback_to_self_name" type="String" setter="" getter="" default=""_on_{signal_name}""> + The format of the default signal callback name when a signal connects to the same node that emits it (in the Signal Connection Dialog). The following substitutions are available: [code]{NodeName}[/code], [code]{nodeName}[/code], [code]{node_name}[/code], [code]{SignalName}[/code], [code]{signalName}[/code], and [code]{signal_name}[/code]. + </member> + <member name="editor/naming/node_name_casing" type="int" setter="" getter="" default="0"> When creating node names automatically, set the type of casing in this project. This is mostly an editor setting. </member> - <member name="editor/node_naming/name_num_separator" type="int" setter="" getter="" default="0"> + <member name="editor/naming/node_name_num_separator" type="int" setter="" getter="" default="0"> What to use to separate node name from number. This is mostly an editor setting. </member> <member name="editor/run/main_run_args" type="String" setter="" getter="" default=""""> @@ -1728,7 +1755,7 @@ [/gdscript] [csharp] // Set the default gravity strength to 980. - PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2d().Space, PhysicsServer2D.AreaParameter.Gravity, 980); + PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2D().Space, PhysicsServer2D.AreaParameter.Gravity, 980); [/csharp] [/codeblocks] </member> @@ -1742,7 +1769,7 @@ [/gdscript] [csharp] // Set the default gravity direction to `Vector2(0, 1)`. - PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2d().Space, PhysicsServer2D.AreaParameter.GravityVector, Vector2.Down) + PhysicsServer2D.AreaSetParam(GetViewport().FindWorld2D().Space, PhysicsServer2D.AreaParameter.GravityVector, Vector2.Down) [/csharp] [/codeblocks] </member> @@ -2276,20 +2303,12 @@ <member name="rendering/textures/lossless_compression/force_png" type="bool" setter="" getter="" default="false"> If [code]true[/code], the texture importer will import lossless textures using the PNG format. Otherwise, it will default to using WebP. </member> - <member name="rendering/textures/vram_compression/import_bptc" type="bool" setter="" getter="" default="false"> - If [code]true[/code], the texture importer will import VRAM-compressed textures using the BPTC algorithm. This texture compression algorithm is only supported on desktop platforms, and only when using the Vulkan renderer. - [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]). - </member> - <member name="rendering/textures/vram_compression/import_etc" type="bool" setter="" getter="" default="false"> - If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression algorithm. This algorithm doesn't support alpha channels in textures. - [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]). - </member> - <member name="rendering/textures/vram_compression/import_etc2" type="bool" setter="" getter="" default="true"> - If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm. This texture compression algorithm is only supported when using the Vulkan renderer. + <member name="rendering/textures/vram_compression/import_etc2_astc" type="bool" setter="" getter="" default="false"> + If [code]true[/code], the texture importer will import VRAM-compressed textures using the Ericsson Texture Compression 2 algorithm for lower quality textures and normalmaps and Adaptable Scalable Texture Compression algorithm for high quality textures (in 4x4 block size). [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]). </member> - <member name="rendering/textures/vram_compression/import_s3tc" type="bool" setter="" getter="" default="true"> - If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm. This algorithm is only supported on desktop platforms and consoles. + <member name="rendering/textures/vram_compression/import_s3tc_bptc" type="bool" setter="" getter="" default="true"> + If [code]true[/code], the texture importer will import VRAM-compressed textures using the S3 Texture Compression algorithm (DXT1-5) for lower quality textures and the the BPTC algorithm (BC6H and BC7) for high quality textures. This algorithm is only supported on PC desktop platforms and consoles. [b]Note:[/b] Changing this setting does [i]not[/i] impact textures that were already imported before. To make this setting apply to textures that were already imported, exit the editor, remove the [code].godot/imported/[/code] folder located inside the project folder then restart the editor (see [member application/config/use_hidden_project_data_directory]). </member> <member name="rendering/textures/webp_compression/compression_method" type="int" setter="" getter="" default="2"> diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml index 325ead0cfa..80a9b40605 100644 --- a/doc/classes/Rect2i.xml +++ b/doc/classes/Rect2i.xml @@ -80,9 +80,9 @@ [/gdscript] [csharp] // position (-3, 2), size (1, 1) - var rect = new Rect2i(new Vector2i(-3, 2), new Vector2i(1, 1)); - // position (-3, -1), size (3, 4), so we fit both rect and Vector2i(0, -1) - var rect2 = rect.Expand(new Vector2i(0, -1)); + var rect = new Rect2I(new Vector2I(-3, 2), new Vector2I(1, 1)); + // position (-3, -1), size (3, 4), so we fit both rect and Vector2I(0, -1) + var rect2 = rect.Expand(new Vector2I(0, -1)); [/csharp] [/codeblocks] </description> diff --git a/doc/classes/ReflectionProbe.xml b/doc/classes/ReflectionProbe.xml index fee48dd246..fa0b1ab00b 100644 --- a/doc/classes/ReflectionProbe.xml +++ b/doc/classes/ReflectionProbe.xml @@ -13,13 +13,13 @@ </tutorials> <members> <member name="ambient_color" type="Color" setter="set_ambient_color" getter="get_ambient_color" default="Color(0, 0, 0, 1)"> - The custom ambient color to use within the [ReflectionProbe]'s [member extents]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. + The custom ambient color to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. </member> <member name="ambient_color_energy" type="float" setter="set_ambient_color_energy" getter="get_ambient_color_energy" default="1.0"> - The custom ambient color energy to use within the [ReflectionProbe]'s [member extents]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. + The custom ambient color energy to use within the [ReflectionProbe]'s [member size]. Only effective if [member ambient_mode] is [constant AMBIENT_COLOR]. </member> <member name="ambient_mode" type="int" setter="set_ambient_mode" getter="get_ambient_mode" enum="ReflectionProbe.AmbientMode" default="1"> - The ambient color to use within the [ReflectionProbe]'s [member extents]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member extents]). + The ambient color to use within the [ReflectionProbe]'s [member size]. The ambient color will smoothly blend with other [ReflectionProbe]s and the rest of the scene (outside the [ReflectionProbe]'s [member size]). </member> <member name="box_projection" type="bool" setter="set_enable_box_projection" getter="is_box_projection_enabled" default="false"> If [code]true[/code], enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location. @@ -31,10 +31,6 @@ <member name="enable_shadows" type="bool" setter="set_enable_shadows" getter="are_shadows_enabled" default="false"> If [code]true[/code], computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the [constant UPDATE_ALWAYS] [member update_mode]. </member> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)"> - The size of the reflection probe. The larger the extents, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the extents only as large as you need them. - [b]Note:[/b] To better fit areas that are not aligned to the grid, you can rotate the [ReflectionProbe] node. - </member> <member name="intensity" type="float" setter="set_intensity" getter="get_intensity" default="1.0"> Defines the reflection intensity. Intensity modulates the strength of the reflection. </member> @@ -43,7 +39,7 @@ </member> <member name="max_distance" type="float" setter="set_max_distance" getter="get_max_distance" default="0.0"> The maximum distance away from the [ReflectionProbe] an object can be before it is culled. Decrease this to improve performance, especially when using the [constant UPDATE_ALWAYS] [member update_mode]. - [b]Note:[/b] The maximum reflection distance is always at least equal to the [member extents]. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member extents] are already large. + [b]Note:[/b] The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing [member max_distance] will not always cull objects from reflections, especially if the reflection probe's [member size] is already large. </member> <member name="mesh_lod_threshold" type="float" setter="set_mesh_lod_threshold" getter="get_mesh_lod_threshold" default="1.0"> The automatic LOD bias to use for meshes rendered within the [ReflectionProbe] (this is analog to [member Viewport.mesh_lod_threshold]). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to [code]0.0[/code], automatic LOD is disabled. Increase [member mesh_lod_threshold] to improve performance at the cost of geometry detail, especially when using the [constant UPDATE_ALWAYS] [member update_mode]. @@ -52,6 +48,10 @@ <member name="origin_offset" type="Vector3" setter="set_origin_offset" getter="get_origin_offset" default="Vector3(0, 0, 0)"> Sets the origin offset to be used when this [ReflectionProbe] is in [member box_projection] mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the number of objects that "get in the way" of the reflection. </member> + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(20, 20, 20)"> + The size of the reflection probe. The larger the size, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the size only as large as you need it. + [b]Note:[/b] To better fit areas that are not aligned to the grid, you can rotate the [ReflectionProbe] node. + </member> <member name="update_mode" type="int" setter="set_update_mode" getter="get_update_mode" enum="ReflectionProbe.UpdateMode" default="0"> Sets how frequently the [ReflectionProbe] is updated. Can be [constant UPDATE_ONCE] or [constant UPDATE_ALWAYS]. </member> @@ -64,13 +64,13 @@ Update the probe every frame. This provides better results for fast-moving dynamic objects (such as cars). However, it has a significant performance cost. Due to the cost, it's recommended to only use one ReflectionProbe with [constant UPDATE_ALWAYS] at most per scene. For all other use cases, use [constant UPDATE_ONCE]. </constant> <constant name="AMBIENT_DISABLED" value="0" enum="AmbientMode"> - Do not apply any ambient lighting inside the [ReflectionProbe]'s [member extents]. + Do not apply any ambient lighting inside the [ReflectionProbe]'s [member size]. </constant> <constant name="AMBIENT_ENVIRONMENT" value="1" enum="AmbientMode"> - Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member extents]. + Apply automatically-sourced environment lighting inside the [ReflectionProbe]'s [member size]. </constant> <constant name="AMBIENT_COLOR" value="2" enum="AmbientMode"> - Apply custom ambient lighting inside the [ReflectionProbe]'s [member extents]. See [member ambient_color] and [member ambient_color_energy]. + Apply custom ambient lighting inside the [ReflectionProbe]'s [member size]. See [member ambient_color] and [member ambient_color_energy]. </constant> </constants> </class> diff --git a/doc/classes/RemoteTransform2D.xml b/doc/classes/RemoteTransform2D.xml index 20fa41a3f0..6f100541be 100644 --- a/doc/classes/RemoteTransform2D.xml +++ b/doc/classes/RemoteTransform2D.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RemoteTransform2D" inherits="Node2D" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - RemoteTransform2D pushes its own [Transform2D] to another [CanvasItem] derived Node in the scene. + RemoteTransform2D pushes its own [Transform2D] to another [Node2D] derived node in the scene. </brief_description> <description> - RemoteTransform2D pushes its own [Transform2D] to another [CanvasItem] derived Node (called the remote node) in the scene. - It can be set to update another Node's position, rotation and/or scale. It can use either global or local coordinates. + RemoteTransform2D pushes its own [Transform2D] to another [Node2D] derived node (called the remote node) in the scene. + It can be set to update another node's position, rotation and/or scale. It can use either global or local coordinates. </description> <tutorials> </tutorials> diff --git a/doc/classes/RenderingDevice.xml b/doc/classes/RenderingDevice.xml index f318430611..82a2871949 100644 --- a/doc/classes/RenderingDevice.xml +++ b/doc/classes/RenderingDevice.xml @@ -1,8 +1,14 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="RenderingDevice" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> + Abstraction for working with modern low-level graphics APIs. </brief_description> <description> + [RenderingDevice] is an abstraction for working with modern low-level graphics APIs such as Vulkan. + On startup, Godot creates a global [RenderingDevice] which can be retrieved using [method RenderingServer.get_rendering_device]. This global RenderingDevice performs drawing to the screen. + Internally, [RenderingDevice] is used in Godot to provide support for several modern low-level graphics APIs while reducing the amount of code duplication required. + [b]Local RenderingDevices:[/b] Using [method RenderingServer.create_local_rendering_device], you can create "secondary" rendering devices to perform drawing and GPU compute operations on separate threads. + [b]Note:[/b] [RenderingDevice] is not available when running in headless mode or when using the OpenGL renderer. </description> <tutorials> </tutorials> @@ -1162,20 +1168,28 @@ <constant name="BARRIER_MASK_NO_BARRIER" value="8" enum="BarrierMask" is_bitfield="true"> </constant> <constant name="TEXTURE_TYPE_1D" value="0" enum="TextureType"> + 1-dimensional texture. </constant> <constant name="TEXTURE_TYPE_2D" value="1" enum="TextureType"> + 2-dimensional texture. </constant> <constant name="TEXTURE_TYPE_3D" value="2" enum="TextureType"> + 3-dimensional texture. </constant> <constant name="TEXTURE_TYPE_CUBE" value="3" enum="TextureType"> + [Cubemap] texture. </constant> <constant name="TEXTURE_TYPE_1D_ARRAY" value="4" enum="TextureType"> + Array of 1-dimensional textures. </constant> <constant name="TEXTURE_TYPE_2D_ARRAY" value="5" enum="TextureType"> + Array of 2-dimensional textures. </constant> <constant name="TEXTURE_TYPE_CUBE_ARRAY" value="6" enum="TextureType"> + Array of [Cubemap] textures. </constant> <constant name="TEXTURE_TYPE_MAX" value="7" enum="TextureType"> + Represents the size of the [enum TextureType] enum. </constant> <constant name="TEXTURE_SAMPLES_1" value="0" enum="TextureSamples"> </constant> @@ -1192,6 +1206,7 @@ <constant name="TEXTURE_SAMPLES_64" value="6" enum="TextureSamples"> </constant> <constant name="TEXTURE_SAMPLES_MAX" value="7" enum="TextureSamples"> + Represents the size of the [enum TextureSamples] enum. </constant> <constant name="TEXTURE_USAGE_SAMPLING_BIT" value="1" enum="TextureUsageBits" is_bitfield="true"> </constant> @@ -1236,8 +1251,10 @@ <constant name="TEXTURE_SLICE_3D" value="2" enum="TextureSliceType"> </constant> <constant name="SAMPLER_FILTER_NEAREST" value="0" enum="SamplerFilter"> + Nearest-neighbor sampler filtering. Sampling at higher resolutions than the source will result in a pixelated look. </constant> <constant name="SAMPLER_FILTER_LINEAR" value="1" enum="SamplerFilter"> + Bilinear sampler filtering. Sampling at higher resolutions than the source will result in a blurry look. </constant> <constant name="SAMPLER_REPEAT_MODE_REPEAT" value="0" enum="SamplerRepeatMode"> </constant> @@ -1298,8 +1315,10 @@ <constant name="UNIFORM_TYPE_MAX" value="10" enum="UniformType"> </constant> <constant name="RENDER_PRIMITIVE_POINTS" value="0" enum="RenderPrimitive"> + Point rendering primitive (with constant size, regardless of distance from camera). </constant> <constant name="RENDER_PRIMITIVE_LINES" value="1" enum="RenderPrimitive"> + Line rendering primitive. </constant> <constant name="RENDER_PRIMITIVE_LINES_WITH_ADJACENCY" value="2" enum="RenderPrimitive"> </constant> @@ -1380,6 +1399,7 @@ <constant name="LOGIC_OP_NO_OP" value="5" enum="LogicOperation"> </constant> <constant name="LOGIC_OP_XOR" value="6" enum="LogicOperation"> + Exclusive or (XOR) logic operation. </constant> <constant name="LOGIC_OP_OR" value="7" enum="LogicOperation"> </constant> @@ -1442,16 +1462,22 @@ <constant name="BLEND_FACTOR_MAX" value="19" enum="BlendFactor"> </constant> <constant name="BLEND_OP_ADD" value="0" enum="BlendOperation"> + Additive blending operation ([code]source + destination[/code]). </constant> <constant name="BLEND_OP_SUBTRACT" value="1" enum="BlendOperation"> + Subtractive blending operation ([code]source - destination[/code]). </constant> <constant name="BLEND_OP_REVERSE_SUBTRACT" value="2" enum="BlendOperation"> + Reverse subtractive blending operation ([code]destination - source[/code]). </constant> <constant name="BLEND_OP_MINIMUM" value="3" enum="BlendOperation"> + Minimum blending operation (keep the lowest value of the two). </constant> <constant name="BLEND_OP_MAXIMUM" value="4" enum="BlendOperation"> + Maximum blending operation (keep the highest value of the two). </constant> <constant name="BLEND_OP_MAX" value="5" enum="BlendOperation"> + Represents the size of the [enum BlendOperation] enum. </constant> <constant name="DYNAMIC_STATE_LINE_WIDTH" value="1" enum="PipelineDynamicStateFlags" is_bitfield="true"> </constant> @@ -1544,12 +1570,16 @@ <constant name="LIMIT_MAX_TEXTURE_ARRAY_LAYERS" value="10" enum="Limit"> </constant> <constant name="LIMIT_MAX_TEXTURE_SIZE_1D" value="11" enum="Limit"> + Maximum supported 1-dimensional texture size (in pixels on a single axis). </constant> <constant name="LIMIT_MAX_TEXTURE_SIZE_2D" value="12" enum="Limit"> + Maximum supported 2-dimensional texture size (in pixels on a single axis). </constant> <constant name="LIMIT_MAX_TEXTURE_SIZE_3D" value="13" enum="Limit"> + Maximum supported 3-dimensional texture size (in pixels on a single axis). </constant> <constant name="LIMIT_MAX_TEXTURE_SIZE_CUBE" value="14" enum="Limit"> + Maximum supported cubemap texture size (in pixels on a single axis of a single face). </constant> <constant name="LIMIT_MAX_TEXTURES_PER_SHADER_STAGE" value="15" enum="Limit"> </constant> @@ -1596,14 +1626,19 @@ <constant name="LIMIT_MAX_VIEWPORT_DIMENSIONS_Y" value="36" enum="Limit"> </constant> <constant name="MEMORY_TEXTURES" value="0" enum="MemoryType"> + Memory taken by textures. </constant> <constant name="MEMORY_BUFFERS" value="1" enum="MemoryType"> + Memory taken by buffers. </constant> <constant name="MEMORY_TOTAL" value="2" enum="MemoryType"> + Total memory taken. This is greater than the sum of [constant MEMORY_TEXTURES] and [constant MEMORY_BUFFERS], as it also includes miscellaneous memory usage. </constant> <constant name="INVALID_ID" value="-1"> + Returned by functions that return an ID if a value is invalid. </constant> <constant name="INVALID_FORMAT_ID" value="-1"> + Returned by functions that return a format ID if a value is invalid. </constant> </constants> </class> diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index fc08a16619..f92ea255cc 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -4,10 +4,10 @@ Server for anything visible. </brief_description> <description> - Server for anything visible. The rendering server is the API backend for everything visible. The whole scene system mounts on it to display. + The rendering server is the API backend for everything visible. The whole scene system mounts on it to display. The rendering server is completely opaque, the internals are entirely implementation specific and cannot be accessed. - The rendering server can be used to bypass the scene system entirely. - Resources are created using the [code]*_create[/code] functions. + The rendering server can be used to bypass the scene/[Node] system entirely. + Resources are created using the [code]*_create[/code] functions. These functions return [RID]s which are not references to the objects themselves, but opaque [i]pointers[/i] towards these objects. All objects are drawn to a viewport. You can use the [Viewport] attached to the [SceneTree] or you can create one yourself with [method viewport_create]. When using a custom scenario or canvas, the scenario or canvas needs to be attached to the viewport using [method viewport_set_scenario] or [method viewport_attach_canvas]. In 3D, all visual objects must be associated with a scenario. The scenario is a visual representation of the world. If accessing the rendering server from a running game, the scenario can be accessed from the scene tree from any [Node3D] node with [method Node3D.get_world_3d]. Otherwise, a scenario can be created with [method scenario_create]. Similarly, in 2D, a canvas is needed to draw all canvas items. @@ -25,6 +25,7 @@ <param index="1" name="material_overrides" type="RID[]" /> <param index="2" name="image_size" type="Vector2i" /> <description> + Bakes the material data of the Mesh passed in the [param base] parameter with optional [param material_overrides] to a set of [Image]s of size [param image_size]. Returns an array of [Image]s containing material properties as specified in [enum BakeChannels]. </description> </method> <method name="camera_attributes_create"> @@ -43,6 +44,7 @@ <param index="4" name="speed" type="float" /> <param index="5" name="scale" type="float" /> <description> + Sets the parameters to use with the auto-exposure effect. These parameters take on the same meaning as their counterparts in [CameraAttributes] and [CameraAttributesPractical]. </description> </method> <method name="camera_attributes_set_dof_blur"> @@ -56,12 +58,14 @@ <param index="6" name="near_transition" type="float" /> <param index="7" name="amount" type="float" /> <description> + Sets the parameters to use with the dof blur effect. These parameters take on the same meaning as their counterparts in [CameraAttributesPractical]. </description> </method> <method name="camera_attributes_set_dof_blur_bokeh_shape"> <return type="void" /> <param index="0" name="shape" type="int" enum="RenderingServer.DOFBokehShape" /> <description> + Sets the shape of the dof bokeh pattern. Different shapes may be used to acheive artistic effect, or to meet performance targets. For more detail on available options see [enum DOFBokehShape]. </description> </method> <method name="camera_attributes_set_dof_blur_quality"> @@ -69,6 +73,7 @@ <param index="0" name="quality" type="int" enum="RenderingServer.DOFBlurQuality" /> <param index="1" name="use_jitter" type="bool" /> <description> + Sets the quality level of the dof blur effect to one of the options in [enum DOFBlurQuality]. [param use_jitter] can be used to jitter samples taken during the blur pass to hide artifacts at the cost of looking more fuzzy. </description> </method> <method name="camera_attributes_set_exposure"> @@ -102,6 +107,7 @@ <param index="0" name="camera" type="RID" /> <param index="1" name="effects" type="RID" /> <description> + Sets the camera_attributes created with [method camera_attributes_create] to the given camera. </description> </method> <method name="camera_set_cull_mask"> @@ -192,6 +198,7 @@ <param index="2" name="radius" type="float" /> <param index="3" name="color" type="Color" /> <description> + Draws a circle on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_circle]. </description> </method> <method name="canvas_item_add_clip_ignore"> @@ -199,6 +206,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="ignore" type="bool" /> <description> + If [param ignore] is [code]true[/code], ignore clipping on items drawn with this canvas item until this is called again with [param ignore] set to false. </description> </method> <method name="canvas_item_add_lcd_texture_rect_region"> @@ -209,6 +217,7 @@ <param index="3" name="src_rect" type="Rect2" /> <param index="4" name="modulate" type="Color" /> <description> + See also [method CanvasItem.draw_lcd_texture_rect_region]. </description> </method> <method name="canvas_item_add_line"> @@ -220,6 +229,7 @@ <param index="4" name="width" type="float" default="-1.0" /> <param index="5" name="antialiased" type="bool" default="false" /> <description> + Draws a line on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_line]. </description> </method> <method name="canvas_item_add_mesh"> @@ -230,6 +240,7 @@ <param index="3" name="modulate" type="Color" default="Color(1, 1, 1, 1)" /> <param index="4" name="texture" type="RID" /> <description> + Draws a mesh created with [method mesh_create] with given [param transform], [param modulate] color, and [param texture]. This is used internally by [MeshInstance2D]. </description> </method> <method name="canvas_item_add_msdf_texture_rect_region"> @@ -243,6 +254,7 @@ <param index="6" name="px_range" type="float" default="1.0" /> <param index="7" name="scale" type="float" default="1.0" /> <description> + See also [method CanvasItem.draw_msdf_texture_rect_region]. </description> </method> <method name="canvas_item_add_multimesh"> @@ -251,6 +263,7 @@ <param index="1" name="mesh" type="RID" /> <param index="2" name="texture" type="RID" /> <description> + Draws a 2D [MultiMesh] on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_multimesh]. </description> </method> <method name="canvas_item_add_nine_patch"> @@ -266,6 +279,7 @@ <param index="8" name="draw_center" type="bool" default="true" /> <param index="9" name="modulate" type="Color" default="Color(1, 1, 1, 1)" /> <description> + Draws a nine-patch rectangle on the [CanvasItem] pointed to by the [param item] [RID]. </description> </method> <method name="canvas_item_add_particles"> @@ -274,6 +288,7 @@ <param index="1" name="particles" type="RID" /> <param index="2" name="texture" type="RID" /> <description> + Draws particles on the [CanvasItem] pointed to by the [param item] [RID]. </description> </method> <method name="canvas_item_add_polygon"> @@ -284,6 +299,7 @@ <param index="3" name="uvs" type="PackedVector2Array" default="PackedVector2Array()" /> <param index="4" name="texture" type="RID" /> <description> + Draws a 2D polygon on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polygon]. </description> </method> <method name="canvas_item_add_polyline"> @@ -294,6 +310,7 @@ <param index="3" name="width" type="float" default="-1.0" /> <param index="4" name="antialiased" type="bool" default="false" /> <description> + Draws a 2D polyline on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_polyline]. </description> </method> <method name="canvas_item_add_primitive"> @@ -304,6 +321,7 @@ <param index="3" name="uvs" type="PackedVector2Array" /> <param index="4" name="texture" type="RID" /> <description> + Draws a 2D primitive on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_primitive]. </description> </method> <method name="canvas_item_add_rect"> @@ -312,6 +330,7 @@ <param index="1" name="rect" type="Rect2" /> <param index="2" name="color" type="Color" /> <description> + Draws a rectangle on the [CanvasItem] pointed to by the [param item] [RID]. See also [method CanvasItem.draw_rect]. </description> </method> <method name="canvas_item_add_set_transform"> @@ -319,6 +338,7 @@ <param index="0" name="item" type="RID" /> <param index="1" name="transform" type="Transform2D" /> <description> + Sets a [Transform2D] that will be used to transform subsequent canvas item commands. </description> </method> <method name="canvas_item_add_texture_rect"> @@ -368,6 +388,7 @@ <method name="canvas_item_create"> <return type="RID" /> <description> + Creates a new [CanvasItem] instance and returns its [RID]. </description> </method> <method name="canvas_item_set_canvas_group_mode"> @@ -877,13 +898,6 @@ <description> </description> </method> - <method name="decal_set_extents"> - <return type="void" /> - <param index="0" name="decal" type="RID" /> - <param index="1" name="extents" type="Vector3" /> - <description> - </description> - </method> <method name="decal_set_fade"> <return type="void" /> <param index="0" name="decal" type="RID" /> @@ -906,6 +920,13 @@ <description> </description> </method> + <method name="decal_set_size"> + <return type="void" /> + <param index="0" name="decal" type="RID" /> + <param index="1" name="size" type="Vector3" /> + <description> + </description> + </method> <method name="decal_set_texture"> <return type="void" /> <param index="0" name="decal" type="RID" /> @@ -1218,14 +1239,6 @@ Creates a new fog volume and allocates an RID. </description> </method> - <method name="fog_volume_set_extents"> - <return type="void" /> - <param index="0" name="fog_volume" type="RID" /> - <param index="1" name="extents" type="Vector3" /> - <description> - Sets the size of the fog volume when shape is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX]. - </description> - </method> <method name="fog_volume_set_material"> <return type="void" /> <param index="0" name="fog_volume" type="RID" /> @@ -1242,6 +1255,14 @@ Sets the shape of the fog volume to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD]. </description> </method> + <method name="fog_volume_set_size"> + <return type="void" /> + <param index="0" name="fog_volume" type="RID" /> + <param index="1" name="size" type="Vector3" /> + <description> + Sets the size of the fog volume when shape is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_CONE], [constant RenderingServer.FOG_VOLUME_SHAPE_CYLINDER] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX]. + </description> + </method> <method name="force_draw"> <return type="void" /> <param index="0" name="swap_buffers" type="bool" default="true" /> @@ -1792,6 +1813,7 @@ <method name="lightmap_create"> <return type="RID" /> <description> + Creates a new [LightmapGI] instance. </description> </method> <method name="lightmap_get_probe_capture_bsp_tree" qualifiers="const"> @@ -2655,14 +2677,6 @@ If [code]true[/code], computes shadows in the reflection probe. This makes the reflection much slower to compute. Equivalent to [member ReflectionProbe.enable_shadows]. </description> </method> - <method name="reflection_probe_set_extents"> - <return type="void" /> - <param index="0" name="probe" type="RID" /> - <param index="1" name="extents" type="Vector3" /> - <description> - Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.extents]. - </description> - </method> <method name="reflection_probe_set_intensity"> <return type="void" /> <param index="0" name="probe" type="RID" /> @@ -2701,6 +2715,14 @@ <description> </description> </method> + <method name="reflection_probe_set_size"> + <return type="void" /> + <param index="0" name="probe" type="RID" /> + <param index="1" name="size" type="Vector3" /> + <description> + Sets the size of the area that the reflection probe will capture. Equivalent to [member ReflectionProbe.size]. + </description> + </method> <method name="reflection_probe_set_update_mode"> <return type="void" /> <param index="0" name="probe" type="RID" /> @@ -3245,12 +3267,12 @@ <description> </description> </method> - <method name="viewport_set_disable_environment"> + <method name="viewport_set_environment_mode"> <return type="void" /> <param index="0" name="viewport" type="RID" /> - <param index="1" name="disabled" type="bool" /> + <param index="1" name="mode" type="int" enum="RenderingServer.ViewportEnvironmentMode" /> <description> - If [code]true[/code], rendering of a viewport's environment is disabled. + Sets the viewport's environment mode which allows enabling or disabling rendering of 3D environment over 2D canvas. When disabled, 2D will not be affected by the environment. When enabled, 2D will be affected by the environment if the environment background mode is [constant ENV_BG_CANVAS]. The default behaviour is to inherit the setting from the viewport's parent. If the topmost parent is also set to [constant VIEWPORT_ENVIRONMENT_INHERIT], then the behavior will be the same as if it was set to [constant VIEWPORT_ENVIRONMENT_ENABLED]. </description> </method> <method name="viewport_set_fsr_sharpness"> @@ -4091,10 +4113,10 @@ [FogVolume] will be shaped like an ellipsoid (stretched sphere). </constant> <constant name="FOG_VOLUME_SHAPE_CONE" value="1" enum="FogVolumeShape"> - [FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's angle is set automatically to fill the extents. The cone will be adjusted to fit within the extents. Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via extents is not supported (scale the [FogVolume] node instead). + [FogVolume] will be shaped like a cone pointing upwards (in local coordinates). The cone's angle is set automatically to fill the size. The cone will be adjusted to fit within the size. Rotate the [FogVolume] node to reorient the cone. Non-uniform scaling via size is not supported (scale the [FogVolume] node instead). </constant> <constant name="FOG_VOLUME_SHAPE_CYLINDER" value="2" enum="FogVolumeShape"> - [FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the extents. Non-uniform scaling via extents is not supported (scale the [FogVolume] node instead). + [FogVolume] will be shaped like an upright cylinder (in local coordinates). Rotate the [FogVolume] node to reorient the cylinder. The cylinder will be adjusted to fit within the size. Non-uniform scaling via size is not supported (scale the [FogVolume] node instead). </constant> <constant name="FOG_VOLUME_SHAPE_BOX" value="3" enum="FogVolumeShape"> [FogVolume] will be shaped like a box. @@ -4135,6 +4157,18 @@ <constant name="VIEWPORT_CLEAR_ONLY_NEXT_FRAME" value="2" enum="ViewportClearMode"> The viewport is cleared once, then the clear mode is set to [constant VIEWPORT_CLEAR_NEVER]. </constant> + <constant name="VIEWPORT_ENVIRONMENT_DISABLED" value="0" enum="ViewportEnvironmentMode"> + Disable rendering of 3D environment over 2D canvas. + </constant> + <constant name="VIEWPORT_ENVIRONMENT_ENABLED" value="1" enum="ViewportEnvironmentMode"> + Enable rendering of 3D environment over 2D canvas. + </constant> + <constant name="VIEWPORT_ENVIRONMENT_INHERIT" value="2" enum="ViewportEnvironmentMode"> + Inherit enable/disable value from parent. If topmost parent is also set to inherit, then this has the same behavior as [constant VIEWPORT_ENVIRONMENT_ENABLED]. + </constant> + <constant name="VIEWPORT_ENVIRONMENT_MAX" value="3" enum="ViewportEnvironmentMode"> + Max value of [enum ViewportEnvironmentMode] enum. + </constant> <constant name="VIEWPORT_SDF_OVERSIZE_100_PERCENT" value="0" enum="ViewportSDFOversize"> </constant> <constant name="VIEWPORT_SDF_OVERSIZE_120_PERCENT" value="1" enum="ViewportSDFOversize"> @@ -4553,12 +4587,16 @@ Fade-in the given instance's dependencies when reaching its visibility range limits. </constant> <constant name="BAKE_CHANNEL_ALBEDO_ALPHA" value="0" enum="BakeChannels"> + Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBA8] and contains albedo color in the [code].rgb[/code] channels and alpha in the [code].a[/code] channel. </constant> <constant name="BAKE_CHANNEL_NORMAL" value="1" enum="BakeChannels"> + Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBA8] and contains the per-pixel normal of the object in the [code].rgb[/code] channels and nothing in the [code].a[/code] channel. The per-pixel normal is encoded as [code]normal * 0.5 + 0.5[/code]. </constant> <constant name="BAKE_CHANNEL_ORM" value="2" enum="BakeChannels"> + Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBA8] and contains ambient occlusion (from material and decals only) in the [code].r[/code] channel, roughness in the [code].g[/code] channel, metallic in the [code].b[/code] channel and sub surface scattering amount in the [code].a[/code] channel. </constant> <constant name="BAKE_CHANNEL_EMISSION" value="3" enum="BakeChannels"> + Index of [Image] in array of [Image]s returned by [method bake_render_uv2]. Image uses [constant Image.FORMAT_RGBAH] and contains emission color in the [code].rgb[/code] channels and nothing in the [code].a[/code] channel. </constant> <constant name="CANVAS_TEXTURE_CHANNEL_DIFFUSE" value="0" enum="CanvasTextureChannel"> </constant> diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index e533fc1e32..67f466ad4c 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -24,7 +24,8 @@ <param index="0" name="subresources" type="bool" default="false" /> <description> Duplicates this resource, returning a new resource with its [code]export[/code]ed or [constant PROPERTY_USAGE_STORAGE] properties copied from the original. - If [param subresources] is [code]false[/code], a shallow copy is returned. Nested resources within subresources are not duplicated and are shared from the original resource. This behavior can be overridden by the [constant PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE] flag. + If [param subresources] is [code]false[/code], a shallow copy is returned; nested resources within subresources are not duplicated and are shared from the original resource. If [param subresources] is [code]true[/code], a deep copy is returned; nested subresources will be duplicated and are not shared. + Subresource properties with the [constant PROPERTY_USAGE_ALWAYS_DUPLICATE] flag are always duplicated even with [param subresources] set to [code]false[/code], and properties with the [constant PROPERTY_USAGE_NEVER_DUPLICATE] flag are never duplicated even with [param subresources] set to [code]true[/code]. [b]Note:[/b] For custom resources, this method will fail if [method Object._init] has been defined with required parameters. </description> </method> diff --git a/doc/classes/ResourceFormatLoader.xml b/doc/classes/ResourceFormatLoader.xml index bb55123b37..1d509d2938 100644 --- a/doc/classes/ResourceFormatLoader.xml +++ b/doc/classes/ResourceFormatLoader.xml @@ -88,7 +88,7 @@ </description> </method> <method name="_rename_dependencies" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="path" type="String" /> <param index="1" name="renames" type="Dictionary" /> <description> diff --git a/doc/classes/ResourceFormatSaver.xml b/doc/classes/ResourceFormatSaver.xml index b0c57bc7cb..7e8e2ec67d 100644 --- a/doc/classes/ResourceFormatSaver.xml +++ b/doc/classes/ResourceFormatSaver.xml @@ -34,7 +34,7 @@ </description> </method> <method name="_save" qualifiers="virtual"> - <return type="int" /> + <return type="int" enum="Error" /> <param index="0" name="resource" type="Resource" /> <param index="1" name="path" type="String" /> <param index="2" name="flags" type="int" /> diff --git a/doc/classes/RichTextEffect.xml b/doc/classes/RichTextEffect.xml index c01546524d..333d34d1b7 100644 --- a/doc/classes/RichTextEffect.xml +++ b/doc/classes/RichTextEffect.xml @@ -13,7 +13,7 @@ [/gdscript] [csharp] // The RichTextEffect will be usable like this: `[example]Some text[/example]` - public string bbcode = "example"; + string bbcode = "example"; [/csharp] [/codeblocks] [b]Note:[/b] As soon as a [RichTextLabel] contains at least one [RichTextEffect], it will continuously process the effect unless the project is paused. This may impact battery life negatively. diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index 5550bf0955..1ecc8a1d4e 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -8,7 +8,7 @@ [b]Note:[/b] Assignments to [member text] clear the tag stack and reconstruct it from the property's contents. Any edits made to [member text] will erase previous edits made from other manual sources such as [method append_text] and the [code]push_*[/code] / [method pop] methods. [b]Note:[/b] RichTextLabel doesn't support entangled BBCode tags. For example, instead of using [code][b]bold[i]bold italic[/b]italic[/i][/code], use [code][b]bold[i]bold italic[/i][/b][i]italic[/i][/code]. [b]Note:[/b] [code]push_*/pop[/code] functions won't affect BBCode. - [b]Note:[/b] Unlike [Label], RichTextLabel doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code][center][/code] tag as follows: [code][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content_height] property. + [b]Note:[/b] Unlike [Label], RichTextLabel doesn't have a [i]property[/i] to horizontally align text to the center. Instead, enable [member bbcode_enabled] and surround the text in a [code][center][/code] tag as follows: [code][center]Example[/center][/code]. There is currently no built-in way to vertically align text either, but this can be emulated by relying on anchors/containers and the [member fit_content] property. </description> <tutorials> <link title="BBCode in RichTextLabel">$DOCS_URL/tutorials/ui/bbcode_in_richtextlabel.html</link> @@ -251,6 +251,14 @@ Adds a [code][color][/code] tag to the tag stack. </description> </method> + <method name="push_customfx"> + <return type="void" /> + <param index="0" name="effect" type="RichTextEffect" /> + <param index="1" name="env" type="Dictionary" /> + <description> + Adds a custom effect tag to the tag stack. The effect does not need to be in [member custom_effects]. The environment is directly passed to the effect. + </description> + </method> <method name="push_dropcap"> <return type="void" /> <param index="0" name="string" type="String" /> @@ -474,9 +482,8 @@ <member name="deselect_on_focus_loss_enabled" type="bool" setter="set_deselect_on_focus_loss_enabled" getter="is_deselect_on_focus_loss_enabled" default="true"> If [code]true[/code], the selected text will be deselected when focus is lost. </member> - <member name="fit_content_height" type="bool" setter="set_fit_content_height" getter="is_fit_content_height_enabled" default="false"> - If [code]true[/code], the label's height will be automatically updated to fit its content. - [b]Note:[/b] This property is used as a workaround to fix issues with [RichTextLabel] in [Container]s, but it's unreliable in some cases and will be removed in future versions. + <member name="fit_content" type="bool" setter="set_fit_content" getter="is_fit_content_enabled" default="false"> + If [code]true[/code], the label's minimum size will be automatically updated to fit its content, matching the behavior of [Label]. </member> <member name="hint_underlined" type="bool" setter="set_hint_underline" getter="is_hint_underlined" default="true"> If [code]true[/code], the label underlines hint tags such as [code][hint=description]{text}[/hint][/code]. diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index bf19ebc23a..6adb37a3f7 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -74,10 +74,10 @@ print("end") [/gdscript] [csharp] - public async void SomeFunction() + public async Task SomeFunction() { GD.Print("start"); - await ToSignal(GetTree().CreateTimer(1.0f), "timeout"); + await ToSignal(GetTree().CreateTimer(1.0f), SceneTreeTimer.SignalName.Timeout); GD.Print("end"); } [/csharp] diff --git a/doc/classes/SceneTreeTimer.xml b/doc/classes/SceneTreeTimer.xml index f28e65c5bf..42b070d7d9 100644 --- a/doc/classes/SceneTreeTimer.xml +++ b/doc/classes/SceneTreeTimer.xml @@ -14,10 +14,10 @@ print("Timer ended.") [/gdscript] [csharp] - public async void SomeFunction() + public async Task SomeFunction() { GD.Print("Timer started."); - await ToSignal(GetTree().CreateTimer(1.0f), "timeout"); + await ToSignal(GetTree().CreateTimer(1.0f), SceneTreeTimer.SignalName.Timeout); GD.Print("Timer ended."); } [/csharp] diff --git a/doc/classes/Semaphore.xml b/doc/classes/Semaphore.xml index 6b2007363e..d1d126c5cb 100644 --- a/doc/classes/Semaphore.xml +++ b/doc/classes/Semaphore.xml @@ -17,9 +17,9 @@ </description> </method> <method name="try_wait"> - <return type="int" enum="Error" /> + <return type="bool" /> <description> - Like [method wait], but won't block, so if the value is zero, fails immediately and returns [constant ERR_BUSY]. If non-zero, it returns [constant OK] to report success. + Like [method wait], but won't block, so if the value is zero, fails immediately and returns [code]false[/code]. If non-zero, it returns [code]true[/code] to report success. </description> </method> <method name="wait"> diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml index 3412cd2140..71905e8b2e 100644 --- a/doc/classes/Signal.xml +++ b/doc/classes/Signal.xml @@ -16,12 +16,12 @@ [/gdscript] [csharp] [Signal] - delegate void Attacked(); + delegate void AttackedEventHandler(); // Additional arguments may be declared. // These arguments must be passed when the signal is emitted. [Signal] - delegate void ItemDropped(itemName: string, amount: int); + delegate void ItemDroppedEventHandler(string itemName, int amount); [/csharp] [/codeblocks] </description> diff --git a/doc/classes/Sprite2D.xml b/doc/classes/Sprite2D.xml index 235fef0bdd..033dbf51f3 100644 --- a/doc/classes/Sprite2D.xml +++ b/doc/classes/Sprite2D.xml @@ -23,11 +23,11 @@ print("A click!") [/gdscript] [csharp] - public override void _Input(InputEvent inputEvent) + public override void _Input(InputEvent @event) { - if (inputEvent is InputEventMouseButton inputEventMouse) + if (@event is InputEventMouseButton inputEventMouse) { - if (inputEventMouse.Pressed && inputEventMouse.ButtonIndex == (int)ButtonList.Left) + if (inputEventMouse.Pressed && inputEventMouse.ButtonIndex == MouseButton.Left) { if (GetRect().HasPoint(ToLocal(inputEventMouse.Position))) { diff --git a/doc/classes/SpriteBase3D.xml b/doc/classes/SpriteBase3D.xml index 5fa984e7a0..e1f3a52a1d 100644 --- a/doc/classes/SpriteBase3D.xml +++ b/doc/classes/SpriteBase3D.xml @@ -38,9 +38,21 @@ </method> </methods> <members> + <member name="alpha_antialiasing_edge" type="float" setter="set_alpha_antialiasing_edge" getter="get_alpha_antialiasing_edge" default="0.0"> + Threshold at which antialiasing will be applied on the alpha channel. + </member> + <member name="alpha_antialiasing_mode" type="int" setter="set_alpha_antialiasing" getter="get_alpha_antialiasing" enum="BaseMaterial3D.AlphaAntiAliasing" default="0"> + The type of alpha antialiasing to apply. See [enum BaseMaterial3D.AlphaAntiAliasing]. + </member> <member name="alpha_cut" type="int" setter="set_alpha_cut_mode" getter="get_alpha_cut_mode" enum="SpriteBase3D.AlphaCutMode" default="0"> The alpha cutting mode to use for the sprite. See [enum AlphaCutMode] for possible values. </member> + <member name="alpha_hash_scale" type="float" setter="set_alpha_hash_scale" getter="get_alpha_hash_scale" default="1.0"> + The hashing scale for Alpha Hash. Recommended values between [code]0[/code] and [code]2[/code]. + </member> + <member name="alpha_scissor_threshold" type="float" setter="set_alpha_scissor_threshold" getter="get_alpha_scissor_threshold" default="0.5"> + Threshold at which the alpha scissor will discard values. + </member> <member name="axis" type="int" setter="set_axis" getter="get_axis" enum="Vector3.Axis" default="2"> The direction in which the front of the texture faces. </member> @@ -118,5 +130,8 @@ <constant name="ALPHA_CUT_OPAQUE_PREPASS" value="2" enum="AlphaCutMode"> This mode draws fully opaque pixels in the depth prepass. This is slower than [constant ALPHA_CUT_DISABLED] or [constant ALPHA_CUT_DISCARD], but it allows displaying translucent areas and smooth edges while using proper sorting. </constant> + <constant name="ALPHA_CUT_HASH" value="3" enum="AlphaCutMode"> + This mode draws cuts off all values below a spatially-deterministic threshold, the rest will remain opaque. + </constant> </constants> </class> diff --git a/doc/classes/StreamPeer.xml b/doc/classes/StreamPeer.xml index f05b5f7dbf..969cbac57d 100644 --- a/doc/classes/StreamPeer.xml +++ b/doc/classes/StreamPeer.xml @@ -223,7 +223,7 @@ put_data("Hello world".to_utf8()) [/gdscript] [csharp] - PutData("Hello World".ToUTF8()); + PutData("Hello World".ToUtf8()); [/csharp] [/codeblocks] </description> diff --git a/doc/classes/StreamPeerTLS.xml b/doc/classes/StreamPeerTLS.xml index d1ddb3d441..9e16dc8914 100644 --- a/doc/classes/StreamPeerTLS.xml +++ b/doc/classes/StreamPeerTLS.xml @@ -14,22 +14,18 @@ <method name="accept_stream"> <return type="int" enum="Error" /> <param index="0" name="stream" type="StreamPeer" /> - <param index="1" name="private_key" type="CryptoKey" /> - <param index="2" name="certificate" type="X509Certificate" /> - <param index="3" name="chain" type="X509Certificate" default="null" /> + <param index="1" name="server_options" type="TLSOptions" /> <description> - Accepts a peer connection as a server using the given [param private_key] and providing the given [param certificate] to the client. You can pass the optional [param chain] parameter to provide additional CA chain information along with the certificate. + Accepts a peer connection as a server using the given [param server_options]. See [method TLSOptions.server]. </description> </method> <method name="connect_to_stream"> <return type="int" enum="Error" /> <param index="0" name="stream" type="StreamPeer" /> - <param index="1" name="validate_certs" type="bool" default="false" /> - <param index="2" name="for_hostname" type="String" default="""" /> - <param index="3" name="valid_certificate" type="X509Certificate" default="null" /> + <param index="1" name="common_name" type="String" /> + <param index="2" name="client_options" type="TLSOptions" default="null" /> <description> - Connects to a peer using an underlying [StreamPeer] [param stream]. If [param validate_certs] is [code]true[/code], [StreamPeerTLS] will validate that the certificate presented by the peer matches the [param for_hostname]. - [b]Note:[/b] Specifying a custom [param valid_certificate] is not supported in Web exports due to browsers restrictions. + Connects to a peer using an underlying [StreamPeer] [param stream] and verifying the remote certificate is correctly signed for the given [param common_name]. You can pass the optional [param client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe]. </description> </method> <method name="disconnect_from_stream"> @@ -57,10 +53,6 @@ </description> </method> </methods> - <members> - <member name="blocking_handshake" type="bool" setter="set_blocking_handshake_enabled" getter="is_blocking_handshake_enabled" default="true"> - </member> - </members> <constants> <constant name="STATUS_DISCONNECTED" value="0" enum="Status"> A status representing a [StreamPeerTLS] that is disconnected. diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 97466e7860..143e1f23e9 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -1002,10 +1002,16 @@ [/codeblocks] </description> </method> + <method name="validate_filename" qualifiers="const"> + <return type="String" /> + <description> + Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores. + </description> + </method> <method name="validate_node_name" qualifiers="const"> <return type="String" /> <description> - Removes all characters that are not allowed in [member Node.name] from the string ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). + Returns a copy of the string with all characters that are not allowed in [member Node.name] removed ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). </description> </method> <method name="xml_escape" qualifiers="const"> diff --git a/doc/classes/StringName.xml b/doc/classes/StringName.xml index b46e39b8d7..c103fb2287 100644 --- a/doc/classes/StringName.xml +++ b/doc/classes/StringName.xml @@ -909,10 +909,16 @@ [/codeblocks] </description> </method> + <method name="validate_filename" qualifiers="const"> + <return type="String" /> + <description> + Returns a copy of the string with all characters that are not allowed in [method is_valid_filename] replaced with underscores. + </description> + </method> <method name="validate_node_name" qualifiers="const"> <return type="String" /> <description> - Removes all characters that are not allowed in [member Node.name] from the string ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). + Returns a copy of the string with all characters that are not allowed in [member Node.name] removed ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). </description> </method> <method name="xml_escape" qualifiers="const"> diff --git a/doc/classes/StyleBoxTexture.xml b/doc/classes/StyleBoxTexture.xml index 745187ed63..f2f6e59a9e 100644 --- a/doc/classes/StyleBoxTexture.xml +++ b/doc/classes/StyleBoxTexture.xml @@ -82,6 +82,7 @@ <member name="region_rect" type="Rect2" setter="set_region_rect" getter="get_region_rect" default="Rect2(0, 0, 0, 0)"> Species a sub-region of the texture to use. This is equivalent to first wrapping the texture in an [AtlasTexture] with the same region. + If empty ([code]Rect2(0, 0, 0, 0)[/code]), the whole texture will be used. </member> <member name="texture" type="Texture2D" setter="set_texture" getter="get_texture"> The texture to use when drawing this style box. diff --git a/doc/classes/SubViewport.xml b/doc/classes/SubViewport.xml index 7020cae1de..bb76a82ef3 100644 --- a/doc/classes/SubViewport.xml +++ b/doc/classes/SubViewport.xml @@ -26,6 +26,7 @@ </member> <member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i(512, 512)"> The width and height of the sub-viewport. Must be set to a value greater than or equal to 2 pixels on both dimensions. Otherwise, nothing will be displayed. + [b]Note:[/b] If the parent node is a [SubViewportContainer] and its [member SubViewportContainer.stretch] is [code]true[/code], the viewport size cannot be changed manually. </member> <member name="size_2d_override" type="Vector2i" setter="set_size_2d_override" getter="get_size_2d_override" default="Vector2i(0, 0)"> The 2D size override of the sub-viewport. If either the width or height is [code]0[/code], the override is disabled. diff --git a/doc/classes/SubViewportContainer.xml b/doc/classes/SubViewportContainer.xml index 77aa7e3ff4..11137222a9 100644 --- a/doc/classes/SubViewportContainer.xml +++ b/doc/classes/SubViewportContainer.xml @@ -13,6 +13,7 @@ <members> <member name="stretch" type="bool" setter="set_stretch" getter="is_stretch_enabled" default="false"> If [code]true[/code], the sub-viewport will be automatically resized to the control's size. + [b]Note:[/b] If [code]true[/code], this will prohibit changing [member SubViewport.size] of its children manually. </member> <member name="stretch_shrink" type="int" setter="set_stretch_shrink" getter="get_stretch_shrink" default="1"> Divides the sub-viewport's effective resolution by this value while preserving its scale. This can be used to speed up rendering. diff --git a/doc/classes/SurfaceTool.xml b/doc/classes/SurfaceTool.xml index 9d73e9fb39..5b567dbc28 100644 --- a/doc/classes/SurfaceTool.xml +++ b/doc/classes/SurfaceTool.xml @@ -133,7 +133,7 @@ <description> Generates normals from vertices so you do not have to do it manually. If [param flip] is [code]true[/code], the resulting normals will be inverted. [method generate_normals] should be called [i]after[/i] generating geometry and [i]before[/i] committing the mesh using [method commit] or [method commit_to_arrays]. For correct display of normal-mapped surfaces, you will also have to generate tangents using [method generate_tangents]. [b]Note:[/b] [method generate_normals] only works if the primitive type to be set to [constant Mesh.PRIMITIVE_TRIANGLES]. - [b]Note:[/b] [method generate_normals] takes smooth groups into account. If you don't specify any smooth group for each vertex, [method generate_normals] will smooth normals for you. + [b]Note:[/b] [method generate_normals] takes smooth groups into account. To generate smooth normals, set the smooth group to a value greater than or equal to [code]0[/code] using [method set_smooth_group] or leave the smooth group at the default of [code]0[/code]. To generate flat normals, set the smooth group to [code]-1[/code] using [method set_smooth_group] prior to adding vertices. </description> </method> <method name="generate_tangents"> @@ -241,7 +241,7 @@ <return type="void" /> <param index="0" name="index" type="int" /> <description> - Specifies whether the current vertex (if using only vertex arrays) or current index (if also using index arrays) should use smooth normals for normal calculation. + Specifies the smooth group to use for the [i]next[/i] vertex. If this is never called, all vertices will have the default smooth group of [code]0[/code] and will be smoothed with adjacent vertices of the same group. To produce a mesh with flat normals, set the smooth group to [code]-1[/code]. </description> </method> <method name="set_tangent"> diff --git a/doc/classes/SystemFont.xml b/doc/classes/SystemFont.xml index 20bfd0d8ae..5e7b79ae97 100644 --- a/doc/classes/SystemFont.xml +++ b/doc/classes/SystemFont.xml @@ -43,6 +43,12 @@ <member name="hinting" type="int" setter="set_hinting" getter="get_hinting" enum="TextServer.Hinting" default="1"> Font hinting mode. </member> + <member name="msdf_pixel_range" type="int" setter="set_msdf_pixel_range" getter="get_msdf_pixel_range" default="16"> + The width of the range around the shape between the minimum and maximum representable signed distance. If using font outlines, [member msdf_pixel_range] must be set to at least [i]twice[/i] the size of the largest font outline. The default [member msdf_pixel_range] value of [code]16[/code] allows outline sizes up to [code]8[/code] to look correct. + </member> + <member name="msdf_size" type="int" setter="set_msdf_size" getter="get_msdf_size" default="48"> + Source font size used to generate MSDF textures. Higher values allow for more precision, but are slower to render and require more memory. Only increase this value if you notice a visible lack of precision in glyph rendering. + </member> <member name="multichannel_signed_distance_field" type="bool" setter="set_multichannel_signed_distance_field" getter="is_multichannel_signed_distance_field" default="false"> If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. </member> diff --git a/doc/classes/TLSOptions.xml b/doc/classes/TLSOptions.xml new file mode 100644 index 0000000000..0917bd9bce --- /dev/null +++ b/doc/classes/TLSOptions.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="TLSOptions" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + TLS configuration for clients and servers. + </brief_description> + <description> + TLSOptions abstracts the configuration options for the [StreamPeerTLS] and [PacketPeerDTLS] classes. + Objects of this class cannot be instantiated directly, and one of the static methods [method client], [method client_unsafe], or [method server] should be used instead. + [codeblocks] + [gdscript] + # Create a TLS client configuration which uses our custom trusted CA chain. + var client_trusted_cas = load("res://my_trusted_cas.crt") + var client_tls_options = TLSOptions.client(client_trusted_cas) + + # Create a TLS server configuration. + var server_certs = load("res://my_server_cas.crt") + var server_key = load("res://my_server_key.key") + var server_tls_options = TLSOptions.server(server_certs, server_key) + [/gdscript] + [/codeblocks] + </description> + <tutorials> + </tutorials> + <methods> + <method name="client" qualifiers="static"> + <return type="TLSOptions" /> + <param index="0" name="trusted_chain" type="X509Certificate" default="null" /> + <param index="1" name="common_name_override" type="String" default="""" /> + <description> + Creates a TLS client configuration which validates certificates and their common names (fully qualified domain names). + You can specify a custom [param trusted_chain] of certification authorities (the default CA list will be used if [code]null[/code]), and optionally provide a [param common_name_override] if you expect the certificate to have a common name other then the server FQDN. + Note: On the Web plafrom, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature. + </description> + </method> + <method name="client_unsafe" qualifiers="static"> + <return type="TLSOptions" /> + <param index="0" name="trusted_chain" type="X509Certificate" default="null" /> + <description> + Creates an [b]unsafe[/b] TLS client configuration where certificate validation is optional. You can optionally provide a valid [param trusted_chain], but the common name of the certififcates will never be checked. Using this configuration for purposes other than testing [b]is not recommended[/b]. + Note: On the Web plafrom, TLS verification is always enforced against the CA list of the web browser. This is considered a security feature. + </description> + </method> + <method name="server" qualifiers="static"> + <return type="TLSOptions" /> + <param index="0" name="key" type="CryptoKey" /> + <param index="1" name="certificate" type="X509Certificate" /> + <description> + Creates a TLS server configuration using the provided [param key] and [param certificate]. + Note: The [param certificate] should include the full certificate chain up to the signing CA (certificates file can be concatenated using a general purpose text editor). + </description> + </method> + </methods> +</class> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index ccd79cd170..c309026aaa 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -390,6 +390,45 @@ <return type="PopupMenu" /> <description> Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit]. + You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example: + [codeblocks] + [gdscript] + func _ready(): + var menu = get_menu() + # Remove all items after "Redo". + menu.item_count = menu.get_item_index(MENU_REDO) + 1 + # Add custom items. + menu.add_separator() + menu.add_item("Insert Date", MENU_MAX + 1) + # Connect callback. + menu.id_pressed.connect(_on_item_pressed) + + func _on_item_pressed(id): + if id == MENU_MAX + 1: + insert_text_at_caret(Time.get_date_string_from_system()) + [/gdscript] + [csharp] + public override void _Ready() + { + var menu = GetMenu(); + // Remove all items after "Redo". + menu.ItemCount = menu.GetItemIndex(TextEdit.MenuItems.Redo) + 1; + // Add custom items. + menu.AddSeparator(); + menu.AddItem("Insert Date", TextEdit.MenuItems.Max + 1); + // Add event handler. + menu.IdPressed += OnItemPressed; + } + + public void OnItemPressed(int id) + { + if (id == TextEdit.MenuItems.Max + 1) + { + InsertTextAtCaret(Time.GetDateStringFromSystem()); + } + } + [/csharp] + [/codeblocks] [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property. </description> </method> @@ -682,7 +721,7 @@ <return type="void" /> <param index="0" name="option" type="int" /> <description> - Triggers a right-click menu action by the specified index. See [enum MenuItems] for a list of available indexes. + Executes a given action as defined in the [enum MenuItems] enum. </description> </method> <method name="merge_gutters"> @@ -764,18 +803,18 @@ [codeblocks] [gdscript] var result = search("print", SEARCH_WHOLE_WORDS, 0, 0) - if result.x != -1: + if result.x != -1: # Result found. var line_number = result.y var column_number = result.x [/gdscript] [csharp] - Vector2i result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0); - if (result.Length > 0) + Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0); + if (result.X != -1) { // Result found. - int lineNumber = result.y; - int columnNumber = result.x; + int lineNumber = result.Y; + int columnNumber = result.X; } [/csharp] [/codeblocks] @@ -1224,70 +1263,76 @@ <constant name="MENU_REDO" value="6" enum="MenuItems"> Redoes the previous action. </constant> - <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems"> + <constant name="MENU_SUBMENU_TEXT_DIR" value="7" enum="MenuItems"> + ID of "Text Writing Direction" submenu. + </constant> + <constant name="MENU_DIR_INHERITED" value="8" enum="MenuItems"> Sets text direction to inherited. </constant> - <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems"> + <constant name="MENU_DIR_AUTO" value="9" enum="MenuItems"> Sets text direction to automatic. </constant> - <constant name="MENU_DIR_LTR" value="9" enum="MenuItems"> + <constant name="MENU_DIR_LTR" value="10" enum="MenuItems"> Sets text direction to left-to-right. </constant> - <constant name="MENU_DIR_RTL" value="10" enum="MenuItems"> + <constant name="MENU_DIR_RTL" value="11" enum="MenuItems"> Sets text direction to right-to-left. </constant> - <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems"> + <constant name="MENU_DISPLAY_UCC" value="12" enum="MenuItems"> Toggles control character display. </constant> - <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems"> + <constant name="MENU_SUBMENU_INSERT_UCC" value="13" enum="MenuItems"> + ID of "Insert Control Character" submenu. + </constant> + <constant name="MENU_INSERT_LRM" value="14" enum="MenuItems"> Inserts left-to-right mark (LRM) character. </constant> - <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems"> + <constant name="MENU_INSERT_RLM" value="15" enum="MenuItems"> Inserts right-to-left mark (RLM) character. </constant> - <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems"> + <constant name="MENU_INSERT_LRE" value="16" enum="MenuItems"> Inserts start of left-to-right embedding (LRE) character. </constant> - <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems"> + <constant name="MENU_INSERT_RLE" value="17" enum="MenuItems"> Inserts start of right-to-left embedding (RLE) character. </constant> - <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems"> + <constant name="MENU_INSERT_LRO" value="18" enum="MenuItems"> Inserts start of left-to-right override (LRO) character. </constant> - <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems"> + <constant name="MENU_INSERT_RLO" value="19" enum="MenuItems"> Inserts start of right-to-left override (RLO) character. </constant> - <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems"> + <constant name="MENU_INSERT_PDF" value="20" enum="MenuItems"> Inserts pop direction formatting (PDF) character. </constant> - <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems"> + <constant name="MENU_INSERT_ALM" value="21" enum="MenuItems"> Inserts Arabic letter mark (ALM) character. </constant> - <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems"> + <constant name="MENU_INSERT_LRI" value="22" enum="MenuItems"> Inserts left-to-right isolate (LRI) character. </constant> - <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems"> + <constant name="MENU_INSERT_RLI" value="23" enum="MenuItems"> Inserts right-to-left isolate (RLI) character. </constant> - <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems"> + <constant name="MENU_INSERT_FSI" value="24" enum="MenuItems"> Inserts first strong isolate (FSI) character. </constant> - <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems"> + <constant name="MENU_INSERT_PDI" value="25" enum="MenuItems"> Inserts pop direction isolate (PDI) character. </constant> - <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems"> + <constant name="MENU_INSERT_ZWJ" value="26" enum="MenuItems"> Inserts zero width joiner (ZWJ) character. </constant> - <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems"> + <constant name="MENU_INSERT_ZWNJ" value="27" enum="MenuItems"> Inserts zero width non-joiner (ZWNJ) character. </constant> - <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems"> + <constant name="MENU_INSERT_WJ" value="28" enum="MenuItems"> Inserts word joiner (WJ) character. </constant> - <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems"> + <constant name="MENU_INSERT_SHY" value="29" enum="MenuItems"> Inserts soft hyphen (SHY) character. </constant> - <constant name="MENU_MAX" value="28" enum="MenuItems"> + <constant name="MENU_MAX" value="30" enum="MenuItems"> Represents the size of the [enum MenuItems] enum. </constant> <constant name="ACTION_NONE" value="0" enum="EditAction"> diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml index f815b8d0c3..bedc52abd1 100644 --- a/doc/classes/TileData.xml +++ b/doc/classes/TileData.xml @@ -218,7 +218,7 @@ <member name="terrain_set" type="int" setter="set_terrain_set" getter="get_terrain_set" default="-1"> ID of the terrain set that the tile uses. </member> - <member name="texture_offset" type="Vector2i" setter="set_texture_offset" getter="get_texture_offset" default="Vector2i(0, 0)"> + <member name="texture_origin" type="Vector2i" setter="set_texture_origin" getter="get_texture_origin" default="Vector2i(0, 0)"> Offsets the position of where the tile is drawn. </member> <member name="transpose" type="bool" setter="set_transpose" getter="get_transpose" default="false"> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 2fd42666b4..c387bd435b 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -251,7 +251,7 @@ <param index="0" name="map_position" type="Vector2i" /> <description> Returns the centered position of a cell in the TileMap's local coordinate space. To convert the returned value into global coordinates, use [method Node2D.to_global]. See also [method local_to_map]. - [b]Note:[/b] This may not correspond to the visual position of the tile, i.e. it ignores the [member TileData.texture_offset] property of individual tiles. + [b]Note:[/b] This may not correspond to the visual position of the tile, i.e. it ignores the [member TileData.texture_origin] property of individual tiles. </description> </method> <method name="move_layer"> diff --git a/doc/classes/TileSet.xml b/doc/classes/TileSet.xml index a812b52307..a39a43be4c 100644 --- a/doc/classes/TileSet.xml +++ b/doc/classes/TileSet.xml @@ -143,6 +143,14 @@ Returns the custom data layers count. </description> </method> + <method name="get_navigation_layer_layer_value" qualifiers="const"> + <return type="bool" /> + <param index="0" name="layer_index" type="int" /> + <param index="1" name="layer_number" type="int" /> + <description> + Returns whether or not the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index] is enabled, given a navigation_layers [param layer_number] between 1 and 32. + </description> + </method> <method name="get_navigation_layer_layers" qualifiers="const"> <return type="int" /> <param index="0" name="layer_index" type="int" /> @@ -500,6 +508,15 @@ Sets the type of the custom data layer identified by the given index. </description> </method> + <method name="set_navigation_layer_layer_value"> + <return type="void" /> + <param index="0" name="layer_index" type="int" /> + <param index="1" name="layer_number" type="int" /> + <param index="2" name="value" type="bool" /> + <description> + Based on [param value], enables or disables the specified navigation layer of the TileSet navigation data layer identified by the given [param layer_index], given a navigation_layers [param layer_number] between 1 and 32. + </description> + </method> <method name="set_navigation_layer_layers"> <return type="void" /> <param index="0" name="layer_index" type="int" /> diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index ff5a665bfd..02a2789ea5 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -401,7 +401,7 @@ </signal> <signal name="item_activated"> <description> - Emitted when an item's label is double-clicked. + Emitted when an item is double-clicked, or selected with a [code]ui_accept[/code] input event (e.g. using [kbd]Enter[/kbd] or [kbd]Space[/kbd] on the keyboard). </description> </signal> <signal name="item_collapsed"> @@ -410,19 +410,14 @@ Emitted when an item is collapsed by a click on the folding arrow. </description> </signal> - <signal name="item_custom_button_pressed"> - <description> - Emitted when a custom button is pressed (i.e. in a [constant TreeItem.CELL_MODE_CUSTOM] mode cell). - </description> - </signal> - <signal name="item_double_clicked"> + <signal name="item_edited"> <description> - Emitted when an item's icon is double-clicked. + Emitted when an item is edited. </description> </signal> - <signal name="item_edited"> + <signal name="item_icon_double_clicked"> <description> - Emitted when an item is edited. + Emitted when an item's icon is double-clicked. For a signal that emits when any part of the item is double-clicked, see [signal item_activated]. </description> </signal> <signal name="item_mouse_selected"> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index fc0dd9f05d..16e4ce3714 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -19,7 +19,7 @@ Tween tween = GetTree().CreateTween(); tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f); tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f); - tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree)); + tween.TweenCallback(Callable.From(GetNode("Sprite").QueueFree)); [/csharp] [/codeblocks] This sequence will make the [code]$Sprite[/code] node turn red, then shrink, before finally calling [method Node.queue_free] to free the sprite. [Tweener]s are executed one after another by default. This behavior can be changed using [method parallel] and [method set_parallel]. @@ -35,7 +35,7 @@ Tween tween = GetTree().CreateTween(); tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f).SetTrans(Tween.TransitionType.Sine); tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f).SetTrans(Tween.TransitionType.Bounce); - tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree)); + tween.TweenCallback(Callable.From(GetNode("Sprite").QueueFree)); [/csharp] [/codeblocks] Most of the [Tween] methods can be chained this way too. In the following example the [Tween] is bound to the running script's node and a default transition is set for its [Tweener]s: @@ -50,7 +50,7 @@ var tween = GetTree().CreateTween().BindNode(this).SetTrans(Tween.TransitionType.Elastic); tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f); tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f); - tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree)); + tween.TweenCallback(Callable.From(GetNode("Sprite").QueueFree)); [/csharp] [/codeblocks] Another interesting use for [Tween]s is animating arbitrary sets of objects: @@ -77,13 +77,13 @@ tween = create_tween() [/gdscript] [csharp] - private Tween tween; + private Tween _tween; public void Animate() { - if (tween != null) - tween.Kill(); // Abort the previous animation - tween = CreateTween(); + if (_tween != null) + _tween.Kill(); // Abort the previous animation + _tween = CreateTween(); } [/csharp] [/codeblocks] @@ -281,7 +281,7 @@ [/gdscript] [csharp] Tween tween = GetTree().CreateTween().SetLoops(); - tween.TweenCallback(new Callable(Shoot)).SetDelay(1.0f); + tween.TweenCallback(Callable.From(Shoot)).SetDelay(1.0f); [/csharp] [/codeblocks] [b]Example:[/b] Turning a sprite red and then blue, with 2 second delay: @@ -294,8 +294,8 @@ [csharp] Tween tween = GetTree().CreateTween(); Sprite2D sprite = GetNode<Sprite2D>("Sprite"); - tween.TweenCallback(new Callable(() => sprite.Modulate = Colors.Red)).SetDelay(2.0f); - tween.TweenCallback(new Callable(() => sprite.Modulate = Colors.Blue)).SetDelay(2.0f); + tween.TweenCallback(Callable.From(() => sprite.Modulate = Colors.Red)).SetDelay(2.0f); + tween.TweenCallback(Callable.From(() => sprite.Modulate = Colors.Blue)).SetDelay(2.0f); [/csharp] [/codeblocks] </description> @@ -332,10 +332,10 @@ [csharp] Tween tween = CreateTween().SetLoops(); tween.TweenProperty(GetNode("Sprite"), "position:x", 200.0f, 1.0f).AsRelative(); - tween.TweenCallback(new Callable(Jump)); + tween.TweenCallback(Callable.From(Jump)); tween.TweenInterval(2.0f); tween.TweenProperty(GetNode("Sprite"), "position:x", -200.0f, 1.0f).AsRelative(); - tween.TweenCallback(new Callable(Jump)); + tween.TweenCallback(Callable.From(Jump)); tween.TweenInterval(2.0f); [/csharp] [/codeblocks] @@ -357,7 +357,7 @@ [/gdscript] [csharp] Tween tween = CreateTween(); - tween.TweenMethod(new Callable(() => LookAt(Vector3.Up)), new Vector3(-1.0f, 0.0f, -1.0f), new Vector3(1.0f, 0.0f, -1.0f), 1.0f); // The LookAt() method takes up vector as second argument. + tween.TweenMethod(Callable.From(() => LookAt(Vector3.Up)), new Vector3(-1.0f, 0.0f, -1.0f), new Vector3(1.0f, 0.0f, -1.0f), 1.0f); // The LookAt() method takes up vector as second argument. [/csharp] [/codeblocks] [b]Example:[/b] Setting the text of a [Label], using an intermediate method and after a delay: @@ -376,7 +376,7 @@ base._Ready(); Tween tween = CreateTween(); - tween.TweenMethod(new Callable(SetLabelText), 0.0f, 10.0f, 1.0f).SetDelay(1.0f); + tween.TweenMethod(Callable.From<int>(SetLabelText), 0.0f, 10.0f, 1.0f).SetDelay(1.0f); } private void SetLabelText(int value) diff --git a/doc/classes/UDPServer.xml b/doc/classes/UDPServer.xml index c3a3a49a80..8151ecb625 100644 --- a/doc/classes/UDPServer.xml +++ b/doc/classes/UDPServer.xml @@ -9,7 +9,8 @@ Below a small example of how it can be used: [codeblocks] [gdscript] - class_name Server + # server_node.gd + class_name ServerNode extends Node var server := UDPServer.new() @@ -34,35 +35,35 @@ pass # Do something with the connected peers. [/gdscript] [csharp] + // ServerNode.cs using Godot; - using System; using System.Collections.Generic; - public class Server : Node + public partial class ServerNode : Node { - public UDPServer Server = new UDPServer(); - public List<PacketPeerUDP> Peers = new List<PacketPeerUDP>(); + private UdpServer _server = new UdpServer(); + private List<PacketPeerUdp> _peers = new List<PacketPeerUdp>(); public override void _Ready() { - Server.Listen(4242); + _server.Listen(4242); } - public override void _Process(float delta) + public override void _Process(double delta) { - Server.Poll(); // Important! - if (Server.IsConnectionAvailable()) + _server.Poll(); // Important! + if (_server.IsConnectionAvailable()) { - PacketPeerUDP peer = Server.TakeConnection(); + PacketPeerUdp peer = _server.TakeConnection(); byte[] packet = peer.GetPacket(); - GD.Print($"Accepted Peer: {peer.GetPacketIp()}:{peer.GetPacketPort()}"); - GD.Print($"Received Data: {packet.GetStringFromUTF8()}"); + GD.Print($"Accepted Peer: {peer.GetPacketIP()}:{peer.GetPacketPort()}"); + GD.Print($"Received Data: {packet.GetStringFromUtf8()}"); // Reply so it knows we received the message. peer.PutPacket(packet); // Keep a reference so we can keep contacting the remote peer. - Peers.Add(peer); + _peers.Add(peer); } - foreach (var peer in Peers) + foreach (var peer in _peers) { // Do something with the peers. } @@ -72,7 +73,8 @@ [/codeblocks] [codeblocks] [gdscript] - class_name Client + # client_node.gd + class_name ClientNode extends Node var udp := PacketPeerUDP.new() @@ -90,30 +92,30 @@ connected = true [/gdscript] [csharp] + // ClientNode.cs using Godot; - using System; - public class Client : Node + public partial class ClientNode : Node { - public PacketPeerUDP Udp = new PacketPeerUDP(); - public bool Connected = false; + private PacketPeerUdp _udp = new PacketPeerUdp(); + private bool _connected = false; public override void _Ready() { - Udp.ConnectToHost("127.0.0.1", 4242); + _udp.ConnectToHost("127.0.0.1", 4242); } - public override void _Process(float delta) + public override void _Process(double delta) { - if (!Connected) + if (!_connected) { // Try to contact server - Udp.PutPacket("The Answer Is..42!".ToUTF8()); + _udp.PutPacket("The Answer Is..42!".ToUtf8()); } - if (Udp.GetAvailablePacketCount() > 0) + if (_udp.GetAvailablePacketCount() > 0) { - GD.Print($"Connected: {Udp.GetPacket().GetStringFromUTF8()}"); - Connected = true; + GD.Print($"Connected: {_udp.GetPacket().GetStringFromUtf8()}"); + _connected = true; } } } diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml index 42baf7728d..e43bceb941 100644 --- a/doc/classes/UndoRedo.xml +++ b/doc/classes/UndoRedo.xml @@ -27,11 +27,11 @@ undo_redo.commit_action() [/gdscript] [csharp] - public UndoRedo UndoRedo; + private UndoRedo _undoRedo; public override void _Ready() { - UndoRedo = GetUndoRedo(); // Method of EditorPlugin. + _undoRedo = GetUndoRedo(); // Method of EditorPlugin. } public void DoSomething() @@ -47,12 +47,12 @@ private void OnMyButtonPressed() { var node = GetNode<Node2D>("MyNode2D"); - UndoRedo.CreateAction("Move the node"); - UndoRedo.AddDoMethod(this, nameof(DoSomething)); - UndoRedo.AddUndoMethod(this, nameof(UndoSomething)); - UndoRedo.AddDoProperty(node, "position", new Vector2(100, 100)); - UndoRedo.AddUndoProperty(node, "position", node.Position); - UndoRedo.CommitAction(); + _undoRedo.CreateAction("Move the node"); + _undoRedo.AddDoMethod(new Callable(this, MethodName.DoSomething)); + _undoRedo.AddUndoMethod(new Callable(this, MethodName.UndoSomething)); + _undoRedo.AddDoProperty(node, "position", new Vector2(100, 100)); + _undoRedo.AddUndoProperty(node, "position", node.Position); + _undoRedo.CommitAction(); } [/csharp] [/codeblocks] diff --git a/doc/classes/VideoStream.xml b/doc/classes/VideoStream.xml index 2797ad3513..648c3edd73 100644 --- a/doc/classes/VideoStream.xml +++ b/doc/classes/VideoStream.xml @@ -8,4 +8,18 @@ </description> <tutorials> </tutorials> + <methods> + <method name="_instantiate_playback" qualifiers="virtual"> + <return type="VideoStreamPlayback" /> + <description> + Called when the video starts playing, to initialize and return a subclass of [VideoStreamPlayback]. + </description> + </method> + </methods> + <members> + <member name="file" type="String" setter="set_file" getter="get_file" default=""""> + The video file path or URI that this [VideoStream] resource handles. + For [VideoStreamTheora], this filename should be an Ogg Theora video file with the [code].ogv[/code] extension. + </member> + </members> </class> diff --git a/doc/classes/VideoStreamPlayback.xml b/doc/classes/VideoStreamPlayback.xml new file mode 100644 index 0000000000..8d8b4fe5b1 --- /dev/null +++ b/doc/classes/VideoStreamPlayback.xml @@ -0,0 +1,104 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="VideoStreamPlayback" inherits="Resource" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Internal class used by [VideoStream] to manage playback state when played from a [VideoStreamPlayer]. + </brief_description> + <description> + This class is intended to be overridden by video decoder extensions with custom implementations of [VideoStream]. + </description> + <tutorials> + </tutorials> + <methods> + <method name="_get_channels" qualifiers="virtual const"> + <return type="int" /> + <description> + Returns the number of audio channels. + </description> + </method> + <method name="_get_length" qualifiers="virtual const"> + <return type="float" /> + <description> + Returns the video duration in seconds, if known, or 0 if unknown. + </description> + </method> + <method name="_get_mix_rate" qualifiers="virtual const"> + <return type="int" /> + <description> + Returns the audio sample rate used for mixing. + </description> + </method> + <method name="_get_playback_position" qualifiers="virtual const"> + <return type="float" /> + <description> + Return the current playback timestamp. Called in response to the [member VideoStreamPlayer.stream_position] getter. + </description> + </method> + <method name="_get_texture" qualifiers="virtual const"> + <return type="Texture2D" /> + <description> + Allocates a [Texture2D] in which decoded video frames will be drawn. + </description> + </method> + <method name="_is_paused" qualifiers="virtual const"> + <return type="bool" /> + <description> + Returns the paused status, as set by [method _set_paused]. + </description> + </method> + <method name="_is_playing" qualifiers="virtual const"> + <return type="bool" /> + <description> + Returns the playback state, as determined by calls to [method _play] and [method _stop]. + </description> + </method> + <method name="_play" qualifiers="virtual"> + <return type="void" /> + <description> + Called in response to [member VideoStreamPlayer.autoplay] or [method VideoStreamPlayer.play]. Note that manual playback may also invoke [method _stop] multiple times before this method is called. [method _is_playing] should return true once playing. + </description> + </method> + <method name="_seek" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="time" type="float" /> + <description> + Seeks to [code]time[/code] seconds. Called in response to the [member VideoStreamPlayer.stream_position] setter. + </description> + </method> + <method name="_set_audio_track" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="idx" type="int" /> + <description> + Select the audio track [code]idx[/code]. Called when playback starts, and in response to the [member VideoStreamPlayer.audio_track] setter. + </description> + </method> + <method name="_set_paused" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="paused" type="bool" /> + <description> + Set the paused status of video playback. [method _is_paused] must return [code]paused[/code]. Called in response to the [member VideoStreamPlayer.paused] setter. + </description> + </method> + <method name="_stop" qualifiers="virtual"> + <return type="void" /> + <description> + Stops playback. May be called multiple times before [method _play], or in response to [method VideoStreamPlayer.stop]. [method _is_playing] should return false once stopped. + </description> + </method> + <method name="_update" qualifiers="virtual"> + <return type="void" /> + <param index="0" name="delta" type="float" /> + <description> + Ticks video playback for [code]delta[/code] seconds. Called every frame as long as [method _is_paused] and [method _is_playing] return true. + </description> + </method> + <method name="mix_audio"> + <return type="int" /> + <param index="0" name="num_frames" type="int" /> + <param index="1" name="buffer" type="PackedFloat32Array" default="PackedFloat32Array()" /> + <param index="2" name="offset" type="int" default="0" /> + <description> + Render [code]num_frames[/code] audio frames (of [method _get_channels] floats each) from [code]buffer[/code], starting from index [code]offset[/code] in the array. Returns the number of audio frames rendered, or -1 on error. + </description> + </method> + </methods> +</class> diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index 236d34383f..ab2de14638 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -55,7 +55,7 @@ <method name="get_final_transform" qualifiers="const"> <return type="Transform2D" /> <description> - Returns the total transform of the viewport. + Returns the transform from the viewport's coordinate system to the embedder's coordinate system. </description> </method> <method name="get_mouse_position" qualifiers="const"> @@ -210,6 +210,7 @@ <param index="0" name="position" type="Vector2" /> <description> Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport]. + [b]Note:[/b] [method warp_mouse] is only supported on Windows, macOS and Linux. It has no effect on Android, iOS and Web. </description> </method> </methods> diff --git a/doc/classes/VisualShaderNodeCustom.xml b/doc/classes/VisualShaderNodeCustom.xml index d96969b383..279295a434 100644 --- a/doc/classes/VisualShaderNodeCustom.xml +++ b/doc/classes/VisualShaderNodeCustom.xml @@ -81,7 +81,7 @@ </description> </method> <method name="_get_input_port_type" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="VisualShaderNode.PortType" /> <param index="0" name="port" type="int" /> <description> Override this method to define the returned type of each input port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types). @@ -111,7 +111,7 @@ </description> </method> <method name="_get_output_port_type" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="VisualShaderNode.PortType" /> <param index="0" name="port" type="int" /> <description> Override this method to define the returned type of each output port of the associated custom node (see [enum VisualShaderNode.PortType] for possible types). @@ -119,7 +119,7 @@ </description> </method> <method name="_get_return_icon_type" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="VisualShaderNode.PortType" /> <description> Override this method to define the return icon of the associated custom node in the Visual Shader Editor's members dialog. Defining this method is [b]optional[/b]. If not overridden, no return icon is shown. diff --git a/doc/classes/VisualShaderNodeDerivativeFunc.xml b/doc/classes/VisualShaderNodeDerivativeFunc.xml index 9a1ad53394..4a31969171 100644 --- a/doc/classes/VisualShaderNodeDerivativeFunc.xml +++ b/doc/classes/VisualShaderNodeDerivativeFunc.xml @@ -15,6 +15,9 @@ <member name="op_type" type="int" setter="set_op_type" getter="get_op_type" enum="VisualShaderNodeDerivativeFunc.OpType" default="0"> A type of operands and returned value. See [enum OpType] for options. </member> + <member name="precision" type="int" setter="set_precision" getter="get_precision" enum="VisualShaderNodeDerivativeFunc.Precision" default="0"> + Sets the level of precision to use for the derivative function. See [enum Precision] for options. When using the GL_Compatibility renderer, this setting has no effect. + </member> </members> <constants> <constant name="OP_TYPE_SCALAR" value="0" enum="OpType"> @@ -44,5 +47,17 @@ <constant name="FUNC_MAX" value="3" enum="Function"> Represents the size of the [enum Function] enum. </constant> + <constant name="PRECISION_NONE" value="0" enum="Precision"> + No precision is specified, the GPU driver is allowed to use whatever level of precision it chooses. This is the default option and is equivalent to using [code]dFdx()[/code] or [code]dFdy()[/code] in text shaders. + </constant> + <constant name="PRECISION_COARSE" value="1" enum="Precision"> + The derivative will be calculated using the current fragment's neighbors (which may not include the current fragment). This tends to be faster than using [constant PRECISION_FINE], but may not be suitable when more precision is needed. This is equivalent to using [code]dFdxCoarse()[/code] or [code]dFdyCoarse()[/code] in text shaders. + </constant> + <constant name="PRECISION_FINE" value="2" enum="Precision"> + The derivative will be calculated using the current fragment and its immediate neighbors. This tends to be slower than using [constant PRECISION_COARSE], but may be necessary when more precision is needed. This is equivalent to using [code]dFdxFine()[/code] or [code]dFdyFine()[/code] in text shaders. + </constant> + <constant name="PRECISION_MAX" value="3" enum="Precision"> + Represents the size of the [enum Precision] enum. + </constant> </constants> </class> diff --git a/doc/classes/VoxelGI.xml b/doc/classes/VoxelGI.xml index 394611b78f..4347c5845f 100644 --- a/doc/classes/VoxelGI.xml +++ b/doc/classes/VoxelGI.xml @@ -38,9 +38,9 @@ <member name="data" type="VoxelGIData" setter="set_probe_data" getter="get_probe_data"> The [VoxelGIData] resource that holds the data for this [VoxelGI]. </member> - <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(10, 10, 10)"> - The size of the area covered by the [VoxelGI]. If you make the extents larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting. - [b]Note:[/b] Extents are clamped to 1.0 unit or more on each axis. + <member name="size" type="Vector3" setter="set_size" getter="get_size" default="Vector3(20, 20, 20)"> + The size of the area covered by the [VoxelGI]. If you make the size larger without increasing the subdivisions with [member subdiv], the size of each cell will increase and result in lower detailed lighting. + [b]Note:[/b] Size is clamped to 1.0 unit or more on each axis. </member> <member name="subdiv" type="int" setter="set_subdiv" getter="get_subdiv" enum="VoxelGI.Subdiv" default="1"> Number of times to subdivide the grid that the [VoxelGI] operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance. diff --git a/doc/classes/VoxelGIData.xml b/doc/classes/VoxelGIData.xml index bd9df18394..541a3bc4a6 100644 --- a/doc/classes/VoxelGIData.xml +++ b/doc/classes/VoxelGIData.xml @@ -26,8 +26,8 @@ <method name="get_bounds" qualifiers="const"> <return type="AABB" /> <description> - Returns the bounds of the baked voxel data as an [AABB], which should match [member VoxelGI.extents] after being baked (which only contains the size as a [Vector3]). - [b]Note:[/b] If the extents were modified without baking the VoxelGI data, then the value of [method get_bounds] and [member VoxelGI.extents] will not match. + Returns the bounds of the baked voxel data as an [AABB], which should match [member VoxelGI.size] after being baked (which only contains the size as a [Vector3]). + [b]Note:[/b] If the size was modified without baking the VoxelGI data, then the value of [method get_bounds] and [member VoxelGI.size] will not match. </description> </method> <method name="get_data_cells" qualifiers="const"> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index c4ea11ab66..14e705a7e6 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -614,6 +614,12 @@ This signal can be used to handle window closing, e.g. by connecting it to [method hide]. </description> </signal> + <signal name="dpi_changed"> + <description> + Emitted when the [Window]'s DPI changes as a result of OS-level changes (e.g. moving the window from a Retina display to a lower resolution one). + [b]Note:[/b] Only implemented on macOS. + </description> + </signal> <signal name="files_dropped"> <param index="0" name="files" type="PackedStringArray" /> <description> diff --git a/doc/classes/XRInterfaceExtension.xml b/doc/classes/XRInterfaceExtension.xml index 5ad67a7ea9..b74ac1e469 100644 --- a/doc/classes/XRInterfaceExtension.xml +++ b/doc/classes/XRInterfaceExtension.xml @@ -64,7 +64,7 @@ </description> </method> <method name="_get_play_area_mode" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="XRInterface.PlayAreaMode" /> <description> Returns the [enum XRInterface.PlayAreaMode] that sets up our play area. </description> @@ -99,7 +99,7 @@ </description> </method> <method name="_get_tracking_status" qualifiers="virtual const"> - <return type="int" /> + <return type="int" enum="XRInterface.TrackingStatus" /> <description> Returns a [enum XRInterface.TrackingStatus] specifying the current status of our tracking. </description> @@ -177,7 +177,7 @@ </method> <method name="_set_play_area_mode" qualifiers="virtual const"> <return type="bool" /> - <param index="0" name="mode" type="int" /> + <param index="0" name="mode" type="int" enum="XRInterface.PlayAreaMode" /> <description> Set the play area mode for this interface. </description> |