diff options
Diffstat (limited to 'doc')
58 files changed, 512 insertions, 360 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 0d6524ccbe..3b2e260dcb 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1271,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"> 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/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/AnimationNodeTransition.xml b/doc/classes/AnimationNodeTransition.xml index a067b0a9ba..bc3e5716dd 100644 --- a/doc/classes/AnimationNodeTransition.xml +++ b/doc/classes/AnimationNodeTransition.xml @@ -44,6 +44,9 @@ </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 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="input_count" type="int" setter="set_input_count" getter="get_input_count" default="0"> The number of enabled input ports for this node. </member> 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/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 0d675112b8..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> @@ -542,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] @@ -812,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] 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/DTLSServer.xml b/doc/classes/DTLSServer.xml index a3a0b0456c..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; } } } 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 1591aa59bf..a5a50b4c6a 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -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] 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/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index 50cabf3c8c..6a976d218f 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -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); } } diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index c097c8f685..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"); 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 72843eb157..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]. diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml index 89746363d8..40b469de0a 100644 --- a/doc/classes/EditorTranslationParserPlugin.xml +++ b/doc/classes/EditorTranslationParserPlugin.xml @@ -27,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] @@ -84,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 2c7d83a811..fd5a921836 100644 --- a/doc/classes/Expression.xml +++ b/doc/classes/Expression.xml @@ -24,7 +24,7 @@ $LineEdit.text = str(result) [/gdscript] [csharp] - public Expression expression = new Expression(); + private Expression _expression = new Expression(); public override void _Ready() { @@ -33,14 +33,14 @@ 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/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/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 b7a5cff694..4973f3fddf 100644 --- a/doc/classes/HTTPClient.xml +++ b/doc/classes/HTTPClient.xml @@ -105,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] @@ -117,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] @@ -151,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 d403acf90c..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 responseCode, 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 responseCode, 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."); } diff --git a/doc/classes/HashingContext.xml b/doc/classes/HashingContext.xml index 7c2be6f817..5223cbf52f 100644 --- a/doc/classes/HashingContext.xml +++ b/doc/classes/HashingContext.xml @@ -8,7 +8,7 @@ The [enum HashType] enum shows the supported hashing algorithms. [codeblocks] [gdscript] - const CHUNK_SIZE = 102 + const CHUNK_SIZE = 1024 func hash_file(path): # Check that file exists. @@ -32,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()) { @@ -51,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/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/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/NavigationAgent2D.xml b/doc/classes/NavigationAgent2D.xml index 6ae4dc4177..92fd8bcc6a 100644 --- a/doc/classes/NavigationAgent2D.xml +++ b/doc/classes/NavigationAgent2D.xml @@ -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> diff --git a/doc/classes/NavigationAgent3D.xml b/doc/classes/NavigationAgent3D.xml index a22cd6dd46..0ed11bc477 100644 --- a/doc/classes/NavigationAgent3D.xml +++ b/doc/classes/NavigationAgent3D.xml @@ -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> diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 16f6de5238..7270a19b4d 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -528,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/Object.xml b/doc/classes/Object.xml index e4607456ca..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; @@ -433,9 +433,9 @@ var button = new Button(); // Option 1: In C#, we can use signals as events and connect with this idiomatic syntax: button.ButtonDown += OnButtonDown; - // Option 2: Object.Connect() with a constructed Callable from a method group. + // Option 2: GodotObject.Connect() with a constructed Callable from a method group. button.Connect(Button.SignalName.ButtonDown, Callable.From(OnButtonDown)); - // Option 3: Object.Connect() with a constructed Callable using a target object and method name. + // 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)); } @@ -700,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. @@ -747,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> 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/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/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 95bd060fc6..e429759e93 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -528,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> @@ -1743,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> @@ -1757,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> 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/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 8bb3073000..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" /> @@ -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. @@ -4565,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/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/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/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/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/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/Tween.xml b/doc/classes/Tween.xml index 9bb92cf362..16e4ce3714 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -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] 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 6c151ef958..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, MethodName.DoSomething); - UndoRedo.AddUndoMethod(this, MethodName.UndoSomething); - UndoRedo.AddDoProperty(node, Node2D.PropertyName.Position, new Vector2(100, 100)); - UndoRedo.AddUndoProperty(node, Node2D.PropertyName.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/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"> |