Skip to content

Commit b35e439

Browse files
committed
Updating theme editor. This is part 1/3
1 parent a6ce9a6 commit b35e439

File tree

4 files changed

+113
-98
lines changed

4 files changed

+113
-98
lines changed

addons/dialogic/Editor/Events/TextEvent.tscn

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ data = {
1414
"width": 16
1515
}
1616

17-
[sub_resource type="ImageTexture" id=3]
17+
[sub_resource type="ImageTexture" id=4]
1818
flags = 4
1919
flags = 4
2020
image = SubResource( 7 )
@@ -54,70 +54,67 @@ show_name_in_timeline = false
5454
sorting_index = 0
5555

5656
[node name="PanelContainer" parent="." index="1"]
57-
margin_right = 191.0
58-
margin_bottom = 82.0
57+
margin_right = 207.0
5958

6059
[node name="MarginContainer" parent="PanelContainer" index="1"]
61-
margin_right = 191.0
62-
margin_bottom = 82.0
60+
margin_right = 207.0
6361

6462
[node name="VBoxContainer" parent="PanelContainer/MarginContainer" index="0"]
65-
margin_right = 185.0
66-
margin_bottom = 76.0
63+
margin_right = 201.0
6764

6865
[node name="Header" parent="PanelContainer/MarginContainer/VBoxContainer" index="0"]
69-
margin_right = 175.0
70-
margin_bottom = 32.0
66+
margin_right = 191.0
67+
margin_bottom = 41.0
7168

7269
[node name="CenterContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="0"]
73-
margin_bottom = 32.0
70+
margin_bottom = 41.0
7471

7572
[node name="IconPanel" parent="PanelContainer/MarginContainer/VBoxContainer/Header/CenterContainer" index="0"]
7673
self_modulate = Color( 1, 1, 1, 1 )
77-
margin_top = 16.0
78-
margin_bottom = 16.0
74+
margin_top = 20.0
75+
margin_bottom = 20.0
7976

8077
[node name="IconTexture" parent="PanelContainer/MarginContainer/VBoxContainer/Header/CenterContainer/IconPanel" index="0"]
8178
self_modulate = Color( 0, 0, 0, 1 )
8279
texture = ExtResource( 5 )
8380

8481
[node name="Warning" parent="PanelContainer/MarginContainer/VBoxContainer/Header/CenterContainer/IconPanel" index="1"]
85-
texture = SubResource( 3 )
82+
texture = SubResource( 4 )
8683

8784
[node name="Content" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="1"]
88-
margin_right = 131.0
89-
margin_bottom = 32.0
85+
margin_right = 147.0
86+
margin_bottom = 41.0
9087

9188
[node name="ExpandControl" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="2"]
9289
visible = true
93-
margin_left = 131.0
94-
margin_top = 1.0
95-
margin_right = 175.0
96-
margin_bottom = 31.0
90+
margin_left = 147.0
91+
margin_top = 5.0
92+
margin_right = 191.0
93+
margin_bottom = 35.0
9794

9895
[node name="Spacer" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="3"]
99-
margin_left = 175.0
100-
margin_right = 175.0
101-
margin_bottom = 32.0
96+
margin_left = 191.0
97+
margin_right = 191.0
98+
margin_bottom = 41.0
10299

103100
[node name="HelpButton" parent="PanelContainer/MarginContainer/VBoxContainer/Header" index="4"]
104101
icon = SubResource( 2 )
105102

106103
[node name="Body" parent="PanelContainer/MarginContainer/VBoxContainer" index="1"]
107104
visible = true
108105
margin_left = 0.0
109-
margin_top = 36.0
110-
margin_right = 175.0
111-
margin_bottom = 70.0
106+
margin_top = 45.0
107+
margin_right = 191.0
108+
margin_bottom = 64.0
112109

113110
[node name="Content" parent="PanelContainer/MarginContainer/VBoxContainer/Body" index="0"]
114111
margin_top = 0.0
115-
margin_right = 175.0
116-
margin_bottom = 34.0
112+
margin_right = 191.0
113+
margin_bottom = 19.0
117114
custom_constants/margin_left = 0
118115

119116
[node name="AllowNoCharacter" type="Node" parent="." index="2"]
120117

121118
[node name="PopupMenu" parent="." index="3"]
122119
custom_styles/hover = SubResource( 6 )
123-
items = [ "Documentation", SubResource( 3 ), 0, false, false, 0, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Move up", SubResource( 3 ), 0, false, false, 2, 0, null, "", false, "Move down", SubResource( 3 ), 0, false, false, 3, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Delete", SubResource( 3 ), 0, false, false, 5, 0, null, "", false ]
120+
items = [ "Documentation", SubResource( 4 ), 0, false, false, -1, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Move up", SubResource( 4 ), 0, false, false, 1, 0, null, "", false, "Move down", SubResource( 4 ), 0, false, false, 2, 0, null, "", false, "", null, 0, false, false, -1, 0, null, "", true, "Delete", SubResource( 4 ), 0, false, false, 4, 0, null, "", false ]

addons/dialogic/Editor/Events/styles/ResourceMenuPanelBackground.tres

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ content_margin_left = 10.0
55
content_margin_right = 10.0
66
content_margin_top = 10.0
77
content_margin_bottom = 10.0
8-
bg_color = Color( 0, 0, 0, 1 )
8+
bg_color = Color( 0.2, 0.23, 0.31, 1 )
99
border_width_left = 1
1010
border_width_top = 1
1111
border_width_right = 1

addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ onready var n : Dictionary = {
155155
},
156156

157157
# Text preview
158-
'text_preview': $VBoxContainer/HBoxContainer3/TextEdit,
159-
'character_picker': $VBoxContainer/HBoxContainer3/CharacterPicker,
158+
'text_preview': $"VBoxContainer/VBoxContainer/HBoxContainer3/TextEdit",
159+
'character_picker': $"VBoxContainer/VBoxContainer/HBoxContainer/CharacterPicker",
160160
}
161161

162162
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -169,9 +169,9 @@ func _ready() -> void:
169169
# Signal connection to free up some memory
170170
connect("visibility_changed", self, "_on_visibility_changed")
171171
if get_constant("dark_theme", "Editor"):
172-
$VBoxContainer/HBoxContainer3/PreviewButton.icon = load("res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg")
172+
$"VBoxContainer/VBoxContainer/HBoxContainer3/PreviewButton".icon = load("res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg")
173173
else:
174-
$VBoxContainer/HBoxContainer3/PreviewButton.icon = load("res://addons/dialogic/Images/Plugin/plugin-editor-icon-light-theme.svg")
174+
$"VBoxContainer/VBoxContainer/HBoxContainer3/PreviewButton".icon = load("res://addons/dialogic/Images/Plugin/plugin-editor-icon-light-theme.svg")
175175

176176
$DelayPreviewTimer.one_shot = true
177177
$DelayPreviewTimer.connect("timeout", self, '_on_DelayPreview_timer_timeout')
@@ -294,11 +294,11 @@ func _ready() -> void:
294294
n['audio_pickers'][name].connect('data_updated', self, '_on_audio_data_updated')
295295

296296
# Character Picker
297-
n['character_picker'].connect('about_to_show', self, 'character_picker_about_to_show')
298-
n['character_picker'].get_popup().connect('index_pressed', self, 'character_picker_selected')
297+
character_picker_update()
298+
n['character_picker'].connect('item_selected', self, 'character_picker_selected')
299299

300300
## Translation
301-
$VBoxContainer/HBoxContainer3/PreviewButton.text = " "+DTS.translate('Preview changes')
301+
$"VBoxContainer/VBoxContainer/HBoxContainer3/PreviewButton".text = " "+DTS.translate('Preview changes')
302302
$VBoxContainer/TabContainer.set_tab_title(0, DTS.translate('DialogTextTabTitle'))
303303
$VBoxContainer/TabContainer.set_tab_title(1, DTS.translate('DialogBoxTabTitle'))
304304
$VBoxContainer/TabContainer.set_tab_title(2, DTS.translate('NameLabelTabTitle'))
@@ -311,22 +311,21 @@ func _ready() -> void:
311311
_on_visibility_changed()
312312

313313

314-
315-
func character_picker_about_to_show():
314+
func character_picker_update():
315+
n['character_picker'].add_item('Random Character')
316+
n['character_picker'].set_item_metadata(0, 'random')
317+
316318
var characters : Array = DialogicUtil.get_character_list()
317-
n['character_picker'].get_popup().clear()
318-
n['character_picker'].get_popup().add_item('Random Character')
319-
n['character_picker'].get_popup().set_item_metadata(0, 'random')
320319
var index = 1
321320
for c in characters:
322-
n['character_picker'].get_popup().add_item(c['name'])
323-
n['character_picker'].get_popup().set_item_metadata(index, c['file'])
321+
n['character_picker'].add_item(c['name'])
322+
n['character_picker'].set_item_metadata(index, c['file'])
324323
index += 1
325-
324+
326325

327326
func character_picker_selected(index):
328-
preview_character_selected = n['character_picker'].get_popup().get_item_metadata(index)
329-
n['character_picker'].text = n['character_picker'].get_popup().get_item_text(index)
327+
preview_character_selected = n['character_picker'].get_item_metadata(index)
328+
n['character_picker'].text = n['character_picker'].get_item_text(index)
330329
_on_PreviewButton_pressed()
331330

332331

@@ -565,9 +564,21 @@ func _on_PreviewButton_pressed() -> void:
565564
if n['character_picker']: # Sometimes it can't find the node
566565
if n['character_picker'].text == 'Random Character':
567566
var characters : Array = DialogicUtil.get_character_list()
568-
if characters.size():
569-
characters.shuffle()
570-
preview_character_selected = characters[0]['file']
567+
var character_array = []
568+
#var index = 0
569+
#print(current_theme)
570+
for c in characters:
571+
#if c['data']['theme'] == current_theme:
572+
character_array.append(c)
573+
#print('Tiene!')
574+
#else:
575+
# print('NOOO')
576+
#print(c)
577+
#index += 1
578+
579+
if character_array.size():
580+
character_array.shuffle()
581+
preview_character_selected = character_array[0]['file']
571582

572583
preview_dialog.dialog_script = {
573584
"events":[

0 commit comments

Comments
 (0)