Arnaud Vergnet 10 months ago
parent
commit
1cf5125f7d
100 changed files with 7068 additions and 0 deletions
  1. 17
    0
      Main.gd
  2. 6
    0
      Main.tscn
  3. 296
    0
      addons/dialogic/Dialog.tscn
  4. 189
    0
      addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd
  5. 321
    0
      addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn
  6. 47
    0
      addons/dialogic/Editor/CharacterEditor/PortraitEntry.gd
  7. 47
    0
      addons/dialogic/Editor/CharacterEditor/PortraitEntry.tscn
  8. 112
    0
      addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd
  9. 108
    0
      addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.tscn
  10. 172
    0
      addons/dialogic/Editor/EditorView.gd
  11. 302
    0
      addons/dialogic/Editor/EditorView.tscn
  12. 250
    0
      addons/dialogic/Editor/MasterTree/MasterTree.gd
  13. 18
    0
      addons/dialogic/Editor/MasterTree/MasterTree.tscn
  14. 48
    0
      addons/dialogic/Editor/Pieces/AudioBlock.gd
  15. 119
    0
      addons/dialogic/Editor/Pieces/AudioBlock.tscn
  16. 29
    0
      addons/dialogic/Editor/Pieces/ChangeScene.gd
  17. 110
    0
      addons/dialogic/Editor/Pieces/ChangeScene.tscn
  18. 43
    0
      addons/dialogic/Editor/Pieces/ChangeTimeline.gd
  19. 97
    0
      addons/dialogic/Editor/Pieces/ChangeTimeline.tscn
  20. 87
    0
      addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd
  21. 138
    0
      addons/dialogic/Editor/Pieces/CharacterJoinBlock.tscn
  22. 42
    0
      addons/dialogic/Editor/Pieces/CharacterLeaveBlock.gd
  23. 105
    0
      addons/dialogic/Editor/Pieces/CharacterLeaveBlock.tscn
  24. 30
    0
      addons/dialogic/Editor/Pieces/Choice.gd
  25. 115
    0
      addons/dialogic/Editor/Pieces/Choice.tscn
  26. 18
    0
      addons/dialogic/Editor/Pieces/CloseDialog.gd
  27. 89
    0
      addons/dialogic/Editor/Pieces/CloseDialog.tscn
  28. 46
    0
      addons/dialogic/Editor/Pieces/Common/CharacterPicker.gd
  29. 31
    0
      addons/dialogic/Editor/Pieces/Common/CharacterPicker.tscn
  30. 30
    0
      addons/dialogic/Editor/Pieces/Common/CustomLineEdit.tscn
  31. 36
    0
      addons/dialogic/Editor/Pieces/Common/DefinitionPicker.gd
  32. 23
    0
      addons/dialogic/Editor/Pieces/Common/DefinitionPicker.tscn
  33. 27
    0
      addons/dialogic/Editor/Pieces/Common/DragController.gd
  34. 10
    0
      addons/dialogic/Editor/Pieces/Common/DragController.tscn
  35. 25
    0
      addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.gd
  36. 18
    0
      addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn
  37. 44
    0
      addons/dialogic/Editor/Pieces/Common/PortraitPicker.gd
  38. 15
    0
      addons/dialogic/Editor/Pieces/Common/PortraitPicker.tscn
  39. 44
    0
      addons/dialogic/Editor/Pieces/Common/VisibleToggle.gd
  40. 17
    0
      addons/dialogic/Editor/Pieces/Common/VisibleToggle.tscn
  41. 20
    0
      addons/dialogic/Editor/Pieces/EmitSignal.gd
  42. 121
    0
      addons/dialogic/Editor/Pieces/EmitSignal.tscn
  43. 14
    0
      addons/dialogic/Editor/Pieces/EndBranch.gd
  44. 92
    0
      addons/dialogic/Editor/Pieces/EndBranch.tscn
  45. 36
    0
      addons/dialogic/Editor/Pieces/IfCondition.gd
  46. 103
    0
      addons/dialogic/Editor/Pieces/IfCondition.tscn
  47. 21
    0
      addons/dialogic/Editor/Pieces/Question.gd
  48. 104
    0
      addons/dialogic/Editor/Pieces/Question.tscn
  49. 51
    0
      addons/dialogic/Editor/Pieces/SceneEvent.gd
  50. 137
    0
      addons/dialogic/Editor/Pieces/SceneEvent.tscn
  51. 43
    0
      addons/dialogic/Editor/Pieces/SetTheme.gd
  52. 97
    0
      addons/dialogic/Editor/Pieces/SetTheme.tscn
  53. 34
    0
      addons/dialogic/Editor/Pieces/SetValue.gd
  54. 134
    0
      addons/dialogic/Editor/Pieces/SetValue.tscn
  55. 100
    0
      addons/dialogic/Editor/Pieces/TextBlock.gd
  56. 135
    0
      addons/dialogic/Editor/Pieces/TextBlock.tscn
  57. 18
    0
      addons/dialogic/Editor/Pieces/WaitSeconds.gd
  58. 110
    0
      addons/dialogic/Editor/Pieces/WaitSeconds.tscn
  59. 79
    0
      addons/dialogic/Editor/SettingsEditor/SettingsEditor.gd
  60. 143
    0
      addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn
  61. 319
    0
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd
  62. 696
    0
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn
  63. 11
    0
      addons/dialogic/Editor/ThemeEditor/default-theme.cfg
  64. 245
    0
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd
  65. 333
    0
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn
  66. 8
    0
      addons/dialogic/Fonts/DefaultFont.tres
  67. 8
    0
      addons/dialogic/Fonts/GlossaryFont.tres
  68. 94
    0
      addons/dialogic/Fonts/Overlock/OFL.txt
  69. BIN
      addons/dialogic/Fonts/Overlock/Overlock-Black.ttf
  70. BIN
      addons/dialogic/Fonts/Overlock/Overlock-BlackItalic.ttf
  71. BIN
      addons/dialogic/Fonts/Overlock/Overlock-Bold.ttf
  72. BIN
      addons/dialogic/Fonts/Overlock/Overlock-BoldItalic.ttf
  73. BIN
      addons/dialogic/Fonts/Overlock/Overlock-Italic.ttf
  74. BIN
      addons/dialogic/Fonts/Overlock/Overlock-Regular.ttf
  75. 7
    0
      addons/dialogic/Fonts/Overlock/Overlock.tres
  76. 1
    0
      addons/dialogic/Images/ActionCopy.svg
  77. 34
    0
      addons/dialogic/Images/ActionCopy.svg.import
  78. 1
    0
      addons/dialogic/Images/Add.svg
  79. 34
    0
      addons/dialogic/Images/Add.svg.import
  80. 3
    0
      addons/dialogic/Images/Events/set-value.svg
  81. 34
    0
      addons/dialogic/Images/Events/set-value.svg.import
  82. 1
    0
      addons/dialogic/Images/Filesystem.svg
  83. 34
    0
      addons/dialogic/Images/Filesystem.svg.import
  84. 1
    0
      addons/dialogic/Images/Folder.svg
  85. 34
    0
      addons/dialogic/Images/Folder.svg.import
  86. 1
    0
      addons/dialogic/Images/ListSelect.svg
  87. 34
    0
      addons/dialogic/Images/ListSelect.svg.import
  88. 3
    0
      addons/dialogic/Images/Portrait.svg
  89. 34
    0
      addons/dialogic/Images/Portrait.svg.import
  90. 1
    0
      addons/dialogic/Images/Remove.svg
  91. 34
    0
      addons/dialogic/Images/Remove.svg.import
  92. 1
    0
      addons/dialogic/Images/Rename.svg
  93. 34
    0
      addons/dialogic/Images/Rename.svg.import
  94. 4
    0
      addons/dialogic/Images/Script.svg
  95. 34
    0
      addons/dialogic/Images/Script.svg.import
  96. 5
    0
      addons/dialogic/Images/Toolbar/add-character.svg
  97. 34
    0
      addons/dialogic/Images/Toolbar/add-character.svg.import
  98. 4
    0
      addons/dialogic/Images/Toolbar/add-definition.svg
  99. 34
    0
      addons/dialogic/Images/Toolbar/add-definition.svg.import
  100. 0
    0
      addons/dialogic/Images/Toolbar/add-theme.svg

+ 17
- 0
Main.gd View File

@@ -0,0 +1,17 @@
1
+extends Node
2
+
3
+
4
+# Declare member variables here. Examples:
5
+# var a = 2
6
+# var b = "text"
7
+
8
+
9
+# Called when the node enters the scene tree for the first time.
10
+func _ready():
11
+	var new_dialog = Dialogic.start('timeline1')
12
+	add_child(new_dialog)
13
+
14
+
15
+# Called every frame. 'delta' is the elapsed time since the previous frame.
16
+#func _process(delta):
17
+#	pass

+ 6
- 0
Main.tscn View File

@@ -0,0 +1,6 @@
1
+[gd_scene load_steps=2 format=2]
2
+
3
+[ext_resource path="res://Main.gd" type="Script" id=1]
4
+
5
+[node name="Main" type="Node"]
6
+script = ExtResource( 1 )

+ 296
- 0
addons/dialogic/Dialog.tscn View File

@@ -0,0 +1,296 @@
1
+[gd_scene load_steps=10 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Images/next-indicator.png" type="Texture" id=1]
4
+[ext_resource path="res://addons/dialogic/Images/background/background-2.png" type="Texture" id=2]
5
+[ext_resource path="res://addons/dialogic/Fonts/DefaultFont.tres" type="DynamicFont" id=3]
6
+[ext_resource path="res://addons/dialogic/Fonts/GlossaryFont.tres" type="DynamicFont" id=4]
7
+[ext_resource path="res://addons/dialogic/Nodes/glossary_info.gd" type="Script" id=5]
8
+[ext_resource path="res://addons/dialogic/Nodes/dialog_node.gd" type="Script" id=6]
9
+
10
+[sub_resource type="StyleBoxFlat" id=1]
11
+bg_color = Color( 1, 1, 1, 0 )
12
+
13
+[sub_resource type="Animation" id=2]
14
+loop = true
15
+tracks/0/type = "value"
16
+tracks/0/path = NodePath(".:margin_bottom")
17
+tracks/0/interp = 2
18
+tracks/0/loop_wrap = true
19
+tracks/0/imported = false
20
+tracks/0/enabled = true
21
+tracks/0/keys = {
22
+"times": PoolRealArray( 0, 0.5 ),
23
+"transitions": PoolRealArray( 1, 1 ),
24
+"update": 0,
25
+"values": [ 12.0, 55.0 ]
26
+}
27
+
28
+[sub_resource type="StyleBoxFlat" id=3]
29
+bg_color = Color( 0.196078, 0.196078, 0.196078, 0 )
30
+
31
+[node name="DialogNode" type="Control"]
32
+anchor_right = 1.0
33
+anchor_bottom = 1.0
34
+script = ExtResource( 6 )
35
+__meta__ = {
36
+"_edit_use_anchors_": false
37
+}
38
+
39
+[node name="Background" type="TextureRect" parent="."]
40
+visible = false
41
+anchor_right = 1.0
42
+anchor_bottom = 1.0
43
+expand = true
44
+stretch_mode = 1
45
+__meta__ = {
46
+"_edit_use_anchors_": false
47
+}
48
+
49
+[node name="Portraits" type="Control" parent="."]
50
+anchor_left = 0.5
51
+anchor_top = 1.0
52
+anchor_right = 0.5
53
+anchor_bottom = 1.0
54
+__meta__ = {
55
+"_edit_use_anchors_": false
56
+}
57
+
58
+[node name="TextBubble" type="Control" parent="."]
59
+anchor_left = 0.5
60
+anchor_top = 1.0
61
+anchor_right = 0.5
62
+anchor_bottom = 1.0
63
+margin_left = -455.0
64
+margin_top = -207.0
65
+margin_right = 455.0
66
+margin_bottom = -40.0
67
+__meta__ = {
68
+"_edit_group_": true,
69
+"_edit_use_anchors_": false
70
+}
71
+
72
+[node name="ColorRect" type="ColorRect" parent="TextBubble"]
73
+visible = false
74
+anchor_right = 1.0
75
+anchor_bottom = 1.0
76
+color = Color( 0, 0, 0, 1 )
77
+__meta__ = {
78
+"_edit_use_anchors_": false
79
+}
80
+
81
+[node name="TextureRect" type="TextureRect" parent="TextBubble"]
82
+anchor_right = 1.0
83
+anchor_bottom = 1.0
84
+texture = ExtResource( 2 )
85
+expand = true
86
+stretch_mode = 1
87
+__meta__ = {
88
+"_edit_use_anchors_": false
89
+}
90
+
91
+[node name="RichTextLabel" type="RichTextLabel" parent="TextBubble"]
92
+anchor_right = 1.0
93
+anchor_bottom = 1.0
94
+margin_left = 20.0
95
+margin_top = 10.0
96
+margin_right = -20.0
97
+margin_bottom = -10.0
98
+rect_clip_content = false
99
+custom_styles/normal = SubResource( 1 )
100
+custom_fonts/normal_font = ExtResource( 3 )
101
+custom_colors/default_color = Color( 0.756863, 0.172549, 0.172549, 1 )
102
+custom_colors/font_color_shadow = Color( 0, 0, 0, 0.619608 )
103
+custom_constants/shadow_offset_x = 2
104
+custom_constants/shadow_offset_y = 2
105
+bbcode_enabled = true
106
+bbcode_text = "Placeholder text for testing and formatting."
107
+meta_underlined = false
108
+text = "Placeholder text for testing and formatting."
109
+__meta__ = {
110
+"_edit_use_anchors_": false
111
+}
112
+
113
+[node name="Tween" type="Tween" parent="TextBubble"]
114
+
115
+[node name="NextIndicator" type="TextureRect" parent="TextBubble"]
116
+visible = false
117
+anchor_left = 1.0
118
+anchor_top = 1.0
119
+anchor_right = 1.0
120
+anchor_bottom = 1.0
121
+margin_left = -36.4279
122
+margin_top = -35.9016
123
+margin_right = 14.5721
124
+margin_bottom = 12.0
125
+rect_scale = Vector2( 0.4, 0.4 )
126
+texture = ExtResource( 1 )
127
+stretch_mode = 4
128
+__meta__ = {
129
+"_edit_use_anchors_": false
130
+}
131
+
132
+[node name="AnimationPlayer" type="AnimationPlayer" parent="TextBubble/NextIndicator"]
133
+autoplay = "IDLE"
134
+anims/IDLE = SubResource( 2 )
135
+
136
+[node name="NameLabel" type="RichTextLabel" parent="TextBubble"]
137
+margin_left = 2.0
138
+margin_top = -37.0
139
+margin_right = 369.0
140
+rect_clip_content = false
141
+custom_styles/normal = SubResource( 1 )
142
+custom_fonts/normal_font = ExtResource( 3 )
143
+custom_colors/default_color = Color( 0.756863, 0.172549, 0.172549, 1 )
144
+custom_colors/font_color_shadow = Color( 0, 0, 0, 0.619608 )
145
+custom_constants/shadow_offset_x = 2
146
+custom_constants/shadow_offset_y = 2
147
+custom_constants/shadow_as_outline = 10
148
+bbcode_enabled = true
149
+bbcode_text = "Name Here"
150
+text = "Name Here"
151
+scroll_active = false
152
+__meta__ = {
153
+"_edit_use_anchors_": false
154
+}
155
+
156
+[node name="Options" type="VBoxContainer" parent="."]
157
+anchor_left = 0.5
158
+anchor_top = 0.5
159
+anchor_right = 0.5
160
+anchor_bottom = 0.5
161
+margin_left = -20.0
162
+margin_top = -19.9999
163
+margin_right = 20.0
164
+margin_bottom = 19.9999
165
+grow_horizontal = 2
166
+grow_vertical = 2
167
+__meta__ = {
168
+"_edit_use_anchors_": false
169
+}
170
+
171
+[node name="TextInputDialog" type="AcceptDialog" parent="."]
172
+anchor_left = 0.5
173
+anchor_top = 0.5
174
+anchor_right = 0.5
175
+anchor_bottom = 0.5
176
+margin_left = -192.0
177
+margin_top = -57.0
178
+margin_right = 192.0
179
+margin_bottom = 57.0
180
+popup_exclusive = true
181
+dialog_hide_on_ok = false
182
+__meta__ = {
183
+"_edit_use_anchors_": false
184
+}
185
+
186
+[node name="LineEdit" type="LineEdit" parent="TextInputDialog"]
187
+margin_left = 8.0
188
+margin_top = 8.0
189
+margin_right = 376.0
190
+margin_bottom = 78.0
191
+
192
+[node name="FX" type="Control" parent="."]
193
+anchor_right = 1.0
194
+anchor_bottom = 1.0
195
+mouse_filter = 2
196
+__meta__ = {
197
+"_edit_group_": true,
198
+"_edit_lock_": true,
199
+"_edit_use_anchors_": false
200
+}
201
+
202
+[node name="FadeInNode" type="ColorRect" parent="FX"]
203
+modulate = Color( 1, 1, 1, 0 )
204
+anchor_right = 1.0
205
+anchor_bottom = 1.0
206
+mouse_filter = 2
207
+color = Color( 0, 0, 0, 1 )
208
+__meta__ = {
209
+"_edit_use_anchors_": false
210
+}
211
+
212
+[node name="Tween" type="Tween" parent="FX/FadeInNode"]
213
+
214
+[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="FX"]
215
+
216
+[node name="DefinitionInfo" type="PanelContainer" parent="."]
217
+visible = false
218
+margin_right = 208.0
219
+mouse_filter = 1
220
+size_flags_horizontal = 3
221
+size_flags_vertical = 3
222
+custom_styles/panel = SubResource( 3 )
223
+script = ExtResource( 5 )
224
+__meta__ = {
225
+"_edit_group_": true,
226
+"_edit_use_anchors_": false
227
+}
228
+
229
+[node name="ColorRect" type="ColorRect" parent="DefinitionInfo"]
230
+mouse_filter = 1
231
+size_flags_horizontal = 0
232
+size_flags_vertical = 0
233
+color = Color( 0.12549, 0.12549, 0.12549, 1 )
234
+__meta__ = {
235
+"_edit_use_anchors_": false
236
+}
237
+
238
+[node name="VBoxContainer" type="VBoxContainer" parent="DefinitionInfo"]
239
+margin_right = 208.0
240
+margin_bottom = 143.0
241
+size_flags_horizontal = 3
242
+size_flags_vertical = 2
243
+__meta__ = {
244
+"_edit_use_anchors_": false
245
+}
246
+
247
+[node name="Title" type="RichTextLabel" parent="DefinitionInfo/VBoxContainer"]
248
+margin_right = 208.0
249
+margin_bottom = 27.0
250
+size_flags_horizontal = 3
251
+size_flags_vertical = 4
252
+custom_styles/normal = SubResource( 1 )
253
+custom_fonts/normal_font = ExtResource( 4 )
254
+bbcode_text = "This is the title"
255
+text = "This is the title"
256
+fit_content_height = true
257
+scroll_active = false
258
+
259
+[node name="Content" type="RichTextLabel" parent="DefinitionInfo/VBoxContainer"]
260
+margin_top = 31.0
261
+margin_right = 208.0
262
+margin_bottom = 112.0
263
+size_flags_horizontal = 3
264
+custom_styles/normal = SubResource( 1 )
265
+custom_fonts/normal_font = ExtResource( 4 )
266
+text = "This is the main copy. Here you write the relevant"
267
+fit_content_height = true
268
+scroll_active = false
269
+__meta__ = {
270
+"_edit_use_anchors_": false
271
+}
272
+
273
+[node name="Extra" type="RichTextLabel" parent="DefinitionInfo/VBoxContainer"]
274
+self_modulate = Color( 1, 1, 1, 0.345098 )
275
+margin_top = 116.0
276
+margin_right = 208.0
277
+margin_bottom = 143.0
278
+size_flags_horizontal = 3
279
+custom_styles/normal = SubResource( 1 )
280
+custom_fonts/normal_font = ExtResource( 4 )
281
+text = "Una linea extra"
282
+fit_content_height = true
283
+scroll_active = false
284
+__meta__ = {
285
+"_edit_use_anchors_": false
286
+}
287
+
288
+[node name="Timer" type="Timer" parent="DefinitionInfo"]
289
+
290
+[node name="WaitSeconds" type="Timer" parent="."]
291
+
292
+[connection signal="meta_hover_ended" from="TextBubble/RichTextLabel" to="." method="_on_RichTextLabel_meta_hover_ended"]
293
+[connection signal="meta_hover_started" from="TextBubble/RichTextLabel" to="." method="_on_RichTextLabel_meta_hover_started"]
294
+[connection signal="tween_completed" from="TextBubble/Tween" to="." method="_on_Tween_tween_completed"]
295
+[connection signal="timeout" from="DefinitionInfo/Timer" to="." method="_on_Definition_Timer_timeout"]
296
+[connection signal="timeout" from="WaitSeconds" to="." method="_on_WaitSeconds_timeout"]

+ 189
- 0
addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd View File

@@ -0,0 +1,189 @@
1
+tool
2
+extends ScrollContainer
3
+
4
+var editor_reference
5
+onready var master_tree = get_node('../MasterTree')
6
+var opened_character_data
7
+var portrait_entry = load("res://addons/dialogic/Editor/CharacterEditor/PortraitEntry.tscn")
8
+onready var nodes = {
9
+	'editor': $HBoxContainer/Container,
10
+	'name': $HBoxContainer/Container/Name/LineEdit,
11
+	'description': $HBoxContainer/Container/Description/TextEdit,
12
+	'file': $HBoxContainer/Container/FileName/LineEdit,
13
+	'color': $HBoxContainer/Container/Color/ColorPickerButton,
14
+	'default_speaker': $HBoxContainer/Container/Actions/DefaultSpeaker,
15
+	'display_name_checkbox': $HBoxContainer/Container/Name/CheckBox,
16
+	'display_name': $HBoxContainer/Container/DisplayName/LineEdit,
17
+	'new_portrait_button': $HBoxContainer/Container/ScrollContainer/VBoxContainer/HBoxContainer/Button,
18
+	'portrait_preview': $HBoxContainer/VBoxContainer/Control/TextureRect,
19
+	'scale': $HBoxContainer/VBoxContainer/HBoxContainer/Scale,
20
+	'offset_x': $HBoxContainer/VBoxContainer/HBoxContainer/OffsetX,
21
+	'offset_y': $HBoxContainer/VBoxContainer/HBoxContainer/OffsetY,
22
+}
23
+
24
+
25
+func _ready():
26
+	nodes['new_portrait_button'].connect('pressed', self, '_on_New_Portrait_Button_pressed')
27
+	nodes['display_name_checkbox'].connect('toggled', self, '_on_display_name_toggled')
28
+	nodes['name'].connect('text_changed', self, '_on_name_changed')
29
+	nodes['color'].connect('color_changed', self, '_on_color_changed')
30
+
31
+
32
+func _on_display_name_toggled(button_pressed):
33
+	$HBoxContainer/Container/DisplayName.visible = button_pressed
34
+
35
+
36
+func _on_name_changed(value):
37
+	var item = master_tree.get_selected()
38
+	item.set_text(0, value)
39
+
40
+
41
+func _on_color_changed(color):
42
+	var item = master_tree.get_selected()
43
+	item.set_icon_modulate(0, color)
44
+
45
+
46
+func clear_character_editor():
47
+	nodes['file'].text = ''
48
+	nodes['name'].text = ''
49
+	nodes['description'].text = ''
50
+	nodes['color'].color = Color('#ffffff')
51
+	nodes['default_speaker'].pressed = false
52
+	nodes['display_name_checkbox'].pressed = false
53
+	nodes['display_name'].text = ''
54
+	nodes['portraits'] = []
55
+	nodes['scale'].value = 100
56
+	nodes['offset_x'].value = 0
57
+	nodes['offset_y'].value = 0
58
+
59
+	# Clearing portraits
60
+	for p in $HBoxContainer/Container/ScrollContainer/VBoxContainer/PortraitList.get_children():
61
+		p.queue_free()
62
+	nodes['portrait_preview'].texture = null
63
+
64
+
65
+# Character Creation
66
+func create_character():
67
+	var character_file = 'character-' + str(OS.get_unix_time()) + '.json'
68
+	var character = {
69
+		'color': '#ffffff',
70
+		'id': character_file,
71
+		'default_speaker': false,
72
+		'portraits': []
73
+	}
74
+	var directory = Directory.new()
75
+	if not directory.dir_exists(DialogicUtil.get_path('WORKING_DIR')):
76
+		directory.make_dir(DialogicUtil.get_path('WORKING_DIR'))
77
+	if not directory.dir_exists(DialogicUtil.get_path('CHAR_DIR')):
78
+		directory.make_dir(DialogicUtil.get_path('CHAR_DIR'))
79
+	var file = File.new()
80
+	file.open(DialogicUtil.get_path('CHAR_DIR', character_file), File.WRITE)
81
+	file.store_line(to_json(character))
82
+	file.close()
83
+	character['metadata'] = {'file': character_file}
84
+	return character
85
+
86
+
87
+func new_character():
88
+	# This event creates and selects the new timeline
89
+	master_tree.add_character(create_character()['metadata'], true)
90
+
91
+
92
+# Saving and Loading
93
+func generate_character_data_to_save():
94
+	var default_speaker: bool = nodes['default_speaker'].pressed
95
+	var portraits = []
96
+	for p in $HBoxContainer/Container/ScrollContainer/VBoxContainer/PortraitList.get_children():
97
+		var entry = {}
98
+		entry['name'] = p.get_node("NameEdit").text
99
+		entry['path'] = p.get_node("PathEdit").text
100
+		portraits.append(entry)
101
+	var info_to_save = {
102
+		'id': nodes['file'].text,
103
+		'description': nodes['description'].text,
104
+		'color': '#' + nodes['color'].color.to_html(),
105
+		'default_speaker': default_speaker,
106
+		'portraits': portraits,
107
+		'display_name_bool': nodes['display_name_checkbox'].pressed,
108
+		'display_name': nodes['display_name'].text,
109
+		'scale': nodes['scale'].value,
110
+		'offset_x': nodes['offset_x'].value,
111
+		'offset_y': nodes['offset_y'].value,
112
+	}
113
+	# Adding name later for cases when no name is provided
114
+	if nodes['name'].text != '':
115
+		info_to_save['name'] = nodes['name'].text
116
+	
117
+	return info_to_save
118
+
119
+
120
+func save_character():
121
+	var path = DialogicUtil.get_path('CHAR_DIR', nodes['file'].text)
122
+	var info_to_save = generate_character_data_to_save()
123
+	if info_to_save['id']:
124
+		var file = File.new()
125
+		file.open(path, File.WRITE)
126
+		file.store_line(to_json(info_to_save))
127
+		file.close()
128
+		opened_character_data = info_to_save
129
+
130
+
131
+func load_character(path):
132
+	var data = DialogicUtil.load_json(path)
133
+	clear_character_editor()
134
+	opened_character_data = data
135
+	nodes['file'].text = data['id']
136
+	nodes['default_speaker'].pressed = false
137
+	if data.has('name'):
138
+		nodes['name'].text = data['name']
139
+	if data.has('description'):
140
+		nodes['description'].text = data['description']
141
+	if data.has('color'):
142
+		nodes['color'].color = Color(data['color'])
143
+	if data.has('default_speaker'):
144
+		if data['default_speaker']:
145
+			nodes['default_speaker'].pressed = true
146
+	
147
+	if data.has('display_name_bool'):
148
+		nodes['display_name_checkbox'].pressed = data['display_name_bool']
149
+	if data.has('display_name'):
150
+		nodes['display_name'].text = data['display_name']
151
+	if data.has('scale'):
152
+		nodes['scale'].value = float(data['scale'])
153
+	
154
+	if data.has('offset_x'):
155
+		nodes['offset_x'].value = data['offset_x']
156
+		nodes['offset_y'].value = data['offset_y']
157
+
158
+	# Portraits
159
+	var default_portrait = create_portrait_entry()
160
+	default_portrait.get_node('NameEdit').text = 'Default'
161
+	default_portrait.get_node('NameEdit').editable = false
162
+	if data.has('portraits'):
163
+		for p in data['portraits']:
164
+			if p['name'] == 'Default':
165
+				default_portrait.get_node('PathEdit').text = p['path']
166
+				default_portrait.update_preview(p['path'])
167
+			else:
168
+				create_portrait_entry(p['name'], p['path'])
169
+
170
+
171
+# Portraits
172
+func _on_New_Portrait_Button_pressed():
173
+	create_portrait_entry('', '', true)
174
+
175
+
176
+func create_portrait_entry(p_name = '', path = '', grab_focus = false):
177
+	var p = portrait_entry.instance()
178
+	p.editor_reference = editor_reference
179
+	p.image_node = nodes['portrait_preview']
180
+	var p_list = $HBoxContainer/Container/ScrollContainer/VBoxContainer/PortraitList
181
+	p_list.add_child(p)
182
+	if p_name != '':
183
+		p.get_node("NameEdit").text = p_name
184
+	if path != '':
185
+		p.get_node("PathEdit").text = path
186
+	if grab_focus:
187
+		p.get_node("NameEdit").grab_focus()
188
+		p._on_ButtonSelect_pressed()
189
+	return p

+ 321
- 0
addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn View File

@@ -0,0 +1,321 @@
1
+[gd_scene load_steps=4 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/CharacterEditor/PortraitEntry.tscn" type="PackedScene" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd" type="Script" id=2]
5
+
6
+[sub_resource type="StyleBoxFlat" id=1]
7
+content_margin_left = 5.0
8
+content_margin_right = 5.0
9
+content_margin_top = 5.0
10
+content_margin_bottom = 5.0
11
+bg_color = Color( 0.2, 0.219608, 0.278431, 1 )
12
+border_width_left = 1
13
+border_width_top = 1
14
+border_width_right = 1
15
+border_width_bottom = 1
16
+border_color = Color( 0.0980392, 0.113725, 0.152941, 1 )
17
+
18
+[node name="CharacterEditor" type="ScrollContainer"]
19
+margin_left = 192.0
20
+margin_right = 1253.0
21
+margin_bottom = 661.0
22
+custom_styles/bg = SubResource( 1 )
23
+script = ExtResource( 2 )
24
+__meta__ = {
25
+"_edit_use_anchors_": false
26
+}
27
+
28
+[node name="HBoxContainer" type="HBoxContainer" parent="."]
29
+margin_left = 5.0
30
+margin_top = 5.0
31
+margin_right = 1056.0
32
+margin_bottom = 656.0
33
+size_flags_horizontal = 3
34
+size_flags_vertical = 3
35
+
36
+[node name="Container" type="VBoxContainer" parent="HBoxContainer"]
37
+margin_right = 523.0
38
+margin_bottom = 651.0
39
+grow_horizontal = 2
40
+grow_vertical = 2
41
+size_flags_horizontal = 3
42
+size_flags_vertical = 9
43
+
44
+[node name="Name" type="HBoxContainer" parent="HBoxContainer/Container"]
45
+margin_right = 523.0
46
+margin_bottom = 24.0
47
+
48
+[node name="Label" type="Label" parent="HBoxContainer/Container/Name"]
49
+margin_top = 5.0
50
+margin_right = 130.0
51
+margin_bottom = 19.0
52
+rect_min_size = Vector2( 130, 0 )
53
+text = "Name: "
54
+
55
+[node name="LineEdit" type="LineEdit" parent="HBoxContainer/Container/Name"]
56
+margin_left = 134.0
57
+margin_right = 274.0
58
+margin_bottom = 24.0
59
+rect_min_size = Vector2( 140, 0 )
60
+
61
+[node name="CheckBox" type="CheckBox" parent="HBoxContainer/Container/Name"]
62
+margin_left = 278.0
63
+margin_right = 451.0
64
+margin_bottom = 24.0
65
+text = "Different display name"
66
+__meta__ = {
67
+"_edit_use_anchors_": false
68
+}
69
+
70
+[node name="DisplayName" type="HBoxContainer" parent="HBoxContainer/Container"]
71
+visible = false
72
+margin_top = 28.0
73
+margin_right = 491.0
74
+margin_bottom = 52.0
75
+__meta__ = {
76
+"_editor_description_": "Display name is the name that will
77
+show up on the dialogs in game."
78
+}
79
+
80
+[node name="Label" type="Label" parent="HBoxContainer/Container/DisplayName"]
81
+margin_top = 5.0
82
+margin_right = 130.0
83
+margin_bottom = 19.0
84
+rect_min_size = Vector2( 130, 0 )
85
+text = "Display Name: "
86
+
87
+[node name="LineEdit" type="LineEdit" parent="HBoxContainer/Container/DisplayName"]
88
+margin_left = 134.0
89
+margin_right = 274.0
90
+margin_bottom = 24.0
91
+rect_min_size = Vector2( 140, 0 )
92
+
93
+[node name="Color" type="HBoxContainer" parent="HBoxContainer/Container"]
94
+margin_top = 28.0
95
+margin_right = 523.0
96
+margin_bottom = 48.0
97
+
98
+[node name="Label" type="Label" parent="HBoxContainer/Container/Color"]
99
+margin_top = 3.0
100
+margin_right = 130.0
101
+margin_bottom = 17.0
102
+rect_min_size = Vector2( 130, 0 )
103
+text = "Color: "
104
+
105
+[node name="ColorPickerButton" type="ColorPickerButton" parent="HBoxContainer/Container/Color"]
106
+margin_left = 134.0
107
+margin_right = 274.0
108
+margin_bottom = 20.0
109
+rect_min_size = Vector2( 140, 0 )
110
+color = Color( 1, 1, 1, 1 )
111
+edit_alpha = false
112
+
113
+[node name="Description" type="HBoxContainer" parent="HBoxContainer/Container"]
114
+margin_top = 52.0
115
+margin_right = 523.0
116
+margin_bottom = 152.0
117
+
118
+[node name="Label" type="Label" parent="HBoxContainer/Container/Description"]
119
+margin_top = 43.0
120
+margin_right = 130.0
121
+margin_bottom = 57.0
122
+rect_min_size = Vector2( 130, 0 )
123
+text = "Description: "
124
+
125
+[node name="TextEdit" type="TextEdit" parent="HBoxContainer/Container/Description"]
126
+margin_left = 134.0
127
+margin_right = 523.0
128
+margin_bottom = 100.0
129
+rect_min_size = Vector2( 100, 100 )
130
+size_flags_horizontal = 3
131
+
132
+[node name="Separator" type="Control" parent="HBoxContainer/Container"]
133
+margin_top = 156.0
134
+margin_right = 523.0
135
+margin_bottom = 166.0
136
+rect_min_size = Vector2( 0, 10 )
137
+
138
+[node name="Portraits" type="HBoxContainer" parent="HBoxContainer/Container"]
139
+margin_top = 170.0
140
+margin_right = 523.0
141
+margin_bottom = 184.0
142
+
143
+[node name="Label" type="Label" parent="HBoxContainer/Container/Portraits"]
144
+margin_right = 143.0
145
+margin_bottom = 14.0
146
+text = "Portraits / Expressions"
147
+
148
+[node name="Labels" type="HBoxContainer" parent="HBoxContainer/Container"]
149
+margin_top = 188.0
150
+margin_right = 523.0
151
+margin_bottom = 202.0
152
+
153
+[node name="LineEdit" type="Label" parent="HBoxContainer/Container/Labels"]
154
+margin_right = 100.0
155
+margin_bottom = 14.0
156
+rect_min_size = Vector2( 100, 0 )
157
+text = "Name"
158
+
159
+[node name="LineEdit2" type="Label" parent="HBoxContainer/Container/Labels"]
160
+margin_left = 104.0
161
+margin_right = 254.0
162
+margin_bottom = 14.0
163
+rect_min_size = Vector2( 150, 0 )
164
+text = "Path"
165
+
166
+[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer/Container"]
167
+margin_top = 206.0
168
+margin_right = 523.0
169
+margin_bottom = 623.0
170
+size_flags_horizontal = 3
171
+size_flags_vertical = 3
172
+
173
+[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/Container/ScrollContainer"]
174
+margin_right = 523.0
175
+margin_bottom = 417.0
176
+size_flags_horizontal = 3
177
+size_flags_vertical = 3
178
+
179
+[node name="PortraitList" type="VBoxContainer" parent="HBoxContainer/Container/ScrollContainer/VBoxContainer"]
180
+margin_right = 523.0
181
+margin_bottom = 24.0
182
+size_flags_horizontal = 3
183
+
184
+[node name="PortraitEntry" parent="HBoxContainer/Container/ScrollContainer/VBoxContainer/PortraitList" instance=ExtResource( 1 )]
185
+margin_right = 523.0
186
+
187
+[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/Container/ScrollContainer/VBoxContainer"]
188
+margin_top = 28.0
189
+margin_right = 523.0
190
+margin_bottom = 48.0
191
+
192
+[node name="Button" type="Button" parent="HBoxContainer/Container/ScrollContainer/VBoxContainer/HBoxContainer"]
193
+margin_right = 87.0
194
+margin_bottom = 20.0
195
+text = " Add new + "
196
+
197
+[node name="FileName" type="HBoxContainer" parent="HBoxContainer/Container"]
198
+visible = false
199
+margin_top = 599.0
200
+margin_right = 523.0
201
+margin_bottom = 623.0
202
+
203
+[node name="Label" type="Label" parent="HBoxContainer/Container/FileName"]
204
+margin_top = 5.0
205
+margin_right = 130.0
206
+margin_bottom = 19.0
207
+rect_min_size = Vector2( 130, 0 )
208
+text = "File:"
209
+
210
+[node name="LineEdit" type="LineEdit" parent="HBoxContainer/Container/FileName"]
211
+margin_left = 134.0
212
+margin_right = 523.0
213
+margin_bottom = 24.0
214
+rect_min_size = Vector2( 140, 0 )
215
+focus_mode = 0
216
+size_flags_horizontal = 3
217
+editable = false
218
+
219
+[node name="Actions" type="HBoxContainer" parent="HBoxContainer/Container"]
220
+margin_top = 627.0
221
+margin_right = 523.0
222
+margin_bottom = 651.0
223
+
224
+[node name="DefaultSpeaker" type="CheckBox" parent="HBoxContainer/Container/Actions"]
225
+margin_right = 128.0
226
+margin_bottom = 24.0
227
+hint_tooltip = "By selecting \"Default Speaker\" all the new
228
+Text Events created will automatically
229
+select this character by default.
230
+You can only have 1 Default Speaker
231
+per project."
232
+text = "Default Speaker"
233
+
234
+[node name="Control" type="Control" parent="HBoxContainer/Container/Actions"]
235
+margin_left = 132.0
236
+margin_right = 523.0
237
+margin_bottom = 24.0
238
+size_flags_horizontal = 3
239
+
240
+[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
241
+margin_left = 527.0
242
+margin_right = 1051.0
243
+margin_bottom = 651.0
244
+size_flags_horizontal = 3
245
+size_flags_vertical = 3
246
+
247
+[node name="Control" type="Panel" parent="HBoxContainer/VBoxContainer"]
248
+margin_right = 524.0
249
+margin_bottom = 623.0
250
+size_flags_horizontal = 3
251
+size_flags_vertical = 3
252
+
253
+[node name="TextureRect" type="TextureRect" parent="HBoxContainer/VBoxContainer/Control"]
254
+anchor_right = 1.0
255
+anchor_bottom = 1.0
256
+margin_left = 30.0
257
+margin_top = 30.0
258
+margin_right = -30.0
259
+margin_bottom = -30.0
260
+rect_min_size = Vector2( 100, 100 )
261
+size_flags_horizontal = 3
262
+size_flags_vertical = 3
263
+expand = true
264
+stretch_mode = 6
265
+__meta__ = {
266
+"_edit_use_anchors_": false
267
+}
268
+
269
+[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/Control"]
270
+self_modulate = Color( 1, 1, 1, 0.396078 )
271
+margin_right = 340.0
272
+margin_bottom = 14.0
273
+text = "Preview"
274
+__meta__ = {
275
+"_edit_use_anchors_": false
276
+}
277
+
278
+[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/VBoxContainer"]
279
+margin_top = 627.0
280
+margin_right = 524.0
281
+margin_bottom = 651.0
282
+
283
+[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
284
+margin_top = 5.0
285
+margin_right = 33.0
286
+margin_bottom = 19.0
287
+text = "Scale"
288
+
289
+[node name="Scale" type="SpinBox" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
290
+margin_left = 37.0
291
+margin_right = 111.0
292
+margin_bottom = 24.0
293
+value = 100.0
294
+allow_greater = true
295
+align = 2
296
+suffix = "%"
297
+
298
+[node name="Label2" type="Label" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
299
+margin_left = 115.0
300
+margin_top = 5.0
301
+margin_right = 186.0
302
+margin_bottom = 19.0
303
+text = "        Offset"
304
+
305
+[node name="OffsetX" type="SpinBox" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
306
+margin_left = 190.0
307
+margin_right = 290.0
308
+margin_bottom = 24.0
309
+rect_min_size = Vector2( 100, 0 )
310
+allow_greater = true
311
+allow_lesser = true
312
+suffix = "X"
313
+
314
+[node name="OffsetY" type="SpinBox" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
315
+margin_left = 294.0
316
+margin_right = 394.0
317
+margin_bottom = 24.0
318
+rect_min_size = Vector2( 100, 0 )
319
+allow_greater = true
320
+allow_lesser = true
321
+suffix = "Y"

+ 47
- 0
addons/dialogic/Editor/CharacterEditor/PortraitEntry.gd View File

@@ -0,0 +1,47 @@
1
+tool
2
+extends HBoxContainer
3
+
4
+var editor_reference
5
+var image_node
6
+
7
+func _ready():
8
+	pass
9
+
10
+
11
+func _process(_delta):
12
+	pass
13
+
14
+
15
+func _on_ButtonDelete_pressed():
16
+	if $NameEdit.text == 'Default':
17
+		$PathEdit.text = ''
18
+		update_preview('')
19
+	else:
20
+		queue_free()
21
+
22
+
23
+func _on_ButtonSelect_pressed():
24
+	editor_reference.godot_dialog("*.png, *.svg")
25
+	editor_reference.godot_dialog_connect(self, "_on_file_selected")
26
+
27
+
28
+func _on_file_selected(path, target):
29
+	update_preview(path)
30
+	$PathEdit.text = path
31
+	if $NameEdit.text == '':
32
+		$NameEdit.text = DialogicUtil.get_filename_from_path(path)
33
+
34
+
35
+func _on_focus_entered():
36
+	if $PathEdit.text != '':
37
+		update_preview($PathEdit.text)
38
+
39
+
40
+func update_preview(path):
41
+	if path == '':
42
+		image_node.texture = null
43
+	else:
44
+		if '.png' in path or '.svg' in path:
45
+			image_node.texture = load(path)
46
+			return true
47
+	return false

+ 47
- 0
addons/dialogic/Editor/CharacterEditor/PortraitEntry.tscn View File

@@ -0,0 +1,47 @@
1
+[gd_scene load_steps=3 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Images/Remove.svg" type="Texture" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/CharacterEditor/PortraitEntry.gd" type="Script" id=2]
5
+
6
+[node name="PortraitEntry" type="HBoxContainer"]
7
+margin_right = 451.0
8
+margin_bottom = 24.0
9
+script = ExtResource( 2 )
10
+__meta__ = {
11
+"_edit_use_anchors_": false
12
+}
13
+
14
+[node name="NameEdit" type="LineEdit" parent="."]
15
+margin_right = 160.0
16
+margin_bottom = 24.0
17
+rect_min_size = Vector2( 160, 0 )
18
+__meta__ = {
19
+"_edit_use_anchors_": false
20
+}
21
+
22
+[node name="PathEdit" type="LineEdit" parent="."]
23
+margin_left = 164.0
24
+margin_right = 391.0
25
+margin_bottom = 24.0
26
+rect_min_size = Vector2( 150, 0 )
27
+size_flags_horizontal = 3
28
+editable = false
29
+selecting_enabled = false
30
+
31
+[node name="ButtonSelect" type="Button" parent="."]
32
+margin_left = 395.0
33
+margin_right = 419.0
34
+margin_bottom = 24.0
35
+text = "..."
36
+
37
+[node name="ButtonDelete" type="Button" parent="."]
38
+margin_left = 423.0
39
+margin_right = 451.0
40
+margin_bottom = 24.0
41
+icon = ExtResource( 1 )
42
+flat = true
43
+
44
+[connection signal="focus_entered" from="NameEdit" to="." method="_on_focus_entered"]
45
+[connection signal="focus_entered" from="PathEdit" to="." method="_on_focus_entered"]
46
+[connection signal="pressed" from="ButtonSelect" to="." method="_on_ButtonSelect_pressed"]
47
+[connection signal="pressed" from="ButtonDelete" to="." method="_on_ButtonDelete_pressed"]

+ 112
- 0
addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd View File

@@ -0,0 +1,112 @@
1
+tool
2
+extends ScrollContainer
3
+
4
+var editor_reference
5
+onready var master_tree = get_node('../MasterTree')
6
+var current_section = ''
7
+
8
+onready var nodes = {
9
+	'name' : $VBoxContainer/HBoxContainer/VBoxContainer/Name,
10
+	'type': $VBoxContainer/HBoxContainer/VBoxContainer/TypeMenuButton,
11
+	'extra_editor': $VBoxContainer/HBoxContainer/ExtraInfo,
12
+	'value_editor': $VBoxContainer/HBoxContainer/Value,
13
+	'value': $VBoxContainer/HBoxContainer/Value/ValueInput,
14
+	'extra_title': $VBoxContainer/HBoxContainer/ExtraInfo/Title,
15
+	'extra_text': $VBoxContainer/HBoxContainer/ExtraInfo/Text,
16
+	'extra_extra': $VBoxContainer/HBoxContainer/ExtraInfo/Extra,
17
+}
18
+
19
+func _ready():
20
+	reset_editor()
21
+	nodes['name'].connect('text_changed', self, '_on_name_changed')
22
+	nodes['type'].connect('item_selected', self, '_on_type_selected')
23
+
24
+
25
+func load_definition(section):
26
+	current_section = section
27
+	reset_editor()
28
+	nodes['name'].editable = true
29
+	nodes['name'].text = get_definition('name', 'Unnamed')
30
+	var type = get_definition('type', 0)
31
+	nodes['type'].select(type)
32
+	if type == 0:
33
+		nodes['value'].text = get_definition('value', '')
34
+	if type == 1:
35
+		nodes['extra_title'].text = get_definition('extra_title', '')
36
+		nodes['extra_text'].text = get_definition('extra_text', '')
37
+		nodes['extra_extra'].text = get_definition('extra_extra', '')
38
+	show_sub_editor(type)
39
+
40
+
41
+func reset_editor():
42
+	nodes['name'].text = ''
43
+	nodes['value'].text = ''
44
+	nodes['extra_title'].text = ''
45
+	nodes['extra_text'].text = ''
46
+	nodes['extra_extra'].text = ''
47
+	nodes['type'].select(get_definition('type', 0))
48
+
49
+
50
+func _on_name_changed(text):
51
+	var item = master_tree.get_selected()
52
+	item.set_text(0, text)
53
+
54
+
55
+func _on_type_selected(index):
56
+	nodes['type'].select(index)
57
+	var item = master_tree.get_selected()
58
+	item.set_icon(0, get_icon("Variant", "EditorIcons"))
59
+	if index == 1:
60
+		item.set_icon(0, get_icon("ScriptCreateDialog", "EditorIcons"))
61
+	show_sub_editor(index)
62
+
63
+
64
+func show_sub_editor(type):
65
+	nodes['extra_editor'].visible = false
66
+	nodes['value_editor'].visible = false
67
+	if type == 0:
68
+		nodes['value_editor'].visible = true
69
+	if type == 1:
70
+		nodes['extra_editor'].visible = true
71
+
72
+
73
+func get_definition(key, default):
74
+	if current_section != '':
75
+		var config = ConfigFile.new()
76
+		config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
77
+		if config.has_section(current_section):
78
+			return config.get_value(current_section, key, default)
79
+	else:
80
+		return default
81
+
82
+
83
+func new_definition():
84
+	var config = ConfigFile.new()
85
+	var section = DialogicUtil.generate_random_id()
86
+	var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
87
+	if err == OK:
88
+		config.set_value(section, 'name', 'New definition')
89
+		config.set_value(section, 'type', 0)
90
+		config.set_value(section, 'value', '')
91
+		config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
92
+		master_tree.add_definition({'section': section,'name': 'New definition', 'type': 0}, true)
93
+	else:
94
+		print('Error loading definitions')
95
+
96
+
97
+func save_definition():
98
+	if current_section != '':
99
+		var config = ConfigFile.new()
100
+		var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
101
+		if err == OK:
102
+			config.set_value(current_section, 'name', nodes['name'].text)
103
+			var type = nodes['type'].selected
104
+			config.set_value(current_section, 'type', type)
105
+			if type == 0:
106
+				config.set_value(current_section, 'value', nodes['value'].text)
107
+			if type == 1:
108
+				config.set_value(current_section, 'extra_title', nodes['extra_title'].text)
109
+				config.set_value(current_section, 'extra_text', nodes['extra_text'].text)
110
+				config.set_value(current_section, 'extra_extra', nodes['extra_extra'].text)
111
+			
112
+			config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))

+ 108
- 0
addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.tscn View File

@@ -0,0 +1,108 @@
1
+[gd_scene load_steps=2 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd" type="Script" id=1]
4
+
5
+[node name="DefinitionEditor" type="ScrollContainer"]
6
+anchor_right = 1.0
7
+anchor_bottom = 1.0
8
+script = ExtResource( 1 )
9
+__meta__ = {
10
+"_edit_use_anchors_": false
11
+}
12
+
13
+[node name="VBoxContainer" type="VBoxContainer" parent="."]
14
+margin_right = 1024.0
15
+margin_bottom = 600.0
16
+size_flags_horizontal = 3
17
+size_flags_vertical = 3
18
+
19
+[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
20
+margin_right = 1024.0
21
+margin_bottom = 230.0
22
+custom_constants/separation = 16
23
+
24
+[node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
25
+margin_right = 300.0
26
+margin_bottom = 230.0
27
+rect_min_size = Vector2( 300, 0 )
28
+custom_constants/separation = 10
29
+
30
+[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
31
+margin_right = 300.0
32
+margin_bottom = 14.0
33
+text = "Name"
34
+
35
+[node name="Name" type="LineEdit" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
36
+margin_top = 24.0
37
+margin_right = 300.0
38
+margin_bottom = 48.0
39
+
40
+[node name="Label2" type="Label" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
41
+margin_top = 58.0
42
+margin_right = 300.0
43
+margin_bottom = 72.0
44
+text = "Type:"
45
+
46
+[node name="TypeMenuButton" type="OptionButton" parent="VBoxContainer/HBoxContainer/VBoxContainer"]
47
+margin_top = 82.0
48
+margin_right = 300.0
49
+margin_bottom = 102.0
50
+text = "Variable"
51
+expand_icon = true
52
+items = [ "Variable", null, false, 0, null, "Extra Information", null, false, 1, null ]
53
+selected = 0
54
+
55
+[node name="ExtraInfo" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
56
+margin_left = 316.0
57
+margin_right = 616.0
58
+margin_bottom = 230.0
59
+rect_min_size = Vector2( 300, 0 )
60
+
61
+[node name="RichTextLabel2" type="Label" parent="VBoxContainer/HBoxContainer/ExtraInfo"]
62
+margin_right = 300.0
63
+margin_bottom = 31.0
64
+text = "A popup will display this information when a player hovers the word in a dialog. "
65
+autowrap = true
66
+
67
+[node name="Control" type="Control" parent="VBoxContainer/HBoxContainer/ExtraInfo"]
68
+margin_top = 35.0
69
+margin_right = 300.0
70
+margin_bottom = 70.0
71
+rect_min_size = Vector2( 0, 35 )
72
+
73
+[node name="Title" type="LineEdit" parent="VBoxContainer/HBoxContainer/ExtraInfo"]
74
+margin_top = 74.0
75
+margin_right = 300.0
76
+margin_bottom = 98.0
77
+placeholder_text = "Title"
78
+
79
+[node name="Text" type="TextEdit" parent="VBoxContainer/HBoxContainer/ExtraInfo"]
80
+margin_top = 102.0
81
+margin_right = 300.0
82
+margin_bottom = 202.0
83
+rect_min_size = Vector2( 0, 100 )
84
+size_flags_vertical = 3
85
+wrap_enabled = true
86
+
87
+[node name="Extra" type="LineEdit" parent="VBoxContainer/HBoxContainer/ExtraInfo"]
88
+margin_top = 206.0
89
+margin_right = 300.0
90
+margin_bottom = 230.0
91
+placeholder_text = "Extra"
92
+
93
+[node name="Value" type="VBoxContainer" parent="VBoxContainer/HBoxContainer"]
94
+margin_left = 632.0
95
+margin_right = 932.0
96
+margin_bottom = 230.0
97
+rect_min_size = Vector2( 300, 0 )
98
+custom_constants/separation = 10
99
+
100
+[node name="Label5" type="Label" parent="VBoxContainer/HBoxContainer/Value"]
101
+margin_right = 300.0
102
+margin_bottom = 14.0
103
+text = "Value:"
104
+
105
+[node name="ValueInput" type="LineEdit" parent="VBoxContainer/HBoxContainer/Value"]
106
+margin_top = 24.0
107
+margin_right = 300.0
108
+margin_bottom = 48.0

+ 172
- 0
addons/dialogic/Editor/EditorView.gd View File

@@ -0,0 +1,172 @@
1
+tool
2
+extends Control
3
+
4
+var plugin_reference
5
+var debug_mode: bool = true # For printing info
6
+var editor_file_dialog # EditorFileDialog
7
+var file_picker_data: Dictionary = {'method': '', 'node': self}
8
+var current_editor_view: String = 'Master'
9
+var version_string: String 
10
+onready var timeline_editor = $MainPanel/TimelineEditor
11
+onready var character_editor = $MainPanel/CharacterEditor
12
+onready var definition_editor = $MainPanel/DefinitionEditor
13
+onready var theme_editor = $MainPanel/ThemeEditor
14
+onready var settings_editor = $MainPanel/SettingsEditor
15
+
16
+
17
+func _ready():
18
+	# Adding file dialog to get used by pieces
19
+	editor_file_dialog = EditorFileDialog.new()
20
+	add_child(editor_file_dialog)
21
+
22
+	# Setting references to this node
23
+	timeline_editor.editor_reference = self
24
+	character_editor.editor_reference = self
25
+	definition_editor.editor_reference = self
26
+	theme_editor.editor_reference = self
27
+
28
+	# Toolbar
29
+	$ToolBar/NewTimelineButton.connect('pressed', $MainPanel/TimelineEditor, 'new_timeline')
30
+	$ToolBar/NewCharactersButton.connect('pressed', $MainPanel/CharacterEditor, 'new_character')
31
+	$ToolBar/NewThemeButton.connect('pressed', $MainPanel/ThemeEditor, 'new_theme')
32
+	$ToolBar/NewDefinitionButton.connect('pressed', $MainPanel/DefinitionEditor, 'new_definition')
33
+	$ToolBar/Docs.icon = get_icon("Instance", "EditorIcons")
34
+	$ToolBar/Docs.connect('pressed', OS, "shell_open", ["https://dialogic.coppolaemilio.com"])
35
+	#$ToolBar/FoldTools/ButtonFold.connect('pressed', $EditorTimeline, 'fold_all_nodes')
36
+	#$ToolBar/FoldTools/ButtonUnfold.connect('pressed', $EditorTimeline, 'unfold_all_nodes')
37
+	
38
+	
39
+	# Connecting context menus
40
+	$TimelinePopupMenu.connect('id_pressed', self, '_on_TimelinePopupMenu_id_pressed')
41
+	$CharacterPopupMenu.connect('id_pressed', self, '_on_CharacterPopupMenu_id_pressed')
42
+	$ThemePopupMenu.connect('id_pressed', self, '_on_ThemePopupMenu_id_pressed')
43
+	$DefinitionPopupMenu.connect('id_pressed', self, '_on_DefinitionPopupMenu_id_pressed')
44
+	
45
+	#Connecting confirmation menus
46
+	$RemoveTimelineConfirmation.connect('confirmed', self, '_on_RemoveTimelineConfirmation_confirmed')
47
+	$RemoveCharacterConfirmation.connect('confirmed', self, '_on_RemoveCharacterConfirmation_confirmed')
48
+	$RemoveThemeConfirmation.connect('confirmed', self, '_on_RemoveThemeConfirmation_confirmed')
49
+	$RemoveDefinitionConfirmation.connect('confirmed', self, '_on_RemoveDefinitionConfirmation_confirmed')
50
+	
51
+	# Loading the version number
52
+	var config = ConfigFile.new()
53
+	var err = config.load("res://addons/dialogic/plugin.cfg")
54
+	if err == OK:
55
+		version_string = config.get_value("plugin", "version", "?")
56
+		$ToolBar/Version.text = 'v' + version_string
57
+
58
+
59
+# Timeline context menu
60
+func _on_TimelinePopupMenu_id_pressed(id):
61
+	if id == 0: # View files
62
+		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('TIMELINE_DIR')))
63
+	if id == 1: # Copy to clipboard
64
+		OS.set_clipboard($MainPanel/TimelineEditor.timeline_name)
65
+	if id == 2: # Remove
66
+		$RemoveTimelineConfirmation.popup_centered()
67
+
68
+
69
+func _on_RemoveTimelineConfirmation_confirmed():
70
+	var dir = Directory.new()
71
+	var target = $MainPanel/TimelineEditor.working_timeline_file
72
+	print('target: ', target)
73
+	dir.remove(target)
74
+	$MainPanel/MasterTree.remove_selected()
75
+	$MainPanel/MasterTree.hide_all_editors(true)
76
+
77
+
78
+# Character context menu
79
+func _on_CharacterPopupMenu_id_pressed(id):
80
+	if id == 0:
81
+		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('CHAR_DIR')))
82
+	if id == 1:
83
+		$RemoveCharacterConfirmation.popup_centered()
84
+
85
+
86
+# Theme context menu
87
+func _on_ThemePopupMenu_id_pressed(id):
88
+	if id == 0:
89
+		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('THEME_DIR')))
90
+	if id == 1:
91
+		$RemoveThemeConfirmation.popup_centered()
92
+
93
+
94
+# Definition context menu
95
+func _on_DefinitionPopupMenu_id_pressed(id):
96
+	if id == 0:
97
+		OS.shell_open(ProjectSettings.globalize_path(DialogicUtil.get_path('DEFINITIONS_FILE')))
98
+	if id == 1:
99
+		$RemoveDefinitionConfirmation.popup_centered()
100
+
101
+
102
+func _on_RemoveDefinitionConfirmation_confirmed():
103
+	var target = $MainPanel/DefinitionEditor.current_section
104
+	var config = ConfigFile.new()
105
+	var err = config.load(DialogicUtil.get_path('DEFINITIONS_FILE'))
106
+	if err == OK:
107
+		config.erase_section(target)
108
+		config.save(DialogicUtil.get_path('DEFINITIONS_FILE'))
109
+		$MainPanel/MasterTree.remove_selected()
110
+		$MainPanel/MasterTree.hide_all_editors(true)
111
+	else:
112
+		print('Error loading definitions')
113
+
114
+
115
+func _on_RemoveCharacterConfirmation_confirmed():
116
+	var dir = Directory.new()
117
+	print($MainPanel/CharacterEditor.opened_character_data)
118
+	var target = DialogicUtil.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id']) 
119
+	dir.remove(target)
120
+	$MainPanel/MasterTree.remove_selected()
121
+	$MainPanel/MasterTree.hide_all_editors(true)
122
+
123
+
124
+func _on_RemoveThemeConfirmation_confirmed():
125
+	var dir = Directory.new()
126
+	var filepath = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
127
+	var target = DialogicUtil.get_path('THEME_DIR', filepath) 
128
+	dir.remove(target)
129
+	$MainPanel/MasterTree.remove_selected()
130
+	$MainPanel/MasterTree.hide_all_editors(true)
131
+
132
+
133
+# Godot dialog
134
+func godot_dialog(filter):
135
+	editor_file_dialog.mode = EditorFileDialog.MODE_OPEN_FILE
136
+	editor_file_dialog.clear_filters()
137
+	editor_file_dialog.popup_centered_ratio(0.75)
138
+	editor_file_dialog.add_filter(filter)
139
+	return editor_file_dialog
140
+
141
+
142
+func godot_dialog_connect(who, method_name):
143
+	var signal_name = "file_selected"
144
+	# Checking if previous connection exists, if it does, disconnect it.
145
+	if editor_file_dialog.is_connected(
146
+		signal_name,
147
+		file_picker_data['node'],
148
+		file_picker_data['method']):
149
+			editor_file_dialog.disconnect(
150
+				signal_name,
151
+				file_picker_data['node'],
152
+				file_picker_data['method']
153
+			)
154
+	# Connect new signal
155
+	editor_file_dialog.connect(signal_name, who, method_name, [who])
156
+	file_picker_data['method'] = method_name
157
+	file_picker_data['node'] = who
158
+
159
+
160
+func _on_file_selected(path):
161
+	dprint(path)
162
+
163
+
164
+func _on_Logo_gui_input(event) -> void:
165
+	# I should probably replace this with an "About Dialogic" dialog
166
+	if event is InputEventMouseButton and event.button_index == 1:
167
+		OS.shell_open("https://github.com/coppolaemilio/dialogic")
168
+
169
+
170
+func dprint(what) -> void:
171
+	if debug_mode:
172
+		print(what)

+ 302
- 0
addons/dialogic/Editor/EditorView.tscn View File

@@ -0,0 +1,302 @@
1
+[gd_scene load_steps=20 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/EditorView.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn" type="PackedScene" id=2]
5
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-timeline.svg" type="Texture" id=3]
6
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-character.svg" type="Texture" id=4]
7
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-theme.svg" type="Texture" id=5]
8
+[ext_resource path="res://addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn" type="PackedScene" id=6]
9
+[ext_resource path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn" type="PackedScene" id=7]
10
+[ext_resource path="res://addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn" type="PackedScene" id=8]
11
+[ext_resource path="res://addons/dialogic/Images/open-icon.svg" type="Texture" id=9]
12
+[ext_resource path="res://addons/dialogic/Images/closed-icon.svg" type="Texture" id=10]
13
+[ext_resource path="res://addons/dialogic/Images/ActionCopy.svg" type="Texture" id=11]
14
+[ext_resource path="res://addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.tscn" type="PackedScene" id=12]
15
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-definition.svg" type="Texture" id=13]
16
+[ext_resource path="res://addons/dialogic/Images/logo.png" type="Texture" id=14]
17
+[ext_resource path="res://addons/dialogic/Images/Remove.svg" type="Texture" id=22]
18
+[ext_resource path="res://addons/dialogic/Images/Filesystem.svg" type="Texture" id=26]
19
+[ext_resource path="res://addons/dialogic/Editor/MasterTree/MasterTree.tscn" type="PackedScene" id=35]
20
+
21
+[sub_resource type="Image" id=3]
22
+data = {
23
+"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 ),
24
+"format": "LumAlpha8",
25
+"height": 16,
26
+"mipmaps": false,
27
+"width": 16
28
+}
29
+
30
+[sub_resource type="ImageTexture" id=2]
31
+flags = 4
32
+flags = 4
33
+image = SubResource( 3 )
34
+size = Vector2( 16, 16 )
35
+
36
+[node name="EditorView" type="Control"]
37
+anchor_right = 1.0
38
+anchor_bottom = 1.0
39
+margin_left = 8.0
40
+margin_top = 8.0
41
+margin_right = -8.0
42
+margin_bottom = -8.0
43
+rect_min_size = Vector2( 0, 200 )
44
+size_flags_horizontal = 3
45
+size_flags_vertical = 3
46
+script = ExtResource( 1 )
47
+__meta__ = {
48
+"_edit_use_anchors_": false
49
+}
50
+
51
+[node name="ToolBar" type="HBoxContainer" parent="."]
52
+anchor_right = 1.0
53
+margin_bottom = 30.0
54
+custom_constants/separation = 0
55
+__meta__ = {
56
+"_edit_use_anchors_": false
57
+}
58
+
59
+[node name="NewTimelineButton" type="Button" parent="ToolBar"]
60
+self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
61
+margin_right = 34.0
62
+margin_bottom = 30.0
63
+hint_tooltip = "New Timeline"
64
+focus_mode = 0
65
+icon = ExtResource( 3 )
66
+flat = true
67
+
68
+[node name="NewCharactersButton" type="ToolButton" parent="ToolBar"]
69
+self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
70
+margin_left = 34.0
71
+margin_right = 68.0
72
+margin_bottom = 30.0
73
+hint_tooltip = "New Character"
74
+focus_mode = 0
75
+icon = ExtResource( 4 )
76
+
77
+[node name="NewDefinitionButton" type="Button" parent="ToolBar"]
78
+self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
79
+margin_left = 68.0
80
+margin_right = 102.0
81
+margin_bottom = 30.0
82
+hint_tooltip = "New Definition"
83
+focus_mode = 0
84
+icon = ExtResource( 13 )
85
+flat = true
86
+
87
+[node name="NewThemeButton" type="Button" parent="ToolBar"]
88
+self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
89
+margin_left = 102.0
90
+margin_right = 136.0
91
+margin_bottom = 30.0
92
+hint_tooltip = "New Theme"
93
+focus_mode = 0
94
+icon = ExtResource( 5 )
95
+flat = true
96
+
97
+[node name="FoldTools" type="HBoxContainer" parent="ToolBar"]
98
+visible = false
99
+margin_left = 136.0
100
+margin_right = 271.0
101
+margin_bottom = 30.0
102
+
103
+[node name="Label" type="Label" parent="ToolBar/FoldTools"]
104
+margin_top = 8.0
105
+margin_right = 59.0
106
+margin_bottom = 22.0
107
+text = "      Fold  "
108
+
109
+[node name="ButtonFold" type="Button" parent="ToolBar/FoldTools"]
110
+margin_left = 63.0
111
+margin_right = 97.0
112
+margin_bottom = 30.0
113
+icon = ExtResource( 10 )
114
+align = 0
115
+
116
+[node name="ButtonUnfold" type="Button" parent="ToolBar/FoldTools"]
117
+margin_left = 101.0
118
+margin_right = 135.0
119
+margin_bottom = 30.0
120
+icon = ExtResource( 9 )
121
+align = 0
122
+
123
+[node name="Spacer" type="Control" parent="ToolBar"]
124
+margin_left = 136.0
125
+margin_right = 751.0
126
+margin_bottom = 30.0
127
+size_flags_horizontal = 3
128
+
129
+[node name="Docs" type="ToolButton" parent="ToolBar"]
130
+self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
131
+margin_left = 751.0
132
+margin_right = 861.0
133
+margin_bottom = 30.0
134
+hint_tooltip = "Theme Editor"
135
+mouse_default_cursor_shape = 2
136
+text = "Online Docs"
137
+icon = SubResource( 2 )
138
+
139
+[node name="Logo" type="TextureRect" parent="ToolBar"]
140
+margin_left = 861.0
141
+margin_right = 981.0
142
+margin_bottom = 30.0
143
+rect_min_size = Vector2( 120, 0 )
144
+mouse_default_cursor_shape = 2
145
+texture = ExtResource( 14 )
146
+expand = true
147
+stretch_mode = 5
148
+
149
+[node name="Version" type="Label" parent="ToolBar"]
150
+self_modulate = Color( 1, 1, 1, 0.631373 )
151
+margin_left = 981.0
152
+margin_top = 8.0
153
+margin_right = 1008.0
154
+margin_bottom = 22.0
155
+text = "v1.0"
156
+
157
+[node name="MainPanel" type="HSplitContainer" parent="."]
158
+anchor_right = 1.0
159
+anchor_bottom = 1.0
160
+margin_left = 6.0
161
+margin_top = 38.0
162
+margin_right = -5.0
163
+margin_bottom = -5.0
164
+__meta__ = {
165
+"_edit_use_anchors_": false
166
+}
167
+
168
+[node name="MasterTree" parent="MainPanel" instance=ExtResource( 35 )]
169
+anchor_right = 0.0
170
+anchor_bottom = 0.0
171
+margin_right = 180.0
172
+margin_bottom = 541.0
173
+rect_min_size = Vector2( 180, 0 )
174
+size_flags_vertical = 3
175
+
176
+[node name="TimelineEditor" parent="MainPanel" instance=ExtResource( 2 )]
177
+visible = false
178
+
179
+[node name="CharacterEditor" parent="MainPanel" instance=ExtResource( 7 )]
180
+visible = false
181
+
182
+[node name="DefinitionEditor" parent="MainPanel" instance=ExtResource( 12 )]
183
+visible = false
184
+
185
+[node name="ThemeEditor" parent="MainPanel" instance=ExtResource( 8 )]
186
+visible = false
187
+
188
+[node name="SettingsEditor" parent="MainPanel" instance=ExtResource( 6 )]
189
+visible = false
190
+anchor_right = 0.0
191
+anchor_bottom = 0.0
192
+margin_left = 192.0
193
+margin_right = 1253.0
194
+margin_bottom = 661.0
195
+
196
+[node name="Empty" type="CenterContainer" parent="MainPanel"]
197
+margin_left = 192.0
198
+margin_right = 997.0
199
+margin_bottom = 541.0
200
+
201
+[node name="VBoxContainer" type="VBoxContainer" parent="MainPanel/Empty"]
202
+margin_left = 262.0
203
+margin_top = 263.0
204
+margin_right = 542.0
205
+margin_bottom = 277.0
206
+
207
+[node name="Label" type="Label" parent="MainPanel/Empty/VBoxContainer"]
208
+margin_right = 280.0
209
+margin_bottom = 14.0
210
+text = "Select or create an element to start working"
211
+
212
+[node name="TimelinePopupMenu" type="PopupMenu" parent="."]
213
+margin_left = 151.0
214
+margin_top = 276.0
215
+margin_right = 325.0
216
+margin_bottom = 332.0
217
+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 ]
218
+__meta__ = {
219
+"_edit_use_anchors_": false
220
+}
221
+
222
+[node name="CharacterPopupMenu" type="PopupMenu" parent="."]
223
+margin_left = 171.799
224
+margin_top = 209.0
225
+margin_right = 267.799
226
+margin_bottom = 229.0
227
+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 ]
228
+__meta__ = {
229
+"_edit_use_anchors_": false
230
+}
231
+
232
+[node name="ThemePopupMenu" type="PopupMenu" parent="."]
233
+margin_left = 171.799
234
+margin_top = 209.0
235
+margin_right = 267.799
236
+margin_bottom = 229.0
237
+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 ]
238
+__meta__ = {
239
+"_edit_use_anchors_": false
240
+}
241
+
242
+[node name="DefinitionPopupMenu" type="PopupMenu" parent="."]
243
+margin_left = 171.799
244
+margin_top = 209.0
245
+margin_right = 267.799
246
+margin_bottom = 229.0
247
+items = [ "Edit definitions file", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Definition", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false ]
248
+__meta__ = {
249
+"_edit_use_anchors_": false
250
+}
251
+
252
+[node name="RemoveCharacterConfirmation" type="ConfirmationDialog" parent="."]
253
+margin_right = 325.0
254
+margin_bottom = 88.0
255
+rect_min_size = Vector2( 250, 87.5 )
256
+dialog_text = "Are you sure you want to remove this character?
257
+(Can't be restored)"
258
+__meta__ = {
259
+"_edit_use_anchors_": false
260
+}
261
+
262
+[node name="RemoveDefinitionConfirmation" type="ConfirmationDialog" parent="."]
263
+margin_right = 325.0
264
+margin_bottom = 88.0
265
+rect_min_size = Vector2( 250, 87.5 )
266
+dialog_text = "Are you sure you want to remove this definition?
267
+(Can't be restored)"
268
+__meta__ = {
269
+"_edit_use_anchors_": false
270
+}
271
+
272
+[node name="RemoveThemeConfirmation" type="ConfirmationDialog" parent="."]
273
+margin_right = 325.0
274
+margin_bottom = 88.0
275
+rect_min_size = Vector2( 250, 87.5 )
276
+dialog_text = "Are you sure you want to remove this theme?
277
+(Can't be restored)"
278
+__meta__ = {
279
+"_edit_use_anchors_": false
280
+}
281
+
282
+[node name="RemoveGlossaryConfirmation" type="ConfirmationDialog" parent="."]
283
+margin_right = 325.0
284
+margin_bottom = 88.0
285
+rect_min_size = Vector2( 250, 87.5 )
286
+dialog_text = "Are you sure you want to remove this entry?
287
+(Can't be restored)"
288
+__meta__ = {
289
+"_edit_use_anchors_": false
290
+}
291
+
292
+[node name="RemoveTimelineConfirmation" type="ConfirmationDialog" parent="."]
293
+margin_right = 325.0
294
+margin_bottom = 88.0
295
+rect_min_size = Vector2( 250, 87.5 )
296
+dialog_text = "Are you sure you want to remove this timeline?
297
+(Can't be restored)"
298
+__meta__ = {
299
+"_edit_use_anchors_": false
300
+}
301
+
302
+[connection signal="gui_input" from="ToolBar/Logo" to="." method="_on_Logo_gui_input"]

+ 250
- 0
addons/dialogic/Editor/MasterTree/MasterTree.gd View File

@@ -0,0 +1,250 @@
1
+tool
2
+extends Tree
3
+
4
+onready var editor_reference = get_node('../..')
5
+onready var timeline_editor = get_node('../TimelineEditor')
6
+onready var character_editor = get_node('../CharacterEditor')
7
+onready var definition_editor = get_node('../DefinitionEditor')
8
+onready var settings_editor = get_node('../SettingsEditor')
9
+onready var theme_editor = get_node('../ThemeEditor')
10
+onready var empty_editor = get_node('../Empty')
11
+
12
+onready var tree = self
13
+var timeline_icon = load("res://addons/dialogic/Images/timeline.svg")
14
+var character_icon = load("res://addons/dialogic/Images/character.svg")
15
+var timelines_tree
16
+var characters_tree
17
+var definitions_tree
18
+var themes_tree
19
+var settings_tree
20
+
21
+func _ready():
22
+	allow_rmb_select = true
23
+	var root = tree.create_item()
24
+	tree.set_hide_root(true)
25
+	
26
+	# Creating the parents
27
+	timelines_tree = tree.create_item(root)
28
+	timelines_tree.set_selectable(0, false)
29
+	timelines_tree.set_text(0, "Timelines")
30
+	#timelines_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
31
+	
32
+	characters_tree = tree.create_item(root)
33
+	characters_tree.set_selectable(0, false)
34
+	characters_tree.set_text(0, "Characters")
35
+	#characters_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
36
+
37
+	definitions_tree = tree.create_item(root)
38
+	definitions_tree.set_selectable(0, false)
39
+	definitions_tree.set_text(0, "Definitions")
40
+	#definitions_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
41
+	
42
+	themes_tree = tree.create_item(root)
43
+	themes_tree.set_selectable(0, false)
44
+	themes_tree.set_text(0, "Themes")
45
+	#themes_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
46
+	
47
+	settings_tree = tree.create_item(root)
48
+	settings_tree.set_selectable(0, true)
49
+	settings_tree.set_text(0, "Settings")
50
+	settings_tree.set_icon(0, get_icon("GDScript", "EditorIcons"))
51
+	settings_tree.set_metadata(0, {'editor': 'Settings'})
52
+
53
+	
54
+	connect('item_selected', self, '_on_item_selected')
55
+	connect('item_rmb_selected', self, '_on_item_rmb_selected')
56
+	connect('gui_input', self, '_on_gui_input')
57
+	connect('item_edited', self, '_on_item_edited')
58
+	$RenamerReset.connect("timeout", self, '_on_renamer_reset_timeout')
59
+	
60
+	#var subchild1 = tree.create_item(timelines_tree)
61
+	#subchild1.set_text(0, "Subchild1")
62
+	
63
+	# Adding timelines
64
+	for t in DialogicUtil.get_timeline_list():
65
+		add_timeline(t)
66
+	
67
+	# Adding characters
68
+	for c in DialogicUtil.get_character_list():
69
+		add_character(c)
70
+	
71
+	# Adding Definitions
72
+	for d in DialogicUtil.get_definition_list():
73
+		add_definition(d)
74
+	
75
+	# Adding Themes
76
+	for m in DialogicUtil.get_theme_list():
77
+		add_theme(m)
78
+	
79
+	# Default empty screen.
80
+	hide_all_editors(true) 
81
+	
82
+	# AutoSave timer
83
+	$AutoSave.connect("timeout", self, '_on_autosave_timeout')
84
+	$AutoSave.start(0.5)
85
+
86
+
87
+func add_timeline(timeline, select = false):
88
+	var item = tree.create_item(timelines_tree)
89
+	item.set_icon(0, timeline_icon)
90
+	if timeline.has('name'):
91
+		item.set_text(0, timeline['name'])
92
+	else:
93
+		item.set_text(0, timeline['file'])
94
+	timeline['editor'] = 'Timeline'
95
+	item.set_metadata(0, timeline)
96
+	#item.set_editable(0, true)
97
+	if select: # Auto selecting
98
+		item.select(0)
99
+
100
+
101
+func add_theme(theme_item, select = false):
102
+	var item = tree.create_item(themes_tree)
103
+	item.set_icon(0, get_icon("StyleBoxTexture", "EditorIcons"))
104
+	item.set_text(0, theme_item['name'])
105
+	theme_item['editor'] = 'Theme'
106
+	item.set_metadata(0, theme_item)
107
+	#item.set_editable(0, true)
108
+	if select: # Auto selecting
109
+		item.select(0)
110
+
111
+
112
+func add_character(character, select = false):
113
+	var item = tree.create_item(characters_tree)
114
+	item.set_icon(0, character_icon)
115
+	if character.has('name'):
116
+		item.set_text(0, character['name'])
117
+	else:
118
+		item.set_text(0, character['file'])
119
+	character['editor'] = 'Character'
120
+	item.set_metadata(0, character)
121
+	#item.set_editable(0, true)
122
+	if character.has('color'):
123
+		item.set_icon_modulate(0, character['color'])
124
+	# Auto selecting
125
+	if select: 
126
+		item.select(0)
127
+
128
+
129
+func add_definition(definition, select = false):
130
+	var item = tree.create_item(definitions_tree)
131
+	item.set_text(0, definition['name'])
132
+	item.set_icon(0, get_icon("Variant", "EditorIcons"))
133
+	if definition['type'] == 1:
134
+		item.set_icon(0, get_icon("ScriptCreateDialog", "EditorIcons"))
135
+		
136
+	definition['editor'] = 'Definition'
137
+	item.set_metadata(0, definition)
138
+	if select: # Auto selecting
139
+		item.select(0)
140
+
141
+
142
+func _on_item_selected():
143
+	# TODO: Ideally I would perform a "save" here before opening the next
144
+	#       resource. Unfortunately there has been so many bugs doing that 
145
+	#       that I'll revisit it in the future. 
146
+	#       save_current_resource()
147
+	var item = get_selected()
148
+	var metadata = item.get_metadata(0)
149
+	hide_all_editors()
150
+	if metadata['editor'] == 'Timeline':
151
+		timeline_editor.visible = true
152
+		timeline_editor.load_timeline(DialogicUtil.get_path('TIMELINE_DIR', metadata['file']))
153
+	if metadata['editor'] == 'Character':
154
+		character_editor.visible = true
155
+		character_editor.load_character(DialogicUtil.get_path('CHAR_DIR', metadata['file']))
156
+	if metadata['editor'] == 'Definition':
157
+		definition_editor.visible = true
158
+		definition_editor.load_definition(metadata['section'])
159
+	if metadata['editor'] == 'Theme':
160
+		theme_editor.load_theme(metadata['file'])
161
+		theme_editor.visible = true
162
+	if metadata['editor'] == 'Settings':
163
+		settings_editor.update_data()
164
+		settings_editor.visible = true
165
+
166
+
167
+func hide_all_editors(show_empty = false):
168
+	character_editor.visible = false
169
+	timeline_editor.visible = false
170
+	definition_editor.visible = false
171
+	theme_editor.visible = false
172
+	empty_editor.visible = false
173
+	settings_editor.visible = false
174
+	if show_empty:
175
+		empty_editor.visible = true
176
+
177
+
178
+func _on_item_rmb_selected(position):
179
+	var item = get_selected().get_metadata(0)
180
+	if item['editor'] == 'Timeline':
181
+		editor_reference.get_node('TimelinePopupMenu').rect_position = get_viewport().get_mouse_position()
182
+		editor_reference.get_node('TimelinePopupMenu').popup()
183
+	if item['editor'] == 'Character':
184
+		editor_reference.get_node("CharacterPopupMenu").rect_position = get_viewport().get_mouse_position()
185
+		editor_reference.get_node("CharacterPopupMenu").popup()
186
+	if item['editor'] == 'Theme':
187
+		editor_reference.get_node("ThemePopupMenu").rect_position = get_viewport().get_mouse_position()
188
+		editor_reference.get_node("ThemePopupMenu").popup()
189
+	if item['editor'] == 'Definition':
190
+		editor_reference.get_node("DefinitionPopupMenu").rect_position = get_viewport().get_mouse_position()
191
+		editor_reference.get_node("DefinitionPopupMenu").popup()
192
+
193
+
194
+func remove_selected():
195
+	var item = get_selected()
196
+	item.free()
197
+	timelines_tree.select(0)
198
+	settings_editor.update_data()
199
+
200
+
201
+func refresh_timeline_list():
202
+	print('update timeline list')
203
+
204
+
205
+func _on_renamer_reset_timeout():
206
+	get_selected().set_editable(0, false)
207
+
208
+
209
+func _on_gui_input(event):
210
+	if event is InputEventMouseButton and event.button_index == 1:
211
+		if event.is_pressed() and event.doubleclick:
212
+			var item = get_selected()
213
+			var metadata = item.get_metadata(0)
214
+			item.set_editable(0, true)
215
+			$RenamerReset.start(0.5)
216
+
217
+
218
+func _on_item_edited():
219
+	var item = get_selected()
220
+	var metadata = item.get_metadata(0)
221
+	if metadata['editor'] == 'Timeline':
222
+		timeline_editor.timeline_name = item.get_text(0)
223
+	if metadata['editor'] == 'Theme':
224
+		DialogicUtil.set_theme_value(metadata['file'], 'settings', 'name', item.get_text(0))
225
+	if metadata['editor'] == 'Character':
226
+		character_editor.nodes['name'].text = item.get_text(0)
227
+	if metadata['editor'] == 'Definition':
228
+		definition_editor.nodes['name'].text = item.get_text(0)
229
+		# Not sure why this signal doesn't triggers
230
+		definition_editor._on_name_changed(item.get_text(0))
231
+
232
+
233
+func _on_autosave_timeout():
234
+	save_current_resource()
235
+
236
+
237
+func save_current_resource():
238
+	var root = get_node('../..') # This is the same as the editor_reference
239
+	if root.visible: #Only save if the editor is open
240
+		var item: TreeItem = get_selected()
241
+		var metadata: Dictionary
242
+		if item != null:
243
+			metadata = item.get_metadata(0)
244
+			if metadata['editor'] == 'Timeline':
245
+				timeline_editor.save_timeline()
246
+			if metadata['editor'] == 'Character':
247
+				character_editor.save_character()
248
+			if metadata['editor'] == 'Definition':
249
+				definition_editor.save_definition()
250
+			# Note: Theme files auto saves on change

+ 18
- 0
addons/dialogic/Editor/MasterTree/MasterTree.tscn View File

@@ -0,0 +1,18 @@
1
+[gd_scene load_steps=2 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/MasterTree/MasterTree.gd" type="Script" id=1]
4
+
5
+[node name="MasterTree" type="Tree"]
6
+anchor_right = 1.0
7
+anchor_bottom = 1.0
8
+allow_rmb_select = true
9
+hide_root = true
10
+script = ExtResource( 1 )
11
+__meta__ = {
12
+"_edit_use_anchors_": false
13
+}
14
+
15
+[node name="RenamerReset" type="Timer" parent="."]
16
+one_shot = true
17
+
18
+[node name="AutoSave" type="Timer" parent="."]

+ 48
- 0
addons/dialogic/Editor/Pieces/AudioBlock.gd View File

@@ -0,0 +1,48 @@
1
+tool
2
+extends Control
3
+
4
+var editor_reference
5
+var editorPopup
6
+
7
+var play_icon = load("res://addons/dialogic/Images/play.svg")
8
+var stop_icon = load("res://addons/dialogic/Images/stop.svg")
9
+
10
+# This is the information of this event and it will get parsed and saved to the JSON file.
11
+var event_data = {
12
+	'audio': 'play',
13
+	'file': ''
14
+}
15
+
16
+
17
+func _on_ButtonAudio_pressed():
18
+	editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
19
+	editor_reference.godot_dialog_connect(self, "_on_file_selected")
20
+
21
+
22
+func _on_file_selected(path, target):
23
+	target.load_audio(path)
24
+
25
+
26
+func load_audio(path):
27
+	$PanelContainer/VBoxContainer/Header/Name.text = path
28
+	$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = false
29
+	event_data['file'] = path
30
+
31
+
32
+func load_data(data):
33
+	event_data = data
34
+	if data['file'] != '':
35
+		load_audio(data['file'])
36
+
37
+
38
+func _on_ButtonPreviewPlay_pressed():
39
+	if $PanelContainer/AudioPreview.is_playing():
40
+		$PanelContainer/AudioPreview.stop()
41
+	else:
42
+		$PanelContainer/AudioPreview.stream = load(event_data['file'])
43
+		$PanelContainer/AudioPreview.play()
44
+		$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = stop_icon
45
+
46
+
47
+func _on_AudioPreview_finished():
48
+	$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = play_icon

+ 119
- 0
addons/dialogic/Editor/Pieces/AudioBlock.tscn View File

@@ -0,0 +1,119 @@
1
+[gd_scene load_steps=7 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Pieces/AudioBlock.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Images/audio-event.svg" type="Texture" id=3]
5
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
6
+[ext_resource path="res://addons/dialogic/Images/play.svg" type="Texture" id=5]
7
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=6]
8
+
9
+[sub_resource type="StyleBoxFlat" id=1]
10
+content_margin_left = 16.0
11
+content_margin_right = 6.0
12
+content_margin_top = 6.0
13
+content_margin_bottom = 6.0
14
+bg_color = Color( 0.580392, 0.286275, 0.227451, 0.447059 )
15
+border_width_left = 2
16
+border_width_top = 2
17
+border_width_right = 2
18
+border_width_bottom = 2
19
+border_color = Color( 0.12549, 0.12549, 0.12549, 1 )
20
+corner_radius_top_left = 6
21
+corner_radius_top_right = 6
22
+corner_radius_bottom_right = 6
23
+corner_radius_bottom_left = 6
24
+
25
+[node name="AudioBlock" type="HBoxContainer"]
26
+margin_right = 1798.0
27
+margin_bottom = 42.0
28
+size_flags_horizontal = 3
29
+size_flags_vertical = 9
30
+script = ExtResource( 1 )
31
+__meta__ = {
32
+"_edit_use_anchors_": false
33
+}
34
+
35
+[node name="Indent" type="Control" parent="."]
36
+visible = false
37
+margin_left = 6.0
38
+margin_top = 6.0
39
+margin_right = 1792.0
40
+margin_bottom = 36.0
41
+
42
+[node name="PanelContainer" type="PanelContainer" parent="."]
43
+margin_right = 1798.0
44
+margin_bottom = 42.0
45
+mouse_filter = 1
46
+size_flags_horizontal = 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 = 1792.0
53
+margin_bottom = 36.0
54
+size_flags_horizontal = 3
55
+
56
+[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
57
+margin_right = 1776.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( 3 )
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 = 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 = 87.0
77
+margin_bottom = 21.0
78
+
79
+[node name="ButtonAudio" type="Button" parent="PanelContainer/VBoxContainer/Header"]
80
+margin_left = 91.0
81
+margin_right = 115.0
82
+margin_bottom = 28.0
83
+text = "..."
84
+
85
+[node name="ButtonPreviewPlay" type="Button" parent="PanelContainer/VBoxContainer/Header"]
86
+margin_left = 119.0
87
+margin_right = 153.0
88
+margin_bottom = 28.0
89
+disabled = true
90
+icon = ExtResource( 5 )
91
+
92
+[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
93
+visible = false
94
+margin_left = 103.0
95
+margin_top = 8.0
96
+margin_right = 131.0
97
+margin_bottom = 22.0
98
+custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
99
+text = "    ..."
100
+
101
+[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
102
+margin_left = 157.0
103
+margin_right = 1735.0
104
+margin_bottom = 28.0
105
+size_flags_horizontal = 3
106
+
107
+[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
108
+margin_left = 1739.0
109
+margin_right = 1776.0
110
+margin_bottom = 28.0
111
+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 ]
112
+
113
+[node name="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"]
114
+
115
+[node name="DragController" parent="." instance=ExtResource( 6 )]
116
+
117
+[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
118
+[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
119
+[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]

+ 29
- 0
addons/dialogic/Editor/Pieces/ChangeScene.gd View File

@@ -0,0 +1,29 @@
1
+tool
2
+extends Control
3
+
4
+var editor_reference
5
+var editorPopup
6
+
7
+var event_data = {
8
+	'change_scene': ''
9
+}
10
+
11
+
12
+func _on_ButtonScenePicker_pressed():
13
+	editor_reference.godot_dialog("*.tscn")
14
+	editor_reference.godot_dialog_connect(self, "_on_file_selected")
15
+
16
+
17
+func _on_file_selected(path, target):
18
+	target.select_scene(path)
19
+
20
+
21
+func select_scene(path):
22
+	$PanelContainer/VBoxContainer/Header/Name.text = path
23
+	event_data['change_scene'] = path
24
+
25
+
26
+func load_data(data):
27
+	event_data = data
28
+	if data['change_scene'] != '':
29
+		select_scene(data['change_scene'])

+ 110
- 0
addons/dialogic/Editor/Pieces/ChangeScene.tscn View File

@@ -0,0 +1,110 @@
1
+[gd_scene load_steps=6 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Pieces/ChangeScene.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Images/change-scene.svg" type="Texture" id=3]
5
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
6
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=6]
7
+
8
+[sub_resource type="StyleBoxFlat" id=1]
9
+content_margin_left = 16.0
10
+content_margin_right = 6.0
11
+content_margin_top = 6.0
12
+content_margin_bottom = 6.0
13
+bg_color = Color( 0.14902, 0.333333, 0.509804, 0.4 )
14
+border_width_left = 2
15
+border_width_top = 2
16
+border_width_right = 2
17
+border_width_bottom = 2
18
+border_color = Color( 0.12549, 0.12549, 0.12549, 1 )
19
+corner_radius_top_left = 6
20
+corner_radius_top_right = 6
21
+corner_radius_bottom_right = 6
22
+corner_radius_bottom_left = 6
23
+
24
+[node name="ChangeScene" type="HBoxContainer"]
25
+margin_right = 1798.0
26
+margin_bottom = 42.0
27
+size_flags_horizontal = 3
28
+size_flags_vertical = 9
29
+script = ExtResource( 1 )
30
+__meta__ = {
31
+"_edit_use_anchors_": false
32
+}
33
+
34
+[node name="Indent" type="Control" parent="."]
35
+visible = false
36
+margin_left = 6.0
37
+margin_top = 6.0
38
+margin_right = 1792.0
39
+margin_bottom = 36.0
40
+
41
+[node name="PanelContainer" type="PanelContainer" parent="."]
42
+margin_right = 1798.0
43
+margin_bottom = 42.0
44
+mouse_filter = 1
45
+size_flags_horizontal = 3
46
+custom_styles/panel = SubResource( 1 )
47
+
48
+[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
49
+margin_left = 16.0
50
+margin_top = 6.0
51
+margin_right = 1792.0
52
+margin_bottom = 36.0
53
+size_flags_horizontal = 3
54
+
55
+[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
56
+margin_right = 1776.0
57
+margin_bottom = 28.0
58
+
59
+[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
60
+margin_right = 22.0
61
+margin_bottom = 28.0
62
+texture = ExtResource( 3 )
63
+stretch_mode = 6
64
+
65
+[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
66
+margin_left = 26.0
67
+margin_top = 7.0
68
+margin_right = 134.0
69
+margin_bottom = 21.0
70
+text = "  Change Scene   "
71
+
72
+[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"]
73
+margin_left = 138.0
74
+margin_top = 7.0
75
+margin_right = 138.0
76
+margin_bottom = 21.0
77
+
78
+[node name="ButtonScenePicker" type="Button" parent="PanelContainer/VBoxContainer/Header"]
79
+margin_left = 142.0
80
+margin_right = 166.0
81
+margin_bottom = 28.0
82
+text = "..."
83
+
84
+[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
85
+visible = false
86
+margin_left = 103.0
87
+margin_top = 8.0
88
+margin_right = 131.0
89
+margin_bottom = 22.0
90
+custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
91
+text = "    ..."
92
+
93
+[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
94
+margin_left = 170.0
95
+margin_right = 1735.0
96
+margin_bottom = 28.0
97
+size_flags_horizontal = 3
98
+
99
+[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
100
+margin_left = 1739.0
101
+margin_right = 1776.0
102
+margin_bottom = 28.0
103
+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 ]
104
+
105
+[node name="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"]
106
+
107
+[node name="DragController" parent="." instance=ExtResource( 6 )]
108
+
109
+[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonScenePicker" to="." method="_on_ButtonScenePicker_pressed"]
110
+[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]

+ 43
- 0
addons/dialogic/Editor/Pieces/ChangeTimeline.gd View File

@@ -0,0 +1,43 @@
1
+tool
2
+extends Control
3
+
4
+var editor_reference
5
+var editorPopup
6
+
7
+
8
+# This is the information of this event and it will get parsed and saved to the JSON file.
9
+var event_data = {
10
+	'change_timeline': ''
11
+}
12
+
13
+
14
+func _ready():
15
+	$PanelContainer/VBoxContainer/Header/MenuButton.get_popup().connect("index_pressed", self, '_on_timeline_selected')
16
+
17
+
18
+func load_data(data):
19
+	event_data = data
20
+	if event_data['change_timeline'] != '':
21
+		for c in DialogicUtil.get_timeline_list():
22
+			if c['file'] == event_data['change_timeline']:
23
+				$PanelContainer/VBoxContainer/Header/MenuButton.text = c['name']
24
+
25
+
26
+func _on_MenuButton_about_to_show():
27
+	var Dropdown = $PanelContainer/VBoxContainer/Header/MenuButton
28
+	Dropdown.get_popup().clear()
29
+	var index = 0
30
+	for c in DialogicUtil.get_timeline_list():
31
+		if c['file'].replace('.json', '') == DialogicUtil.get_filename_from_path(editor_reference.get_node('MainPanel/TimelineEditor').working_timeline_file):
32
+			Dropdown.get_popup().add_item('(Current) ' + c['name'])
33
+		else:
34
+			Dropdown.get_popup().add_item(c['name'])
35
+		Dropdown.get_popup().set_item_metadata(index, {'file': c['file'], 'color': c['color']})
36
+		index += 1
37
+
38
+
39
+func _on_timeline_selected(index):
40
+	var text = $PanelContainer/VBoxContainer/Header/MenuButton.get_popup().get_item_text(index)
41
+	var metadata = $PanelContainer/VBoxContainer/Header/MenuButton.get_popup().get_item_metadata(index)
42
+	$PanelContainer/VBoxContainer/Header/MenuButton.text = text
43
+	event_data['change_timeline'] = metadata['file']

+ 97
- 0
addons/dialogic/Editor/Pieces/ChangeTimeline.tscn View File

@@ -0,0 +1,97 @@
1
+[gd_scene load_steps=6 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Pieces/ChangeTimeline.gd" type="Script" id=1]
4
+[ext_resource path="res://addons/dialogic/Images/change-timeline.svg" type="Texture" id=3]
5
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
6
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
7
+
8
+[sub_resource type="StyleBoxFlat" id=1]
9
+content_margin_left = 16.0
10
+content_margin_right = 6.0
11
+content_margin_top = 6.0
12
+content_margin_bottom = 6.0
13
+bg_color = Color( 0.435294, 0.301961, 0.603922, 0.192157 )
14
+border_width_left = 2
15
+border_width_top = 2
16
+border_width_right = 2
17
+border_width_bottom = 2
18
+border_color = Color( 0.12549, 0.12549, 0.12549, 1 )
19
+corner_radius_top_left = 6
20
+corner_radius_top_right = 6
21
+corner_radius_bottom_right = 6
22
+corner_radius_bottom_left = 6
23
+
24
+[node name="ChangeTimelineBlock" type="HBoxContainer"]
25
+margin_right = 1798.0
26
+margin_bottom = 42.0
27
+size_flags_horizontal = 3
28
+size_flags_vertical = 9
29
+script = ExtResource( 1 )
30
+__meta__ = {
31
+"_edit_use_anchors_": false
32
+}
33
+
34
+[node name="Indent" type="Control" parent="."]
35
+visible = false
36
+margin_bottom = 42.0
37
+
38
+[node name="PanelContainer" type="PanelContainer" parent="."]
39
+margin_right = 1798.0
40
+margin_bottom = 42.0
41
+mouse_filter = 1
42
+size_flags_horizontal = 3
43
+size_flags_vertical = 3
44
+custom_styles/panel = SubResource( 1 )
45
+
46
+[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
47
+margin_left = 16.0
48
+margin_top = 6.0
49
+margin_right = 1792.0
50
+margin_bottom = 36.0
51
+size_flags_horizontal = 3
52
+
53
+[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
54
+margin_right = 1776.0
55
+margin_bottom = 28.0
56
+
57
+[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
58
+margin_right = 22.0
59
+margin_bottom = 28.0
60
+texture = ExtResource( 3 )
61
+stretch_mode = 6
62
+
63
+[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
64
+margin_left = 26.0
65
+margin_top = 7.0
66
+margin_right = 140.0
67
+margin_bottom = 21.0
68
+text = "  Change Timeline"
69
+
70
+[node name="MenuButton" type="MenuButton" parent="PanelContainer/VBoxContainer/Header"]
71
+margin_left = 144.0
72
+margin_right = 263.0
73
+margin_bottom = 28.0
74
+text = "[Select Timeline]"
75
+
76
+[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
77
+margin_left = 267.0
78
+margin_top = 7.0
79
+margin_right = 267.0
80
+margin_bottom = 21.0
81
+custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
82
+
83
+[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
84
+margin_left = 271.0
85
+margin_right = 1735.0
86
+margin_bottom = 28.0
87
+size_flags_horizontal = 3
88
+
89
+[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
90
+margin_left = 1739.0
91
+margin_right = 1776.0
92
+margin_bottom = 28.0
93
+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 ]
94
+
95
+[node name="DragController" parent="." instance=ExtResource( 5 )]
96
+
97
+[connection signal="about_to_show" from="PanelContainer/VBoxContainer/Header/MenuButton" to="." method="_on_MenuButton_about_to_show"]

+ 87
- 0
addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd View File

@@ -0,0 +1,87 @@
1
+tool
2
+extends Control
3
+
4
+var editor_reference
5
+onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
6
+
7
+var current_color = Color('#ffffff')
8
+var default_icon_color = Color("#65989898")
9
+
10
+# This is the information of this event and it will get parsed and saved to the JSON file.
11
+var event_data = {
12
+	'action': 'join',
13
+	'character': '',
14
+	'portrait': '',
15
+	'position': {"0":false,"1":false,"2":false,"3":false,"4":false}
16
+}
17
+
18
+
19
+func _ready():
20
+	for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
21
+		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
25
+
26
+
27
+func _on_character_selected(data):
28
+	# 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'])
49
+
50
+
51
+func position_button_pressed(name):
52
+	clear_all_positions()
53
+	var selected_index = name.split('-')[1]
54
+	var button = $PanelContainer/VBoxContainer/Header/PositionsContainer.get_node('position-' + selected_index)
55
+	button.set('self_modulate', Color("#ffffff"))
56
+	button.set('self_modulate', current_color)
57
+	button.pressed = true
58
+	event_data['position'][selected_index] = true
59
+
60
+
61
+func clear_all_positions():
62
+	for i in range(5):
63
+		event_data['position'][str(i)] = false
64
+	for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
65
+		p.set('self_modulate', default_icon_color)
66
+		p.pressed = false
67
+
68
+
69
+func check_active_position(active_color = Color("#ffffff")):
70
+	var index = 0
71
+	for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
72
+		if event_data['position'][str(index)]:
73
+			p.pressed = true
74
+			p.set('self_modulate', active_color)
75
+		index += 1
76
+
77
+
78
+func load_data(data):
79
+	event_data = data
80
+	if data['character'] != '':
81
+		var character_data = DialogicUtil.load_json(DialogicUtil.get_path('CHAR_DIR', 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'])
85
+		check_active_position(current_color)
86
+		return
87
+	check_active_position()

+ 138
- 0
addons/dialogic/Editor/Pieces/CharacterJoinBlock.tscn View File

@@ -0,0 +1,138 @@
1
+[gd_scene load_steps=9 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
4
+[ext_resource path="res://addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd" type="Script" id=3]
5
+[ext_resource path="res://addons/dialogic/Images/character-join.svg" type="Texture" id=4]
6
+[ext_resource path="res://addons/dialogic/Images/character.svg" type="Texture" id=5]
7
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=6]
8
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PortraitPicker.tscn" type="PackedScene" id=7]
9
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CharacterPicker.tscn" type="PackedScene" id=8]
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.14902, 0.521569, 0.298039, 0.266667 )
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="CharacterJoinBlock" type="HBoxContainer"]
28
+margin_right = 1798.0
29
+margin_bottom = 42.0
30
+size_flags_horizontal = 3
31
+size_flags_vertical = 9
32
+script = ExtResource( 3 )
33
+__meta__ = {
34
+"_edit_use_anchors_": false
35
+}
36
+
37
+[node name="Indent" type="Control" parent="."]
38
+visible = false
39
+margin_bottom = 44.0
40
+
41
+[node name="PanelContainer" type="PanelContainer" parent="."]
42
+margin_right = 1798.0
43
+margin_bottom = 42.0
44
+mouse_filter = 1
45
+size_flags_horizontal = 3
46
+custom_styles/panel = SubResource( 1 )
47
+
48
+[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
49
+margin_left = 16.0
50
+margin_top = 6.0
51
+margin_right = 1792.0
52
+margin_bottom = 36.0