diff options
Diffstat (limited to 'doc/classes')
51 files changed, 1121 insertions, 519 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 3d01c60aea..5bb10d162f 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -2818,6 +2818,9 @@ </constant> <constant name="PROPERTY_USAGE_EDITOR_BASIC_SETTING" value="134217728" enum="PropertyUsageFlags"> </constant> + <constant name="PROPERTY_USAGE_READ_ONLY" value="268435456" enum="PropertyUsageFlags"> + The property is read-only in the editor inspector. + </constant> <constant name="PROPERTY_USAGE_ARRAY" value="536870912" enum="PropertyUsageFlags"> </constant> <constant name="PROPERTY_USAGE_DEFAULT" value="6" enum="PropertyUsageFlags"> diff --git a/doc/classes/AStarGrid2D.xml b/doc/classes/AStarGrid2D.xml index 19cd9d21d7..331862ebfa 100644 --- a/doc/classes/AStarGrid2D.xml +++ b/doc/classes/AStarGrid2D.xml @@ -6,14 +6,24 @@ <description> Compared to [AStar2D] you don't need to manually create points or connect them together. It also supports multiple type of heuristics and modes for diagonal movement. This class also provides a jumping mode which is faster to calculate than without it in the [AStar2D] class. In contrast to [AStar2D], you only need set the [member size] of the grid, optionally set the [member cell_size] and then call the [method update] method: - [codeblock] + [codeblocks] + [gdscript] var astar_grid = AStarGrid2D.new() astar_grid.size = Vector2i(32, 32) astar_grid.cell_size = Vector2(16, 16) astar_grid.update() print(astar_grid.get_id_path(Vector2i(0, 0), Vector2i(3, 4))) # prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) print(astar_grid.get_point_path(Vector2i(0, 0), Vector2i(3, 4))) # prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) - [/codeblock] + [/gdscript] + [csharp] + AStarGrid2D astarGrid = new AStarGrid2D(); + astarGrid.Size = new Vector2i(32, 32); + astarGrid.CellSize = new Vector2i(16, 16); + astarGrid.Update(); + GD.Print(astarGrid.GetIdPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) + GD.Print(astarGrid.GetPointPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) + [/csharp] + [/codeblocks] </description> <tutorials> </tutorials> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index f6d926031d..d8c4b8fdb5 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -53,6 +53,15 @@ </constructor> <constructor name="Array"> <return type="Array" /> + <param index="0" name="base" type="Array" /> + <param index="1" name="type" type="int" /> + <param index="2" name="class_name" type="StringName" /> + <param index="3" name="script" type="Variant" /> + <description> + </description> + </constructor> + <constructor name="Array"> + <return type="Array" /> <param index="0" name="from" type="Array" /> <description> Constructs an [Array] as a copy of the given [Array]. @@ -303,6 +312,21 @@ [b]Note:[/b] Calling this function is not the same as writing [code]array[0][/code]. If the array is empty, accessing by index will pause project execution when running from the editor. </description> </method> + <method name="get_typed_builtin" qualifiers="const"> + <return type="int" /> + <description> + </description> + </method> + <method name="get_typed_class_name" qualifiers="const"> + <return type="StringName" /> + <description> + </description> + </method> + <method name="get_typed_script" qualifiers="const"> + <return type="Variant" /> + <description> + </description> + </method> <method name="has" qualifiers="const"> <return type="bool" /> <param index="0" name="value" type="Variant" /> @@ -366,6 +390,16 @@ Returns [code]true[/code] if the array is empty. </description> </method> + <method name="is_read_only" qualifiers="const"> + <return type="bool" /> + <description> + </description> + </method> + <method name="is_typed" qualifiers="const"> + <return type="bool" /> + <description> + </description> + </method> <method name="map" qualifiers="const"> <return type="Array" /> <param index="0" name="method" type="Callable" /> @@ -479,6 +513,20 @@ Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. </description> </method> + <method name="set_read_only"> + <return type="void" /> + <param index="0" name="enable" type="bool" /> + <description> + </description> + </method> + <method name="set_typed"> + <return type="void" /> + <param index="0" name="type" type="int" /> + <param index="1" name="class_name" type="StringName" /> + <param index="2" name="script" type="Variant" /> + <description> + </description> + </method> <method name="shuffle"> <return type="void" /> <description> @@ -556,6 +604,12 @@ [/codeblocks] </description> </method> + <method name="typed_assign"> + <return type="bool" /> + <param index="0" name="array" type="Array" /> + <description> + </description> + </method> </methods> <operators> <operator name="operator !="> diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 1fcaf6d866..dd48ee6790 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -81,6 +81,13 @@ [/codeblock] </description> </method> + <method name="callv" qualifiers="const"> + <return type="Variant" /> + <param index="0" name="arguments" type="Array" /> + <description> + Calls the method represented by this [Callable]. Contrary to [method call], this method does not take a variable number of arguments but expects all arguments to be passed via a single [Array]. + </description> + </method> <method name="get_method" qualifiers="const"> <return type="StringName" /> <description> diff --git a/doc/classes/Camera2D.xml b/doc/classes/Camera2D.xml index bb78d537ad..a1d24f778d 100644 --- a/doc/classes/Camera2D.xml +++ b/doc/classes/Camera2D.xml @@ -124,6 +124,9 @@ <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="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> <member name="limit_bottom" type="int" setter="set_limit" getter="get_limit" default="10000000"> Bottom scroll limit in pixels. The camera stops moving when reaching this value, but [member offset] can push the view past the limit. </member> @@ -147,9 +150,6 @@ <member name="process_callback" type="int" setter="set_process_callback" getter="get_process_callback" enum="Camera2D.Camera2DProcessCallback" default="1"> The camera's process callback. See [enum Camera2DProcessCallback]. </member> - <member name="rotating" type="bool" setter="set_rotating" getter="is_rotating" default="false"> - If [code]true[/code], the camera view rotates with the target. - </member> <member name="smoothing_enabled" type="bool" setter="set_enable_follow_smoothing" getter="is_follow_smoothing_enabled" default="false"> If [code]true[/code], the camera smoothly moves towards the target at [member smoothing_speed]. </member> diff --git a/doc/classes/DirAccess.xml b/doc/classes/DirAccess.xml index ddb98030eb..af498a6519 100644 --- a/doc/classes/DirAccess.xml +++ b/doc/classes/DirAccess.xml @@ -6,6 +6,14 @@ <description> Directory type. It is used to manage directories and their content (not restricted to the project folder). [DirAccess] can't be instantiated directly. Instead it is created with a static method that takes a path for which it will be opened. + Most of the methods have a static alternative that can be used without creating a [DirAccess]. Static methods only support absolute paths (including [code]res://[/code] and [code]user://[/code]). + [codeblock] + # Standard + var dir = DirAccess.open("user://levels") + dir.make_dir("world1") + # Static + DirAccess.make_dir_absolute("user://levels/world1") + [/codeblock] [b]Note:[/b] Many resources types are imported (e.g. textures or sound files), and their source asset will not be included in the exported game, as only the imported version is used. Use [ResourceLoader] to access imported resources. Here is an example on how to iterate through the files of a directory: [codeblocks] @@ -27,7 +35,7 @@ [csharp] public void DirContents(string path) { - var dir = DirAccess.Open(path); + using var dir = DirAccess.Open(path); if (dir != null) { dir.ListDirBegin(); @@ -59,7 +67,7 @@ <methods> <method name="change_dir"> <return type="int" enum="Error" /> - <param index="0" name="todir" type="String" /> + <param index="0" name="to_dir" type="String" /> <description> Changes the currently opened directory to the one passed as an argument. The argument can be relative to the current directory (e.g. [code]newdir[/code] or [code]../newdir[/code]), or an absolute path (e.g. [code]/tmp/newdir[/code] or [code]res://somedir/newdir[/code]). Returns one of the [enum Error] code constants ([code]OK[/code] on success). @@ -76,6 +84,15 @@ Returns one of the [enum Error] code constants ([code]OK[/code] on success). </description> </method> + <method name="copy_absolute" qualifiers="static"> + <return type="int" enum="Error" /> + <param index="0" name="from" type="String" /> + <param index="1" name="to" type="String" /> + <param index="2" name="chmod_flags" type="int" default="-1" /> + <description> + Static version of [method copy]. Supports only absolute paths. + </description> + </method> <method name="current_is_dir" qualifiers="const"> <return type="bool" /> <description> @@ -87,7 +104,13 @@ <param index="0" name="path" type="String" /> <description> Returns whether the target directory exists. The argument can be relative to the current directory, or an absolute path. - If the [DirAccess] is not open, the path is relative to [code]res://[/code]. + </description> + </method> + <method name="dir_exists_absolute" qualifiers="static"> + <return type="bool" /> + <param index="0" name="path" type="String" /> + <description> + Static version of [method dir_exists]. Supports only absolute paths. </description> </method> <method name="file_exists"> @@ -95,7 +118,7 @@ <param index="0" name="path" type="String" /> <description> Returns whether the target file exists. The argument can be relative to the current directory, or an absolute path. - If the [DirAccess] is not open, the path is relative to [code]res://[/code]. + For a static equivalent, use [method FileAccess.file_exists]. </description> </method> <method name="get_current_dir" qualifiers="const"> @@ -108,7 +131,7 @@ <method name="get_current_drive"> <return type="int" /> <description> - Returns the currently opened directory's drive index. See [method get_drive] to convert returned index to the name of the drive. + Returns the currently opened directory's drive index. See [method get_drive_name] to convert returned index to the name of the drive. </description> </method> <method name="get_directories"> @@ -118,17 +141,15 @@ Affected by [member include_hidden] and [member include_navigational]. </description> </method> - <method name="get_drive"> - <return type="String" /> - <param index="0" name="idx" type="int" /> + <method name="get_directories_at" qualifiers="static"> + <return type="PackedStringArray" /> + <param index="0" name="path" type="String" /> <description> - On Windows, returns the name of the drive (partition) passed as an argument (e.g. [code]C:[/code]). - On macOS, returns the path to the mounted volume passed as an argument. - On Linux, returns the path to the mounted volume or GTK 3 bookmark passed as an argument. - On other platforms, or if the requested drive does not exist, the method returns an empty String. + Returns a [PackedStringArray] containing filenames of the directory contents, excluding files, at the given [param path]. The array is sorted alphabetically. + Use [method get_directories] if you want more control of what gets included. </description> </method> - <method name="get_drive_count"> + <method name="get_drive_count" qualifiers="static"> <return type="int" /> <description> On Windows, returns the number of drives (partitions) mounted on the current filesystem. @@ -137,6 +158,16 @@ On other platforms, the method returns 0. </description> </method> + <method name="get_drive_name" qualifiers="static"> + <return type="String" /> + <param index="0" name="idx" type="int" /> + <description> + On Windows, returns the name of the drive (partition) passed as an argument (e.g. [code]C:[/code]). + On macOS, returns the path to the mounted volume passed as an argument. + On Linux, returns the path to the mounted volume or GTK 3 bookmark passed as an argument. + On other platforms, or if the requested drive does not exist, the method returns an empty String. + </description> + </method> <method name="get_files"> <return type="PackedStringArray" /> <description> @@ -144,6 +175,14 @@ Affected by [member include_hidden]. </description> </method> + <method name="get_files_at" qualifiers="static"> + <return type="PackedStringArray" /> + <param index="0" name="path" type="String" /> + <description> + Returns a [PackedStringArray] containing filenames of the directory contents, excluding directories, at the given [param path]. The array is sorted alphabetically. + Use [method get_files] if you want more control of what gets included. + </description> + </method> <method name="get_next"> <return type="String" /> <description> @@ -185,6 +224,13 @@ Returns one of the [enum Error] code constants ([code]OK[/code] on success). </description> </method> + <method name="make_dir_absolute" qualifiers="static"> + <return type="int" enum="Error" /> + <param index="0" name="path" type="String" /> + <description> + Static version of [method make_dir]. Supports only absolute paths. + </description> + </method> <method name="make_dir_recursive"> <return type="int" enum="Error" /> <param index="0" name="path" type="String" /> @@ -193,6 +239,13 @@ Returns one of the [enum Error] code constants ([code]OK[/code] on success). </description> </method> + <method name="make_dir_recursive_absolute" qualifiers="static"> + <return type="int" enum="Error" /> + <param index="0" name="path" type="String" /> + <description> + Static version of [method make_dir_recursive]. Supports only absolute paths. + </description> + </method> <method name="open" qualifiers="static"> <return type="DirAccess" /> <param index="0" name="path" type="String" /> @@ -210,6 +263,13 @@ Returns one of the [enum Error] code constants ([code]OK[/code] on success). </description> </method> + <method name="remove_absolute" qualifiers="static"> + <return type="int" enum="Error" /> + <param index="0" name="path" type="String" /> + <description> + Static version of [method remove]. Supports only absolute paths. + </description> + </method> <method name="rename"> <return type="int" enum="Error" /> <param index="0" name="from" type="String" /> @@ -219,6 +279,14 @@ Returns one of the [enum Error] code constants ([code]OK[/code] on success). </description> </method> + <method name="rename_absolute" qualifiers="static"> + <return type="int" enum="Error" /> + <param index="0" name="from" type="String" /> + <param index="1" name="to" type="String" /> + <description> + Static version of [method rename]. Supports only absolute paths. + </description> + </method> </methods> <members> <member name="include_hidden" type="bool" setter="set_include_hidden" getter="get_include_hidden"> diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index d22d64c276..6d3f3a7362 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -1324,6 +1324,7 @@ <param index="0" name="window_id" type="int" /> <param index="1" name="parent_window_id" type="int" /> <description> + Sets window transient parent. Transient window is will be destroyed with its transient parent and displayed on top of non-exclusive full-screen parent window. Transient windows can't enter full-screen mode. </description> </method> <method name="window_set_vsync_mode"> @@ -1336,6 +1337,15 @@ Depending on the platform and used renderer, the engine will fall back to [constant VSYNC_ENABLED], if the desired mode is not supported. </description> </method> + <method name="window_set_window_buttons_offset"> + <return type="void" /> + <param index="0" name="offset" type="Vector2i" /> + <param index="1" name="window_id" type="int" default="0" /> + <description> + When [constant WINDOW_FLAG_EXTEND_TO_TITLE] flag is set, set offset to the center of the first titlebar button. + [b]Note:[/b] This flag is implemented on macOS. + </description> + </method> <method name="window_set_window_event_callback"> <return type="void" /> <param index="0" name="callback" type="Callable" /> @@ -1509,7 +1519,8 @@ Window is floating above other regular windows. This flag is ignored for full-screen windows. </constant> <constant name="WINDOW_FLAG_TRANSPARENT" value="3" enum="WindowFlags"> - Window is will be destroyed with its transient parent and displayed on top of non-exclusive full-screen parent window. Transient windows can't enter full-screen mode. + Window background can be transparent. + [b]Note:[/b] This flag has no effect if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code]. </constant> <constant name="WINDOW_FLAG_NO_FOCUS" value="4" enum="WindowFlags"> Window can't be focused. No-focus window will ignore all input, except mouse clicks. @@ -1537,6 +1548,8 @@ </constant> <constant name="WINDOW_EVENT_DPI_CHANGE" value="6" enum="WindowEvent"> </constant> + <constant name="WINDOW_EVENT_TITLEBAR_CHANGE" value="7" enum="WindowEvent"> + </constant> <constant name="VSYNC_DISABLED" value="0" enum="VSyncMode"> No vertical synchronization, which means the engine will display frames as fast as possible (tearing may be visible). </constant> diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index 348347c4ef..c395815117 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -9,7 +9,7 @@ Below is an example EditorImportPlugin that imports a [Mesh] from a file with the extension ".special" or ".spec": [codeblocks] [gdscript] - tool + @tool extends EditorImportPlugin func _get_importer_name(): @@ -44,7 +44,7 @@ # Fill the Mesh with data read in "file", left as an exercise to the reader. var filename = save_path + "." + _get_save_extension() - return ResourceSaver.save(filename, mesh) + return ResourceSaver.save(mesh, filename) [/gdscript] [csharp] using Godot; @@ -103,7 +103,7 @@ var mesh = new ArrayMesh(); // Fill the Mesh with data read in "file", left as an exercise to the reader. String filename = savePath + "." + GetSaveExtension(); - return (int)ResourceSaver.Save(filename, mesh); + return (int)ResourceSaver.Save(mesh, filename); } } [/csharp] diff --git a/doc/classes/EditorInspector.xml b/doc/classes/EditorInspector.xml index 280a7bf34a..a1a43dd5bf 100644 --- a/doc/classes/EditorInspector.xml +++ b/doc/classes/EditorInspector.xml @@ -13,6 +13,14 @@ </description> <tutorials> </tutorials> + <methods> + <method name="get_selected_path" qualifiers="const"> + <return type="String" /> + <description> + Gets the path of the currently selected property. + </description> + </method> + </methods> <members> <member name="horizontal_scroll_mode" type="int" setter="set_horizontal_scroll_mode" getter="get_horizontal_scroll_mode" overrides="ScrollContainer" enum="ScrollContainer.ScrollMode" default="0" /> </members> diff --git a/doc/classes/EditorScenePostImport.xml b/doc/classes/EditorScenePostImport.xml index 395b094bf2..2bf2accf17 100644 --- a/doc/classes/EditorScenePostImport.xml +++ b/doc/classes/EditorScenePostImport.xml @@ -8,7 +8,7 @@ The [method _post_import] callback receives the imported scene's root node and returns the modified version of the scene. Usage example: [codeblocks] [gdscript] - tool # Needed so it runs in editor. + @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. diff --git a/doc/classes/EditorScript.xml b/doc/classes/EditorScript.xml index 2ff8a7ba2a..dfc04c9cde 100644 --- a/doc/classes/EditorScript.xml +++ b/doc/classes/EditorScript.xml @@ -9,7 +9,7 @@ [b]Example script:[/b] [codeblocks] [gdscript] - tool + @tool extends EditorScript func _run(): diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 329cd3fe63..6007128965 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -405,7 +405,7 @@ If [code]true[/code], allows panning by holding down [kbd]Space[/kbd] in the 2D editor viewport (in addition to panning with the middle or right mouse buttons). If [code]false[/code], the left mouse button must be held down while holding down [kbd]Space[/kbd] to pan in the 2D editor viewport. </member> <member name="editors/panning/sub_editors_panning_scheme" type="int" setter="" getter=""> - Controls whether the mouse wheel scroll zooms or pans in subeditors. The list of affected subeditors is: animation blend tree editor, [Polygon2D] editor, tileset editor, texture region editor, visual shader editor and visual script editor. See also [member editors/panning/2d_editor_panning_scheme] and [member editors/panning/animation_editors_panning_scheme]. + Controls whether the mouse wheel scroll zooms or pans in subeditors. The list of affected subeditors is: animation blend tree editor, [Polygon2D] editor, tileset editor, texture region editor and visual shader editor. See also [member editors/panning/2d_editor_panning_scheme] and [member editors/panning/animation_editors_panning_scheme]. </member> <member name="editors/panning/warped_mouse_panning" type="bool" setter="" getter=""> If [code]true[/code], warps the mouse around the 2D viewport while panning in the 2D editor. This makes it possible to pan over a large area without having to exit panning then mouse the mouse back constantly. @@ -424,10 +424,10 @@ [b]Note:[/b] Only effective if [member editors/tiles_editor/display_grid] is [code]true[/code]. </member> <member name="editors/visual_editors/lines_curvature" type="float" setter="" getter=""> - The curvature to use for connection lines in the visual script and visual shader editors. Higher values will make connection lines appear more curved, with values above [code]0.5[/code] resulting in more "angular" turns in the middle of connection lines. + The curvature to use for connection lines in the visual shader editor. Higher values will make connection lines appear more curved, with values above [code]0.5[/code] resulting in more "angular" turns in the middle of connection lines. </member> <member name="editors/visual_editors/minimap_opacity" type="float" setter="" getter=""> - The opacity of the minimap displayed in the bottom-right corner of the visual script and visual shader editors. + The opacity of the minimap displayed in the bottom-right corner of the visual shader editor. </member> <member name="editors/visual_editors/visual_shader/port_preview_size" type="int" setter="" getter=""> The size to use for port previews in the visual shader uniforms (toggled by clicking the "eye" icon next to an output). The value is defined in pixels at 100% zoom, and will scale with zoom automatically. diff --git a/doc/classes/EditorTranslationParserPlugin.xml b/doc/classes/EditorTranslationParserPlugin.xml index 08986781cd..df10c645ef 100644 --- a/doc/classes/EditorTranslationParserPlugin.xml +++ b/doc/classes/EditorTranslationParserPlugin.xml @@ -11,7 +11,7 @@ Below shows an example of a custom parser that extracts strings from a CSV file to write into a POT. [codeblocks] [gdscript] - tool + @tool extends EditorTranslationParserPlugin func _parse_file(path, msgids, msgids_context_plural): diff --git a/doc/classes/Engine.xml b/doc/classes/Engine.xml index 301a3e55fb..ecf3d87a70 100644 --- a/doc/classes/Engine.xml +++ b/doc/classes/Engine.xml @@ -14,12 +14,20 @@ <description> Returns the name of the CPU architecture the Godot binary was built for. Possible return values are [code]x86_64[/code], [code]x86_32[/code], [code]arm64[/code], [code]armv7[/code], [code]rv64[/code], [code]riscv[/code], [code]ppc64[/code], [code]ppc[/code], [code]wasm64[/code] and [code]wasm32[/code]. To detect whether the current CPU architecture is 64-bit, you can use the fact that all 64-bit architecture names have [code]64[/code] in their name: - [codeblock] + [codeblocks] + [gdscript] if "64" in Engine.get_architecture_name(): print("Running on 64-bit CPU.") else: print("Running on 32-bit CPU.") - [/codeblock] + [/gdscript] + [csharp] + if (Engine.GetArchitectureName().Contains("64")) + GD.Print("Running on 64-bit CPU."); + else + GD.Print("Running on 32-bit CPU."); + [/csharp] + [/codeblocks] [b]Note:[/b] [method get_architecture_name] does [i]not[/i] return the name of the host CPU architecture. For example, if running an x86_32 Godot binary on a x86_64 system, the returned value will be [code]x86_32[/code]. </description> </method> @@ -83,11 +91,24 @@ <description> Returns the total number of frames passed since engine initialization which is advanced on each [b]physics frame[/b]. See also [method get_process_frames]. [method get_physics_frames] can be used to run expensive logic less often without relying on a [Timer]: - [codeblock] + [codeblocks] + [gdscript] func _physics_process(_delta): if Engine.get_physics_frames() % 2 == 0: pass # Run expensive logic only once every 2 physics frames here. - [/codeblock] + [/gdscript] + [csharp] + public override void _PhysicsProcess(double delta) + { + base._PhysicsProcess(delta); + + if (Engine.GetPhysicsFrames() % 2 == 0) + { + // Run expensive logic only once every 2 physics frames here. + } + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_physics_interpolation_fraction" qualifiers="const"> @@ -101,11 +122,24 @@ <description> Returns the total number of frames passed since engine initialization which is advanced on each [b]process frame[/b], regardless of whether the render loop is enabled. See also [method get_frames_drawn] and [method get_physics_frames]. [method get_process_frames] can be used to run expensive logic less often without relying on a [Timer]: - [codeblock] + [codeblocks] + [gdscript] func _process(_delta): if Engine.get_process_frames() % 2 == 0: pass # Run expensive logic only once every 2 process (render) frames here. - [/codeblock] + [/gdscript] + [csharp] + public override void _Process(double delta) + { + base._Process(delta); + + if (Engine.GetProcessFrames() % 2 == 0) + { + // Run expensive logic only once every 2 physics frames here. + } + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_script_language" qualifiers="const"> @@ -182,12 +216,20 @@ <return type="bool" /> <description> Returns [code]true[/code] if the script is currently running inside the editor, [code]false[/code] otherwise. This is useful for [code]@tool[/code] scripts to conditionally draw editor helpers, or prevent accidentally running "game" code that would affect the scene state while in the editor: - [codeblock] + [codeblocks] + [gdscript] if Engine.is_editor_hint(): draw_gizmos() else: simulate_physics() - [/codeblock] + [/gdscript] + [csharp] + if (Engine.IsEditorHint()) + DrawGizmos(); + else + SimulatePhysics(); + [/csharp] + [/codeblocks] See [url=$DOCS_URL/tutorials/plugins/running_code_in_the_editor.html]Running code in the editor[/url] in the documentation for more information. [b]Note:[/b] To detect whether the script is run from an editor [i]build[/i] (e.g. when pressing [kbd]F5[/kbd]), use [method OS.has_feature] with the [code]"editor"[/code] argument instead. [code]OS.has_feature("editor")[/code] will evaluate to [code]true[/code] both when the code is running in the editor and when running the project from the editor, but it will evaluate to [code]false[/code] when the code is run from an exported project. </description> diff --git a/doc/classes/FileAccess.xml b/doc/classes/FileAccess.xml index 61377fb13a..adc0f4c3dd 100644 --- a/doc/classes/FileAccess.xml +++ b/doc/classes/FileAccess.xml @@ -20,24 +20,30 @@ [csharp] public void Save(string content) { - var file = FileAccess.Open("user://save_game.dat", File.ModeFlags.Write); + using var file = FileAccess.Open("user://save_game.dat", File.ModeFlags.Write); file.StoreString(content); } public string Load() { - var file = FileAccess.Open("user://save_game.dat", File.ModeFlags.Read); + using var file = FileAccess.Open("user://save_game.dat", File.ModeFlags.Read); string content = file.GetAsText(); return content; } [/csharp] [/codeblocks] In the example above, the file will be saved in the user data folder as specified in the [url=$DOCS_URL/tutorials/io/data_paths.html]Data paths[/url] documentation. - There is no method to close a file in order to free it from use. Instead, [FileAccess] will close when it's freed, which happens when it goes out of scope or when it gets assigned with [code]null[/code]. - [codeblock] + There is no method to close a file in order to free it from use. Instead, [FileAccess] will close when it's freed, which happens when it goes out of scope or when it gets assigned with [code]null[/code]. In C# the reference must be disposed after we are done using it, this can be done with the [code]using[/code] statement or calling the [code]Dispose[/code] method directly. + [codeblocks] + [gdscript] var file = FileAccess.open("res://something") # File is opened and locked for use. file = null # File is closed. - [/codeblock] + [/gdscript] + [csharp] + using var file = FileAccess.Open("res://something"); // File is opened and locked for use. + // The using statement calls Dispose when going out of scope. + [/csharp] + [/codeblocks] [b]Note:[/b] To access project resources once exported, it is recommended to use [ResourceLoader] instead of the [FileAccess] API, as some files are converted to engine-specific formats and their original source files might not be present in the exported PCK package. [b]Note:[/b] Files are automatically closed only if the process exits "normally" (such as by clicking the window manager's close button or pressing [b]Alt + F4[/b]). If you stop the project execution by pressing [b]F8[/b] while the project is running, the file won't be closed as the game process will be killed. You can work around this by calling [method flush] at regular intervals. </description> @@ -71,6 +77,7 @@ <description> Returns [code]true[/code] if the file exists in the given path. [b]Note:[/b] Many resources types are imported (e.g. textures or sound files), and their source asset will not be included in the exported game, as only the imported version is used. See [method ResourceLoader.exists] for an alternative approach that takes resource remapping into account. + For a non-static, relative equivalent, use [method DirAccess.file_exists]. </description> </method> <method name="flush"> diff --git a/doc/classes/Font.xml b/doc/classes/Font.xml index ad3a16afbb..6a42b62bcf 100644 --- a/doc/classes/Font.xml +++ b/doc/classes/Font.xml @@ -228,9 +228,15 @@ <description> Returns the size of a bounding box of a single-line string, taking kerning and advance into account. See also [method get_multiline_string_size] and [method draw_string]. For example, to get the string size as displayed by a single-line Label, use: - [codeblock] + [codeblocks] + [gdscript] var string_size = $Label.get_theme_font("font").get_string_size($Label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, $Label.get_theme_font_size("font_size")) - [/codeblock] + [/gdscript] + [csharp] + Label label = GetNode<Label>("Label"); + Vector2 stringSize = label.GetThemeFont("font").GetStringSize(label.Text, HorizontalAlignment.Left, -1, label.GetThemeFontSize("font_size")); + [/csharp] + [/codeblocks] [b]Note:[/b] Real height of the string is context-dependent and can be significantly different from the value returned by [method get_height]. </description> </method> diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml index e613ab1a55..0142018f1a 100644 --- a/doc/classes/Geometry2D.xml +++ b/doc/classes/Geometry2D.xml @@ -33,6 +33,13 @@ Given an array of [Vector2]s, returns the convex hull as a list of points in counterclockwise order. The last point is the same as the first one. </description> </method> + <method name="decompose_polygon_in_convex"> + <return type="PackedVector2Array[]" /> + <param index="0" name="polygon" type="PackedVector2Array" /> + <description> + Decomposes the [param polygon] into multiple convex hulls and returns an array of [PackedVector2Array]. + </description> + </method> <method name="exclude_polygons"> <return type="PackedVector2Array[]" /> <param index="0" name="polygon_a" type="PackedVector2Array" /> diff --git a/doc/classes/ImageFormatLoader.xml b/doc/classes/ImageFormatLoader.xml new file mode 100644 index 0000000000..c6b1ec922a --- /dev/null +++ b/doc/classes/ImageFormatLoader.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ImageFormatLoader" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Base class to add support for specific image formats. + </brief_description> + <description> + The engine supports multiple image formats out of the box (PNG, SVG, JPEG, WebP to name a few), but you can choose to implement support for additional image formats by extending [ImageFormatLoaderExtension]. + </description> + <tutorials> + </tutorials> + <constants> + <constant name="FLAG_NONE" value="0" enum="LoaderFlags" is_bitfield="true"> + </constant> + <constant name="FLAG_FORCE_LINEAR" value="1" enum="LoaderFlags" is_bitfield="true"> + </constant> + <constant name="FLAG_CONVERT_COLORS" value="2" enum="LoaderFlags" is_bitfield="true"> + </constant> + </constants> +</class> diff --git a/doc/classes/ImageFormatLoaderExtension.xml b/doc/classes/ImageFormatLoaderExtension.xml new file mode 100644 index 0000000000..b2a7ebc60f --- /dev/null +++ b/doc/classes/ImageFormatLoaderExtension.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="ImageFormatLoaderExtension" inherits="ImageFormatLoader" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Base class for creating [ImageFormatLoader] extensions (adding support for extra image formats). + </brief_description> + <description> + The engine supports multiple image formats out of the box (PNG, SVG, JPEG, WebP to name a few), but you can choose to implement support for additional image formats by extending this class. + Be sure to respect the documented return types and values. You should create an instance of it, and call [method add_format_loader] to register that loader during the initializaiton phase. + </description> + <tutorials> + </tutorials> + <methods> + <method name="_get_recognized_extensions" qualifiers="virtual const"> + <return type="PackedStringArray" /> + <description> + Returns the list of file extensions for this image format. Files with the given extentions will be treated as image file and loaded using this class. + </description> + </method> + <method name="_load_image" qualifiers="virtual"> + <return type="int" enum="Error" /> + <param index="0" name="image" type="Image" /> + <param index="1" name="fileaccess" type="FileAccess" /> + <param index="2" name="flags" type="int" enum="ImageFormatLoader.LoaderFlags" /> + <param index="3" name="scale" type="float" /> + <description> + Loads the content of [param fileaccess] into the provided [param image]. + </description> + </method> + <method name="add_format_loader"> + <return type="void" /> + <description> + Add this format loader to the engine, allowing it to recognize the file extensions returned by [method _get_recognized_extensions]. + </description> + </method> + <method name="remove_format_loader"> + <return type="void" /> + <description> + Remove this format loader from the engine. + </description> + </method> + </methods> +</class> diff --git a/doc/classes/JSON.xml b/doc/classes/JSON.xml index 38ddca2727..125d016632 100644 --- a/doc/classes/JSON.xml +++ b/doc/classes/JSON.xml @@ -28,6 +28,11 @@ [codeblock] var data = JSON.parse_string(json_string) # Returns null if parsing failed. [/codeblock] + [b]Note:[/b] Both parse methods do not fully comply with the JSON specification: + - Trailing commas in arrays or objects are ignored, instead of causing a parser error. + - New line and tab characters are accepted in string literals, and are treated like their corresponding escape sequences [code]\n[/code] and [code]\t[/code]. + - Numbers are parsed using [method String.to_float] which is generally more lax than the JSON specification. + - Certain errors, such as invalid Unicode sequences, do not cause a parser error. Instead, the string is cleansed and an error is logged to the console. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationPathQueryParameters2D.xml b/doc/classes/NavigationPathQueryParameters2D.xml new file mode 100644 index 0000000000..364f495a72 --- /dev/null +++ b/doc/classes/NavigationPathQueryParameters2D.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationPathQueryParameters2D" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Parameters to be sent to a 2D navigation path query. + </brief_description> + <description> + This class contains the start and target position and other parameters to be used with [method NavigationServer2D.query_path]. + </description> + <tutorials> + </tutorials> + <members> + <member name="map" type="RID" setter="set_map" getter="get_map"> + The navigation [code]map[/code] [RID] used in the path query. + </member> + <member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1"> + The navigation layers the query will use (as a bitmask). + </member> + <member name="path_postprocessing" type="int" setter="set_path_postprocessing" getter="get_path_postprocessing" enum="NavigationPathQueryParameters2D.PathPostProcessing" default="0"> + The path postprocessing applied to the raw path corridor found by the [member pathfinding_algorithm]. + </member> + <member name="pathfinding_algorithm" type="int" setter="set_pathfinding_algorithm" getter="get_pathfinding_algorithm" enum="NavigationPathQueryParameters2D.PathfindingAlgorithm" default="0"> + The pathfinding algorithm used in the path query. + </member> + <member name="start_position" type="Vector2" setter="set_start_position" getter="get_start_position" default="Vector2(0, 0)"> + The pathfinding start position in global coordinates. + </member> + <member name="target_position" type="Vector2" setter="set_target_position" getter="get_target_position" default="Vector2(0, 0)"> + The pathfinding target position in global coordinates. + </member> + </members> + <constants> + <constant name="PATHFINDING_ALGORITHM_ASTAR" value="0" enum="PathfindingAlgorithm"> + The path query uses the default A* pathfinding algorithm. + </constant> + <constant name="PATH_POSTPROCESSING_CORRIDORFUNNEL" value="0" enum="PathPostProcessing"> + Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navmesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artifical corners with diagonal movement due to a jagged path corridor imposed by the cell shapes. + </constant> + <constant name="PATH_POSTPROCESSING_EDGECENTERED" value="1" enum="PathPostProcessing"> + Centers every path position in the middle of the traveled navmesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center. + </constant> + </constants> +</class> diff --git a/doc/classes/NavigationPathQueryParameters3D.xml b/doc/classes/NavigationPathQueryParameters3D.xml new file mode 100644 index 0000000000..59c907c5b5 --- /dev/null +++ b/doc/classes/NavigationPathQueryParameters3D.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationPathQueryParameters3D" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Parameters to be sent to a 3D navigation path query. + </brief_description> + <description> + This class contains the start and target position and other parameters to be used with [method NavigationServer3D.query_path]. + </description> + <tutorials> + </tutorials> + <members> + <member name="map" type="RID" setter="set_map" getter="get_map"> + The navigation [code]map[/code] [RID] used in the path query. + </member> + <member name="navigation_layers" type="int" setter="set_navigation_layers" getter="get_navigation_layers" default="1"> + The navigation layers the query will use (as a bitmask). + </member> + <member name="path_postprocessing" type="int" setter="set_path_postprocessing" getter="get_path_postprocessing" enum="NavigationPathQueryParameters3D.PathPostProcessing" default="0"> + The path postprocessing applied to the raw path corridor found by the [member pathfinding_algorithm]. + </member> + <member name="pathfinding_algorithm" type="int" setter="set_pathfinding_algorithm" getter="get_pathfinding_algorithm" enum="NavigationPathQueryParameters3D.PathfindingAlgorithm" default="0"> + The pathfinding algorithm used in the path query. + </member> + <member name="start_position" type="Vector3" setter="set_start_position" getter="get_start_position" default="Vector3(0, 0, 0)"> + The pathfinding start position in global coordinates. + </member> + <member name="target_position" type="Vector3" setter="set_target_position" getter="get_target_position" default="Vector3(0, 0, 0)"> + The pathfinding target position in global coordinates. + </member> + </members> + <constants> + <constant name="PATHFINDING_ALGORITHM_ASTAR" value="0" enum="PathfindingAlgorithm"> + The path query uses the default A* pathfinding algorithm. + </constant> + <constant name="PATH_POSTPROCESSING_CORRIDORFUNNEL" value="0" enum="PathPostProcessing"> + Applies a funnel algorithm to the raw path corridor found by the pathfinding algorithm. This will result in the shortest path possible inside the path corridor. This postprocessing very much depends on the navmesh polygon layout and the created corridor. Especially tile- or gridbased layouts can face artifical corners with diagonal movement due to a jagged path corridor imposed by the cell shapes. + </constant> + <constant name="PATH_POSTPROCESSING_EDGECENTERED" value="1" enum="PathPostProcessing"> + Centers every path position in the middle of the traveled navmesh polygon edge. This creates better paths for tile- or gridbased layouts that restrict the movement to the cells center. + </constant> + </constants> +</class> diff --git a/doc/classes/NavigationPathQueryResult2D.xml b/doc/classes/NavigationPathQueryResult2D.xml new file mode 100644 index 0000000000..95b90e9383 --- /dev/null +++ b/doc/classes/NavigationPathQueryResult2D.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationPathQueryResult2D" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Result from a [NavigationPathQueryParameters2D] navigation path query. + </brief_description> + <description> + This class contains the result of a navigation path query from [method NavigationServer2D.query_path]. + </description> + <tutorials> + </tutorials> + <methods> + <method name="reset"> + <return type="void" /> + <description> + Reset the result object to its initial state. This is useful to reuse the object across multiple queries. + </description> + </method> + </methods> + <members> + <member name="path" type="PackedVector2Array" setter="set_path" getter="get_path" default="PackedVector2Array()"> + The resulting path array from the navigation query. All path array positions are in global coordinates. Without customized query parameters this is the same path as returned by [method NavigationServer2D.map_get_path]. + </member> + </members> +</class> diff --git a/doc/classes/NavigationPathQueryResult3D.xml b/doc/classes/NavigationPathQueryResult3D.xml new file mode 100644 index 0000000000..b4ca8288db --- /dev/null +++ b/doc/classes/NavigationPathQueryResult3D.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="NavigationPathQueryResult3D" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Result from a [NavigationPathQueryParameters3D] navigation path query. + </brief_description> + <description> + This class contains the result of a navigation path query from [method NavigationServer3D.query_path]. + </description> + <tutorials> + </tutorials> + <methods> + <method name="reset"> + <return type="void" /> + <description> + Reset the result object to its initial state. This is useful to reuse the object across multiple queries. + </description> + </method> + </methods> + <members> + <member name="path" type="PackedVector3Array" setter="set_path" getter="get_path" default="PackedVector3Array()"> + The resulting path array from the navigation query. All path array positions are in global coordinates. Without customized query parameters this is the same path as returned by [method NavigationServer3D.map_get_path]. + </member> + </members> +</class> diff --git a/doc/classes/NavigationRegion2D.xml b/doc/classes/NavigationRegion2D.xml index 89f7dcb4af..0f28081201 100644 --- a/doc/classes/NavigationRegion2D.xml +++ b/doc/classes/NavigationRegion2D.xml @@ -10,6 +10,7 @@ The pathfinding cost of entering this region from another region can be controlled with the [member enter_cost] value. [b]Note:[/b] This value is not added to the path cost when the start position is already inside this region. The pathfinding cost of traveling distances inside this region can be controlled with the [member travel_cost] multiplier. + [b]Note:[/b] This node caches changes to its properties, so if you make changes to the underlying region [RID] in [NavigationServer2D], they will not be reflected in this node's properties. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationRegion3D.xml b/doc/classes/NavigationRegion3D.xml index 87e82e7b2e..85f163b3c2 100644 --- a/doc/classes/NavigationRegion3D.xml +++ b/doc/classes/NavigationRegion3D.xml @@ -10,6 +10,7 @@ The cost of entering this region from another region can be controlled with the [member enter_cost] value. [b]Note:[/b] This value is not added to the path cost when the start position is already inside this region. The cost of traveling distances inside this region can be controlled with the [member travel_cost] multiplier. + [b]Note:[/b] This node caches changes to its properties, so if you make changes to the underlying region [RID] in [NavigationServer3D], they will not be reflected in this node's properties. </description> <tutorials> </tutorials> diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index 0874e183e4..981ab8a5e1 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -368,6 +368,14 @@ Set the map's link connection radius used to connect links to navigation polygons. </description> </method> + <method name="query_path" qualifiers="const"> + <return type="void" /> + <param index="0" name="parameters" type="NavigationPathQueryParameters2D" /> + <param index="1" name="result" type="NavigationPathQueryResult2D" /> + <description> + Queries a path in a given navigation map. Start and target position and other parameters are defined through [NavigationPathQueryParameters2D]. Updates the provided [NavigationPathQueryResult2D] result object with the path among other results requested by the query. + </description> + </method> <method name="region_create" qualifiers="const"> <return type="RID" /> <description> diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 255f2a902c..943aa03ef7 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -410,6 +410,14 @@ [b]Note:[/b] This function is not thread safe. </description> </method> + <method name="query_path" qualifiers="const"> + <return type="void" /> + <param index="0" name="parameters" type="NavigationPathQueryParameters3D" /> + <param index="1" name="result" type="NavigationPathQueryResult3D" /> + <description> + Queries a path in a given navigation map. Start and target position and other parameters are defined through [NavigationPathQueryParameters3D]. Updates the provided [NavigationPathQueryResult3D] result object with the path among other results requested by the query. + </description> + </method> <method name="region_bake_navmesh" qualifiers="const"> <return type="void" /> <param index="0" name="mesh" type="NavigationMesh" /> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index d8ad65082f..d9732da3a3 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -179,9 +179,14 @@ <return type="Tween" /> <description> Creates a new [Tween] and binds it to this node. This is equivalent of doing: - [codeblock] + [codeblocks] + [gdscript] get_tree().create_tween().bind_node(self) - [/codeblock] + [/gdscript] + [csharp] + GetTree().CreateTween().BindNode(this); + [/csharp] + [/codeblocks] </description> </method> <method name="duplicate" qualifiers="const"> @@ -267,13 +272,24 @@ Returns an array listing the groups that the node is a member of. [b]Note:[/b] For performance reasons, the order of node groups is [i]not[/i] guaranteed. The order of node groups should not be relied upon as it can vary across project runs. [b]Note:[/b] The engine uses some group names internally (all starting with an underscore). To avoid conflicts with internal groups, do not add custom groups whose name starts with an underscore. To exclude internal groups while looping over [method get_groups], use the following snippet: - [codeblock] + [codeblocks] + [gdscript] # Stores the node's non-internal groups only (as an array of Strings). var non_internal_groups = [] for group in get_groups(): if not group.begins_with("_"): non_internal_groups.push_back(group) - [/codeblock] + [/gdscript] + [csharp] + // Stores the node's non-internal groups only (as a List of strings). + List<string> nonInternalGroups = new List<string>(); + foreach (string group in GetGroups()) + { + if (!group.BeginsWith("_")) + nonInternalGroups.Add(group); + } + [/csharp] + [/codeblocks] </description> </method> <method name="get_index" qualifiers="const"> diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index 96ce10745d..3df7ec931f 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -116,7 +116,7 @@ Rotates the node so that the local forward axis (-Z) points toward the [param target] position. The local up axis (+Y) points as close to the [param up] vector as possible while staying perpendicular to the local forward axis. The resulting transform is orthogonal, and the scale is preserved. Non-uniform scaling may not work correctly. The [param target] position cannot be the same as the node's position, the [param up] vector cannot be zero, and the direction from the node's position to the [param target] vector cannot be parallel to the [param up] vector. - Operations take place in global space. + Operations take place in global space, which means that the node must be in the scene tree. </description> </method> <method name="look_at_from_position"> diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index d920c45de4..313f3ab6db 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -523,12 +523,18 @@ <param index="0" name="path" type="String" /> <description> Moves the file or directory to the system's recycle bin. See also [method DirAccess.remove]. - The method takes only global paths, so you may need to use [method ProjectSettings.globalize_path]. Do not use it for files in [code]res://[/code] as it will not work in exported project. + The method takes only global paths, so you may need to use [method ProjectSettings.globalize_path]. Do not use it for files in [code]res://[/code] as it will not work in exported projects. [b]Note:[/b] If the user has disabled the recycle bin on their system, the file will be permanently deleted instead. - [codeblock] + [codeblocks] + [gdscript] var file_to_remove = "user://slot1.sav" OS.move_to_trash(ProjectSettings.globalize_path(file_to_remove)) - [/codeblock] + [/gdscript] + [csharp] + var fileToRemove = "user://slot1.sav"; + OS.MoveToTrash(ProjectSettings.GlobalizePath(fileToRemove)); + [/csharp] + [/codeblocks] </description> </method> <method name="open_midi_inputs"> diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml index 97595a6984..7ca1d5d60d 100644 --- a/doc/classes/PackedScene.xml +++ b/doc/classes/PackedScene.xml @@ -41,7 +41,7 @@ # Only `node` and `body` are now packed. var result = scene.pack(node) if result == OK: - var error = ResourceSaver.save("res://path/name.tscn", scene) # Or "user://..." + var error = ResourceSaver.save(scene, "res://path/name.tscn") # Or "user://..." if error != OK: push_error("An error occurred while saving the scene to disk.") [/gdscript] @@ -63,7 +63,7 @@ Error result = scene.Pack(node); if (result == Error.Ok) { - Error error = ResourceSaver.Save("res://path/name.tscn", scene); // Or "user://..." + Error error = ResourceSaver.Save(scene, "res://path/name.tscn"); // Or "user://..." if (error != Error.Ok) { GD.PushError("An error occurred while saving the scene to disk."); diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index 4b588033c0..18ac8a11df 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -53,6 +53,20 @@ <description> </description> </method> + <method name="area_get_collision_layer" qualifiers="const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + Returns the physics layer or layers an area belongs to. + </description> + </method> + <method name="area_get_collision_mask" qualifiers="const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + Returns the physics layer or layers an area can contact with. + </description> + </method> <method name="area_get_object_instance_id" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> diff --git a/doc/classes/PhysicsServer2DExtension.xml b/doc/classes/PhysicsServer2DExtension.xml index a63aa8a30f..9bb11e0d89 100644 --- a/doc/classes/PhysicsServer2DExtension.xml +++ b/doc/classes/PhysicsServer2DExtension.xml @@ -47,6 +47,18 @@ <description> </description> </method> + <method name="_area_get_collision_layer" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + </description> + </method> + <method name="_area_get_collision_mask" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + </description> + </method> <method name="_area_get_object_instance_id" qualifiers="virtual const"> <return type="int" /> <param index="0" name="area" type="RID" /> @@ -602,7 +614,7 @@ <method name="_body_set_state_sync_callback" qualifiers="virtual"> <return type="void" /> <param index="0" name="body" type="RID" /> - <param index="1" name="callback" type="PhysicsServer2DExtensionStateCallback*" /> + <param index="1" name="callable" type="Callable" /> <description> </description> </method> diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index da9e10c420..95f7fb69a2 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -40,6 +40,20 @@ Creates an [Area3D]. </description> </method> + <method name="area_get_collision_layer" qualifiers="const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + Returns the physics layer or layers an area belongs to. + </description> + </method> + <method name="area_get_collision_mask" qualifiers="const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + Returns the physics layer or layers an area can contact with. + </description> + </method> <method name="area_get_object_instance_id" qualifiers="const"> <return type="int" /> <param index="0" name="area" type="RID" /> diff --git a/doc/classes/PhysicsServer3DExtension.xml b/doc/classes/PhysicsServer3DExtension.xml index f42276ddd8..1e9df54de5 100644 --- a/doc/classes/PhysicsServer3DExtension.xml +++ b/doc/classes/PhysicsServer3DExtension.xml @@ -34,6 +34,18 @@ <description> </description> </method> + <method name="_area_get_collision_layer" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + </description> + </method> + <method name="_area_get_collision_mask" qualifiers="virtual const"> + <return type="int" /> + <param index="0" name="area" type="RID" /> + <description> + </description> + </method> <method name="_area_get_object_instance_id" qualifiers="virtual const"> <return type="int" /> <param index="0" name="area" type="RID" /> @@ -575,7 +587,7 @@ <method name="_body_set_state_sync_callback" qualifiers="virtual"> <return type="void" /> <param index="0" name="body" type="RID" /> - <param index="1" name="callback" type="PhysicsServer3DExtensionStateCallback*" /> + <param index="1" name="callable" type="Callable" /> <description> </description> </method> diff --git a/doc/classes/PlaneMesh.xml b/doc/classes/PlaneMesh.xml index 564b6fe743..1dceac70b0 100644 --- a/doc/classes/PlaneMesh.xml +++ b/doc/classes/PlaneMesh.xml @@ -31,10 +31,10 @@ [PlaneMesh] will face the positive X-axis. </constant> <constant name="FACE_Y" value="1" enum="Orientation"> - [PlaneMesh] will face the positive Y-axis. This matches the behaviour of the [PlaneMesh] in Godot 3.x. + [PlaneMesh] will face the positive Y-axis. This matches the behavior of the [PlaneMesh] in Godot 3.x. </constant> <constant name="FACE_Z" value="2" enum="Orientation"> - [PlaneMesh] will face the positive Z-axis. This matches the behvaiour of the QuadMesh in Godot 3.x. + [PlaneMesh] will face the positive Z-axis. This matches the behavior of the QuadMesh in Godot 3.x. </constant> </constants> </class> diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 7c0ce656ab..6b8e077fad 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -571,15 +571,25 @@ Forces the main window to be borderless. [b]Note:[/b] This setting is ignored on iOS, Android, and Web. </member> - <member name="display/window/size/fullscreen" type="bool" setter="" getter="" default="false"> - Sets the main window to full screen when the project starts. Note that this is not [i]exclusive[/i] fullscreen. On Windows and Linux, a borderless window is used to emulate fullscreen. On macOS, a new desktop is used to display the running project. - Regardless of the platform, enabling fullscreen will change the window size to match the monitor's size. Therefore, make sure your project supports [url=$DOCS_URL/tutorials/rendering/multiple_resolutions.html]multiple resolutions[/url] when enabling fullscreen mode. - [b]Note:[/b] This setting is ignored on iOS, Android, and Web. + <member name="display/window/size/extend_to_title" type="bool" setter="" getter="" default="false"> + Main window content is expanded to the full size of the window. Unlike borderless window, the frame is left intact and can be used to resize the window, title bar is transparent, but have minimize/maximize/close buttons. + [b]Note:[/b] This setting is implemented on macOS. + </member> + <member name="display/window/size/mode" type="int" setter="" getter="" default="0"> + Main window mode. See [enum DisplayServer.WindowMode] for possible values and how each mode behaves. + </member> + <member name="display/window/size/no_focus" type="bool" setter="" getter="" default="false"> + Main window can't be focused. No-focus window will ignore all input, except mouse clicks. </member> <member name="display/window/size/resizable" type="bool" setter="" getter="" default="true"> Allows the window to be resizable by default. [b]Note:[/b] This setting is ignored on iOS. </member> + <member name="display/window/size/transparent" type="bool" setter="" getter="" default="false"> + Main window background can be transparent. + [b]Note:[/b] To use transparent splash screen, set [member application/boot_splash/bg_color] to [code]Color(0, 0, 0, 0)[/code]. + [b]Note:[/b] This setting has no effect if [member display/window/per_pixel_transparency/allowed] is set to [code]false[/code]. + </member> <member name="display/window/size/viewport_height" type="int" setter="" getter="" default="648"> Sets the game's main viewport height. On desktop platforms, this is also the initial window height, represented by an indigo-colored rectangle in the 2D editor. Stretch mode settings also use this as a reference when using the [code]canvas_items[/code] or [code]viewport[/code] stretch modes. See also [member display/window/size/viewport_width], [member display/window/size/window_width_override] and [member display/window/size/window_height_override]. </member> @@ -1714,13 +1724,6 @@ If [code]true[/code], performs a previous depth pass before rendering 3D materials. This increases performance significantly in scenes with high overdraw, when complex materials and lighting are used. However, in scenes with few occluded surfaces, the depth prepass may reduce performance. If your game is viewed from a fixed angle that makes it easy to avoid overdraw (such as top-down or side-scrolling perspective), consider disabling the depth prepass to improve performance. This setting can be changed at run-time to optimize performance depending on the scene currently being viewed. [b]Note:[/b] Only supported when using the Vulkan Clustered backend or the OpenGL backend. When using Vulkan Mobile there is no depth prepass performed. </member> - <member name="rendering/driver/driver_name" type="String" setter="" getter="" default=""vulkan""> - The video driver to use. - [b]Note:[/b] OpenGL support is currently incomplete. Only basic rendering is supported. - [b]Note:[/b] The backend in use can be overridden at runtime via the [code]--rendering-driver[/code] command line argument. - [b]FIXME:[/b] No longer valid after DisplayServer split: - In such cases, this property is not updated, so use [code]OS.get_current_video_driver[/code] to query it at run-time. - </member> <member name="rendering/driver/threads/thread_model" type="int" setter="" getter="" default="1"> Thread model for rendering. Rendering on a thread can vastly improve performance, but synchronizing to the main thread can cause a bit more jitter. </member> @@ -1796,6 +1799,27 @@ <member name="rendering/environment/volumetric_fog/volume_size" type="int" setter="" getter="" default="64"> Base size used to determine size of froxel buffer in the camera X-axis and Y-axis. The final size is scaled by the aspect ratio of the screen, so actual values may differ from what is set. Set a larger size for more detailed fog, set a smaller size for better performance. </member> + <member name="rendering/gl_compatibility/driver" type="String" setter="" getter="" default=""opengl3""> + Sets the driver to be used by the renderer when using the Compatibility renderer. This property can not be edited directly, instead, set the driver using the platform-specific overrides. + </member> + <member name="rendering/gl_compatibility/driver.android" type="String" setter="" getter="" default=""opengl3""> + Android override for [member rendering/gl_compatibility/driver]. + </member> + <member name="rendering/gl_compatibility/driver.ios" type="String" setter="" getter="" default=""opengl3""> + iOS override for [member rendering/gl_compatibility/driver]. + </member> + <member name="rendering/gl_compatibility/driver.linuxbsd" type="String" setter="" getter="" default=""opengl3""> + LinuxBSD override for [member rendering/gl_compatibility/driver]. + </member> + <member name="rendering/gl_compatibility/driver.macos" type="String" setter="" getter="" default=""opengl3""> + macOS override for [member rendering/gl_compatibility/driver]. + </member> + <member name="rendering/gl_compatibility/driver.web" type="String" setter="" getter="" default=""opengl3""> + Web override for [member rendering/gl_compatibility/driver]. + </member> + <member name="rendering/gl_compatibility/driver.windows" type="String" setter="" getter="" default=""opengl3""> + Windows override for [member rendering/gl_compatibility/driver]. + </member> <member name="rendering/global_illumination/gi/use_half_resolution" type="bool" setter="" getter="" default="false"> If [code]true[/code], renders [VoxelGI] and SDFGI ([member Environment.sdfgi_enabled]) buffers at halved resolution (e.g. 960×540 when the viewport size is 1920×1080). This improves performance significantly when VoxelGI or SDFGI is enabled, at the cost of artifacts that may be visible on polygon edges. The loss in quality becomes less noticeable as the viewport resolution increases. [LightmapGI] rendering is not affected by this setting. [b]Note:[/b] This property is only read when the project starts. To set half-resolution GI at run-time, call [method RenderingServer.gi_set_use_half_resolution] instead. @@ -1956,6 +1980,44 @@ <member name="rendering/reflections/sky_reflections/texture_array_reflections.mobile" type="bool" setter="" getter="" default="false"> Lower-end override for [member rendering/reflections/sky_reflections/texture_array_reflections] on mobile devices, due to performance concerns or driver support. </member> + <member name="rendering/renderer/rendering_method" type="String" setter="" getter="" default=""forward_plus""> + Sets the renderer that will be used by the project. Options are: + [b]Clustered[/b]: High-end renderer designed for Desktop devices. Has a higher base overhead, but scales well with complex scenes. Not suitable for older devices or mobile. + [b]Mobile[/b]: Modern renderer designed for mobile devices. Has a lower base overhead than Clustered, but does not scale as well to large scenes with many elements. + [b]Compatibility[/b]: Low-end renderer designed for older devices. Based on the limitations of the OpenGL 3.3/ OpenGL ES 3.0 / WebGL 2 APIs. + </member> + <member name="rendering/renderer/rendering_method.mobile" type="String" setter="" getter="" default=""mobile""> + Override for [member rendering/renderer/rendering_method] on mobile devices. + </member> + <member name="rendering/renderer/rendering_method.web" type="String" setter="" getter="" default=""gl_compatibility""> + Override for [member rendering/renderer/rendering_method] on web. + </member> + <member name="rendering/rendering_device/descriptor_pools/max_descriptors_per_pool" type="int" setter="" getter="" default="64"> + </member> + <member name="rendering/rendering_device/driver" type="String" setter="" getter="" default=""vulkan""> + Sets the driver to be used by the renderer when using a RenderingDevice-based renderer like the clustered renderer or the mobile renderer. This property can not be edited directly, instead, set the driver using the platform-specific overrides. + </member> + <member name="rendering/rendering_device/driver.android" type="String" setter="" getter="" default=""vulkan""> + Android override for [member rendering/rendering_device/driver]. + </member> + <member name="rendering/rendering_device/driver.ios" type="String" setter="" getter="" default=""vulkan""> + iOS override for [member rendering/rendering_device/driver]. + </member> + <member name="rendering/rendering_device/driver.linuxbsd" type="String" setter="" getter="" default=""vulkan""> + LinuxBSD override for [member rendering/rendering_device/driver]. + </member> + <member name="rendering/rendering_device/driver.macos" type="String" setter="" getter="" default=""vulkan""> + macOS override for [member rendering/rendering_device/driver]. + </member> + <member name="rendering/rendering_device/driver.windows" type="String" setter="" getter="" default=""vulkan""> + Windows override for [member rendering/rendering_device/driver]. + </member> + <member name="rendering/rendering_device/staging_buffer/block_size_kb" type="int" setter="" getter="" default="256"> + </member> + <member name="rendering/rendering_device/staging_buffer/max_size_mb" type="int" setter="" getter="" default="128"> + </member> + <member name="rendering/rendering_device/staging_buffer/texture_upload_region_size_px" type="int" setter="" getter="" default="64"> + </member> <member name="rendering/scaling_3d/fsr_sharpness" type="float" setter="" getter="" default="0.2"> Determines how sharp the upscaled image will be when using the FSR upscaling mode. Sharpness halves with every whole number. Values go from 0.0 (sharpest) to 2.0. Values above 2.0 won't make a visible difference. </member> @@ -2037,18 +2099,6 @@ <member name="rendering/vrs/texture" type="String" setter="" getter="" default=""""> If [member rendering/vrs/mode] is set to texture, this is the path to default texture loaded as the VRS image. </member> - <member name="rendering/vulkan/descriptor_pools/max_descriptors_per_pool" type="int" setter="" getter="" default="64"> - </member> - <member name="rendering/vulkan/rendering/back_end" type="int" setter="" getter="" default="0"> - </member> - <member name="rendering/vulkan/rendering/back_end.mobile" type="int" setter="" getter="" default="1"> - </member> - <member name="rendering/vulkan/staging_buffer/block_size_kb" type="int" setter="" getter="" default="256"> - </member> - <member name="rendering/vulkan/staging_buffer/max_size_mb" type="int" setter="" getter="" default="128"> - </member> - <member name="rendering/vulkan/staging_buffer/texture_upload_region_size_px" type="int" setter="" getter="" default="64"> - </member> <member name="threading/worker_pool/low_priority_thread_ratio" type="float" setter="" getter="" default="0.3"> </member> <member name="threading/worker_pool/max_threads" type="int" setter="" getter="" default="-1"> diff --git a/doc/classes/QuadMesh.xml b/doc/classes/QuadMesh.xml new file mode 100644 index 0000000000..b869774601 --- /dev/null +++ b/doc/classes/QuadMesh.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="QuadMesh" inherits="PlaneMesh" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Class representing a square mesh facing the camera. + </brief_description> + <description> + Class representing a square [PrimitiveMesh]. This flat mesh does not have a thickness. By default, this mesh is aligned on the X and Y axes; this rotation is more suited for use with billboarded materials. A [QuadMesh] is equivalent to a [PlaneMesh] except its default [member PlaneMesh.orientation] is [constant PlaneMesh.FACE_Z]. + </description> + <tutorials> + <link title="GUI in 3D Demo">https://godotengine.org/asset-library/asset/127</link> + <link title="2D in 3D Demo">https://godotengine.org/asset-library/asset/129</link> + </tutorials> + <members> + <member name="orientation" type="int" setter="set_orientation" getter="get_orientation" overrides="PlaneMesh" enum="PlaneMesh.Orientation" default="2" /> + <member name="size" type="Vector2" setter="set_size" getter="get_size" overrides="PlaneMesh" default="Vector2(1, 1)" /> + </members> +</class> diff --git a/doc/classes/Quaternion.xml b/doc/classes/Quaternion.xml index a521af5709..f21ebf57e2 100644 --- a/doc/classes/Quaternion.xml +++ b/doc/classes/Quaternion.xml @@ -71,7 +71,7 @@ <param index="0" name="to" type="Quaternion" /> <description> Returns the angle between this quaternion and [param to]. This is the magnitude of the angle you would need to rotate by to get from one to the other. - [b]Note:[/b] This method has an abnormally high number of floating-point errors, so methods such as [code]is_zero_approx[/code] will not work reliably. + [b]Note:[/b] The magnitude of the floating-point error for this method is abnormally high, so methods such as [code]is_zero_approx[/code] will not work reliably. </description> </method> <method name="dot" qualifiers="const"> diff --git a/doc/classes/RefCounted.xml b/doc/classes/RefCounted.xml index 3daf3534b0..223e572254 100644 --- a/doc/classes/RefCounted.xml +++ b/doc/classes/RefCounted.xml @@ -13,6 +13,12 @@ <link title="When and how to avoid using nodes for everything">$DOCS_URL/tutorials/best_practices/node_alternatives.html</link> </tutorials> <methods> + <method name="get_reference_count" qualifiers="const"> + <return type="int" /> + <description> + Returns the current reference count. + </description> + </method> <method name="init_ref"> <return type="bool" /> <description> diff --git a/doc/classes/ScriptEditorBase.xml b/doc/classes/ScriptEditorBase.xml index c365e0971b..a3fcf53228 100644 --- a/doc/classes/ScriptEditorBase.xml +++ b/doc/classes/ScriptEditorBase.xml @@ -19,14 +19,14 @@ <method name="get_base_editor" qualifiers="const"> <return type="Control" /> <description> - Returns the underlying [Control] used for editing scripts. This can be either [CodeEdit] (for text scripts) or [GraphEdit] (for visual scripts). + Returns the underlying [Control] used for editing scripts. For text scripts, this is a [CodeEdit]. </description> </method> </methods> <signals> <signal name="edited_script_changed"> <description> - Emitted after script validation. For visual scripts on modification. + Emitted after script validation. </description> </signal> <signal name="go_to_help"> @@ -35,15 +35,22 @@ Emitted when the user requests a specific documentation page. </description> </signal> + <signal name="go_to_method"> + <param index="0" name="script" type="Object" /> + <param index="1" name="method" type="String" /> + <description> + Emitted when the user requests to view a specific method of a script, similar to [signal request_open_script_at_line]. + </description> + </signal> <signal name="name_changed"> <description> - Emitted after script validation or when the edited resource has changed. Not used by visual scripts. + Emitted after script validation or when the edited resource has changed. </description> </signal> <signal name="replace_in_files_requested"> <param index="0" name="text" type="String" /> <description> - Emitted when the user request to find and replace text in the file system. Not used by visual scripts. + Emitted when the user request to find and replace text in the file system. </description> </signal> <signal name="request_help"> @@ -56,7 +63,7 @@ <param index="0" name="script" type="Object" /> <param index="1" name="line" type="int" /> <description> - Emitted when the user requests a script. + Emitted when the user requests to view a specific line of a script, similar to [signal go_to_method]. </description> </signal> <signal name="request_save_history"> @@ -67,7 +74,7 @@ <signal name="search_in_files_requested"> <param index="0" name="text" type="String" /> <description> - Emitted when the user request to search text in the file system. Not used by visual scripts. + Emitted when the user request to search text in the file system. </description> </signal> </signals> diff --git a/doc/classes/StreamPeerGZIP.xml b/doc/classes/StreamPeerGZIP.xml new file mode 100644 index 0000000000..71dd36160d --- /dev/null +++ b/doc/classes/StreamPeerGZIP.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<class name="StreamPeerGZIP" inherits="StreamPeer" is_experimental="true" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> + <brief_description> + Stream peer handling GZIP and deflate compression/decompresison. + </brief_description> + <description> + This class allows to compress or decompress data using GZIP/deflate in a streaming fashion. This is particularly useful when compressing or decompressing files that has to be sent through the network without having to allocate them all in memory. + After starting the stream via [method start_compression] (or [method start_decompression]), calling [method StreamPeer.put_partial_data] on this stream will compress (or decompress) the data, writing it to the internal buffer. Calling [method StreamPeer.get_available_bytes] will return the pending bytes in the internal buffer, and [method StreamPeer.get_partial_data] will retrieve the compressed (or decompressed) bytes from it. When the stream is over, you must call [method finish] to ensure the internal buffer is properly flushed (make sure to call [method StreamPeer.get_available_bytes] on last time to check if more data needs to be read after that). + </description> + <tutorials> + </tutorials> + <methods> + <method name="clear"> + <return type="void" /> + <description> + Clears this stream, resetting the internal state. + </description> + </method> + <method name="finish"> + <return type="int" enum="Error" /> + <description> + Finalizes the stream, compressing or decompressing any buffered chunk left. + </description> + </method> + <method name="start_compression"> + <return type="int" enum="Error" /> + <param index="0" name="use_deflate" type="bool" default="false" /> + <param index="1" name="buffer_size" type="int" default="65535" /> + <description> + Start the stream in compression mode with the given [param buffer_size], if [param use_deflate] is [code]true[/code] uses deflate instead of GZIP. + </description> + </method> + <method name="start_decompression"> + <return type="int" enum="Error" /> + <param index="0" name="use_deflate" type="bool" default="false" /> + <param index="1" name="buffer_size" type="int" default="65535" /> + <description> + Start the stream in decompression mode with the given [param buffer_size], if [param use_deflate] is [code]true[/code] uses deflate instead of GZIP. + </description> + </method> + </methods> +</class> diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml index 2e67c61e54..2512c563c5 100644 --- a/doc/classes/TextServer.xml +++ b/doc/classes/TextServer.xml @@ -1565,6 +1565,8 @@ <constant name="FONT_LCD_SUBPIXEL_LAYOUT_VBGR" value="4" enum="FontLCDSubpixelLayout"> Vertical BGR sub-pixel layout. </constant> + <constant name="FONT_LCD_SUBPIXEL_LAYOUT_MAX" value="5" enum="FontLCDSubpixelLayout"> + </constant> <constant name="DIRECTION_AUTO" value="0" enum="Direction"> Text direction is determined based on contents and current locale. </constant> diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml index 4886bf0757..37d2698dd4 100644 --- a/doc/classes/TextServerExtension.xml +++ b/doc/classes/TextServerExtension.xml @@ -9,21 +9,19 @@ <tutorials> </tutorials> <methods> - <method name="create_font" qualifiers="virtual"> + <method name="_create_font" qualifiers="virtual"> <return type="RID" /> <description> - Creates new, empty font cache entry resource. To free the resulting resourec, use [method free_rid] method. </description> </method> - <method name="create_shaped_text" qualifiers="virtual"> + <method name="_create_shaped_text" qualifiers="virtual"> <return type="RID" /> <param index="0" name="direction" type="int" enum="TextServer.Direction" /> <param index="1" name="orientation" type="int" enum="TextServer.Orientation" /> <description> - Creates new buffer for complex text layout, with the given [param direction] and [param orientation]. To free the resulting buffer, use [method free_rid] method. </description> </method> - <method name="draw_hex_code_box" qualifiers="virtual const"> + <method name="_draw_hex_code_box" qualifiers="virtual const"> <return type="void" /> <param index="0" name="canvas" type="RID" /> <param index="1" name="size" type="int" /> @@ -31,42 +29,36 @@ <param index="3" name="index" type="int" /> <param index="4" name="color" type="Color" /> <description> - Draws box displaying character hexadecimal code. Used for replacing missing characters. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="font_clear_glyphs" qualifiers="virtual"> + <method name="_font_clear_glyphs" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <description> - Removes all rendered glyphs information from the cache entry. </description> </method> - <method name="font_clear_kerning_map" qualifiers="virtual"> + <method name="_font_clear_kerning_map" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Removes all kerning overrides. </description> </method> - <method name="font_clear_size_cache" qualifiers="virtual"> + <method name="_font_clear_size_cache" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <description> - Removes all font sizes from the cache entry. </description> </method> - <method name="font_clear_textures" qualifiers="virtual"> + <method name="_font_clear_textures" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <description> - Removes all textures from font cache entry. </description> </method> - <method name="font_draw_glyph" qualifiers="virtual const"> + <method name="_font_draw_glyph" qualifiers="virtual const"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="canvas" type="RID" /> @@ -75,10 +67,9 @@ <param index="4" name="index" type="int" /> <param index="5" name="color" type="Color" /> <description> - Draws single glyph into a canvas item at the position, using [param font_rid] at the size [param size]. </description> </method> - <method name="font_draw_glyph_outline" qualifiers="virtual const"> + <method name="_font_draw_glyph_outline" qualifiers="virtual const"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="canvas" type="RID" /> @@ -88,897 +79,779 @@ <param index="5" name="index" type="int" /> <param index="6" name="color" type="Color" /> <description> - Draws single glyph outline of size [param outline_size] into a canvas item at the position, using [param font_rid] at the size [param size]. </description> </method> - <method name="font_get_antialiasing" qualifiers="virtual const"> + <method name="_font_get_antialiasing" qualifiers="virtual const"> <return type="int" enum="TextServer.FontAntialiasing" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font anti-aliasing mode. </description> </method> - <method name="font_get_ascent" qualifiers="virtual const"> + <method name="_font_get_ascent" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Returns the font ascent (number of pixels above the baseline). </description> </method> - <method name="font_get_descent" qualifiers="virtual const"> + <method name="_font_get_descent" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Returns the font descent (number of pixels below the baseline). </description> </method> - <method name="font_get_embolden" qualifiers="virtual const"> + <method name="_font_get_embolden" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font embolden strength. </description> </method> - <method name="font_get_face_count" qualifiers="virtual const"> + <method name="_font_get_face_count" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns number of faces in the TrueType / OpenType collection. </description> </method> - <method name="font_get_face_index" qualifiers="virtual const"> + <method name="_font_get_face_index" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns an active face index in the TrueType / OpenType collection. </description> </method> - <method name="font_get_fixed_size" qualifiers="virtual const"> + <method name="_font_get_fixed_size" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns bitmap font fixed size. </description> </method> - <method name="font_get_generate_mipmaps" qualifiers="virtual const"> + <method name="_font_get_generate_mipmaps" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns [code]true[/code] if font texture mipmap generation is enabled. </description> </method> - <method name="font_get_global_oversampling" qualifiers="virtual const"> + <method name="_font_get_global_oversampling" qualifiers="virtual const"> <return type="float" /> <description> - Returns the font oversampling factor, shared by all fonts in the TextServer. </description> </method> - <method name="font_get_glyph_advance" qualifiers="virtual const"> + <method name="_font_get_glyph_advance" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="glyph" type="int" /> <description> - Returns glyph advance (offset of the next glyph). </description> </method> - <method name="font_get_glyph_contours" qualifiers="virtual const"> + <method name="_font_get_glyph_contours" qualifiers="virtual const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="index" type="int" /> <description> - Returns outline contours of the glyph as a [code]Dictionary[/code] with the following contents: - [code]points[/code] - [PackedVector3Array], containing outline points. [code]x[/code] and [code]y[/code] are point coordinates. [code]z[/code] is the type of the point, using the [enum TextServer.ContourPointTag] values. - [code]contours[/code] - [PackedInt32Array], containing indices the end points of each contour. - [code]orientation[/code] - [bool], contour orientation. If [code]true[/code], clockwise contours must be filled. </description> </method> - <method name="font_get_glyph_index" qualifiers="virtual const"> + <method name="_font_get_glyph_index" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="char" type="int" /> <param index="3" name="variation_selector" type="int" /> <description> - Returns the glyph index of a [param char], optionally modified by the [param variation_selector]. </description> </method> - <method name="font_get_glyph_list" qualifiers="virtual const"> + <method name="_font_get_glyph_list" qualifiers="virtual const"> <return type="PackedInt32Array" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <description> - Returns list of rendered glyphs in the cache entry. </description> </method> - <method name="font_get_glyph_offset" qualifiers="virtual const"> + <method name="_font_get_glyph_offset" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Returns glyph offset from the baseline. </description> </method> - <method name="font_get_glyph_size" qualifiers="virtual const"> + <method name="_font_get_glyph_size" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Returns size of the glyph. </description> </method> - <method name="font_get_glyph_texture_idx" qualifiers="virtual const"> + <method name="_font_get_glyph_texture_idx" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Returns index of the cache texture containing the glyph. </description> </method> - <method name="font_get_glyph_texture_rid" qualifiers="virtual const"> + <method name="_font_get_glyph_texture_rid" qualifiers="virtual const"> <return type="RID" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Returns resource id of the cache texture containing the glyph. </description> </method> - <method name="font_get_glyph_texture_size" qualifiers="virtual const"> + <method name="_font_get_glyph_texture_size" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Returns size of the cache texture containing the glyph. </description> </method> - <method name="font_get_glyph_uv_rect" qualifiers="virtual const"> + <method name="_font_get_glyph_uv_rect" qualifiers="virtual const"> <return type="Rect2" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Returns rectangle in the cache texture containing the glyph. </description> </method> - <method name="font_get_hinting" qualifiers="virtual const"> + <method name="_font_get_hinting" qualifiers="virtual const"> <return type="int" enum="TextServer.Hinting" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns the font hinting mode. Used by dynamic fonts only. </description> </method> - <method name="font_get_kerning" qualifiers="virtual const"> + <method name="_font_get_kerning" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="glyph_pair" type="Vector2i" /> <description> - Returns kerning for the pair of glyphs. </description> </method> - <method name="font_get_kerning_list" qualifiers="virtual const"> + <method name="_font_get_kerning_list" qualifiers="virtual const"> <return type="Vector2i[]" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Returns list of the kerning overrides. </description> </method> - <method name="font_get_language_support_override" qualifiers="virtual"> + <method name="_font_get_language_support_override" qualifiers="virtual"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="language" type="String" /> <description> - Returns [code]true[/code] if support override is enabled for the [param language]. </description> </method> - <method name="font_get_language_support_overrides" qualifiers="virtual"> + <method name="_font_get_language_support_overrides" qualifiers="virtual"> <return type="PackedStringArray" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns list of language support overrides. </description> </method> - <method name="font_get_msdf_pixel_range" qualifiers="virtual const"> + <method name="_font_get_msdf_pixel_range" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns the width of the range around the shape between the minimum and maximum representable signed distance. </description> </method> - <method name="font_get_msdf_size" qualifiers="virtual const"> + <method name="_font_get_msdf_size" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns source font size used to generate MSDF textures. </description> </method> - <method name="font_get_name" qualifiers="virtual const"> + <method name="_font_get_name" qualifiers="virtual const"> <return type="String" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font family name. </description> </method> - <method name="font_get_opentype_feature_overrides" qualifiers="virtual const"> + <method name="_font_get_opentype_feature_overrides" qualifiers="virtual const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font OpenType feature set override. </description> </method> - <method name="font_get_oversampling" qualifiers="virtual const"> + <method name="_font_get_oversampling" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only. </description> </method> - <method name="font_get_scale" qualifiers="virtual const"> + <method name="_font_get_scale" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Returns scaling factor of the color bitmap font. </description> </method> - <method name="font_get_script_support_override" qualifiers="virtual"> + <method name="_font_get_script_support_override" qualifiers="virtual"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="script" type="String" /> <description> - Returns [code]true[/code] if support override is enabled for the [param script]. </description> </method> - <method name="font_get_script_support_overrides" qualifiers="virtual"> + <method name="_font_get_script_support_overrides" qualifiers="virtual"> <return type="PackedStringArray" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns list of script support overrides. </description> </method> - <method name="font_get_size_cache_list" qualifiers="virtual const"> + <method name="_font_get_size_cache_list" qualifiers="virtual const"> <return type="Vector2i[]" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns list of the font sizes in the cache. Each size is [code]Vector2i[/code] with font size and outline size. </description> </method> - <method name="font_get_style" qualifiers="virtual const"> + <method name="_font_get_style" qualifiers="virtual const"> <return type="int" enum="TextServer.FontStyle" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font style flags, see [enum TextServer.FontStyle]. </description> </method> - <method name="font_get_style_name" qualifiers="virtual const"> + <method name="_font_get_style_name" qualifiers="virtual const"> <return type="String" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font style name. </description> </method> - <method name="font_get_subpixel_positioning" qualifiers="virtual const"> + <method name="_font_get_subpixel_positioning" qualifiers="virtual const"> <return type="int" enum="TextServer.SubpixelPositioning" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns font sub-pixel glyph positioning mode. </description> </method> - <method name="font_get_supported_chars" qualifiers="virtual const"> + <method name="_font_get_supported_chars" qualifiers="virtual const"> <return type="String" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns a string containing all the characters available in the font. </description> </method> - <method name="font_get_texture_count" qualifiers="virtual const"> + <method name="_font_get_texture_count" qualifiers="virtual const"> <return type="int" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <description> - Returns number of textures used by font cache entry. </description> </method> - <method name="font_get_texture_image" qualifiers="virtual const"> + <method name="_font_get_texture_image" qualifiers="virtual const"> <return type="Image" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="texture_index" type="int" /> <description> - Returns font cache texture image data. </description> </method> - <method name="font_get_texture_offsets" qualifiers="virtual const"> + <method name="_font_get_texture_offsets" qualifiers="virtual const"> <return type="PackedInt32Array" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="texture_index" type="int" /> <description> - Returns array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty. </description> </method> - <method name="font_get_transform" qualifiers="virtual const"> + <method name="_font_get_transform" qualifiers="virtual const"> <return type="Transform2D" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns 2D transform applied to the font outlines. </description> </method> - <method name="font_get_underline_position" qualifiers="virtual const"> + <method name="_font_get_underline_position" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Returns pixel offset of the underline below the baseline. </description> </method> - <method name="font_get_underline_thickness" qualifiers="virtual const"> + <method name="_font_get_underline_thickness" qualifiers="virtual const"> <return type="float" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <description> - Returns thickness of the underline in pixels. </description> </method> - <method name="font_get_variation_coordinates" qualifiers="virtual const"> + <method name="_font_get_variation_coordinates" qualifiers="virtual const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info. </description> </method> - <method name="font_has_char" qualifiers="virtual const"> + <method name="_font_has_char" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="char" type="int" /> <description> - Returns [code]true[/code] if a Unicode [param char] is available in the font. </description> </method> - <method name="font_is_force_autohinter" qualifiers="virtual const"> + <method name="_font_is_force_autohinter" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns [code]true[/code] if auto-hinting is supported and preferred over font built-in hinting. Used by dynamic fonts only. </description> </method> - <method name="font_is_language_supported" qualifiers="virtual const"> + <method name="_font_is_language_supported" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="language" type="String" /> <description> - Returns [code]true[/code], if font supports given language ([url=https://en.wikipedia.org/wiki/ISO_639-1]ISO 639[/url] code). </description> </method> - <method name="font_is_multichannel_signed_distance_field" qualifiers="virtual const"> + <method name="_font_is_multichannel_signed_distance_field" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns [code]true[/code] if glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. </description> </method> - <method name="font_is_script_supported" qualifiers="virtual const"> + <method name="_font_is_script_supported" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="script" type="String" /> <description> - Returns [code]true[/code], if font supports given script (ISO 15924 code). </description> </method> - <method name="font_remove_glyph" qualifiers="virtual"> + <method name="_font_remove_glyph" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <description> - Removes specified rendered glyph information from the cache entry. </description> </method> - <method name="font_remove_kerning" qualifiers="virtual"> + <method name="_font_remove_kerning" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="glyph_pair" type="Vector2i" /> <description> - Removes kerning override for the pair of glyphs. </description> </method> - <method name="font_remove_language_support_override" qualifiers="virtual"> + <method name="_font_remove_language_support_override" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="language" type="String" /> <description> - Remove language support override. </description> </method> - <method name="font_remove_script_support_override" qualifiers="virtual"> + <method name="_font_remove_script_support_override" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="script" type="String" /> <description> - Removes script support override. </description> </method> - <method name="font_remove_size_cache" qualifiers="virtual"> + <method name="_font_remove_size_cache" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <description> - Removes specified font size from the cache entry. </description> </method> - <method name="font_remove_texture" qualifiers="virtual"> + <method name="_font_remove_texture" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="texture_index" type="int" /> <description> - Removes specified texture from the cache entry. </description> </method> - <method name="font_render_glyph" qualifiers="virtual"> + <method name="_font_render_glyph" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="index" type="int" /> <description> - Renders specified glyph to the font cache texture. </description> </method> - <method name="font_render_range" qualifiers="virtual"> + <method name="_font_render_range" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="start" type="int" /> <param index="3" name="end" type="int" /> <description> - Renders the range of characters to the font cache texture. </description> </method> - <method name="font_set_antialiasing" qualifiers="virtual"> + <method name="_font_set_antialiasing" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="antialiasing" type="int" enum="TextServer.FontAntialiasing" /> <description> - Sets font anti-aliasing mode. </description> </method> - <method name="font_set_ascent" qualifiers="virtual"> + <method name="_font_set_ascent" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="ascent" type="float" /> <description> - Sets the font ascent (number of pixels above the baseline). </description> </method> - <method name="font_set_data" qualifiers="virtual"> + <method name="_font_set_data" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="data" type="PackedByteArray" /> <description> - Sets font source data, e.g contents of the dynamic font source file. </description> </method> - <method name="font_set_data_ptr" qualifiers="virtual"> + <method name="_font_set_data_ptr" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="data_ptr" type="const uint8_t*" /> <param index="2" name="data_size" type="int" /> <description> - Sets font source data, e.g contents of the dynamic font source file. [param data_ptr] memory buffer must remain accessible during font lifetime. </description> </method> - <method name="font_set_descent" qualifiers="virtual"> + <method name="_font_set_descent" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="descent" type="float" /> <description> - Sets the font descent (number of pixels below the baseline). </description> </method> - <method name="font_set_embolden" qualifiers="virtual"> + <method name="_font_set_embolden" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="strength" type="float" /> <description> - Sets font embolden strength. If [param strength] is not equal to zero, emboldens the font outlines. Negative values reduce the outline thickness. </description> </method> - <method name="font_set_face_index" qualifiers="virtual"> + <method name="_font_set_face_index" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="face_index" type="int" /> <description> - Sets an active face index in the TrueType / OpenType collection. </description> </method> - <method name="font_set_fixed_size" qualifiers="virtual"> + <method name="_font_set_fixed_size" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="fixed_size" type="int" /> <description> - Sets bitmap font fixed size. If set to value greater than zero, same cache entry will be used for all font sizes. </description> </method> - <method name="font_set_force_autohinter" qualifiers="virtual"> + <method name="_font_set_force_autohinter" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="force_autohinter" type="bool" /> <description> - If set to [code]true[/code] auto-hinting is preferred over font built-in hinting. </description> </method> - <method name="font_set_generate_mipmaps" qualifiers="virtual"> + <method name="_font_set_generate_mipmaps" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="generate_mipmaps" type="bool" /> <description> - If set to [code]true[/code] font texture mipmap generation is enabled. </description> </method> - <method name="font_set_global_oversampling" qualifiers="virtual"> + <method name="_font_set_global_oversampling" qualifiers="virtual"> <return type="void" /> <param index="0" name="oversampling" type="float" /> <description> - Sets oversampling factor, shared by all font in the TextServer. - [b]Note:[/b] This value can be automatically changed by display server. </description> </method> - <method name="font_set_glyph_advance" qualifiers="virtual"> + <method name="_font_set_glyph_advance" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="glyph" type="int" /> <param index="3" name="advance" type="Vector2" /> <description> - Sets glyph advance (offset of the next glyph). </description> </method> - <method name="font_set_glyph_offset" qualifiers="virtual"> + <method name="_font_set_glyph_offset" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <param index="3" name="offset" type="Vector2" /> <description> - Sets glyph offset from the baseline. </description> </method> - <method name="font_set_glyph_size" qualifiers="virtual"> + <method name="_font_set_glyph_size" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <param index="3" name="gl_size" type="Vector2" /> <description> - Sets size of the glyph. </description> </method> - <method name="font_set_glyph_texture_idx" qualifiers="virtual"> + <method name="_font_set_glyph_texture_idx" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <param index="3" name="texture_idx" type="int" /> <description> - Sets index of the cache texture containing the glyph. </description> </method> - <method name="font_set_glyph_uv_rect" qualifiers="virtual"> + <method name="_font_set_glyph_uv_rect" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="glyph" type="int" /> <param index="3" name="uv_rect" type="Rect2" /> <description> - Sets rectangle in the cache texture containing the glyph. </description> </method> - <method name="font_set_hinting" qualifiers="virtual"> + <method name="_font_set_hinting" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="hinting" type="int" enum="TextServer.Hinting" /> <description> - Sets font hinting mode. Used by dynamic fonts only. </description> </method> - <method name="font_set_kerning" qualifiers="virtual"> + <method name="_font_set_kerning" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="glyph_pair" type="Vector2i" /> <param index="3" name="kerning" type="Vector2" /> <description> - Sets kerning for the pair of glyphs. </description> </method> - <method name="font_set_language_support_override" qualifiers="virtual"> + <method name="_font_set_language_support_override" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="language" type="String" /> <param index="2" name="supported" type="bool" /> <description> - Adds override for [method font_is_language_supported]. </description> </method> - <method name="font_set_msdf_pixel_range" qualifiers="virtual"> + <method name="_font_set_msdf_pixel_range" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="msdf_pixel_range" type="int" /> <description> - Sets the width of the range around the shape between the minimum and maximum representable signed distance. </description> </method> - <method name="font_set_msdf_size" qualifiers="virtual"> + <method name="_font_set_msdf_size" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="msdf_size" type="int" /> <description> - Sets source font size used to generate MSDF textures. </description> </method> - <method name="font_set_multichannel_signed_distance_field" qualifiers="virtual"> + <method name="_font_set_multichannel_signed_distance_field" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="msdf" type="bool" /> <description> - If set to [code]true[/code], glyphs of all sizes are rendered using single multichannel signed distance field generated from the dynamic font vector data. MSDF rendering allows displaying the font at any scaling factor without blurriness, and without incurring a CPU cost when the font size changes (since the font no longer needs to be rasterized on the CPU). As a downside, font hinting is not available with MSDF. The lack of font hinting may result in less crisp and less readable fonts at small sizes. - [b]Note:[/b] MSDF font rendering does not render glyphs with overlapping shapes correctly. Overlapping shapes are not valid per the OpenType standard, but are still commonly found in many font files, especially those converted by Google Fonts. To avoid issues with overlapping glyphs, consider downloading the font file directly from the type foundry instead of relying on Google Fonts. </description> </method> - <method name="font_set_name" qualifiers="virtual"> + <method name="_font_set_name" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="name" type="String" /> <description> - Sets the font family name. </description> </method> - <method name="font_set_opentype_feature_overrides" qualifiers="virtual"> + <method name="_font_set_opentype_feature_overrides" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="overrides" type="Dictionary" /> <description> - Sets font OpenType feature set override. </description> </method> - <method name="font_set_oversampling" qualifiers="virtual"> + <method name="_font_set_oversampling" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="oversampling" type="float" /> <description> - Sets font oversampling factor, if set to [code]0.0[/code] global oversampling factor is used instead. Used by dynamic fonts only. </description> </method> - <method name="font_set_scale" qualifiers="virtual"> + <method name="_font_set_scale" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="scale" type="float" /> <description> - Sets scaling factor of the color bitmap font. </description> </method> - <method name="font_set_script_support_override" qualifiers="virtual"> + <method name="_font_set_script_support_override" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="script" type="String" /> <param index="2" name="supported" type="bool" /> <description> - Adds override for [method font_is_script_supported]. </description> </method> - <method name="font_set_style" qualifiers="virtual"> + <method name="_font_set_style" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="style" type="int" enum="TextServer.FontStyle" /> <description> - Sets the font style flags, see [enum TextServer.FontStyle]. </description> </method> - <method name="font_set_style_name" qualifiers="virtual"> + <method name="_font_set_style_name" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="name_style" type="String" /> <description> - Sets the font style name. </description> </method> - <method name="font_set_subpixel_positioning" qualifiers="virtual"> + <method name="_font_set_subpixel_positioning" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="subpixel_positioning" type="int" enum="TextServer.SubpixelPositioning" /> <description> - Sets font sub-pixel glyph positioning mode. </description> </method> - <method name="font_set_texture_image" qualifiers="virtual"> + <method name="_font_set_texture_image" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="texture_index" type="int" /> <param index="3" name="image" type="Image" /> <description> - Sets font cache texture image data. </description> </method> - <method name="font_set_texture_offsets" qualifiers="virtual"> + <method name="_font_set_texture_offsets" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="Vector2i" /> <param index="2" name="texture_index" type="int" /> <param index="3" name="offset" type="PackedInt32Array" /> <description> - Sets array containing the first free pixel in the each column of texture. Should be the same size as texture width or empty. </description> </method> - <method name="font_set_transform" qualifiers="virtual"> + <method name="_font_set_transform" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="transform" type="Transform2D" /> <description> - Sets 2D transform, applied to the font outlines, can be used for slanting, flipping and rotating glyphs. - For example, to simulate italic typeface by slanting, apply the following transform [code]Transform2D(1.0, slant, 0.0, 1.0, 0.0, 0.0)[/code]. </description> </method> - <method name="font_set_underline_position" qualifiers="virtual"> + <method name="_font_set_underline_position" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="underline_position" type="float" /> <description> - Sets pixel offset of the underline below the baseline. </description> </method> - <method name="font_set_underline_thickness" qualifiers="virtual"> + <method name="_font_set_underline_thickness" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="size" type="int" /> <param index="2" name="underline_thickness" type="float" /> <description> - Sets thickness of the underline in pixels. </description> </method> - <method name="font_set_variation_coordinates" qualifiers="virtual"> + <method name="_font_set_variation_coordinates" qualifiers="virtual"> <return type="void" /> <param index="0" name="font_rid" type="RID" /> <param index="1" name="variation_coordinates" type="Dictionary" /> <description> - Sets variation coordinates for the specified font cache entry. See [method font_supported_variation_list] for more info. </description> </method> - <method name="font_supported_feature_list" qualifiers="virtual const"> + <method name="_font_supported_feature_list" qualifiers="virtual const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns the dictionary of the supported OpenType features. </description> </method> - <method name="font_supported_variation_list" qualifiers="virtual const"> + <method name="_font_supported_variation_list" qualifiers="virtual const"> <return type="Dictionary" /> <param index="0" name="font_rid" type="RID" /> <description> - Returns the dictionary of the supported OpenType variation coordinates. </description> </method> - <method name="format_number" qualifiers="virtual const"> + <method name="_format_number" qualifiers="virtual const"> <return type="String" /> <param index="0" name="string" type="String" /> <param index="1" name="language" type="String" /> <description> - Converts a number from the Western Arabic (0..9) to the numeral systems used in [param language]. </description> </method> - <method name="free_rid" qualifiers="virtual"> + <method name="_free_rid" qualifiers="virtual"> <return type="void" /> <param index="0" name="rid" type="RID" /> <description> - Frees an object created by this [TextServer]. </description> </method> - <method name="get_features" qualifiers="virtual const"> + <method name="_get_features" qualifiers="virtual const"> <return type="int" /> <description> - Returns text server features, see [enum TextServer.Feature]. </description> </method> - <method name="get_hex_code_box_size" qualifiers="virtual const"> + <method name="_get_hex_code_box_size" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="size" type="int" /> <param index="1" name="index" type="int" /> <description> - Returns size of the replacement character (box with character hexadecimal code that is drawn in place of invalid characters). - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="get_name" qualifiers="virtual const"> + <method name="_get_name" qualifiers="virtual const"> <return type="String" /> <description> - Returns the name of the server interface. </description> </method> - <method name="get_support_data_filename" qualifiers="virtual const"> + <method name="_get_support_data_filename" qualifiers="virtual const"> <return type="String" /> <description> - Returns default TextServer database (e.g. ICU break iterators and dictionaries) filename. </description> </method> - <method name="get_support_data_info" qualifiers="virtual const"> + <method name="_get_support_data_info" qualifiers="virtual const"> <return type="String" /> <description> - Returns TextServer database (e.g. ICU break iterators and dictionaries) description. </description> </method> - <method name="has" qualifiers="virtual"> + <method name="_has" qualifiers="virtual"> <return type="bool" /> <param index="0" name="rid" type="RID" /> <description> - Returns [code]true[/code] if [param rid] is valid resource owned by this text server. </description> </method> - <method name="has_feature" qualifiers="virtual const"> + <method name="_has_feature" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="feature" type="int" enum="TextServer.Feature" /> <description> - Returns [code]true[/code] if the server supports a feature. </description> </method> - <method name="is_confusable" qualifiers="virtual const"> + <method name="_is_confusable" qualifiers="virtual const"> <return type="int" /> <param index="0" name="string" type="String" /> <param index="1" name="dict" type="PackedStringArray" /> <description> - Returns index of the first string in [param dict] which is visually confusable with the [param string], or [code]-1[/code] if none is found. </description> </method> - <method name="is_locale_right_to_left" qualifiers="virtual const"> + <method name="_is_locale_right_to_left" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="locale" type="String" /> <description> - Returns [code]true[/code] if locale is right-to-left. </description> </method> - <method name="is_valid_identifier" qualifiers="virtual const"> + <method name="_is_valid_identifier" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="string" type="String" /> <description> - Returns [code]true[/code] is [param string] is a valid identifier. </description> </method> - <method name="load_support_data" qualifiers="virtual"> + <method name="_load_support_data" qualifiers="virtual"> <return type="bool" /> <param index="0" name="filename" type="String" /> <description> - Loads optional TextServer database (e.g. ICU break iterators and dictionaries). </description> </method> - <method name="name_to_tag" qualifiers="virtual const"> + <method name="_name_to_tag" qualifiers="virtual const"> <return type="int" /> <param index="0" name="name" type="String" /> <description> - Converts readable feature, variation, script or language name to OpenType tag. </description> </method> - <method name="parse_number" qualifiers="virtual const"> + <method name="_parse_number" qualifiers="virtual const"> <return type="String" /> <param index="0" name="string" type="String" /> <param index="1" name="language" type="String" /> <description> - Converts a number from the numeral systems used in [param language] to Western Arabic (0..9). </description> </method> - <method name="parse_structured_text" qualifiers="virtual const"> + <method name="_parse_structured_text" qualifiers="virtual const"> <return type="Vector2i[]" /> <param index="0" name="parser_type" type="int" enum="TextServer.StructuredTextParser" /> <param index="1" name="args" type="Array" /> @@ -986,37 +859,32 @@ <description> </description> </method> - <method name="percent_sign" qualifiers="virtual const"> + <method name="_percent_sign" qualifiers="virtual const"> <return type="String" /> <param index="0" name="language" type="String" /> <description> - Returns percent sign used in the [param language]. </description> </method> - <method name="save_support_data" qualifiers="virtual const"> + <method name="_save_support_data" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="filename" type="String" /> <description> - Saves optional TextServer database (e.g. ICU break iterators and dictionaries) to the file. - [b]Note:[/b] This function is used by during project export, to include TextServer database. </description> </method> - <method name="shaped_get_span_count" qualifiers="virtual const"> + <method name="_shaped_get_span_count" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <description> - Returns number of text spans added using [method shaped_text_add_string] or [method shaped_text_add_object]. </description> </method> - <method name="shaped_get_span_meta" qualifiers="virtual const"> + <method name="_shaped_get_span_meta" qualifiers="virtual const"> <return type="Variant" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="index" type="int" /> <description> - Returns text span metadata. </description> </method> - <method name="shaped_set_span_update_font" qualifiers="virtual"> + <method name="_shaped_set_span_update_font" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="index" type="int" /> @@ -1024,10 +892,9 @@ <param index="3" name="size" type="int" /> <param index="4" name="opentype_features" type="Dictionary" /> <description> - Changes text span font, font size and OpenType features, without changing the text. </description> </method> - <method name="shaped_text_add_object" qualifiers="virtual"> + <method name="_shaped_text_add_object" qualifiers="virtual"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="key" type="Variant" /> @@ -1035,10 +902,9 @@ <param index="3" name="inline_align" type="int" enum="InlineAlignment" /> <param index="4" name="length" type="int" /> <description> - Adds inline object to the text buffer, [param key] must be unique. In the text, object is represented as [param length] object replacement characters. </description> </method> - <method name="shaped_text_add_string" qualifiers="virtual"> + <method name="_shaped_text_add_string" qualifiers="virtual"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="text" type="String" /> @@ -1048,17 +914,15 @@ <param index="5" name="language" type="String" /> <param index="6" name="meta" type="Variant" /> <description> - Adds text span and font to draw it to the text buffer. </description> </method> - <method name="shaped_text_clear" qualifiers="virtual"> + <method name="_shaped_text_clear" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <description> - Clears text buffer (removes text and inline objects). </description> </method> - <method name="shaped_text_draw" qualifiers="virtual const"> + <method name="_shaped_text_draw" qualifiers="virtual const"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="canvas" type="RID" /> @@ -1067,11 +931,9 @@ <param index="4" name="clip_r" type="float" /> <param index="5" name="color" type="Color" /> <description> - Draw shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_draw_outline" qualifiers="virtual const"> + <method name="_shaped_text_draw_outline" qualifiers="virtual const"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="canvas" type="RID" /> @@ -1081,130 +943,109 @@ <param index="5" name="outline_size" type="int" /> <param index="6" name="color" type="Color" /> <description> - Draw the outline of the shaped text into a canvas item at a given position, with [param color]. [param pos] specifies the leftmost point of the baseline (for horizontal layout) or topmost point of the baseline (for vertical layout). - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_fit_to_width" qualifiers="virtual"> + <method name="_shaped_text_fit_to_width" qualifiers="virtual"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="width" type="float" /> <param index="2" name="jst_flags" type="int" enum="TextServer.JustificationFlag" /> <description> - Adjusts text with to fit to specified width, returns new text width. </description> </method> - <method name="shaped_text_get_ascent" qualifiers="virtual const"> + <method name="_shaped_text_get_ascent" qualifiers="virtual const"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <description> - Returns the text ascent (number of pixels above the baseline for horizontal layout or to the left of baseline for vertical). </description> </method> - <method name="shaped_text_get_carets" qualifiers="virtual const"> + <method name="_shaped_text_get_carets" qualifiers="virtual const"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="position" type="int" /> <param index="2" name="caret" type="CaretInfo*" /> <description> - Returns shapes of the carets corresponding to the character offset [param position] in the text. Returned caret shape is 1 pixel wide rectangle. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_get_custom_punctuation" qualifiers="virtual const"> + <method name="_shaped_text_get_custom_punctuation" qualifiers="virtual const"> <return type="String" /> <param index="0" name="shaped" type="RID" /> <description> - Returns custom punctuation character list, used for word breaking. If set to empty string, server defaults are used. </description> </method> - <method name="shaped_text_get_descent" qualifiers="virtual const"> + <method name="_shaped_text_get_descent" qualifiers="virtual const"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <description> - Returns the text descent (number of pixels below the baseline for horizontal layout or to the right of baseline for vertical). </description> </method> - <method name="shaped_text_get_direction" qualifiers="virtual const"> + <method name="_shaped_text_get_direction" qualifiers="virtual const"> <return type="int" enum="TextServer.Direction" /> <param index="0" name="shaped" type="RID" /> <description> - Returns direction of the text. </description> </method> - <method name="shaped_text_get_dominant_direction_in_range" qualifiers="virtual const"> + <method name="_shaped_text_get_dominant_direction_in_range" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="start" type="int" /> <param index="2" name="end" type="int" /> <description> - Returns dominant direction of in the range of text. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_get_ellipsis_glyph_count" qualifiers="virtual const"> + <method name="_shaped_text_get_ellipsis_glyph_count" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <description> - Returns number of glyphs in the ellipsis. </description> </method> - <method name="shaped_text_get_ellipsis_glyphs" qualifiers="virtual const"> + <method name="_shaped_text_get_ellipsis_glyphs" qualifiers="virtual const"> <return type="const Glyph*" /> <param index="0" name="shaped" type="RID" /> <description> - Returns array of the glyphs in the ellipsis. </description> </method> - <method name="shaped_text_get_ellipsis_pos" qualifiers="virtual const"> + <method name="_shaped_text_get_ellipsis_pos" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <description> - Returns position of the ellipsis. </description> </method> - <method name="shaped_text_get_glyph_count" qualifiers="virtual const"> + <method name="_shaped_text_get_glyph_count" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <description> - Returns number of glyphs in the buffer. </description> </method> - <method name="shaped_text_get_glyphs" qualifiers="virtual const"> + <method name="_shaped_text_get_glyphs" qualifiers="virtual const"> <return type="const Glyph*" /> <param index="0" name="shaped" type="RID" /> <description> - Returns an array of glyphs in the visual order. </description> </method> - <method name="shaped_text_get_grapheme_bounds" qualifiers="virtual const"> + <method name="_shaped_text_get_grapheme_bounds" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="pos" type="int" /> <description> - Returns composite character's bounds as offsets from the start of the line. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_get_inferred_direction" qualifiers="virtual const"> + <method name="_shaped_text_get_inferred_direction" qualifiers="virtual const"> <return type="int" enum="TextServer.Direction" /> <param index="0" name="shaped" type="RID" /> <description> - Returns direction of the text, inferred by the BiDi algorithm. </description> </method> - <method name="shaped_text_get_line_breaks" qualifiers="virtual const"> + <method name="_shaped_text_get_line_breaks" qualifiers="virtual const"> <return type="PackedInt32Array" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="width" type="float" /> <param index="2" name="start" type="int" /> <param index="3" name="break_flags" type="int" enum="TextServer.LineBreakFlag" /> <description> - Breaks text to the lines and returns character ranges for each line. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_get_line_breaks_adv" qualifiers="virtual const"> + <method name="_shaped_text_get_line_breaks_adv" qualifiers="virtual const"> <return type="PackedInt32Array" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="width" type="PackedFloat32Array" /> @@ -1212,334 +1053,280 @@ <param index="3" name="once" type="bool" /> <param index="4" name="break_flags" type="int" enum="TextServer.LineBreakFlag" /> <description> - Breaks text to the lines and columns. Returns character ranges for each segment. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_get_object_rect" qualifiers="virtual const"> + <method name="_shaped_text_get_object_rect" qualifiers="virtual const"> <return type="Rect2" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="key" type="Variant" /> <description> - Returns bounding rectangle of the inline object. </description> </method> - <method name="shaped_text_get_objects" qualifiers="virtual const"> + <method name="_shaped_text_get_objects" qualifiers="virtual const"> <return type="Array" /> <param index="0" name="shaped" type="RID" /> <description> - Returns array of inline objects. </description> </method> - <method name="shaped_text_get_orientation" qualifiers="virtual const"> + <method name="_shaped_text_get_orientation" qualifiers="virtual const"> <return type="int" enum="TextServer.Orientation" /> <param index="0" name="shaped" type="RID" /> <description> - eturns text orientation. </description> </method> - <method name="shaped_text_get_parent" qualifiers="virtual const"> + <method name="_shaped_text_get_parent" qualifiers="virtual const"> <return type="RID" /> <param index="0" name="shaped" type="RID" /> <description> - Returns the parent buffer from which the substring originates. </description> </method> - <method name="shaped_text_get_preserve_control" qualifiers="virtual const"> + <method name="_shaped_text_get_preserve_control" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <description> - Returns [code]true[/code] if text buffer is configured to display control characters. </description> </method> - <method name="shaped_text_get_preserve_invalid" qualifiers="virtual const"> + <method name="_shaped_text_get_preserve_invalid" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <description> - Returns [code]true[/code] if text buffer is configured to display hexadecimal codes in place of invalid characters. - [b]Note:[/b] If set to [code]false[/code], nothing is displayed in place of invalid characters. </description> </method> - <method name="shaped_text_get_range" qualifiers="virtual const"> + <method name="_shaped_text_get_range" qualifiers="virtual const"> <return type="Vector2i" /> <param index="0" name="shaped" type="RID" /> <description> - Returns substring buffer character range in the parent buffer. </description> </method> - <method name="shaped_text_get_selection" qualifiers="virtual const"> + <method name="_shaped_text_get_selection" qualifiers="virtual const"> <return type="PackedVector2Array" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="start" type="int" /> <param index="2" name="end" type="int" /> <description> - Returns selection rectangles for the specified character range. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_get_size" qualifiers="virtual const"> + <method name="_shaped_text_get_size" qualifiers="virtual const"> <return type="Vector2" /> <param index="0" name="shaped" type="RID" /> <description> - Returns size of the text. </description> </method> - <method name="shaped_text_get_spacing" qualifiers="virtual const"> + <method name="_shaped_text_get_spacing" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="spacing" type="int" enum="TextServer.SpacingType" /> <description> - Returns extra spacing added between glyphs or lines in pixels. </description> </method> - <method name="shaped_text_get_trim_pos" qualifiers="virtual const"> + <method name="_shaped_text_get_trim_pos" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <description> - Returns the position of the overrun trim. </description> </method> - <method name="shaped_text_get_underline_position" qualifiers="virtual const"> + <method name="_shaped_text_get_underline_position" qualifiers="virtual const"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <description> - Returns pixel offset of the underline below the baseline. </description> </method> - <method name="shaped_text_get_underline_thickness" qualifiers="virtual const"> + <method name="_shaped_text_get_underline_thickness" qualifiers="virtual const"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <description> - Returns thickness of the underline. </description> </method> - <method name="shaped_text_get_width" qualifiers="virtual const"> + <method name="_shaped_text_get_width" qualifiers="virtual const"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <description> - Returns width (for horizontal layout) or height (for vertical) of the text. </description> </method> - <method name="shaped_text_get_word_breaks" qualifiers="virtual const"> + <method name="_shaped_text_get_word_breaks" qualifiers="virtual const"> <return type="PackedInt32Array" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="grapheme_flags" type="int" enum="TextServer.GraphemeFlag" /> <description> - Breaks text into words and returns array of character ranges. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_hit_test_grapheme" qualifiers="virtual const"> + <method name="_shaped_text_hit_test_grapheme" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="coord" type="float" /> <description> - Returns grapheme index at the specified pixel offset at the baseline, or [code]-1[/code] if none is found. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_hit_test_position" qualifiers="virtual const"> + <method name="_shaped_text_hit_test_position" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="coord" type="float" /> <description> - Returns caret character offset at the specified pixel offset at the baseline. This function always returns a valid position. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_is_ready" qualifiers="virtual const"> + <method name="_shaped_text_is_ready" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <description> - Returns [code]true[/code] if buffer is successfully shaped. </description> </method> - <method name="shaped_text_next_grapheme_pos" qualifiers="virtual const"> + <method name="_shaped_text_next_grapheme_pos" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="pos" type="int" /> <description> - Returns composite character end position closest to the [param pos]. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_overrun_trim_to_width" qualifiers="virtual"> + <method name="_shaped_text_overrun_trim_to_width" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="width" type="float" /> <param index="2" name="trim_flags" type="int" enum="TextServer.TextOverrunFlag" /> <description> - Trims text if it exceeds the given width. </description> </method> - <method name="shaped_text_prev_grapheme_pos" qualifiers="virtual const"> + <method name="_shaped_text_prev_grapheme_pos" qualifiers="virtual const"> <return type="int" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="pos" type="int" /> <description> - Returns composite character start position closest to the [param pos]. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="shaped_text_resize_object" qualifiers="virtual"> + <method name="_shaped_text_resize_object" qualifiers="virtual"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="key" type="Variant" /> <param index="2" name="size" type="Vector2" /> <param index="3" name="inline_align" type="int" enum="InlineAlignment" /> <description> - Sets new size and alignment of embedded object. </description> </method> - <method name="shaped_text_set_bidi_override" qualifiers="virtual"> + <method name="_shaped_text_set_bidi_override" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="override" type="Array" /> <description> - Overrides BiDi for the structured text. - Override ranges should cover full source text without overlaps. BiDi algorithm will be used on each range separately. </description> </method> - <method name="shaped_text_set_custom_punctuation" qualifiers="virtual"> + <method name="_shaped_text_set_custom_punctuation" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="punct" type="String" /> <description> - Sets custom punctuation character list, used for word breaking. If set to empty string, server defaults are used. </description> </method> - <method name="shaped_text_set_direction" qualifiers="virtual"> + <method name="_shaped_text_set_direction" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="direction" type="int" enum="TextServer.Direction" /> <description> - Sets desired text [param direction]. If set to [code]TEXT_DIRECTION_AUTO[/code], direction will be detected based on the buffer contents and current locale. </description> </method> - <method name="shaped_text_set_orientation" qualifiers="virtual"> + <method name="_shaped_text_set_orientation" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="orientation" type="int" enum="TextServer.Orientation" /> <description> - Sets desired text orientation. </description> </method> - <method name="shaped_text_set_preserve_control" qualifiers="virtual"> + <method name="_shaped_text_set_preserve_control" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> - If set to [code]true[/code] text buffer will display control characters. </description> </method> - <method name="shaped_text_set_preserve_invalid" qualifiers="virtual"> + <method name="_shaped_text_set_preserve_invalid" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="enabled" type="bool" /> <description> - If set to [code]true[/code] text buffer will display invalid characters as hexadecimal codes, otherwise nothing is displayed. </description> </method> - <method name="shaped_text_set_spacing" qualifiers="virtual"> + <method name="_shaped_text_set_spacing" qualifiers="virtual"> <return type="void" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="spacing" type="int" enum="TextServer.SpacingType" /> <param index="2" name="value" type="int" /> <description> - Sets extra spacing added between glyphs or lines in pixels. </description> </method> - <method name="shaped_text_shape" qualifiers="virtual"> + <method name="_shaped_text_shape" qualifiers="virtual"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <description> - Shapes buffer if it's not shaped. Returns [code]true[/code] if the string is shaped successfully. </description> </method> - <method name="shaped_text_sort_logical" qualifiers="virtual"> + <method name="_shaped_text_sort_logical" qualifiers="virtual"> <return type="const Glyph*" /> <param index="0" name="shaped" type="RID" /> <description> - Returns text glyphs in the logical order. </description> </method> - <method name="shaped_text_substr" qualifiers="virtual const"> + <method name="_shaped_text_substr" qualifiers="virtual const"> <return type="RID" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="start" type="int" /> <param index="2" name="length" type="int" /> <description> - Returns text buffer for the substring of the text in the [param shaped] text buffer (including inline objects). </description> </method> - <method name="shaped_text_tab_align" qualifiers="virtual"> + <method name="_shaped_text_tab_align" qualifiers="virtual"> <return type="float" /> <param index="0" name="shaped" type="RID" /> <param index="1" name="tab_stops" type="PackedFloat32Array" /> <description> - Aligns shaped text to the given tab-stops. </description> </method> - <method name="shaped_text_update_breaks" qualifiers="virtual"> + <method name="_shaped_text_update_breaks" qualifiers="virtual"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <description> - Updates line breaking positions in the text buffer. - [b]Note:[/b] This method is used by default line/word breaking methods, and its implementation might be omitted if custom line breaking in implemented. </description> </method> - <method name="shaped_text_update_justification_ops" qualifiers="virtual"> + <method name="_shaped_text_update_justification_ops" qualifiers="virtual"> <return type="bool" /> <param index="0" name="shaped" type="RID" /> <description> - Updates line justification positions (word breaks and elongations) in the text buffer. - [b]Note:[/b] This method is used by default line/word breaking methods, and its implementation might be omitted if custom line breaking in implemented. </description> </method> - <method name="spoof_check" qualifiers="virtual const"> + <method name="_spoof_check" qualifiers="virtual const"> <return type="bool" /> <param index="0" name="string" type="String" /> <description> - Returns [code]true[/code] if [param string] is likely to be an attempt at confusing the reader. </description> </method> - <method name="string_get_word_breaks" qualifiers="virtual const"> + <method name="_string_get_word_breaks" qualifiers="virtual const"> <return type="PackedInt32Array" /> <param index="0" name="string" type="String" /> <param index="1" name="language" type="String" /> <description> - Returns array of the word break character offsets. </description> </method> - <method name="string_to_lower" qualifiers="virtual const"> + <method name="_string_to_lower" qualifiers="virtual const"> <return type="String" /> <param index="0" name="string" type="String" /> <param index="1" name="language" type="String" /> <description> - Returns the string converted to lowercase. </description> </method> - <method name="string_to_upper" qualifiers="virtual const"> + <method name="_string_to_upper" qualifiers="virtual const"> <return type="String" /> <param index="0" name="string" type="String" /> <param index="1" name="language" type="String" /> <description> - Returns the string converted to uppercase. </description> </method> - <method name="strip_diacritics" qualifiers="virtual const"> + <method name="_strip_diacritics" qualifiers="virtual const"> <return type="String" /> <param index="0" name="string" type="String" /> <description> - Strips diacritics from the string. - [b]Note:[/b] If this method is not implemented in the plugin, the default implementation will be used. </description> </method> - <method name="tag_to_name" qualifiers="virtual const"> + <method name="_tag_to_name" qualifiers="virtual const"> <return type="String" /> <param index="0" name="tag" type="int" /> <description> - Converts OpenType tag to readable feature, variation, script or language name. </description> </method> </methods> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 54eb83297d..fd9c44091c 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -188,7 +188,7 @@ </description> </method> <method name="get_used_rect"> - <return type="Rect2" /> + <return type="Rect2i" /> <description> Returns a rectangle enclosing the used (non-empty) tiles of the map, including all layers. </description> diff --git a/doc/classes/Tree.xml b/doc/classes/Tree.xml index f6a078602c..539ca38190 100644 --- a/doc/classes/Tree.xml +++ b/doc/classes/Tree.xml @@ -312,6 +312,9 @@ The drop mode as an OR combination of flags. See [enum DropModeFlags] constants. Once dropping is done, reverts to [constant DROP_MODE_DISABLED]. Setting this during [method Control._can_drop_data] is recommended. This controls the drop sections, i.e. the decision and drawing of possible drop locations based on the mouse position. </member> + <member name="enable_recursive_folding" type="bool" setter="set_enable_recursive_folding" getter="is_recursive_folding_enabled" default="true"> + If [code]true[/code], recursive folding is enabled for this [Tree]. Holding down Shift while clicking the fold arrow collapses or uncollapses the [TreeItem] and all its descendants. + </member> <member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="2" /> <member name="hide_folding" type="bool" setter="set_hide_folding" getter="is_folding_hidden" default="false"> If [code]true[/code], the folding arrow is hidden. diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index fdae6d205d..c109dc57f7 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -321,6 +321,14 @@ Returns the [Tree] that owns this TreeItem. </description> </method> + <method name="is_any_collapsed"> + <return type="bool" /> + <param index="0" name="only_visible" type="bool" default="false" /> + <description> + Returns [code]true[/code] if this [TreeItem], or any of its descendants, is collapsed. + If [param only_visible] is [code]true[/code] it ignores non-visible [TreeItem]s. + </description> + </method> <method name="is_button_disabled" qualifiers="const"> <return type="bool" /> <param index="0" name="column" type="int" /> @@ -442,6 +450,13 @@ If [code]true[/code], the given [param column] is checked. Clears column's indeterminate status. </description> </method> + <method name="set_collapsed_recursive"> + <return type="void" /> + <param index="0" name="enable" type="bool" /> + <description> + Collapses or uncollapses this [TreeItem] and all the descendants of this item. + </description> + </method> <method name="set_custom_as_button"> <return type="void" /> <param index="0" name="column" type="int" /> diff --git a/doc/classes/Tween.xml b/doc/classes/Tween.xml index 5186972477..acf900ae55 100644 --- a/doc/classes/Tween.xml +++ b/doc/classes/Tween.xml @@ -8,42 +8,85 @@ [Tween] is more suited than [AnimationPlayer] for animations where you don't know the final values in advance. For example, interpolating a dynamically-chosen camera zoom value is best done with a [Tween]; it would be difficult to do the same thing with an [AnimationPlayer] node. Tweens are also more light-weight than [AnimationPlayer], so they are very much suited for simple animations or general tasks that don't require visual tweaking provided by the editor. They can be used in a fire-and-forget manner for some logic that normally would be done by code. You can e.g. make something shoot periodically by using a looped [CallbackTweener] with a delay. A [Tween] can be created by using either [method SceneTree.create_tween] or [method Node.create_tween]. [Tween]s created manually (i.e. by using [code]Tween.new()[/code]) are invalid and can't be used for tweening values. A tween animation is created by adding [Tweener]s to the [Tween] object, using [method tween_property], [method tween_interval], [method tween_callback] or [method tween_method]: - [codeblock] + [codeblocks] + [gdscript] var tween = get_tree().create_tween() tween.tween_property($Sprite, "modulate", Color.red, 1) tween.tween_property($Sprite, "scale", Vector2(), 1) tween.tween_callback($Sprite.queue_free) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = GetTree().CreateTween(); + tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f); + tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f); + tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree)); + [/csharp] + [/codeblocks] This sequence will make the [code]$Sprite[/code] node turn red, then shrink, before finally calling [method Node.queue_free] to free the sprite. [Tweener]s are executed one after another by default. This behavior can be changed using [method parallel] and [method set_parallel]. When a [Tweener] is created with one of the [code]tween_*[/code] methods, a chained method call can be used to tweak the properties of this [Tweener]. For example, if you want to set a different transition type in the above example, you can use [method set_trans]: - [codeblock] + [codeblocks] + [gdscript] var tween = get_tree().create_tween() tween.tween_property($Sprite, "modulate", Color.red, 1).set_trans(Tween.TRANS_SINE) tween.tween_property($Sprite, "scale", Vector2(), 1).set_trans(Tween.TRANS_BOUNCE) tween.tween_callback($Sprite.queue_free) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = GetTree().CreateTween(); + tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f).SetTrans(Tween.TransitionType.Sine); + tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f).SetTrans(Tween.TransitionType.Bounce); + tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree)); + [/csharp] + [/codeblocks] Most of the [Tween] methods can be chained this way too. In the following example the [Tween] is bound to the running script's node and a default transition is set for its [Tweener]s: - [codeblock] + [codeblocks] + [gdscript] var tween = get_tree().create_tween().bind_node(self).set_trans(Tween.TRANS_ELASTIC) tween.tween_property($Sprite, "modulate", Color.red, 1) tween.tween_property($Sprite, "scale", Vector2(), 1) tween.tween_callback($Sprite.queue_free) - [/codeblock] + [/gdscript] + [csharp] + var tween = GetTree().CreateTween().BindNode(this).SetTrans(Tween.TransitionType.Elastic); + tween.TweenProperty(GetNode("Sprite"), "modulate", Colors.Red, 1.0f); + tween.TweenProperty(GetNode("Sprite"), "scale", Vector2.Zero, 1.0f); + tween.TweenCallback(new Callable(GetNode("Sprite").QueueFree)); + [/csharp] + [/codeblocks] Another interesting use for [Tween]s is animating arbitrary sets of objects: - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween() for sprite in get_children(): tween.tween_property(sprite, "position", Vector2(0, 0), 1) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween(); + foreach (Node sprite in GetChildren()) + tween.TweenProperty(sprite, "position", Vector2.Zero, 1.0f); + [/csharp] + [/codeblocks] In the example above, all children of a node are moved one after another to position (0, 0). You should avoid using more than one [Tween] per object's property. If two or more tweens animate one property at the same time, the last one created will take priority and assign the final value. If you want to interrupt and restart an animation, consider assigning the [Tween] to a variable: - [codeblock] + [codeblocks] + [gdscript] var tween func animate(): if tween: tween.kill() # Abort the previous animation. tween = create_tween() - [/codeblock] + [/gdscript] + [csharp] + private Tween tween; + + public void Animate() + { + if (tween != null) + tween.Kill(); // Abort the previous animation + tween = CreateTween(); + } + [/csharp] + [/codeblocks] Some [Tweener]s use transitions and eases. The first accepts a [enum TransitionType] constant, and refers to the way the timing of the animation is handled (see [url=https://easings.net/]easings.net[/url] for some examples). The second accepts an [enum EaseType] constant, and controls where the [code]trans_type[/code] is applied to the interpolation (in the beginning, the end, or both). If you don't know which transition and easing to pick, you can try different [enum TransitionType] constants with [constant EASE_IN_OUT], and use the one that looks best. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/tween_cheatsheet.png]Tween easing and transition types cheatsheet[/url] [b]Note:[/b] All [Tween]s will automatically start by default. To prevent a [Tween] from autostarting, you can call [method stop] immediately after it is created. @@ -64,12 +107,20 @@ <return type="Tween" /> <description> Used to chain two [Tweener]s after [method set_parallel] is called with [code]true[/code]. - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween().set_parallel(true) tween.tween_property(...) tween.tween_property(...) # Will run parallelly with above. tween.chain().tween_property(...) # Will run after two above are finished. - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween().SetParallel(true); + tween.TweenProperty(...); + tween.TweenProperty(...); // Will run parallelly with above. + tween.Chain().TweenProperty(...); // Will run after two above are finished. + [/csharp] + [/codeblocks] </description> </method> <method name="custom_step"> @@ -127,12 +178,20 @@ <return type="Tween" /> <description> Makes the next [Tweener] run parallelly to the previous one. Example: - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween() tween.tween_property(...) tween.parallel().tween_property(...) tween.parallel().tween_property(...) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween(); + tween.TweenProperty(...); + tween.Parallel().TweenProperty(...); + tween.Parallel().TweenProperty(...); + [/csharp] + [/codeblocks] All [Tweener]s in the example will run at the same time. You can make the [Tween] parallel by default by using [method set_parallel]. </description> @@ -214,16 +273,30 @@ <description> Creates and appends a [CallbackTweener]. This method can be used to call an arbitrary method in any object. Use [method Callable.bind] to bind additional arguments for the call. Example: object that keeps shooting every 1 second. - [codeblock] + [codeblocks] + [gdscript] var tween = get_tree().create_tween().set_loops() tween.tween_callback(shoot).set_delay(1) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = GetTree().CreateTween().SetLoops(); + tween.TweenCallback(new Callable(Shoot)).SetDelay(1.0f); + [/csharp] + [/codeblocks] Example: turning a sprite red and then blue, with 2 second delay. - [codeblock] + [codeblocks] + [gdscript] var tween = get_tree().create_tween() tween.tween_callback($Sprite.set_modulate.bind(Color.red)).set_delay(2) tween.tween_callback($Sprite.set_modulate.bind(Color.blue)).set_delay(2) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = GetTree().CreateTween(); + Sprite2D sprite = GetNode<Sprite2D>("Sprite"); + tween.TweenCallback(new Callable(() => sprite.Modulate = Colors.Red)).SetDelay(2.0f); + tween.TweenCallback(new Callable(() => sprite.Modulate = Colors.Blue)).SetDelay(2.0f); + [/csharp] + [/codeblocks] </description> </method> <method name="tween_interval"> @@ -232,13 +305,21 @@ <description> Creates and appends an [IntervalTweener]. This method can be used to create delays in the tween animation, as an alternative to using the delay in other [Tweener]s, or when there's no animation (in which case the [Tween] acts as a timer). [param time] is the length of the interval, in seconds. Example: creating an interval in code execution. - [codeblock] + [codeblocks] + [gdscript] # ... some code await create_tween().tween_interval(2).finished # ... more code - [/codeblock] + [/gdscript] + [csharp] + // ... some code + await ToSignal(CreateTween().TweenInterval(2.0f), Tween.SignalName.Finished); + // ... more code + [/csharp] + [/codeblocks] Example: creating an object that moves back and forth and jumps every few seconds. - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween().set_loops() tween.tween_property($Sprite, "position:x", 200.0, 1).as_relative() tween.tween_callback(jump) @@ -246,7 +327,17 @@ tween.tween_property($Sprite, "position:x", -200.0, 1).as_relative() tween.tween_callback(jump) tween.tween_interval(2) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween().SetLoops(); + tween.TweenProperty(GetNode("Sprite"), "position:x", 200.0f, 1.0f).AsRelative(); + tween.TweenCallback(new Callable(Jump)); + tween.TweenInterval(2.0f); + tween.TweenProperty(GetNode("Sprite"), "position:x", -200.0f, 1.0f).AsRelative(); + tween.TweenCallback(new Callable(Jump)); + tween.TweenInterval(2.0f); + [/csharp] + [/codeblocks] </description> </method> <method name="tween_method"> @@ -258,19 +349,41 @@ <description> Creates and appends a [MethodTweener]. This method is similar to a combination of [method tween_callback] and [method tween_property]. It calls a method over time with a tweened value provided as an argument. The value is tweened between [param from] and [param to] over the time specified by [param duration], in seconds. Use [method Callable.bind] to bind additional arguments for the call. You can use [method MethodTweener.set_ease] and [method MethodTweener.set_trans] to tweak the easing and transition of the value or [method MethodTweener.set_delay] to delay the tweening. Example: making a 3D object look from one point to another point. - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween() tween.tween_method(look_at.bind(Vector3.UP), Vector3(-1, 0, -1), Vector3(1, 0, -1), 1) # The look_at() method takes up vector as second argument. - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween(); + tween.TweenMethod(new Callable(() => LookAt(Vector3.Up)), new Vector3(-1.0f, 0.0f, -1.0f), new Vector3(1.0f, 0.0f, -1.0f), 1.0f); // The LookAt() method takes up vector as second argument. + [/csharp] + [/codeblocks] Example: setting a text of a [Label], using an intermediate method and after a delay. - [codeblock] + [codeblocks] + [gdscript] func _ready(): var tween = create_tween() tween.tween_method(set_label_text, 0, 10, 1).set_delay(1) func set_label_text(value: int): $Label.text = "Counting " + str(value) - [/codeblock] + [/gdscript] + [csharp] + public override void _Ready() + { + base._Ready(); + + Tween tween = CreateTween(); + tween.TweenMethod(new Callable(SetLabelText), 0.0f, 10.0f, 1.0f).SetDelay(1.0f); + } + + private void SetLabelText(int value) + { + GetNode<Label>("Label").Text = $"Counting {value}"; + } + [/csharp] + [/codeblocks] </description> </method> <method name="tween_property"> @@ -281,19 +394,33 @@ <param index="3" name="duration" type="float" /> <description> Creates and appends a [PropertyTweener]. This method tweens a [param property] of an [param object] between an initial value and [param final_val] in a span of time equal to [param duration], in seconds. The initial value by default is the property's value at the time the tweening of the [PropertyTweener] starts. For example: - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween() tween.tween_property($Sprite, "position", Vector2(100, 200), 1) tween.tween_property($Sprite, "position", Vector2(200, 300), 1) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween(); + tween.TweenProperty(GetNode("Sprite"), "position", new Vector2(100.0f, 200.0f), 1.0f); + tween.TweenProperty(GetNode("Sprite"), "position", new Vector2(200.0f, 300.0f), 1.0f); + [/csharp] + [/codeblocks] will move the sprite to position (100, 200) and then to (200, 300). If you use [method PropertyTweener.from] or [method PropertyTweener.from_current], the starting position will be overwritten by the given value instead. See other methods in [PropertyTweener] to see how the tweening can be tweaked further. [b]Note:[/b] You can find the correct property name by hovering over the property in the Inspector. You can also provide the components of a property directly by using [code]"property:component"[/code] (eg. [code]position:x[/code]), where it would only apply to that particular component. Example: moving object twice from the same position, with different transition types. - [codeblock] + [codeblocks] + [gdscript] var tween = create_tween() tween.tween_property($Sprite, "position", Vector2.RIGHT * 300, 1).as_relative().set_trans(Tween.TRANS_SINE) tween.tween_property($Sprite, "position", Vector2.RIGHT * 300, 1).as_relative().from_current().set_trans(Tween.TRANS_EXPO) - [/codeblock] + [/gdscript] + [csharp] + Tween tween = CreateTween(); + tween.TweenProperty(GetNode("Sprite"), "position", Vector2.Right * 300.0f, 1.0f).AsRelative().SetTrans(Tween.TransitionType.Sine); + tween.TweenProperty(GetNode("Sprite"), "position", Vector2.Right * 300.0f, 1.0f).AsRelative().FromCurrent().SetTrans(Tween.TransitionType.Expo); + [/csharp] + [/codeblocks] </description> </method> </methods> diff --git a/doc/classes/Window.xml b/doc/classes/Window.xml index 2c0a694ef9..c585b54ee1 100644 --- a/doc/classes/Window.xml +++ b/doc/classes/Window.xml @@ -381,7 +381,8 @@ Note that behavior might be different depending on the platform. </member> <member name="transparent" type="bool" setter="set_flag" getter="get_flag" default="false"> - If [code]true[/code], the [Window]'s background can be transparent. This is best used with embedded windows. Currently non-embedded [Window] transparency is implemented only for MacOS. + If [code]true[/code], the [Window]'s background can be transparent. This is best used with embedded windows. + [b]Note:[/b] This flag has no effect if [member ProjectSettings.display/window/per_pixel_transparency/allowed] is set to [code]false[/code]. </member> <member name="unfocusable" type="bool" setter="set_flag" getter="get_flag" default="false"> If [code]true[/code], the [Window] can't be focused nor interacted with. It can still be visible. @@ -454,6 +455,11 @@ Emitted when the [constant NOTIFICATION_THEME_CHANGED] notification is sent. </description> </signal> + <signal name="titlebar_changed"> + <description> + Emitted when window title bar decorations are changed, e.g., macOS window enter/exit full screen mode, or extend-to-title flag is changed. + </description> + </signal> <signal name="visibility_changed"> <description> Emitted when [Window] is made visible or disappears. diff --git a/doc/classes/XRInterface.xml b/doc/classes/XRInterface.xml index 6296b95e6c..3e48b8284a 100644 --- a/doc/classes/XRInterface.xml +++ b/doc/classes/XRInterface.xml @@ -69,6 +69,18 @@ Is [code]true[/code] if this interface has been initialised. </description> </method> + <method name="is_passthrough_enabled"> + <return type="bool" /> + <description> + Is [code]true[/code] if passthrough is enabled. + </description> + </method> + <method name="is_passthrough_supported"> + <return type="bool" /> + <description> + Is [code]true[/code] if this interface supports passthrough. + </description> + </method> <method name="set_play_area_mode"> <return type="bool" /> <param index="0" name="mode" type="int" enum="XRInterface.PlayAreaMode" /> @@ -76,6 +88,19 @@ Sets the active play area mode, will return [code]false[/code] if the mode can't be used with this interface. </description> </method> + <method name="start_passthrough"> + <return type="bool" /> + <description> + Starts passthrough, will return [code]false[/code] if passthrough couldn't be started. + [b]Note:[/b] The viewport used for XR must have a transparent background, otherwise passthrough may not properly render. + </description> + </method> + <method name="stop_passthrough"> + <return type="void" /> + <description> + Stops passthrough. + </description> + </method> <method name="supports_play_area_mode"> <return type="bool" /> <param index="0" name="mode" type="int" enum="XRInterface.PlayAreaMode" /> |