Skip to content

Commit acf7152

Browse files
Fix Styles not working (#2582)
The style directory wasn't actually created on build and also the building method was storing resources which the .godot file didn't like AT ALL (took me a moment to figure this out). Now custom styles seem to work again, some more adjustments might be needed.
1 parent 28512a5 commit acf7152

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

addons/dialogic/Core/DialogicResourceUtil.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static func update() -> void:
1313
update_directory('.dtl')
1414
update_label_cache()
1515
update_audio_channel_cache()
16-
DialogicStylesUtil.update_style_directory()
16+
DialogicStylesUtil.build_style_directory()
1717

1818

1919
#region RESOURCE DIRECTORIES

addons/dialogic/Modules/Style/DialogicStylesUtil.gd

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static var style_directory := {}
88
################################################################################
99

1010
static func update_style_directory() -> void:
11-
return ProjectSettings.get_setting('dialogic/layout/style_directory', {})
11+
style_directory = ProjectSettings.get_setting('dialogic/layout/style_directory', {})
1212

1313

1414
static func build_style_directory() -> void:
@@ -24,9 +24,11 @@ static func build_style_directory() -> void:
2424
continue
2525
# TODO this is bad
2626
var resource: DialogicStyle = load(style_path)
27-
style_directory[resource.name] = resource
28-
ProjectSettings.set_setting('dialogic/layout/style_directory', style_directory)
29-
ProjectSettings.save()
27+
style_directory[resource.name] = style_path
28+
29+
if Engine.is_editor_hint():
30+
ProjectSettings.set_setting('dialogic/layout/style_directory', style_directory)
31+
ProjectSettings.save()
3032

3133

3234
static func get_default_style_path() -> String:
@@ -46,16 +48,16 @@ static func get_fallback_style() -> DialogicStyle:
4648

4749

4850
static func get_style_path(name_or_path:String) -> String:
49-
var path := ""
51+
print(style_directory)
5052
if name_or_path.begins_with("res://"):
5153
if not ResourceLoader.exists(name_or_path):
5254
name_or_path = ""
5355

5456
if name_or_path in style_directory:
55-
path = style_directory[name_or_path]
57+
name_or_path = style_directory[name_or_path]
5658

5759
if not name_or_path:
58-
path = get_default_style_path()
60+
name_or_path = get_default_style_path()
5961

6062
if not name_or_path or not ResourceLoader.exists(name_or_path):
6163
return get_fallback_style_path()

0 commit comments

Comments
 (0)