Browse Source

update dialogic

Arnaud Vergnet 2 years ago
parent
commit
519475a5ba
62 changed files with 2157 additions and 1040 deletions
  1. 17
    2
      addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd
  2. 15
    3
      addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn
  3. 49
    4
      addons/dialogic/Editor/EditorView.gd
  4. 41
    12
      addons/dialogic/Editor/EditorView.tscn
  5. 17
    45
      addons/dialogic/Editor/Events/AudioBlock.gd
  6. 25
    44
      addons/dialogic/Editor/Events/AudioBlock.tscn
  7. 21
    44
      addons/dialogic/Editor/Events/BackgroundMusic.gd
  8. 40
    42
      addons/dialogic/Editor/Events/BackgroundMusic.tscn
  9. 52
    0
      addons/dialogic/Editor/Events/ChangeBackground.gd
  10. 26
    0
      addons/dialogic/Editor/Events/ChangeBackground.tscn
  11. 35
    33
      addons/dialogic/Editor/Events/CharacterJoinBlock.gd
  12. 18
    13
      addons/dialogic/Editor/Events/CharacterJoinBlock.tscn
  13. 53
    3
      addons/dialogic/Editor/Events/Choice.gd
  14. 46
    7
      addons/dialogic/Editor/Events/Choice.tscn
  15. 8
    4
      addons/dialogic/Editor/Events/CloseDialog.gd
  16. 25
    9
      addons/dialogic/Editor/Events/CloseDialog.tscn
  17. 106
    0
      addons/dialogic/Editor/Events/Common/AudioPicker.gd
  18. 101
    0
      addons/dialogic/Editor/Events/Common/AudioPicker.tscn
  19. 56
    0
      addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.gd
  20. 23
    0
      addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn
  21. 13
    14
      addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.gd
  22. 1
    5
      addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.tscn
  23. 54
    0
      addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.gd
  24. 2
    1
      addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.tscn
  25. 34
    0
      addons/dialogic/Editor/Events/Common/ImagePicker.gd
  26. 34
    0
      addons/dialogic/Editor/Events/Common/ImagePicker.tscn
  27. 15
    0
      addons/dialogic/Editor/Events/Common/ImagePreview.gd
  28. 25
    0
      addons/dialogic/Editor/Events/Common/ImagePreview.tscn
  29. 0
    2
      addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn
  30. 0
    44
      addons/dialogic/Editor/Events/Common/PortraitPicker.gd
  31. 11
    26
      addons/dialogic/Editor/Events/Question.gd
  32. 5
    7
      addons/dialogic/Editor/Events/Question.tscn
  33. 0
    60
      addons/dialogic/Editor/Events/SceneEvent.gd
  34. 0
    127
      addons/dialogic/Editor/Events/SceneEvent.tscn
  35. 144
    0
      addons/dialogic/Editor/Events/Templates/EventTemplate.gd
  36. 168
    0
      addons/dialogic/Editor/Events/Templates/EventTemplate.tscn
  37. 43
    0
      addons/dialogic/Editor/Events/Templates/ExpandControl.gd
  38. 38
    0
      addons/dialogic/Editor/Events/Templates/ExpandControl.tscn
  39. 17
    0
      addons/dialogic/Editor/Events/Templates/OptionsControl.gd
  40. 16
    0
      addons/dialogic/Editor/Events/Templates/OptionsControl.tscn
  41. 11
    20
      addons/dialogic/Editor/Events/TextBlock.gd
  42. 7
    13
      addons/dialogic/Editor/Events/TextBlock.tscn
  43. 13
    0
      addons/dialogic/Editor/Events/styles/ChangeBackground.tres
  44. 0
    0
      addons/dialogic/Editor/Events/styles/selected_styleboxflat.tres
  45. 13
    0
      addons/dialogic/Editor/Events/styles/selected_styleboxflat_template.tres
  46. 0
    0
      addons/dialogic/Editor/Events/styles/selected_styleboxflat_text_event.tres
  47. 27
    13
      addons/dialogic/Editor/MasterTree/MasterTree.gd
  48. 64
    11
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd
  49. 245
    154
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn
  50. 85
    44
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd
  51. 5
    4
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn
  52. 0
    1
      addons/dialogic/Images/Context Menus/ActionCopy.svg
  53. 0
    1
      addons/dialogic/Images/Context Menus/Filesystem.svg
  54. 0
    0
      addons/dialogic/Images/Event Icons/Main Icons/change-background.svg
  55. 34
    0
      addons/dialogic/Images/Event Icons/Main Icons/change-background.svg.import
  56. 33
    19
      addons/dialogic/Nodes/BackgroundMusic.gd
  57. 3
    135
      addons/dialogic/Nodes/BackgroundMusic.tscn
  58. 13
    4
      addons/dialogic/Nodes/Portrait.gd
  59. 19
    5
      addons/dialogic/Nodes/TextBubble.gd
  60. 16
    15
      addons/dialogic/Nodes/TextBubble.tscn
  61. 98
    50
      addons/dialogic/Nodes/dialog_node.gd
  62. 77
    0
      addons/dialogic/Other/DialogicSharp.cs

+ 17
- 2
addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd View File

@@ -11,6 +11,7 @@ onready var nodes = {
11 11
 	'description': $HBoxContainer/Container/Description/TextEdit,
12 12
 	'file': $HBoxContainer/Container/FileName/LineEdit,
13 13
 	'color': $HBoxContainer/Container/Color/ColorPickerButton,
14
+	'mirror_portraits_checkbox' : $HBoxContainer/VBoxContainer/HBoxContainer/MirrorOption/MirrorPortraitsCheckBox,
14 15
 	'default_speaker': $HBoxContainer/Container/Actions/DefaultSpeaker,
15 16
 	'display_name_checkbox': $HBoxContainer/Container/Name/CheckBox,
16 17
 	'display_name': $HBoxContainer/Container/DisplayName/LineEdit,
@@ -55,6 +56,7 @@ func clear_character_editor():
55 56
 	nodes['name'].text = ''
56 57
 	nodes['description'].text = ''
57 58
 	nodes['color'].color = Color('#ffffff')
59
+	nodes['mirror_portraits_checkbox'].pressed = false
58 60
 	nodes['default_speaker'].pressed = false
59 61
 	nodes['display_name_checkbox'].pressed = false
60 62
 	nodes['display_name'].text = ''
@@ -76,7 +78,8 @@ func create_character():
76 78
 		'color': '#ffffff',
77 79
 		'id': character_file,
78 80
 		'default_speaker': false,
79
-		'portraits': []
81
+		'portraits': [],
82
+		'mirror_portraits' :false
80 83
 	}
81 84
 	DialogicResources.set_character(character)
82 85
 	character['metadata'] = {'file': character_file}
@@ -101,6 +104,7 @@ func generate_character_data_to_save():
101 104
 		'id': nodes['file'].text,
102 105
 		'description': nodes['description'].text,
103 106
 		'color': '#' + nodes['color'].color.to_html(),
107
+		'mirror_portraits': nodes["mirror_portraits_checkbox"].pressed,
104 108
 		'default_speaker': default_speaker,
105 109
 		'portraits': portraits,
106 110
 		'display_name_bool': nodes['display_name_checkbox'].pressed,
@@ -150,7 +154,14 @@ func load_character(filename: String):
150 154
 	if data.has('offset_x'):
151 155
 		nodes['offset_x'].value = data['offset_x']
152 156
 		nodes['offset_y'].value = data['offset_y']
153
-
157
+	
158
+	if data.has('mirror_portraits'):
159
+		nodes['mirror_portraits_checkbox'].pressed = data['mirror_portraits']
160
+		nodes['portrait_preview'].flip_h = data['mirror_portraits']
161
+	else:
162
+		nodes['mirror_portraits_checkbox'].pressed = false
163
+		nodes['portrait_preview'].flip_h = false
164
+	
154 165
 	# Portraits
155 166
 	var default_portrait = create_portrait_entry()
156 167
 	default_portrait.get_node('NameEdit').text = 'Default'
@@ -183,3 +194,7 @@ func create_portrait_entry(p_name = '', path = '', grab_focus = false):
183 194
 		p.get_node("NameEdit").grab_focus()
184 195
 		p._on_ButtonSelect_pressed()
185 196
 	return p
197
+
198
+
199
+func _on_MirrorPortraitsCheckBox_toggled(button_pressed):
200
+	nodes['portrait_preview'].flip_h = button_pressed

+ 15
- 3
addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn View File

@@ -8,7 +8,7 @@ content_margin_left = 5.0
8 8
 content_margin_right = 5.0
9 9
 content_margin_top = 5.0
10 10
 content_margin_bottom = 5.0
11
-bg_color = Color( 0.2, 0.23, 0.31, 1 )
11
+bg_color = Color( 0.03, 0.21, 0.26, 1 )
12 12
 
13 13
 [node name="CharacterEditor" type="ScrollContainer"]
14 14
 margin_left = 192.0
@@ -141,9 +141,9 @@ margin_bottom = 14.0
141 141
 text = "Portraits / Expressions"
142 142
 
143 143
 [node name="Labels" type="HBoxContainer" parent="HBoxContainer/Container"]
144
-margin_top = 188.0
144
+margin_top = 216.0
145 145
 margin_right = 523.0
146
-margin_bottom = 202.0
146
+margin_bottom = 230.0
147 147
 
148 148
 [node name="LineEdit" type="Label" parent="HBoxContainer/Container/Labels"]
149 149
 margin_right = 100.0
@@ -314,3 +314,15 @@ rect_min_size = Vector2( 100, 0 )
314 314
 allow_greater = true
315 315
 allow_lesser = true
316 316
 suffix = "Y"
317
+
318
+[node name="MirrorOption" type="HBoxContainer" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
319
+margin_left = 398.0
320
+margin_right = 523.0
321
+margin_bottom = 24.0
322
+
323
+[node name="MirrorPortraitsCheckBox" type="CheckBox" parent="HBoxContainer/VBoxContainer/HBoxContainer/MirrorOption"]
324
+margin_right = 125.0
325
+margin_bottom = 24.0
326
+text = "Mirror portraits"
327
+
328
+[connection signal="toggled" from="HBoxContainer/VBoxContainer/HBoxContainer/MirrorOption/MirrorPortraitsCheckBox" to="." method="_on_MirrorPortraitsCheckBox_toggled"]

+ 49
- 4
addons/dialogic/Editor/EditorView.gd View File

@@ -72,11 +72,35 @@ func _ready():
72 72
 	$ToolBar/FoldTools/ButtonUnfold.connect('pressed', timeline_editor, 'unfold_all_nodes')
73 73
 	
74 74
 	
75
+	# Adding items to context menus
76
+	$TimelinePopupMenu.add_icon_item(get_icon("Filesystem", "EditorIcons"), 'Show in File Manager')
77
+	$TimelinePopupMenu.add_icon_item(get_icon("ActionCopy", "EditorIcons"), 'Copy Timeline Name')
78
+	$TimelinePopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Timeline')
79
+	
80
+	$CharacterPopupMenu.add_icon_item(get_icon("Filesystem", "EditorIcons"), 'Show in File Manager')
81
+	$CharacterPopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Character')
82
+	
83
+	$ThemePopupMenu.add_icon_item(get_icon("Filesystem", "EditorIcons"), 'Show in File Manager')
84
+	$ThemePopupMenu.add_icon_item(get_icon("Duplicate", "EditorIcons"), 'Duplicate Theme')
85
+	$ThemePopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Theme')
86
+	
87
+	$DefinitionPopupMenu.add_icon_item(get_icon("Edit", "EditorIcons"), 'Edit Definitions File')
88
+	$DefinitionPopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Definition')
89
+	
90
+	$TimelineRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Timeline')
91
+	$CharacterRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Character')
92
+	$ThemeRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Theme')
93
+	$DefinitionRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Definition')
94
+	
75 95
 	# Connecting context menus
76 96
 	$TimelinePopupMenu.connect('id_pressed', self, '_on_TimelinePopupMenu_id_pressed')
77 97
 	$CharacterPopupMenu.connect('id_pressed', self, '_on_CharacterPopupMenu_id_pressed')
78 98
 	$ThemePopupMenu.connect('id_pressed', self, '_on_ThemePopupMenu_id_pressed')
79 99
 	$DefinitionPopupMenu.connect('id_pressed', self, '_on_DefinitionPopupMenu_id_pressed')
100
+	$TimelineRootPopupMenu.connect('id_pressed', self, '_on_TimelineRootPopupMenu_id_pressed')
101
+	$CharacterRootPopupMenu.connect('id_pressed', self, '_on_CharacterRootPopupMenu_id_pressed')
102
+	$ThemeRootPopupMenu.connect('id_pressed', self, '_on_ThemeRootPopupMenu_id_pressed')
103
+	$DefinitionRootPopupMenu.connect('id_pressed', self, '_on_DefinitionRootPopupMenu_id_pressed')
80 104
 	
81 105
 	#Connecting confirmation menus
82 106
 	$RemoveTimelineConfirmation.connect('confirmed', self, '_on_RemoveTimelineConfirmation_confirmed')
@@ -130,21 +154,42 @@ func _on_ThemePopupMenu_id_pressed(id):
130 154
 	if id == 0:
131 155
 		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('THEME_DIR')))
132 156
 	if id == 1:
133
-		$RemoveThemeConfirmation.popup_centered()
134
-	if id == 2:
135 157
 		var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file']
136 158
 		if (filename.begins_with('theme-')):
137 159
 			theme_editor.duplicate_theme(filename)
160
+	if id == 2:
161
+		$RemoveThemeConfirmation.popup_centered()
138 162
 
139 163
 
140 164
 # Definition context menu
141 165
 func _on_DefinitionPopupMenu_id_pressed(id):
142 166
 	if id == 0:
143
-		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('DEFAULT_DEFINITIONS_FILE')))
167
+		var paths = DialogicResources.get_config_files_paths()
168
+		OS.shell_open(ProjectSettings.globalize_path(paths['DEFAULT_DEFINITIONS_FILE']))
144 169
 	if id == 1:
145 170
 		$RemoveDefinitionConfirmation.popup_centered()
146 171
 
147 172
 
173
+# Timeline Root context menu
174
+func _on_TimelineRootPopupMenu_id_pressed(id):
175
+	if id == 0: # Add Timeline
176
+		$MainPanel/TimelineEditor.new_timeline()
177
+
178
+# Character Root context menu
179
+func _on_CharacterRootPopupMenu_id_pressed(id):
180
+	if id == 0: # Add Character
181
+		$MainPanel/CharacterEditor.new_character()
182
+
183
+# Theme Root context menu
184
+func _on_ThemeRootPopupMenu_id_pressed(id):
185
+	if id == 0: # Add Theme
186
+		$MainPanel/ThemeEditor.new_theme()
187
+
188
+# Definition Root context menu
189
+func _on_DefinitionRootPopupMenu_id_pressed(id):
190
+	if id == 0: # Add Definition
191
+		$MainPanel/DefinitionEditor.new_definition()
192
+
148 193
 func _on_RemoveDefinitionConfirmation_confirmed():
149 194
 	var target = $MainPanel/DefinitionEditor.current_definition['id']
150 195
 	DialogicResources.delete_default_definition(target)
@@ -194,7 +239,7 @@ func godot_dialog_connect(who, method_name):
194 239
 
195 240
 
196 241
 func _on_file_selected(path):
197
-	dprint(path)
242
+	dprint('[D] Selected '+str(path))
198 243
 
199 244
 
200 245
 func dprint(what) -> void:

+ 41
- 12
addons/dialogic/Editor/EditorView.tscn View File

@@ -1,4 +1,4 @@
1
-[gd_scene load_steps=17 format=2]
1
+[gd_scene load_steps=14 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Editor/EditorView.gd" type="Script" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn" type="PackedScene" id=2]
@@ -8,14 +8,11 @@
8 8
 [ext_resource path="res://addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn" type="PackedScene" id=6]
9 9
 [ext_resource path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn" type="PackedScene" id=7]
10 10
 [ext_resource path="res://addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn" type="PackedScene" id=8]
11
-[ext_resource path="res://addons/dialogic/Images/Context Menus/ActionCopy.svg" type="Texture" id=11]
12 11
 [ext_resource path="res://addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.tscn" type="PackedScene" id=12]
13 12
 [ext_resource path="res://addons/dialogic/Images/Toolbar/add-theme.svg" type="Texture" id=13]
14
-[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=22]
15
-[ext_resource path="res://addons/dialogic/Images/Context Menus/Filesystem.svg" type="Texture" id=26]
16 13
 [ext_resource path="res://addons/dialogic/Editor/MasterTree/MasterTree.tscn" type="PackedScene" id=35]
17 14
 
18
-[sub_resource type="Image" id=1]
15
+[sub_resource type="Image" id=3]
19 16
 data = {
20 17
 "data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ),
21 18
 "format": "LumAlpha8",
@@ -27,7 +24,7 @@ data = {
27 24
 [sub_resource type="ImageTexture" id=2]
28 25
 flags = 4
29 26
 flags = 4
30
-image = SubResource( 1 )
27
+image = SubResource( 3 )
31 28
 size = Vector2( 16, 16 )
32 29
 
33 30
 [node name="EditorView" type="Control"]
@@ -206,7 +203,6 @@ margin_left = 151.0
206 203
 margin_top = 276.0
207 204
 margin_right = 325.0
208 205
 margin_bottom = 332.0
209
-items = [ "Show in File Manager", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Copy Timeline Name", ExtResource( 11 ), 0, false, false, 1, 0, null, "", false, "Remove", ExtResource( 22 ), 0, false, false, 2, 0, null, "", false ]
210 206
 __meta__ = {
211 207
 "_edit_use_anchors_": false
212 208
 }
@@ -216,27 +212,60 @@ margin_left = 171.799
216 212
 margin_top = 209.0
217 213
 margin_right = 267.799
218 214
 margin_bottom = 229.0
219
-items = [ "Show in File Manager", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Character", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false ]
220 215
 __meta__ = {
221 216
 "_edit_use_anchors_": false
222 217
 }
223 218
 
224
-[node name="ThemePopupMenu" type="PopupMenu" parent="."]
219
+[node name="DefinitionPopupMenu" type="PopupMenu" parent="."]
225 220
 margin_left = 171.799
226 221
 margin_top = 209.0
227 222
 margin_right = 267.799
228 223
 margin_bottom = 229.0
229
-items = [ "Show in File Manager", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Theme", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false, "Duplicate Theme", ExtResource( 11 ), 0, false, false, 2, 0, null, "", false ]
230 224
 __meta__ = {
231 225
 "_edit_use_anchors_": false
232 226
 }
233 227
 
234
-[node name="DefinitionPopupMenu" type="PopupMenu" parent="."]
228
+[node name="ThemePopupMenu" type="PopupMenu" parent="."]
235 229
 margin_left = 171.799
236 230
 margin_top = 209.0
237 231
 margin_right = 267.799
238 232
 margin_bottom = 229.0
239
-items = [ "Edit definitions file", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Definition", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false ]
233
+__meta__ = {
234
+"_edit_use_anchors_": false
235
+}
236
+
237
+[node name="TimelineRootPopupMenu" type="PopupMenu" parent="."]
238
+margin_left = 159.0
239
+margin_top = 283.0
240
+margin_right = 227.0
241
+margin_bottom = 319.0
242
+__meta__ = {
243
+"_edit_use_anchors_": false
244
+}
245
+
246
+[node name="CharacterRootPopupMenu" type="PopupMenu" parent="."]
247
+margin_left = 159.0
248
+margin_top = 283.0
249
+margin_right = 227.0
250
+margin_bottom = 319.0
251
+__meta__ = {
252
+"_edit_use_anchors_": false
253
+}
254
+
255
+[node name="ThemeRootPopupMenu" type="PopupMenu" parent="."]
256
+margin_left = 159.0
257
+margin_top = 283.0
258
+margin_right = 227.0
259
+margin_bottom = 319.0
260
+__meta__ = {
261
+"_edit_use_anchors_": false
262
+}
263
+
264
+[node name="DefinitionRootPopupMenu" type="PopupMenu" parent="."]
265
+margin_left = 159.0
266
+margin_top = 283.0
267
+margin_right = 227.0
268
+margin_bottom = 319.0
240 269
 __meta__ = {
241 270
 "_edit_use_anchors_": false
242 271
 }

+ 17
- 45
addons/dialogic/Editor/Events/AudioBlock.gd View File

@@ -7,57 +7,29 @@ var editorPopup
7 7
 
8 8
 # This is the information of this event and it will get parsed and saved to the JSON file.
9 9
 var event_data = {
10
+	'event_name':'AudioEvent',
10 11
 	'audio': 'stop',
11
-	'file': ''
12
+	'file': '',
13
+	'audio_bus':'Master',
14
+	'volume':0
12 15
 }
13 16
 
14 17
 
15 18
 func _ready():
16
-	load_audio('')
17
-	$PanelContainer/VBoxContainer/Header/ButtonClear.icon = get_icon("Remove", "EditorIcons")
18
-	$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
19
-
20
-func _on_ButtonAudio_pressed():
21
-	editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
22
-	editor_reference.godot_dialog_connect(self, "_on_file_selected")
23
-
24
-
25
-func _on_file_selected(path, target):
26
-	target.load_audio(path)
27
-
28
-
29
-func load_audio(path: String):
30
-	if not path.empty():
31
-		$PanelContainer/VBoxContainer/Header/Name.text = path
32
-		$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = false
33
-		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = false
34
-		event_data['file'] = path
35
-		event_data['audio'] = 'play'
36
-	else:
37
-		$PanelContainer/VBoxContainer/Header/Name.text = 'No sound (will stop previous audio event)'
38
-		$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = true
39
-		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = true
40
-		event_data['file'] = ''
41
-		event_data['audio'] = 'stop'
42
-
19
+	$PanelContainer/VBoxContainer/Header/VisibleToggle.set_visible(true)
20
+	$PanelContainer/VBoxContainer/Settings/AudioPicker.editor_reference = editor_reference
21
+	$PanelContainer/VBoxContainer/Settings/AudioPicker.connect('audio_changed', self, 'update_audio_data')
43 22
 
44 23
 func load_data(data):
45 24
 	event_data = data
46
-	load_audio(data['file'])
47
-
48
-
49
-func _on_ButtonPreviewPlay_pressed():
50
-	if $PanelContainer/AudioPreview.is_playing():
51
-		$PanelContainer/AudioPreview.stop()
25
+	$PanelContainer/VBoxContainer/Settings/AudioPicker.load_data(data)
26
+
27
+func update_audio_data(file, playing, audio_bus, volume):
28
+	event_data['file'] = file
29
+	event_data['audio'] = playing
30
+	event_data['audio_bus'] = audio_bus
31
+	event_data['volume'] = volume
32
+	if file:
33
+		$PanelContainer/VBoxContainer/Header/Preview.text = 'Plays '+file.get_file()
52 34
 	else:
53
-		$PanelContainer/AudioPreview.stream = load(event_data['file'])
54
-		$PanelContainer/AudioPreview.play()
55
-		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Stop", "EditorIcons")
56
-
57
-
58
-func _on_AudioPreview_finished():
59
-	$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
60
-
61
-
62
-func _on_ButtonClear_pressed():
63
-	load_audio('')
35
+		$PanelContainer/VBoxContainer/Header/Preview.text = 'Stops previous audio event'

+ 25
- 44
addons/dialogic/Editor/Events/AudioBlock.tscn View File

@@ -1,10 +1,11 @@
1
-[gd_scene load_steps=6 format=2]
1
+[gd_scene load_steps=8 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Editor/Events/AudioBlock.gd" type="Script" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
7
-
7
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/AudioPicker.tscn" type="PackedScene" id=5]
8
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=8]
8 9
 
9 10
 [sub_resource type="StyleBoxFlat" id=1]
10 11
 content_margin_left = 16.0
@@ -55,69 +56,49 @@ size_flags_horizontal = 3
55 56
 
56 57
 [node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
57 58
 margin_right = 1776.0
58
-margin_bottom = 28.0
59
+margin_bottom = 30.0
59 60
 
60 61
 [node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
61 62
 margin_right = 22.0
62
-margin_bottom = 28.0
63
+margin_bottom = 30.0
63 64
 texture = ExtResource( 3 )
64 65
 stretch_mode = 6
65 66
 
66 67
 [node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
67 68
 margin_left = 26.0
68
-margin_top = 7.0
69
-margin_right = 83.0
70
-margin_bottom = 21.0
71
-text = "  Audio   "
72
-
73
-[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"]
74
-margin_left = 87.0
75
-margin_top = 7.0
76
-margin_right = 352.0
77
-margin_bottom = 21.0
78
-text = "No sound (will stop previous audio event)"
79
-
80
-[node name="ButtonAudio" type="Button" parent="PanelContainer/VBoxContainer/Header"]
81
-margin_left = 356.0
82
-margin_right = 380.0
83
-margin_bottom = 28.0
84
-text = "..."
85
-
86
-[node name="ButtonClear" type="Button" parent="PanelContainer/VBoxContainer/Header"]
87
-margin_left = 384.0
88
-margin_right = 396.0
89
-margin_bottom = 28.0
90
-disabled = true
69
+margin_top = 8.0
70
+margin_right = 118.0
71
+margin_bottom = 22.0
72
+text = "  Audio Event  "
91 73
 
92
-[node name="ButtonPreviewPlay" type="Button" parent="PanelContainer/VBoxContainer/Header"]
93
-margin_left = 400.0
94
-margin_right = 412.0
95
-margin_bottom = 28.0
96
-disabled = true
74
+[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
75
+margin_left = 122.0
76
+margin_right = 152.0
77
+pressed = false
97 78
 
98 79
 [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
99
-visible = false
100
-margin_left = 103.0
80
+margin_left = 156.0
101 81
 margin_top = 8.0
102
-margin_right = 131.0
82
+margin_right = 156.0
103 83
 margin_bottom = 22.0
104 84
 custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
105
-text = "    ..."
106 85
 
107 86
 [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
108
-margin_left = 416.0
87
+margin_left = 160.0
109 88
 margin_right = 1735.0
110
-margin_bottom = 28.0
89
+margin_bottom = 30.0
111 90
 
112 91
 [node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
113 92
 margin_left = 1739.0
114 93
 margin_right = 1776.0
115
-margin_bottom = 28.0
116 94
 items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
117 95
 
118
-[node name="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"]
96
+[node name="Settings" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
97
+visible = false
98
+margin_top = 34.0
99
+margin_right = 1776.0
100
+margin_bottom = 54.0
119 101
 
120
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
121
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonClear" to="." method="_on_ButtonClear_pressed"]
122
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
123
-[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]
102
+[node name="AudioPicker" parent="PanelContainer/VBoxContainer/Settings" instance=ExtResource( 5 )]
103
+margin_right = 294.0
104
+margin_bottom = 20.0

+ 21
- 44
addons/dialogic/Editor/Events/BackgroundMusic.gd View File

@@ -8,58 +8,35 @@ var editorPopup
8 8
 
9 9
 # This is the information of this event and it will get parsed and saved to the JSON file.
10 10
 var event_data = {
11
+	'event_name':'BackgroundMusic',
11 12
 	'background-music': 'stop',
12
-	'file': ''
13
+	'file': '',
14
+	'audio_bus':'Master',
15
+	'volume':0,
16
+	'fade_length':1,
13 17
 }
14 18
 
15 19
 
16 20
 func _ready():
17
-	load_audio('')
18
-	$PanelContainer/VBoxContainer/Header/ButtonClear.icon = get_icon("Remove", "EditorIcons")
19
-	$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
20
-
21
-
22
-func _on_ButtonAudio_pressed():
23
-	editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
24
-	editor_reference.godot_dialog_connect(self, "_on_file_selected")
25
-
26
-
27
-func _on_file_selected(path, target):
28
-	target.load_audio(path)
29
-
30
-
31
-func load_audio(path: String):
32
-	if not path.empty():
33
-		$PanelContainer/VBoxContainer/Header/Name.text = path
34
-		$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = false
35
-		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = false
36
-		event_data['file'] = path
37
-		event_data['background-music'] = 'play'
38
-	else:
39
-		$PanelContainer/VBoxContainer/Header/Name.text = 'No music (will stop with fade out)'
40
-		$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = true
41
-		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = true
42
-		event_data['file'] = ''
43
-		event_data['background-music'] = 'stop'
44
-
21
+	$PanelContainer/VBoxContainer/Header/VisibleToggle.set_visible(true)
22
+	$PanelContainer/VBoxContainer/Settings/AudioPicker.editor_reference = editor_reference
23
+	$PanelContainer/VBoxContainer/Settings/AudioPicker.connect("audio_changed", self, "update_audio_data")
45 24
 
46 25
 func load_data(data):
47 26
 	event_data = data
48
-	load_audio(data['file'])
49
-
50
-
51
-func _on_ButtonPreviewPlay_pressed():
52
-	if $PanelContainer/AudioPreview.is_playing():
53
-		$PanelContainer/AudioPreview.stop()
27
+	$PanelContainer/VBoxContainer/Settings/FadeLength.value = event_data.get("fade_length", 1)
28
+	$PanelContainer/VBoxContainer/Settings/AudioPicker.load_data(data)
29
+
30
+func update_audio_data(file, playing, audio_bus, volume):
31
+	event_data['background-music'] = playing
32
+	event_data['file'] = file
33
+	event_data['audio_bus'] = audio_bus
34
+	event_data['volume'] = volume
35
+	if file:
36
+		$PanelContainer/VBoxContainer/Header/Preview.text = 'Plays '+file.get_file()
54 37
 	else:
55
-		$PanelContainer/AudioPreview.stream = load(event_data['file'])
56
-		$PanelContainer/AudioPreview.play()
57
-		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Stop", "EditorIcons")
58
-
59
-
60
-func _on_AudioPreview_finished():
61
-	$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
38
+		$PanelContainer/VBoxContainer/Header/Preview.text = 'Fades out previous background music'
62 39
 
40
+func _on_FadeLength_value_changed(value):
41
+	event_data['fade_length'] = value
63 42
 
64
-func _on_ButtonClear_pressed():
65
-	load_audio('')

+ 40
- 42
addons/dialogic/Editor/Events/BackgroundMusic.tscn View File

@@ -1,10 +1,11 @@
1
-[gd_scene load_steps=6 format=2]
1
+[gd_scene load_steps=8 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Editor/Events/BackgroundMusic.gd" type="Script" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/background-music.svg" type="Texture" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
7
-
7
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/AudioPicker.tscn" type="PackedScene" id=5]
8
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=8]
8 9
 
9 10
 [sub_resource type="StyleBoxFlat" id=1]
10 11
 content_margin_left = 16.0
@@ -55,69 +56,66 @@ size_flags_horizontal = 3
55 56
 
56 57
 [node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
57 58
 margin_right = 1776.0
58
-margin_bottom = 28.0
59
+margin_bottom = 30.0
59 60
 
60 61
 [node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
61 62
 margin_right = 22.0
62
-margin_bottom = 28.0
63
+margin_bottom = 30.0
63 64
 texture = ExtResource( 3 )
64 65
 stretch_mode = 6
65 66
 
66 67
 [node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
67 68
 margin_left = 26.0
68
-margin_top = 7.0
69
+margin_top = 8.0
69 70
 margin_right = 150.0
70
-margin_bottom = 21.0
71
+margin_bottom = 22.0
71 72
 text = "  Background Music"
72 73
 
73
-[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"]
74
+[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
74 75
 margin_left = 154.0
75
-margin_top = 7.0
76
-margin_right = 368.0
77
-margin_bottom = 21.0
78
-text = "No music (will stop with fade out)"
79
-
80
-[node name="ButtonAudio" type="Button" parent="PanelContainer/VBoxContainer/Header"]
81
-margin_left = 372.0
82
-margin_right = 396.0
83
-margin_bottom = 28.0
84
-text = "..."
85
-
86
-[node name="ButtonClear" type="Button" parent="PanelContainer/VBoxContainer/Header"]
87
-margin_left = 400.0
88
-margin_right = 412.0
89
-margin_bottom = 28.0
90
-disabled = true
91
-
92
-[node name="ButtonPreviewPlay" type="Button" parent="PanelContainer/VBoxContainer/Header"]
93
-margin_left = 416.0
94
-margin_right = 428.0
95
-margin_bottom = 28.0
96
-disabled = true
76
+margin_right = 184.0
77
+pressed = false
97 78
 
98 79
 [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
99
-visible = false
100
-margin_left = 103.0
80
+margin_left = 188.0
101 81
 margin_top = 8.0
102
-margin_right = 131.0
82
+margin_right = 188.0
103 83
 margin_bottom = 22.0
104 84
 custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
105
-text = "    ..."
106 85
 
107 86
 [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
108
-margin_left = 432.0
87
+margin_left = 192.0
109 88
 margin_right = 1735.0
110
-margin_bottom = 28.0
89
+margin_bottom = 30.0
111 90
 
112 91
 [node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
113 92
 margin_left = 1739.0
114 93
 margin_right = 1776.0
115
-margin_bottom = 28.0
116 94
 items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
117 95
 
118
-[node name="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"]
119
-
120
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
121
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonClear" to="." method="_on_ButtonClear_pressed"]
122
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
123
-[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]
96
+[node name="Settings" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
97
+visible = false
98
+margin_top = 34.0
99
+margin_right = 1776.0
100
+margin_bottom = 58.0
101
+
102
+[node name="AudioPicker" parent="PanelContainer/VBoxContainer/Settings" instance=ExtResource( 5 )]
103
+margin_right = 334.0
104
+margin_bottom = 24.0
105
+event_name = "Background Music"
106
+
107
+[node name="FadeLengthLabel" type="Label" parent="PanelContainer/VBoxContainer/Settings"]
108
+margin_left = 338.0
109
+margin_top = 5.0
110
+margin_right = 425.0
111
+margin_bottom = 19.0
112
+text = "  Fade-length:"
113
+
114
+[node name="FadeLength" type="SpinBox" parent="PanelContainer/VBoxContainer/Settings"]
115
+margin_left = 429.0
116
+margin_right = 503.0
117
+margin_bottom = 24.0
118
+step = 0.01
119
+suffix = "s"
120
+
121
+[connection signal="value_changed" from="PanelContainer/VBoxContainer/Settings/FadeLength" to="." method="_on_FadeLength_value_changed"]

+ 52
- 0
addons/dialogic/Editor/Events/ChangeBackground.gd View File

@@ -0,0 +1,52 @@
1
+tool
2
+extends Control
3
+
4
+var editor_reference
5
+var preview = "..."
6
+
7
+var preview_scene = preload("res://addons/dialogic/Editor/Events/Common/ImagePreview.tscn")
8
+
9
+onready var event_template = $EventTemplate
10
+
11
+var image_picker
12
+
13
+# This is the information of this event and it will get parsed and saved to the JSON file.
14
+var event_data = {
15
+	'background': ''
16
+}
17
+
18
+func _ready():
19
+	image_picker = event_template.get_header()
20
+	# Needed to open the file dialog
21
+	image_picker.editor_reference = editor_reference
22
+	image_picker.connect("file_selected", self, "_on_file_selected")
23
+	image_picker.connect("clear_pressed", self, "_on_clear_pressed")
24
+
25
+
26
+func load_data(data):
27
+	event_data = data
28
+	load_image(event_data['background'])
29
+
30
+
31
+func load_image(img_src: String):
32
+	event_data['background'] = img_src
33
+	if not img_src.empty() and not img_src.ends_with('.tscn'):
34
+		event_template.set_preview("...")
35
+		event_template.set_body(preview_scene)
36
+		event_template.get_body().set_image(load(img_src))
37
+		image_picker.set_image(img_src)
38
+	elif img_src.ends_with('.tscn'):
39
+		event_template.set_preview("...")
40
+		image_picker.set_image(img_src)
41
+		event_template.set_body(null)
42
+	else:
43
+		event_template.set_body(null)
44
+		image_picker.clear_image()
45
+
46
+
47
+func _on_file_selected(path):
48
+	load_image(path)
49
+
50
+
51
+func _on_clear_pressed():
52
+	load_image('')

+ 26
- 0
addons/dialogic/Editor/Events/ChangeBackground.tscn View File

@@ -0,0 +1,26 @@
1
+[gd_scene load_steps=6 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/ChangeBackground.gd" type="Script" id=2]
4
+[ext_resource path="res://addons/dialogic/Editor/Events/styles/ChangeBackground.tres" type="StyleBox" id=3]
5
+[ext_resource path="res://addons/dialogic/Editor/Events/Templates/EventTemplate.tscn" type="PackedScene" id=4]
6
+[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-background.svg" type="Texture" id=6]
7
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/ImagePicker.tscn" type="PackedScene" id=7]
8
+
9
+[node name="ChangeBackground" type="HBoxContainer"]
10
+anchor_right = 1.0
11
+margin_bottom = 44.0
12
+size_flags_horizontal = 3
13
+size_flags_vertical = 9
14
+script = ExtResource( 2 )
15
+__meta__ = {
16
+"_edit_use_anchors_": false
17
+}
18
+
19
+[node name="EventTemplate" parent="." instance=ExtResource( 4 )]
20
+anchor_right = 0.0
21
+margin_right = 1024.0
22
+margin_bottom = 46.0
23
+event_style = ExtResource( 3 )
24
+event_icon = ExtResource( 6 )
25
+event_name = "Change Background"
26
+header_scene = ExtResource( 7 )

+ 35
- 33
addons/dialogic/Editor/Events/CharacterJoinBlock.gd View File

@@ -2,8 +2,8 @@ tool
2 2
 extends Control
3 3
 
4 4
 var editor_reference
5
-onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
6
-
5
+onready var character_picker = $PanelContainer/VBoxContainer/Header/CharacterAndPortraitPicker
6
+onready var mirror_toggle = $PanelContainer/VBoxContainer/Header/MirrorButton
7 7
 var current_color = Color('#ffffff')
8 8
 var default_icon_color = Color("#65989898")
9 9
 
@@ -12,40 +12,36 @@ var event_data = {
12 12
 	'action': 'join',
13 13
 	'character': '',
14 14
 	'portrait': '',
15
-	'position': {"0":false,"1":false,"2":false,"3":false,"4":false}
15
+	'position': {"0":false,"1":false,"2":false,"3":false,"4":false},
16
+	'mirror':false
16 17
 }
17 18
 
18 19
 
19 20
 func _ready():
20 21
 	for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
21 22
 		p.connect('pressed', self, "position_button_pressed", [p.name])
22
-	$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
23
-	portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
24
-	portrait_picker.allow_dont_change = false
23
+	character_picker.connect("character_changed", self, '_on_character_change')
24
+	character_picker.set_allow_portrait_dont_change(false)
25
+	mirror_toggle.icon = get_icon("MirrorX", "EditorIcons")
25 26
 
26 27
 
27
-func _on_character_selected(data):
28
+func _on_character_change(character: Dictionary, portrait: String):
28 29
 	# Updating icon Color
29
-	current_color = Color(data['color'])
30
-	var c_c_ind = 0
31
-	for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
32
-		if event_data['position'][str(c_c_ind)]:
33
-			p.set('self_modulate', Color(data['color']))
34
-		else:
35
-			p.set('self_modulate', default_icon_color)
36
-		c_c_ind += 1
37
-	event_data['character'] = data['file']
38
-	portrait_picker.set_character(event_data['character'], event_data['portrait'])
39
-	portrait_picker.text = 'Default'
40
-
41
-
42
-func _on_portrait_selected(index):
43
-	var text = portrait_picker.get_popup().get_item_text(index)
44
-	if portrait_picker.allow_dont_change:
45
-		if text == "[Don't change]":
46
-			text = ''
47
-	event_data['portrait'] = text
48
-	portrait_picker.set_character(event_data['character'], event_data['portrait'])
30
+	if character.keys().size() > 0:
31
+		current_color = Color(character['color'])
32
+		var c_c_ind = 0
33
+		for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
34
+			if event_data['position'][str(c_c_ind)]:
35
+				p.set('self_modulate', Color(character['color']))
36
+			else:
37
+				p.set('self_modulate', default_icon_color)
38
+			c_c_ind += 1
39
+		event_data['character'] = character['file']
40
+		event_data['portrait'] = portrait
41
+	else:
42
+		event_data['character'] = ''
43
+		event_data['portrait'] = ''
44
+		clear_all_positions()
49 45
 
50 46
 
51 47
 func position_button_pressed(name):
@@ -78,10 +74,16 @@ func check_active_position(active_color = Color("#ffffff")):
78 74
 func load_data(data):
79 75
 	event_data = data
80 76
 	if data['character'] != '':
81
-		var character_data = DialogicResources.get_character_json(data['character'])
82
-		$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data(character_data['name'], Color(character_data['color']))
83
-		portrait_picker.set_character(data['character'], data['portrait'])
84
-		current_color = Color(character_data['color'])
77
+		character_picker.set_data(data['character'], data['portrait'])
78
+		current_color = character_picker.get_selected_character()['color']
85 79
 		check_active_position(current_color)
86
-		return
87
-	check_active_position()
80
+	else:
81
+		check_active_position()
82
+	
83
+	if data.has('mirror'):
84
+		mirror_toggle.pressed = data['mirror']
85
+	else:
86
+		mirror_toggle.pressed = false
87
+
88
+func _on_MirrorButton_toggled(button_pressed):
89
+	event_data['mirror'] = button_pressed

+ 18
- 13
addons/dialogic/Editor/Events/CharacterJoinBlock.tscn View File

@@ -1,15 +1,11 @@
1
-[gd_scene load_steps=9 format=2]
1
+[gd_scene load_steps=8 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Editor/Events/CharacterJoinBlock.gd" type="Script" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=4]
7 7
 [ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=5]
8
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=7]
9
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=8]
10
-
11
-
12
-
8
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn" type="PackedScene" id=6]
13 9
 
14 10
 [sub_resource type="StyleBoxFlat" id=1]
15 11
 content_margin_left = 16.0
@@ -72,14 +68,12 @@ margin_right = 130.0
72 68
 margin_bottom = 22.0
73 69
 text = "  Character join: "
74 70
 
75
-[node name="CharacterPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
71
+[node name="CharacterAndPortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
72
+anchor_right = 0.0
73
+anchor_bottom = 0.0
76 74
 margin_left = 134.0
77 75
 margin_right = 240.0
78
-
79
-[node name="PortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 7 )]
80
-visible = false
81
-margin_left = 278.0
82
-margin_right = 361.0
76
+margin_bottom = 30.0
83 77
 
84 78
 [node name="LabelPosition" type="Label" parent="PanelContainer/VBoxContainer/Header"]
85 79
 margin_left = 244.0
@@ -127,8 +121,17 @@ margin_right = 186.0
127 121
 margin_bottom = 30.0
128 122
 icon = ExtResource( 5 )
129 123
 
130
-[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 1 )]
124
+[node name="MirrorButton" type="ToolButton" parent="PanelContainer/VBoxContainer/Header"]
131 125
 margin_left = 502.0
126
+margin_right = 514.0
127
+margin_bottom = 30.0
128
+hint_tooltip = "Mirrors the character"
129
+focus_mode = 0
130
+toggle_mode = true
131
+enabled_focus_mode = 0
132
+
133
+[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 1 )]
134
+margin_left = 518.0
132 135
 margin_right = 1735.0
133 136
 margin_bottom = 30.0
134 137
 
@@ -136,3 +139,5 @@ margin_bottom = 30.0
136 139
 margin_left = 1739.0
137 140
 margin_right = 1776.0
138 141
 items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
142
+
143
+[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/MirrorButton" to="." method="_on_MirrorButton_toggled"]

+ 53
- 3
addons/dialogic/Editor/Events/Choice.gd View File

@@ -4,23 +4,37 @@ extends Control
4 4
 var editor_reference
5 5
 var editorPopup
6 6
 
7
+onready var definition_picker = $PanelContainer/VBoxContainer/Header/Condition/DefinitionPicker
8
+onready var condition_picker = $PanelContainer/VBoxContainer/Header/Condition/ConditionPicker
9
+onready var condition_line_edit = $PanelContainer/VBoxContainer/Header/Condition/CustomLineEdit2
10
+onready var condition_checkbox = $PanelContainer/VBoxContainer/Header/ConditionCheckBox
11
+
7 12
 
8 13
 # This is the information of this event and it will get parsed and saved to the JSON file.
9 14
 var event_data = {
10
-	'choice': ''
15
+	'choice': '',
16
+	'condition': '',
17
+	'definition': '',
18
+	'value': ''
11 19
 }
12 20
 
13 21
 
14 22
 func _ready():
15 23
 	$PanelContainer/VBoxContainer/Header/Warning.visible = false
16 24
 	$PanelContainer/VBoxContainer/Header/CustomLineEdit.connect('text_changed', self, '_on_LineEdit_text_changed')
17
-	pass
25
+	definition_picker.get_popup().connect("index_pressed", self, '_on_definition_entry_selected')
26
+	condition_picker.get_popup().connect("index_pressed", self, '_on_condition_entry_selected')
18 27
 
19 28
 
20 29
 func load_data(data):
21 30
 	event_data = data
22 31
 	$PanelContainer/VBoxContainer/Header/CustomLineEdit.text = event_data['choice']
23
-
32
+	if event_data.has('condition') and event_data.has('definition') and event_data.has('value'):
33
+		condition_checkbox.pressed = not event_data['condition'].empty() and not event_data['definition'].empty() and not event_data['value'].empty()
34
+	else:
35
+		_reset_conditions()
36
+		condition_checkbox.pressed = false
37
+	_load_condition_data(event_data)
24 38
 
25 39
 func _on_LineEdit_text_changed(new_text):
26 40
 	event_data['choice'] = new_text
@@ -28,3 +42,39 @@ func _on_LineEdit_text_changed(new_text):
28 42
 
29 43
 func _on_Indent_visibility_changed():
30 44
 	$PanelContainer/VBoxContainer/Header/Warning.visible = !$Indent.visible
45
+
46
+
47
+func _load_condition_data(event_data):
48
+	condition_line_edit.text = event_data['value']
49
+	definition_picker.load_definition(event_data['definition'])
50
+	condition_picker.load_condition(event_data['condition'])
51
+
52
+
53
+func _reset_conditions():
54
+	event_data['condition'] = ''
55
+	event_data['definition'] = ''
56
+	event_data['value'] = ''
57
+
58
+
59
+func _on_ConditionCheckBox_toggled(button_pressed):
60
+	$PanelContainer/VBoxContainer/Header/Condition.visible = button_pressed
61
+	if not button_pressed:
62
+		_reset_conditions()
63
+		_load_condition_data(event_data)
64
+	elif event_data['condition'].empty():
65
+		event_data['condition'] = '=='
66
+		_load_condition_data(event_data)
67
+
68
+
69
+func _on_CustomLineEdit2_text_changed(new_text):
70
+	event_data['value'] = new_text
71
+
72
+
73
+func _on_definition_entry_selected(index):
74
+	var metadata = definition_picker.get_popup().get_item_metadata(index)
75
+	event_data['definition'] = metadata['id']
76
+
77
+
78
+func _on_condition_entry_selected(index):
79
+	var metadata = condition_picker.get_popup().get_item_metadata(index)
80
+	event_data['condition'] = metadata['condition']

+ 46
- 7
addons/dialogic/Editor/Events/Choice.tscn View File

@@ -1,14 +1,13 @@
1
-[gd_scene load_steps=8 format=2]
1
+[gd_scene load_steps=10 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/choice.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Choice.gd" type="Script" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
7
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/ConditionPicker.tscn" type="PackedScene" id=5]
7 8
 [ext_resource path="res://addons/dialogic/Images/Event Icons/warning.svg" type="Texture" id=6]
8 9
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/CustomLineEdit.tscn" type="PackedScene" id=7]
9
-
10
-
11
-
10
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/DefinitionPicker.tscn" type="PackedScene" id=8]
12 11
 
13 12
 [sub_resource type="StyleBoxFlat" id=1]
14 13
 content_margin_left = 16.0
@@ -94,15 +93,52 @@ margin_left = 50.0
94 93
 margin_right = 98.0
95 94
 margin_bottom = 28.0
96 95
 
97
-[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
96
+[node name="Spacer2" type="Control" parent="PanelContainer/VBoxContainer/Header"]
98 97
 margin_left = 102.0
98
+margin_right = 112.0
99
+margin_bottom = 28.0
100
+rect_min_size = Vector2( 10, 0 )
101
+__meta__ = {
102
+"_edit_use_anchors_": false
103
+}
104
+
105
+[node name="ConditionCheckBox" type="CheckBox" parent="PanelContainer/VBoxContainer/Header"]
106
+margin_left = 116.0
107
+margin_right = 238.0
108
+margin_bottom = 28.0
109
+text = "Has condition?"
110
+
111
+[node name="Condition" type="HBoxContainer" parent="PanelContainer/VBoxContainer/Header"]
112
+visible = false
113
+margin_left = 228.0
114
+margin_right = 506.0
115
+margin_bottom = 28.0
116
+__meta__ = {
117
+"_edit_use_anchors_": false
118
+}
119
+
120
+[node name="DefinitionPicker" parent="PanelContainer/VBoxContainer/Header/Condition" instance=ExtResource( 8 )]
121
+margin_right = 143.0
122
+margin_bottom = 28.0
123
+
124
+[node name="ConditionPicker" parent="PanelContainer/VBoxContainer/Header/Condition" instance=ExtResource( 5 )]
125
+margin_left = 147.0
126
+margin_right = 226.0
127
+
128
+[node name="CustomLineEdit2" parent="PanelContainer/VBoxContainer/Header/Condition" instance=ExtResource( 7 )]
129
+margin_left = 230.0
130
+margin_right = 278.0
131
+margin_bottom = 28.0
132
+
133
+[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
134
+margin_left = 242.0
99 135
 margin_top = 7.0
100
-margin_right = 102.0
136
+margin_right = 242.0
101 137
 margin_bottom = 21.0
102 138
 custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
103 139
 
104 140
 [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
105
-margin_left = 106.0
141
+margin_left = 246.0
106 142
 margin_right = 941.0
107 143
 margin_bottom = 28.0
108 144
 
@@ -111,4 +147,7 @@ margin_left = 945.0
111 147
 margin_right = 982.0
112 148
 margin_bottom = 28.0
113 149
 items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
150
+
114 151
 [connection signal="visibility_changed" from="Indent" to="." method="_on_Indent_visibility_changed"]
152
+[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/ConditionCheckBox" to="." method="_on_ConditionCheckBox_toggled"]
153
+[connection signal="text_changed" from="PanelContainer/VBoxContainer/Header/Condition/CustomLineEdit2" to="." method="_on_CustomLineEdit2_text_changed"]

+ 8
- 4
addons/dialogic/Editor/Events/CloseDialog.gd View File

@@ -7,12 +7,16 @@ var editorPopup
7 7
 
8 8
 # This is the information of this event and it will get parsed and saved to the JSON file.
9 9
 var event_data = {
10
-	'close_dialog': ''
10
+	'close_dialog': '',
11
+	'transition_duration': 1.0
11 12
 }
12 13
 
13 14
 
14
-func _ready():
15
-	pass
16
-
17 15
 func load_data(data):
18 16
 	event_data = data
17
+	if not event_data.has('transition_duration'):
18
+		event_data['transition_duration'] = 1.0
19
+	$PanelContainer/VBoxContainer/Header/SpinBox.value = event_data['transition_duration']
20
+
21
+func _on_SpinBox_value_changed(value):
22
+	event_data['transition_duration'] = value

+ 25
- 9
addons/dialogic/Editor/Events/CloseDialog.tscn View File

@@ -1,13 +1,11 @@
1
-[gd_scene load_steps=6 format=2]
1
+[gd_scene load_steps=7 format=2]
2 2
 
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/SpinBoxPreventDnD.gd" type="Script" id=1]
3 4
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=2]
4 5
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=3]
5 6
 [ext_resource path="res://addons/dialogic/Editor/Events/CloseDialog.gd" type="Script" id=4]
6 7
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=5]
7 8
 
8
-
9
-
10
-
11 9
 [sub_resource type="StyleBoxFlat" id=1]
12 10
 content_margin_left = 16.0
13 11
 content_margin_right = 6.0
@@ -66,19 +64,36 @@ stretch_mode = 6
66 64
 [node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
67 65
 margin_left = 26.0
68 66
 margin_top = 7.0
69
-margin_right = 113.0
67
+margin_right = 121.0
68
+margin_bottom = 21.0
69
+text = "  Close Dialog  "
70
+
71
+[node name="SpinBox" type="SpinBox" parent="PanelContainer/VBoxContainer/Header"]
72
+margin_left = 125.0
73
+margin_right = 199.0
74
+margin_bottom = 28.0
75
+step = 0.1
76
+value = 1.0
77
+allow_greater = true
78
+align = 1
79
+script = ExtResource( 1 )
80
+
81
+[node name="Title2" type="Label" parent="PanelContainer/VBoxContainer/Header"]
82
+margin_left = 203.0
83
+margin_top = 7.0
84
+margin_right = 324.0
70 85
 margin_bottom = 21.0
71
-text = "  Close Dialog"
86
+text = "  Fade-out duration"
72 87
 
73 88
 [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
74
-margin_left = 117.0
89
+margin_left = 328.0
75 90
 margin_top = 7.0
76
-margin_right = 117.0
91
+margin_right = 328.0
77 92
 margin_bottom = 21.0
78 93
 custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
79 94
 
80 95
 [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
81
-margin_left = 121.0
96
+margin_left = 332.0
82 97
 margin_right = 1735.0
83 98
 margin_bottom = 28.0
84 99
 
@@ -87,3 +102,4 @@ margin_left = 1739.0
87 102
 margin_right = 1776.0
88 103
 margin_bottom = 28.0
89 104
 items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
105
+[connection signal="value_changed" from="PanelContainer/VBoxContainer/Header/SpinBox" to="." method="_on_SpinBox_value_changed"]

+ 106
- 0
addons/dialogic/Editor/Events/Common/AudioPicker.gd View File

@@ -0,0 +1,106 @@
1
+tool
2
+extends HBoxContainer
3
+
4
+var editor_reference
5
+var editorPopup
6
+
7
+export (String) var event_name = 'Audio Event'
8
+
9
+var file : String
10
+var audio : String
11
+var audio_bus : String = "Master"
12
+var volume: float = 0
13
+
14
+signal audio_changed(file, audio, audio_bus, volume)
15
+
16
+func _ready():
17
+	load_audio('')
18
+	AudioServer.connect("bus_layout_changed", self, "update_bus_selector")
19
+	$ButtonClear.icon = get_icon("Remove", "EditorIcons")
20
+	$ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
21
+	update_bus_selector()
22
+
23
+func _on_ButtonAudio_pressed():
24
+	editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
25
+	editor_reference.godot_dialog_connect(self, "_on_file_selected")
26
+
27
+func _on_file_selected(path, target):
28
+	target.load_audio(path) # why is the targer needed? Couldn't it just call itself?
29
+
30
+func load_audio(path: String):
31
+	if not path.empty():
32
+		$Name.text = path.get_file()
33
+		$Name.hint_tooltip = path
34
+		$ButtonAudio.hint_tooltip = path
35
+		$ButtonClear.disabled = false
36
+		$ButtonPreviewPlay.disabled = false
37
+		file = path
38
+		audio = 'play'
39
+		emit_signal("audio_changed", file, audio, audio_bus, volume)
40
+		
41
+		show_options()
42
+	else:
43
+		$Name.text = 'No sound (will stop previous '+event_name+')'
44
+		file = ''
45
+		audio = 'stop'
46
+		emit_signal("audio_changed", file, audio, audio_bus, volume)
47
+
48
+		hide_options()
49
+
50
+func load_data(data):
51
+	file = data['file']
52
+	if data.has('audio'): audio = data['audio']
53
+	if data.has('background-music'): audio = data['background-music']
54
+	
55
+	if data.has('audio_bus'): audio_bus = data['audio_bus']
56
+	
57
+	for idx in range($BusSelector.get_item_count()):
58
+		if $BusSelector.get_item_text(idx) == audio_bus:
59
+			$BusSelector.select(idx)
60
+	
61
+	if data.has('volume'): volume = data['volume']
62
+	$Volume.value = volume
63
+	load_audio(file)
64
+
65
+func _on_ButtonPreviewPlay_pressed():
66
+	if $AudioPreview.is_playing():
67
+		$AudioPreview.stop()
68
+	else:
69
+		$AudioPreview.stream = load(file)
70
+		$AudioPreview.bus = audio_bus
71
+		$AudioPreview.volume_db = volume
72
+		$AudioPreview.play()
73
+		$ButtonPreviewPlay.icon = get_icon("Stop", "EditorIcons")
74
+
75
+func _on_AudioPreview_finished():
76
+	$ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
77
+
78
+func _on_ButtonClear_pressed():
79
+	load_audio('')
80
+
81
+func update_bus_selector():
82
+	$BusSelector.clear()
83
+	for i in range(AudioServer.bus_count):
84
+		$BusSelector.add_item(AudioServer.get_bus_name(i))
85
+
86
+func _on_BusSelector_item_selected(index):
87
+	audio_bus = $BusSelector.get_item_text(index)
88
+	emit_signal("audio_changed", file, audio, audio_bus, volume)
89
+
90
+func _on_Volume_value_changed(value):
91
+	volume = value
92
+	emit_signal("audio_changed", file, audio, audio_bus, volume)
93
+
94
+func show_options():
95
+	$ButtonClear.show()
96
+	$ButtonPreviewPlay.show()
97
+	$BusSelector.show()
98
+	$VolumeLabel.show()
99
+	$Volume.show()
100
+
101
+func hide_options():
102
+	$ButtonClear.hide()
103
+	$ButtonPreviewPlay.hide()
104
+	$BusSelector.hide()
105
+	$VolumeLabel.hide()
106
+	$Volume.hide()

+ 101
- 0
addons/dialogic/Editor/Events/Common/AudioPicker.tscn View File

@@ -0,0 +1,101 @@
1
+[gd_scene load_steps=4 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/AudioPicker.gd" type="Script" id=1]
4
+
5
+[sub_resource type="Image" id=3]
6
+data = {
7
+"data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ),
8
+"format": "LumAlpha8",
9
+"height": 16,
10
+"mipmaps": false,
11
+"width": 16
12
+}
13
+
14
+[sub_resource type="ImageTexture" id=2]
15
+flags = 4
16
+flags = 4
17
+image = SubResource( 3 )
18
+size = Vector2( 16, 16 )
19
+
20
+[node name="AudioPicker" type="HBoxContainer"]
21
+margin_right = 40.0
22
+margin_bottom = 40.0
23
+script = ExtResource( 1 )
24
+__meta__ = {
25
+"_edit_use_anchors_": false
26
+}
27
+
28
+[node name="Name" type="Label" parent="."]
29
+margin_top = 13.0
30
+margin_right = 266.0
31
+margin_bottom = 27.0
32
+mouse_filter = 1
33
+text = "No sound (will stop previous Audio Event)"
34
+
35
+[node name="ButtonAudio" type="Button" parent="."]
36
+margin_left = 270.0
37
+margin_right = 294.0
38
+margin_bottom = 40.0
39
+text = "..."
40
+
41
+[node name="ButtonClear" type="Button" parent="."]
42
+visible = false
43
+margin_left = 297.0
44
+margin_right = 325.0
45
+margin_bottom = 40.0
46
+disabled = true
47
+icon = SubResource( 2 )
48
+
49
+[node name="ButtonPreviewPlay" type="Button" parent="."]
50
+visible = false
51
+margin_left = 329.0
52
+margin_right = 357.0
53
+margin_bottom = 40.0
54
+disabled = true
55
+icon = SubResource( 2 )
56
+
57
+[node name="BusSelector" type="OptionButton" parent="."]
58
+visible = false
59
+margin_left = 361.0
60
+margin_right = 390.0
61
+margin_bottom = 40.0
62
+text = "Master"
63
+items = [ "Master", null, false, 0, null, "Cool new bus", null, false, 1, null ]
64
+selected = 0
65
+
66
+[node name="VolumeLabel" type="Label" parent="."]
67
+margin_left = 298.0
68
+margin_top = 13.0
69
+margin_right = 359.0
70
+margin_bottom = 27.0
71
+text = "  Volume:"
72
+
73
+[node name="Volume" type="SpinBox" parent="."]
74
+margin_left = 363.0
75
+margin_right = 437.0
76
+margin_bottom = 40.0
77
+min_value = -80.0
78
+max_value = 24.0
79
+step = 0.01
80
+suffix = "dB"
81
+__meta__ = {
82
+"_edit_use_anchors_": false
83
+}
84
+
85
+[node name="Preview" type="Label" parent="."]
86
+visible = false
87
+margin_left = 329.0
88
+margin_top = 13.0
89
+margin_right = 357.0
90
+margin_bottom = 27.0
91
+custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
92
+text = "    ..."
93
+
94
+[node name="AudioPreview" type="AudioStreamPlayer" parent="."]
95
+
96
+[connection signal="pressed" from="ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
97
+[connection signal="pressed" from="ButtonClear" to="." method="_on_ButtonClear_pressed"]
98
+[connection signal="pressed" from="ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
99
+[connection signal="item_selected" from="BusSelector" to="." method="_on_BusSelector_item_selected"]
100
+[connection signal="value_changed" from="Volume" to="." method="_on_Volume_value_changed"]
101
+[connection signal="finished" from="AudioPreview" to="." method="_on_AudioPreview_finished"]

+ 56
- 0
addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.gd View File

@@ -0,0 +1,56 @@
1
+tool
2
+extends HBoxContainer
3
+
4
+onready var character_picker = $CharacterPicker
5
+onready var portrait_picker = $PortraitPicker
6
+
7
+signal character_changed(character, portrait)
8
+
9
+var allow_portrait_dont_change := true
10
+
11
+var character := {}
12
+var portrait: String
13
+
14
+
15
+func _ready():
16
+	character_picker.connect('character_selected', self , '_on_character_selected')
17
+	portrait_picker.connect("portrait_selected", self, '_on_portrait_selected')
18
+
19
+
20
+func set_allow_portrait_dont_change(dont_allow: bool):
21
+	allow_portrait_dont_change = dont_allow
22
+	portrait_picker.allow_dont_change = dont_allow
23
+
24
+
25
+func set_data(c: String, p: String):
26
+	character = {}
27
+	for ch in DialogicUtil.get_character_list():
28
+		if ch['file'] == c:
29
+			character = ch
30
+	
31
+	if character.has('name') and character.has('color'):
32
+		character_picker.set_data(character['name'], Color(character['color']))
33
+		portrait_picker.set_character(character, p)
34
+	else:
35
+		character_picker.set_data('',  Color('#FFFFFF'))
36
+		portrait_picker.set_character({}, '')
37
+		
38
+
39
+
40
+func _on_character_selected(data: Dictionary):
41
+	character = data
42
+	if allow_portrait_dont_change or character.keys().size() == 0:
43
+		portrait = ''
44
+	else:
45
+		portrait = 'Default'
46
+	portrait_picker.set_character(character)
47
+	emit_signal("character_changed", character, portrait)
48
+
49
+
50
+func _on_portrait_selected(p: String):
51
+	portrait = p
52
+	emit_signal("character_changed", character, portrait)
53
+
54
+
55
+func get_selected_character() -> Dictionary:
56
+	return character

+ 23
- 0
addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn View File

@@ -0,0 +1,23 @@
1
+[gd_scene load_steps=4 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.tscn" type="PackedScene" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.tscn" type="PackedScene" id=2]
5
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.gd" type="Script" id=3]
6
+
7
+[node name="CharacterAndPortraitPicker" type="HBoxContainer"]
8
+anchor_right = 1.0
9
+anchor_bottom = 1.0
10
+margin_right = -880.0
11
+margin_bottom = -570.0
12
+rect_min_size = Vector2( 144, 30 )
13
+script = ExtResource( 3 )
14
+__meta__ = {
15
+"_edit_use_anchors_": false
16
+}
17
+
18
+[node name="CharacterPicker" parent="." instance=ExtResource( 2 )]
19
+
20
+[node name="PortraitPicker" parent="." instance=ExtResource( 1 )]
21
+visible = false
22
+margin_left = 110.0
23
+margin_right = 144.0

addons/dialogic/Editor/Events/Common/CharacterPicker.gd → addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.gd View File

@@ -1,7 +1,7 @@
1 1
 tool
2 2
 extends HBoxContainer
3 3
 
4
-signal character_selected(value)
4
+signal character_selected(data)
5 5
 
6 6
 
7 7
 func _ready():
@@ -11,36 +11,35 @@ func _ready():
11 11
 func _on_Dropdown_about_to_show():
12 12
 	var popup = $Dropdown.get_popup()
13 13
 	popup.clear()
14
-	popup.add_item('No Character')
15
-	popup.set_item_metadata(0, {'file': '', 'color': Color('#ffffff')})
14
+	popup.add_item('[Character]')
15
+	popup.set_item_metadata(0, {})
16 16
 	
17 17
 	var index = 1
18 18
 	for c in DialogicUtil.get_sorted_character_list():
19 19
 		popup.add_item(c['name'])
20
-		popup.set_item_metadata(index, {'file': c['file'],'color': c['color']})
20
+		popup.set_item_metadata(index, c)
21 21
 		index += 1
22 22
 
23 23
 
24 24
 func _on_character_selected(index: int):
25
-	var data = {'file': '', 'color': Color('#FFFFFF')}
25
+	var metadata = $Dropdown.get_popup().get_item_metadata(index)
26 26
 	if index == 0:
27 27
 		set_data('[Character]', Color('#FFFFFF'))
28 28
 	else:
29
-		var metadata = $Dropdown.get_popup().get_item_metadata(index)
30 29
 		set_data($Dropdown.get_popup().get_item_text(index), metadata['color'])
31
-		data['file'] = metadata['file']
32
-		data['color'] = metadata['color']
33
-	
34
-	emit_signal('character_selected', data)
35
-	return data
30
+	emit_signal('character_selected', metadata)
31
+	return metadata
36 32
 
37 33
 
38
-func set_data_by_file(file_name):
34
+func set_data_by_file(file_name: String):
39 35
 	# This method is used when you don't know the character's color
40 36
 	var character = DialogicResources.get_character_json(file_name)
41 37
 	set_data(character['name'], Color(character['color']))
42 38
 
43 39
 
44
-func set_data(text: String, color:Color = Color('#FFFFFF')) -> void:
45
-	$Dropdown.text = text
40
+func set_data(text: String, color: Color = Color('#FFFFFF')):
41
+	if not text.empty():
42
+		$Dropdown.text = text
43
+	else:
44
+		$Dropdown.text = '[Character]'
46 45
 	$Icon.set("self_modulate", Color(color))

addons/dialogic/Editor/Events/Common/CharacterPicker.tscn → addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.tscn View File

@@ -1,10 +1,7 @@
1 1
 [gd_scene load_steps=3 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=1]
4
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.gd" type="Script" id=2]
5
-
6
-
7
-
4
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.gd" type="Script" id=2]
8 5
 
9 6
 [node name="CharacterPicker" type="HBoxContainer"]
10 7
 margin_right = 106.0
@@ -30,5 +27,4 @@ margin_bottom = 30.0
30 27
 focus_mode = 2
31 28
 text = "[Character]"
32 29
 flat = false
33
-
34 30
 [connection signal="about_to_show" from="Dropdown" to="." method="_on_Dropdown_about_to_show"]

+ 54
- 0
addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.gd View File

@@ -0,0 +1,54 @@
1
+tool
2
+extends MenuButton
3
+
4
+var character := {}
5
+var portrait := ""
6
+
7
+var allow_dont_change := true
8
+
9
+signal portrait_selected(portrait)
10
+
11
+
12
+func _ready():
13
+	visible = false
14
+	connect("about_to_show", self, '_on_about_to_show')
15
+	get_popup().connect("index_pressed", self, '_on_portrait_selected')
16
+	if not allow_dont_change:
17
+		_set_portrait('Default')
18
+
19
+
20
+func set_character(c: Dictionary, p: String = '') -> void:
21
+	character = c
22
+	visible = character.has('portraits') and character['portraits'].size() > 1
23
+	_set_portrait('Default')
24
+	if allow_dont_change and (p == "[Don't change]" or p.empty()):
25
+		_set_portrait('')
26
+	elif visible:
27
+		for port in character['portraits']:
28
+			if port['name'] == p:
29
+				_set_portrait(p)
30
+
31
+func _set_portrait(val: String):
32
+	if (val.empty() or val == "[Don't change]") and allow_dont_change:
33
+		text = "[Don't change]"
34
+		portrait = ""
35
+	else:
36
+		text = val
37
+		portrait = val
38
+
39
+
40
+func _on_about_to_show():
41
+	get_popup().clear()
42
+	var index = 0
43
+	if allow_dont_change:
44
+		get_popup().add_item("[Don't change]")
45
+		index += 1
46
+	if character.has('portraits'):
47
+		for p in character['portraits']:
48
+			get_popup().add_item(p['name'])
49
+			index += 1
50
+
51
+
52
+func _on_portrait_selected(index: int):
53
+	set_character(character, get_popup().get_item_text(index))
54
+	emit_signal("portrait_selected", portrait)

addons/dialogic/Editor/Events/Common/PortraitPicker.tscn → addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.tscn View File

@@ -1,7 +1,8 @@
1 1
 [gd_scene load_steps=3 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Portrait.svg" type="Texture" id=1]
4
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.gd" type="Script" id=2]
4
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.gd" type="Script" id=2]
5
+
5 6
 
6 7
 
7 8
 

+ 34
- 0
addons/dialogic/Editor/Events/Common/ImagePicker.gd View File

@@ -0,0 +1,34 @@
1
+tool
2
+extends HBoxContainer
3
+
4
+var editor_reference
5
+
6
+signal clear_pressed()
7
+signal file_selected()
8
+
9
+onready var name_label = $Name
10
+onready var clear_button = $ClearButton
11
+
12
+
13
+func set_image(src: String):
14
+	clear_button.disabled = false
15
+	name_label.text = src;
16
+
17
+
18
+func clear_image():
19
+	clear_button.disabled = true
20
+	name_label.text = 'No image (will clear previous scene event)'
21
+
22
+
23
+func _on_file_selected(path, target):
24
+	emit_signal("file_selected", path)
25
+
26
+
27
+func _on_ImageButton_pressed():
28
+	editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
29
+	editor_reference.godot_dialog_connect(self, "_on_file_selected")
30
+
31
+
32
+func _on_ClearButton_pressed():
33
+	clear_image()
34
+	emit_signal("clear_pressed")

+ 34
- 0
addons/dialogic/Editor/Events/Common/ImagePicker.tscn View File

@@ -0,0 +1,34 @@
1
+[gd_scene load_steps=3 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/ImagePicker.gd" type="Script" id=2]
5
+
6
+[node name="ImagePicker" type="HBoxContainer"]
7
+margin_left = 154.0
8
+margin_right = 485.0
9
+margin_bottom = 28.0
10
+script = ExtResource( 2 )
11
+__meta__ = {
12
+"_edit_use_anchors_": false
13
+}
14
+
15
+[node name="Name" type="Label" parent="."]
16
+margin_top = 7.0
17
+margin_right = 271.0
18
+margin_bottom = 21.0
19
+text = "No image (will clear previous scene event)"
20
+
21
+[node name="ImageButton" type="Button" parent="."]
22
+margin_left = 275.0
23
+margin_right = 299.0
24
+margin_bottom = 28.0
25
+text = "..."
26
+
27
+[node name="ClearButton" type="Button" parent="."]
28
+margin_left = 303.0
29
+margin_right = 331.0
30
+margin_bottom = 28.0
31
+disabled = true
32
+icon = ExtResource( 1 )
33
+[connection signal="pressed" from="ImageButton" to="." method="_on_ImageButton_pressed"]
34
+[connection signal="pressed" from="ClearButton" to="." method="_on_ClearButton_pressed"]

+ 15
- 0
addons/dialogic/Editor/Events/Common/ImagePreview.gd View File

@@ -0,0 +1,15 @@
1
+tool
2
+extends CenterContainer
3
+
4
+onready var texture_rect = $TextureRect
5
+
6
+var previw_size = 200
7
+
8
+func set_image(image: Texture):
9
+	texture_rect.texture = image
10
+	if image != null:
11
+		texture_rect.rect_size = Vector2(previw_size, previw_size)
12
+		texture_rect.rect_min_size = Vector2(previw_size, previw_size)
13
+	else:
14
+		texture_rect.rect_size = Vector2(0, 0)
15
+		texture_rect.rect_min_size = Vector2(0, 0)

+ 25
- 0
addons/dialogic/Editor/Events/Common/ImagePreview.tscn View File

@@ -0,0 +1,25 @@
1
+[gd_scene load_steps=2 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/ImagePreview.gd" type="Script" id=1]
4
+
5
+[node name="ImagePreview" type="CenterContainer"]
6
+anchor_right = 1.0
7
+anchor_bottom = 1.0
8
+margin_right = -824.0
9
+margin_bottom = -400.0
10
+mouse_filter = 1
11
+size_flags_horizontal = 3
12
+size_flags_vertical = 3
13
+script = ExtResource( 1 )
14
+__meta__ = {
15
+"_edit_use_anchors_": false
16
+}
17
+
18
+[node name="TextureRect" type="TextureRect" parent="."]
19
+margin_right = 200.0
20
+margin_bottom = 200.0
21
+rect_min_size = Vector2( 200, 200 )
22
+size_flags_horizontal = 5
23
+size_flags_vertical = 5
24
+expand = true
25
+stretch_mode = 6

+ 0
- 2
addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn View File

@@ -3,8 +3,6 @@
3 3
 [ext_resource path="res://addons/dialogic/Images/Pieces/expand-icon.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.gd" type="Script" id=2]
5 5
 
6
-
7
-
8 6
 [node name="OptionButton" type="MenuButton"]
9 7
 margin_left = 1749.0
10 8
 margin_right = 1786.0

+ 0
- 44
addons/dialogic/Editor/Events/Common/PortraitPicker.gd View File

@@ -1,44 +0,0 @@
1
-tool
2
-extends MenuButton
3
-
4
-var character
5
-var portrait
6
-
7
-var allow_dont_change:bool = true
8
-
9
-
10
-func _ready():
11
-	visible = false
12
-	connect("about_to_show", self, '_on_about_to_show')
13
-	if allow_dont_change == false:
14
-		text = 'Default'
15
-
16
-
17
-func set_character(c: String, p: String = '') -> void:
18
-	character = c
19
-	portrait = p
20
-	visible = false
21
-	for c in DialogicUtil.get_character_list():
22
-		if c['file'] == character:
23
-			if c.has('portraits'):
24
-				if c['portraits'].size() > 1:
25
-					visible = true
26
-					for p in c['portraits']:
27
-						if p['name'] == portrait:
28
-							text = portrait
29
-	if allow_dont_change:
30
-		if p == "[Don't change]":
31
-			text = ''
32
-
33
-
34
-func _on_about_to_show():
35
-	get_popup().clear()
36
-	var index = 0
37
-	if allow_dont_change:
38
-		get_popup().add_item("[Don't change]")
39
-		index += 1
40
-	for c in DialogicUtil.get_sorted_character_list():
41
-		if c['file'] == character:
42
-			for p in c['portraits']:
43
-				get_popup().add_item(p['name'])
44
-				index += 1

+ 11
- 26
addons/dialogic/Editor/Events/Question.gd View File

@@ -13,15 +13,14 @@ var event_data = {
13 13
 	'portrait': '',
14 14
 }
15 15
 
16
-onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
16
+onready var character_picker = $PanelContainer/VBoxContainer/Header/CharacterAndPortraitPicker
17 17
 
18 18
 func _ready():
19
-	$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
20
-	portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
19
+	character_picker.connect("character_changed", self, '_on_character_changed')
21 20
 
22 21
 	var c_list = DialogicUtil.get_sorted_character_list()
23 22
 	if c_list.size() == 0:
24
-		$PanelContainer/VBoxContainer/Header/CharacterPicker.visible = false
23
+		character_picker.visible = false
25 24
 	else:
26 25
 		# Default Speaker
27 26
 		for c in c_list:
@@ -36,31 +35,17 @@ func load_data(data):
36 35
 		event_data['portrait'] = ''
37 36
 	
38 37
 	$PanelContainer/VBoxContainer/Header/LineEdit.text = event_data['question']
39
-	update_preview()
38
+	character_picker.set_data(event_data['character'], event_data['portrait'])
40 39
 
41 40
 
42 41
 func _on_LineEdit_text_changed(new_text):
43 42
 	event_data['question'] = new_text
44 43
 
45 44
 
46
-func _on_character_selected(data):
47
-	event_data['character'] = data['file']
48
-	update_preview()
49
-
50
-
51
-func _on_portrait_selected(index):
52
-	var text = portrait_picker.get_popup().get_item_text(index)
53
-	if text == "[Don't change]":
54
-		text = ''
55
-		portrait_picker.text = ''
56
-	event_data['portrait'] = text
57
-	update_preview()
58
-
59
-
60
-func update_preview():
61
-	portrait_picker.set_character(event_data['character'], event_data['portrait'])
62
-	
63
-	for c in DialogicUtil.get_character_list():
64
-		if c['file'] == event_data['character']:
65
-			$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data_by_file(event_data['character'])
66
-
45
+func _on_character_changed(character_data: Dictionary, portrait: String) -> void:
46
+	if character_data.keys().size() > 0:
47
+		event_data['character'] = character_data['file']
48
+		event_data['portrait'] = portrait
49
+	else:
50
+		event_data['character'] = ''
51
+		event_data['portrait'] = ''

+ 5
- 7
addons/dialogic/Editor/Events/Question.tscn View File

@@ -1,11 +1,10 @@
1
-[gd_scene load_steps=8 format=2]
1
+[gd_scene load_steps=7 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/question.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Question.gd" type="Script" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
7
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=5]
8
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=6]
7
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn" type="PackedScene" id=5]
9 8
 
10 9
 [sub_resource type="StyleBoxFlat" id=1]
11 10
 content_margin_left = 16.0
@@ -78,14 +77,13 @@ margin_left = 26.0
78 77
 margin_right = 30.0
79 78
 margin_bottom = 28.0
80 79
 
81
-[node name="CharacterPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
80
+[node name="CharacterAndPortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
81
+anchor_right = 0.0
82
+anchor_bottom = 0.0
82 83
 margin_left = 34.0
83 84
 margin_right = 140.0
84 85
 margin_bottom = 28.0
85 86
 
86
-[node name="PortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
87
-visible = false
88
-
89 87
 [node name="VSeparator2" type="VSeparator" parent="PanelContainer/VBoxContainer/Header"]
90 88
 margin_left = 144.0
91 89
 margin_right = 148.0

+ 0
- 60
addons/dialogic/Editor/Events/SceneEvent.gd View File

@@ -1,60 +0,0 @@
1
-tool
2
-extends Control
3
-
4
-var editor_reference
5
-var editorPopup
6
-var preview = "..."
7
-onready var toggler = get_node("PanelContainer/VBoxContainer/Header/VisibleToggle")
8
-
9
-# This is the information of this event and it will get parsed and saved to the JSON file.
10
-var event_data = {
11
-	'background': ''
12
-}
13
-
14
-
15
-func _ready():
16
-	connect("gui_input", self, '_on_gui_input')
17
-
18
-
19
-func load_data(data):
20
-	event_data = data
21
-	print("loading")
22
-	print(data)
23
-	load_image(event_data['background'])
24
-
25
-
26
-func load_image(img_src: String):
27
-	event_data['background'] = img_src
28
-	if not img_src.empty() and not img_src.ends_with('.tscn'):
29
-		$PanelContainer/VBoxContainer/Header/Name.text = img_src
30
-		$PanelContainer/VBoxContainer/TextureRect.texture = load(img_src)
31
-		$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(200,200)
32
-		$PanelContainer/VBoxContainer/Header/ClearButton.disabled = false
33
-		preview = "..."
34
-		toggler.show()
35
-		toggler.set_visible(true)
36
-	else:
37
-		$PanelContainer/VBoxContainer/Header/Name.text = 'No image (will clear previous scene event)'
38
-		$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(0,0)
39
-		$PanelContainer/VBoxContainer/Header/ClearButton.disabled = true
40
-		preview = ""
41
-		toggler.hide()
42
-		toggler.set_visible(false)
43
-
44
-
45
-func _on_gui_input(event):
46
-	if event is InputEventMouseButton and event.is_pressed() and event.doubleclick and event.button_index == 1 and toggler.visible:
47
-		toggler.set_visible(not toggler.pressed)
48
-
49
-
50
-func _on_ImageButton_pressed():
51
-	editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
52
-	editor_reference.godot_dialog_connect(self, "_on_file_selected")
53
-
54
-
55
-func _on_file_selected(path, target):
56
-	target.load_image(path)
57
-
58
-
59
-func _on_ClearButton_pressed():
60
-	load_image('')

+ 0
- 127
addons/dialogic/Editor/Events/SceneEvent.tscn View File

@@ -1,127 +0,0 @@
1
-[gd_scene load_steps=8 format=2]
2
-
3
-[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/scene event.svg" type="Texture" id=1]
4
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
5
-[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=3]
6
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=4]
7
-[ext_resource path="res://addons/dialogic/Editor/Events/SceneEvent.gd" type="Script" id=5]
8
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=6]
9
-
10
-
11
-[sub_resource type="StyleBoxFlat" id=1]
12
-content_margin_left = 16.0
13
-content_margin_right = 6.0
14
-content_margin_top = 6.0
15
-content_margin_bottom = 6.0
16
-bg_color = Color( 0.219608, 0.34902, 0.701961, 0.443137 )
17
-border_width_left = 2
18
-border_width_top = 2
19
-border_width_right = 2
20
-border_width_bottom = 2
21
-border_color = Color( 0.12549, 0.12549, 0.12549, 1 )
22
-corner_radius_top_left = 6
23
-corner_radius_top_right = 6
24
-corner_radius_bottom_right = 6
25
-corner_radius_bottom_left = 6
26
-
27
-[node name="SceneBlock" type="HBoxContainer"]
28
-anchor_right = 1.0
29
-margin_bottom = 44.0
30
-size_flags_horizontal = 3
31
-size_flags_vertical = 9
32
-script = ExtResource( 5 )
33
-__meta__ = {
34
-"_edit_use_anchors_": false
35
-}
36
-
37
-[node name="Indent" type="Control" parent="."]
38
-visible = false
39
-margin_bottom = 46.0
40
-
41
-[node name="PanelContainer" type="PanelContainer" parent="."]
42
-margin_right = 1024.0
43
-margin_bottom = 44.0
44
-mouse_filter = 1
45
-size_flags_horizontal = 3
46
-size_flags_vertical = 3
47
-custom_styles/panel = SubResource( 1 )
48
-
49
-[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
50
-margin_left = 16.0
51
-margin_top = 6.0
52
-margin_right = 1018.0
53
-margin_bottom = 38.0
54
-size_flags_horizontal = 3
55
-
56
-[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
57
-margin_right = 1002.0
58
-margin_bottom = 28.0
59
-
60
-[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
61
-margin_right = 22.0
62
-margin_bottom = 28.0
63
-texture = ExtResource( 1 )
64
-stretch_mode = 6
65
-
66
-[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
67
-margin_left = 26.0
68
-margin_top = 7.0
69
-margin_right = 139.0
70
-margin_bottom = 21.0
71
-text = "  Scene settings   "
72
-
73
-[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"]
74
-margin_left = 143.0
75
-margin_top = 7.0
76
-margin_right = 414.0
77
-margin_bottom = 21.0
78
-text = "No image (will clear previous scene event)"
79
-
80
-[node name="ImageButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
81
-margin_left = 418.0
82
-margin_right = 442.0
83
-margin_bottom = 28.0
84
-text = "..."
85
-
86
-[node name="ClearButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
87
-margin_left = 446.0
88
-margin_right = 474.0
89
-margin_bottom = 28.0
90
-disabled = true
91
-icon = ExtResource( 3 )
92
-
93
-[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
94
-visible = false
95
-margin_left = 478.0
96
-margin_right = 508.0
97
-
98
-[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
99
-visible = false
100
-margin_left = 512.0
101
-margin_top = 8.0
102
-margin_right = 540.0
103
-margin_bottom = 22.0
104
-custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
105
-text = "    ..."
106
-
107
-[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
108
-margin_left = 478.0
109
-margin_right = 961.0
110
-margin_bottom = 28.0
111
-
112
-[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
113
-margin_left = 965.0
114
-margin_right = 1002.0
115
-margin_bottom = 28.0
116
-items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
117
-
118
-[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer"]
119
-margin_top = 32.0
120
-margin_right = 1002.0
121
-margin_bottom = 32.0
122
-size_flags_horizontal = 3
123
-size_flags_vertical = 3
124
-expand = true
125
-stretch_mode = 5
126
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ImageButton" to="." method="_on_ImageButton_pressed"]
127
-[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ClearButton" to="." method="_on_ClearButton_pressed"]

+ 144
- 0
addons/dialogic/Editor/Events/Templates/EventTemplate.gd View File

@@ -0,0 +1,144 @@
1
+tool
2
+extends HBoxContainer
3
+
4
+export(StyleBoxFlat) var event_style : StyleBoxFlat
5
+export(Texture) var event_icon : Texture
6
+export(String) var event_name : String
7
+export(PackedScene) var header_scene : PackedScene
8
+export(PackedScene) var body_scene : PackedScene
9
+
10
+signal option_action(action_name)
11
+signal selected()
12
+
13
+onready var panel = $PanelContainer
14
+onready var title_container = $PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer
15
+onready var title_label = $PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer/TitleMarginContainer/TitleLabel
16
+onready var icon_texture  = $PanelContainer/MarginContainer/VBoxContainer/Header/IconMarginContainer/IconTexture
17
+onready var expand_control = $PanelContainer/MarginContainer/VBoxContainer/Header/ExpandControl
18
+onready var options_control = $PanelContainer/MarginContainer/VBoxContainer/Header/OptionsControl
19
+onready var header_content_container = $PanelContainer/MarginContainer/VBoxContainer/Header/Content
20
+onready var body_container = $PanelContainer/MarginContainer/VBoxContainer/Body
21
+onready var body_content_container = $PanelContainer/MarginContainer/VBoxContainer/Body/Content
22
+onready var indent_node = $Indent
23
+
24
+
25
+var header_node
26
+var body_node
27
+var indent_size = 25
28
+
29
+## *****************************************************************************
30
+##								PUBLIC METHODS
31
+## *****************************************************************************
32
+
33
+
34
+func set_event_style(style: StyleBoxFlat):
35
+	panel.set('custom_styles/panel', style)
36
+
37
+
38
+func get_event_style():
39
+	return panel.get('custom_styles/panel')
40
+	
41
+
42
+func set_event_icon(icon: Texture):
43
+	icon_texture.texture = icon
44
+
45
+
46
+func set_event_name(text: String):
47
+	title_label.text = text
48
+	if text.empty():
49
+		title_container.hide()
50
+	else:
51
+		title_container.show()
52
+
53
+
54
+func set_header(scene: PackedScene):
55
+	header_node = _set_content(header_content_container, scene)
56
+
57
+
58
+func set_body(scene: PackedScene):
59
+	body_node = _set_content(body_content_container, scene)
60
+	expand_control.set_enabled(body_node != null)
61
+
62
+
63
+func get_body():
64
+	return body_node
65
+
66
+
67
+func get_header():
68
+	return header_node
69
+
70
+
71
+func set_preview(text: String):
72
+	expand_control.set_preview(text)
73
+
74
+
75
+func set_indent(indent: int):
76
+	indent_node.rect_min_size = Vector2(indent_size * indent, 0)
77
+	indent_node.visible = indent != 0
78
+
79
+
80
+func on_timeline_selected():
81
+	emit_signal("selected")
82
+
83
+
84
+func set_expanded(expanded: bool):
85
+	expand_control.set_expanded(expanded)
86
+
87
+
88
+## *****************************************************************************
89
+##								PRIVATE METHODS
90
+## *****************************************************************************
91
+
92
+
93
+func _setup_event():
94
+	if event_style != null:
95
+		set_event_style(event_style)
96
+	if event_icon != null:
97
+		set_event_icon(event_icon)
98
+	if event_name != null:
99
+		set_event_name(event_name)
100
+	if header_scene != null:
101
+		set_header(header_scene)
102
+	if body_scene != null:
103
+		set_body(body_scene)
104
+
105
+
106
+func _set_content(container: Control, scene: PackedScene):
107
+	for c in container.get_children():
108
+		container.remove_child(c)
109
+	if scene != null:
110
+		var node = scene.instance()
111
+		container.add_child(node)
112
+#		node.set_owner(get_tree().get_edited_scene_root())
113
+		return node
114
+	return null
115
+
116
+
117
+func _on_ExpandControl_state_changed(expanded: bool):
118
+	if expanded:
119
+		body_container.show()
120
+	else:
121
+		body_container.hide()
122
+
123
+
124
+func _on_OptionsControl_action(action_name: String):
125
+	# Simply transmit the signal to the timeline editor
126
+	emit_signal("option_action", action_name)
127
+
128
+
129
+func _on_gui_input(event):
130
+	if event is InputEventMouseButton and event.is_pressed() and event.doubleclick and event.button_index == 1 and expand_control.enabled:
131
+		expand_control.set_expanded(not expand_control.expanded)
132
+
133
+
134
+## *****************************************************************************
135
+##								OVERRIDES
136
+## *****************************************************************************
137
+
138
+
139
+func _ready():
140
+	_setup_event()
141
+	panel.connect("gui_input", self, '_on_gui_input')
142
+	expand_control.connect("state_changed", self, "_on_ExpandControl_state_changed")
143
+	options_control.connect("action", self, "_on_OptionsControl_action")
144
+	expand_control.set_enabled(body_scene != null)

+ 168
- 0
addons/dialogic/Editor/Events/Templates/EventTemplate.tscn View File

@@ -0,0 +1,168 @@
1
+[gd_scene load_steps=7 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Templates/EventTemplate.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/Events/Templates/ExpandControl.tscn" type="PackedScene" id=2]
5
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=4]
6
+[ext_resource path="res://addons/dialogic/Editor/Events/Templates/OptionsControl.tscn" type="PackedScene" id=5]
7
+[ext_resource path="res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg" type="Texture" id=6]
8
+
9
+[sub_resource type="StyleBoxFlat" id=1]
10
+bg_color = Color( 0.262745, 0.262745, 0.262745, 1 )
11
+border_width_left = 2
12
+border_width_top = 2
13
+border_width_right = 2
14
+border_width_bottom = 2
15
+corner_radius_top_left = 6
16
+corner_radius_top_right = 6
17
+corner_radius_bottom_right = 6
18
+corner_radius_bottom_left = 6
19
+
20
+[node name="EventTemplate" type="HBoxContainer"]
21
+anchor_right = 1.0
22
+margin_bottom = 44.0
23
+rect_min_size = Vector2( 0, 44 )
24
+size_flags_horizontal = 3
25
+size_flags_vertical = 9
26
+script = ExtResource( 1 )
27
+__meta__ = {
28
+"_edit_use_anchors_": false
29
+}
30
+event_style = SubResource( 1 )
31
+event_icon = ExtResource( 6 )
32
+event_name = "Event Template"
33
+
34
+[node name="Indent" type="Control" parent="."]
35
+visible = false
36
+margin_bottom = 64.0
37
+
38
+[node name="PanelContainer" type="PanelContainer" parent="."]
39
+margin_right = 1024.0
40
+margin_bottom = 46.0
41
+mouse_filter = 1
42
+mouse_default_cursor_shape = 6
43
+size_flags_horizontal = 3
44
+size_flags_vertical = 3
45
+custom_styles/panel = SubResource( 1 )
46
+
47
+[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
48
+margin_left = 2.0
49
+margin_top = 2.0
50
+margin_right = 1022.0
51
+margin_bottom = 44.0
52
+mouse_filter = 1
53
+custom_constants/margin_right = 6
54
+custom_constants/margin_top = 6
55
+custom_constants/margin_left = 6
56
+custom_constants/margin_bottom = 6
57
+
58
+[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
59
+margin_left = 6.0
60
+margin_top = 6.0
61
+margin_right = 1014.0
62
+margin_bottom = 36.0
63
+rect_min_size = Vector2( 0, 30 )
64
+size_flags_horizontal = 3
65
+
66
+[node name="Header" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
67
+margin_right = 1008.0
68
+margin_bottom = 30.0
69
+rect_min_size = Vector2( 0, 30 )
70
+size_flags_horizontal = 3
71
+
72
+[node name="IconMarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
73
+margin_right = 31.0
74
+margin_bottom = 30.0
75
+mouse_filter = 1
76
+custom_constants/margin_right = 5
77
+custom_constants/margin_left = 10
78
+
79
+[node name="IconTexture" type="TextureRect" parent="PanelContainer/MarginContainer/VBoxContainer/Header/IconMarginContainer"]
80
+margin_left = 10.0
81
+margin_right = 26.0
82
+margin_bottom = 30.0
83
+texture = ExtResource( 6 )
84
+stretch_mode = 6
85
+
86
+[node name="TitleHBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
87
+margin_left = 35.0
88
+margin_right = 160.0
89
+margin_bottom = 30.0
90
+
91
+[node name="VSeparator" type="VSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer"]
92
+margin_right = 4.0
93
+margin_bottom = 30.0
94
+mouse_filter = 1
95
+
96
+[node name="TitleMarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer"]
97
+margin_left = 8.0
98
+margin_right = 117.0
99
+margin_bottom = 30.0
100
+mouse_filter = 1
101
+custom_constants/margin_right = 5
102
+custom_constants/margin_left = 5
103
+__meta__ = {
104
+"_edit_use_anchors_": false
105
+}
106
+
107
+[node name="TitleLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer/TitleMarginContainer"]
108
+margin_left = 5.0
109
+margin_top = 8.0
110
+margin_right = 104.0
111
+margin_bottom = 22.0
112
+text = "Event Template"
113
+
114
+[node name="VSeparator2" type="VSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer"]
115
+margin_left = 121.0
116
+margin_right = 125.0
117
+margin_bottom = 30.0
118
+mouse_filter = 1
119
+
120
+[node name="Content" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
121
+margin_left = 164.0
122
+margin_right = 174.0
123
+margin_bottom = 30.0
124
+mouse_filter = 1
125
+custom_constants/margin_right = 5
126
+custom_constants/margin_left = 5
127
+
128
+[node name="ExpandControl" parent="PanelContainer/MarginContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
129
+margin_left = 178.0
130
+margin_right = 230.0
131
+
132
+[node name="Spacer" parent="PanelContainer/MarginContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
133
+margin_left = 178.0
134
+margin_right = 962.0
135
+margin_bottom = 30.0
136
+
137
+[node name="VSeparator3" type="VSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
138
+margin_left = 966.0
139
+margin_right = 970.0
140
+margin_bottom = 30.0
141
+mouse_filter = 1
142
+
143
+[node name="OptionsControl" parent="PanelContainer/MarginContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
144
+margin_left = 974.0
145
+margin_right = 1008.0
146
+margin_bottom = 30.0
147
+items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", false, "Remove", null, 0, false, false, 3, 0, null, "", false ]
148
+
149
+[node name="Body" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
150
+visible = false
151
+margin_top = 34.0
152
+margin_right = 1008.0
153
+margin_bottom = 262.0
154
+
155
+[node name="HSeparator" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Body"]
156
+margin_right = 1008.0
157
+margin_bottom = 4.0
158
+mouse_filter = 1
159
+
160
+[node name="Content" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Body"]
161
+margin_top = 8.0
162
+margin_right = 1008.0
163
+margin_bottom = 228.0
164
+mouse_filter = 1
165
+size_flags_horizontal = 3
166
+size_flags_vertical = 3
167
+custom_constants/margin_top = 10
168
+custom_constants/margin_bottom = 10

+ 43
- 0
addons/dialogic/Editor/Events/Templates/ExpandControl.gd View File

@@ -0,0 +1,43 @@
1
+tool
2
+extends HBoxContainer
3
+
4
+onready var visible_toggle = $VisibleToggle
5
+onready var preview = $MarginContainer/Preview
6
+
7
+var enabled : bool
8
+var expanded: bool
9
+
10
+signal state_changed(expanded)
11
+
12
+func _ready():
13
+	set_enabled(false)
14
+	visible_toggle.connect("toggled", self, "_on_VisibleToggle_toggled")
15
+
16
+
17
+func set_preview(text: String):
18
+	preview.text = text
19
+
20
+
21
+func set_enabled(enabled: bool):
22
+	self.enabled = enabled
23
+	set_expanded(enabled)
24
+	if enabled:
25
+		show()
26
+	else:
27
+		hide()
28
+
29
+
30
+func set_expanded(expanded: bool):
31
+	self.expanded = expanded
32
+	visible_toggle.pressed = expanded
33
+	if expanded:
34
+		preview.hide()
35
+	else:
36
+		preview.show()
37
+	visible_toggle.release_focus()
38
+	emit_signal("state_changed", expanded)
39
+
40
+
41
+func _on_VisibleToggle_toggled(button_pressed: bool):
42
+	if enabled:
43
+		set_expanded(button_pressed)

+ 38
- 0
addons/dialogic/Editor/Events/Templates/ExpandControl.tscn View File

@@ -0,0 +1,38 @@
1
+[gd_scene load_steps=3 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Templates/ExpandControl.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=4]
5
+
6
+[node name="ExpandControl" type="HBoxContainer"]
7
+visible = false
8
+margin_right = 62.0
9
+margin_bottom = 30.0
10
+script = ExtResource( 1 )
11
+__meta__ = {
12
+"_edit_use_anchors_": false
13
+}
14
+
15
+[node name="VSeparator" type="VSeparator" parent="."]
16
+margin_right = 4.0
17
+margin_bottom = 30.0
18
+
19
+[node name="VisibleToggle" parent="." instance=ExtResource( 4 )]
20
+margin_left = 8.0
21
+margin_right = 38.0
22
+pressed = false
23
+script = null
24
+
25
+[node name="MarginContainer" type="MarginContainer" parent="."]
26
+margin_left = 42.0
27
+margin_right = 64.0
28
+margin_bottom = 30.0
29
+mouse_filter = 1
30
+custom_constants/margin_left = 10
31
+
32
+[node name="Preview" type="Label" parent="MarginContainer"]
33
+margin_left = 10.0
34
+margin_top = 8.0
35
+margin_right = 22.0
36
+margin_bottom = 22.0
37
+custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
38
+text = "..."

+ 17
- 0
addons/dialogic/Editor/Events/Templates/OptionsControl.gd View File

@@ -0,0 +1,17 @@
1
+tool
2
+extends MenuButton
3
+
4
+signal action(action_name)
5
+
6
+func _ready():
7
+	var popup = get_popup()
8
+	popup.connect("index_pressed", self, "_on_OptionSelected")
9
+
10
+
11
+func _on_OptionSelected(index):
12
+	if index == 0:
13
+		emit_signal("action", "up")
14
+	elif index == 1:
15
+		emit_signal("action", "down")
16
+	elif index == 3:
17
+		emit_signal("action","remove")

+ 16
- 0
addons/dialogic/Editor/Events/Templates/OptionsControl.tscn View File

@@ -0,0 +1,16 @@
1
+[gd_scene load_steps=3 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Events/Templates/OptionsControl.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Images/Pieces/expand-icon.svg" type="Texture" id=2]
5
+
6
+[node name="OptionsControl" type="MenuButton"]
7
+margin_right = 29.0
8
+margin_bottom = 20.0
9
+icon = ExtResource( 2 )
10
+clip_text = true
11
+align = 2
12
+items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down", null, 0, false, false, 1, 0, null, "", false, "", null, 0, false, false, 2, 0, null, "", true, "Remove", null, 0, false, false, 3, 0, null, "", false ]
13
+script = ExtResource( 1 )
14
+__meta__ = {
15
+"_edit_use_anchors_": false
16
+}

+ 11
- 20
addons/dialogic/Editor/Events/TextBlock.gd View File

@@ -13,7 +13,7 @@ var event_data = {
13 13
 	'portrait': '',
14 14
 }
15 15
 
16
-onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
16
+onready var character_picker = $PanelContainer/VBoxContainer/Header/CharacterAndPortraitPicker
17 17
 onready var text_editor = $PanelContainer/VBoxContainer/TextEdit
18 18
 
19 19
 func _ready():
@@ -25,12 +25,11 @@ func _ready():
25 25
 	connect("gui_input", self, '_on_gui_input')
26 26
 	text_editor.connect("focus_entered", self, "_on_TextEdit_focus_entered")
27 27
 	text_editor.set("rect_min_size", Vector2(0, 80))
28
-	$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
29
-	portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
28
+	character_picker.connect('character_changed', self , '_on_character_changed')
30 29
 
31 30
 	var c_list = DialogicUtil.get_sorted_character_list()
32 31
 	if c_list.size() == 0:
33
-		$PanelContainer/VBoxContainer/Header/CharacterPicker.visible = false
32
+		character_picker.visible = false
34 33
 	else:
35 34
 		# Default Speaker
36 35
 		for c in c_list:
@@ -38,17 +37,13 @@ func _ready():
38 37
 				event_data['character'] = c['file']
39 38
 
40 39
 
41
-func _on_character_selected(data) -> void:
42
-	event_data['character'] = data['file']
43
-	update_preview()
44
-
45
-
46
-func _on_portrait_selected(index) -> void:
47
-	var text = portrait_picker.get_popup().get_item_text(index)
48
-	if text == "[Don't change]":
49
-		text = ''
50
-		portrait_picker.text = ''
51
-	event_data['portrait'] = text
40
+func _on_character_changed(character_data: Dictionary, portrait: String) -> void:
41
+	if character_data.keys().size() > 0:
42
+		event_data['character'] = character_data['file']
43
+		event_data['portrait'] = portrait
44
+	else:
45
+		event_data['character'] = ''
46
+		event_data['portrait'] = ''
52 47
 	update_preview()
53 48
 
54 49
 
@@ -67,17 +62,13 @@ func load_text(text) -> void:
67 62
 func load_data(data) -> void:
68 63
 	event_data = data
69 64
 	text_editor.text = event_data['text']
65
+	character_picker.set_data(event_data['character'], event_data['portrait'])
70 66
 	update_preview()
71 67
 
72 68
 
73 69
 func update_preview() -> String:
74
-	portrait_picker.set_character(event_data['character'], event_data['portrait'])
75 70
 	var t = text_editor.text
76 71
 	text_editor.rect_min_size.y = text_height * (2 + t.count('\n'))
77
-
78
-	for c in DialogicUtil.get_character_list():
79
-		if c['file'] == event_data['character']:
80
-			$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data_by_file(event_data['character'])
81 72
 	
82 73
 	var text = event_data['text']
83 74
 	var lines = text.count('\n')

+ 7
- 13
addons/dialogic/Editor/Events/TextBlock.tscn View File

@@ -1,16 +1,12 @@
1
-[gd_scene load_steps=9 format=2]
1
+[gd_scene load_steps=8 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Editor/Events/TextBlock.gd" type="Script" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
7
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=6]
8
-[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=7]
7
+[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn" type="PackedScene" id=5]
9 8
 [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=8]
10 9
 
11
-
12
-
13
-
14 10
 [sub_resource type="StyleBoxFlat" id=1]
15 11
 content_margin_left = 6.0
16 12
 content_margin_right = 6.0
@@ -90,14 +86,12 @@ margin_left = 35.0
90 86
 margin_right = 39.0
91 87
 margin_bottom = 30.0
92 88
 
93
-[node name="CharacterPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
89
+[node name="CharacterAndPortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
90
+anchor_right = 0.0
91
+anchor_bottom = 0.0
94 92
 margin_left = 43.0
95 93
 margin_right = 149.0
96
-
97
-[node name="PortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 7 )]
98
-visible = false
99
-margin_left = 153.0
100
-margin_right = 187.0
94
+margin_bottom = 30.0
101 95
 
102 96
 [node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
103 97
 margin_left = 153.0
@@ -129,8 +123,8 @@ margin_bottom = 114.0
129 123
 rect_min_size = Vector2( 0, 80 )
130 124
 size_flags_horizontal = 3
131 125
 size_flags_vertical = 3
126
+syntax_highlighting = true
132 127
 show_line_numbers = true
133 128
 smooth_scrolling = true
134 129
 wrap_enabled = true
135
-
136 130
 [connection signal="text_changed" from="PanelContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]

+ 13
- 0
addons/dialogic/Editor/Events/styles/ChangeBackground.tres View File

@@ -0,0 +1,13 @@
1
+[gd_resource type="StyleBoxFlat" format=2]
2
+
3
+[resource]
4
+bg_color = Color( 0.219608, 0.34902, 0.701961, 0.443137 )
5
+border_width_left = 2
6
+border_width_top = 2
7
+border_width_right = 2
8
+border_width_bottom = 2
9
+border_color = Color( 0.12549, 0.12549, 0.12549, 1 )
10
+corner_radius_top_left = 6
11
+corner_radius_top_right = 6
12
+corner_radius_bottom_right = 6
13
+corner_radius_bottom_left = 6

addons/dialogic/Editor/Events/selected_styleboxflat.tres → addons/dialogic/Editor/Events/styles/selected_styleboxflat.tres View File


+ 13
- 0
addons/dialogic/Editor/Events/styles/selected_styleboxflat_template.tres View File

@@ -0,0 +1,13 @@
1
+[gd_resource type="StyleBoxFlat" format=2]
2
+
3
+[resource]
4
+bg_color = Color( 0.0980392, 0.329412, 0.509804, 1 )
5
+border_width_left = 2
6
+border_width_top = 2
7
+border_width_right = 2
8
+border_width_bottom = 2
9
+border_color = Color( 0.0901961, 0.560784, 0.937255, 1 )
10
+corner_radius_top_left = 6
11
+corner_radius_top_right = 6
12
+corner_radius_bottom_right = 6
13
+corner_radius_bottom_left = 6

addons/dialogic/Editor/Events/selected_styleboxflat_text_event.tres → addons/dialogic/Editor/Events/styles/selected_styleboxflat_text_event.tres View File


+ 27
- 13
addons/dialogic/Editor/MasterTree/MasterTree.gd View File

@@ -58,27 +58,26 @@ func _ready():
58 58
 	
59 59
 	# Creating the parents
60 60
 	timelines_tree = tree.create_item(root)
61
-	timelines_tree.set_selectable(0, false)
62 61
 	timelines_tree.set_text(0, "Timelines")
63 62
 	timelines_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
63
+	timelines_tree.set_metadata(0, {'editor': 'Timeline Root'})
64 64
 	
65 65
 	characters_tree = tree.create_item(root)
66
-	characters_tree.set_selectable(0, false)
67 66
 	characters_tree.set_text(0, "Characters")
68 67
 	characters_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
68
+	characters_tree.set_metadata(0, {'editor': 'Character Root'})
69 69
 
70 70
 	definitions_tree = tree.create_item(root)
71
-	definitions_tree.set_selectable(0, false)
72 71
 	definitions_tree.set_text(0, "Definitions")
73 72
 	definitions_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
73
+	definitions_tree.set_metadata(0, {'editor': 'Definition Root'})
74 74
 	
75 75
 	themes_tree = tree.create_item(root)
76
-	themes_tree.set_selectable(0, false)
77 76
 	themes_tree.set_text(0, "Themes")
78 77
 	themes_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
78
+	themes_tree.set_metadata(0, {'editor': 'Theme Root'})
79 79
 	
80 80
 	settings_tree = tree.create_item(root)
81
-	settings_tree.set_selectable(0, true)
82 81
 	settings_tree.set_text(0, "Settings")
83 82
 	settings_tree.set_icon(0, get_icon("GDScript", "EditorIcons"))
84 83
 	settings_tree.set_metadata(0, {'editor': 'Settings'})
@@ -140,6 +139,7 @@ func _add_timeline(timeline, select = false):
140 139
 	else:
141 140
 		item.set_text(0, timeline['file'])
142 141
 	timeline['editor'] = 'Timeline'
142
+	timeline['editable'] = true
143 143
 	item.set_metadata(0, timeline)
144 144
 	if not get_constant("dark_theme", "Editor"):
145 145
 		item.set_icon_modulate(0, get_color("property_color", "Editor"))
@@ -165,6 +165,7 @@ func _add_theme(theme_item, select = false):
165 165
 	item.set_icon(0, theme_icon)
166 166
 	item.set_text(0, theme_item['name'])
167 167
 	theme_item['editor'] = 'Theme'
168
+	theme_item['editable'] = true
168 169
 	item.set_metadata(0, theme_item)
169 170
 	if not get_constant("dark_theme", "Editor"):
170 171
 		item.set_icon_modulate(0, get_color("property_color", "Editor"))
@@ -192,6 +193,7 @@ func _add_character(character, select = false):
192 193
 	else:
193 194
 		item.set_text(0, character['file'])
194 195
 	character['editor'] = 'Character'
196
+	character['editable'] = true
195 197
 	item.set_metadata(0, character)
196 198
 	#item.set_editable(0, true)
197 199
 	if character.has('color'):
@@ -220,6 +222,7 @@ func _add_definition(definition, select = false):
220 222
 	if definition['type'] == 1:
221 223
 		item.set_icon(0, glossary_icon)
222 224
 	definition['editor'] = 'Definition'
225
+	definition['editable'] = true
223 226
 	item.set_metadata(0, definition)
224 227
 	if not get_constant("dark_theme", "Editor"):
225 228
 		item.set_icon_modulate(0, get_color("property_color", "Editor"))
@@ -237,23 +240,22 @@ func _on_item_selected():
237 240
 	if metadata['editor'] == 'Timeline':
238 241
 		timeline_editor.load_timeline(metadata['file'])
239 242
 		show_timeline_editor()
240
-	if metadata['editor'] == 'Character':
243
+	elif metadata['editor'] == 'Character':
241 244
 		if not character_editor.is_selected(metadata['file']):
242 245
 			character_editor.load_character(metadata['file'])
243 246
 		show_character_editor()
244
-	if metadata['editor'] == 'Definition':
247
+	elif metadata['editor'] == 'Definition':
245 248
 		if not definition_editor.is_selected(metadata['id']):
246 249
 			definition_editor.visible = true
247 250
 			definition_editor.load_definition(metadata['id'])
248 251
 		show_definition_editor()
249
-	if metadata['editor'] == 'Theme':
252
+	elif metadata['editor'] == 'Theme':
250 253
 		theme_editor.load_theme(metadata['file'])
251 254
 		show_theme_editor()
252
-	if metadata['editor'] == 'Settings':
255
+	elif metadata['editor'] == 'Settings':
253 256
 		settings_editor.update_data()
254 257
 		show_settings_editor()
255 258
 
256
-
257 259
 func show_character_editor():
258 260
 	emit_signal("editor_selected", 'character')
259 261
 	character_editor.visible = true
@@ -328,7 +330,18 @@ func _on_item_rmb_selected(position):
328 330
 	if item['editor'] == 'Definition':
329 331
 		editor_reference.get_node("DefinitionPopupMenu").rect_position = get_viewport().get_mouse_position()
330 332
 		editor_reference.get_node("DefinitionPopupMenu").popup()
331
-
333
+	if item['editor'] == 'Timeline Root':
334
+		editor_reference.get_node('TimelineRootPopupMenu').rect_position = get_viewport().get_mouse_position()
335
+		editor_reference.get_node('TimelineRootPopupMenu').popup()
336
+	if item['editor'] == 'Character Root':
337
+		editor_reference.get_node("CharacterRootPopupMenu").rect_position = get_viewport().get_mouse_position()
338
+		editor_reference.get_node("CharacterRootPopupMenu").popup()
339
+	if item['editor'] == 'Theme Root':
340
+		editor_reference.get_node("ThemeRootPopupMenu").rect_position = get_viewport().get_mouse_position()
341
+		editor_reference.get_node("ThemeRootPopupMenu").popup()
342
+	if item['editor'] == 'Definition Root':
343
+		editor_reference.get_node("DefinitionRootPopupMenu").rect_position = get_viewport().get_mouse_position()
344
+		editor_reference.get_node("DefinitionRootPopupMenu").popup()
332 345
 
333 346
 func remove_selected():
334 347
 	var item = get_selected()
@@ -351,8 +364,9 @@ func _on_gui_input(event):
351 364
 		if event.is_pressed() and event.doubleclick:
352 365
 			var item = get_selected()
353 366
 			var metadata = item.get_metadata(0)
354
-			item.set_editable(0, true)
355
-			$RenamerReset.start(0.5)
367
+			if metadata.has("editable") and metadata["editable"]:
368
+				item.set_editable(0, true)
369
+				$RenamerReset.start(0.5)
356 370
 
357 371
 
358 372
 func _on_item_edited():

+ 64
- 11
addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd View File

@@ -31,16 +31,19 @@ onready var n : Dictionary = {
31 31
 	# Dialog box
32 32
 	'background_texture_button_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/CheckBox",
33 33
 	'theme_background_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton",
34
-	'theme_next_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextIndicatorButton",
35
-	'next_animation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextAnimation",
34
+	'theme_next_image': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextIndicatorButton",
35
+	'next_indicator_scale': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer7/IndicatorScale",
36
+	'next_indicator_offset_x': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetX",
37
+	'next_indicator_offset_y': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetY",
38
+	'next_animation': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextAnimation",
36 39
 	'theme_action_key': $"VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton",
37 40
 	'theme_background_color_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/CheckBox",
38 41
 	'theme_background_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/ColorPickerButton",
39
-	'theme_text_margin': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetV",
40
-	'theme_text_margin_h': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetH",
41
-	'size_w': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeW",
42
-	'size_h': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeH", 
43
-	'bottom_gap': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer5/BottomGap",
42
+	'theme_text_margin': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetV",
43
+	'theme_text_margin_h': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetH",
44
+	'size_w': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeW",
45
+	'size_h': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeH", 
46
+	'bottom_gap': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5/BottomGap",
44 47
 	'background_modulation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox",
45 48
 	'background_modulation_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton",
46 49
 	
@@ -72,6 +75,10 @@ onready var n : Dictionary = {
72 75
 	'button_offset_y': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetV",
73 76
 	'button_separation': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/VerticalSeparation",
74 77
 	
78
+	'button_fixed': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/FixedSize",
79
+	'button_fixed_x': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeX",
80
+	'button_fixed_y': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeY",
81
+	
75 82
 	# Glossary
76 83
 	'glossary_font': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton,
77 84
 	'glossary_color': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton,
@@ -101,7 +108,7 @@ func _ready() -> void:
101 108
 func load_theme(filename):
102 109
 	loading = true
103 110
 	current_theme = filename
104
-	var theme = DialogicResources.get_theme_config(filename) 
111
+	var theme = DialogicResources.get_theme_config(filename)
105 112
 	# Settings
106 113
 	n['theme_action_key'].text = theme.get_value('settings', 'action_key', 'ui_accept')
107 114
 	
@@ -111,6 +118,10 @@ func load_theme(filename):
111 118
 	n['theme_background_color'].color = Color(theme.get_value('background', 'color', '#ff000000'))
112 119
 	n['theme_background_color_visible'].pressed = theme.get_value('background', 'use_color', false)
113 120
 	n['theme_next_image'].text = DialogicResources.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
121
+	n['next_indicator_scale'].value = theme.get_value('next_indicator', 'scale', 0.4)
122
+	var next_indicator_offset = theme.get_value('next_indicator', 'offset', Vector2(13,10))
123
+	n['next_indicator_offset_x'].value = next_indicator_offset.x
124
+	n['next_indicator_offset_y'].value = next_indicator_offset.y
114 125
 
115 126
 	n['background_modulation'].pressed = theme.get_value('background', 'modulation', false)
116 127
 	n['background_modulation_color'].color = Color(theme.get_value('background', 'modulation_color', '#ffffffff'))
@@ -135,8 +146,9 @@ func load_theme(filename):
135 146
 	n['button_separation'].value = theme.get_value('buttons', 'gap', 5)
136 147
 	n['button_modulation'].pressed = theme.get_value('buttons', 'modulation', false)
137 148
 	n['button_modulation_color'].color = Color(theme.get_value('buttons', 'modulation_color', '#ffffffff'))
138
-	
139
-	
149
+	n['button_fixed'].pressed = theme.get_value('buttons', 'fixed', false)
150
+	n['button_fixed_x'].value = theme.get_value('buttons', 'fixed_size', Vector2(130,40)).x
151
+	n['button_fixed_y'].value = theme.get_value('buttons', 'fixed_size', Vector2(130,40)).y
140 152
 	
141 153
 	toggle_button_customization_fields(not theme.get_value('buttons', 'use_native', false))
142 154
 	
@@ -245,6 +257,14 @@ func _on_indicator_selected(path, target) -> void:
245 257
 		return
246 258
 	DialogicResources.set_theme_value(current_theme, 'next_indicator','image', path)
247 259
 	n['theme_next_image'].text = DialogicResources.get_filename_from_path(path)
260
+	# Since people will probably want the sprite on fresh values and the default
261
+	# ones are for the custom dialogic theme, I reset the next indicator properties
262
+	# here so they can set the scale and offset they want.
263
+	DialogicResources.set_theme_value(current_theme, 'next_indicator', 'scale', 1)
264
+	DialogicResources.set_theme_value(current_theme, 'offset', 'scale', Vector2(10,10))
265
+	n['next_indicator_scale'].value = 1
266
+	n['next_indicator_offset_x'].value = 10
267
+	n['next_indicator_offset_y'].value = 10
248 268
 	_on_PreviewButton_pressed() # Refreshing the preview
249 269
 
250 270
 
@@ -301,8 +321,12 @@ func _on_PreviewButton_pressed() -> void:
301 321
 	$VBoxContainer/Panel.add_child(preview_dialog)
302 322
 	
303 323
 	# maintaining the preview panel big enough for the dialog box
304
-	$VBoxContainer/Panel.rect_min_size.y = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y + 90 + preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
324
+	var box_size = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y
325
+	var bottom_gap = preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
326
+	var extra = 90
327
+	$VBoxContainer/Panel.rect_min_size.y = box_size + extra + bottom_gap
305 328
 	$VBoxContainer/Panel.rect_size.y = 0
329
+	preview_dialog.call_deferred('resize_main')
306 330
 
307 331
 
308 332
 func _on_ActionOptionButton_item_selected(index) -> void:
@@ -630,3 +654,32 @@ func _on_ColorPicker_ChoiceButtons_modulation_color_changed(color) -> void:
630 654
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'modulation_color', '#' + color.to_html())
631 655
 	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
632 656
 
657
+
658
+
659
+func _on_IndicatorScale_value_changed(value) -> void:
660
+	if loading:
661
+		return
662
+	DialogicResources.set_theme_value(current_theme, 'next_indicator', 'scale', value)
663
+	_on_PreviewButton_pressed() # Refreshing the preview
664
+
665
+
666
+func _on_NextOffset_value_changed(value):
667
+	if loading:
668
+		return
669
+	var offset_value = Vector2(n['next_indicator_offset_x'].value, n['next_indicator_offset_y'].value)
670
+	DialogicResources.set_theme_value(current_theme, 'next_indicator', 'offset', offset_value)
671
+	_on_PreviewButton_pressed() # Refreshing the preview
672
+
673
+
674
+func _on_FixedSize_toggled(button_pressed):
675
+	if loading:
676
+		return
677
+	DialogicResources.set_theme_value(current_theme, 'buttons', 'fixed', button_pressed)
678
+	_on_PreviewButton_pressed() # Refreshing the preview
679
+
680
+
681
+func _on_ButtonSize_value_changed(value):
682
+	if loading:
683
+		return
684
+	DialogicResources.set_theme_value(current_theme, 'buttons','fixed_size', Vector2(n['button_fixed_x'].value,n['button_fixed_y'].value))
685
+	_on_PreviewButton_pressed() # Refreshing the preview

+ 245
- 154
addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn View File

@@ -8,38 +8,38 @@ content_margin_left = 4.0
8 8
 content_margin_right = 4.0
9 9
 content_margin_top = 4.0
10 10
 content_margin_bottom = 4.0
11
-bg_color = Color( 0.2265, 0.246975, 0.301575, 1 )
11
+bg_color = Color( 0.252, 0.2718, 0.3246, 1 )
12 12
 
13 13
 [node name="ThemeEditor" type="ScrollContainer"]
14 14
 anchor_right = 1.0
15 15
 anchor_bottom = 1.0
16 16
 margin_right = -6.0
17
-margin_bottom = -17.0
17
+margin_bottom = 311.0
18 18
 script = ExtResource( 2 )
19 19
 __meta__ = {
20 20
 "_edit_use_anchors_": false
21 21
 }
22 22
 
23 23
 [node name="VBoxContainer" type="VBoxContainer" parent="."]
24
-margin_right = 1006.0
25
-margin_bottom = 592.0
24
+margin_right = 1018.0
25
+margin_bottom = 911.0
26 26
 size_flags_horizontal = 3
27 27
 size_flags_vertical = 3
28 28
 custom_constants/separation = 15
29 29
 
30 30
 [node name="Panel" type="Panel" parent="VBoxContainer"]
31
-margin_right = 1006.0
32
-margin_bottom = 300.0
33
-rect_min_size = Vector2( 0, 300 )
31
+margin_right = 1018.0
32
+margin_bottom = 460.0
33
+rect_min_size = Vector2( 0, 460 )
34 34
 
35 35
 [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
36
-margin_top = 315.0
37
-margin_right = 1006.0
38
-margin_bottom = 375.0
36
+margin_top = 475.0
37
+margin_right = 1018.0
38
+margin_bottom = 535.0
39 39
 custom_constants/separation = 10
40 40
 
41 41
 [node name="TextEdit" type="TextEdit" parent="VBoxContainer/HBoxContainer3"]
42
-margin_right = 844.0
42
+margin_right = 856.0
43 43
 margin_bottom = 60.0
44 44
 rect_min_size = Vector2( 400, 60 )
45 45
 size_flags_horizontal = 3
@@ -48,21 +48,22 @@ text = "This is preview text. You can use  [color=#A5EFAC]BBCode[/color] to styl
48 48
 wrap_enabled = true
49 49
 
50 50
 [node name="PreviewButton" type="Button" parent="VBoxContainer/HBoxContainer3"]
51
-margin_left = 854.0
52
-margin_right = 1006.0
51
+margin_left = 866.0
52
+margin_right = 1018.0
53 53
 margin_bottom = 60.0
54 54
 text = "  Preview changes  "
55 55
 icon = ExtResource( 1 )
56 56
 
57 57
 [node name="TabContainer" type="TabContainer" parent="VBoxContainer"]
58
-margin_top = 390.0
59
-margin_right = 1006.0
60
-margin_bottom = 592.0
58
+margin_top = 550.0
59
+margin_right = 1018.0
60
+margin_bottom = 911.0
61 61
 size_flags_horizontal = 3
62 62
 size_flags_vertical = 3
63 63
 tab_align = 0
64 64
 
65 65
 [node name="Dialog Text" type="HBoxContainer" parent="VBoxContainer/TabContainer"]
66
+visible = false
66 67
 anchor_right = 1.0
67 68
 anchor_bottom = 1.0
68 69
 margin_left = 4.0
@@ -73,7 +74,7 @@ custom_constants/separation = 10
73 74
 
74 75
 [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Text"]
75 76
 margin_right = 270.0
76
-margin_bottom = 166.0
77
+margin_bottom = 325.0
77 78
 rect_min_size = Vector2( 270, 0 )
78 79
 size_flags_vertical = 3
79 80
 __meta__ = {
@@ -199,12 +200,12 @@ prefix = "Y"
199 200
 [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Text"]
200 201
 margin_left = 280.0
201 202
 margin_right = 284.0
202
-margin_bottom = 166.0
203
+margin_bottom = 325.0
203 204
 
204 205
 [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Text"]
205 206
 margin_left = 294.0
206 207
 margin_right = 564.0
207
-margin_bottom = 166.0
208
+margin_bottom = 325.0
208 209
 rect_min_size = Vector2( 270, 0 )
209 210
 size_flags_vertical = 3
210 211
 __meta__ = {
@@ -251,8 +252,8 @@ margin_bottom = -4.0
251 252
 custom_constants/separation = 10
252 253
 
253 254
 [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"]
254
-margin_right = 270.0
255
-margin_bottom = 157.0
255
+margin_right = 288.0
256
+margin_bottom = 325.0
256 257
 rect_min_size = Vector2( 270, 0 )
257 258
 size_flags_vertical = 3
258 259
 __meta__ = {
@@ -260,29 +261,29 @@ __meta__ = {
260 261
 }
261 262
 
262 263
 [node name="SectionTitle" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column"]
263
-margin_right = 270.0
264
+margin_right = 288.0
264 265
 margin_bottom = 22.0
265 266
 custom_styles/normal = SubResource( 1 )
266 267
 text = "Visuals"
267 268
 
268 269
 [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column"]
269 270
 margin_top = 26.0
270
-margin_right = 270.0
271
-margin_bottom = 154.0
271
+margin_right = 288.0
272
+margin_bottom = 190.0
272 273
 size_flags_horizontal = 3
273 274
 custom_constants/hseparation = 10
274 275
 columns = 2
275 276
 
276 277
 [node name="Label5" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
277 278
 margin_top = 5.0
278
-margin_right = 134.0
279
+margin_right = 126.0
279 280
 margin_bottom = 19.0
280 281
 size_flags_horizontal = 3
281 282
 text = "Background Color"
282 283
 
283 284
 [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
284
-margin_left = 144.0
285
-margin_right = 270.0
285
+margin_left = 136.0
286
+margin_right = 288.0
286 287
 margin_bottom = 24.0
287 288
 
288 289
 [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2"]
@@ -291,20 +292,20 @@ margin_bottom = 24.0
291 292
 
292 293
 [node name="ColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2"]
293 294
 margin_left = 28.0
294
-margin_right = 126.0
295
+margin_right = 152.0
295 296
 margin_bottom = 24.0
296 297
 size_flags_horizontal = 3
297 298
 
298 299
 [node name="Label" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
299 300
 margin_top = 33.0
300
-margin_right = 134.0
301
+margin_right = 126.0
301 302
 margin_bottom = 47.0
302 303
 text = "Background Texture"
303 304
 
304 305
 [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
305
-margin_left = 144.0
306
+margin_left = 136.0
306 307
 margin_top = 28.0
307
-margin_right = 270.0
308
+margin_right = 288.0
308 309
 margin_bottom = 52.0
309 310
 
310 311
 [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3"]
@@ -314,21 +315,21 @@ pressed = true
314 315
 
315 316
 [node name="BackgroundTextureButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3"]
316 317
 margin_left = 28.0
317
-margin_right = 126.0
318
+margin_right = 152.0
318 319
 margin_bottom = 24.0
319 320
 size_flags_horizontal = 3
320 321
 text = "background-2"
321 322
 
322 323
 [node name="Label9" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
323 324
 margin_top = 61.0
324
-margin_right = 134.0
325
+margin_right = 126.0
325 326
 margin_bottom = 75.0
326 327
 text = "Texture Modulation"
327 328
 
328 329
 [node name="HBoxContainer6" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
329
-margin_left = 144.0
330
+margin_left = 136.0
330 331
 margin_top = 56.0
331
-margin_right = 270.0
332
+margin_right = 288.0
332 333
 margin_bottom = 80.0
333 334
 
334 335
 [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6"]
@@ -337,47 +338,102 @@ margin_bottom = 24.0
337 338
 
338 339
 [node name="ColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6"]
339 340
 margin_left = 28.0
340
-margin_right = 126.0
341
+margin_right = 152.0
341 342
 margin_bottom = 24.0
342 343
 size_flags_horizontal = 3
343 344
 
344
-[node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
345
-margin_top = 87.0
346
-margin_right = 134.0
347
-margin_bottom = 101.0
348
-text = "Next indicator"
345
+[node name="Label6" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
346
+margin_top = 89.0
347
+margin_right = 126.0
348
+margin_bottom = 103.0
349
+size_flags_horizontal = 3
350
+text = "Box padding"
349 351
 
350
-[node name="NextIndicatorButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
351
-margin_left = 144.0
352
+[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
353
+margin_left = 136.0
352 354
 margin_top = 84.0
353
-margin_right = 270.0
354
-margin_bottom = 104.0
355
-text = "next-indicator"
355
+margin_right = 288.0
356
+margin_bottom = 108.0
356 357
 
357
-[node name="Label4" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
358
-margin_top = 111.0
359
-margin_right = 134.0
360
-margin_bottom = 125.0
361
-text = "Next animation"
358
+[node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer"]
359
+margin_right = 74.0
360
+margin_bottom = 24.0
361
+max_value = 1e+07
362
+value = 10.0
363
+rounded = true
364
+allow_greater = true
365
+allow_lesser = true
362 366
 
363
-[node name="NextAnimation" type="OptionButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
364
-margin_left = 144.0
365
-margin_top = 108.0
366
-margin_right = 270.0
367
-margin_bottom = 128.0
368
-__meta__ = {
369
-"_edit_use_anchors_": false
370
-}
367
+[node name="TextOffsetH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer"]
368
+margin_left = 78.0
369
+margin_right = 152.0
370
+margin_bottom = 24.0
371
+max_value = 1e+07
372
+value = 20.0
373
+rounded = true
374
+allow_greater = true
375
+allow_lesser = true
376
+
377
+[node name="Label7" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
378
+margin_top = 117.0
379
+margin_right = 126.0
380
+margin_bottom = 131.0
381
+text = "Box size (pixels)"
382
+
383
+[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
384
+margin_left = 136.0
385
+margin_top = 112.0
386
+margin_right = 288.0
387
+margin_bottom = 136.0
388
+
389
+[node name="BoxSizeW" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4"]
390
+margin_right = 74.0
391
+margin_bottom = 24.0
392
+value = 100.0
393
+rounded = true
394
+allow_greater = true
395
+allow_lesser = true
396
+
397
+[node name="BoxSizeH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4"]
398
+margin_left = 78.0
399
+margin_right = 152.0
400
+margin_bottom = 24.0
401
+max_value = 999.0
402
+value = 167.0
403
+rounded = true
404
+allow_greater = true
405
+allow_lesser = true
406
+
407
+[node name="Label8" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
408
+margin_top = 145.0
409
+margin_right = 126.0
410
+margin_bottom = 159.0
411
+text = "Bottom gap"
412
+
413
+[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
414
+margin_left = 136.0
415
+margin_top = 140.0
416
+margin_right = 288.0
417
+margin_bottom = 164.0
418
+
419
+[node name="BottomGap" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5"]
420
+margin_right = 74.0
421
+margin_bottom = 24.0
422
+max_value = 999.0
423
+value = 40.0
424
+rounded = true
425
+allow_greater = true
426
+allow_lesser = true
371 427
 
372 428
 [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Box"]
373
-margin_left = 280.0
374
-margin_right = 284.0
375
-margin_bottom = 157.0
429
+margin_left = 298.0
430
+margin_right = 302.0
431
+margin_bottom = 325.0
376 432
 
377 433
 [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"]
378
-margin_left = 294.0
379
-margin_right = 564.0
380
-margin_bottom = 157.0
434
+margin_left = 312.0
435
+margin_right = 582.0
436
+margin_bottom = 325.0
381 437
 rect_min_size = Vector2( 270, 0 )
382 438
 size_flags_vertical = 3
383 439
 __meta__ = {
@@ -388,107 +444,105 @@ __meta__ = {
388 444
 margin_right = 270.0
389 445
 margin_bottom = 22.0
390 446
 custom_styles/normal = SubResource( 1 )
391
-text = "Placement"
447
+text = "Next Indicator"
392 448
 
393 449
 [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2"]
394 450
 margin_top = 26.0
395 451
 margin_right = 270.0
396
-margin_bottom = 106.0
452
+margin_bottom = 126.0
397 453
 size_flags_horizontal = 3
398 454
 custom_constants/hseparation = 10
399 455
 columns = 2
400 456
 
401
-[node name="Label6" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
402
-margin_top = 5.0
457
+[node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
458
+margin_top = 3.0
403 459
 margin_right = 108.0
404
-margin_bottom = 19.0
405
-size_flags_horizontal = 3
406
-text = "Box padding"
460
+margin_bottom = 17.0
461
+text = "Image"
407 462
 
408
-[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
463
+[node name="NextIndicatorButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
409 464
 margin_left = 118.0
410 465
 margin_right = 270.0
411
-margin_bottom = 24.0
466
+margin_bottom = 20.0
467
+text = "next-indicator"
412 468
 
413
-[node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer"]
414
-margin_right = 74.0
415
-margin_bottom = 24.0
416
-max_value = 1e+07
417
-value = 10.0
418
-rounded = true
419
-allow_greater = true
420
-allow_lesser = true
469
+[node name="Label4" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
470
+margin_top = 27.0
471
+margin_right = 108.0
472
+margin_bottom = 41.0
473
+text = "Animation"
421 474
 
422
-[node name="TextOffsetH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer"]
423
-margin_left = 78.0
424
-margin_right = 152.0
425
-margin_bottom = 24.0
426
-max_value = 1e+07
427
-value = 20.0
428
-rounded = true
429
-allow_greater = true
430
-allow_lesser = true
475
+[node name="NextAnimation" type="OptionButton" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
476
+margin_left = 118.0
477
+margin_top = 24.0
478
+margin_right = 270.0
479
+margin_bottom = 44.0
480
+__meta__ = {
481
+"_edit_use_anchors_": false
482
+}
431 483
 
432
-[node name="Label7" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
433
-margin_top = 33.0
484
+[node name="Label3" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
485
+margin_top = 53.0
434 486
 margin_right = 108.0
435
-margin_bottom = 47.0
436
-text = "Box size (pixels)"
487
+margin_bottom = 67.0
488
+text = "Scale"
437 489
 
438
-[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
490
+[node name="HBoxContainer7" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
439 491
 margin_left = 118.0
440
-margin_top = 28.0
492
+margin_top = 48.0
441 493
 margin_right = 270.0
442
-margin_bottom = 52.0
494
+margin_bottom = 72.0
443 495
 
444
-[node name="BoxSizeW" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4"]
496
+[node name="IndicatorScale" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer7"]
445 497
 margin_right = 74.0
446 498
 margin_bottom = 24.0
447
-value = 100.0
448
-rounded = true
449
-allow_greater = true
450
-allow_lesser = true
451
-
452
-[node name="BoxSizeH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4"]
453
-margin_left = 78.0
454
-margin_right = 152.0
455
-margin_bottom = 24.0
456 499
 max_value = 999.0
457
-value = 167.0
458
-rounded = true
500
+step = 0.1
501
+value = 1.0
459 502
 allow_greater = true
460 503
 allow_lesser = true
461 504
 
462
-[node name="Label8" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
463
-margin_top = 61.0
505
+[node name="Label9" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
506
+margin_top = 81.0
464 507
 margin_right = 108.0
465
-margin_bottom = 75.0
466
-text = "Bottom gap"
508
+margin_bottom = 95.0
509
+size_flags_horizontal = 3
510
+text = "Offset"
467 511
 
468
-[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
512
+[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
469 513
 margin_left = 118.0
470
-margin_top = 56.0
514
+margin_top = 76.0
471 515
 margin_right = 270.0
472
-margin_bottom = 80.0
516
+margin_bottom = 100.0
473 517
 
474
-[node name="BottomGap" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer5"]
518
+[node name="NextOffsetX" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2"]
475 519
 margin_right = 74.0
476 520
 margin_bottom = 24.0
477
-max_value = 999.0
478
-value = 40.0
521
+max_value = 1e+07
522
+value = 10.0
523
+rounded = true
524
+allow_greater = true
525
+allow_lesser = true
526
+
527
+[node name="NextOffsetY" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2"]
528
+margin_left = 78.0
529
+margin_right = 152.0
530
+margin_bottom = 24.0
531
+max_value = 1e+07
532
+value = 20.0
479 533
 rounded = true
480 534
 allow_greater = true
481 535
 allow_lesser = true
482 536
 
483 537
 [node name="VSeparator2" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Box"]
484
-margin_left = 574.0
485
-margin_right = 578.0
486
-margin_bottom = 157.0
538
+margin_left = 592.0
539
+margin_right = 596.0
540
+margin_bottom = 325.0
487 541
 
488 542
 [node name="Column3" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"]
489
-margin_left = 588.0
490
-margin_right = 858.0
491
-margin_bottom = 157.0
543
+margin_left = 606.0
544
+margin_right = 876.0
545
+margin_bottom = 325.0
492 546
 rect_min_size = Vector2( 270, 0 )
493 547
 size_flags_vertical = 3
494 548
 __meta__ = {
@@ -542,7 +596,7 @@ custom_constants/separation = 10
542 596
 
543 597
 [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"]
544 598
 margin_right = 287.0
545
-margin_bottom = 157.0
599
+margin_bottom = 325.0
546 600
 rect_min_size = Vector2( 270, 0 )
547 601
 size_flags_vertical = 3
548 602
 __meta__ = {
@@ -630,12 +684,12 @@ prefix = "Y"
630 684
 [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Name Label"]
631 685
 margin_left = 297.0
632 686
 margin_right = 301.0
633
-margin_bottom = 157.0
687
+margin_bottom = 325.0
634 688
 
635 689
 [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"]
636 690
 margin_left = 311.0
637 691
 margin_right = 581.0
638
-margin_bottom = 157.0
692
+margin_bottom = 325.0
639 693
 rect_min_size = Vector2( 270, 0 )
640 694
 size_flags_vertical = 3
641 695
 __meta__ = {
@@ -651,7 +705,7 @@ text = "Box"
651 705
 [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Name Label/Column2"]
652 706
 margin_top = 26.0
653 707
 margin_right = 270.0
654
-margin_bottom = 78.0
708
+margin_bottom = 106.0
655 709
 columns = 2
656 710
 
657 711
 [node name="Label5" type="Label" parent="VBoxContainer/TabContainer/Name Label/Column2/GridContainer"]
@@ -725,12 +779,12 @@ size_flags_horizontal = 3
725 779
 [node name="VSeparator2" type="VSeparator" parent="VBoxContainer/TabContainer/Name Label"]
726 780
 margin_left = 591.0
727 781
 margin_right = 595.0
728
-margin_bottom = 157.0
782
+margin_bottom = 325.0
729 783
 
730 784
 [node name="Column3" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"]
731 785
 margin_left = 605.0
732 786
 margin_right = 875.0
733
-margin_bottom = 157.0
787
+margin_bottom = 325.0
734 788
 rect_min_size = Vector2( 270, 0 )
735 789
 size_flags_vertical = 3
736 790
 __meta__ = {
@@ -770,7 +824,6 @@ allow_greater = true
770 824
 allow_lesser = true
771 825
 
772 826
 [node name="Choice Buttons" type="HBoxContainer" parent="VBoxContainer/TabContainer"]
773
-visible = false
774 827
 anchor_right = 1.0
775 828
 anchor_bottom = 1.0
776 829
 margin_left = 4.0
@@ -781,7 +834,7 @@ custom_constants/separation = 10
781 834
 
782 835
 [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons"]
783 836
 margin_right = 270.0
784
-margin_bottom = 157.0
837
+margin_bottom = 325.0
785 838
 rect_min_size = Vector2( 270, 0 )
786 839
 size_flags_vertical = 3
787 840
 __meta__ = {
@@ -797,7 +850,7 @@ text = "Visuals"
797 850
 [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column"]
798 851
 margin_top = 26.0
799 852
 margin_right = 270.0
800
-margin_bottom = 106.0
853
+margin_bottom = 162.0
801 854
 size_flags_horizontal = 3
802 855
 custom_constants/hseparation = 10
803 856
 columns = 2
@@ -898,26 +951,26 @@ margin_bottom = 24.0
898 951
 size_flags_horizontal = 3
899 952
 
900 953
 [node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer"]
901
-margin_top = 89.0
954
+margin_top = 117.0
902 955
 margin_right = 134.0
903
-margin_bottom = 103.0
956
+margin_bottom = 131.0
904 957
 text = "Use Native Buttons"
905 958
 
906 959
 [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer"]
907 960
 margin_left = 144.0
908
-margin_top = 84.0
961
+margin_top = 112.0
909 962
 margin_right = 270.0
910
-margin_bottom = 108.0
963
+margin_bottom = 136.0
911 964
 
912 965
 [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Choice Buttons"]
913 966
 margin_left = 280.0
914 967
 margin_right = 284.0
915
-margin_bottom = 157.0
968
+margin_bottom = 325.0
916 969
 
917 970
 [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons"]
918 971
 margin_left = 294.0
919
-margin_right = 575.0
920
-margin_bottom = 157.0
972
+margin_right = 603.0
973
+margin_bottom = 325.0
921 974
 rect_min_size = Vector2( 270, 0 )
922 975
 size_flags_vertical = 3
923 976
 __meta__ = {
@@ -925,15 +978,15 @@ __meta__ = {
925 978
 }
926 979
 
927 980
 [node name="SectionTitle" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column2"]
928
-margin_right = 281.0
981
+margin_right = 309.0
929 982
 margin_bottom = 22.0
930 983
 custom_styles/normal = SubResource( 1 )
931 984
 text = "Placement"
932 985
 
933 986
 [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2"]
934 987
 margin_top = 26.0
935
-margin_right = 281.0
936
-margin_bottom = 78.0
988
+margin_right = 309.0
989
+margin_bottom = 106.0
937 990
 size_flags_horizontal = 3
938 991
 custom_constants/hseparation = 10
939 992
 columns = 2
@@ -947,7 +1000,7 @@ text = "Box padding"
947 1000
 
948 1001
 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
949 1002
 margin_left = 129.0
950
-margin_right = 281.0
1003
+margin_right = 309.0
951 1004
 margin_bottom = 24.0
952 1005
 
953 1006
 [node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer"]
@@ -976,12 +1029,44 @@ text = "Vertical separation"
976 1029
 [node name="VerticalSeparation" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
977 1030
 margin_left = 129.0
978 1031
 margin_top = 28.0
979
-margin_right = 281.0
1032
+margin_right = 309.0
980 1033
 margin_bottom = 52.0
981 1034
 value = 5.0
982 1035
 rounded = true
983 1036
 allow_lesser = true
984 1037
 
1038
+[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
1039
+margin_top = 61.0
1040
+margin_right = 119.0
1041
+margin_bottom = 75.0
1042
+text = "Fixed size"
1043
+
1044
+[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
1045
+margin_left = 129.0
1046
+margin_top = 56.0
1047
+margin_right = 309.0
1048
+margin_bottom = 80.0
1049
+
1050
+[node name="FixedSize" type="CheckBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2"]
1051
+margin_right = 24.0
1052
+margin_bottom = 24.0
1053
+
1054
+[node name="ButtonSizeX" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2"]
1055
+margin_left = 28.0
1056
+margin_right = 102.0
1057
+margin_bottom = 24.0
1058
+rounded = true
1059
+allow_greater = true
1060
+allow_lesser = true
1061
+
1062
+[node name="ButtonSizeY" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2"]
1063
+margin_left = 106.0
1064
+margin_right = 180.0
1065
+margin_bottom = 24.0
1066
+rounded = true
1067
+allow_greater = true
1068
+allow_lesser = true
1069
+
985 1070
 [node name="Glossary" type="HBoxContainer" parent="VBoxContainer/TabContainer"]
986 1071
 visible = false
987 1072
 anchor_right = 1.0
@@ -1114,13 +1199,16 @@ one_shot = true
1114 1199
 [connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton" to="." method="_on_BackgroundTextureButton_pressed"]
1115 1200
 [connection signal="toggled" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox" to="." method="_on_BackgroundTexture_Modulation_toggled"]
1116 1201
 [connection signal="color_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton" to="." method="_on_ColorPicker_Background_texture_modulation_color_changed"]
1117
-[connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextIndicatorButton" to="." method="_on_NextIndicatorButton_pressed"]
1118
-[connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextAnimation" to="." method="_on_NextAnimation_item_selected"]
1119
-[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_TextMargin_value_changed"]
1120
-[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_TextMargin_value_changed"]
1121
-[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeW" to="." method="_on_BoxSize_value_changed"]
1122
-[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeH" to="." method="_on_BoxSize_value_changed"]
1123
-[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer5/BottomGap" to="." method="_on_BottomGap_value_changed"]
1202
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_TextMargin_value_changed"]
1203
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_TextMargin_value_changed"]
1204
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeW" to="." method="_on_BoxSize_value_changed"]
1205
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeH" to="." method="_on_BoxSize_value_changed"]
1206
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5/BottomGap" to="." method="_on_BottomGap_value_changed"]
1207
+[connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextIndicatorButton" to="." method="_on_NextIndicatorButton_pressed"]
1208
+[connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextAnimation" to="." method="_on_NextAnimation_item_selected"]
1209
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer7/IndicatorScale" to="." method="_on_IndicatorScale_value_changed"]
1210
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetX" to="." method="_on_NextOffset_value_changed"]
1211
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetY" to="." method="_on_NextOffset_value_changed"]
1124 1212
 [connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton" to="." method="_on_ActionOptionButton_item_selected"]
1125 1213
 [connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton" to="." method="_on_ActionOptionButton_pressed"]
1126 1214
 [connection signal="toggled" from="VBoxContainer/TabContainer/Name Label/Column/GridContainer/CharacterColor" to="." method="_on_name_auto_color_toggled"]
@@ -1147,6 +1235,9 @@ one_shot = true
1147 1235
 [connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_ButtonOffset_value_changed"]
1148 1236
 [connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_ButtonOffset_value_changed"]
1149 1237
 [connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/VerticalSeparation" to="." method="_on_VerticalSeparation_value_changed"]
1238
+[connection signal="toggled" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/FixedSize" to="." method="_on_FixedSize_toggled"]
1239
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeX" to="." method="_on_ButtonSize_value_changed"]
1240
+[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeY" to="." method="_on_ButtonSize_value_changed"]
1150 1241
 [connection signal="pressed" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton" to="." method="_on_GlossaryFontButton_pressed"]
1151 1242
 [connection signal="color_changed" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton" to="." method="_on_GlossaryColorPicker_color_changed"]
1152 1243
 [connection signal="toggled" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/HBoxContainer2/CheckBoxShadow" to="." method="_on_CheckBoxShadow_toggled"]

+ 85
- 44
addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd View File

@@ -11,8 +11,9 @@ onready var timeline = $TimelineArea/TimeLine
11 11
 onready var events_warning = $ScrollContainer/EventContainer/EventsWarning
12 12
 
13 13
 var hovered_item = null
14
-var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/selected_styleboxflat.tres")
15
-var selected_style_text : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/selected_styleboxflat_text_event.tres")
14
+var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/styles/selected_styleboxflat.tres")
15
+var selected_style_text : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/styles/selected_styleboxflat_text_event.tres")
16
+var selected_style_template : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/styles/selected_styleboxflat_template.tres")
16 17
 var saved_style : StyleBoxFlat
17 18
 var selected_item : Node
18 19
 
@@ -20,6 +21,10 @@ var selected_item : Node
20 21
 var moving_piece = null
21 22
 var piece_was_dragged = false
22 23
 
24
+func _has_template(event):
25
+	return event.event_data.has("background")
26
+
27
+
23 28
 func _ready():
24 29
 	var modifier = ''
25 30
 	var _scale = get_constant("inspector_margin", "Editor")
@@ -203,10 +208,12 @@ func _process(delta):
203 208
 
204 209
 func _clear_selection():
205 210
 	if selected_item != null and saved_style != null:
206
-		var selected_panel: PanelContainer = selected_item.get_node("PanelContainer")
207
-		if selected_panel != null:
208
-			selected_panel.set('custom_styles/panel', saved_style)
209
-			
211
+		if not _has_template(selected_item):
212
+			var selected_panel: PanelContainer = selected_item.get_node("PanelContainer")
213
+			if selected_panel != null:
214
+				selected_panel.set('custom_styles/panel', saved_style)
215
+		else:
216
+			selected_item.event_template.set_event_style(saved_style)
210 217
 	selected_item = null
211 218
 	saved_style = null
212 219
 
@@ -218,17 +225,22 @@ func _is_item_selected(item: Node):
218 225
 func _select_item(item: Node):
219 226
 	if item != null and not _is_item_selected(item):
220 227
 		_clear_selection()
221
-		var panel: PanelContainer = item.get_node("PanelContainer")
222
-		if panel != null:
223
-			saved_style = panel.get('custom_styles/panel')
224
-			selected_item = item
225
-			if selected_item.event_data.has('text') and selected_item.event_data.has('character'):
226
-				panel.set('custom_styles/panel', selected_style_text)
227
-			else:
228
-				panel.set('custom_styles/panel', selected_style)
229
-			# allow event panels to do additional operation when getting selected
230
-			if (selected_item.has_method("on_timeline_selected")):
231
-				selected_item.on_timeline_selected()
228
+		selected_item = item
229
+		if not _has_template(item):
230
+			var panel: PanelContainer = item.get_node("PanelContainer")
231
+			if panel != null:
232
+				saved_style = panel.get('custom_styles/panel')
233
+				if selected_item.event_data.has('text') and selected_item.event_data.has('character'):
234
+					panel.set('custom_styles/panel', selected_style_text)
235
+				else:
236
+					panel.set('custom_styles/panel', selected_style)
237
+				# allow event panels to do additional operation when getting selected
238
+				if (selected_item.has_method("on_timeline_selected")):
239
+					selected_item.on_timeline_selected()
240
+		else:
241
+			saved_style = item.event_template.get_event_style()
242
+			item.event_template.set_event_style(selected_style_template)
243
+			selected_item.event_template.on_timeline_selected()
232 244
 	else:
233 245
 		_clear_selection()
234 246
 
@@ -250,6 +262,16 @@ func _on_gui_input(event, item: Node):
250 262
 				piece_was_dragged = false
251 263
 
252 264
 
265
+func _on_event_options_action(action: String, item: Node):
266
+	if action == "remove":
267
+		if selected_item != item:
268
+			_select_item(item)
269
+		delete_event()
270
+	else:
271
+		move_block(item, action)
272
+	indent_events()
273
+
274
+
253 275
 # Event Creation signal for buttons
254 276
 func _create_event_button_pressed(button_name):
255 277
 	create_event(button_name)
@@ -284,7 +306,6 @@ func _on_ButtonCondition_pressed() -> void:
284 306
 
285 307
 # Adding an event to the timeline
286 308
 func create_event(scene: String, data: Dictionary = {'no-data': true} , indent: bool = false):
287
-	# This function will create an event in the timeline.
288 309
 	var piece = load("res://addons/dialogic/Editor/Events/" + scene + ".tscn").instance()
289 310
 	piece.editor_reference = editor_reference
290 311
 	if selected_item != null:
@@ -294,6 +315,9 @@ func create_event(scene: String, data: Dictionary = {'no-data': true} , indent:
294 315
 	if data.has('no-data') == false:
295 316
 		piece.load_data(data)
296 317
 	
318
+	if _has_template(piece):
319
+		piece.event_template.connect("option_action", self, '_on_event_options_action', [piece])
320
+	
297 321
 	piece.connect("gui_input", self, '_on_gui_input', [piece])
298 322
 	events_warning.visible = false
299 323
 	# Indent on create
@@ -313,8 +337,13 @@ func indent_events() -> void:
313 337
 		return
314 338
 	# Resetting all the indents
315 339
 	for event in event_list:
316
-		var indent_node = event.get_node("Indent")
317
-		indent_node.visible = false
340
+		var indent_node
341
+		# Keep old behavior for items without template
342
+		if not _has_template(event):
343
+			indent_node = event.get_node("Indent")
344
+			indent_node.visible = false
345
+		else:
346
+			event.event_template.set_indent(0)
318 347
 		
319 348
 	# Adding new indents
320 349
 	for event in event_list:
@@ -322,17 +351,18 @@ func indent_events() -> void:
322 351
 		# in this list have an event_data property
323 352
 		if (not "event_data" in event):
324 353
 			continue
325
-			
326
-		if event.event_data.has('question') or event.event_data.has('condition'):
327
-			indent += 1
328
-			starter = true
329
-			question_index += 1
330
-			question_indent[question_index] = indent
354
+		
355
+		
331 356
 		if event.event_data.has('choice'):
332 357
 			if question_index > 0:
333 358
 				indent = question_indent[question_index] + 1
334 359
 				starter = true
335
-		if event.event_data.has('endbranch'):
360
+		elif event.event_data.has('question') or event.event_data.has('condition'):
361
+			indent += 1
362
+			starter = true
363
+			question_index += 1
364
+			question_indent[question_index] = indent
365
+		elif event.event_data.has('endbranch'):
336 366
 			if question_indent.has(question_index):
337 367
 				indent = question_indent[question_index]
338 368
 				indent -= 1
@@ -341,20 +371,24 @@ func indent_events() -> void:
341 371
 					indent = 0
342 372
 
343 373
 		if indent > 0:
344
-			var indent_node = event.get_node("Indent")
345
-			indent_node.rect_min_size = Vector2(25 * indent, 0)
346
-			indent_node.visible = true
347
-			if starter:
348
-				indent_node.rect_min_size = Vector2(25 * (indent - 1), 0)
349
-				if indent - 1 == 0:
350
-					indent_node.visible = false
351
-				
374
+			# Keep old behavior for items without template
375
+			if not _has_template(event):
376
+				var indent_node = event.get_node("Indent")
377
+				indent_node.rect_min_size = Vector2(25 * indent, 0)
378
+				indent_node.visible = true
379
+				if starter:
380
+					indent_node.rect_min_size = Vector2(25 * (indent - 1), 0)
381
+					if indent - 1 == 0:
382
+						indent_node.visible = false
383
+			else:
384
+				if starter:
385
+					event.event_template.set_indent(indent - 1)
386
+				else:
387
+					event.event_template.set_indent(indent)
352 388
 		starter = false
353 389
 
354 390
 
355 391
 func load_timeline(filename: String):
356
-	#print('---------------------------')
357
-	#print('Loading: ', filename)
358 392
 	clear_timeline()
359 393
 	var start_time = OS.get_system_time_msecs()
360 394
 	timeline_file = filename
@@ -370,16 +404,16 @@ func load_timeline(filename: String):
370 404
 			{'text', 'character', 'portrait'}:
371 405
 				create_event("TextBlock", i)
372 406
 			{'background'}:
373
-				create_event("SceneEvent", i)
374
-			{'character', 'action', 'position', 'portrait'}:
407
+				create_event("ChangeBackground", i)
408
+			{'character', 'action', 'position', 'portrait',..}:
375 409
 				create_event("CharacterJoinBlock", i)
376
-			{'audio', 'file'}:
410
+			{'audio', 'file', ..}:
377 411
 				create_event("AudioBlock", i)
378
-			{'background-music', 'file'}:
412
+			{'background-music', 'file', ..}:
379 413
 				create_event("BackgroundMusic", i)
380 414
 			{'question', 'options', ..}:
381 415
 				create_event("Question", i)
382
-			{'choice'}:
416
+			{'choice', ..}:
383 417
 				create_event("Choice", i)
384 418
 			{'endbranch'}:
385 419
 				create_event("EndBranch", i)
@@ -391,7 +425,7 @@ func load_timeline(filename: String):
391 425
 				create_event("EmitSignal", i)
392 426
 			{'change_scene'}:
393 427
 				create_event("ChangeScene", i)
394
-			{'close_dialog'}:
428
+			{'close_dialog', ..}:
395 429
 				create_event("CloseDialog", i)
396 430
 			{'wait_seconds'}:
397 431
 				create_event("WaitSeconds", i)
@@ -439,7 +473,10 @@ func get_block_below(block):
439 473
 
440 474
 func get_block_height(block):
441 475
 	if block != null:
442
-		return block.get_node("PanelContainer").rect_size.y
476
+		if not _has_template(block):
477
+			return block.get_node("PanelContainer").rect_size.y
478
+		else:
479
+			return block.rect_size.y
443 480
 	else:
444 481
 		return null
445 482
 
@@ -506,9 +543,13 @@ func fold_all_nodes():
506 543
 	for event in timeline.get_children():
507 544
 		if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"):
508 545
 			event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(false)
546
+		elif _has_template(event):
547
+			event.event_template.set_expanded(false)
509 548
 
510 549
 
511 550
 func unfold_all_nodes():
512 551
 	for event in timeline.get_children():
513 552
 		if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"):
514 553
 			event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(true)
554
+		elif _has_template(event):
555
+			event.event_template.set_expanded(true)

+ 5
- 4
addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn View File

@@ -3,7 +3,7 @@
3 3
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3]
6
-[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/scene event.svg" type="Texture" id=4]
6
+[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-background.svg" type="Texture" id=4]
7 7
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/condition.svg" type="Texture" id=5]
8 8
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=6]
9 9
 [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-leave.svg" type="Texture" id=7]
@@ -24,6 +24,7 @@
24 24
 [ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineArea.gd" type="Script" id=22]
25 25
 
26 26
 
27
+
27 28
 [sub_resource type="StyleBoxFlat" id=1]
28 29
 content_margin_left = 5.0
29 30
 content_margin_right = 5.0
@@ -266,15 +267,15 @@ align = 0
266 267
 script = ExtResource( 21 )
267 268
 EventName = "ChangeTimeline"
268 269
 
269
-[node name="SceneEvent" type="Button" parent="ScrollContainer/EventContainer"]
270
+[node name="ChangeBackground" type="Button" parent="ScrollContainer/EventContainer"]
270 271
 margin_top = 408.0
271 272
 margin_right = 180.0
272 273
 margin_bottom = 436.0
273
-text = "  Scene Event"
274
+text = "  Change Background"
274 275
 icon = ExtResource( 4 )
275 276
 align = 0
276 277
 script = ExtResource( 21 )
277
-EventName = "SceneEvent"
278
+EventName = "ChangeBackground"
278 279
 
279 280
 [node name="CloseDialog" type="Button" parent="ScrollContainer/EventContainer"]
280 281
 margin_top = 440.0

+ 0
- 1
addons/dialogic/Images/Context Menus/ActionCopy.svg View File

@@ -1 +0,0 @@
1
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m2 1c-.554 0-1 .446-1 1v9c0 .554.446 1 1 1h1v-9h9v-1c0-.554-.446-1-1-1zm3 3c-.554 0-1 .446-1 1v9c0 .554.446 1 1 1h9c.554 0 1-.446 1-1v-9c0-.554-.446-1-1-1zm1 2h7v7h-7z" fill="#e0e0e0"/></svg>

+ 0
- 1
addons/dialogic/Images/Context Menus/Filesystem.svg View File

@@ -1 +0,0 @@
1
-<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m1 1v5h2v8h1 5v1h6v-3h-6v1h-5v-4h5v1h6v-3h-6v1h-5v-2h3v-4h-2l-1-1z" fill="#e0e0e0"/></svg>

addons/dialogic/Images/Event Icons/Main Icons/scene event.svg → addons/dialogic/Images/Event Icons/Main Icons/change-background.svg View File


+ 34
- 0
addons/dialogic/Images/Event Icons/Main Icons/change-background.svg.import View File

@@ -0,0 +1,34 @@
1
+[remap]
2
+
3
+importer="texture"
4
+type="StreamTexture"
5
+path="res://.import/change-background.svg-b779e98a98d293a18e8d288547972610.stex"
6
+metadata={
7
+"vram_texture": false
8
+}
9
+
10
+[deps]
11
+
12
+source_file="res://addons/dialogic/Images/Event Icons/Main Icons/change-background.svg"
13
+dest_files=[ "res://.import/change-background.svg-b779e98a98d293a18e8d288547972610.stex" ]
14
+
15
+[params]
16
+
17
+compress/mode=0
18
+compress/lossy_quality=0.7
19
+compress/hdr_mode=0
20
+compress/bptc_ldr=0
21
+compress/normal_map=0
22
+flags/repeat=0
23
+flags/filter=true
24
+flags/mipmaps=false
25
+flags/anisotropic=false
26
+flags/srgb=2
27
+process/fix_alpha_border=true
28
+process/premult_alpha=false
29
+process/HDR_as_SRGB=false
30
+process/invert_color=false
31
+stream=false
32
+size_limit=0
33
+detect_3d=true
34
+svg/scale=1.0

+ 33
- 19
addons/dialogic/Nodes/BackgroundMusic.gd View File

@@ -1,29 +1,43 @@
1 1
 extends Control
2 2
 class_name DialogicBackgroundMusic
3 3
 
4
-onready var _anim_player := $AnimationPlayer
5 4
 onready var _track1 := $Track1
6 5
 onready var _track2 := $Track2
7 6
 
8 7
 var current_path = ""
9 8
 
10
-func crossfade_to(path: String) -> void:
11
-	if current_path != path:
12
-		current_path = path
13
-		var stream: AudioStream = load(current_path)
14
-		if _track1.playing and _track2.playing:
15
-			return
16
-		
17
-		if _track2.playing:
18
-			_track1.stream = stream
19
-			_track1.play()
20
-			_anim_player.play("FadeToTrack1")
21
-		else:
22
-			_track2.stream = stream
23
-			_track2.play()
24
-			_anim_player.play("FadeToTrack2")
9
+func crossfade_to(path: String, audio_bus:String, volume:float, fade_length: float) -> void:
10
+	if _track1.playing and _track2.playing:
11
+		return
12
+	
13
+	var stream: AudioStream = load(path)
14
+	var fade_out_track = _track1
15
+	var fade_in_track = _track2
16
+	
17
+	if _track2.playing:
18
+		fade_out_track = _track2
19
+		fade_in_track = _track1
20
+	
21
+	# setup the new track
22
+	fade_in_track.stream = stream
23
+	fade_in_track.bus = audio_bus
24
+	fade_in_track.volume_db = -60
25
+	
26
+	
27
+	$Tween.interpolate_property(fade_out_track, "volume_db", null, -60, fade_length, Tween.TRANS_LINEAR)
28
+	$Tween.interpolate_property(fade_in_track, "volume_db", -60, volume, fade_length, Tween.TRANS_LINEAR)
29
+	$Tween.start()
30
+	
31
+	# in case the audio is already playing we will attempt a fade into the new one from the current position
32
+	if current_path == path:
33
+		fade_in_track.play(fade_out_track.get_playback_position())
34
+	# else just play it from the beginning
35
+	else:
36
+		fade_in_track.play()
37
+	current_path = path
25 38
 
26
-
27
-func fade_out() -> void:
39
+func fade_out(fade_length:float = 1) -> void:
28 40
 	current_path = ""
29
-	_anim_player.play("FadeOut")
41
+	$Tween.interpolate_property(_track1, "volume_db", null, -60, fade_length, Tween.TRANS_LINEAR)
42
+	$Tween.interpolate_property(_track2, "volume_db", null, -60, fade_length, Tween.TRANS_LINEAR)
43
+	$Tween.start()

+ 3
- 135
addons/dialogic/Nodes/BackgroundMusic.tscn View File

@@ -1,137 +1,7 @@
1
-[gd_scene load_steps=5 format=2]
1
+[gd_scene load_steps=2 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Nodes/BackgroundMusic.gd" type="Script" id=1]
4 4
 
5
-[sub_resource type="Animation" id=1]
6
-resource_name = "FadeOut"
7
-length = 0.5
8
-tracks/0/type = "value"
9
-tracks/0/path = NodePath("Track1:volume_db")
10
-tracks/0/interp = 1
11
-tracks/0/loop_wrap = true
12
-tracks/0/imported = false
13
-tracks/0/enabled = true
14
-tracks/0/keys = {
15
-"times": PoolRealArray( 0, 0.5 ),
16
-"transitions": PoolRealArray( 5.66, 1 ),
17
-"update": 0,
18
-"values": [ 0.0, -80.0 ]
19
-}
20
-tracks/1/type = "value"
21
-tracks/1/path = NodePath("Track2:volume_db")
22
-tracks/1/interp = 1
23
-tracks/1/loop_wrap = true
24
-tracks/1/imported = false
25
-tracks/1/enabled = true
26
-tracks/1/keys = {
27
-"times": PoolRealArray( 0, 0.5 ),
28
-"transitions": PoolRealArray( 5.66, 1 ),
29
-"update": 0,
30
-"values": [ 0.0, -80.0 ]
31
-}
32
-tracks/2/type = "value"
33
-tracks/2/path = NodePath("Track2:playing")
34
-tracks/2/interp = 1
35
-tracks/2/loop_wrap = true
36
-tracks/2/imported = false
37
-tracks/2/enabled = true
38
-tracks/2/keys = {
39
-"times": PoolRealArray( 0.5 ),
40
-"transitions": PoolRealArray( 1 ),
41
-"update": 1,
42
-"values": [ false ]
43
-}
44
-tracks/3/type = "value"
45
-tracks/3/path = NodePath("Track1:playing")
46
-tracks/3/interp = 1
47
-tracks/3/loop_wrap = true
48
-tracks/3/imported = false
49
-tracks/3/enabled = true
50
-tracks/3/keys = {
51
-"times": PoolRealArray( 0.5 ),
52
-"transitions": PoolRealArray( 1 ),
53
-"update": 1,
54
-"values": [ false ]
55
-}
56
-
57
-[sub_resource type="Animation" id=2]
58
-length = 0.5
59
-tracks/0/type = "value"
60
-tracks/0/path = NodePath("Track1:volume_db")
61
-tracks/0/interp = 1
62
-tracks/0/loop_wrap = true
63
-tracks/0/imported = false
64
-tracks/0/enabled = true
65
-tracks/0/keys = {
66
-"times": PoolRealArray( 0, 0.5 ),
67
-"transitions": PoolRealArray( 5.66, 1 ),
68
-"update": 0,
69
-"values": [ -80.0, 0.0 ]
70
-}
71
-tracks/1/type = "value"
72
-tracks/1/path = NodePath("Track2:volume_db")
73
-tracks/1/interp = 1
74
-tracks/1/loop_wrap = true
75
-tracks/1/imported = false
76
-tracks/1/enabled = true
77
-tracks/1/keys = {
78
-"times": PoolRealArray( 0, 0.5 ),
79
-"transitions": PoolRealArray( 5.66, 1 ),
80
-"update": 0,
81
-"values": [ 0.0, -80.0 ]
82
-}
83
-tracks/2/type = "value"
84
-tracks/2/path = NodePath("Track2:playing")
85
-tracks/2/interp = 1
86
-tracks/2/loop_wrap = true
87
-tracks/2/imported = false
88
-tracks/2/enabled = true
89
-tracks/2/keys = {
90
-"times": PoolRealArray( 0.5 ),
91
-"transitions": PoolRealArray( 1 ),
92
-"update": 1,
93
-"values": [ false ]
94
-}
95
-
96
-[sub_resource type="Animation" id=3]
97
-length = 0.5
98
-tracks/0/type = "value"
99
-tracks/0/path = NodePath("Track1:volume_db")
100
-tracks/0/interp = 1
101
-tracks/0/loop_wrap = true
102
-tracks/0/imported = false
103
-tracks/0/enabled = true
104
-tracks/0/keys = {
105
-"times": PoolRealArray( 0, 0.5 ),
106
-"transitions": PoolRealArray( 5.66, 1 ),
107
-"update": 0,
108
-"values": [ 0.0, -80.0 ]
109
-}
110
-tracks/1/type = "value"
111
-tracks/1/path = NodePath("Track1:playing")
112
-tracks/1/interp = 1
113
-tracks/1/loop_wrap = true
114
-tracks/1/imported = false
115
-tracks/1/enabled = true
116
-tracks/1/keys = {
117
-"times": PoolRealArray( 0.5 ),
118
-"transitions": PoolRealArray( 1 ),
119
-"update": 1,
120
-"values": [ false ]
121
-}
122
-tracks/2/type = "value"
123
-tracks/2/path = NodePath("Track2:volume_db")
124
-tracks/2/interp = 1
125
-tracks/2/loop_wrap = true
126
-tracks/2/imported = false
127
-tracks/2/enabled = true
128
-tracks/2/keys = {
129
-"times": PoolRealArray( 0, 0.5 ),
130
-"transitions": PoolRealArray( 5.66, 1 ),
131
-"update": 0,
132
-"values": [ -80.0, 0.0 ]
133
-}
134
-
135 5
 [node name="BackgroundMusic" type="Control"]
136 6
 margin_right = 40.0
137 7
 margin_bottom = 40.0
@@ -141,11 +11,9 @@ __meta__ = {
141 11
 }
142 12
 
143 13
 [node name="Track1" type="AudioStreamPlayer" parent="."]
14
+volume_db = -80.0
144 15
 
145 16
 [node name="Track2" type="AudioStreamPlayer" parent="."]
146 17
 volume_db = -80.0
147 18
 
148
-[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
149
-anims/FadeOut = SubResource( 1 )
150
-anims/FadeToTrack1 = SubResource( 2 )
151
-anims/FadeToTrack2 = SubResource( 3 )
19
+[node name="Tween" type="Tween" parent="."]

+ 13
- 4
addons/dialogic/Nodes/Portrait.gd View File

@@ -4,7 +4,8 @@ var character_data = {
4 4
 	'name': 'Default',
5 5
 	'image': "res://addons/dialogic/Example Assets/portraits/df-3.png",
6 6
 	'color': Color(0.973511, 1, 0.152344),
7
-	'file': ''
7
+	'file': '',
8
+	'mirror_portraits': false
8 9
 }
9 10
 var positions = {
10 11
 	'left': Vector2(-400, 0),
@@ -12,10 +13,11 @@ var positions = {
12 13
 	'center': Vector2(0, 0),
13 14
 	'center_right': Vector2(200, 0),
14 15
 	'center_left': Vector2(-200, 0)}
16
+
15 17
 var direction = 'left'
16 18
 var debug = false
17 19
 
18
-func init(expression: String = '', position_offset = 'left') -> void:
20
+func init(expression: String = '', position_offset = 'left', mirror = false) -> void:
19 21
 	rect_position += positions[position_offset]
20 22
 	direction = position_offset
21 23
 	modulate = Color(1,1,1,0)
@@ -41,7 +43,14 @@ func init(expression: String = '', position_offset = 'left') -> void:
41 43
 			$TextureRect.texture.get_width() * 0.5,
42 44
 			$TextureRect.texture.get_height()
43 45
 		) * custom_scale
44
-
46
+	
47
+	# the mirror setting of the character
48
+	if character_data["data"].has('mirror_portraits'):
49
+		if character_data["data"]['mirror_portraits']:
50
+			$TextureRect.flip_h = true
51
+	# the mirror setting of the join event
52
+	if mirror:
53
+		$TextureRect.flip_h = !$TextureRect.flip_h
45 54
 
46 55
 func _ready():
47 56
 	if debug:
@@ -59,7 +68,7 @@ func set_portrait(expression: String) -> void:
59 68
 				$TextureRect.texture = load(p['path'])
60 69
 			else:
61 70
 				$TextureRect.texture = Texture.new()
62
-
71
+	
63 72
 
64 73
 # Tween stuff
65 74
 func fade_in(node = self, time = 0.5):

+ 19
- 5
addons/dialogic/Nodes/TextBubble.gd View File

@@ -6,6 +6,7 @@ var text_speed := 0.02 # Higher = lower speed
6 6
 onready var text_label = $RichTextLabel
7 7
 onready var name_label = $NameLabel
8 8
 onready var tween = $Tween
9
+onready var next_indicator = $NextIndicatorContainer/NextIndicator
9 10
 
10 11
 var _finished := false
11 12
 
@@ -101,7 +102,20 @@ func load_theme(theme: ConfigFile):
101 102
 	$TextureRect.visible = theme.get_value('background', 'use_image', true)
102 103
 
103 104
 	# Next image
104
-	$NextIndicator.texture = DialogicUtil.path_fixer_load(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
105
+	$NextIndicatorContainer.rect_position = Vector2(0,0)
106
+	next_indicator.texture = DialogicUtil.path_fixer_load(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
107
+	# Reset for up and down animation
108
+	next_indicator.margin_top = 0 
109
+	next_indicator.margin_bottom = 0 
110
+	next_indicator.margin_left = 0 
111
+	next_indicator.margin_right = 0 
112
+	# Scale
113
+	var indicator_scale = theme.get_value('next_indicator', 'scale', 0.4)
114
+	next_indicator.rect_scale = Vector2(indicator_scale, indicator_scale)
115
+	# Offset
116
+	var offset = theme.get_value('next_indicator', 'offset', Vector2(13, 10))
117
+	next_indicator.rect_position = theme.get_value('box', 'size', Vector2(910, 167)) - (next_indicator.texture.get_size() * indicator_scale)
118
+	next_indicator.rect_position -= offset
105 119
 	
106 120
 	# Character Name
107 121
 	$NameLabel/ColorRect.visible = theme.get_value('name', 'background_visible', false)
@@ -120,10 +134,10 @@ func load_theme(theme: ConfigFile):
120 134
 		$NameLabel/TextureRect.modulate = Color('#ffffffff')
121 135
 	
122 136
 	# Setting next indicator animation
123
-	$NextIndicator.self_modulate = Color('#ffffff')
124
-	$NextIndicator/AnimationPlayer.play(
125
-		theme.get_value('next_indicator', 'animation', 'Up and down')
126
-	)
137
+	next_indicator.self_modulate = Color('#ffffff')
138
+	var animation = theme.get_value('next_indicator', 'animation', 'Up and down')
139
+	next_indicator.get_node('AnimationPlayer').play(animation)
140
+
127 141
 
128 142
 ## *****************************************************************************
129 143
 ##								PRIVATE METHODS

+ 16
- 15
addons/dialogic/Nodes/TextBubble.tscn View File

@@ -31,7 +31,7 @@ resource_name = "Static"
31 31
 [sub_resource type="Animation" id=4]
32 32
 loop = true
33 33
 tracks/0/type = "value"
34
-tracks/0/path = NodePath(".:margin_bottom")
34
+tracks/0/path = NodePath("..:rect_position")
35 35
 tracks/0/interp = 2
36 36
 tracks/0/loop_wrap = true
37 37
 tracks/0/imported = false
@@ -40,7 +40,7 @@ tracks/0/keys = {
40 40
 "times": PoolRealArray( 0, 0.5 ),
41 41
 "transitions": PoolRealArray( 1, 1 ),
42 42
 "update": 0,
43
-"values": [ 12.0, 55.0 ]
43
+"values": [ Vector2( 0, 0 ), Vector2( 0, -10 ) ]
44 44
 }
45 45
 
46 46
 [sub_resource type="StyleBoxFlat" id=5]
@@ -92,7 +92,7 @@ margin_bottom = -10.0
92 92
 rect_clip_content = false
93 93
 custom_styles/normal = SubResource( 1 )
94 94
 custom_fonts/normal_font = ExtResource( 1 )
95
-custom_colors/default_color = Color( 0.423529, 0.580392, 0.74902, 1 )
95
+custom_colors/default_color = Color( 1, 1, 1, 1 )
96 96
 custom_colors/font_color_shadow = Color( 1, 1, 1, 0 )
97 97
 custom_constants/shadow_offset_x = 2
98 98
 custom_constants/shadow_offset_y = 2
@@ -104,30 +104,31 @@ __meta__ = {
104 104
 "_edit_use_anchors_": false
105 105
 }
106 106
 
107
-[node name="NextIndicator" type="TextureRect" parent="."]
108
-visible = false
109
-anchor_left = 1.0
110
-anchor_top = 1.0
111
-anchor_right = 1.0
112
-anchor_bottom = 1.0
113
-margin_left = -36.4279
114
-margin_top = -35.9016
115
-margin_right = 14.5721
116
-margin_bottom = 44.8652
117
-rect_scale = Vector2( 0.4, 0.4 )
107
+[node name="NextIndicatorContainer" type="Control" parent="."]
108
+margin_right = 40.0
109
+margin_bottom = 40.0
110
+__meta__ = {
111
+"_edit_use_anchors_": false
112
+}
113
+
114
+[node name="NextIndicator" type="TextureRect" parent="NextIndicatorContainer"]
115
+margin_top = -10.0
116
+margin_right = 51.0
117
+margin_bottom = 41.0
118 118
 texture = ExtResource( 3 )
119 119
 stretch_mode = 4
120 120
 __meta__ = {
121 121
 "_edit_use_anchors_": false
122 122
 }
123 123
 
124
-[node name="AnimationPlayer" type="AnimationPlayer" parent="NextIndicator"]
124
+[node name="AnimationPlayer" type="AnimationPlayer" parent="NextIndicatorContainer/NextIndicator"]
125 125
 autoplay = "Up and down"
126 126
 anims/Pulse = SubResource( 2 )
127 127
 anims/Static = SubResource( 3 )
128 128
 "anims/Up and down" = SubResource( 4 )
129 129
 
130 130
 [node name="NameLabel" type="Label" parent="."]
131
+visible = false
131 132
 margin_top = -48.0
132 133
 margin_right = 58.0
133 134
 margin_bottom = -8.0

+ 98
- 50
addons/dialogic/Nodes/dialog_node.gd View File

@@ -56,6 +56,8 @@ func _ready():
56 56
 	# Setting everything up for the node to be default
57 57
 	$DefinitionInfo.visible = false
58 58
 	$TextBubble.connect("text_completed", self, "_on_text_completed")
59
+	$TextBubble/RichTextLabel.connect('meta_hover_started', self, '_on_RichTextLabel_meta_hover_started')
60
+	$TextBubble/RichTextLabel.connect('meta_hover_ended', self, '_on_RichTextLabel_meta_hover_ended')
59 61
 
60 62
 	# Getting the character information
61 63
 	characters = DialogicUtil.get_character_list()
@@ -83,15 +85,16 @@ func load_config_files():
83 85
 
84 86
 func resize_main():
85 87
 	# This function makes sure that the dialog is displayed at the correct
86
-	# size and position in the screen. 
87
-	if Engine.is_editor_hint() == false:
88
+	# size and position in the screen.
89
+	var reference = rect_size
90
+	if not Engine.is_editor_hint():
88 91
 		set_global_position(Vector2(0,0))
89
-		if ProjectSettings.get_setting("display/window/stretch/mode") != '2d':
90
-			set_deferred('rect_size', get_viewport().size)
91
-		dprint("Viewport", get_viewport().size)
92
-	$TextBubble.rect_position.x = (rect_size.x / 2) - ($TextBubble.rect_size.x / 2)
92
+		reference = get_viewport().get_visible_rect().size
93
+
94
+	$TextBubble.rect_position.x = (reference.x / 2) - ($TextBubble.rect_size.x / 2)
93 95
 	if current_theme != null:
94
-		$TextBubble.rect_position.y = (rect_size.y) - ($TextBubble.rect_size.y) - current_theme.get_value('box', 'bottom_gap', 40)
96
+		$TextBubble.rect_position.y = (reference.y) - ($TextBubble.rect_size.y) - current_theme.get_value('box', 'bottom_gap', 40)
97
+
95 98
 
96 99
 
97 100
 func set_current_dialog(dialog_path: String):
@@ -190,32 +193,48 @@ func parse_branches(dialog_script: Dictionary) -> Dictionary:
190 193
 	var event_id: int = 0 # The current id for jumping later on
191 194
 	var question_id: int = 0 # identifying the questions to assign options to it
192 195
 	for event in dialog_script['events']:
193
-		if event.has('question'):
196
+		if event.has('choice'):
197
+			var opened_branch = parser_queue.back()
198
+			var option = {
199
+				'question_id': opened_branch['question_id'],
200
+				'label': event['choice'],
201
+				'event_id': event_id,
202
+				}
203
+			if event.has('condition') and event.has('definition') and event.has('value'):
204
+				option = {
205
+					'question_id': opened_branch['question_id'],
206
+					'label': event['choice'],
207
+					'event_id': event_id,
208
+					'condition': event['condition'],
209
+					'definition': event['definition'],
210
+					'value': event['value'],
211
+					}
212
+			else:
213
+				option = {
214
+					'question_id': opened_branch['question_id'],
215
+					'label': event['choice'],
216
+					'event_id': event_id,
217
+					'condition': '',
218
+					'definition': '',
219
+					'value': '',
220
+					}
221
+			dialog_script['events'][opened_branch['event_id']]['options'].append(option)
222
+			event['question_id'] = opened_branch['question_id']
223
+		elif event.has('question'):
194 224
 			event['event_id'] = event_id
195 225
 			event['question_id'] = question_id
196 226
 			event['answered'] = false
197 227
 			question_id += 1
198 228
 			questions.append(event)
199 229
 			parser_queue.append(event)
200
-
201
-		if event.has('condition'):
230
+		elif event.has('condition'):
202 231
 			event['event_id'] = event_id
203 232
 			event['question_id'] = question_id
204 233
 			event['answered'] = false
205 234
 			question_id += 1
206 235
 			questions.append(event)
207 236
 			parser_queue.append(event)
208
-
209
-		if event.has('choice'):
210
-			var opened_branch = parser_queue.back()
211
-			dialog_script['events'][opened_branch['event_id']]['options'].append({
212
-				'question_id': opened_branch['question_id'],
213
-				'label': event['choice'],
214
-				'event_id': event_id,
215
-				})
216
-			event['question_id'] = opened_branch['question_id']
217
-
218
-		if event.has('endbranch'):
237
+		elif event.has('endbranch'):
219 238
 			event['event_id'] = event_id
220 239
 			var opened_branch = parser_queue.pop_back()
221 240
 			event['end_branch_of'] = opened_branch['question_id']
@@ -256,7 +275,7 @@ func _insert_glossary_definitions(text: String):
256 275
 
257 276
 
258 277
 func _process(delta):
259
-	$TextBubble/NextIndicator.visible = finished
278
+	$TextBubble/NextIndicatorContainer/NextIndicator.visible = finished
260 279
 	if waiting_for_answer and Input.is_action_just_released(input_next):
261 280
 		if $Options.get_child_count() > 0:
262 281
 			$Options.get_child(0).grab_focus()
@@ -317,6 +336,7 @@ func on_timeline_end():
317 336
 		DialogicSingleton.save_definitions()
318 337
 		DialogicSingleton.set_current_timeline('')
319 338
 	emit_signal("event_end", "timeline")
339
+	dprint('[D] Timeline End')
320 340
 
321 341
 
322 342
 func _init_dialog():
@@ -435,7 +455,7 @@ func event_handler(event: Dictionary):
435 455
 						if char_portrait == '':
436 456
 							char_portrait = 'Default'
437 457
 						p.character_data = character_data
438
-						p.init(char_portrait, get_character_position(event['position']))
458
+						p.init(char_portrait, get_character_position(event['position']), event.get('mirror', false))
439 459
 						$Portraits.add_child(p)
440 460
 						p.fade_in()
441 461
 				_load_next_event()
@@ -455,6 +475,7 @@ func event_handler(event: Dictionary):
455 475
 					background.anchor_bottom = 1
456 476
 					background.stretch_mode = TextureRect.STRETCH_SCALE
457 477
 					background.show_behind_parent = true
478
+					background.mouse_filter = Control.MOUSE_FILTER_IGNORE
458 479
 					add_child(background)
459 480
 				background.texture = null
460 481
 				if (background.get_child_count() > 0):
@@ -469,7 +490,7 @@ func event_handler(event: Dictionary):
469 490
 				elif (event['background'] != ''):
470 491
 					background.texture = load(event['background'])
471 492
 			_load_next_event()
472
-		{'audio'}, {'audio', 'file'}:
493
+		{'audio'}, {'audio', 'file', ..}:
473 494
 			emit_signal("event_start", "audio", event)
474 495
 			if event['audio'] == 'play' and 'file' in event.keys() and not event['file'].empty():
475 496
 				var audio = get_node_or_null('AudioEvent')
@@ -477,21 +498,25 @@ func event_handler(event: Dictionary):
477 498
 					audio = AudioStreamPlayer.new()
478 499
 					audio.name = 'AudioEvent'
479 500
 					add_child(audio)
501
+				if event.has('audio_bus'):
502
+					if AudioServer.get_bus_index(event['audio_bus']) >= 0:
503
+						audio.bus = event['audio_bus']
504
+				if event.has('volume'):
505
+					audio.volume_db = event['volume']
480 506
 				audio.stream = load(event['file'])
481 507
 				audio.play()
482
-				print('play')
483 508
 			else:
484 509
 				var audio = get_node_or_null('AudioEvent')
485 510
 				if audio != null:
486 511
 					audio.stop()
487 512
 					audio.queue_free()
488 513
 			_load_next_event()
489
-		{'background-music'}, {'background-music', 'file'}:
514
+		{'background-music'}, {'background-music', 'file',..}:
490 515
 			emit_signal("event_start", "background-music", event)
491 516
 			if event['background-music'] == 'play' and 'file' in event.keys() and not event['file'].empty():
492
-				$FX/BackgroundMusic.crossfade_to(event['file'])
517
+				$FX/BackgroundMusic.crossfade_to(event['file'], event.get('audio_bus', 'Master'), event.get('volume', 0), event.get('fade_length', 1))
493 518
 			else:
494
-				$FX/BackgroundMusic.fade_out()
519
+				$FX/BackgroundMusic.fade_out(event.get('fade_length', 1))
495 520
 			_load_next_event()
496 521
 		{'endbranch', ..}:
497 522
 			emit_signal("event_start", "endbranch", event)
@@ -502,9 +527,12 @@ func event_handler(event: Dictionary):
502 527
 			dprint('[!] Emitting signal: dialogic_signal(', event['emit_signal'], ')')
503 528
 			emit_signal("dialogic_signal", event['emit_signal'])
504 529
 			_load_next_event()
505
-		{'close_dialog'}:
530
+		{'close_dialog', ..}:
506 531
 			emit_signal("event_start", "close_dialog", event)
507
-			close_dialog_event()
532
+			var transition_duration = 1.0
533
+			if event.has('transition_duration'):
534
+				transition_duration = event['transition_duration']
535
+			close_dialog_event(transition_duration)
508 536
 		{'set_theme'}:
509 537
 			emit_signal("event_start", "set_theme", event)
510 538
 			if event['set_theme'] != '':
@@ -569,7 +597,7 @@ func event_handler(event: Dictionary):
569 597
 			_load_next_event()
570 598
 		_:
571 599
 			visible = false
572
-			dprint('Other event. ', event)
600
+			dprint('[D] Other event. ', event)
573 601
 	
574 602
 	$Options.visible = waiting_for_answer
575 603
 
@@ -580,7 +608,21 @@ func reset_options():
580 608
 		option.queue_free()
581 609
 
582 610
 
583
-func add_choice_button(option):
611
+func _should_add_choice_button(option: Dictionary):
612
+	if not option['condition'].empty() and not option['definition'].empty() and not option['value'].empty():
613
+		var def_value = null
614
+		for d in definitions['variables']:
615
+			if d['id'] == option['definition']:
616
+				def_value = d['value']
617
+		return def_value != null and _compare_definitions(def_value, option['value'], option['condition']);
618
+	else:
619
+		return true
620
+
621
+
622
+func add_choice_button(option: Dictionary):
623
+	if not _should_add_choice_button(option):
624
+		return
625
+	
584 626
 	var theme = current_theme
585 627
 
586 628
 	var button = ChoiceButton.instance()
@@ -593,6 +635,11 @@ func add_choice_button(option):
593 635
 		button.set('custom_colors/font_color', text_color)
594 636
 		button.set('custom_colors/font_color_hover', text_color)
595 637
 		button.set('custom_colors/font_color_pressed', text_color)
638
+		
639
+		if theme.get_value('buttons', 'fixed', false):
640
+			var size = theme.get_value('buttons', 'fixed_size', Vector2(130,40))
641
+			button.rect_min_size = size
642
+			button.rect_size = size
596 643
 
597 644
 		if theme.get_value('buttons', 'text_color_enabled', true):
598 645
 			var button_text_color = Color(theme.get_value('buttons', 'text_color', "#ffffffff"))
@@ -729,7 +776,7 @@ func _on_RichTextLabel_meta_hover_started(meta):
729 776
 				'color': current_theme.get_value('definitions', 'color', '#ffbebebe'),
730 777
 			})
731 778
 			correct_type = true
732
-			dprint(d)
779
+			dprint('[D] Hovered over glossary entry: ', d)
733 780
 
734 781
 	if correct_type:
735 782
 		definition_visible = true
@@ -740,7 +787,6 @@ func _on_RichTextLabel_meta_hover_started(meta):
740 787
 
741 788
 func _on_RichTextLabel_meta_hover_ended(meta):
742 789
 	# Adding a timer to avoid a graphical glitch
743
-
744 790
 	$DefinitionInfo/Timer.start(0.1)
745 791
 
746 792
 
@@ -752,18 +798,17 @@ func _on_Definition_Timer_timeout():
752 798
 
753 799
 func wait_seconds(seconds):
754 800
 	var timer = Timer.new()
755
-	timer.name = 'WaitSeconds'
756 801
 	add_child(timer)
757
-	timer.connect("timeout", self, '_on_WaitSeconds_timeout')
802
+	timer.connect("timeout", self, '_on_WaitSeconds_timeout', [timer])
758 803
 	timer.start(seconds)
759 804
 	$TextBubble.visible = false
760 805
 
761 806
 
762
-func _on_WaitSeconds_timeout():
807
+func _on_WaitSeconds_timeout(timer):
763 808
 	emit_signal("event_end", "wait")
764 809
 	waiting = false
765
-	$WaitSeconds.stop()
766
-	$WaitSeconds.queue_free()
810
+	timer.stop()
811
+	timer.queue_free()
767 812
 	$TextBubble.visible = true
768 813
 	_load_next_event()
769 814
 
@@ -811,18 +856,21 @@ func characters_leave_all():
811 856
 			p.fade_out()
812 857
 
813 858
 
814
-func close_dialog_event():
815
-	var tween = Tween.new()
816
-	add_child(tween)
817
-	tween.interpolate_property($TextBubble, "modulate",
818
-		$TextBubble.modulate, Color('#00ffffff'), 1,
819
-		Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
820
-	tween.start()
821
-	var close_dialog_timer = Timer.new()
822
-	close_dialog_timer.connect("timeout", self, '_on_close_dialog_timeout')
823
-	add_child(close_dialog_timer)
824
-	close_dialog_timer.start(2)
859
+func close_dialog_event(transition_duration):
825 860
 	characters_leave_all()
861
+	if transition_duration == 0:
862
+		_on_close_dialog_timeout()
863
+	else:
864
+		var tween = Tween.new()
865
+		add_child(tween)
866
+		tween.interpolate_property($TextBubble, "modulate",
867
+			$TextBubble.modulate, Color('#00ffffff'), transition_duration,
868
+			Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
869
+		tween.start()
870
+		var close_dialog_timer = Timer.new()
871
+		close_dialog_timer.connect("timeout", self, '_on_close_dialog_timeout')
872
+		add_child(close_dialog_timer)
873
+		close_dialog_timer.start(transition_duration)
826 874
 
827 875
 
828 876
 func _on_close_dialog_timeout():

+ 77
- 0
addons/dialogic/Other/DialogicSharp.cs View File

@@ -0,0 +1,77 @@
1
+using Godot;
2
+using GC = Godot.Collections;
3
+using System;
4
+
5
+public static class DialogicSharp
6
+{
7
+  private static Script _dialogic = GD.Load<Script>("res://addons/dialogic/Other/DialogicClass.gd");
8
+  private const String DEFAULT_DIALOG_RESOURCE = "res://addons/dialogic/Dialog.tscn";
9
+
10
+  public static String CurrentTimeline
11
+  {
12
+    get
13
+    {
14
+      return (String)_dialogic.Call("get_current_timeline");
15
+    }
16
+    set
17
+    {
18
+      _dialogic.Call("set_current_timeline", value);
19
+    }
20
+  }
21
+
22
+  public static GC.Dictionary Definitions
23
+  {
24
+    get
25
+    {
26
+      return (GC.Dictionary)_dialogic.Call("get_definitions");
27
+    }
28
+  }
29
+
30
+  public static GC.Dictionary DefaultDefinitions
31
+  {
32
+    get
33
+    {
34
+      return (GC.Dictionary)_dialogic.Call("get_default_definitions");
35
+    }
36
+  }
37
+
38
+  public static Node Start(String timeline, bool resetSaves = true, bool debugMode = false)
39
+  {
40
+    return Start<Node>(timeline, DEFAULT_DIALOG_RESOURCE, resetSaves, debugMode);
41
+  }
42
+
43
+  public static T Start<T>(String timeline, String dialogScenePath, bool resetSaves = true, bool debugMode = false) where T : class
44
+  {
45
+    return (T)_dialogic.Call("start", timeline, resetSaves, dialogScenePath, debugMode);
46
+  }
47
+
48
+  public static Node StartFromSave(String timeline, bool debugMode = false)
49
+  {
50
+    return StartFromSave<Node>(timeline, DEFAULT_DIALOG_RESOURCE, debugMode);
51
+  }
52
+
53
+  public static T StartFromSave<T>(String timeline, String dialogScenePath, bool debugMode = false) where T : class
54
+  {
55
+    return (T)_dialogic.Call("start", timeline, dialogScenePath, debugMode);
56
+  }
57
+
58
+  public static String GetVariable(String name)
59
+  {
60
+    return (String)_dialogic.Call("get_variable", name);
61
+  }
62
+
63
+  public static void SetVariable(String name, String value)
64
+  {
65
+    _dialogic.Call("set_variable", name, value);
66
+  }
67
+
68
+  public static GC.Dictionary GetGlossary(String name)
69
+  {
70
+    return (GC.Dictionary)_dialogic.Call("get_glossary", name);
71
+  }
72
+
73
+  public static void SetGlossary(String name, String title, String text, String extra)
74
+  {
75
+    _dialogic.Call("set_glossary", name, title, text, extra);
76
+  }
77
+}

Loading…
Cancel
Save