Skip to content

Commit 018b9bb

Browse files
committed
Fixed resetting of themes
Fix bug where button choice styles would 'randomly' reset
1 parent 74ee097 commit 018b9bb

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

addons/dialogic/Editor/ThemeEditor/ButtonStylePicker.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ func load_style(data):
1616

1717
$BackgroundTexture/CheckBox.pressed = data[4]
1818
set_path(data[5])
19+
real_file_path = data[5]
1920

2021
$TextureModulation/CheckBox.pressed = data[6]
2122
$TextureModulation/ColorPickerButton.color = data[7]

addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ func _on_generic_checkbox(button_pressed, section, key, update_preview = true) -
639639
# with this generic checkbox logic. TODO
640640
if loading:
641641
return
642+
642643
DialogicResources.set_theme_value(current_theme, section, key, button_pressed)
643644
if update_preview:
644645
_on_PreviewButton_pressed() # Refreshing the preview
@@ -647,6 +648,7 @@ func _on_generic_checkbox(button_pressed, section, key, update_preview = true) -
647648
func _on_generic_value_change(value, section, key, update_preview = true) -> void:
648649
if loading:
649650
return
651+
650652
DialogicResources.set_theme_value(current_theme, section, key, value)
651653
if update_preview:
652654
_on_PreviewButton_pressed() # Refreshing the preview
@@ -737,13 +739,15 @@ func _on_Alignment_item_selected(index) -> void:
737739
func _on_ColorPickerButton_color_changed(color) -> void:
738740
if loading:
739741
return
742+
740743
DialogicResources.set_theme_value(current_theme, 'text','color', '#' + color.to_html())
741744
$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
742745

743746

744747
func _on_ColorPickerButtonShadow_color_changed(color) -> void:
745748
if loading:
746749
return
750+
747751
DialogicResources.set_theme_value(current_theme, 'text','shadow_color', '#' + color.to_html())
748752
$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
749753

@@ -773,6 +777,8 @@ func _on_button_dialogbox_anchor_selected(index):
773777

774778
# Background Texture
775779
func _on_BackgroundTextureButton_pressed() -> void:
780+
if loading:
781+
return
776782
editor_reference.godot_dialog("*.png")
777783
editor_reference.godot_dialog_connect(self, "_on_background_selected")
778784

@@ -813,6 +819,8 @@ func _on_PortraitDimTime_value_changed(value):
813819

814820
# Next indicator
815821
func _on_NextIndicatorButton_pressed() -> void:
822+
if loading:
823+
return
816824
editor_reference.godot_dialog("*.png")
817825
editor_reference.godot_dialog_connect(self, "_on_indicator_selected")
818826

@@ -834,6 +842,8 @@ func _on_indicator_selected(path, target) -> void:
834842

835843

836844
func _on_NextAnimation_item_selected(index) -> void:
845+
if loading:
846+
return
837847
DialogicResources.set_theme_value(current_theme, 'next_indicator', 'animation', n['next_animation'].get_item_text(index))
838848
_on_PreviewButton_pressed() # Refreshing the preview
839849

@@ -875,6 +885,8 @@ func _on_name_background_color_changed(color) -> void:
875885

876886
# Background Texture
877887
func _on_name_image_pressed() -> void:
888+
if loading:
889+
return
878890
editor_reference.godot_dialog("*.png")
879891
editor_reference.godot_dialog_connect(self, "_on_name_texture_selected")
880892

@@ -986,6 +998,8 @@ func _on_button_texture_toggled(button_pressed) -> void:
986998

987999

9881000
func _on_ButtonTextureButton_pressed(section = '') -> void:
1001+
if loading:
1002+
return
9891003
editor_reference.godot_dialog("*.png")
9901004
if section != '':
9911005
# Special modifier
@@ -996,23 +1010,31 @@ func _on_ButtonTextureButton_pressed(section = '') -> void:
9961010
func _on_modifier_button_image_selected(path, _target):
9971011
if loading:
9981012
return
1013+
9991014
n['button_' + current_choice_modifier_selected].set_path(path)
10001015
n['button_' + current_choice_modifier_selected].real_file_path = path
10011016
n['button_' + current_choice_modifier_selected].get_node('BackgroundTexture/Button').text = DialogicResources.get_filename_from_path(path)
10021017
_on_choice_style_modified(current_choice_modifier_selected)
10031018

10041019

10051020
func _on_choice_style_modified(section):
1021+
if loading:
1022+
return
1023+
10061024
DialogicResources.set_theme_value(current_theme, 'buttons', section, n['button_' + section].get_style_array())
10071025

10081026
func _on_native_button_toggled(button_pressed) -> void:
10091027
if loading:
10101028
return
1029+
10111030
DialogicResources.set_theme_value(current_theme, 'buttons', 'use_native', button_pressed)
10121031
toggle_button_customization_fields(button_pressed, false)
10131032

10141033

10151034
func toggle_button_customization_fields(native_enabled: bool, custom_enabled: bool) -> void:
1035+
if loading:
1036+
return
1037+
10161038
var customization_disabled = native_enabled or custom_enabled
10171039
n['button_padding_x'].editable = not customization_disabled
10181040
n['button_padding_y'].editable = not customization_disabled
@@ -1026,6 +1048,8 @@ func _on_CustomButtonsCheckBox_toggled(button_pressed):
10261048

10271049

10281050
func _on_CustomButtonsButton_pressed():
1051+
if loading:
1052+
return
10291053
editor_reference.godot_dialog("*.tscn")
10301054
editor_reference.godot_dialog_connect(self, "_on_custom_button_selected")
10311055

@@ -1043,11 +1067,15 @@ func _on_choice_show_toggled(button_pressed) -> void:
10431067

10441068
## TITLE FONT
10451069
func _on_Glossary_TitleFontButton_pressed():
1070+
if loading:
1071+
return
10461072
editor_reference.godot_dialog("*.tres")
10471073
editor_reference.godot_dialog_connect(self, "_on_Glossary_TitleFont_selected")
10481074

10491075

10501076
func _on_Glossary_TitleFontOpen_pressed():
1077+
if loading:
1078+
return
10511079
var theme = DialogicResources.get_theme_config(current_theme)
10521080
editor_reference.editor_interface.inspect_object(load(theme.get_value('definitions', 'font', 'res://addons/dialogic/Example Assets/Fonts/GlossaryFont.tres')))
10531081

@@ -1069,6 +1097,8 @@ func _on_Glossary_TitleColorPicker_color_changed(color):
10691097

10701098
## TEXT
10711099
func _on_Glossary_TextFontButton_pressed():
1100+
if loading:
1101+
return
10721102
editor_reference.godot_dialog("*.tres")
10731103
editor_reference.godot_dialog_connect(self, "_on_Glossary_TextFont_selected")
10741104

@@ -1082,6 +1112,8 @@ func _on_Glossary_TextFont_selected(path, target):
10821112

10831113

10841114
func _on_Glossary_TextFontOpen_pressed():
1115+
if loading:
1116+
return
10851117
var theme = DialogicResources.get_theme_config(current_theme)
10861118
editor_reference.editor_interface.inspect_object(load(theme.get_value('definitions', 'text_font', 'res://addons/dialogic/Example Assets/Fonts/GlossaryFont.tres')))
10871119

@@ -1095,6 +1127,8 @@ func _on_Glossary_TextColorPicker_color_changed(color):
10951127

10961128
## EXTRA FONT
10971129
func _on_Glossary_ExtraFontButton_pressed():
1130+
if loading:
1131+
return
10981132
editor_reference.godot_dialog("*.tres")
10991133
editor_reference.godot_dialog_connect(self, "_on_Glossary_ExtraFont_selected")
11001134

@@ -1108,6 +1142,8 @@ func _on_Glossary_ExtraFont_selected(path, target):
11081142

11091143

11101144
func _on_Glossary_ExtraFontOpen_pressed():
1145+
if loading:
1146+
return
11111147
var theme = DialogicResources.get_theme_config(current_theme)
11121148
editor_reference.editor_interface.inspect_object(load(theme.get_value('definitions', 'extra_font', 'res://addons/dialogic/Example Assets/Fonts/GlossaryFont.tres')))
11131149

@@ -1130,11 +1166,15 @@ func _on_Glossary_HighlightColorPicker_color_changed(color):
11301166

11311167

11321168
func _on_BgPanelSelection_pressed():
1169+
if loading:
1170+
return
11331171
editor_reference.godot_dialog("*.tres")
11341172
editor_reference.godot_dialog_connect(self, "_on_Glossary_BackgroundPanel_selected")
11351173

11361174

11371175
func _on_BGPanelOpen_pressed():
1176+
if loading:
1177+
return
11381178
var theme = DialogicResources.get_theme_config(current_theme)
11391179
editor_reference.editor_interface.inspect_object(load(theme.get_value('definitions', 'background_panel', 'res://addons/dialogic/Example Assets/backgrounds/GlossaryBackground.tres')))
11401180

@@ -1148,5 +1188,7 @@ func _on_Glossary_BackgroundPanel_selected(path, target):
11481188

11491189
## ------------ AUDIO TAB ------------------------------------
11501190
func _on_audio_data_updated(section):
1191+
if loading:
1192+
return
11511193
DialogicResources.set_theme_value(current_theme, 'audio', section, n['audio_pickers'][section].get_data())
11521194
_on_PreviewButton_pressed()

0 commit comments

Comments
 (0)