Skip to content

Format the words Memory, Imagination and Spirit in dialogue - #2959

Merged
manuq merged 8 commits into
endlessm:mainfrom
Un-player0:main
Sep 29, 2026
Merged

manuq merged 8 commits into
endlessm:mainfrom
Un-player0:main

Conversation

@Un-player0

Copy link
Copy Markdown
Contributor

Creates Custom RichTextEffects for each thread type

Can be used in .dialogue files as a tag

[Memory]Memory[/Memory]
[Imagination]Imagination[/Imagination]
[Spirit]Spirit[/Spirit]

Resolves: #392

@Un-player0
Un-player0 requested a review from a team as a code owner September 22, 2026 22:21
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Test build no longer available.

@Un-player0

Copy link
Copy Markdown
Contributor Author

Pre-commit is skipping my files, should i move them to another folder?

@manuq

manuq commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Pre-commit is skipping my files, should i move them to another folder?

Yes, that's because addons/dialogue_manager/ is the Dialogue Manager addon and is not intended to be changed. Also because it's not our code, we don't ensure formatting on it. We also update it frequently to be up-to-date.

The actual dialogue balloon used in the game is scenes/ui_elements/dialogue/balloon.tscn (and the script scenes/ui_elements/dialogue/components/balloon.gd) and is a modified copy of the one in addons/dialogue_manager/example_balloon/.

Is it possible to add the custom RichTextEffects without editing the addon?

@Un-player0

Un-player0 commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Is it possible to add the custom RichTextEffects without editing the addon?

Custom effects are only inserted in the markup section of the custom RichTextLabel that DialogueManager uses
image

I'm not sure if this counts as editing the addon.
The Dialogue Manager docs mention the use of BBCode, but not the use of custom text effects https://github.com/nathanhoad/godot_dialogue_manager/blob/main/docs/Basic_Dialogue.md

If it's okay, I can just move the text effects to scenes/ui_elements/dialogue/balloon.tscn

@manuq

manuq commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Is it possible to add the custom RichTextEffects without editing the addon?

Custom effects are only inserted in the markup section of the custom RichTextLabel that DialogueManager uses image

I'm not sure if this counts as editing the addon. The Dialogue Manager docs mention the use of BBCode, but not the use of custom text effects https://github.com/nathanhoad/godot_dialogue_manager/blob/main/docs/Basic_Dialogue.md

If it's okay, I can just move the text effects to scenes/ui_elements/dialogue/balloon.tscn

Is it possible to add the custom RichTextEffects without editing the addon?

Custom effects are only inserted in the markup section of the custom RichTextLabel that DialogueManager uses image

I'm not sure if this counts as editing the addon. The Dialogue Manager docs mention the use of BBCode, but not the use of custom text effects https://github.com/nathanhoad/godot_dialogue_manager/blob/main/docs/Basic_Dialogue.md

If it's okay, I can just move the text effects to scenes/ui_elements/dialogue/balloon.tscn

Yes, move them to our balloon, instead of changing the addon. Also, please move all scripts into scenes/ui_elements/dialogue/components/.

image

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented, this change shouldn't affect the addon. It can be done in Threadbare's balloon.

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works very well! I think it needs refactoring to avoid having 3 scripts that are almost the same.

# SPDX-FileCopyrightText: The Threadbare Authors
# SPDX-License-Identifier: MPL-2.0
@tool
class_name ImaginationTextEffect

@manuq manuq Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scripts of all 3 effects are essentially the same. So please create a base class:

# SPDX-FileCopyrightText: The Threadbare Authors
# SPDX-License-Identifier: MPL-2.0
@tool
## Base class for the magical threads text effect
@abstract class_name BaseThreadsTextEffect
extends RichTextEffect

var text_color_1: Color
var text_color_2: Color

var speed: float = 4.0
var span: float = 2.0


func _process_custom_fx(char_fx: CharFXTransform) -> bool:
	var time_var := sin(char_fx.elapsed_time * speed + (char_fx.range.x / span)) * 0.5 + 0.5

	char_fx.color = text_color_1.lerp(text_color_2, time_var)
	char_fx.offset = Vector2(0, -time_var * 2)

	return true

And then for example the text_effect_imagination.gd would be:

# SPDX-FileCopyrightText: The Threadbare Authors
# SPDX-License-Identifier: MPL-2.0
@tool
class_name ImaginationTextEffect
extends BaseThreadsTextEffect

var bbcode := "Imagination"

func _init() -> void:
	text_color_1 = Color("7c6000ff")
	text_color_2 = Color("c49f23ff")

Comment on lines +9 to +10
var text_color := Color("#7C6000")
var text_markup := Color("c49f23ff")

@manuq manuq Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use same color notation for each variable so they are consistent. You can change the notation from the color picker in the editor.

Grabacion.de.pantalla.desde.2026-09-23.21-39-46.mp4

The second one called "markup" confused me. Checking the code in _process_custom_fx, it lerps between them. So I would just call them color 1 and color 2, or color A and color B, or "start" and "end".

Suggested change
var text_color := Color("#7C6000")
var text_markup := Color("c49f23ff")
var text_color_1 := Color("7c6000ff")
var text_color_2 := Color("c49f23ff")

@Un-player0
Un-player0 requested a review from manuq September 29, 2026 18:10

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!

@manuq
manuq merged commit 53c9581 into endlessm:main Sep 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Format the words Memory, Imagination and Spirit in dialogue

2 participants