Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CharFXTransform - relative_index is substracted by 1 each RichTextLabel bbcode effect block #85328

Closed
havi05 opened this issue Nov 24, 2023 · 0 comments · Fixed by #85363
Closed
Assignees
Milestone

Comments

@havi05
Copy link
Contributor

havi05 commented Nov 24, 2023

Godot version

v4.2.rc1.official [ad72de5]

System information

Godot v4.2.rc1 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti (NVIDIA; 31.0.15.3742) - Intel(R) Core(TM) i7-10700F CPU @ 2.90GHz (16 Threads)

Issue description

While trying to use a custom effect script as a workaround for the rainbow bbcode effect at the RichTextLabel I found a bug regarding the CharFXTransform.relative_index.
The variable is explained as follows in the documentation:

The character offset of the glyph, relative to the current RichTextEffect custom block.

However, when using the script below, the character index shifts one to the left each time instead of being at the same position for each new effect block.
grafik

Steps to reproduce

Add this script as Custom Effect to the RichTextLabel (or see the MRP):

extends RichTextEffect
class_name test

var bbcode = "test"

func _process_custom_fx(char_fx):
	if char_fx.relative_index == 5:
		char_fx.color = Color.BLACK
	pass

Add this Text to a Rich TextLabel:

[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]
[test]0123456789[/test]

Minimal reproduction project

relative_index_issue.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants