Skip to content

Fix Custom Styles not working #2582

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

Merged
merged 1 commit into from
Apr 27, 2025

Conversation

Jowan-Spooner
Copy link
Member

Some mistakes on a recent PR made custom styles not be used at all 🙈.

Should fix #2577 and #2580 as well as a bunch of peoples issues on discord.

@Jowan-Spooner Jowan-Spooner added Bug 🐞 Something isn't working Critical 💩 labels Apr 27, 2025
@Jowan-Spooner Jowan-Spooner merged commit acf7152 into dialogic-godot:main Apr 27, 2025
3 checks passed
@@ -46,16 +48,16 @@ static func get_fallback_style() -> DialogicStyle:


static func get_style_path(name_or_path:String) -> String:
var path := ""
print(style_directory)
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix! Did you mean to leave in this print statement by the way?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, my bad 🙈 Will push a fix later!

if name_or_path.begins_with("res://"):
if not ResourceLoader.exists(name_or_path):
name_or_path = ""

if name_or_path in style_directory:
path = style_directory[name_or_path]
name_or_path = style_directory[name_or_path]
Copy link
Contributor

Choose a reason for hiding this comment

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

This function seems like it has a side effect of modifying the input argument name_or_path. Is that intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well it's returning the name_or_path variable later and because there is a chance the original value passed into the function is already the path I skipped creating a separate value. Strings are not passed by reference afaik, so this shouldn't be a problem I think.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. Worth testing quickly though. Strings can potentially be very large, so I would have assumed they are passed by reference in GDScript but happy to be proven wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐞 Something isn't working Critical 💩
Development

Successfully merging this pull request may close these issues.

Cannot change styles
2 participants