Skip to content

Commit

Permalink
Merge pull request godotengine#86331 from Calinou/doc-richtexteffect
Browse files Browse the repository at this point in the history
Improve RichTextLabel `install_effect()` documentation
  • Loading branch information
YuriSizov committed Dec 19, 2023
2 parents fc082dd + 78fff72 commit 3ce73e5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion doc/classes/RichTextEffect.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
A custom effect for a [RichTextLabel].
</brief_description>
<description>
A custom effect for a [RichTextLabel].
A custom effect for a [RichTextLabel], which can be loaded in the [RichTextLabel] inspector or using [method RichTextLabel.install_effect].
[b]Note:[/b] For a [RichTextEffect] to be usable, a BBCode tag must be defined as a member variable called [code]bbcode[/code] in the script.
[codeblocks]
[gdscript skip-lint]
Expand Down
23 changes: 22 additions & 1 deletion doc/classes/RichTextLabel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,28 @@
<return type="void" />
<param index="0" name="effect" type="Variant" />
<description>
Installs a custom effect. [param effect] should be a valid [RichTextEffect].
Installs a custom effect. This can also be done in the RichTextLabel inspector using the [member custom_effects] property. [param effect] should be a valid [RichTextEffect].
Example RichTextEffect:
[codeblock]
# effect.gd
class_name MyCustomEffect
extends RichTextEffect

var bbcode = "my_custom_effect"

# ...
[/codeblock]
Registering the above effect in RichTextLabel from script:
[codeblock]
# rich_text_label.gd
extends RichTextLabel

func _ready():
install_effect(MyCustomEffect.new())

# Alternatively, if not using `class_name` in the script that extends RichTextEffect:
install_effect(preload("res://effect.gd").new())
[/codeblock]
</description>
</method>
<method name="is_menu_visible" qualifiers="const">
Expand Down

0 comments on commit 3ce73e5

Please sign in to comment.