Skip to content

Commit f7ba051

Browse files
committed
some unification 🤝
1 parent 4cc3d85 commit f7ba051

File tree

6 files changed

+45
-100
lines changed

6 files changed

+45
-100
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Screenshot](https://coppolaemilio.com/images/dialogic/dialogic-hero-1.0.png?v)
22
Create dialogs, characters and scenes to display conversations in your Godot games.
33

4-
# Version 1.3 (WIP) ![Godot v3.3](https://img.shields.io/badge/godot-v3.3-%23478cbf)
4+
# Version 1.2.4 (WIP) ![Godot v3.3](https://img.shields.io/badge/godot-v3.3-%23478cbf)
55

66
[Changelog](https://github.com/coppolaemilio/dialogic/blob/main/docs/changelog.md)
77
[Installation](#installation)

addons/dialogic/Editor/EditorView.gd

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,9 @@ func _ready():
8888
$ToolBar/FoldTools/ButtonUnfold.connect('pressed', timeline_editor, 'unfold_all_nodes')
8989

9090

91-
#Connecting confirmation menus
92-
$RemoveTimelineConfirmation.connect('confirmed', self, '_on_RemoveTimelineConfirmation_confirmed')
91+
#Connecting confirmation
9392
$RemoveFolderConfirmation.connect('confirmed', self, '_on_RemoveFolderConfirmation_confirmed')
94-
$RemoveCharacterConfirmation.connect('confirmed', self, '_on_RemoveCharacterConfirmation_confirmed')
95-
$RemoveThemeConfirmation.connect('confirmed', self, '_on_RemoveThemeConfirmation_confirmed')
96-
$RemoveValueConfirmation.connect('confirmed', self, '_on_RemoveValueConfirmation_confirmed')
97-
$RemoveGlossaryConfirmation.connect('confirmed', self, '_on_RemoveGlossaryEntryConfirmation_confirmed')
98-
93+
9994
# Loading the version number
10095
var config = ConfigFile.new()
10196
var err = config.load("res://addons/dialogic/plugin.cfg")
@@ -110,44 +105,40 @@ func on_master_tree_editor_selected(editor: String):
110105
$ToolBar/FoldTools.visible = editor == 'timeline'
111106

112107

108+
func popup_remove_confirmation(what):
109+
var remove_text = "Are you sure you want to remove this [resource]? \n (Can't be restored)"
110+
$RemoveConfirmation.dialog_text = remove_text.replace('[resource]', what)
111+
if $RemoveConfirmation.is_connected(
112+
'confirmed', self, '_on_RemoveConfirmation_confirmed'):
113+
$RemoveConfirmation.disconnect(
114+
'confirmed', self, '_on_RemoveConfirmation_confirmed')
115+
$RemoveConfirmation.connect('confirmed', self, '_on_RemoveConfirmation_confirmed', [what])
116+
$RemoveConfirmation.popup_centered()
113117

114-
func _on_RemoveTimelineConfirmation_confirmed():
115-
var dir = Directory.new()
116-
var target = $MainPanel/TimelineEditor.timeline_file
117-
#'target: ', target)
118-
DialogicResources.delete_timeline(target)
119-
DialogicUtil.update_resource_folder_structure()
120-
$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
121-
$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
122-
123-
124-
func _on_RemoveGlossaryEntryConfirmation_confirmed():
125-
var target = $MainPanel/GlossaryEntryEditor.current_definition['id']
126-
DialogicResources.delete_default_definition(target)
127-
$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
128-
$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
129-
130-
func _on_RemoveValueConfirmation_confirmed():
131-
var target = $MainPanel/ValueEditor.current_definition['id']
132-
DialogicResources.delete_default_definition(target)
133-
$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
134-
$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
135118

136119
func _on_RemoveFolderConfirmation_confirmed():
137120
var item_path = $MainPanel/MasterTreeContainer/MasterTree.get_item_path($MainPanel/MasterTreeContainer/MasterTree.get_selected())
138121
DialogicUtil.remove_folder(item_path)
139122
$MainPanel/MasterTreeContainer/MasterTree.build_full_tree()
140123

141-
func _on_RemoveCharacterConfirmation_confirmed():
142-
var filename = $MainPanel/CharacterEditor.opened_character_data['id']
143-
DialogicResources.delete_character(filename)
144-
$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
145-
$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
146-
147124

148-
func _on_RemoveThemeConfirmation_confirmed():
149-
var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file']
150-
DialogicResources.delete_theme(filename)
125+
func _on_RemoveConfirmation_confirmed(what: String = ''):
126+
if what == 'Timeline':
127+
var target = $MainPanel/TimelineEditor.timeline_file
128+
DialogicResources.delete_timeline(target)
129+
DialogicUtil.update_resource_folder_structure()
130+
elif what == 'GlossaryEntry':
131+
var target = $MainPanel/GlossaryEntryEditor.current_definition['id']
132+
DialogicResources.delete_default_definition(target)
133+
elif what == 'Value':
134+
var target = $MainPanel/ValueEditor.current_definition['id']
135+
DialogicResources.delete_default_definition(target)
136+
elif what == 'Theme':
137+
var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file']
138+
DialogicResources.delete_theme(filename)
139+
elif what == 'Character':
140+
var filename = $MainPanel/CharacterEditor.opened_character_data['id']
141+
DialogicResources.delete_character(filename)
151142
$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
152143
$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
153144

@@ -183,12 +174,3 @@ func godot_dialog_connect(who, method_name, signal_name = "file_selected"):
183174

184175
file_picker_data['method'] = method_name
185176
file_picker_data['node'] = who
186-
187-
188-
func _on_file_selected(path):
189-
dprint('[D] Selected '+str(path))
190-
191-
192-
func dprint(what) -> void:
193-
if debug_mode:
194-
print(what)

addons/dialogic/Editor/EditorView.tscn

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ align = 0
123123

124124
[node name="Spacer" type="Control" parent="ToolBar"]
125125
margin_left = 140.0
126-
margin_right = 832.0
126+
margin_right = 820.0
127127
margin_bottom = 32.0
128128
size_flags_horizontal = 3
129129

130130
[node name="Docs" type="ToolButton" parent="ToolBar"]
131131
self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
132-
margin_left = 832.0
133-
margin_right = 942.0
132+
margin_left = 820.0
133+
margin_right = 930.0
134134
margin_bottom = 32.0
135135
hint_tooltip = "Theme Editor"
136136
mouse_default_cursor_shape = 2
@@ -139,11 +139,11 @@ icon = SubResource( 2 )
139139

140140
[node name="Version" type="Label" parent="ToolBar"]
141141
self_modulate = Color( 1, 1, 1, 0.631373 )
142-
margin_left = 942.0
142+
margin_left = 930.0
143143
margin_top = 9.0
144144
margin_right = 1024.0
145145
margin_bottom = 23.0
146-
text = "Dialogic v1.2.1"
146+
text = "Dialogic v1.2.4"
147147

148148
[node name="MainPanel" type="HSplitContainer" parent="."]
149149
anchor_right = 1.0
@@ -216,11 +216,11 @@ margin_right = 280.0
216216
margin_bottom = 14.0
217217
text = "Select or create an element to start working"
218218

219-
[node name="RemoveCharacterConfirmation" type="ConfirmationDialog" parent="."]
219+
[node name="RemoveConfirmation" type="ConfirmationDialog" parent="."]
220220
margin_right = 325.0
221221
margin_bottom = 88.0
222222
rect_min_size = Vector2( 250, 87.5 )
223-
dialog_text = "Are you sure you want to remove this character?
223+
dialog_text = "Are you sure you want to remove this [resource]?
224224
(Can't be restored)"
225225
__meta__ = {
226226
"_edit_use_anchors_": false
@@ -235,43 +235,3 @@ dialog_text = "Are you sure you want to remove this folder and all the items con
235235
__meta__ = {
236236
"_edit_use_anchors_": false
237237
}
238-
239-
[node name="RemoveValueConfirmation" type="ConfirmationDialog" parent="."]
240-
margin_right = 325.0
241-
margin_bottom = 88.0
242-
rect_min_size = Vector2( 250, 87.5 )
243-
dialog_text = "Are you sure you want to remove this value?
244-
(Can't be restored)"
245-
__meta__ = {
246-
"_edit_use_anchors_": false
247-
}
248-
249-
[node name="RemoveThemeConfirmation" type="ConfirmationDialog" parent="."]
250-
margin_right = 325.0
251-
margin_bottom = 88.0
252-
rect_min_size = Vector2( 250, 87.5 )
253-
dialog_text = "Are you sure you want to remove this theme?
254-
(Can't be restored)"
255-
__meta__ = {
256-
"_edit_use_anchors_": false
257-
}
258-
259-
[node name="RemoveGlossaryConfirmation" type="ConfirmationDialog" parent="."]
260-
margin_right = 325.0
261-
margin_bottom = 88.0
262-
rect_min_size = Vector2( 250, 87.5 )
263-
dialog_text = "Are you sure you want to remove this entry?
264-
(Can't be restored)"
265-
__meta__ = {
266-
"_edit_use_anchors_": false
267-
}
268-
269-
[node name="RemoveTimelineConfirmation" type="ConfirmationDialog" parent="."]
270-
margin_right = 325.0
271-
margin_bottom = 88.0
272-
rect_min_size = Vector2( 250, 87.5 )
273-
dialog_text = "Are you sure you want to remove this timeline?
274-
(Can't be restored)"
275-
__meta__ = {
276-
"_edit_use_anchors_": false
277-
}

addons/dialogic/Editor/MasterTree/MasterTree.gd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,14 @@ func _on_TimelinePopupMenu_id_pressed(id):
464464
if id == 1: # Copy to clipboard
465465
OS.set_clipboard(editor_reference.get_node("MainPanel/TimelineEditor").timeline_name)
466466
if id == 2: # Remove
467-
editor_reference.get_node('RemoveTimelineConfirmation').popup_centered()
467+
editor_reference.popup_remove_confirmation('Timeline')
468468

469469
# Character context menu
470470
func _on_CharacterPopupMenu_id_pressed(id):
471471
if id == 0:
472472
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('CHAR_DIR')))
473473
if id == 1:
474-
editor_reference.get_node('RemoveCharacterConfirmation').popup_centered()
474+
editor_reference.popup_remove_confirmation('Character')
475475

476476
# Theme context menu
477477
func _on_ThemePopupMenu_id_pressed(id):
@@ -482,7 +482,7 @@ func _on_ThemePopupMenu_id_pressed(id):
482482
if (filename.begins_with('theme-')):
483483
editor_reference.theme_editor.duplicate_theme(filename)
484484
if id == 2:
485-
editor_reference.get_node('RemoveThemeConfirmation').popup_centered()
485+
editor_reference.popup_remove_confirmation('Theme')
486486

487487
# Definition context menu
488488
func _on_DefinitionPopupMenu_id_pressed(id):
@@ -491,9 +491,9 @@ func _on_DefinitionPopupMenu_id_pressed(id):
491491
OS.shell_open(ProjectSettings.globalize_path(paths['DEFAULT_DEFINITIONS_FILE']))
492492
if id == 1:
493493
if value_editor.visible:
494-
editor_reference.get_node('RemoveValueConfirmation').popup_centered()
494+
editor_reference.popup_remove_confirmation('Value')
495495
elif glossary_entry_editor.visible:
496-
editor_reference.get_node('RemoveGlossaryConfirmation').popup_centered()
496+
editor_reference.popup_remove_confirmation('GlossaryEntry')
497497

498498
## FOLDER POPUPS
499499

addons/dialogic/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ name="Dialogic"
44
description="Create dialogs, characters and scenes to display conversations in your Godot games.
55
https://github.com/coppolaemilio/dialogic"
66
author="Emilio Coppola"
7-
version="1.2.3"
7+
version="1.2.4"
88
script="dialogic.gd"

docs/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## v1.2.4 - WIP
2+
- Unified the remove resource confirmation dialogs
3+
14
## v1.2.3 - Two releases in one day?
25
- Hopefully, final attempt to fix the weird event creation bug [[Jowan-Spooner](https://github.com/Jowan-Spooner)] Thanks [[Drawsi](https://github.com/Drawsi)] for the report and testing!
36

0 commit comments

Comments
 (0)