Looking to access the Built in RichTextEffects tag options

Godot Version

Godot_v4.4.1-stable

Question

Hello! My name is Jax(or Wily) and I’m currently searching around to see if there is any way to access the built in RichTextEffects for BBCode and get their CharFXTransform resource(if they have one)? I see that custom text fx have a Dictionary made with all their properties and thats really helpful for what I’m trying to do.

I’m currently making a bottom panel plugin that lets you test bbcode with sliders and controls for all of their tag options like rate=… , freq=… , and etc. Knowing how to access the tag options for the built in Text Effects would help a lot with formatting them to a list of all BBCode tags in the current project. This lets you select the tag you want and copy the paramaters you tested over to your RichTextLabel for ease of use.

This is all I found on it and I might have missed something. This seems extremely confusing wording to my brain right now haha.

For built-in effects you have the list with their parameters here BBCode in RichTextLabel — Godot Engine (stable) documentation in English

For custom effects it’s up to the effect and they don’t register any parameter themselves. I don’t think it’s possible to get the effect parameters outside of the RichTextEffect._process_custom_fx() function. Also, the effect can use that env value to do whatever they need, not only parameters.

The only option I think you have is to parse the values yourself. Something like:

extends Node


@onready var rich_text_label: RichTextLabel = $RichTextLabel
var tag_regex = RegEx.new()


func _ready() -> void:
	tag_regex.compile(r"\[([^\/]+?)\]")
	var tags = tag_regex.search_all(rich_text_label.text)
	for tag in tags:
		var parameters = tag.get_string(1).split(" ")
		for parameter in parameters:
			if parameter.contains("="):
				var param_name = parameter.split("=")[0]
				print("Parameter: %s" % param_name)
			else:
				print("Tag %s" % parameter)

Will parse this bbcode:

[wave amp=50.0 freq=10.0 connected=1]Wave effect[/wave]

[center][tornado radius=10.0 freq=1.0 connected=1]Tornado effect[/tornado][/center]

and output:

Tag wave
Parameter: amp
Parameter: freq
Parameter: connected
Tag center
Tag tornado
Parameter: radius
Parameter: freq
Parameter: connected

1 Like

Thank you for the detailed response :grinning_face_with_smiling_eyes:. It did help me get around my mental block. It really doesn’t seem like their is a clean way to get parameters for BBCode, and it doesn’t seem like theirs an easy way to make them without a lot of coding knowledge.

This is a great solution to parse text if you need to know what tags it has when its received. Unfortunately it doesn’t really fit what I’m trying to do. I want to list all tags in the engine not just in the text. I’ll just have to make them manually.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.