Skip to content

Commit

Permalink
Remove empty [b]Example:[/b] lines from the class reference
Browse files Browse the repository at this point in the history
  • Loading branch information
Mickeon committed Aug 18, 2024
1 parent 1bd740d commit d0fda1a
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 73 deletions.
10 changes: 3 additions & 7 deletions doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -667,12 +667,9 @@
<return type="float" />
<param index="0" name="lin" type="float" />
<description>
Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear).
[b]Example:[/b]
Converts from linear energy to decibels (audio). Since volume is not normally linear, this can be used to implement volume sliders that behave as expected.
[b]Example:[/b] Change the Master bus's volume through a [Slider] node, which ranges from [code]0.0[/code] to [code]1.0[/code]:
[codeblock]
# "Slider" refers to a node that inherits Range such as HSlider or VSlider.
# Its range must be configured to go from 0 to 1.
# Change the bus name if you'd like to change the volume of a specific bus only.
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear_to_db($Slider.value))
[/codeblock]
</description>
Expand Down Expand Up @@ -2603,8 +2600,7 @@
</constant>
<constant name="OK" value="0" enum="Error">
Methods that return [enum Error] return [constant OK] when no error occurred.
Since [constant OK] has value 0, and all other error constants are positive integers, it can also be used in boolean checks.
[b]Example:[/b]
Since [constant OK] has value [code]0[/code], and all other error constants are positive integers, it can also be used in boolean checks.
[codeblock]
var error = method_that_returns_error()
if error != OK:
Expand Down
6 changes: 2 additions & 4 deletions doc/classes/AnimatedSprite2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,10 @@
<param index="0" name="frame" type="int" />
<param index="1" name="progress" type="float" />
<description>
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]
Sets [member frame] the [member frame_progress] to the given values. Unlike setting [member frame], this method does not reset the [member frame_progress] to [code]0.0[/code] implicitly.
[b]Example:[/b] Change the animation while keeping the same [member frame] and [member frame_progress].
[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")
Expand Down
6 changes: 2 additions & 4 deletions doc/classes/AnimatedSprite3D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@
<param index="0" name="frame" type="int" />
<param index="1" name="progress" type="float" />
<description>
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]
Sets [member frame] the [member frame_progress] to the given values. Unlike setting [member frame], this method does not reset the [member frame_progress] to [code]0.0[/code] implicitly.
[b]Example:[/b] Change the animation while keeping the same [member frame] and [member frame_progress].
[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")
Expand Down
1 change: 0 additions & 1 deletion doc/classes/AnimationNodeStateMachine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</brief_description>
<description>
Contains multiple [AnimationRootNode]s representing animation states, connected in a graph. State transitions can be configured to happen automatically or via code, using a shortest-path algorithm. Retrieve the [AnimationNodeStateMachinePlayback] object from the [AnimationTree] node to control it programmatically.
[b]Example:[/b]
[codeblocks]
[gdscript]
var state_machine = $AnimationTree.get("parameters/playback")
Expand Down
1 change: 0 additions & 1 deletion doc/classes/AnimationNodeStateMachinePlayback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</brief_description>
<description>
Allows control of [AnimationTree] state machines created with [AnimationNodeStateMachine]. Retrieve with [code]$AnimationTree.get("parameters/playback")[/code].
[b]Example:[/b]
[codeblocks]
[gdscript]
var state_machine = $AnimationTree.get("parameters/playback")
Expand Down
3 changes: 1 addition & 2 deletions doc/classes/Array.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
A built-in data structure that holds a sequence of elements.
</brief_description>
<description>
An array data structure that can contain a sequence of elements of any [Variant] type. Elements are accessed by a numerical index starting at 0. Negative indices are used to count from the back (-1 is the last element, -2 is the second to last, etc.).
[b]Example:[/b]
An array data structure that can contain a sequence of elements of any [Variant] type. Elements are accessed by a numerical index starting at [code]0[/code]. Negative indices are used to count from the back ([code]-1[/code] is the last element, [code]-2[/code] is the second to last, etc.).
[codeblocks]
[gdscript]
var array = ["First", 2, 3, "Last"]
Expand Down
1 change: 0 additions & 1 deletion doc/classes/Callable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</brief_description>
<description>
[Callable] is a built-in [Variant] type that represents a function. It can either be a method within an [Object] instance, or a custom callable used for different purposes (see [method is_custom]). Like all [Variant] types, it can be stored in variables and passed to other functions. It is most commonly used for signal callbacks.
[b]Example:[/b]
[codeblocks]
[gdscript]
func print_args(arg1, arg2, arg3 = ""):
Expand Down
4 changes: 2 additions & 2 deletions doc/classes/CallbackTweener.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
<param index="0" name="delay" type="float" />
<description>
Makes the callback call delayed by given time in seconds.
[b]Example:[/b]
[b]Example:[/b] Call [method Node.queue_free] after 2 seconds.
[codeblock]
var tween = get_tree().create_tween()
tween.tween_callback(queue_free).set_delay(2) #this will call queue_free() after 2 seconds
tween.tween_callback(queue_free).set_delay(2)
[/codeblock]
</description>
</method>
Expand Down
3 changes: 1 addition & 2 deletions doc/classes/EditorInterface.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
<param index="1" name="valid_types" type="StringName[]" default="[]" />
<description>
Pops up an editor dialog for selecting a [Node] from the edited scene. The [param callback] must take a single argument of type [NodePath]. It is called on the selected [NodePath] or the empty path [code]^""[/code] if the dialog is canceled. If [param valid_types] is provided, the dialog will only show Nodes that match one of the listed Node types.
[b]Example:[/b]
[b]Example:[/b] Display the node selection dialog as soon as this node is added to the tree for the first time:
[codeblock]
func _ready():
if Engine.is_editor_hint():
Expand All @@ -322,7 +322,6 @@
<param index="2" name="type_filter" type="PackedInt32Array" default="PackedInt32Array()" />
<description>
Pops up an editor dialog for selecting properties from [param object]. The [param callback] must take a single argument of type [NodePath]. It is called on the selected property path (see [method NodePath.get_as_property_path]) or the empty path [code]^""[/code] if the dialog is canceled. If [param type_filter] is provided, the dialog will only show properties that match one of the listed [enum Variant.Type] values.
[b]Example:[/b]
[codeblock]
func _ready():
if Engine.is_editor_hint():
Expand Down
10 changes: 3 additions & 7 deletions doc/classes/EditorPlugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
<param index="1" name="event" type="InputEvent" />
<description>
Called when there is a root node in the current edited scene, [method _handles] is implemented, and an [InputEvent] happens in the 3D viewport. The return value decides whether the [InputEvent] is consumed or forwarded to other [EditorPlugin]s. See [enum AfterGUIInput] for options.
[b]Example:[/b]
[codeblocks]
[gdscript]
# Prevents the InputEvent from reaching other Editor classes.
Expand All @@ -119,8 +118,7 @@
}
[/csharp]
[/codeblocks]
Must [code]return EditorPlugin.AFTER_GUI_INPUT_PASS[/code] in order to forward the [InputEvent] to other Editor classes.
[b]Example:[/b]
This method must return [constant AFTER_GUI_INPUT_PASS] in order to forward the [InputEvent] to other Editor classes.
[codeblocks]
[gdscript]
# Consumes InputEventMouseMotion and forwards other InputEvent types.
Expand Down Expand Up @@ -188,8 +186,7 @@
<return type="bool" />
<param index="0" name="event" type="InputEvent" />
<description>
Called when there is a root node in the current edited scene, [method _handles] is implemented and an [InputEvent] happens in the 2D viewport. Intercepts the [InputEvent], if [code]return true[/code] [EditorPlugin] consumes the [param event], otherwise forwards [param event] to other Editor classes.
[b]Example:[/b]
Called when there is a root node in the current edited scene, [method _handles] is implemented, and an [InputEvent] happens in the 2D viewport. If this method returns [code]true[/code], [param event] is intercepted by this [EditorPlugin], otherwise [param event] is forwarded to other Editor classes.
[codeblocks]
[gdscript]
# Prevents the InputEvent from reaching other Editor classes.
Expand All @@ -204,8 +201,7 @@
}
[/csharp]
[/codeblocks]
Must [code]return false[/code] in order to forward the [InputEvent] to other Editor classes.
[b]Example:[/b]
This method must return [code]false[/code] in order to forward the [InputEvent] to other Editor classes.
[codeblocks]
[gdscript]
# Consumes InputEventMouseMotion and forwards other InputEvent types.
Expand Down
1 change: 0 additions & 1 deletion doc/classes/EditorSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
- [code]name[/code]: [String] (the name of the property)
- [code]type[/code]: [int] (see [enum Variant.Type])
- optionally [code]hint[/code]: [int] (see [enum PropertyHint]) and [code]hint_string[/code]: [String]
[b]Example:[/b]
[codeblocks]
[gdscript]
var settings = EditorInterface.get_editor_settings()
Expand Down
3 changes: 1 addition & 2 deletions doc/classes/HTTPClient.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
<method name="get_response_headers_as_dictionary">
<return type="Dictionary" />
<description>
Returns all response headers as a Dictionary of structure [code]{ "key": "value1; value2" }[/code] where the case-sensitivity of the keys and values is kept like the server delivers it. A value is a simple String, this string can have more than one value where "; " is used as separator.
[b]Example:[/b]
Returns all response headers as a [Dictionary]. Each entry is composed by the header name, and a [String] containing the values separated by [code]"; "[/code]. The casing is kept the same as the headers were received.
[codeblock]
{
"content-length": 12,
Expand Down
2 changes: 0 additions & 2 deletions doc/classes/Image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,6 @@
<param index="2" name="color" type="Color" />
<description>
Sets the [Color] of the pixel at [code](x, y)[/code] to [param color].
[b]Example:[/b]
[codeblocks]
[gdscript]
var img_width = 10
Expand All @@ -561,7 +560,6 @@
<param index="1" name="color" type="Color" />
<description>
Sets the [Color] of the pixel at [param point] to [param color].
[b]Example:[/b]
[codeblocks]
[gdscript]
var img_width = 10
Expand Down
1 change: 0 additions & 1 deletion doc/classes/Input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@
<param index="0" name="event" type="InputEvent" />
<description>
Feeds an [InputEvent] to the game. Can be used to artificially trigger input events from code. Also generates [method Node._input] calls.
[b]Example:[/b]
[codeblocks]
[gdscript]
var cancel_event = InputEventAction.new()
Expand Down
5 changes: 2 additions & 3 deletions doc/classes/JSON.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
<description>
The [JSON] class enables all data types to be converted to and from a JSON string. This is useful for serializing data, e.g. to save to a file or send over the network.
[method stringify] is used to convert any data type into a JSON string.
[method parse] is used to convert any existing JSON data into a [Variant] that can be used within Godot. If successfully parsed, use [member data] to retrieve the [Variant], and use [code]typeof[/code] to check if the Variant's type is what you expect. JSON Objects are converted into a [Dictionary], but JSON data can be used to store [Array]s, numbers, [String]s and even just a boolean.
[b]Example[/b]
[method parse] is used to convert any existing JSON data into a [Variant] that can be used within Godot. If successfully parsed, use [member data] to retrieve the [Variant], and use [method @GlobalScope.typeof] to check if the Variant's type is what you expect. JSON Objects are converted into a [Dictionary], but JSON data can be used to store [Array]s, numbers, [String]s and even just a boolean.
[codeblock]
var data_to_send = ["a", "b", "c"]
var json_string = JSON.stringify(data_to_send)
Expand All @@ -33,7 +32,7 @@
- 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.
- Certain errors, such as invalid Unicode sequences, do not cause a parser error. Instead, the string is cleaned up and an error is logged to the console.
</description>
<tutorials>
</tutorials>
Expand Down
1 change: 0 additions & 1 deletion doc/classes/JavaScriptObject.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</brief_description>
<description>
JavaScriptObject is used to interact with JavaScript objects retrieved or created via [method JavaScriptBridge.get_interface], [method JavaScriptBridge.create_object], or [method JavaScriptBridge.create_callback].
[b]Example:[/b]
[codeblock]
extends Node

Expand Down
4 changes: 2 additions & 2 deletions doc/classes/LineEdit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@
</member>
<member name="max_length" type="int" setter="set_max_length" getter="get_max_length" default="0">
Maximum number of characters that can be entered inside the [LineEdit]. If [code]0[/code], there is no limit.
When a limit is defined, characters that would exceed [member max_length] are truncated. This happens both for existing [member text] contents when setting the max length, or for new text inserted in the [LineEdit], including pasting. If any input text is truncated, the [signal text_change_rejected] signal is emitted with the truncated substring as parameter.
[b]Example:[/b]
When a limit is defined, characters that would exceed [member max_length] are truncated. This happens both for existing [member text] contents when setting the max length, or for new text inserted in the [LineEdit], including pasting.
If any input text is truncated, the [signal text_change_rejected] signal is emitted with the truncated substring as parameter:
[codeblocks]
[gdscript]
text = "Hello world"
Expand Down
3 changes: 1 addition & 2 deletions doc/classes/MeshDataTool.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@
<param index="1" name="vertex" type="int" />
<description>
Returns the specified vertex index of the given face.
Vertex argument must be either 0, 1, or 2 because faces contain three vertices.
[b]Example:[/b]
[param vertex] must be either [code]0[/code], [code]1[/code], or [code]2[/code] because faces contain three vertices.
[codeblocks]
[gdscript]
var index = mesh_data_tool.get_face_vertex(0, 1) # Gets the index of the second vertex of the first face.
Expand Down
7 changes: 1 addition & 6 deletions doc/classes/ProjectSettings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
- [code]"name"[/code]: [String] (the property's name)
- [code]"type"[/code]: [int] (see [enum Variant.Type])
- optionally [code]"hint"[/code]: [int] (see [enum PropertyHint]) and [code]"hint_string"[/code]: [String]
[b]Example:[/b]
[codeblocks]
[gdscript]
ProjectSettings.set("category/property_name", 0)
Expand Down Expand Up @@ -85,7 +84,6 @@
<param index="1" name="default_value" type="Variant" default="null" />
<description>
Returns the value of the setting identified by [param name]. If the setting doesn't exist and [param default_value] is specified, the value of [param default_value] is returned. Otherwise, [code]null[/code] is returned.
[b]Example:[/b]
[codeblocks]
[gdscript]
print(ProjectSettings.get_setting("application/config/name"))
Expand All @@ -104,8 +102,7 @@
<param index="0" name="name" type="StringName" />
<description>
Similar to [method get_setting], but applies feature tag overrides if any exists and is valid.
[b]Example:[/b]
If the following setting override exists "application/config/name.windows", and the following code is executed:
[b]Example:[/b] If the setting override [code]"application/config/name.windows"[/code] exists, and the following code is executed on a [i]Windows[/i] operating system, the overridden setting is printed instead:
[codeblocks]
[gdscript]
print(ProjectSettings.get_setting_with_override("application/config/name"))
Expand All @@ -114,7 +111,6 @@
GD.Print(ProjectSettings.GetSettingWithOverride("application/config/name"));
[/csharp]
[/codeblocks]
Then the overridden setting will be returned instead if the project is running on the [i]Windows[/i] operating system.
</description>
</method>
<method name="globalize_path" qualifiers="const">
Expand Down Expand Up @@ -224,7 +220,6 @@
<param index="1" name="value" type="Variant" />
<description>
Sets the value of a setting.
[b]Example:[/b]
[codeblocks]
[gdscript]
ProjectSettings.set_setting("application/config/name", "Example")
Expand Down
9 changes: 4 additions & 5 deletions doc/classes/PropertyTweener.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<return type="PropertyTweener" />
<description>
When called, the final value will be used as a relative value instead.
[b]Example:[/b]
[b]Example:[/b] Move the node by [code]100[/code] pixels to the right.
[codeblock]
var tween = get_tree().create_tween()
tween.tween_property(self, "position", Vector2.RIGHT * 100, 1).as_relative() #the node will move by 100 pixels to the right
tween.tween_property(self, "position", Vector2.RIGHT * 100, 1).as_relative()
[/codeblock]
</description>
</method>
Expand All @@ -26,10 +26,10 @@
<param index="0" name="value" type="Variant" />
<description>
Sets a custom initial value to the [PropertyTweener].
[b]Example:[/b]
[b]Example:[/b] Move the node from position [code](100, 100)[/code] to [code](200, 100)[/code].
[codeblock]
var tween = get_tree().create_tween()
tween.tween_property(self, "position", Vector2(200, 100), 1).from(Vector2(100, 100)) #this will move the node from position (100, 100) to (200, 100)
tween.tween_property(self, "position", Vector2(200, 100), 1).from(Vector2(100, 100))
[/codeblock]
</description>
</method>
Expand All @@ -48,7 +48,6 @@
<param index="0" name="interpolator_method" type="Callable" />
<description>
Allows interpolating the value with a custom easing function. The provided [param interpolator_method] will be called with a value ranging from [code]0.0[/code] to [code]1.0[/code] and is expected to return a value within the same range (values outside the range can be used for overshoot). The return value of the method is then used for interpolation between initial and final value. Note that the parameter passed to the method is still subject to the tweener's own easing.
[b]Example:[/b]
[codeblock]
@export var curve: Curve

Expand Down
3 changes: 1 addition & 2 deletions doc/classes/SpinBox.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</brief_description>
<description>
[SpinBox] is a numerical input text field. It allows entering integers and floating-point numbers.
[b]Example:[/b]
[b]Example:[/b] Create a [SpinBox], disable its context menu and set its text alignment to right.
[codeblocks]
[gdscript]
var spin_box = SpinBox.new()
Expand All @@ -22,7 +22,6 @@
spinBox.AlignHorizontal = LineEdit.HorizontalAlignEnum.Right;
[/csharp]
[/codeblocks]
The above code will create a [SpinBox], disable context menu on it and set the text alignment to right.
See [Range] class for more options over the [SpinBox].
[b]Note:[/b] With the [SpinBox]'s context menu disabled, you can right-click the bottom half of the spinbox to set the value to its minimum, while right-clicking the top half sets the value to its maximum.
[b]Note:[/b] [SpinBox] relies on an underlying [LineEdit] node. To theme a [SpinBox]'s background, add theme items for [LineEdit] and customize them.
Expand Down
Loading

0 comments on commit d0fda1a

Please sign in to comment.