Browse Source

update dialogic to 1.1pre

Arnaud Vergnet 7 months ago
parent
commit
5fc8d1426b
99 changed files with 2867 additions and 901 deletions
  1. 5
    5
      addons/dialogic/Dialog.tscn
  2. 1
    1
      addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd
  3. 1
    1
      addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd
  4. 53
    19
      addons/dialogic/Editor/EditorView.gd
  5. 72
    81
      addons/dialogic/Editor/EditorView.tscn
  6. 142
    22
      addons/dialogic/Editor/MasterTree/MasterTree.gd
  7. 93
    0
      addons/dialogic/Editor/Pieces/CallNode.gd
  8. 143
    0
      addons/dialogic/Editor/Pieces/CallNode.tscn
  9. 3
    4
      addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.gd
  10. 1
    1
      addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn
  11. 8
    0
      addons/dialogic/Editor/Pieces/Common/SpinBoxPreventDnD.gd
  12. 2
    1
      addons/dialogic/Editor/Pieces/IfCondition.tscn
  13. 3
    3
      addons/dialogic/Editor/Pieces/SceneEvent.gd
  14. 26
    1
      addons/dialogic/Editor/Pieces/TextBlock.gd
  15. 5
    2
      addons/dialogic/Editor/Pieces/TextBlock.tscn
  16. 3
    1
      addons/dialogic/Editor/Pieces/WaitSeconds.tscn
  17. 10
    0
      addons/dialogic/Editor/SettingsEditor/SettingsEditor.gd
  18. 39
    18
      addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn
  19. 207
    52
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd
  20. 512
    486
      addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn
  21. 16
    0
      addons/dialogic/Editor/TimelineEditor/EventButton.gd
  22. 139
    0
      addons/dialogic/Editor/TimelineEditor/TimelineArea.gd
  23. 180
    8
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd
  24. 132
    85
      addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn
  25. 4
    0
      addons/dialogic/Images/Resources/character-1.25.svg
  26. 34
    0
      addons/dialogic/Images/Resources/character-1.25.svg.import
  27. 4
    0
      addons/dialogic/Images/Resources/character-2.svg
  28. 34
    0
      addons/dialogic/Images/Resources/character-2.svg.import
  29. 4
    0
      addons/dialogic/Images/Resources/character.svg
  30. 3
    3
      addons/dialogic/Images/Resources/character.svg.import
  31. 3
    0
      addons/dialogic/Images/Resources/definition-1.25.svg
  32. 34
    0
      addons/dialogic/Images/Resources/definition-1.25.svg.import
  33. 3
    0
      addons/dialogic/Images/Resources/definition-2.svg
  34. 34
    0
      addons/dialogic/Images/Resources/definition-2.svg.import
  35. 2
    2
      addons/dialogic/Images/Resources/definition.svg
  36. 3
    0
      addons/dialogic/Images/Resources/glossary-1.25.svg
  37. 34
    0
      addons/dialogic/Images/Resources/glossary-1.25.svg.import
  38. 3
    0
      addons/dialogic/Images/Resources/glossary-2.svg
  39. 34
    0
      addons/dialogic/Images/Resources/glossary-2.svg.import
  40. 2
    2
      addons/dialogic/Images/Resources/glossary.svg
  41. 4
    0
      addons/dialogic/Images/Resources/theme-1.25.svg
  42. 34
    0
      addons/dialogic/Images/Resources/theme-1.25.svg.import
  43. 4
    0
      addons/dialogic/Images/Resources/theme-2.svg
  44. 3
    3
      addons/dialogic/Images/Resources/theme-2.svg.import
  45. 3
    3
      addons/dialogic/Images/Resources/theme.svg
  46. 6
    0
      addons/dialogic/Images/Resources/timeline-1.25.svg
  47. 34
    0
      addons/dialogic/Images/Resources/timeline-1.25.svg.import
  48. 6
    0
      addons/dialogic/Images/Resources/timeline-2.svg
  49. 34
    0
      addons/dialogic/Images/Resources/timeline-2.svg.import
  50. 7
    0
      addons/dialogic/Images/Resources/timeline.svg
  51. 3
    3
      addons/dialogic/Images/Resources/timeline.svg.import
  52. 4
    0
      addons/dialogic/Images/Toolbar/add-character-1.25.svg
  53. 34
    0
      addons/dialogic/Images/Toolbar/add-character-1.25.svg.import
  54. 4
    0
      addons/dialogic/Images/Toolbar/add-character-2.svg
  55. 34
    0
      addons/dialogic/Images/Toolbar/add-character-2.svg.import
  56. 3
    3
      addons/dialogic/Images/Toolbar/add-character.svg
  57. 4
    0
      addons/dialogic/Images/Toolbar/add-definition-1.25.svg
  58. 34
    0
      addons/dialogic/Images/Toolbar/add-definition-1.25.svg.import
  59. 4
    0
      addons/dialogic/Images/Toolbar/add-definition-2.svg
  60. 34
    0
      addons/dialogic/Images/Toolbar/add-definition-2.svg.import
  61. 3
    3
      addons/dialogic/Images/Toolbar/add-definition.svg
  62. 4
    0
      addons/dialogic/Images/Toolbar/add-glossary-1.25.svg
  63. 34
    0
      addons/dialogic/Images/Toolbar/add-glossary-1.25.svg.import
  64. 4
    0
      addons/dialogic/Images/Toolbar/add-glossary-2.svg
  65. 34
    0
      addons/dialogic/Images/Toolbar/add-glossary-2.svg.import
  66. 4
    0
      addons/dialogic/Images/Toolbar/add-glossary.svg
  67. 34
    0
      addons/dialogic/Images/Toolbar/add-glossary.svg.import
  68. 5
    0
      addons/dialogic/Images/Toolbar/add-theme-1.25.svg
  69. 34
    0
      addons/dialogic/Images/Toolbar/add-theme-1.25.svg.import
  70. 5
    0
      addons/dialogic/Images/Toolbar/add-theme-2.svg
  71. 34
    0
      addons/dialogic/Images/Toolbar/add-theme-2.svg.import
  72. 4
    4
      addons/dialogic/Images/Toolbar/add-theme.svg
  73. 7
    0
      addons/dialogic/Images/Toolbar/add-timeline-1.25.svg
  74. 34
    0
      addons/dialogic/Images/Toolbar/add-timeline-1.25.svg.import
  75. 7
    0
      addons/dialogic/Images/Toolbar/add-timeline-2.svg
  76. 34
    0
      addons/dialogic/Images/Toolbar/add-timeline-2.svg.import
  77. 6
    6
      addons/dialogic/Images/Toolbar/add-timeline.svg
  78. 0
    1
      addons/dialogic/Images/Tools.svg
  79. 0
    5
      addons/dialogic/Images/icon.svg
  80. BIN
      addons/dialogic/Images/logo.png
  81. 129
    50
      addons/dialogic/Nodes/dialog_node.gd
  82. 38
    2
      addons/dialogic/Other/DialogicResources.gd
  83. 16
    1
      addons/dialogic/Other/inspector_timeline_picker.gd
  84. 57
    5
      addons/dialogic/Other/timeline_picker.gd
  85. 2
    0
      addons/dialogic/dialogic.gd
  86. 1
    1
      addons/dialogic/plugin.cfg
  87. 1
    1
      dialogic/characters/character-1616658471.json
  88. 1
    1
      dialogic/timelines/timeline-1616656510.json
  89. 1
    1
      dialogic/timelines/timeline-1616657347.json
  90. 1
    1
      dialogic/timelines/timeline-1616659153.json
  91. 1
    1
      dialogic/timelines/timeline-1616659306.json
  92. 1
    1
      dialogic/timelines/timeline-1616659917.json
  93. 1
    1
      dialogic/timelines/timeline-1616660188.json
  94. 1
    1
      dialogic/timelines/timeline-1616660446.json
  95. 1
    1
      dialogic/timelines/timeline-1616660984.json
  96. 1
    1
      dialogic/timelines/timeline-1616661304.json
  97. 1
    1
      dialogic/timelines/timeline-1616661658.json
  98. 1
    1
      dialogic/timelines/timeline-1616661685.json
  99. 1
    1
      dialogic/timelines/timeline-1616662258.json

+ 5
- 5
addons/dialogic/Dialog.tscn View File

@@ -87,9 +87,9 @@ anchor_left = 0.5
87 87
 anchor_top = 1.0
88 88
 anchor_right = 0.5
89 89
 anchor_bottom = 1.0
90
-margin_left = -455.0
90
+margin_left = -250.0
91 91
 margin_top = -207.0
92
-margin_right = 455.0
92
+margin_right = 250.0
93 93
 margin_bottom = -40.0
94 94
 __meta__ = {
95 95
 "_edit_use_anchors_": false
@@ -136,8 +136,6 @@ __meta__ = {
136 136
 "_edit_use_anchors_": false
137 137
 }
138 138
 
139
-[node name="Tween" type="Tween" parent="TextBubble"]
140
-
141 139
 [node name="NextIndicator" type="TextureRect" parent="TextBubble"]
142 140
 visible = false
143 141
 anchor_left = 1.0
@@ -203,6 +201,8 @@ __meta__ = {
203 201
 "_edit_use_anchors_": false
204 202
 }
205 203
 
204
+[node name="Tween" type="Tween" parent="TextBubble"]
205
+
206 206
 [node name="Options" type="VBoxContainer" parent="."]
207 207
 anchor_left = 0.5
208 208
 anchor_top = 0.5
@@ -340,8 +340,8 @@ __meta__ = {
340 340
 [node name="Timer" type="Timer" parent="DefinitionInfo"]
341 341
 
342 342
 [node name="WaitSeconds" type="Timer" parent="."]
343
+
343 344
 [connection signal="meta_hover_ended" from="TextBubble/RichTextLabel" to="." method="_on_RichTextLabel_meta_hover_ended"]
344 345
 [connection signal="meta_hover_started" from="TextBubble/RichTextLabel" to="." method="_on_RichTextLabel_meta_hover_started"]
345
-[connection signal="tween_completed" from="TextBubble/Tween" to="." method="_on_Tween_tween_completed"]
346 346
 [connection signal="timeout" from="DefinitionInfo/Timer" to="." method="_on_Definition_Timer_timeout"]
347 347
 [connection signal="timeout" from="WaitSeconds" to="." method="_on_WaitSeconds_timeout"]

+ 1
- 1
addons/dialogic/Editor/CharacterEditor/CharacterEditor.gd View File

@@ -2,7 +2,7 @@ tool
2 2
 extends ScrollContainer
3 3
 
4 4
 var editor_reference
5
-onready var master_tree = get_node('../MasterTree')
5
+onready var master_tree = get_node('../MasterTreeContainer/MasterTree')
6 6
 var opened_character_data
7 7
 var portrait_entry = load("res://addons/dialogic/Editor/CharacterEditor/PortraitEntry.tscn")
8 8
 onready var nodes = {

+ 1
- 1
addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.gd View File

@@ -2,7 +2,7 @@ tool
2 2
 extends ScrollContainer
3 3
 
4 4
 var editor_reference
5
-onready var master_tree = get_node('../MasterTree')
5
+onready var master_tree = get_node('../MasterTreeContainer/MasterTree')
6 6
 var current_definition = null
7 7
 
8 8
 onready var nodes = {

+ 53
- 19
addons/dialogic/Editor/EditorView.gd View File

@@ -6,7 +6,7 @@ var editor_file_dialog # EditorFileDialog
6 6
 var file_picker_data: Dictionary = {'method': '', 'node': self}
7 7
 var current_editor_view: String = 'Master'
8 8
 var version_string: String 
9
-onready var master_tree = $MainPanel/MasterTree
9
+onready var master_tree = $MainPanel/MasterTreeContainer/MasterTree
10 10
 onready var timeline_editor = $MainPanel/TimelineEditor
11 11
 onready var character_editor = $MainPanel/CharacterEditor
12 12
 onready var definition_editor = $MainPanel/DefinitionEditor
@@ -27,6 +27,40 @@ func _ready():
27 27
 
28 28
 	master_tree.connect("editor_selected", self, 'on_master_tree_editor_selected')
29 29
 
30
+	
31
+	# Sizes
32
+	# This part of the code is a bit terrible. But there is no better way
33
+	# of doing this in Godot at the moment. I'm sorry.
34
+	var separation = get_constant("separation", "BoxContainer")
35
+	$MainPanel.margin_left = separation
36
+	$MainPanel.margin_right = separation * -1
37
+	$MainPanel.margin_bottom = separation * -1
38
+	$MainPanel.margin_top = 38
39
+	var modifier = ''
40
+	var _scale = get_constant("inspector_margin", "Editor")
41
+	_scale = _scale * 0.125
42
+	if _scale == 1:
43
+		$MainPanel.margin_top = 30
44
+	if _scale == 1.25:
45
+		modifier = '-1.25'
46
+		$MainPanel.margin_top = 37
47
+	if _scale == 1.5:
48
+		modifier = '-1.25'
49
+		$MainPanel.margin_top = 46
50
+	if _scale == 1.75:
51
+		modifier = '-1.25'
52
+		$MainPanel.margin_top = 53
53
+	if _scale == 2:
54
+		$MainPanel.margin_top = 59
55
+		modifier = '-2'
56
+	$ToolBar/NewTimelineButton.icon = load("res://addons/dialogic/Images/Toolbar/add-timeline" + modifier + ".svg")
57
+	$ToolBar/NewCharactersButton.icon = load("res://addons/dialogic/Images/Toolbar/add-character" + modifier + ".svg")
58
+	$ToolBar/NewDefinitionButton.icon = load("res://addons/dialogic/Images/Toolbar/add-definition" + modifier + ".svg")
59
+	$ToolBar/NewThemeButton.icon = load("res://addons/dialogic/Images/Toolbar/add-theme" + modifier + ".svg")
60
+	$ToolBar/NewThemeButton.icon = load("res://addons/dialogic/Images/Toolbar/add-theme" + modifier + ".svg")
61
+	
62
+	$ToolBar/FoldTools/ButtonFold.icon = get_icon("GuiTreeArrowRight", "EditorIcons")
63
+	$ToolBar/FoldTools/ButtonUnfold.icon = get_icon("GuiTreeArrowDown", "EditorIcons")
30 64
 	# Toolbar
31 65
 	$ToolBar/NewTimelineButton.connect('pressed', $MainPanel/TimelineEditor, 'new_timeline')
32 66
 	$ToolBar/NewCharactersButton.connect('pressed', $MainPanel/CharacterEditor, 'new_character')
@@ -55,7 +89,9 @@ func _ready():
55 89
 	var err = config.load("res://addons/dialogic/plugin.cfg")
56 90
 	if err == OK:
57 91
 		version_string = config.get_value("plugin", "version", "?")
58
-		$ToolBar/Version.text = 'v' + version_string
92
+		$ToolBar/Version.text = 'Dialogic v' + version_string
93
+		
94
+	$MainPanel/MasterTreeContainer/FilterMasterTreeEdit.right_icon = get_icon("Search", "EditorIcons")
59 95
 
60 96
 
61 97
 func on_master_tree_editor_selected(editor: String):
@@ -75,10 +111,10 @@ func _on_TimelinePopupMenu_id_pressed(id):
75 111
 func _on_RemoveTimelineConfirmation_confirmed():
76 112
 	var dir = Directory.new()
77 113
 	var target = $MainPanel/TimelineEditor.timeline_file
78
-	print('target: ', target)
114
+	#'target: ', target)
79 115
 	DialogicResources.delete_timeline(target)
80
-	$MainPanel/MasterTree.remove_selected()
81
-	$MainPanel/MasterTree.hide_all_editors()
116
+	$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
117
+	$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
82 118
 
83 119
 
84 120
 # Character context menu
@@ -95,6 +131,10 @@ func _on_ThemePopupMenu_id_pressed(id):
95 131
 		OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('THEME_DIR')))
96 132
 	if id == 1:
97 133
 		$RemoveThemeConfirmation.popup_centered()
134
+	if id == 2:
135
+		var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file']
136
+		if (filename.begins_with('theme-')):
137
+			theme_editor.duplicate_theme(filename)
98 138
 
99 139
 
100 140
 # Definition context menu
@@ -108,22 +148,22 @@ func _on_DefinitionPopupMenu_id_pressed(id):
108 148
 func _on_RemoveDefinitionConfirmation_confirmed():
109 149
 	var target = $MainPanel/DefinitionEditor.current_definition['id']
110 150
 	DialogicResources.delete_default_definition(target)
111
-	$MainPanel/MasterTree.remove_selected()
112
-	$MainPanel/MasterTree.hide_all_editors()
151
+	$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
152
+	$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
113 153
 
114 154
 
115 155
 func _on_RemoveCharacterConfirmation_confirmed():
116
-	var filename = DialogicResources.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id']) 
156
+	var filename = $MainPanel/CharacterEditor.opened_character_data['id']
117 157
 	DialogicResources.delete_character(filename)
118
-	$MainPanel/MasterTree.remove_selected()
119
-	$MainPanel/MasterTree.hide_all_editors()
158
+	$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
159
+	$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
120 160
 
121 161
 
122 162
 func _on_RemoveThemeConfirmation_confirmed():
123
-	var filename = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
163
+	var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file']
124 164
 	DialogicResources.delete_theme(filename)
125
-	$MainPanel/MasterTree.remove_selected()
126
-	$MainPanel/MasterTree.hide_all_editors()
165
+	$MainPanel/MasterTreeContainer/MasterTree.remove_selected()
166
+	$MainPanel/MasterTreeContainer/MasterTree.hide_all_editors()
127 167
 
128 168
 
129 169
 # Godot dialog
@@ -157,12 +197,6 @@ func _on_file_selected(path):
157 197
 	dprint(path)
158 198
 
159 199
 
160
-func _on_Logo_gui_input(event) -> void:
161
-	# I should probably replace this with an "About Dialogic" dialog
162
-	if event is InputEventMouseButton and event.button_index == 1:
163
-		OS.shell_open("https://github.com/coppolaemilio/dialogic")
164
-
165
-
166 200
 func dprint(what) -> void:
167 201
 	if debug_mode:
168 202
 		print(what)

+ 72
- 81
addons/dialogic/Editor/EditorView.tscn View File

@@ -1,24 +1,21 @@
1
-[gd_scene load_steps=20 format=2]
1
+[gd_scene load_steps=17 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Editor/EditorView.gd" type="Script" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn" type="PackedScene" id=2]
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]
5
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-character.svg" type="Texture" id=3]
6
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-timeline.svg" type="Texture" id=4]
7
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-definition.svg" type="Texture" id=5]
8 8
 [ext_resource path="res://addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn" type="PackedScene" id=6]
9 9
 [ext_resource path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn" type="PackedScene" id=7]
10 10
 [ext_resource path="res://addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn" type="PackedScene" id=8]
11
-[ext_resource path="res://addons/dialogic/Images/open-icon.svg" type="Texture" id=9]
12
-[ext_resource path="res://addons/dialogic/Images/closed-icon.svg" type="Texture" id=10]
13 11
 [ext_resource path="res://addons/dialogic/Images/ActionCopy.svg" type="Texture" id=11]
14 12
 [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]
13
+[ext_resource path="res://addons/dialogic/Images/Toolbar/add-theme.svg" type="Texture" id=13]
17 14
 [ext_resource path="res://addons/dialogic/Images/Remove.svg" type="Texture" id=22]
18 15
 [ext_resource path="res://addons/dialogic/Images/Filesystem.svg" type="Texture" id=26]
19 16
 [ext_resource path="res://addons/dialogic/Editor/MasterTree/MasterTree.tscn" type="PackedScene" id=35]
20 17
 
21
-[sub_resource type="Image" id=3]
18
+[sub_resource type="Image" id=1]
22 19
 data = {
23 20
 "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 21
 "format": "LumAlpha8",
@@ -30,16 +27,12 @@ data = {
30 27
 [sub_resource type="ImageTexture" id=2]
31 28
 flags = 4
32 29
 flags = 4
33
-image = SubResource( 3 )
30
+image = SubResource( 1 )
34 31
 size = Vector2( 16, 16 )
35 32
 
36 33
 [node name="EditorView" type="Control"]
37 34
 anchor_right = 1.0
38 35
 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 36
 rect_min_size = Vector2( 0, 200 )
44 37
 size_flags_horizontal = 3
45 38
 size_flags_vertical = 3
@@ -50,7 +43,7 @@ __meta__ = {
50 43
 
51 44
 [node name="ToolBar" type="HBoxContainer" parent="."]
52 45
 anchor_right = 1.0
53
-margin_bottom = 30.0
46
+margin_bottom = 32.0
54 47
 custom_constants/separation = 0
55 48
 __meta__ = {
56 49
 "_edit_use_anchors_": false
@@ -58,119 +51,118 @@ __meta__ = {
58 51
 
59 52
 [node name="NewTimelineButton" type="Button" parent="ToolBar"]
60 53
 self_modulate = Color( 0.870588, 0.870588, 0.870588, 1 )
61
-margin_right = 34.0
62
-margin_bottom = 30.0
54
+margin_right = 28.0
55
+margin_bottom = 32.0
63 56
 hint_tooltip = "New Timeline"
64 57
 focus_mode = 0
65
-icon = ExtResource( 3 )
58
+icon = ExtResource( 4 )
66 59
 flat = true
67 60
 
68 61
 [node name="NewCharactersButton" type="ToolButton" parent="ToolBar"]
69 62
 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
63
+margin_left = 28.0
64
+margin_right = 56.0
65
+margin_bottom = 32.0
73 66
 hint_tooltip = "New Character"
74 67
 focus_mode = 0
75
-icon = ExtResource( 4 )
68
+icon = ExtResource( 3 )
76 69
 
77 70
 [node name="NewDefinitionButton" type="Button" parent="ToolBar"]
78 71
 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
72
+margin_left = 56.0
73
+margin_right = 84.0
74
+margin_bottom = 32.0
82 75
 hint_tooltip = "New Definition"
83 76
 focus_mode = 0
84
-icon = ExtResource( 13 )
77
+icon = ExtResource( 5 )
85 78
 flat = true
86 79
 
87 80
 [node name="NewThemeButton" type="Button" parent="ToolBar"]
88 81
 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
82
+margin_left = 84.0
83
+margin_right = 112.0
84
+margin_bottom = 32.0
92 85
 hint_tooltip = "New Theme"
93 86
 focus_mode = 0
94
-icon = ExtResource( 5 )
87
+icon = ExtResource( 13 )
95 88
 flat = true
96 89
 
97 90
 [node name="FoldTools" type="HBoxContainer" parent="ToolBar"]
98 91
 visible = false
99
-margin_left = 136.0
100
-margin_right = 271.0
101
-margin_bottom = 30.0
92
+margin_left = 112.0
93
+margin_right = 203.0
94
+margin_bottom = 32.0
102 95
 
103 96
 [node name="Label" type="Label" parent="ToolBar/FoldTools"]
104
-margin_top = 8.0
97
+margin_top = 9.0
105 98
 margin_right = 59.0
106
-margin_bottom = 22.0
99
+margin_bottom = 23.0
107 100
 text = "      Fold  "
108 101
 
109
-[node name="ButtonFold" type="Button" parent="ToolBar/FoldTools"]
102
+[node name="ButtonFold" type="ToolButton" parent="ToolBar/FoldTools"]
110 103
 margin_left = 63.0
111
-margin_right = 97.0
112
-margin_bottom = 30.0
113
-icon = ExtResource( 10 )
104
+margin_right = 75.0
105
+margin_bottom = 32.0
106
+icon = SubResource( 2 )
114 107
 align = 0
115 108
 
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 )
109
+[node name="ButtonUnfold" type="ToolButton" parent="ToolBar/FoldTools"]
110
+margin_left = 79.0
111
+margin_right = 91.0
112
+margin_bottom = 32.0
113
+icon = SubResource( 2 )
121 114
 align = 0
122 115
 
123 116
 [node name="Spacer" type="Control" parent="ToolBar"]
124
-margin_left = 136.0
125
-margin_right = 751.0
126
-margin_bottom = 30.0
117
+margin_left = 112.0
118
+margin_right = 832.0
119
+margin_bottom = 32.0
127 120
 size_flags_horizontal = 3
128 121
 
129 122
 [node name="Docs" type="ToolButton" parent="ToolBar"]
130 123
 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
124
+margin_left = 832.0
125
+margin_right = 942.0
126
+margin_bottom = 32.0
134 127
 hint_tooltip = "Theme Editor"
135 128
 mouse_default_cursor_shape = 2
136 129
 text = "Online Docs"
137 130
 icon = SubResource( 2 )
138 131
 
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 132
 [node name="Version" type="Label" parent="ToolBar"]
150 133
 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"
134
+margin_left = 942.0
135
+margin_top = 9.0
136
+margin_right = 1024.0
137
+margin_bottom = 23.0
138
+text = "Dialogic v1.1"
156 139
 
157 140
 [node name="MainPanel" type="HSplitContainer" parent="."]
158 141
 anchor_right = 1.0
159 142
 anchor_bottom = 1.0
160
-margin_left = 6.0
161 143
 margin_top = 38.0
162
-margin_right = -5.0
163
-margin_bottom = -5.0
164 144
 __meta__ = {
165 145
 "_edit_use_anchors_": false
166 146
 }
167 147
 
168
-[node name="MasterTree" parent="MainPanel" instance=ExtResource( 35 )]
148
+[node name="MasterTreeContainer" type="VBoxContainer" parent="MainPanel"]
149
+margin_right = 150.0
150
+margin_bottom = 562.0
151
+
152
+[node name="FilterMasterTreeEdit" type="LineEdit" parent="MainPanel/MasterTreeContainer"]
153
+margin_right = 150.0
154
+margin_bottom = 26.0
155
+clear_button_enabled = true
156
+right_icon = SubResource( 2 )
157
+placeholder_text = "Filter"
158
+
159
+[node name="MasterTree" parent="MainPanel/MasterTreeContainer" instance=ExtResource( 35 )]
169 160
 anchor_right = 0.0
170 161
 anchor_bottom = 0.0
171
-margin_right = 180.0
172
-margin_bottom = 541.0
173
-rect_min_size = Vector2( 180, 0 )
162
+margin_top = 30.0
163
+margin_right = 150.0
164
+margin_bottom = 562.0
165
+rect_min_size = Vector2( 150, 0 )
174 166
 size_flags_vertical = 3
175 167
 
176 168
 [node name="TimelineEditor" parent="MainPanel" instance=ExtResource( 2 )]
@@ -194,15 +186,15 @@ margin_right = 1253.0
194 186
 margin_bottom = 661.0
195 187
 
196 188
 [node name="Empty" type="CenterContainer" parent="MainPanel"]
197
-margin_left = 192.0
198
-margin_right = 997.0
199
-margin_bottom = 541.0
189
+margin_left = 162.0
190
+margin_right = 1024.0
191
+margin_bottom = 562.0
200 192
 
201 193
 [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
194
+margin_left = 291.0
195
+margin_top = 274.0
196
+margin_right = 571.0
197
+margin_bottom = 288.0
206 198
 
207 199
 [node name="Label" type="Label" parent="MainPanel/Empty/VBoxContainer"]
208 200
 margin_right = 280.0
@@ -234,7 +226,7 @@ margin_left = 171.799
234 226
 margin_top = 209.0
235 227
 margin_right = 267.799
236 228
 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 ]
229
+items = [ "Show in File Manager", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Theme", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false, "Duplicate Theme", ExtResource( 11 ), 0, false, false, 2, 0, null, "", false ]
238 230
 __meta__ = {
239 231
 "_edit_use_anchors_": false
240 232
 }
@@ -298,4 +290,3 @@ dialog_text = "Are you sure you want to remove this timeline?
298 290
 __meta__ = {
299 291
 "_edit_use_anchors_": false
300 292
 }
301
-[connection signal="gui_input" from="ToolBar/Logo" to="." method="_on_Logo_gui_input"]

+ 142
- 22
addons/dialogic/Editor/MasterTree/MasterTree.gd View File

@@ -1,26 +1,31 @@
1 1
 tool
2 2
 extends Tree
3 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')
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
+onready var filter_tree_edit = get_node('../FilterMasterTreeEdit')
11 12
 
12 13
 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 theme_icon = load("res://addons/dialogic/Images/Resources/theme.svg")
16
-var definition_icon = load("res://addons/dialogic/Images/Resources/definition.svg")
17
-var glossary_icon = load("res://addons/dialogic/Images/Resources/glossary.svg")
14
+
15
+var timeline_icon
16
+var character_icon
17
+var theme_icon
18
+var definition_icon
19
+var glossary_icon
20
+
18 21
 var timelines_tree
19 22
 var characters_tree
20 23
 var definitions_tree
21 24
 var themes_tree
22 25
 var settings_tree
23 26
 
27
+var filter_tree_term = ''
28
+
24 29
 signal editor_selected(selected)
25 30
 
26 31
 func _ready():
@@ -28,26 +33,49 @@ func _ready():
28 33
 	var root = tree.create_item()
29 34
 	tree.set_hide_root(true)
30 35
 	
36
+	var modifier = ''
37
+	var _scale = get_constant("inspector_margin", "Editor")
38
+	_scale = _scale * 0.125
39
+	rect_min_size.x = 150
40
+	if _scale == 1.25:
41
+		modifier = '-1.25'
42
+		rect_min_size.x = 180
43
+	if _scale == 1.5:
44
+		modifier = '-1.25'
45
+		rect_min_size.x = 250
46
+	if _scale == 1.75:
47
+		modifier = '-1.25'
48
+		rect_min_size.x = 250
49
+	if _scale == 2:
50
+		modifier = '-2'
51
+		rect_min_size.x = 360
52
+	rect_size.x = 0
53
+	timeline_icon = load("res://addons/dialogic/Images/Resources/timeline" + modifier + ".svg")
54
+	character_icon = load("res://addons/dialogic/Images/Resources/character" + modifier + ".svg")
55
+	theme_icon = load("res://addons/dialogic/Images/Resources/theme" + modifier + ".svg")
56
+	definition_icon = load("res://addons/dialogic/Images/Resources/definition" + modifier + ".svg")
57
+	glossary_icon = load("res://addons/dialogic/Images/Resources/glossary" + modifier + ".svg")
58
+	
31 59
 	# Creating the parents
32 60
 	timelines_tree = tree.create_item(root)
33 61
 	timelines_tree.set_selectable(0, false)
34 62
 	timelines_tree.set_text(0, "Timelines")
35
-	#timelines_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
63
+	timelines_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
36 64
 	
37 65
 	characters_tree = tree.create_item(root)
38 66
 	characters_tree.set_selectable(0, false)
39 67
 	characters_tree.set_text(0, "Characters")
40
-	#characters_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
68
+	characters_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
41 69
 
42 70
 	definitions_tree = tree.create_item(root)
43 71
 	definitions_tree.set_selectable(0, false)
44 72
 	definitions_tree.set_text(0, "Definitions")
45
-	#definitions_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
73
+	definitions_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
46 74
 	
47 75
 	themes_tree = tree.create_item(root)
48 76
 	themes_tree.set_selectable(0, false)
49 77
 	themes_tree.set_text(0, "Themes")
50
-	#themes_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
78
+	themes_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
51 79
 	
52 80
 	settings_tree = tree.create_item(root)
53 81
 	settings_tree.set_selectable(0, true)
@@ -62,6 +90,8 @@ func _ready():
62 90
 	connect('item_edited', self, '_on_item_edited')
63 91
 	$RenamerReset.connect("timeout", self, '_on_renamer_reset_timeout')
64 92
 	
93
+	filter_tree_edit.connect("text_changed", self, '_on_filter_tree_edit_changed')
94
+	
65 95
 	#var subchild1 = tree.create_item(timelines_tree)
66 96
 	#subchild1.set_text(0, "Subchild1")
67 97
 	
@@ -93,7 +123,13 @@ func _clear_tree_children(parent: TreeItem):
93 123
 func build_timelines(selected_item: String=''):
94 124
 	_clear_tree_children(timelines_tree)
95 125
 	for t in DialogicUtil.get_sorted_timeline_list():
96
-		_add_timeline(t, not selected_item.empty() and t['file'] == selected_item)
126
+		if (filter_tree_term != ''):
127
+			if (filter_tree_term.to_lower() in t['file'].to_lower() or filter_tree_term.to_lower() in t['name'].to_lower()):
128
+				_add_timeline(t, not selected_item.empty() and t['file'] == selected_item)
129
+		else:
130
+			_add_timeline(t, not selected_item.empty() and t['file'] == selected_item)
131
+	# force redraw control
132
+	update()
97 133
 
98 134
 
99 135
 func _add_timeline(timeline, select = false):
@@ -115,7 +151,13 @@ func _add_timeline(timeline, select = false):
115 151
 func build_themes(selected_item: String=''):
116 152
 	_clear_tree_children(themes_tree)
117 153
 	for t in DialogicUtil.get_sorted_theme_list():
118
-		_add_theme(t, not selected_item.empty() and t['file'] == selected_item)
154
+		if (filter_tree_term != ''):
155
+			if (filter_tree_term.to_lower() in t['file'].to_lower() or filter_tree_term.to_lower() in t['name'].to_lower()):
156
+				_add_theme(t, not selected_item.empty() and t['file'] == selected_item)
157
+		else:
158
+			_add_theme(t, not selected_item.empty() and t['file'] == selected_item)
159
+	# force redraw tree
160
+	update()
119 161
 
120 162
 
121 163
 func _add_theme(theme_item, select = false):
@@ -133,7 +175,13 @@ func _add_theme(theme_item, select = false):
133 175
 func build_characters(selected_item: String=''):
134 176
 	_clear_tree_children(characters_tree)
135 177
 	for t in DialogicUtil.get_sorted_character_list():
136
-		_add_character(t, not selected_item.empty() and t['file'] == selected_item)
178
+		if (filter_tree_term != ''):
179
+			if (filter_tree_term.to_lower() in t['file'].to_lower() or filter_tree_term.to_lower() in t['name'].to_lower()):
180
+				_add_character(t, not selected_item.empty() and t['file'] == selected_item)
181
+		else:		
182
+			_add_character(t, not selected_item.empty() and t['file'] == selected_item)
183
+	# force redraw tree
184
+	update()
137 185
 
138 186
 
139 187
 func _add_character(character, select = false):
@@ -156,7 +204,13 @@ func _add_character(character, select = false):
156 204
 func build_definitions(selected_item: String=''):
157 205
 	_clear_tree_children(definitions_tree)
158 206
 	for t in DialogicUtil.get_sorted_default_definitions_list():
159
-		_add_definition(t, not selected_item.empty() and t['id'] == selected_item)
207
+		if (filter_tree_term != ''):
208
+			if (filter_tree_term.to_lower() in t['name'].to_lower()):
209
+				_add_definition(t, not selected_item.empty() and t['id'] == selected_item)
210
+		else:		
211
+			_add_definition(t, not selected_item.empty() and t['id'] == selected_item)
212
+	# force redraw tree
213
+	update()
160 214
 
161 215
 
162 216
 func _add_definition(definition, select = false):
@@ -209,6 +263,7 @@ func show_character_editor():
209 263
 	settings_editor.visible = false
210 264
 	empty_editor.visible = false
211 265
 
266
+
212 267
 func show_timeline_editor():
213 268
 	emit_signal("editor_selected", 'timeline')
214 269
 	character_editor.visible = false
@@ -218,6 +273,7 @@ func show_timeline_editor():
218 273
 	settings_editor.visible = false
219 274
 	empty_editor.visible = false
220 275
 
276
+
221 277
 func show_definition_editor():
222 278
 	emit_signal("editor_selected", 'definition')
223 279
 	character_editor.visible = false
@@ -227,6 +283,7 @@ func show_definition_editor():
227 283
 	settings_editor.visible = false
228 284
 	empty_editor.visible = false
229 285
 
286
+
230 287
 func show_theme_editor():
231 288
 	emit_signal("editor_selected", 'theme')
232 289
 	character_editor.visible = false
@@ -236,6 +293,7 @@ func show_theme_editor():
236 293
 	settings_editor.visible = false
237 294
 	empty_editor.visible = false
238 295
 
296
+
239 297
 func show_settings_editor():
240 298
 	emit_signal("editor_selected", 'theme')
241 299
 	character_editor.visible = false
@@ -245,6 +303,7 @@ func show_settings_editor():
245 303
 	settings_editor.visible = true
246 304
 	empty_editor.visible = false
247 305
 
306
+
248 307
 func hide_all_editors():
249 308
 	emit_signal("editor_selected", 'none')
250 309
 	character_editor.visible = false
@@ -279,7 +338,8 @@ func remove_selected():
279 338
 
280 339
 
281 340
 func refresh_timeline_list():
282
-	print('update timeline list')
341
+	#print('update timeline list')
342
+	pass
283 343
 
284 344
 
285 345
 func _on_renamer_reset_timeout():
@@ -296,7 +356,6 @@ func _on_gui_input(event):
296 356
 
297 357
 
298 358
 func _on_item_edited():
299
-	print('edited')
300 359
 	var item = get_selected()
301 360
 	var metadata = item.get_metadata(0)
302 361
 	if metadata['editor'] == 'Timeline':
@@ -320,6 +379,14 @@ func _on_item_edited():
320 379
 
321 380
 func _on_autosave_timeout():
322 381
 	save_current_resource()
382
+	
383
+	
384
+func _on_filter_tree_edit_changed(value):
385
+	filter_tree_term = value
386
+	build_timelines()
387
+	build_themes()
388
+	build_characters()
389
+	build_definitions()
323 390
 
324 391
 
325 392
 func save_current_resource():
@@ -336,3 +403,56 @@ func save_current_resource():
336 403
 			if metadata['editor'] == 'Definition':
337 404
 				definition_editor.save_definition()
338 405
 			# Note: Theme files auto saves on change
406
+
407
+
408
+func select_timeline_item(timeline_name):
409
+	if (timeline_name == ''):
410
+		return
411
+
412
+	var main_item = tree.get_root().get_children()
413
+	
414
+	# wow, godots tree traversal is extremly odd, or I just don't get it
415
+	while (main_item):
416
+		
417
+		if (main_item == null):
418
+			break
419
+			
420
+		if (main_item.has_method("get_text") && main_item.get_text(0) == "Timelines"):
421
+			var item = main_item.get_children()
422
+			while (item):
423
+							
424
+				if (not item.has_method("get_metadata")):
425
+					item = item.get_next()
426
+					continue
427
+			
428
+				var meta = item.get_metadata(0)
429
+		
430
+				if (meta == null):
431
+					item = item.get_next()
432
+					continue
433
+		
434
+				if (not meta.has("editor") or meta["editor"] != "Timeline"):
435
+					item = item.get_next()
436
+					continue
437
+			
438
+				# search for filename
439
+				if (meta.has("file") and meta["file"] == timeline_name):
440
+					# select this one
441
+					item.select(0)
442
+					return;
443
+			
444
+				# search for name
445
+				if (meta.has("name") and meta["name"] == timeline_name):
446
+					# select this one
447
+					item.select(0)
448
+					return;
449
+	
450
+				item = item.get_next()
451
+			break
452
+		else:
453
+			main_item = main_item.get_next()
454
+			
455
+	# fallback
456
+	hide_all_editors()
457
+	pass
458
+

+ 93
- 0
addons/dialogic/Editor/Pieces/CallNode.gd View File

@@ -0,0 +1,93 @@
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
+	'call_node': {
11
+		'target_node_path': '',
12
+		'method_name': '',
13
+		'arguments': []
14
+	}
15
+}
16
+
17
+
18
+func load_data(data):
19
+	event_data = data
20
+	
21
+	if (not event_data['call_node']['arguments'] is Array):
22
+		event_data['call_node']['arguments'] = []
23
+	
24
+	for i in range(event_data['call_node']['arguments'].size()):
25
+		if (event_data['call_node']['arguments'][i] == null):
26
+			event_data['call_node']['arguments'][i] = ''
27
+	
28
+	$PanelContainer/VBoxContainer/Properties/TargetNodeEdit.text = event_data['call_node']['target_node_path']
29
+	$PanelContainer/VBoxContainer/Properties/CallMethodEdit.text = event_data['call_node']['method_name']
30
+	$PanelContainer/VBoxContainer/Properties/ArgumentsSpinBox.value = event_data['call_node']['arguments'].size()
31
+	
32
+	_create_argument_controls()
33
+
34
+
35
+# signal callbacks
36
+
37
+func _on_Target_LineEdit_text_changed(new_text):
38
+	event_data['call_node']['target_node_path'] = new_text
39
+	
40
+func _on_Method_LineEdit_text_changed(new_text):
41
+	event_data['call_node']['method_name'] = new_text
42
+
43
+func _on_ArgumentsSpinBox_value_changed(value):
44
+	event_data['call_node']['arguments'].resize(max(0, value))
45
+	
46
+	for i in range(event_data['call_node']['arguments'].size()):
47
+		if (event_data['call_node']['arguments'][i] == null):
48
+			event_data['call_node']['arguments'][i] = ''
49
+			
50
+	_create_argument_controls()
51
+	pass
52
+	
53
+func _on_argument_value_changed(value, arg_index):
54
+	if (arg_index < 0 or arg_index >= event_data['call_node']['arguments'].size()):
55
+		return
56
+		
57
+	event_data['call_node']['arguments'][arg_index] = str(value)
58
+	pass
59
+	
60
+# helpers
61
+func _create_argument_controls():
62
+	if (not event_data['call_node']['arguments'] is Array):
63
+		return
64
+		
65
+	# clear old
66
+	for c in $PanelContainer/VBoxContainer/Arguments.get_children():
67
+		$PanelContainer/VBoxContainer/Arguments.remove_child(c)
68
+		c.queue_free()
69
+		
70
+	# create controls
71
+	var index = 0
72
+	for a in event_data['call_node']['arguments']:
73
+		var container = HBoxContainer.new()
74
+		container.name = "Argument%s" % index
75
+		
76
+		var label = Label.new()
77
+		label.name = "ArgumentLabel"
78
+		label.text = "Argument %s:" % index
79
+		label.rect_min_size.x = 100
80
+		container.add_child(label)
81
+		
82
+		var edit = LineEdit.new()
83
+		edit.name = "ArgumentValue"
84
+		edit.text = str(a)
85
+		edit.connect("text_changed", self, "_on_argument_value_changed", [ index ])
86
+		edit.rect_min_size.x = 250
87
+		container.add_child(edit)
88
+		
89
+		$PanelContainer/VBoxContainer/Arguments.add_child(container)
90
+		
91
+		index += 1
92
+		
93
+	pass

+ 143
- 0
addons/dialogic/Editor/Pieces/CallNode.tscn View File

@@ -0,0 +1,143 @@
1
+[gd_scene load_steps=6 format=2]
2
+
3
+[ext_resource path="res://addons/dialogic/Images/Script.svg" type="Texture" id=1]
4
+[ext_resource path="res://addons/dialogic/Editor/Pieces/CallNode.gd" type="Script" id=2]
5
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
6
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
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="CallNode" type="HBoxContainer"]
25
+margin_right = 1004.0
26
+margin_bottom = 100.0
27
+size_flags_horizontal = 3
28
+size_flags_vertical = 9
29
+script = ExtResource( 2 )
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 = 1004.0
40
+margin_bottom = 100.0
41
+mouse_filter = 1
42
+size_flags_horizontal = 3
43
+size_flags_vertical = 3
44
+custom_styles/panel = SubResource( 1 )
45
+__meta__ = {
46
+"_edit_use_anchors_": false
47
+}
48
+
49
+[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
50
+margin_left = 16.0
51
+margin_top = 6.0
52
+margin_right = 998.0
53
+margin_bottom = 94.0
54
+size_flags_horizontal = 3
55
+
56
+[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
57
+margin_right = 982.0
58
+margin_bottom = 28.0
59
+
60
+[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
61
+margin_right = 22.0
62
+margin_bottom = 28.0
63
+texture = ExtResource( 1 )
64
+stretch_mode = 6
65
+
66
+[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
67
+margin_left = 26.0
68
+margin_top = 7.0
69
+margin_right = 87.0
70
+margin_bottom = 21.0
71
+text = "Call Node"
72
+
73
+[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
74
+margin_left = 91.0
75
+margin_top = 7.0
76
+margin_right = 91.0
77
+margin_bottom = 21.0
78
+custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
79
+
80
+[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
81
+margin_left = 95.0
82
+margin_right = 941.0
83
+margin_bottom = 28.0
84
+
85
+[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
86
+margin_left = 945.0
87
+margin_right = 982.0
88
+margin_bottom = 28.0
89
+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 ]
90
+
91
+[node name="Properties" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
92
+margin_top = 32.0
93
+margin_right = 982.0
94
+margin_bottom = 56.0
95
+custom_constants/separation = 8
96
+
97
+[node name="TargetNodeLabel" type="Label" parent="PanelContainer/VBoxContainer/Properties"]
98
+margin_top = 5.0
99
+margin_right = 81.0
100
+margin_bottom = 19.0
101
+text = "Target Node:"
102
+
103
+[node name="TargetNodeEdit" type="LineEdit" parent="PanelContainer/VBoxContainer/Properties"]
104
+margin_left = 89.0
105
+margin_right = 339.0
106
+margin_bottom = 24.0
107
+rect_min_size = Vector2( 250, 0 )
108
+
109
+[node name="CallMethodLabel" type="Label" parent="PanelContainer/VBoxContainer/Properties"]
110
+margin_left = 347.0
111
+margin_top = 5.0
112
+margin_right = 427.0
113
+margin_bottom = 19.0
114
+text = "Call Method:"
115
+
116
+[node name="CallMethodEdit" type="LineEdit" parent="PanelContainer/VBoxContainer/Properties"]
117
+margin_left = 435.0
118
+margin_right = 635.0
119
+margin_bottom = 24.0
120
+rect_min_size = Vector2( 200, 0 )
121
+
122
+[node name="ArgumentsLabel" type="Label" parent="PanelContainer/VBoxContainer/Properties"]
123
+margin_left = 643.0
124
+margin_top = 5.0
125
+margin_right = 717.0
126
+margin_bottom = 19.0
127
+text = "Arguments:"
128
+
129
+[node name="ArgumentsSpinBox" type="SpinBox" parent="PanelContainer/VBoxContainer/Properties"]
130
+margin_left = 725.0
131
+margin_right = 799.0
132
+margin_bottom = 24.0
133
+max_value = 99.0
134
+
135
+[node name="Arguments" type="VBoxContainer" parent="PanelContainer/VBoxContainer"]
136
+margin_top = 60.0
137
+margin_right = 982.0
138
+margin_bottom = 60.0
139
+custom_constants/separation = 5
140
+
141
+[connection signal="text_changed" from="PanelContainer/VBoxContainer/Properties/TargetNodeEdit" to="." method="_on_Target_LineEdit_text_changed"]
142
+[connection signal="text_changed" from="PanelContainer/VBoxContainer/Properties/CallMethodEdit" to="." method="_on_Method_LineEdit_text_changed"]
143
+[connection signal="value_changed" from="PanelContainer/VBoxContainer/Properties/ArgumentsSpinBox" to="." method="_on_ArgumentsSpinBox_value_changed"]

+ 3
- 4
addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.gd View File

@@ -21,8 +21,7 @@ func _on_OptionSelected(index):
21 21
 		timeline_editor.move_block(current_piece, 'down')
22 22
 	elif index == 3:
23 23
 		# Removing a piece
24
-		if timeline_editor.selected_item == current_piece:
25
-			timeline_editor.selected_item = null
26
-		# TODO: Add a warning here if the event has changes
27
-		current_piece.queue_free()
24
+		if timeline_editor.selected_item != current_piece:
25
+			timeline_editor._select_item(current_piece)
26
+		timeline_editor.delete_event()
28 27
 	timeline_editor.indent_events()

+ 1
- 1
addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn View File

@@ -11,7 +11,7 @@ text = "Item 0"
11 11
 icon = ExtResource( 1 )
12 12
 clip_text = true
13 13
 align = 2
14
-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 ]
14
+items = [ "Move Up (Alt+Up)", null, 0, false, false, 0, 0, null, "", false, "Move Down (Alt+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 ]
15 15
 script = ExtResource( 2 )
16 16
 __meta__ = {
17 17
 "_edit_use_anchors_": false

+ 8
- 0
addons/dialogic/Editor/Pieces/Common/SpinBoxPreventDnD.gd View File

@@ -0,0 +1,8 @@
1
+tool
2
+extends SpinBox
3
+
4
+func can_drop_data(position, data):
5
+	# this prevents locking the mouse
6
+	# on some operating systems
7
+	# due to a godot editor bug with SpinBox drag/drop
8
+	return false

+ 2
- 1
addons/dialogic/Editor/Pieces/IfCondition.tscn View File

@@ -75,8 +75,9 @@ margin_bottom = 28.0
75 75
 
76 76
 [node name="CustomLineEdit" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
77 77
 margin_left = 256.0
78
-margin_right = 304.0
78
+margin_right = 352.0
79 79
 margin_bottom = 28.0
80
+hint_tooltip = "you can enter a text-value, a number or you can enter the name of another definition to compare against."
80 81
 
81 82
 [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
82 83
 margin_left = 308.0

+ 3
- 3
addons/dialogic/Editor/Pieces/SceneEvent.gd View File

@@ -18,7 +18,7 @@ func _ready():
18 18
 
19 19
 
20 20
 func _on_ImageButton_pressed():
21
-	editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp;Image")
21
+	editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
22 22
 	editor_reference.godot_dialog_connect(self, "_on_file_selected")
23 23
 
24 24
 
@@ -33,8 +33,8 @@ func load_data(data):
33 33
 
34 34
 func load_image(img_src):
35 35
 	event_data['background'] = img_src
36
-	if event_data['background'] != '':
37
-		$PanelContainer/VBoxContainer/HBoxContainer/LineEdit.text = event_data['background']
36
+	$PanelContainer/VBoxContainer/HBoxContainer/LineEdit.text = event_data['background']
37
+	if event_data['background'] != '' and not event_data['background'].ends_with('.tscn'):
38 38
 		$PanelContainer/VBoxContainer/TextureRect.texture = load(event_data['background'])
39 39
 		$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(200,200)
40 40
 		preview = event_data['background']

+ 26
- 1
addons/dialogic/Editor/Pieces/TextBlock.gd View File

@@ -1,7 +1,7 @@
1 1
 tool
2 2
 extends Control
3 3
 
4
-var text_height = 26
4
+var text_height = 21
5 5
 var editor_reference
6 6
 var preview = ''
7 7
 onready var toggler = get_node("PanelContainer/VBoxContainer/Header/VisibleToggle")
@@ -16,7 +16,11 @@ var event_data = {
16 16
 onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker
17 17
 
18 18
 func _ready():
19
+	var _scale = get_constant("inspector_margin", "Editor")
20
+	_scale = _scale * 0.125
21
+	text_height = text_height * _scale
19 22
 	connect("gui_input", self, '_on_gui_input')
23
+	$PanelContainer/VBoxContainer/TextEdit.connect("focus_entered", self, "_on_TextEdit_focus_entered")
20 24
 	$PanelContainer/VBoxContainer/TextEdit.set("rect_min_size", Vector2(0, 80))
21 25
 	$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
22 26
 	portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
@@ -96,5 +100,26 @@ func _on_gui_input(event):
96 100
 				toggler.pressed = true
97 101
 
98 102
 
103
+func _on_TextEdit_focus_entered():
104
+	# propagate to timeline to make this text event as active selected
105
+	# to help improve keyboard shortcut workflows
106
+	# only maybe only do this on left click since mouse wheel and
107
+	# touch scrolling may triggers this event too
108
+	if (Input.is_mouse_button_pressed(BUTTON_LEFT)):
109
+		var timeline_editor = editor_reference.get_node_or_null('MainPanel/TimelineEditor')
110
+		if (timeline_editor != null):
111
+			# @todo select item and clear selection is marked as "private" in TimelineEditor.gd
112
+			# consider to make it "public" or add a public helper function
113
+			timeline_editor._clear_selection()
114
+			timeline_editor._select_item(self)
115
+		pass
116
+	
117
+	
99 118
 func _on_saver_timer_timeout():
100 119
 	update_preview()
120
+	
121
+	
122
+# gets called when the user selects this node in the timeline
123
+func on_timeline_selected():
124
+	$PanelContainer/VBoxContainer/TextEdit.grab_focus()
125
+	pass

+ 5
- 2
addons/dialogic/Editor/Pieces/TextBlock.tscn View File

@@ -76,9 +76,9 @@ stretch_mode = 6
76 76
 
77 77
 [node name="Label" type="Label" parent="PanelContainer/VBoxContainer/Header"]
78 78
 visible = false
79
-margin_left = 60.0
79
+margin_left = 35.0
80 80
 margin_top = 8.0
81
-margin_right = 103.0
81
+margin_right = 78.0
82 82
 margin_bottom = 22.0
83 83
 text = "  Text  "
84 84
 
@@ -93,6 +93,8 @@ margin_right = 149.0
93 93
 
94 94
 [node name="PortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 7 )]
95 95
 visible = false
96
+margin_left = 153.0
97
+margin_right = 187.0
96 98
 
97 99
 [node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
98 100
 margin_left = 153.0
@@ -127,4 +129,5 @@ size_flags_vertical = 3
127 129
 show_line_numbers = true
128 130
 smooth_scrolling = true
129 131
 wrap_enabled = true
132
+
130 133
 [connection signal="text_changed" from="PanelContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]

+ 3
- 1
addons/dialogic/Editor/Pieces/WaitSeconds.tscn View File

@@ -1,9 +1,10 @@
1
-[gd_scene load_steps=6 format=2]
1
+[gd_scene load_steps=8 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/Events/Wait.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Editor/Pieces/WaitSeconds.gd" type="Script" id=2]
5 5
 [ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
6 6
 [ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
7
+[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/SpinBoxPreventDnD.gd" type="Script" id=6]
7 8
 
8 9
 [sub_resource type="StyleBoxFlat" id=1]
9 10
 content_margin_left = 16.0
@@ -78,6 +79,7 @@ min_value = 0.1
78 79
 value = 0.1
79 80
 allow_greater = true
80 81
 align = 1
82
+script = ExtResource( 6 )
81 83
 
82 84
 [node name="Title2" type="Label" parent="PanelContainer/VBoxContainer/Header"]
83 85
 margin_left = 157.0

+ 10
- 0
addons/dialogic/Editor/SettingsEditor/SettingsEditor.gd View File

@@ -7,7 +7,10 @@ onready var nodes = {
7 7
 	'remove_empty_messages': $VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer/RemoveEmptyMessages,
8 8
 	'auto_color_names': $VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer3/AutoColorNames,
9 9
 	'propagate_input': $VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer4/PropagateInput,
10
+	'dim_characters': $VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer5/DimCharacters,
10 11
 }
12
+
13
+
11 14
 func _ready():
12 15
 	update_data()
13 16
 	
@@ -16,6 +19,7 @@ func _ready():
16 19
 	nodes['remove_empty_messages'].connect('toggled', self, '_on_remove_empty_message_toggled')
17 20
 	nodes['auto_color_names'].connect('toggled', self, '_on_auto_color_names_toggled')
18 21
 	nodes['propagate_input'].connect('toggled', self, '_on_propagate_input_toggled')
22
+	nodes['dim_characters'].connect('toggled', self, '_on_dim_characters_toggled')
19 23
 
20 24
 
21 25
 func update_data():
@@ -33,6 +37,8 @@ func dialog_options(settings):
33 37
 		nodes['auto_color_names'].pressed = settings.get_value('dialog', 'auto_color_names')
34 38
 	if settings.has_section_key('dialog', 'propagate_input'):
35 39
 		nodes['propagate_input'].pressed = settings.get_value('dialog', 'propagate_input')
40
+	if settings.has_section_key('dialog', 'dim_characters'):
41
+		nodes['dim_characters'].pressed = settings.get_value('dialog', 'dim_characters')
36 42
 
37 43
 
38 44
 func refresh_themes(settings):
@@ -74,10 +80,14 @@ func _on_new_line_toggled(value):
74 80
 func _on_auto_color_names_toggled(value):
75 81
 	set_value('dialog', 'auto_color_names', value)
76 82
 
83
+
77 84
 func _on_propagate_input_toggled(value):
78 85
 	set_value('dialog', 'propagate_input', value)
79 86
 
80 87
 
88
+func _on_dim_characters_toggled(value):
89
+	set_value('dialog', 'dim_characters', value)
90
+
81 91
 # Reading and saving data to the settings file
82 92
 func set_value(section, key, value):
83 93
 	DialogicResources.set_settings_value(section, key, value)

+ 39
- 18
addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn View File

@@ -18,19 +18,19 @@ size_flags_vertical = 3
18 18
 
19 19
 [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
20 20
 margin_right = 1024.0
21
-margin_bottom = 212.0
21
+margin_bottom = 240.0
22 22
 
23 23
 [node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3"]
24
-margin_right = 288.0
25
-margin_bottom = 212.0
24
+margin_right = 304.0
25
+margin_bottom = 240.0
26 26
 custom_constants/separation = 16
27 27
 
28 28
 [node name="VBoxContainer" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer"]
29
-margin_right = 288.0
29
+margin_right = 304.0
30 30
 margin_bottom = 54.0
31 31
 
32 32
 [node name="Panel" type="Panel" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer"]
33
-margin_right = 288.0
33
+margin_right = 304.0
34 34
 margin_bottom = 30.0
35 35
 rect_min_size = Vector2( 0, 30 )
36 36
 size_flags_horizontal = 3
@@ -45,7 +45,7 @@ __meta__ = {
45 45
 
46 46
 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer"]
47 47
 margin_top = 34.0
48
-margin_right = 288.0
48
+margin_right = 304.0
49 49
 margin_bottom = 54.0
50 50
 
51 51
 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer/HBoxContainer"]
@@ -59,19 +59,23 @@ margin_left = 50.0
59 59
 margin_right = 190.0
60 60
 margin_bottom = 20.0
61 61
 rect_min_size = Vector2( 140, 0 )
62
-text = "test"
63
-items = [ "test", null, false, 0, {
64
-"file": "theme-1616687382.cfg"
62
+text = "Basic"
63
+items = [ "Alternative", null, false, 0, {
64
+"file": "theme-1617143167.cfg"
65
+}, "Basic", null, false, 1, {
66
+"file": "theme-1616778229.cfg"
67
+}, "New Theme", null, false, 2, {
68
+"file": "theme-1617143282.cfg"
65 69
 } ]
66
-selected = 0
70
+selected = 1
67 71
 
68 72
 [node name="VBoxContainer2" type="VBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer"]
69 73
 margin_top = 70.0
70
-margin_right = 288.0
71
-margin_bottom = 212.0
74
+margin_right = 304.0
75
+margin_bottom = 240.0
72 76
 
73 77
 [node name="Panel2" type="Panel" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2"]
74
-margin_right = 288.0
78
+margin_right = 304.0
75 79
 margin_bottom = 30.0
76 80
 rect_min_size = Vector2( 0, 30 )
77 81
 size_flags_horizontal = 3
@@ -86,7 +90,7 @@ __meta__ = {
86 90
 
87 91
 [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2"]
88 92
 margin_top = 34.0
89
-margin_right = 288.0
93
+margin_right = 304.0
90 94
 margin_bottom = 58.0
91 95
 
92 96
 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer2"]
@@ -105,7 +109,7 @@ pressed = true
105 109
 
106 110
 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2"]
107 111
 margin_top = 62.0
108
-margin_right = 288.0
112
+margin_right = 304.0
109 113
 margin_bottom = 86.0
110 114
 
111 115
 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer"]
@@ -116,14 +120,14 @@ text = "Remove empty messages"
116 120
 
117 121
 [node name="RemoveEmptyMessages" type="CheckBox" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer"]
118 122
 margin_left = 169.0
119
-margin_right = 288.0
123
+margin_right = 304.0
120 124
 margin_bottom = 24.0
121 125
 size_flags_horizontal = 3
122 126
 pressed = true
123 127
 
124 128
 [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2"]
125 129
 margin_top = 90.0
126
-margin_right = 288.0
130
+margin_right = 304.0
127 131
 margin_bottom = 114.0
128 132
 
129 133
 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer3"]
@@ -140,7 +144,7 @@ pressed = true
140 144
 
141 145
 [node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2"]
142 146
 margin_top = 118.0
143
-margin_right = 288.0
147
+margin_right = 304.0
144 148
 margin_bottom = 142.0
145 149
 
146 150
 [node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer4"]
@@ -154,3 +158,20 @@ margin_left = 223.0
154 158
 margin_right = 247.0
155 159
 margin_bottom = 24.0
156 160
 pressed = true
161
+
162
+[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2"]
163
+margin_top = 146.0
164
+margin_right = 304.0
165
+margin_bottom = 170.0
166
+
167
+[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer5"]
168
+margin_top = 5.0
169
+margin_right = 276.0
170
+margin_bottom = 19.0
171
+text = "Dim characters when they are not speaking"
172
+
173
+[node name="DimCharacters" type="CheckBox" parent="VBoxContainer/HBoxContainer3/VBoxContainer/VBoxContainer2/HBoxContainer5"]
174
+margin_left = 280.0
175
+margin_right = 304.0
176
+margin_bottom = 24.0
177
+pressed = true

+ 207
- 52
addons/dialogic/Editor/ThemeEditor/ThemeEditor.gd View File

@@ -2,68 +2,78 @@ tool
2 2
 extends Control
3 3
 
4 4
 var editor_reference
5
-onready var master_tree = get_node('../MasterTree')
5
+onready var master_tree = get_node('../MasterTreeContainer/MasterTree')
6 6
 onready var settings_editor = get_node('../SettingsEditor')
7 7
 var current_theme = ''
8 8
 
9
+# When loading the variables to the input fields in the 
10
+# load_theme function, every element thinks the value was updated
11
+# so it has to perform a "saving" of that property. 
12
+# The loading variable is a way to check if the values should be saved
13
+# or not.
14
+var loading = true 
15
+
9 16
 # The amazing and revolutionary path system that magically works and you can't
10 17
 # complain because "that is not how you are supposed to work". If there was only
11 18
 # a way to set an id and then access that node via id...
12 19
 # Here you have paths in all its glory. Praise the paths (っ´ω`c)♡
13 20
 onready var n = {
14 21
 	# Text
15
-	'theme_text_shadow': $VBoxContainer/HBoxContainer2/Text/GridContainer/HBoxContainer2/CheckBoxShadow,
16
-	'theme_text_shadow_color': $VBoxContainer/HBoxContainer2/Text/GridContainer/HBoxContainer2/ColorPickerButtonShadow,
17
-	'theme_text_color': $VBoxContainer/HBoxContainer2/Text/GridContainer/ColorPickerButton,
18
-	'theme_font': $VBoxContainer/HBoxContainer2/Text/GridContainer/FontButton,
19
-	'theme_shadow_offset_x': $VBoxContainer/HBoxContainer2/Text/GridContainer/HBoxContainer/ShadowOffsetX,
20
-	'theme_shadow_offset_y': $VBoxContainer/HBoxContainer2/Text/GridContainer/HBoxContainer/ShadowOffsetY,
21
-	'theme_text_speed': $VBoxContainer/HBoxContainer2/Text/GridContainer/TextSpeed,
22
-	'alignment': $VBoxContainer/HBoxContainer2/Text/GridContainer/HBoxContainer3/Alignment,
22
+	'theme_text_shadow': $VBoxContainer/TabContainer/Text/Column/GridContainer/HBoxContainer2/CheckBoxShadow,
23
+	'theme_text_shadow_color': $VBoxContainer/TabContainer/Text/Column/GridContainer/HBoxContainer2/ColorPickerButtonShadow,
24
+	'theme_text_color': $VBoxContainer/TabContainer/Text/Column/GridContainer/ColorPickerButton,
25
+	'theme_font': $VBoxContainer/TabContainer/Text/Column/GridContainer/FontButton,
26
+	'theme_shadow_offset_x': $VBoxContainer/TabContainer/Text/Column/GridContainer/HBoxContainer/ShadowOffsetX,
27
+	'theme_shadow_offset_y': $VBoxContainer/TabContainer/Text/Column/GridContainer/HBoxContainer/ShadowOffsetY,
28
+	'theme_text_speed': $VBoxContainer/TabContainer/Text/Column/GridContainer/TextSpeed,
29
+	'alignment': $VBoxContainer/TabContainer/Text/Column/GridContainer/HBoxContainer3/Alignment,
23 30
 	
24 31
 	# Dialog box
25
-	'background_texture_button_visible': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer3/CheckBox,
26
-	'theme_background_image': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer3/BackgroundTextureButton,
27
-	'theme_next_image': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/NextIndicatorButton,
28
-	'next_animation': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/NextAnimation,
29
-	'theme_action_key': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/BoxContainer/ActionOptionButton,
30
-	'theme_background_color_visible': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer2/CheckBox,
31
-	'theme_background_color': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer2/ColorPickerButton,
32
-	'theme_text_margin': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer/TextOffsetV,
33
-	'theme_text_margin_h': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer/TextOffsetH,
34
-	'size_w': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer4/BoxSizeW,
35
-	'size_h': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer4/BoxSizeH, 
36
-	'bottom_gap': $VBoxContainer/HBoxContainer2/DialogBox/GridContainer/HBoxContainer5/BottomGap,
32
+	'background_texture_button_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/CheckBox",
33
+	'theme_background_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton",
34
+	'theme_next_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextIndicatorButton",
35
+	'next_animation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextAnimation",
36
+	'theme_action_key': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/BoxContainer/ActionOptionButton",
37
+	'theme_background_color_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/CheckBox",
38
+	'theme_background_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/ColorPickerButton",
39
+	'theme_text_margin': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetV",
40
+	'theme_text_margin_h': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetH",
41
+	'size_w': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeW",
42
+	'size_h': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeH", 
43
+	'bottom_gap': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5/BottomGap",
44
+	'background_modulation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox",
45
+	'background_modulation_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton",
46
+	
37 47
 	
38 48
 	# Buttons
39
-	'button_text_color_enabled': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer4/CheckBox2,
40
-	'button_text_color': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer4/ButtonTextColor,
41
-	'button_background': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer2/ColorPickerButton,
42
-	'button_background_visible': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer2/CheckBox,
43
-	'button_image': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer3/BackgroundTextureButton,
44
-	'button_image_visible': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer3/CheckBox,
45
-	'button_offset_x': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer/TextOffsetH,
46
-	'button_offset_y': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/HBoxContainer/TextOffsetV,
47
-	'button_separation': $VBoxContainer/HBoxContainer2/ButtonStyle/GridContainer/VerticalSeparation,
49
+	'button_text_color_enabled': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer4/CheckBox2",
50
+	'button_text_color': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer4/ButtonTextColor",
51
+	'button_background': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer2/ColorPickerButton",
52
+	'button_background_visible': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer2/CheckBox",
53
+	'button_image': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer3/BackgroundTextureButton",
54
+	'button_image_visible': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer3/CheckBox",
55
+	'button_offset_x': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer/TextOffsetH",
56
+	'button_offset_y': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/HBoxContainer/TextOffsetV",
57
+	'button_separation': $"VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer/VerticalSeparation",
48 58
 	
49 59
 	# Definitions
50
-	'glossary_font': $VBoxContainer/HBoxContainer2/Glossary/GridContainer/FontButton,
51
-	'glossary_color': $VBoxContainer/HBoxContainer2/Glossary/GridContainer/ColorPickerButton,
60
+	'glossary_font': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton,
61
+	'glossary_color': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton,
62
+	
52 63
 	# Text preview
53
-	'preview_panel': $VBoxContainer/Panel,
54 64
 	'text_preview': $VBoxContainer/HBoxContainer3/TextEdit,
55 65
 	
56 66
 	# Character Names
57
-	'name_auto_color': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/CheckBox,
58
-	'name_background_visible': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer2/CheckBox,
59
-	'name_background': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer2/ColorPickerButton,
60
-	'name_image': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer3/BackgroundTextureButton,
61
-	'name_image_visible': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer3/CheckBox,
62
-	'name_shadow': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer4/ColorPickerButtonShadow,
63
-	'name_shadow_visible': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer4/CheckBoxShadow,
64
-	'name_shadow_offset_x': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer/ShadowOffsetX,
65
-	'name_shadow_offset_y': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer/ShadowOffsetY,
66
-	'name_bottom_gap': $VBoxContainer/HBoxContainer2/Glossary/GridContainer2/HBoxContainer5/BottomGap,
67
+	'name_auto_color': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/CheckBox",
68
+	'name_background_visible': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer2/CheckBox",
69
+	'name_background': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer2/ColorPickerButton",
70
+	'name_image': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer3/BackgroundTextureButton",
71
+	'name_image_visible': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer3/CheckBox",
72
+	'name_shadow': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer4/ColorPickerButtonShadow",
73
+	'name_shadow_visible': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer4/CheckBoxShadow",
74
+	'name_shadow_offset_x': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer/ShadowOffsetX",
75
+	'name_shadow_offset_y': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer/ShadowOffsetY",
76
+	'name_bottom_gap': $"VBoxContainer/TabContainer/Name Label/Column/GridContainer/HBoxContainer5/BottomGap",
67 77
 }
68 78
 
69 79
 func _ready():
@@ -73,11 +83,15 @@ func _ready():
73 83
 		$VBoxContainer/HBoxContainer3/PreviewButton.icon = load("res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg")
74 84
 	else:
75 85
 		$VBoxContainer/HBoxContainer3/PreviewButton.icon = load("res://addons/dialogic/Images/Plugin/plugin-editor-icon-light-theme.svg")
86
+	
87
+	$DelayPreviewTimer.one_shot = true
88
+	$DelayPreviewTimer.connect("timeout", self, '_on_DelayPreview_timer_timeout')
76 89
 	# Force preview update
77 90
 	_on_visibility_changed()
78 91
 
79 92
 
80 93
 func load_theme(filename):
94
+	loading = true
81 95
 	current_theme = filename
82 96
 	var theme = DialogicResources.get_theme_config(filename) 
83 97
 	# Settings
@@ -89,6 +103,10 @@ func load_theme(filename):
89 103
 	n['theme_background_color'].color = Color(theme.get_value('background', 'color', '#ff000000'))
90 104
 	n['theme_background_color_visible'].pressed = theme.get_value('background', 'use_color', false)
91 105
 	n['theme_next_image'].text = DialogicResources.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Images/next-indicator.png'))
106
+
107
+	n['background_modulation'].pressed = theme.get_value('background', 'modulation', false)
108
+	n['background_modulation_color'].color = Color(theme.get_value('background', 'modulation_color', '#ffffffff'))
109
+	
92 110
 	
93 111
 	var size_value = theme.get_value('box', 'size', Vector2(910, 167))
94 112
 	n['size_w'].value = size_value.x
@@ -160,6 +178,8 @@ func load_theme(filename):
160 178
 	# Preview text
161 179
 	n['text_preview'].text = theme.get_value('text', 'preview', 'This is preview text. You can use  [color=#A5EFAC]BBCode[/color] to style it.\n[wave amp=50 freq=2]You can even use effects![/wave]')
162 180
 	
181
+	# Finished loading
182
+	loading = false
163 183
 	# Updating the preview
164 184
 	_on_PreviewButton_pressed()
165 185
 
@@ -171,18 +191,29 @@ func new_theme():
171 191
 	load_theme(theme_file)
172 192
 	# Check if it is the only theme to set as default
173 193
 	if DialogicUtil.get_theme_list().size() == 1:
174
-		print('only theme, setting as default')
194
+		#print('only theme, setting as default')
175 195
 		settings_editor.set_value('theme', 'default', theme_file)
176 196
 
177 197
 
198
+func duplicate_theme(from_filename):
199
+	var duplicate_theme = 'theme-' + str(OS.get_unix_time()) + '.cfg'
200
+	DialogicResources.duplicate_theme(from_filename, duplicate_theme)
201
+	DialogicResources.set_theme_value(duplicate_theme, 'settings', 'name', duplicate_theme)
202
+	master_tree.build_themes(duplicate_theme)
203
+	load_theme(duplicate_theme)
204
+	
205
+
178 206
 func _on_BackgroundTextureButton_pressed():
179 207
 	editor_reference.godot_dialog("*.png")
180 208
 	editor_reference.godot_dialog_connect(self, "_on_background_selected")
181 209
 
182 210
 
183 211
 func _on_background_selected(path, target):
212
+	if loading == true:
213
+		return
184 214
 	DialogicResources.set_theme_value(current_theme, 'background','image', path)
185 215
 	n['theme_background_image'].text = DialogicResources.get_filename_from_path(path)
216
+	_on_PreviewButton_pressed() # Refreshing the preview
186 217
 
187 218
 
188 219
 func _on_NextIndicatorButton_pressed():
@@ -191,36 +222,54 @@ func _on_NextIndicatorButton_pressed():
191 222
 
192 223
 
193 224
 func _on_indicator_selected(path, target):
225
+	if loading == true:
226
+		return
194 227
 	DialogicResources.set_theme_value(current_theme, 'next_indicator','image', path)
195 228
 	n['theme_next_image'].text = DialogicResources.get_filename_from_path(path)
229
+	_on_PreviewButton_pressed() # Refreshing the preview
196 230
 
197 231
 
198 232
 func _on_NextAnimation_item_selected(index):
199 233
 	DialogicResources.set_theme_value(current_theme, 'next_indicator', 'animation', n['next_animation'].get_item_text(index))
234
+	_on_PreviewButton_pressed() # Refreshing the preview
200 235
 
201 236
 
202 237
 func _on_ColorPickerButton_color_changed(color):
238
+	if loading == true:
239
+		return
203 240
 	DialogicResources.set_theme_value(current_theme, 'text','color', '#' + color.to_html())
241
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
204 242
 
205 243
 
206 244
 func _on_ColorPickerButtonShadow_color_changed(color):
245
+	if loading == true:
246
+		return
207 247
 	DialogicResources.set_theme_value(current_theme, 'text','shadow_color', '#' + color.to_html())
248
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
208 249
 
209 250
 
210 251
 func _on_CheckBoxShadow_toggled(button_pressed):
252
+	if loading == true:
253
+		return
211 254
 	DialogicResources.set_theme_value(current_theme, 'text','shadow', button_pressed)
255
+	_on_PreviewButton_pressed() # Refreshing the preview
212 256
 
213 257
 
214 258
 func _on_ShadowOffset_value_changed(_value):
259
+	if loading == true:
260
+		return
215 261
 	DialogicResources.set_theme_value(current_theme, 'text','shadow_offset', Vector2(n['theme_shadow_offset_x'].value,n['theme_shadow_offset_y'].value))
262
+	_on_PreviewButton_pressed() # Refreshing the preview
216 263
 
217 264
 
218 265
 func _on_PreviewButton_pressed():
219
-	for i in n['preview_panel'].get_children():
266
+	for i in $VBoxContainer/Panel.get_children():
220 267
 		i.free()
221 268
 	var dialogic_node = load("res://addons/dialogic/Dialog.tscn")
222 269
 	var preview_dialog = dialogic_node.instance()
270
+	preview_dialog.timeline = ''
223 271
 	preview_dialog.preview = true
272
+	preview_dialog.debug_mode = false
224 273
 	preview_dialog.get_node('DefinitionInfo').in_theme_editor = true
225 274
 	
226 275
 	# Random character preview if there are any
@@ -230,21 +279,27 @@ func _on_PreviewButton_pressed():
230 279
 		characters.shuffle()
231 280
 		character_file = characters[0]['file']
232 281
 	
282
+	# Loading the theme here because I need it for the parse_alignment
283
+	preview_dialog.current_theme = preview_dialog.load_theme(current_theme)
284
+	
233 285
 	# Creating the one event timeline for the dialog
286
+	var text = preview_dialog.parse_definitions(n['text_preview'].text)
234 287
 	preview_dialog.dialog_script['events'] = [{
235 288
 		"character": character_file,
236 289
 		"portrait":'',
237
-		"text": preview_dialog.parse_definitions(n['text_preview'].text)
290
+		"text": text
238 291
 	}]
239 292
 	preview_dialog.parse_characters(preview_dialog.dialog_script)
240 293
 	preview_dialog.settings = DialogicResources.get_settings_config()
241 294
 	
242 295
 	# Alignment
243
-	n['preview_panel'].add_child(preview_dialog)
296
+	$VBoxContainer/Panel.add_child(preview_dialog)
244 297
 	
245 298
 	preview_dialog.load_dialog()
299
+	# Reloading the theme
246 300
 	preview_dialog.current_theme = preview_dialog.load_theme(current_theme)
247 301
 	
302
+	
248 303
 	# When not performing this step, the dialog name doesn't update the color for some reason
249 304
 	# I should probably refactor the preview dialog to stop making everything manually.
250 305
 	if n['name_auto_color'].pressed:
@@ -252,11 +307,13 @@ func _on_PreviewButton_pressed():
252 307
 			preview_dialog.get_node('TextBubble/NameLabel').set('custom_colors/font_color', characters[0]['color'])
253 308
 	
254 309
 	# maintaining the preview panel big enough for the dialog box
255
-	n['preview_panel'].rect_min_size.y = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y + 90 + preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
256
-	n['preview_panel'].rect_size.y = 0
310
+	$VBoxContainer/Panel.rect_min_size.y = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y + 90 + preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
311
+	$VBoxContainer/Panel.rect_size.y = 0
257 312
 
258 313
 
259 314
 func _on_ActionOptionButton_item_selected(index):
315
+	if loading == true:
316
+		return
260 317
 	DialogicResources.set_theme_value(current_theme, 'settings','action_key', n['theme_action_key'].text)
261 318
 
262 319
 
@@ -274,43 +331,68 @@ func _on_FontButton_pressed():
274 331
 
275 332
 
276 333
 func _on_Font_selected(path, target):
334
+	if loading == true:
335
+		return
277 336
 	DialogicResources.set_theme_value(current_theme, 'text','font', path)
278 337
 	n['theme_font'].text = DialogicResources.get_filename_from_path(path)
338
+	_on_PreviewButton_pressed() # Refreshing the preview
279 339
 
280 340
 
281 341
 func _on_textSpeed_value_changed(value):
342
+	if loading == true:
343
+		return
282 344
 	DialogicResources.set_theme_value(current_theme, 'text','speed', value)
345
+	_on_PreviewButton_pressed() # Refreshing the preview
283 346
 
284 347
 
285 348
 func _on_TextMargin_value_changed(value):
349
+	if loading == true:
350
+		return
286 351
 	var final_vector = Vector2(
287 352
 		n['theme_text_margin'].value,
288 353
 		n['theme_text_margin_h'].value
289 354
 	)
290 355
 	DialogicResources.set_theme_value(current_theme, 'text', 'margin', final_vector)
356
+	_on_PreviewButton_pressed() # Refreshing the preview
291 357
 
292 358
 
293 359
 func _on_BackgroundColor_CheckBox_toggled(button_pressed):
360
+	if loading == true:
361
+		return
294 362
 	DialogicResources.set_theme_value(current_theme, 'background', 'use_color', button_pressed)
363
+	_on_PreviewButton_pressed() # Refreshing the preview
295 364
 
296 365
 
297 366
 func _on_BackgroundColor_ColorPickerButton_color_changed(color):
367
+	if loading == true:
368
+		return
298 369
 	DialogicResources.set_theme_value(current_theme, 'background', 'color', '#' + color.to_html())
370
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
299 371
 
300 372
 
301 373
 func _on_BackgroundTexture_CheckBox_toggled(button_pressed):
374
+	if loading == true:
375
+		return
302 376
 	DialogicResources.set_theme_value(current_theme, 'background', 'use_image', button_pressed)
303
-
377
+	_on_PreviewButton_pressed() # Refreshing the preview
378
+	
304 379
 
305 380
 func _on_button_background_visible_toggled(button_pressed):
381
+	if loading == true:
382
+		return
306 383
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'use_background_color', button_pressed)
307 384
 
308 385
 
309 386
 func _on_button_background_color_color_changed(color):
387
+	if loading == true:
388
+		return
310 389
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'background_color', '#' + color.to_html())
390
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
311 391
 
312 392
 
313 393
 func _on_ButtonOffset_value_changed(value):
394
+	if loading == true:
395
+		return
314 396
 	var final_vector = Vector2(
315 397
 		n['button_offset_x'].value,
316 398
 		n['button_offset_y'].value
@@ -319,10 +401,14 @@ func _on_ButtonOffset_value_changed(value):
319 401
 
320 402
 
321 403
 func _on_VerticalSeparation_value_changed(value):
404
+	if loading == true:
405
+		return
322 406
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'gap', n['button_separation'].value)
323 407
 
324 408
 
325 409
 func _on_button_texture_toggled(button_pressed):
410
+	if loading == true:
411
+		return
326 412
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'use_image', button_pressed)
327 413
 
328 414
 
@@ -332,29 +418,43 @@ func _on_ButtonTextureButton_pressed():
332 418
 
333 419
 
334 420
 func _on_button_texture_selected(path, target):
421
+	if loading == true:
422
+		return
335 423
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'image', path)
336 424
 	n['button_image'].text = DialogicResources.get_filename_from_path(path)
337 425
 
338 426
 
339 427
 func _on_ButtonTextColor_color_changed(color):
428
+	if loading == true:
429
+		return
340 430
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'text_color', '#' + color.to_html())
431
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
341 432
 
342 433
 
343 434
 func _on_Custom_Button_Color_toggled(button_pressed):
435
+	if loading == true:
436
+		return
344 437
 	DialogicResources.set_theme_value(current_theme, 'buttons', 'text_color_enabled', button_pressed)
345 438
 
346 439
 
347 440
 func _on_GlossaryColorPicker_color_changed(color):
441
+	if loading == true:
442
+		return
348 443
 	DialogicResources.set_theme_value(current_theme, 'definitions', 'color', '#' + color.to_html())
444
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
349 445
 
350 446
 
351 447
 func _on_GlossaryFontButton_pressed():
352 448
 	editor_reference.godot_dialog("*.tres")
353 449
 	editor_reference.godot_dialog_connect(self, "_on_Glossary_Font_selected")
354 450
 
451
+
355 452
 func _on_Glossary_Font_selected(path, target):
453
+	if loading == true:
454
+		return
356 455
 	DialogicResources.set_theme_value(current_theme, 'definitions', 'font', path)
357 456
 	n['glossary_font'].text = DialogicResources.get_filename_from_path(path)
457
+	_on_PreviewButton_pressed() # Refreshing the preview
358 458
 
359 459
 
360 460
 func _on_visibility_changed():
@@ -364,47 +464,69 @@ func _on_visibility_changed():
364 464
 	else:
365 465
 		# Erasing all previews since them keeps working
366 466
 		# on background
367
-		for i in n['preview_panel'].get_children():
467
+		for i in $VBoxContainer/Panel.get_children():
368 468
 			i.queue_free()
369 469
 
370 470
 
371 471
 func _on_BoxSize_value_changed(value):
472
+	if loading == true:
473
+		return
372 474
 	var size_value = Vector2(n['size_w'].value, n['size_h'].value)
373 475
 	DialogicResources.set_theme_value(current_theme, 'box', 'size', size_value)
476
+	_on_PreviewButton_pressed() # Refreshing the preview
374 477
 
375 478
 
376 479
 func _on_BottomGap_value_changed(value):
480
+	if loading == true:
481
+		return
377 482
 	DialogicResources.set_theme_value(current_theme, 'box', 'bottom_gap', value)
483
+	_on_PreviewButton_pressed() # Refreshing the preview
378 484
 
379 485
 
380 486
 func _on_Alignment_item_selected(index):
487
+	if loading == true:
488
+		return
381 489
 	if index == 0:
382 490
 		DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Left')
383 491
 	elif index == 1:
384 492
 		DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Center')
385 493
 	elif index == 2:
386 494
 		DialogicResources.set_theme_value(current_theme, 'text', 'alignment', 'Right')
387
-
495
+	_on_PreviewButton_pressed() # Refreshing the preview
388 496
 
389 497
 
390 498
 func _on_Preview_text_changed():
499
+	if loading == true:
500
+		return
391 501
 	DialogicResources.set_theme_value(current_theme, 'text', 'preview', n['text_preview'].text)
392 502
 
393 503
 
394 504
 func _on_name_auto_color_toggled(button_pressed):
505
+	if loading == true:
506
+		return
395 507
 	DialogicResources.set_theme_value(current_theme, 'name', 'auto_color', button_pressed)
508
+	_on_PreviewButton_pressed() # Refreshing the preview
396 509
 
397 510
 
398 511
 func _on_name_background_visible_toggled(button_pressed):
512
+	if loading == true:
513
+		return
399 514
 	DialogicResources.set_theme_value(current_theme, 'name', 'background_visible', button_pressed)
515
+	_on_PreviewButton_pressed() # Refreshing the preview
400 516
 
401 517
 
402 518
 func _on_name_background_color_changed(color):
519
+	if loading == true:
520
+		return
403 521
 	DialogicResources.set_theme_value(current_theme, 'name', 'background', '#' + color.to_html())
522
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
404 523
 
405 524
 
406 525
 func _on_name_image_visible_toggled(button_pressed):
526
+	if loading == true:
527
+		return
407 528
 	DialogicResources.set_theme_value(current_theme, 'name', 'image_visible', button_pressed)
529
+	_on_PreviewButton_pressed() # Refreshing the preview
408 530
 
409 531
 
410 532
 func _on_name_image_pressed():
@@ -413,22 +535,55 @@ func _on_name_image_pressed():
413 535
 
414 536
 
415 537
 func _on_name_texture_selected(path, target):
538
+	if loading == true:
539
+		return
416 540
 	DialogicResources.set_theme_value(current_theme, 'name', 'image', path)
417 541
 	n['name_image'].text = DialogicResources.get_filename_from_path(path)
542
+	_on_PreviewButton_pressed() # Refreshing the preview
418 543
 
419 544
 
420 545
 func _on_shadow_visible_toggled(button_pressed):
546
+	if loading == true:
547
+		return
421 548
 	DialogicResources.set_theme_value(current_theme, 'name', 'shadow_visible', button_pressed)
549
+	_on_PreviewButton_pressed() # Refreshing the preview
422 550
 
423 551
 
424 552
 func _on_name_shadow_color_changed(color):
553
+	if loading == true:
554
+		return
425 555
 	DialogicResources.set_theme_value(current_theme, 'name', 'shadow', '#' + color.to_html())
556
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
426 557
 
427 558
 
428 559
 func _on_name_ShadowOffset_value_changed(_value):
560
+	if loading == true:
561
+		return
429 562
 	DialogicResources.set_theme_value(current_theme, 'name','shadow_offset', 
430 563
 			Vector2(n['name_shadow_offset_x'].value,n['name_shadow_offset_y'].value))
564
+	_on_PreviewButton_pressed() # Refreshing the preview
431 565
 
432 566
 
433 567
 func _on_name_BottomGap_value_changed(value):
568
+	if loading == true:
569
+		return
434 570
 	DialogicResources.set_theme_value(current_theme, 'name', 'bottom_gap', value)
571
+	_on_PreviewButton_pressed() # Refreshing the preview
572
+
573
+
574
+func _on_DelayPreview_timer_timeout():
575
+	_on_PreviewButton_pressed() # Refreshing the preview
576
+
577
+
578
+func _on_BackgroundTexture_Modulation_toggled(button_pressed):
579
+	if loading == true:
580
+		return
581
+	DialogicResources.set_theme_value(current_theme, 'background', 'modulation', button_pressed)
582
+	_on_PreviewButton_pressed() # Refreshing the preview
583
+
584
+
585
+func _on_ColorPicker_Background_texture_modulation_color_changed(color):
586
+	if loading == true:
587
+		return
588
+	DialogicResources.set_theme_value(current_theme, 'background', 'modulation_color', '#' + color.to_html())
589
+	$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times

+ 512
- 486
addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn
File diff suppressed because it is too large
View File


+ 16
- 0
addons/dialogic/Editor/TimelineEditor/EventButton.gd View File

@@ -0,0 +1,16 @@
1
+tool
2
+extends Button
3
+
4
+export (String) var EventName = ''
5
+
6
+func get_drag_data(position):
7
+	var preview_label = Label.new()
8
+	
9
+	if (self.text != ''):
10
+		preview_label.text = text
11
+	else:
12
+		preview_label.text = 'Add Event %s' % [ EventName ]
13
+		
14
+	set_drag_preview(preview_label)
15
+	
16
+	return { "source": "EventButton", "event_name": EventName }

+ 139
- 0
addons/dialogic/Editor/TimelineEditor/TimelineArea.gd View File

@@ -0,0 +1,139 @@
1
+tool
2
+extends ScrollContainer
3
+
4
+var _drag_drop_indicator = null
5
+# store last attempts since godot sometimes misses drop events
6
+var _is_drag_receiving = false
7
+var _last_event_button_drop_attempt = '' 
8
+var _mouse_exited = false
9
+
10
+func _ready():
11
+	connect("mouse_entered", self, '_on_mouse_entered')
12
+	connect("mouse_exited", self, '_on_mouse_exited')
13
+	connect("gui_input", self, '_on_gui_input')
14
+
15
+
16
+func can_drop_data(position, data):
17
+	if (data != null and data is Dictionary and data.has("source")):
18
+		if (data["source"] == "EventButton"):
19
+			# position drop indicator
20
+			_set_indicator_position(position)
21
+			_is_drag_receiving = true
22
+			_last_event_button_drop_attempt = data["event_name"]
23
+			return true
24
+	
25
+	_remove_drop_indicator()
26
+	return false
27
+	
28
+
29
+func cancel_drop():
30
+	_is_drag_receiving = false
31
+	_last_event_button_drop_attempt = ''
32
+	_remove_drop_indicator()
33
+	pass
34
+
35
+	
36
+func drop_data(position, data):
37
+	# todo, getting timeline like this is prone to fail someday
38
+	var timeline_editor = get_parent()
39
+	
40
+	# add event
41
+	if (data["source"] == "EventButton"):
42
+		var piece = timeline_editor.create_event(data["event_name"])
43
+		if (piece != null and _drag_drop_indicator != null):
44
+			var parent = piece.get_parent()
45
+			if (parent != null):
46
+				parent.remove_child(piece)
47
+				parent.add_child_below_node(_drag_drop_indicator, piece)
48
+				timeline_editor.indent_events()
49
+				# @todo _select_item seems to be a "private" function
50
+				# maybe expose it as "public" or add a public helper function
51
+				# to TimelineEditor.gd
52
+				timeline_editor._select_item(piece)
53
+				
54
+	_is_drag_receiving = false
55
+	_last_event_button_drop_attempt = ''
56
+	_remove_drop_indicator()
57
+	
58
+	
59
+func _on_mouse_exited():
60
+	_mouse_exited = true
61
+	
62
+  
63
+func _on_mouse_entered():
64
+	_mouse_exited = false	
65
+	
66
+  
67
+func _input(event):
68
+	if (event is InputEventMouseButton and is_visible_in_tree() and event.button_index == BUTTON_LEFT):
69
+		if (_mouse_exited and _is_drag_receiving):
70
+			cancel_drop()
71
+			
72
+      
73
+func _on_gui_input(event):
74
+	# godot sometimes misses drop events
75
+	if (event is InputEventMouseButton and event.button_index == BUTTON_LEFT):
76
+		if (_is_drag_receiving):
77
+			if (_last_event_button_drop_attempt != ''):
78
+				drop_data(Vector2.ZERO, { "source": "EventButton", "event_name": _last_event_button_drop_attempt} )
79
+			_is_drag_receiving = false
80
+			_remove_drop_indicator()
81
+	pass
82
+	
83
+	
84
+func _create_drop_indicator():
85
+	_remove_drop_indicator()
86
+	
87
+	var timeline = get_child(0)
88
+	if (timeline == null):
89
+		return
90
+	
91
+	var indicator = ColorRect.new()
92
+	indicator.name = "DropIndicator"
93
+	indicator.rect_size.y = 100
94
+	indicator.rect_min_size.y = 100
95
+	indicator.color = Color(0.35, 0.37, 0.44) # default editor light blue
96
+	indicator.mouse_filter = MOUSE_FILTER_IGNORE
97
+	
98
+	# add indent node like the other scene nodes have
99
+	var indent = Control.new()
100
+	indent.rect_min_size.x = 25
101
+	indent.visible = false
102
+	indent.name = "Indent"
103
+	indicator.add_child(indent)
104
+	
105
+	var label = Label.new()
106
+	label.text = "Drop here"
107
+	indicator.add_child(label)
108
+	
109
+	timeline.add_child(indicator)
110
+	
111
+	_drag_drop_indicator = indicator
112
+	
113
+	
114
+func _remove_drop_indicator():	
115
+	if (_drag_drop_indicator != null):
116
+		_drag_drop_indicator.get_parent().remove_child(_drag_drop_indicator)
117
+		_drag_drop_indicator.queue_free()
118
+		
119
+	_drag_drop_indicator = null
120
+	
121
+	
122
+func _set_indicator_position(position):
123
+	var timeline = get_child(0)
124
+	if (timeline == null):
125
+		return
126
+		
127
+	if (_drag_drop_indicator == null):
128
+		_create_drop_indicator()
129
+		
130
+	var highest_index = 0
131
+	var index = 0
132
+	for child in timeline.get_children():
133
+		if child.get_local_mouse_position().y > 0 and index > highest_index:
134
+			highest_index = index
135
+		index += 1
136
+		
137
+	if (_drag_drop_indicator.is_inside_tree()):
138
+		timeline.move_child(_drag_drop_indicator, max(0, highest_index))
139
+	pass

+ 180
- 8
addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd View File

@@ -6,7 +6,7 @@ var timeline_name: String = ''
6 6
 var timeline_file: String = ''
7 7
 var current_timeline: Dictionary = {}
8 8
 
9
-onready var master_tree = get_node('../MasterTree')
9
+onready var master_tree = get_node('../MasterTreeContainer/MasterTree')
10 10
 onready var timeline = $TimelineArea/TimeLine
11 11
 onready var events_warning = $ScrollContainer/EventContainer/EventsWarning
12 12
 
@@ -18,8 +18,26 @@ var selected_item : Node
18 18
 
19 19
 
20 20
 var moving_piece = null
21
+var piece_was_dragged = false
21 22
 
22 23
 func _ready():
24
+	var modifier = ''
25
+	var _scale = get_constant("inspector_margin", "Editor")
26
+	_scale = _scale * 0.125
27
+	$ScrollContainer.rect_min_size.x = 180
28
+	if _scale == 1.25:
29
+		modifier = '-1.25'
30
+		$ScrollContainer.rect_min_size.x = 200
31
+	if _scale == 1.5:
32
+		modifier = '-1.25'
33
+		$ScrollContainer.rect_min_size.x = 200
34
+	if _scale == 1.75:
35
+		modifier = '-1.25'
36
+		$ScrollContainer.rect_min_size.x = 390
37
+	if _scale == 2:
38
+		modifier = '-2'
39
+		$ScrollContainer.rect_min_size.x = 390
40
+	
23 41
 	# We connect all the event buttons to the event creation functions
24 42
 	for b in $ScrollContainer/EventContainer.get_children():
25 43
 		if b is Button:
@@ -34,6 +52,136 @@ func _ready():
34 52
 	style.set('bg_color', get_color("dark_color_1", "Editor"))
35 53
 
36 54
 
55
+func delete_event():
56
+	# get next element
57
+	var next = min(timeline.get_child_count() - 1, selected_item.get_index() + 1)
58
+	var next_node = timeline.get_child(next)
59
+	if (next_node == selected_item):
60
+		next_node = null
61
+		
62
+	# remove current
63
+	selected_item.get_parent().remove_child(selected_item)
64
+	selected_item.queue_free()
65
+	selected_item = null
66
+	
67
+	# select next
68
+	if (next_node != null):
69
+		_select_item(next_node)
70
+	else:
71
+		if (timeline.get_child_count() > 0):
72
+			next_node = timeline.get_child(max(0, timeline.get_child_count() - 1))
73
+			if (next_node != null):
74
+				_select_item(next_node)
75
+				
76
+	indent_events()
77
+
78
+func _input(event):
79
+	# some shortcuts need to get handled in the common input event
80
+	# especially CTRL-based
81
+	# because certain godot controls swallow events (like textedit)
82
+	# we protect this with is_visible_in_tree to not 
83
+	# invoke a shortcut by accident
84
+	if (event is InputEventKey and event is InputEventWithModifiers and is_visible_in_tree()):
85
+		# CTRL UP
86
+		if (event.pressed
87
+			and event.alt == false
88
+			and event.shift == false
89
+			and event.control == true
90
+			and event.scancode == KEY_UP
91
+			and event.echo == false
92
+		):
93
+			# select previous
94
+			if (selected_item != null):
95
+				var prev = max(0, selected_item.get_index() - 1)
96
+				var prev_node = timeline.get_child(prev)
97
+				if (prev_node != selected_item):
98
+					_select_item(prev_node)
99
+				get_tree().set_input_as_handled()
100
+				
101
+			pass
102
+			
103
+		# CTRL DOWN
104
+		if (event.pressed
105
+			and event.alt == false
106
+			and event.shift == false
107
+			and event.control == true
108
+			and event.scancode == KEY_DOWN
109
+			and event.echo == false
110
+		):
111
+			# select next
112
+			if (selected_item != null):
113
+				var next = min(timeline.get_child_count() - 1, selected_item.get_index() + 1)
114
+				var next_node = timeline.get_child(next)
115
+				if (next_node != selected_item):
116
+					_select_item(next_node)
117
+				get_tree().set_input_as_handled()
118
+				
119
+			pass
120
+			
121
+		# CTRL DELETE
122
+		if (event.pressed
123
+			and event.alt == false
124
+			and event.shift == false
125
+			and event.control == true
126
+			and event.scancode == KEY_DELETE
127
+			and event.echo == false
128
+		):
129
+			if (selected_item != null):
130
+				delete_event()
131
+				get_tree().set_input_as_handled()
132
+			pass
133
+			
134
+		# CTRL T
135
+		if (event.pressed
136
+			and event.alt == false
137
+			and event.shift == false
138
+			and event.control == true
139
+			and event.scancode == KEY_T
140
+			and event.echo == false
141
+		):
142
+			var new_text = create_event("TextBlock")
143
+			_select_item(new_text)
144
+			indent_events()
145
+			get_tree().set_input_as_handled()
146
+			pass
147
+
148
+
149
+func _unhandled_key_input(event):
150
+	if (event is InputEventWithModifiers):
151
+		# ALT UP
152
+		if (event.pressed
153
+			and event.alt == true 
154
+			and event.shift == false 
155
+			and event.control == false 
156
+			and event.scancode == KEY_UP
157
+			and event.echo == false
158
+		):
159
+			# move selected up
160
+			if (selected_item != null):
161
+				move_block(selected_item, "up")
162
+				indent_events()
163
+				get_tree().set_input_as_handled()
164
+				
165
+			pass
166
+			
167
+		# ALT DOWN
168
+		if (event.pressed
169
+			and event.alt == true 
170
+			and event.shift == false 
171
+			and event.control == false 
172
+			and event.scancode == KEY_DOWN
173
+			and event.echo == false
174
+		):
175
+			# move selected down
176
+			if (selected_item != null):
177
+				move_block(selected_item, "down")
178
+				indent_events()
179
+				get_tree().set_input_as_handled()
180
+				
181
+			pass
182
+			
183
+	pass
184
+	
37 185
 func _process(delta):
38 186
 	if moving_piece != null:
39 187
 		var current_position = get_global_mouse_position()
@@ -45,10 +193,12 @@ func _process(delta):
45 193
 			up_offset = (up_offset / 2) + 5
46 194
 			if current_position.y < node_position - up_offset:
47 195
 				move_block(moving_piece, 'up')
196
+				piece_was_dragged = true
48 197
 		if down_offset != null:
49 198
 			down_offset = height + (down_offset / 2) + 5
50 199
 			if current_position.y > node_position + down_offset:
51 200
 				move_block(moving_piece, 'down')
201
+				piece_was_dragged = true
52 202
 
53 203
 
54 204
 func _clear_selection():
@@ -56,6 +206,7 @@ func _clear_selection():
56 206
 		var selected_panel: PanelContainer = selected_item.get_node("PanelContainer")
57 207
 		if selected_panel != null:
58 208
 			selected_panel.set('custom_styles/panel', saved_style)
209
+			
59 210
 	selected_item = null
60 211
 	saved_style = null
61 212
 
@@ -75,18 +226,28 @@ func _select_item(item: Node):
75 226
 				panel.set('custom_styles/panel', selected_style_text)
76 227
 			else:
77 228
 				panel.set('custom_styles/panel', selected_style)
229
+			# allow event panels to do additional operation when getting selected
230
+			if (selected_item.has_method("on_timeline_selected")):
231
+				selected_item.on_timeline_selected()
78 232
 	else:
79 233
 		_clear_selection()
80 234
 
81 235
 
82 236
 func _on_gui_input(event, item: Node):
83 237
 	if event is InputEventMouseButton and event.button_index == 1:
84
-		if event.is_pressed():
238
+		if (not event.is_pressed()):
239
+			if (not piece_was_dragged and moving_piece != null):
240
+				_clear_selection()
241
+			if (moving_piece != null):
242
+				indent_events()
243
+			moving_piece = null
244
+		elif event.is_pressed():
245
+			moving_piece = item
85 246
 			if not _is_item_selected(item):
86 247
 				_select_item(item)
87
-			moving_piece = item
88
-		else:
89
-			moving_piece = null
248
+				piece_was_dragged = true
249
+			else:
250
+				piece_was_dragged = false
90 251
 
91 252
 
92 253
 # Event Creation signal for buttons
@@ -154,8 +315,14 @@ func indent_events() -> void:
154 315
 	for event in event_list:
155 316
 		var indent_node = event.get_node("Indent")
156 317
 		indent_node.visible = false
318
+		
157 319
 	# Adding new indents
158 320
 	for event in event_list:
321
+		# since there are indicators now, not all elements
322
+		# in this list have an event_data property
323
+		if (not "event_data" in event):
324
+			continue
325
+			
159 326
 		if event.event_data.has('question') or event.event_data.has('condition'):
160 327
 			indent += 1
161 328
 			starter = true
@@ -186,8 +353,8 @@ func indent_events() -> void:
186 353
 
187 354
 
188 355
 func load_timeline(filename: String):
189
-	print('---------------------------')
190
-	print('Loading: ', filename)
356
+	#print('---------------------------')
357
+	#print('Loading: ', filename)
191 358
 	clear_timeline()
192 359
 	var start_time = OS.get_system_time_msecs()
193 360
 	timeline_file = filename
@@ -234,6 +401,8 @@ func load_timeline(filename: String):
234 401
 				create_event("SetValue", i)
235 402
 			{'set_theme'}:
236 403
 				create_event("SetTheme", i)
404
+			{'call_node'}:
405
+				create_event("CallNode", i)
237 406
 
238 407
 	if data.size() < 1:
239 408
 		events_warning.visible = true
@@ -243,7 +412,7 @@ func load_timeline(filename: String):
243 412
 		#fold_all_nodes()
244 413
 	
245 414
 	var elapsed_time = (OS.get_system_time_msecs() - start_time) * 0.001
246
-	editor_reference.dprint("Loading time: " + str(elapsed_time))
415
+	#editor_reference.dprint("Loading time: " + str(elapsed_time))
247 416
 
248 417
 
249 418
 func clear_timeline():
@@ -317,6 +486,9 @@ func generate_save_data():
317 486
 		'events': []
318 487
 	}
319 488
 	for event in timeline.get_children():
489
+		# check that event has event_data (e.g. drag drop indicators)
490
+		if (not "event_data" in event):
491
+			continue
320 492
 		if event.is_queued_for_deletion() == false: # Checking that the event is not waiting to be removed
321 493
 			info_to_save['events'].append(event.event_data)
322 494
 	return info_to_save

+ 132
- 85
addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn View File

@@ -1,4 +1,4 @@
1
-[gd_scene load_steps=22 format=2]
1
+[gd_scene load_steps=25 format=2]
2 2
 
3 3
 [ext_resource path="res://addons/dialogic/Images/character-join.svg" type="Texture" id=1]
4 4
 [ext_resource path="res://addons/dialogic/Images/dialog.svg" type="Texture" id=2]
@@ -19,6 +19,9 @@
19 19
 [ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.gd" type="Script" id=17]
20 20
 [ext_resource path="res://addons/dialogic/Images/theme.svg" type="Texture" id=18]
21 21
 [ext_resource path="res://addons/dialogic/Images/Events/background-music.svg" type="Texture" id=19]
22
+[ext_resource path="res://addons/dialogic/Images/Script.svg" type="Texture" id=20]
23
+[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/EventButton.gd" type="Script" id=21]
24
+[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineArea.gd" type="Script" id=22]
22 25
 
23 26
 [sub_resource type="StyleBoxFlat" id=1]
24 27
 content_margin_left = 5.0
@@ -48,7 +51,6 @@ anchor_bottom = 1.0
48 51
 margin_bottom = 138.0
49 52
 size_flags_horizontal = 3
50 53
 size_flags_vertical = 3
51
-custom_constants/separation = 0
52 54
 split_offset = 7
53 55
 script = ExtResource( 17 )
54 56
 __meta__ = {
@@ -56,11 +58,12 @@ __meta__ = {
56 58
 }
57 59
 
58 60
 [node name="TimelineArea" type="ScrollContainer" parent="."]
59