diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 2 | ||||
-rw-r--r-- | doc/classes/ColorPickerButton.xml | 2 | ||||
-rw-r--r-- | doc/classes/Control.xml | 16 | ||||
-rw-r--r-- | doc/classes/HTTPRequest.xml | 30 | ||||
-rw-r--r-- | doc/classes/Image.xml | 8 | ||||
-rw-r--r-- | doc/classes/NavigationMeshGenerator.xml | 1 | ||||
-rw-r--r-- | doc/classes/NavigationServer2D.xml | 20 | ||||
-rw-r--r-- | doc/classes/NavigationServer3D.xml | 20 | ||||
-rw-r--r-- | doc/classes/ScrollContainer.xml | 2 |
9 files changed, 77 insertions, 24 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 4048b483e8..475d166925 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2460,7 +2460,7 @@ </constant> <constant name="PROPERTY_HINT_RANGE" value="1" enum="PropertyHint"> Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_lesser"[/code]. - Additionally, other keywords can be included: "exp" for exponential range editing, "radians" for editing radian angles in degrees, "degrees" to hint at an angle and "noslider" to hide the slider. + Additionally, other keywords can be included: "exp" for exponential range editing, "radians" for editing radian angles in degrees, "degrees" to hint at an angle and "no_slider" to hide the slider. </constant> <constant name="PROPERTY_HINT_ENUM" value="2" enum="PropertyHint"> Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string. diff --git a/doc/classes/ColorPickerButton.xml b/doc/classes/ColorPickerButton.xml index 53d35c1a3d..75a715789c 100644 --- a/doc/classes/ColorPickerButton.xml +++ b/doc/classes/ColorPickerButton.xml @@ -6,7 +6,7 @@ <description> Encapsulates a [ColorPicker] making it accessible by pressing a button. Pressing the button will toggle the [ColorPicker] visibility. See also [BaseButton] which contains common properties and methods associated with this node. - [b]Note:[/b] By default, the button may not be wide enough for the color preview swatch to be visible. Make sure to set [member Control.minimum_size] to a big enough value to give the button enough space. + [b]Note:[/b] By default, the button may not be wide enough for the color preview swatch to be visible. Make sure to set [member Control.custom_minimum_size] to a big enough value to give the button enough space. </description> <tutorials> <link title="GUI Drag And Drop Demo">https://godotengine.org/asset-library/asset/133</link> diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 2828896eac..2846b564b4 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -100,7 +100,7 @@ <method name="_get_minimum_size" qualifiers="virtual const"> <return type="Vector2" /> <description> - Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to [member minimum_size] for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately). + Virtual method to be implemented by the user. Returns the minimum size for this control. Alternative to [member custom_minimum_size] for controlling minimum size via code. The actual minimum size will be the max value of these two (in each axis separately). If not overridden, defaults to [constant Vector2.ZERO]. [b]Note:[/b] This method will not be called when the script is attached to a [Control] node that already overrides its minimum size (e.g. [Label], [Button], [PanelContainer] etc.). It can only be used with most basic GUI nodes, like [Control], [Container], [Panel] etc. </description> @@ -157,7 +157,7 @@ Virtual method to be implemented by the user. Returns a [Control] node that should be used as a tooltip instead of the default one. The [code]for_text[/code] includes the contents of the [member hint_tooltip] property. The returned node must be of type [Control] or Control-derived. It can have child nodes of any type. It is freed when the tooltip disappears, so make sure you always provide a new instance (if you want to use a pre-existing node from your scene tree, you can duplicate it and pass the duplicated instance). When [code]null[/code] or a non-Control node is returned, the default tooltip will be used instead. The returned node will be added as child to a [PopupPanel], so you should only provide the contents of that panel. That [PopupPanel] can be themed using [method Theme.set_stylebox] for the type [code]"TooltipPanel"[/code] (see [member hint_tooltip] for an example). - [b]Note:[/b] The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its [member minimum_size] to some non-zero value. + [b]Note:[/b] The tooltip is shrunk to minimal size. If you want to ensure it's fully visible, you might want to set its [member custom_minimum_size] to some non-zero value. [b]Note:[/b] The node (and any relevant children) should be [member CanvasItem.visible] when returned, otherwise, the viewport that instantiates it will not be able to calculate its minimum size reliably. Example of usage with a custom-constructed node: [codeblocks] @@ -357,7 +357,7 @@ <method name="get_combined_minimum_size" qualifiers="const"> <return type="Vector2" /> <description> - Returns combined minimum size from [member minimum_size] and [method get_minimum_size]. + Returns combined minimum size from [member custom_minimum_size] and [method get_minimum_size]. </description> </method> <method name="get_cursor_shape" qualifiers="const"> @@ -389,7 +389,7 @@ <method name="get_minimum_size" qualifiers="const"> <return type="Vector2" /> <description> - Returns the minimum size for this control. See [member minimum_size]. + Returns the minimum size for this control. See [member custom_minimum_size]. </description> </method> <method name="get_offset" qualifiers="const"> @@ -939,7 +939,7 @@ <method name="update_minimum_size"> <return type="void" /> <description> - Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with [method get_minimum_size] when the return value is changed. Setting [member minimum_size] directly calls this method automatically. + Invalidates the size cache in this node and in parent nodes up to top level. Intended to be used with [method get_minimum_size] when the return value is changed. Setting [member custom_minimum_size] directly calls this method automatically. </description> </method> <method name="warp_mouse"> @@ -970,6 +970,9 @@ <member name="clip_contents" type="bool" setter="set_clip_contents" getter="is_clipping_contents" default="false"> Enables whether rendering of [CanvasItem] based children should be clipped to this control's rectangle. If [code]true[/code], parts of a child which would be visibly outside of this control's rectangle will not be rendered and won't receive input. </member> + <member name="custom_minimum_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size" default="Vector2(0, 0)"> + The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes. + </member> <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" enum="Control.FocusMode" default="0"> The focus access mode for the control (None, Click or All). Only one Control can be focused at the same time, and it will receive keyboard signals. </member> @@ -1027,9 +1030,6 @@ <member name="layout_direction" type="int" setter="set_layout_direction" getter="get_layout_direction" enum="Control.LayoutDirection" default="0"> Controls layout direction and text writing direction. Right-to-left layouts are necessary for certain languages (e.g. Arabic and Hebrew). </member> - <member name="minimum_size" type="Vector2" setter="set_custom_minimum_size" getter="get_custom_minimum_size" default="Vector2(0, 0)"> - The minimum size of the node's bounding rectangle. If you set it to a value greater than (0, 0), the node's bounding rectangle will always have at least this size, even if its content is smaller. If it's set to (0, 0), the node sizes automatically to fit its content, be it a texture or child nodes. - </member> <member name="mouse_default_cursor_shape" type="int" setter="set_default_cursor_shape" getter="get_default_cursor_shape" enum="Control.CursorShape" default="0"> The default cursor shape for this control. Useful for Godot plugins and applications or games that use the system's mouse cursors. [b]Note:[/b] On Linux, shapes may vary depending on the cursor theme of the system. diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml index 641d73e333..166923314f 100644 --- a/doc/classes/HTTPRequest.xml +++ b/doc/classes/HTTPRequest.xml @@ -15,7 +15,7 @@ # Create an HTTP request node and connect its completion signal. var http_request = HTTPRequest.new() add_child(http_request) - http_request.connect("request_completed", self, "_http_request_completed") + http_request.request_completed.connect(self._http_request_completed) # Perform a GET request. The URL below returns JSON as of writing. var error = http_request.request("https://httpbin.org/get") @@ -25,7 +25,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. - var body = {"name": "Godette"} + var body = JSON.new().stringify({"name": "Godette"}) error = http_request.request("https://httpbin.org/post", [], true, HTTPClient.METHOD_POST, body) if error != OK: push_error("An error occurred in the HTTP request.") @@ -33,7 +33,9 @@ # Called when the HTTP request is completed. func _http_request_completed(result, response_code, headers, body): - var response = parse_json(body.get_string_from_utf8()) + var json = JSON.new() + json.parse(body.get_string_from_utf8()) + var response = json.get_data() # Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org). print(response.headers["User-Agent"]) @@ -44,7 +46,7 @@ // Create an HTTP request node and connect its completion signal. var httpRequest = new HTTPRequest(); AddChild(httpRequest); - httpRequest.Connect("request_completed", this, nameof(HttpRequestCompleted)); + httpRequest.RequestCompleted += HttpRequestCompleted; // Perform a GET request. The URL below returns JSON as of writing. Error error = httpRequest.Request("https://httpbin.org/get"); @@ -56,21 +58,24 @@ // 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 = { "name", "Godette" }; - // GDScript to_json is non existent, so we use JSON.Print() here. - error = httpRequest.Request("https://httpbin.org/post", null, true, HTTPClient.Method.Post, JSON.Print(body)); + string body = new JSON().Stringify(new Godot.Collections.Dictionary + { + { "name", "Godette" } + }); + error = httpRequest.Request("https://httpbin.org/post", null, true, HTTPClient.Method.Post, body); if (error != Error.Ok) { GD.PushError("An error occurred in the HTTP request."); } } - // Called when the HTTP request is completed. private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body) { - // GDScript parse_json is non existent so we have to use JSON.parse, which has a slightly different syntax. - var response = JSON.Parse(body.GetStringFromUTF8()).Result as Godot.Collections.Dictionary; + var json = new JSON(); + json.Parse(body.GetStringFromUTF8()); + var response = json.GetData() as Godot.Collections.Dictionary; + // 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"]); } @@ -83,7 +88,7 @@ # Create an HTTP request node and connect its completion signal. var http_request = HTTPRequest.new() add_child(http_request) - http_request.connect("request_completed", self, "_http_request_completed") + http_request.request_completed.connect(self._http_request_completed) # Perform the HTTP request. The URL below returns a PNG image as of writing. var error = http_request.request("https://via.placeholder.com/512") @@ -115,7 +120,7 @@ // Create an HTTP request node and connect its completion signal. var httpRequest = new HTTPRequest(); AddChild(httpRequest); - httpRequest.Connect("request_completed", this, nameof(HttpRequestCompleted)); + httpRequest.RequestCompleted += HttpRequestCompleted; // Perform the HTTP request. The URL below returns a PNG image as of writing. Error error = httpRequest.Request("https://via.placeholder.com/512"); @@ -125,7 +130,6 @@ } } - // Called when the HTTP request is completed. private void HttpRequestCompleted(int result, int response_code, string[] headers, byte[] body) { diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index d2baf78a9e..43b03ce65e 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -380,6 +380,14 @@ [b]Note:[/b] The TinyEXR module is disabled in non-editor builds, which means [method save_exr] will return [constant ERR_UNAVAILABLE] when it is called from an exported project. </description> </method> + <method name="save_exr_to_buffer" qualifiers="const"> + <return type="PackedByteArray" /> + <argument index="0" name="grayscale" type="bool" default="false" /> + <description> + Saves the image as an EXR file to a byte array. If [code]grayscale[/code] is [code]true[/code] and the image has only one channel, it will be saved explicitly as monochrome rather than one red channel. This function will return an empty byte array if Godot was compiled without the TinyEXR module. + [b]Note:[/b] The TinyEXR module is disabled in non-editor builds, which means [method save_exr] will return an empty byte array when it is called from an exported project. + </description> + </method> <method name="save_jpg" qualifiers="const"> <return type="int" enum="Error" /> <argument index="0" name="path" type="String" /> diff --git a/doc/classes/NavigationMeshGenerator.xml b/doc/classes/NavigationMeshGenerator.xml index b92183fda0..612ce54d34 100644 --- a/doc/classes/NavigationMeshGenerator.xml +++ b/doc/classes/NavigationMeshGenerator.xml @@ -8,6 +8,7 @@ The entire navigation mesh baking is best done in a separate thread as the voxelization, collision tests and mesh optimization steps involved are very performance and time hungry operations. Navigation mesh baking happens in multiple steps and the result depends on 3D source geometry and properties of the [NavigationMesh] resource. In the first step, starting from a root node and depending on [NavigationMesh] properties all valid 3D source geometry nodes are collected from the [SceneTree]. Second, all collected nodes are parsed for their relevant 3D geometry data and a combined 3D mesh is build. Due to the many different types of parsable objects, from normal [MeshInstance3D]s to [CSGShape3D]s or various [CollisionObject3D]s, some operations to collect geometry data can trigger [RenderingServer] and [PhysicsServer3D] synchronizations. Server synchronization can have a negative effect on baking time or framerate as it often involves [Mutex] locking for thread security. Many parsable objects and the continuous synchronization with other threaded Servers can increase the baking time significantly. On the other hand only a few but very large and complex objects will take some time to prepare for the Servers which can noticeably stall the next frame render. As a general rule the total amount of parsable objects and their individual size and complexity should be balanced to avoid framerate issues or very long baking times. The combined mesh is then passed to the Recast Navigation Object to test the source geometry for walkable terrain suitable to [NavigationMesh] agent properties by creating a voxel world around the meshes bounding area. The finalized navigation mesh is then returned and stored inside the [NavigationMesh] for use as a resource inside [NavigationRegion3D] nodes. + [b]Note:[/b] Using meshes to not only define walkable surfaces but also obstruct navigation baking does not always work. The navigation baking has no concept of what is a geometry "inside" when dealing with mesh source geometry and this is intentional. Depending on current baking parameters, as soon as the obstructing mesh is large enough to fit a navigation mesh area inside, the baking will generate navigation mesh areas that are inside the obstructing source geometry mesh. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 187d916fba..36379d2531 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -139,6 +139,16 @@ Create a new map. </description> </method> + <method name="map_force_update"> + <return type="void" /> + <argument index="0" name="map" type="RID" /> + <description> + This function immediately forces synchronization of the specified navigation [code]map[/code] [RID]. By default navigation maps are only synchronized at the end of each physics frame. This function can be used to immediately (re)calculate all the navigation meshes and region connections of the navigation map. This makes it possible to query a navigation path for a changed map immediately and in the same frame (multiple times if needed). + Due to technical restrictions the current NavigationServer command queue will be flushed. This means all already queued update commands for this physics frame will be executed, even those intended for other maps, regions and agents not part of the specified map. The expensive computation of the navigation meshes and region connections of a map will only be done for the specified map. Other maps will receive the normal synchronization at the end of the physics frame. Should the specified map receive changes after the forced update it will update again as well when the other maps receive their update. + Avoidance processing and dispatch of the [code]safe_velocity[/code] signals is untouched by this function and continues to happen for all maps and agents at the end of the physics frame. + [b]Note:[/b] With great power comes great responsibility. This function should only be used by users that really know what they are doing and have a good reason for it. Forcing an immediate update of a navigation map requires locking the NavigationServer and flushing the entire NavigationServer command queue. Not only can this severely impact the performance of a game but it can also introduce bugs if used inappropriately without much foresight. + </description> + </method> <method name="map_get_agents" qualifiers="const"> <return type="Array" /> <argument index="0" name="map" type="RID" /> @@ -282,6 +292,16 @@ Returns the [code]travel_cost[/code] of this [code]region[/code]. </description> </method> + <method name="region_owns_point" qualifiers="const"> + <return type="bool" /> + <argument index="0" name="region" type="RID" /> + <argument index="1" name="point" type="Vector2" /> + <description> + Returns [code]true[/code] if the provided [code]point[/code] in world space is currently owned by the provided navigation [code]region[/code]. Owned in this context means that one of the region's navigation mesh polygon faces has a possible position at the closest distance to this point compared to all other navigation meshes from other navigation regions that are also registered on the navigation map of the provided region. + If multiple navigation meshes have positions at equal distance the navigation region whose polygons are processed first wins the ownership. Polygons are processed in the same order that navigation regions were registered on the NavigationServer. + [b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected. + </description> + </method> <method name="region_set_enter_cost" qualifiers="const"> <return type="void" /> <argument index="0" name="region" type="RID" /> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index e605cf6645..5185b353bc 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -139,6 +139,16 @@ Create a new map. </description> </method> + <method name="map_force_update"> + <return type="void" /> + <argument index="0" name="map" type="RID" /> + <description> + This function immediately forces synchronization of the specified navigation [code]map[/code] [RID]. By default navigation maps are only synchronized at the end of each physics frame. This function can be used to immediately (re)calculate all the navigation meshes and region connections of the navigation map. This makes it possible to query a navigation path for a changed map immediately and in the same frame (multiple times if needed). + Due to technical restrictions the current NavigationServer command queue will be flushed. This means all already queued update commands for this physics frame will be executed, even those intended for other maps, regions and agents not part of the specified map. The expensive computation of the navigation meshes and region connections of a map will only be done for the specified map. Other maps will receive the normal synchronization at the end of the physics frame. Should the specified map receive changes after the forced update it will update again as well when the other maps receive their update. + Avoidance processing and dispatch of the [code]safe_velocity[/code] signals is untouched by this function and continues to happen for all maps and agents at the end of the physics frame. + [b]Note:[/b] With great power comes great responsibility. This function should only be used by users that really know what they are doing and have a good reason for it. Forcing an immediate update of a navigation map requires locking the NavigationServer and flushing the entire NavigationServer command queue. Not only can this severely impact the performance of a game but it can also introduce bugs if used inappropriately without much foresight. + </description> + </method> <method name="map_get_agents" qualifiers="const"> <return type="Array" /> <argument index="0" name="map" type="RID" /> @@ -332,6 +342,16 @@ Returns the [code]travel_cost[/code] of this [code]region[/code]. </description> </method> + <method name="region_owns_point" qualifiers="const"> + <return type="bool" /> + <argument index="0" name="region" type="RID" /> + <argument index="1" name="point" type="Vector3" /> + <description> + Returns [code]true[/code] if the provided [code]point[/code] in world space is currently owned by the provided navigation [code]region[/code]. Owned in this context means that one of the region's navigation mesh polygon faces has a possible position at the closest distance to this point compared to all other navigation meshes from other navigation regions that are also registered on the navigation map of the provided region. + If multiple navigation meshes have positions at equal distance the navigation region whose polygons are processed first wins the ownership. Polygons are processed in the same order that navigation regions were registered on the NavigationServer. + [b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected. + </description> + </method> <method name="region_set_enter_cost" qualifiers="const"> <return type="void" /> <argument index="0" name="region" type="RID" /> diff --git a/doc/classes/ScrollContainer.xml b/doc/classes/ScrollContainer.xml index 658793c4c0..1bbf5cb91b 100644 --- a/doc/classes/ScrollContainer.xml +++ b/doc/classes/ScrollContainer.xml @@ -5,7 +5,7 @@ </brief_description> <description> A ScrollContainer node meant to contain a [Control] child. - ScrollContainers will automatically create a scrollbar child ([HScrollBar], [VScrollBar], or both) when needed and will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the [member Control.minimum_size] of the Control relative to the ScrollContainer. + ScrollContainers will automatically create a scrollbar child ([HScrollBar], [VScrollBar], or both) when needed and will only draw the Control within the ScrollContainer area. Scrollbars will automatically be drawn at the right (for vertical) or bottom (for horizontal) and will enable dragging to move the viewable Control (and its children) within the ScrollContainer. Scrollbars will also automatically resize the grabber based on the [member Control.custom_minimum_size] of the Control relative to the ScrollContainer. Works great with a [Panel] control. You can set [code]EXPAND[/code] on the children's size flags, so they will upscale to the ScrollContainer's size if it's larger (scroll is invisible for the chosen dimension). </description> <tutorials> |