diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Array.xml | 26 | ||||
-rw-r--r-- | doc/classes/Object.xml | 2 | ||||
-rw-r--r-- | doc/classes/PrimitiveMesh.xml | 3 | ||||
-rw-r--r-- | doc/classes/RenderingServer.xml | 8 | ||||
-rw-r--r-- | doc/classes/RichTextLabel.xml | 55 | ||||
-rw-r--r-- | doc/classes/Signal.xml | 5 | ||||
-rw-r--r-- | doc/classes/String.xml | 2 | ||||
-rw-r--r-- | doc/classes/TileMap.xml | 4 | ||||
-rw-r--r-- | doc/classes/XRInterface.xml | 37 |
9 files changed, 127 insertions, 15 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 213a2254af..c4fec5a729 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -214,7 +214,7 @@ [b]Note:[/b] Calling this function is not the same as writing [code]array[-1][/code]. If the array is empty, accessing by index will pause project execution when running from the editor. </description> </method> - <method name="bsearch"> + <method name="bsearch" qualifiers="const"> <return type="int" /> <param index="0" name="value" type="Variant" /> <param index="1" name="before" type="bool" default="true" /> @@ -223,7 +223,7 @@ [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. </description> </method> - <method name="bsearch_custom"> + <method name="bsearch_custom" qualifiers="const"> <return type="int" /> <param index="0" name="value" type="Variant" /> <param index="1" name="func" type="Callable" /> @@ -276,7 +276,7 @@ array.fill(0) # Initialize the 10 elements to 0. [/gdscript] [csharp] - var array = new Godot.Collections.Array{}; + var array = new Godot.Collections.Array(); array.Resize(10); array.Fill(0); // Initialize the 10 elements to 0. [/csharp] @@ -347,7 +347,7 @@ print(["inside", 7].has("7")) # False [/gdscript] [csharp] - var arr = new Godot.Collections.Array{"inside", 7}; + var arr = new Godot.Collections.Array { "inside", 7 }; // has is renamed to Contains GD.Print(arr.Contains("inside")); // True GD.Print(arr.Contains("outside")); // False @@ -364,7 +364,7 @@ [/gdscript] [csharp] // As there is no "in" keyword in C#, you have to use Contains - var array = new Godot.Collections.Array{2, 4, 6, 8}; + var array = new Godot.Collections.Array { 2, 4, 6, 8 }; if (array.Contains(2)) { GD.Print("Contains!"); @@ -454,10 +454,16 @@ <return type="Variant" /> <description> Returns a random value from the target array. - [codeblock] + [codeblocks] + [gdscript] var array: Array[int] = [1, 2, 3, 4] print(array.pick_random()) # Prints either of the four numbers. - [/codeblock] + [/gdscript] + [csharp] + var array = new Godot.Collections.Array { 1, 2, 3, 4 }; + GD.Print(array.PickRandom()); // Prints either of the four numbers. + [/csharp] + [/codeblocks] </description> </method> <method name="pop_at"> @@ -566,7 +572,7 @@ Returns the slice of the [Array], from [param begin] (inclusive) to [param end] (exclusive), as a new [Array]. The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]). If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]). - If specified, [param step] is the relative index between source elements. It can be negative, then [param begin] must be higher than [param end]. For example, [code][0, 1, 2, 3, 4, 5].slice(5, 1, -2)[/code] returns [code][5, 3][/code]). + If specified, [param step] is the relative index between source elements. It can be negative, then [param begin] must be higher than [param end]. For example, [code][0, 1, 2, 3, 4, 5].slice(5, 1, -2)[/code] returns [code][5, 3][/code]. If [param deep] is true, each element will be copied by value rather than by reference. </description> </method> @@ -583,7 +589,9 @@ print(strings) # Prints [string1, string10, string11, string2] [/gdscript] [csharp] - // There is no sort support for Godot.Collections.Array + var strings = new Godot.Collections.Array { "string1", "string2", "string10", "string11" }; + strings.Sort(); + GD.Print(strings); // Prints [string1, string10, string11, string2] [/csharp] [/codeblocks] To perform natural order sorting, you can use [method sort_custom] with [method String.naturalnocasecmp_to] as follows: diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index e30ff6be19..ab7ae82875 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -639,7 +639,7 @@ <description> Returns an [Array] of connections for the given [param signal] name. Each connection is represented as a [Dictionary] that contains three entries: - [code]signal[/code] is a reference to the [Signal]; - - [code]callable[/code] is a reference to the [Callable]; + - [code]callable[/code] is a reference to the connected [Callable]; - [code]flags[/code] is a combination of [enum ConnectFlags]. </description> </method> diff --git a/doc/classes/PrimitiveMesh.xml b/doc/classes/PrimitiveMesh.xml index b1c8907d8e..b98590d10c 100644 --- a/doc/classes/PrimitiveMesh.xml +++ b/doc/classes/PrimitiveMesh.xml @@ -48,7 +48,8 @@ The current [Material] of the primitive mesh. </member> <member name="uv2_padding" type="float" setter="set_uv2_padding" getter="get_uv2_padding" default="2.0"> - If [member add_uv2] is set, specifies the padding in pixels applied along seams of the mesh. If at generation the size of the lightmap texture can't be determined, the UVs are calculated assuming a texture size of 1024x1024. + If [member add_uv2] is set, specifies the padding in pixels applied along seams of the mesh. Lower padding values allow making better use of the lightmap texture (resulting in higher texel density), but may introduce visible lightmap bleeding along edges. + If the size of the lightmap texture can't be determined when generating the mesh, UV2 is calculated assuming a texture size of 1024x1024. </member> </members> </class> diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 4e3a1bc0ef..e5ab3271dc 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -630,6 +630,14 @@ Sets a light occluder's [Transform2D]. </description> </method> + <method name="canvas_light_set_blend_mode"> + <return type="void" /> + <param index="0" name="light" type="RID" /> + <param index="1" name="mode" type="int" enum="RenderingServer.CanvasLightBlendMode" /> + <description> + Sets the blend mode for the given canvas light. See [enum CanvasLightBlendMode] for options. Equivalent to [member Light2D.blend_mode]. + </description> + </method> <method name="canvas_light_set_color"> <return type="void" /> <param index="0" name="light" type="RID" /> diff --git a/doc/classes/RichTextLabel.xml b/doc/classes/RichTextLabel.xml index 1ecc8a1d4e..49bb65b64d 100644 --- a/doc/classes/RichTextLabel.xml +++ b/doc/classes/RichTextLabel.xml @@ -106,6 +106,45 @@ <return type="PopupMenu" /> <description> Returns the [PopupMenu] of this [RichTextLabel]. By default, this menu is displayed when right-clicking on the [RichTextLabel]. + You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example: + [codeblocks] + [gdscript] + func _ready(): + var menu = get_menu() + # Remove "Select All" item. + menu.remove_item(MENU_SELECT_ALL) + # Add custom items. + menu.add_separator() + menu.add_item("Duplicate Text", MENU_MAX + 1) + # Connect callback. + menu.id_pressed.connect(_on_item_pressed) + + func _on_item_pressed(id): + if id == MENU_MAX + 1: + add_text("\n" + get_parsed_text()) + [/gdscript] + [csharp] + public override void _Ready() + { + var menu = GetMenu(); + // Remove "Select All" item. + menu.RemoveItem(RichTextLabel.MenuItems.SelectAll); + // Add custom items. + menu.AddSeparator(); + menu.AddItem("Duplicate Text", RichTextLabel.MenuItems.Max + 1); + // Add event handler. + menu.IdPressed += OnItemPressed; + } + + public void OnItemPressed(int id) + { + if (id == TextEdit.MenuItems.Max + 1) + { + AddText("\n" + GetParsedText()); + } + } + [/csharp] + [/codeblocks] [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property. </description> </method> @@ -193,6 +232,13 @@ If [member threaded] is enabled, returns [code]true[/code] if the background thread has finished text processing, otherwise always return [code]true[/code]. </description> </method> + <method name="menu_option"> + <return type="void" /> + <param index="0" name="option" type="int" /> + <description> + Executes a given action as defined in the [enum MenuItems] enum. + </description> + </method> <method name="newline"> <return type="void" /> <description> @@ -633,6 +679,15 @@ </constant> <constant name="ITEM_CUSTOMFX" value="26" enum="ItemType"> </constant> + <constant name="MENU_COPY" value="0" enum="MenuItems"> + Copies the selected text. + </constant> + <constant name="MENU_SELECT_ALL" value="1" enum="MenuItems"> + Selects the whole [RichTextLabel] text. + </constant> + <constant name="MENU_MAX" value="2" enum="MenuItems"> + Represents the size of the [enum MenuItems] enum. + </constant> </constants> <theme_items> <theme_item name="default_color" data_type="color" type="Color" default="Color(1, 1, 1, 1)"> diff --git a/doc/classes/Signal.xml b/doc/classes/Signal.xml index 71905e8b2e..cdbeba0220 100644 --- a/doc/classes/Signal.xml +++ b/doc/classes/Signal.xml @@ -85,7 +85,10 @@ <method name="get_connections" qualifiers="const"> <return type="Array" /> <description> - Returns the list of [Callable]s connected to this signal. + Returns an [Array] of connections for this signal. Each connection is represented as a [Dictionary] that contains three entries: + - [code]signal[/code] is a reference to this signal; + - [code]callable[/code] is a reference to the connected [Callable]; + - [code]flags[/code] is a combination of [enum Object.ConnectFlags]. </description> </method> <method name="get_name" qualifiers="const"> diff --git a/doc/classes/String.xml b/doc/classes/String.xml index 143e1f23e9..792cd38741 100644 --- a/doc/classes/String.xml +++ b/doc/classes/String.xml @@ -529,7 +529,7 @@ <return type="bool" /> <param index="0" name="expr" type="String" /> <description> - Does a simple expression match, where [code]*[/code] matches zero or more arbitrary characters and [code]?[/code] matches any single character except a period ([code].[/code]). An empty string or empty expression always evaluates to [code]false[/code]. + Does a simple expression match (also called "glob" or "globbing"), where [code]*[/code] matches zero or more arbitrary characters and [code]?[/code] matches any single character except a period ([code].[/code]). An empty string or empty expression always evaluates to [code]false[/code]. </description> </method> <method name="matchn" qualifiers="const"> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index c116939bd8..5dedea50d0 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -279,8 +279,8 @@ <description> Sets the tile indentifiers for the cell on layer [param layer] at coordinates [param coords]. Each tile of the [TileSet] is identified using three parts: - The source identifier [param source_id] identifies a [TileSetSource] identifier. See [method TileSet.set_source_id], - - The atlas coordinates identifier [param atlas_coords] identifies a tile coordinates in the atlas (if the source is a [TileSetAtlasSource]. For [TileSetScenesCollectionSource] it should always be [code]Vector2i(0, 0)[/code]), - - The alternative tile identifier [param alternative_tile] identifies a tile alternative the source is a [TileSetAtlasSource], and the scene for a [TileSetScenesCollectionSource]. + - The atlas coordinates identifier [param atlas_coords] identifies a tile coordinates in the atlas (if the source is a [TileSetAtlasSource]). For [TileSetScenesCollectionSource] it should always be [code]Vector2i(0, 0)[/code]), + - The alternative tile identifier [param alternative_tile] identifies a tile alternative in the atlas (if the source is a [TileSetAtlasSource]), and the scene for a [TileSetScenesCollectionSource]. If [param source_id] is set to [code]-1[/code], [param atlas_coords] to [code]Vector2i(-1, -1)[/code] or [param alternative_tile] to [code]-1[/code], the cell will be erased. An erased cell gets [b]all[/b] its identifiers automatically set to their respective invalid values, namely [code]-1[/code], [code]Vector2i(-1, -1)[/code] and [code]-1[/code]. </description> </method> diff --git a/doc/classes/XRInterface.xml b/doc/classes/XRInterface.xml index 05d5eb6673..db65ce62f2 100644 --- a/doc/classes/XRInterface.xml +++ b/doc/classes/XRInterface.xml @@ -51,6 +51,12 @@ Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform. </description> </method> + <method name="get_supported_environment_blend_modes"> + <return type="Array" /> + <description> + Returns the an array of supported environment blend modes, see [enum XRInterface.EnvironmentBlendMode]. + </description> + </method> <method name="get_tracking_status" qualifiers="const"> <return type="int" enum="XRInterface.TrackingStatus" /> <description> @@ -101,6 +107,28 @@ Is [code]true[/code] if this interface supports passthrough. </description> </method> + <method name="set_environment_blend_mode"> + <return type="bool" /> + <param index="0" name="mode" type="int" enum="XRInterface.EnvironmentBlendMode" /> + <description> + Sets the active environment blend mode. + [param mode] is the [enum XRInterface.EnvironmentBlendMode] starting with the next frame. + [b]Note:[/b] Not all runtimes support all environment blend modes, so it is important to check this at startup. For example: + [codeblock] + func _ready(): + var xr_interface : XRInterface = XRServer.find_interface("OpenXR") + if xr_interface and xr_interface.is_initialized(): + var vp : Viewport = get_viewport() + vp.use_xr = true + var acceptable_modes = [ XRInterface.XR_ENV_BLEND_MODE_OPAQUE, XRInterface.XR_ENV_BLEND_MODE_ADDITIVE ] + var modes = xr_interface.get_supported_environment_blend_modes() + for mode in acceptable_modes: + if mode in modes: + xr_interface.set_environment_blend_mode(mode) + break + [/codeblock] + </description> + </method> <method name="set_play_area_mode"> <return type="bool" /> <param index="0" name="mode" type="int" enum="XRInterface.PlayAreaMode" /> @@ -220,5 +248,14 @@ <constant name="XR_PLAY_AREA_STAGE" value="4" enum="PlayAreaMode"> Same as roomscale but origin point is fixed to the center of the physical space, XRServer.center_on_hmd disabled. </constant> + <constant name="XR_ENV_BLEND_MODE_OPAQUE" value="0" enum="EnvironmentBlendMode"> + Opaque blend mode. This is typically used for VR devices. + </constant> + <constant name="XR_ENV_BLEND_MODE_ADDITIVE" value="1" enum="EnvironmentBlendMode"> + Additive blend mode. This is typically used for AR devices or VR devices with passthrough. + </constant> + <constant name="XR_ENV_BLEND_MODE_ALPHA_BLEND" value="2" enum="EnvironmentBlendMode"> + Alpha blend mode. This is typically used for AR or VR devices with passthrough capabilities. The alpha channel controls how much of the passthrough is visible. Alpha of 0.0 means the passthrough is visible and this pixel works in ADDITIVE mode. Alpha of 1.0 means that the passthrough is not visible and this pixel works in OPAQUE mode. + </constant> </constants> </class> |