diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/AABB.xml | 2 | ||||
-rw-r--r-- | doc/classes/AStarGrid2D.xml | 8 | ||||
-rw-r--r-- | doc/classes/AnimatedSprite2D.xml | 102 | ||||
-rw-r--r-- | doc/classes/AnimatedSprite3D.xml | 104 | ||||
-rw-r--r-- | doc/classes/AnimationNodeStateMachineTransition.xml | 2 | ||||
-rw-r--r-- | doc/classes/AnimationPlayer.xml | 18 | ||||
-rw-r--r-- | doc/classes/Array.xml | 15 | ||||
-rw-r--r-- | doc/classes/Dictionary.xml | 12 | ||||
-rw-r--r-- | doc/classes/Image.xml | 2 | ||||
-rw-r--r-- | doc/classes/LineEdit.xml | 89 | ||||
-rw-r--r-- | doc/classes/Rect2i.xml | 6 | ||||
-rw-r--r-- | doc/classes/TextEdit.xml | 101 |
12 files changed, 344 insertions, 117 deletions
diff --git a/doc/classes/AABB.xml b/doc/classes/AABB.xml index ca454cafa3..2c5337eea3 100644 --- a/doc/classes/AABB.xml +++ b/doc/classes/AABB.xml @@ -66,7 +66,7 @@ [/gdscript] [csharp] // position (-3, 2, 0), size (1, 1, 1) - var box = new AABB(new Vector3(-3, 2, 0), new Vector3(1, 1, 1)); + var box = new Aabb(new Vector3(-3, 2, 0), new Vector3(1, 1, 1)); // position (-3, -1, 0), size (3, 4, 2), so we fit both the original AABB and Vector3(0, -1, 2) var box2 = box.Expand(new Vector3(0, -1, 2)); [/csharp] diff --git a/doc/classes/AStarGrid2D.xml b/doc/classes/AStarGrid2D.xml index 32599d7f7d..b253a33377 100644 --- a/doc/classes/AStarGrid2D.xml +++ b/doc/classes/AStarGrid2D.xml @@ -17,11 +17,11 @@ [/gdscript] [csharp] AStarGrid2D astarGrid = new AStarGrid2D(); - astarGrid.Size = new Vector2i(32, 32); - astarGrid.CellSize = new Vector2i(16, 16); + astarGrid.Size = new Vector2I(32, 32); + astarGrid.CellSize = new Vector2I(16, 16); astarGrid.Update(); - GD.Print(astarGrid.GetIdPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) - GD.Print(astarGrid.GetPointPath(Vector2i.Zero, new Vector2i(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) + GD.Print(astarGrid.GetIdPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (1, 1), (2, 2), (3, 3), (3, 4) + GD.Print(astarGrid.GetPointPath(Vector2I.Zero, new Vector2I(3, 4))); // prints (0, 0), (16, 16), (32, 32), (48, 48), (48, 64) [/csharp] [/codeblocks] </description> diff --git a/doc/classes/AnimatedSprite2D.xml b/doc/classes/AnimatedSprite2D.xml index cd9c0cee98..9872c59990 100644 --- a/doc/classes/AnimatedSprite2D.xml +++ b/doc/classes/AnimatedSprite2D.xml @@ -5,34 +5,82 @@ </brief_description> <description> [AnimatedSprite2D] is similar to the [Sprite2D] node, except it carries multiple textures as animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. - After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor. - To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time. </description> <tutorials> <link title="2D Sprite animation">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link> <link title="2D Dodge The Creeps Demo">https://godotengine.org/asset-library/asset/515</link> </tutorials> <methods> + <method name="get_playing_speed" qualifiers="const"> + <return type="float" /> + <description> + Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns a negative value if the current animation is playing backwards. + </description> + </method> + <method name="is_playing" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]). + </description> + </method> + <method name="pause"> + <return type="void" /> + <description> + Pauses the currently playing animation. The [member frame] and [member frame_progress] will be kept and calling [method play] or [method play_backwards] without arguments will resume the animation from the current playback position. + See also [method stop]. + </description> + </method> <method name="play"> <return type="void" /> - <param index="0" name="anim" type="StringName" default="&""" /> - <param index="1" name="backwards" type="bool" default="false" /> + <param index="0" name="name" type="StringName" default="&""" /> + <param index="1" name="custom_speed" type="float" default="1.0" /> + <param index="2" name="from_end" type="bool" default="false" /> + <description> + Plays the animation with key [param name]. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). + If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. + </description> + </method> + <method name="play_backwards"> + <return type="void" /> + <param index="0" name="name" type="StringName" default="&""" /> + <description> + Plays the animation with key [param name] in reverse. + This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information. + </description> + </method> + <method name="set_frame_and_progress"> + <return type="void" /> + <param index="0" name="frame" type="int" /> + <param index="1" name="progress" type="float" /> <description> - Plays the animation named [param anim]. If no [param anim] is provided, the current animation is played. If [param backwards] is [code]true[/code], the animation is played in reverse. - [b]Note:[/b] If [member speed_scale] is negative, the animation direction specified by [param backwards] will be inverted. + The setter of [member frame] resets the [member frame_progress] to [code]0.0[/code] implicitly, but this method avoids that. + This is useful when you want to carry over the current [member frame_progress] to another [member frame]. + [b]Example:[/b] + [codeblocks] + [gdscript] + # Change the animation with keeping the frame index and progress. + var current_frame = animated_sprite.get_frame() + var current_progress = animated_sprite.get_frame_progress() + animated_sprite.play("walk_another_skin") + animated_sprite.set_frame_and_progress(current_frame, current_progress) + [/gdscript] + [/codeblocks] </description> </method> <method name="stop"> <return type="void" /> <description> - Stops the current [member animation] at the current [member frame]. - [b]Note:[/b] This method resets the current frame's elapsed time and removes the [code]backwards[/code] flag from the current [member animation] (if it was previously set by [method play]). If this behavior is undesired, set [member playing] to [code]false[/code] instead. + Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. </description> </method> </methods> <members> <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"default""> - The current animation from the [member frames] resource. If this value changes, the [code]frame[/code] counter is reset. + The current animation from the [member sprite_frames] resource. If this value is changed, the [member frame] counter and the [member frame_progress] are reset. + </member> + <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default=""""> + The key of the animation to play when the scene loads. </member> <member name="centered" type="bool" setter="set_centered" getter="is_centered" default="true"> If [code]true[/code], texture will be centered. @@ -44,32 +92,46 @@ If [code]true[/code], texture is flipped vertically. </member> <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> - The displayed animation frame's index. + The displayed animation frame's index. Setting this property also resets [member frame_progress]. If this is not desired, use [method set_frame_and_progress]. </member> - <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> - The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource. + <member name="frame_progress" type="float" setter="set_frame_progress" getter="get_frame_progress" default="0.0"> + The progress value between [code]0.0[/code] and [code]1.0[/code] until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from [code]1.0[/code] to [code]0.0[/code]. </member> <member name="offset" type="Vector2" setter="set_offset" getter="get_offset" default="Vector2(0, 0)"> The texture's drawing offset. </member> - <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false"> - If [code]true[/code], the [member animation] is currently playing. Setting this property to [code]false[/code] pauses the current animation. Use [method stop] to stop the animation at the current frame instead. - [b]Note:[/b] Unlike [method stop], changing this property to [code]false[/code] preserves the current frame's elapsed time and the [code]backwards[/code] flag of the current [member animation] (if it was previously set by [method play]). - [b]Note:[/b] After a non-looping animation finishes, the property still remains [code]true[/code]. - </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> - The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation is paused, preserving the current frame's elapsed time. + The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed. + If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance. + </member> + <member name="sprite_frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> + The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource. </member> </members> <signals> + <signal name="animation_changed"> + <description> + Emitted when [member animation] changes. + </description> + </signal> <signal name="animation_finished"> <description> - Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop. + Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback. + </description> + </signal> + <signal name="animation_looped"> + <description> + Emitted when the animation loops. </description> </signal> <signal name="frame_changed"> <description> - Emitted when [member frame] changed. + Emitted when [member frame] changes. + </description> + </signal> + <signal name="sprite_frames_changed"> + <description> + Emitted when [member sprite_frames] changes. </description> </signal> </signals> diff --git a/doc/classes/AnimatedSprite3D.xml b/doc/classes/AnimatedSprite3D.xml index 4837ae715f..c39bb99827 100644 --- a/doc/classes/AnimatedSprite3D.xml +++ b/doc/classes/AnimatedSprite3D.xml @@ -4,59 +4,121 @@ 2D sprite node in 3D world, that can use multiple 2D textures for animation. </brief_description> <description> - [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as animation [member frames]. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. - After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor. - To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time. + [AnimatedSprite3D] is similar to the [Sprite3D] node, except it carries multiple textures as animation [member sprite_frames]. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel. </description> <tutorials> <link title="2D Sprite animation (also applies to 3D)">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link> </tutorials> <methods> + <method name="get_playing_speed" qualifiers="const"> + <return type="float" /> + <description> + Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns a negative value if the current animation is playing backwards. + </description> + </method> + <method name="is_playing" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]). + </description> + </method> + <method name="pause"> + <return type="void" /> + <description> + Pauses the currently playing animation. The [member frame] and [member frame_progress] will be kept and calling [method play] or [method play_backwards] without arguments will resume the animation from the current playback position. + See also [method stop]. + </description> + </method> <method name="play"> <return type="void" /> - <param index="0" name="anim" type="StringName" default="&""" /> - <param index="1" name="backwards" type="bool" default="false" /> + <param index="0" name="name" type="StringName" default="&""" /> + <param index="1" name="custom_speed" type="float" default="1.0" /> + <param index="2" name="from_end" type="bool" default="false" /> + <description> + Plays the animation with key [param name]. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). + If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. + </description> + </method> + <method name="play_backwards"> + <return type="void" /> + <param index="0" name="name" type="StringName" default="&""" /> + <description> + Plays the animation with key [param name] in reverse. + This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information. + </description> + </method> + <method name="set_frame_and_progress"> + <return type="void" /> + <param index="0" name="frame" type="int" /> + <param index="1" name="progress" type="float" /> <description> - Plays the animation named [param anim]. If no [param anim] is provided, the current animation is played. If [param backwards] is [code]true[/code], the animation is played in reverse. - [b]Note:[/b] If [member speed_scale] is negative, the animation direction specified by [param backwards] will be inverted. + The setter of [member frame] resets the [member frame_progress] to [code]0.0[/code] implicitly, but this method avoids that. + This is useful when you want to carry over the current [member frame_progress] to another [member frame]. + [b]Example:[/b] + [codeblocks] + [gdscript] + # Change the animation with keeping the frame index and progress. + var current_frame = animated_sprite.get_frame() + var current_progress = animated_sprite.get_frame_progress() + animated_sprite.play("walk_another_skin") + animated_sprite.set_frame_and_progress(current_frame, current_progress) + [/gdscript] + [/codeblocks] </description> </method> <method name="stop"> <return type="void" /> <description> - Stops the current [member animation] at the current [member frame]. - [b]Note:[/b] This method resets the current frame's elapsed time and removes the [code]backwards[/code] flag from the current [member animation] (if it was previously set by [method play]). If this behavior is undesired, set [member playing] to [code]false[/code] instead. + Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. </description> </method> </methods> <members> <member name="animation" type="StringName" setter="set_animation" getter="get_animation" default="&"default""> - The current animation from the [code]frames[/code] resource. If this value changes, the [code]frame[/code] counter is reset. + The current animation from the [member sprite_frames] resource. If this value is changed, the [member frame] counter and the [member frame_progress] are reset. </member> - <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> - The displayed animation frame's index. + <member name="autoplay" type="String" setter="set_autoplay" getter="get_autoplay" default=""""> + The key of the animation to play when the scene loads. </member> - <member name="frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> - The [SpriteFrames] resource containing the animation(s). + <member name="frame" type="int" setter="set_frame" getter="get_frame" default="0"> + The displayed animation frame's index. Setting this property also resets [member frame_progress]. If this is not desired, use [method set_frame_and_progress]. </member> - <member name="playing" type="bool" setter="set_playing" getter="is_playing" default="false"> - If [code]true[/code], the [member animation] is currently playing. Setting this property to [code]false[/code] pauses the current animation. Use [method stop] to stop the animation at the current frame instead. - [b]Note:[/b] Unlike [method stop], changing this property to [code]false[/code] preserves the current frame's elapsed time and the [code]backwards[/code] flag of the current [member animation] (if it was previously set by [method play]). - [b]Note:[/b] After a non-looping animation finishes, the property still remains [code]true[/code]. + <member name="frame_progress" type="float" setter="set_frame_progress" getter="get_frame_progress" default="0.0"> + The progress value between [code]0.0[/code] and [code]1.0[/code] until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from [code]1.0[/code] to [code]0.0[/code]. </member> <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> - The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation is paused, preserving the current frame's elapsed time. + The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed. + If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance. + </member> + <member name="sprite_frames" type="SpriteFrames" setter="set_sprite_frames" getter="get_sprite_frames"> + The [SpriteFrames] resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the [SpriteFrames] resource. </member> </members> <signals> + <signal name="animation_changed"> + <description> + Emitted when [member animation] changes. + </description> + </signal> <signal name="animation_finished"> <description> - Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop. + Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback. + </description> + </signal> + <signal name="animation_looped"> + <description> + Emitted when the animation loops. </description> </signal> <signal name="frame_changed"> <description> - Emitted when [member frame] changed. + Emitted when [member frame] changes. + </description> + </signal> + <signal name="sprite_frames_changed"> + <description> + Emitted when [member sprite_frames] changes. </description> </signal> </signals> diff --git a/doc/classes/AnimationNodeStateMachineTransition.xml b/doc/classes/AnimationNodeStateMachineTransition.xml index eee25fad7c..bccab4613a 100644 --- a/doc/classes/AnimationNodeStateMachineTransition.xml +++ b/doc/classes/AnimationNodeStateMachineTransition.xml @@ -15,7 +15,7 @@ $animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0)) [/gdscript] [csharp] - GetNode<AnimationTree>("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.x == 0)); + GetNode<AnimationTree>("animation_tree").Set("parameters/conditions/idle", IsOnFloor && (LinearVelocity.X == 0)); [/csharp] [/codeblocks] </member> diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index c164fe4363..8982eeedb2 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -113,13 +113,14 @@ <param index="0" name="anim_from" type="StringName" /> <param index="1" name="anim_to" type="StringName" /> <description> - Gets the blend time (in seconds) between two animations, referenced by their keys. + Returns the blend time (in seconds) between two animations, referenced by their keys. </description> </method> <method name="get_playing_speed" qualifiers="const"> <return type="float" /> <description> - Gets the actual playing speed of current animation or 0 if not playing. This speed is the [member playback_speed] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. + Returns a negative value if the current animation is playing backwards. </description> </method> <method name="get_queue"> @@ -145,7 +146,7 @@ <method name="is_playing" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if playing an animation. + Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]). </description> </method> <method name="pause"> @@ -163,7 +164,7 @@ <param index="3" name="from_end" type="bool" default="false" /> <description> Plays the animation with key [param name]. Custom blend times and speed can be set. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). - The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused, or restart if it was stopped (see [method stop] for both pause and stop). If the animation was already playing, it will keep playing. + The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. [b]Note:[/b] The animation will be updated the next time the [AnimationPlayer] is processed. If other variables are updated at the same time this is called, they may be updated too early. To perform the update immediately, call [code]advance(0)[/code]. </description> </method> @@ -221,7 +222,7 @@ <return type="void" /> <param index="0" name="keep_state" type="bool" default="false" /> <description> - Stops the currently playing animation. The animation position is reset to [code]0[/code] and the playback speed is reset to [code]1.0[/code]. See also [method pause]. + Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. If [param keep_state] is [code]true[/code], the animation state is not updated visually. [b]Note:[/b] The method / audio / animation playback tracks will not be processed by this method. </description> @@ -260,9 +261,6 @@ <member name="playback_process_mode" type="int" setter="set_process_callback" getter="get_process_callback" enum="AnimationPlayer.AnimationProcessCallback" default="1"> The process notification in which to update animations. </member> - <member name="playback_speed" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> - The speed scaling ratio. For example, if this value is 1, then the animation plays at normal speed. If it's 0.5, then it plays at half speed. If it's 2, then it plays at double speed. - </member> <member name="reset_on_save" type="bool" setter="set_reset_on_save_enabled" getter="is_reset_on_save_enabled" default="true"> This is used by the editor. If set to [code]true[/code], the scene will be saved with the effects of the reset animation (the animation with the key [code]"RESET"[/code]) applied as if it had been seeked to time 0, with the editor keeping the values that the scene had before saving. This makes it more convenient to preview and edit animations in the editor, as changes to the scene will not be saved as long as they are set in the reset animation. @@ -270,6 +268,10 @@ <member name="root_node" type="NodePath" setter="set_root" getter="get_root" default="NodePath("..")"> The node from which node path references will travel. </member> + <member name="speed_scale" type="float" setter="set_speed_scale" getter="get_speed_scale" default="1.0"> + The speed scaling ratio. For example, if this value is [code]1[/code], then the animation plays at normal speed. If it's [code]0.5[/code], then it plays at half speed. If it's [code]2[/code], then it plays at double speed. + If set to a negative value, the animation is played in reverse. If set to [code]0[/code], the animation will not advance. + </member> </members> <signals> <signal name="animation_changed"> diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index ce4d7693d8..1ac1c0745e 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -392,7 +392,7 @@ <method name="is_read_only" qualifiers="const"> <return type="bool" /> <description> - Returns [code]true[/code] if the array is read-only. See [method set_read_only]. Arrays are automatically read-only if declared with [code]const[/code] keyword. + Returns [code]true[/code] if the array is read-only. See [method make_read_only]. Arrays are automatically read-only if declared with [code]const[/code] keyword. </description> </method> <method name="is_typed" qualifiers="const"> @@ -401,6 +401,12 @@ Returns [code]true[/code] if the array is typed. Typed arrays can only store elements of their associated type and provide type safety for the [code][][/code] operator. Methods of typed array still return [Variant]. </description> </method> + <method name="make_read_only"> + <return type="void" /> + <description> + Makes the array read-only, i.e. disabled modifying of the array's elements. Does not apply to nested content, e.g. content of nested arrays. + </description> + </method> <method name="map" qualifiers="const"> <return type="Array" /> <param index="0" name="method" type="Callable" /> @@ -524,13 +530,6 @@ Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. </description> </method> - <method name="set_read_only"> - <return type="void" /> - <param index="0" name="enable" type="bool" /> - <description> - Makes the [Array] read-only, i.e. disabled modifying of the array's elements. Does not apply to nested content, e.g. content of nested arrays. - </description> - </method> <method name="set_typed"> <return type="void" /> <param index="0" name="type" type="int" /> diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 03e5b5d1d8..ea0bcc5cbb 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -271,12 +271,24 @@ Returns [code]true[/code] if the dictionary is empty (its size is [code]0[/code]). See also [method size]. </description> </method> + <method name="is_read_only" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the dictionary is read-only. See [method make_read_only]. Dictionaries are automatically read-only if declared with [code]const[/code] keyword. + </description> + </method> <method name="keys" qualifiers="const"> <return type="Array" /> <description> Returns the list of keys in the dictionary. </description> </method> + <method name="make_read_only"> + <return type="void" /> + <description> + Makes the dictionary read-only, i.e. disabled modifying of the dictionary's contents. Does not apply to nested content, e.g. content of nested dicitonaries. + </description> + </method> <method name="merge"> <return type="void" /> <param index="0" name="dictionary" type="Dictionary" /> diff --git a/doc/classes/Image.xml b/doc/classes/Image.xml index 051e087611..b13564cfef 100644 --- a/doc/classes/Image.xml +++ b/doc/classes/Image.xml @@ -525,7 +525,7 @@ var img = new Image(); img.Create(imgWidth, imgHeight, false, Image.Format.Rgba8); - img.SetPixelv(new Vector2i(1, 2), Colors.Red); // Sets the color at (1, 2) to red. + img.SetPixelv(new Vector2I(1, 2), Colors.Red); // Sets the color at (1, 2) to red. [/csharp] [/codeblocks] This is the same as [method set_pixel], but with a [Vector2i] argument instead of two integer arguments. diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index b8383aaed9..8ed8622030 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -61,6 +61,45 @@ <return type="PopupMenu" /> <description> Returns the [PopupMenu] of this [LineEdit]. By default, this menu is displayed when right-clicking on the [LineEdit]. + You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example: + [codeblocks] + [gdscript] + func _ready(): + var menu = get_menu() + # Remove all items after "Redo". + menu.item_count = menu.get_item_index(MENU_REDO) + 1 + # Add custom items. + menu.add_separator() + menu.add_item("Insert Date", MENU_MAX + 1) + # Connect callback. + menu.id_pressed.connect(_on_item_pressed) + + func _on_item_pressed(id): + if id == MENU_MAX + 1: + insert_text_at_caret(Time.get_date_string_from_system()) + [/gdscript] + [csharp] + public override void _Ready() + { + var menu = GetMenu(); + // Remove all items after "Redo". + menu.ItemCount = menu.GetItemIndex(LineEdit.MenuItems.Redo) + 1; + // Add custom items. + menu.AddSeparator(); + menu.AddItem("Insert Date", LineEdit.MenuItems.Max + 1); + // Add event handler. + menu.IdPressed += OnItemPressed; + } + + public void OnItemPressed(int id) + { + if (id == LineEdit.MenuItems.Max + 1) + { + InsertTextAtCaret(Time.GetDateStringFromSystem()); + } + } + [/csharp] + [/codeblocks] [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property. </description> </method> @@ -296,70 +335,76 @@ <constant name="MENU_REDO" value="6" enum="MenuItems"> Reverse the last undo action. </constant> - <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems"> + <constant name="MENU_SUBMENU_TEXT_DIR" value="7" enum="MenuItems"> + ID of "Text Writing Direction" submenu. + </constant> + <constant name="MENU_DIR_INHERITED" value="8" enum="MenuItems"> Sets text direction to inherited. </constant> - <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems"> + <constant name="MENU_DIR_AUTO" value="9" enum="MenuItems"> Sets text direction to automatic. </constant> - <constant name="MENU_DIR_LTR" value="9" enum="MenuItems"> + <constant name="MENU_DIR_LTR" value="10" enum="MenuItems"> Sets text direction to left-to-right. </constant> - <constant name="MENU_DIR_RTL" value="10" enum="MenuItems"> + <constant name="MENU_DIR_RTL" value="11" enum="MenuItems"> Sets text direction to right-to-left. </constant> - <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems"> + <constant name="MENU_DISPLAY_UCC" value="12" enum="MenuItems"> Toggles control character display. </constant> - <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems"> + <constant name="MENU_SUBMENU_INSERT_UCC" value="13" enum="MenuItems"> + ID of "Insert Control Character" submenu. + </constant> + <constant name="MENU_INSERT_LRM" value="14" enum="MenuItems"> Inserts left-to-right mark (LRM) character. </constant> - <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems"> + <constant name="MENU_INSERT_RLM" value="15" enum="MenuItems"> Inserts right-to-left mark (RLM) character. </constant> - <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems"> + <constant name="MENU_INSERT_LRE" value="16" enum="MenuItems"> Inserts start of left-to-right embedding (LRE) character. </constant> - <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems"> + <constant name="MENU_INSERT_RLE" value="17" enum="MenuItems"> Inserts start of right-to-left embedding (RLE) character. </constant> - <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems"> + <constant name="MENU_INSERT_LRO" value="18" enum="MenuItems"> Inserts start of left-to-right override (LRO) character. </constant> - <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems"> + <constant name="MENU_INSERT_RLO" value="19" enum="MenuItems"> Inserts start of right-to-left override (RLO) character. </constant> - <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems"> + <constant name="MENU_INSERT_PDF" value="20" enum="MenuItems"> Inserts pop direction formatting (PDF) character. </constant> - <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems"> + <constant name="MENU_INSERT_ALM" value="21" enum="MenuItems"> Inserts Arabic letter mark (ALM) character. </constant> - <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems"> + <constant name="MENU_INSERT_LRI" value="22" enum="MenuItems"> Inserts left-to-right isolate (LRI) character. </constant> - <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems"> + <constant name="MENU_INSERT_RLI" value="23" enum="MenuItems"> Inserts right-to-left isolate (RLI) character. </constant> - <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems"> + <constant name="MENU_INSERT_FSI" value="24" enum="MenuItems"> Inserts first strong isolate (FSI) character. </constant> - <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems"> + <constant name="MENU_INSERT_PDI" value="25" enum="MenuItems"> Inserts pop direction isolate (PDI) character. </constant> - <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems"> + <constant name="MENU_INSERT_ZWJ" value="26" enum="MenuItems"> Inserts zero width joiner (ZWJ) character. </constant> - <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems"> + <constant name="MENU_INSERT_ZWNJ" value="27" enum="MenuItems"> Inserts zero width non-joiner (ZWNJ) character. </constant> - <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems"> + <constant name="MENU_INSERT_WJ" value="28" enum="MenuItems"> Inserts word joiner (WJ) character. </constant> - <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems"> + <constant name="MENU_INSERT_SHY" value="29" enum="MenuItems"> Inserts soft hyphen (SHY) character. </constant> - <constant name="MENU_MAX" value="28" enum="MenuItems"> + <constant name="MENU_MAX" value="30" enum="MenuItems"> Represents the size of the [enum MenuItems] enum. </constant> <constant name="KEYBOARD_TYPE_DEFAULT" value="0" enum="VirtualKeyboardType"> diff --git a/doc/classes/Rect2i.xml b/doc/classes/Rect2i.xml index 325ead0cfa..80a9b40605 100644 --- a/doc/classes/Rect2i.xml +++ b/doc/classes/Rect2i.xml @@ -80,9 +80,9 @@ [/gdscript] [csharp] // position (-3, 2), size (1, 1) - var rect = new Rect2i(new Vector2i(-3, 2), new Vector2i(1, 1)); - // position (-3, -1), size (3, 4), so we fit both rect and Vector2i(0, -1) - var rect2 = rect.Expand(new Vector2i(0, -1)); + var rect = new Rect2I(new Vector2I(-3, 2), new Vector2I(1, 1)); + // position (-3, -1), size (3, 4), so we fit both rect and Vector2I(0, -1) + var rect2 = rect.Expand(new Vector2I(0, -1)); [/csharp] [/codeblocks] </description> diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml index ccd79cd170..c309026aaa 100644 --- a/doc/classes/TextEdit.xml +++ b/doc/classes/TextEdit.xml @@ -390,6 +390,45 @@ <return type="PopupMenu" /> <description> Returns the [PopupMenu] of this [TextEdit]. By default, this menu is displayed when right-clicking on the [TextEdit]. + You can add custom menu items or remove standard ones. Make sure your IDs don't conflict with the standard ones (see [enum MenuItems]). For example: + [codeblocks] + [gdscript] + func _ready(): + var menu = get_menu() + # Remove all items after "Redo". + menu.item_count = menu.get_item_index(MENU_REDO) + 1 + # Add custom items. + menu.add_separator() + menu.add_item("Insert Date", MENU_MAX + 1) + # Connect callback. + menu.id_pressed.connect(_on_item_pressed) + + func _on_item_pressed(id): + if id == MENU_MAX + 1: + insert_text_at_caret(Time.get_date_string_from_system()) + [/gdscript] + [csharp] + public override void _Ready() + { + var menu = GetMenu(); + // Remove all items after "Redo". + menu.ItemCount = menu.GetItemIndex(TextEdit.MenuItems.Redo) + 1; + // Add custom items. + menu.AddSeparator(); + menu.AddItem("Insert Date", TextEdit.MenuItems.Max + 1); + // Add event handler. + menu.IdPressed += OnItemPressed; + } + + public void OnItemPressed(int id) + { + if (id == TextEdit.MenuItems.Max + 1) + { + InsertTextAtCaret(Time.GetDateStringFromSystem()); + } + } + [/csharp] + [/codeblocks] [b]Warning:[/b] This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their [member Window.visible] property. </description> </method> @@ -682,7 +721,7 @@ <return type="void" /> <param index="0" name="option" type="int" /> <description> - Triggers a right-click menu action by the specified index. See [enum MenuItems] for a list of available indexes. + Executes a given action as defined in the [enum MenuItems] enum. </description> </method> <method name="merge_gutters"> @@ -764,18 +803,18 @@ [codeblocks] [gdscript] var result = search("print", SEARCH_WHOLE_WORDS, 0, 0) - if result.x != -1: + if result.x != -1: # Result found. var line_number = result.y var column_number = result.x [/gdscript] [csharp] - Vector2i result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0); - if (result.Length > 0) + Vector2I result = Search("print", (uint)TextEdit.SearchFlags.WholeWords, 0, 0); + if (result.X != -1) { // Result found. - int lineNumber = result.y; - int columnNumber = result.x; + int lineNumber = result.Y; + int columnNumber = result.X; } [/csharp] [/codeblocks] @@ -1224,70 +1263,76 @@ <constant name="MENU_REDO" value="6" enum="MenuItems"> Redoes the previous action. </constant> - <constant name="MENU_DIR_INHERITED" value="7" enum="MenuItems"> + <constant name="MENU_SUBMENU_TEXT_DIR" value="7" enum="MenuItems"> + ID of "Text Writing Direction" submenu. + </constant> + <constant name="MENU_DIR_INHERITED" value="8" enum="MenuItems"> Sets text direction to inherited. </constant> - <constant name="MENU_DIR_AUTO" value="8" enum="MenuItems"> + <constant name="MENU_DIR_AUTO" value="9" enum="MenuItems"> Sets text direction to automatic. </constant> - <constant name="MENU_DIR_LTR" value="9" enum="MenuItems"> + <constant name="MENU_DIR_LTR" value="10" enum="MenuItems"> Sets text direction to left-to-right. </constant> - <constant name="MENU_DIR_RTL" value="10" enum="MenuItems"> + <constant name="MENU_DIR_RTL" value="11" enum="MenuItems"> Sets text direction to right-to-left. </constant> - <constant name="MENU_DISPLAY_UCC" value="11" enum="MenuItems"> + <constant name="MENU_DISPLAY_UCC" value="12" enum="MenuItems"> Toggles control character display. </constant> - <constant name="MENU_INSERT_LRM" value="12" enum="MenuItems"> + <constant name="MENU_SUBMENU_INSERT_UCC" value="13" enum="MenuItems"> + ID of "Insert Control Character" submenu. + </constant> + <constant name="MENU_INSERT_LRM" value="14" enum="MenuItems"> Inserts left-to-right mark (LRM) character. </constant> - <constant name="MENU_INSERT_RLM" value="13" enum="MenuItems"> + <constant name="MENU_INSERT_RLM" value="15" enum="MenuItems"> Inserts right-to-left mark (RLM) character. </constant> - <constant name="MENU_INSERT_LRE" value="14" enum="MenuItems"> + <constant name="MENU_INSERT_LRE" value="16" enum="MenuItems"> Inserts start of left-to-right embedding (LRE) character. </constant> - <constant name="MENU_INSERT_RLE" value="15" enum="MenuItems"> + <constant name="MENU_INSERT_RLE" value="17" enum="MenuItems"> Inserts start of right-to-left embedding (RLE) character. </constant> - <constant name="MENU_INSERT_LRO" value="16" enum="MenuItems"> + <constant name="MENU_INSERT_LRO" value="18" enum="MenuItems"> Inserts start of left-to-right override (LRO) character. </constant> - <constant name="MENU_INSERT_RLO" value="17" enum="MenuItems"> + <constant name="MENU_INSERT_RLO" value="19" enum="MenuItems"> Inserts start of right-to-left override (RLO) character. </constant> - <constant name="MENU_INSERT_PDF" value="18" enum="MenuItems"> + <constant name="MENU_INSERT_PDF" value="20" enum="MenuItems"> Inserts pop direction formatting (PDF) character. </constant> - <constant name="MENU_INSERT_ALM" value="19" enum="MenuItems"> + <constant name="MENU_INSERT_ALM" value="21" enum="MenuItems"> Inserts Arabic letter mark (ALM) character. </constant> - <constant name="MENU_INSERT_LRI" value="20" enum="MenuItems"> + <constant name="MENU_INSERT_LRI" value="22" enum="MenuItems"> Inserts left-to-right isolate (LRI) character. </constant> - <constant name="MENU_INSERT_RLI" value="21" enum="MenuItems"> + <constant name="MENU_INSERT_RLI" value="23" enum="MenuItems"> Inserts right-to-left isolate (RLI) character. </constant> - <constant name="MENU_INSERT_FSI" value="22" enum="MenuItems"> + <constant name="MENU_INSERT_FSI" value="24" enum="MenuItems"> Inserts first strong isolate (FSI) character. </constant> - <constant name="MENU_INSERT_PDI" value="23" enum="MenuItems"> + <constant name="MENU_INSERT_PDI" value="25" enum="MenuItems"> Inserts pop direction isolate (PDI) character. </constant> - <constant name="MENU_INSERT_ZWJ" value="24" enum="MenuItems"> + <constant name="MENU_INSERT_ZWJ" value="26" enum="MenuItems"> Inserts zero width joiner (ZWJ) character. </constant> - <constant name="MENU_INSERT_ZWNJ" value="25" enum="MenuItems"> + <constant name="MENU_INSERT_ZWNJ" value="27" enum="MenuItems"> Inserts zero width non-joiner (ZWNJ) character. </constant> - <constant name="MENU_INSERT_WJ" value="26" enum="MenuItems"> + <constant name="MENU_INSERT_WJ" value="28" enum="MenuItems"> Inserts word joiner (WJ) character. </constant> - <constant name="MENU_INSERT_SHY" value="27" enum="MenuItems"> + <constant name="MENU_INSERT_SHY" value="29" enum="MenuItems"> Inserts soft hyphen (SHY) character. </constant> - <constant name="MENU_MAX" value="28" enum="MenuItems"> + <constant name="MENU_MAX" value="30" enum="MenuItems"> Represents the size of the [enum MenuItems] enum. </constant> <constant name="ACTION_NONE" value="0" enum="EditAction"> |