update dialogic

This commit is contained in:
Arnaud Vergnet 2021-03-25 22:52:07 +01:00
parent 658adfb766
commit adb5380f49
39 changed files with 351 additions and 132 deletions

View file

@ -29,6 +29,9 @@ func _ready():
nodes['color'].connect('color_changed', self, '_on_color_changed')
func is_selected(file: String):
return nodes['file'].text == file
func _on_display_name_toggled(button_pressed):
$HBoxContainer/Container/DisplayName.visible = button_pressed
@ -36,6 +39,8 @@ func _on_display_name_toggled(button_pressed):
func _on_name_changed(value):
var item = master_tree.get_selected()
item.set_text(0, value)
save_character()
master_tree.build_characters(nodes['file'].text)
func _on_color_changed(color):
@ -77,8 +82,8 @@ func create_character():
func new_character():
# This event creates and selects the new timeline
master_tree.add_character(create_character()['metadata'], true)
# This event creates and selects the new character
master_tree.build_characters(create_character()['metadata']['file'])
# Saving and Loading

View file

@ -22,6 +22,9 @@ func _ready():
nodes['type'].connect('item_selected', self, '_on_type_selected')
func is_selected(id: String):
return current_definition != null and current_definition['id'] == id
func load_definition(id):
current_definition = DialogicResources.get_default_definition_item(id)
reset_editor()
@ -53,6 +56,9 @@ func reset_editor():
func _on_name_changed(text):
var item = master_tree.get_selected()
item.set_text(0, text)
if current_definition != null:
save_definition()
master_tree.build_definitions(current_definition['id'])
func _on_type_selected(index):
@ -76,11 +82,11 @@ func show_sub_editor(type):
func new_definition():
var id = DialogicUtil.generate_random_id()
DialogicResources.set_default_definition_variable(id, 'New definition', '')
master_tree.add_definition({'id': id, 'name': 'New definition', 'type': 0}, true)
master_tree.build_definitions(id)
func save_definition():
if current_definition['id'] != '':
if current_definition != null and current_definition['id'] != '':
var type: int = nodes['type'].selected
if type == 0:
DialogicResources.set_default_definition_variable(current_definition['id'], nodes['name'].text, nodes['value'].text)

View file

@ -6,6 +6,7 @@ var editor_file_dialog # EditorFileDialog
var file_picker_data: Dictionary = {'method': '', 'node': self}
var current_editor_view: String = 'Master'
var version_string: String
onready var master_tree = $MainPanel/MasterTree
onready var timeline_editor = $MainPanel/TimelineEditor
onready var character_editor = $MainPanel/CharacterEditor
onready var definition_editor = $MainPanel/DefinitionEditor
@ -24,6 +25,8 @@ func _ready():
definition_editor.editor_reference = self
theme_editor.editor_reference = self
master_tree.connect("editor_selected", self, 'on_master_tree_editor_selected')
# Toolbar
$ToolBar/NewTimelineButton.connect('pressed', $MainPanel/TimelineEditor, 'new_timeline')
$ToolBar/NewCharactersButton.connect('pressed', $MainPanel/CharacterEditor, 'new_character')
@ -31,8 +34,8 @@ func _ready():
$ToolBar/NewDefinitionButton.connect('pressed', $MainPanel/DefinitionEditor, 'new_definition')
$ToolBar/Docs.icon = get_icon("Instance", "EditorIcons")
$ToolBar/Docs.connect('pressed', OS, "shell_open", ["https://dialogic.coppolaemilio.com"])
#$ToolBar/FoldTools/ButtonFold.connect('pressed', $EditorTimeline, 'fold_all_nodes')
#$ToolBar/FoldTools/ButtonUnfold.connect('pressed', $EditorTimeline, 'unfold_all_nodes')
$ToolBar/FoldTools/ButtonFold.connect('pressed', timeline_editor, 'fold_all_nodes')
$ToolBar/FoldTools/ButtonUnfold.connect('pressed', timeline_editor, 'unfold_all_nodes')
# Connecting context menus
@ -55,6 +58,10 @@ func _ready():
$ToolBar/Version.text = 'v' + version_string
func on_master_tree_editor_selected(editor: String):
$ToolBar/FoldTools.visible = editor == 'timeline'
# Timeline context menu
func _on_TimelinePopupMenu_id_pressed(id):
if id == 0: # View files
@ -71,7 +78,7 @@ func _on_RemoveTimelineConfirmation_confirmed():
print('target: ', target)
DialogicResources.delete_timeline(target)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
$MainPanel/MasterTree.hide_all_editors()
# Character context menu
@ -102,21 +109,21 @@ func _on_RemoveDefinitionConfirmation_confirmed():
var target = $MainPanel/DefinitionEditor.current_definition['id']
DialogicResources.delete_default_definition(target)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
$MainPanel/MasterTree.hide_all_editors()
func _on_RemoveCharacterConfirmation_confirmed():
var filename = DialogicResources.get_path('CHAR_DIR', $MainPanel/CharacterEditor.opened_character_data['id'])
DialogicResources.delete_character(filename)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
$MainPanel/MasterTree.hide_all_editors()
func _on_RemoveThemeConfirmation_confirmed():
var filename = $MainPanel/MasterTree.get_selected().get_metadata(0)['file']
DialogicResources.delete_theme(filename)
$MainPanel/MasterTree.remove_selected()
$MainPanel/MasterTree.hide_all_editors(true)
$MainPanel/MasterTree.hide_all_editors()
# Godot dialog

View file

@ -298,5 +298,4 @@ dialog_text = "Are you sure you want to remove this timeline?
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="gui_input" from="ToolBar/Logo" to="." method="_on_Logo_gui_input"]

View file

@ -18,6 +18,8 @@ var definitions_tree
var themes_tree
var settings_tree
signal editor_selected(selected)
func _ready():
allow_rmb_select = true
var root = tree.create_item()
@ -61,30 +63,37 @@ func _ready():
#subchild1.set_text(0, "Subchild1")
# Adding timelines
for t in DialogicUtil.get_timeline_list():
add_timeline(t)
build_timelines()
# Adding characters
for c in DialogicUtil.get_character_list():
add_character(c)
build_characters()
# Adding Definitions
for d in DialogicUtil.get_default_definitions_list():
add_definition(d)
build_definitions()
# Adding Themes
for m in DialogicUtil.get_theme_list():
add_theme(m)
build_themes()
# Default empty screen.
hide_all_editors(true)
hide_all_editors()
# AutoSave timer
$AutoSave.connect("timeout", self, '_on_autosave_timeout')
$AutoSave.start(0.5)
func add_timeline(timeline, select = false):
func _clear_tree_children(parent: TreeItem):
while parent.get_children() != null:
parent.get_children().free()
func build_timelines(selected_item: String=''):
_clear_tree_children(timelines_tree)
for t in DialogicUtil.get_sorted_timeline_list():
_add_timeline(t, not selected_item.empty() and t['file'] == selected_item)
func _add_timeline(timeline, select = false):
var item = tree.create_item(timelines_tree)
item.set_icon(0, timeline_icon)
if timeline.has('name'):
@ -98,7 +107,13 @@ func add_timeline(timeline, select = false):
item.select(0)
func add_theme(theme_item, select = false):
func build_themes(selected_item: String=''):
_clear_tree_children(themes_tree)
for t in DialogicUtil.get_sorted_theme_list():
_add_theme(t, not selected_item.empty() and t['file'] == selected_item)
func _add_theme(theme_item, select = false):
var item = tree.create_item(themes_tree)
item.set_icon(0, get_icon("StyleBoxTexture", "EditorIcons"))
item.set_text(0, theme_item['name'])
@ -109,7 +124,13 @@ func add_theme(theme_item, select = false):
item.select(0)
func add_character(character, select = false):
func build_characters(selected_item: String=''):
_clear_tree_children(characters_tree)
for t in DialogicUtil.get_sorted_character_list():
_add_character(t, not selected_item.empty() and t['file'] == selected_item)
func _add_character(character, select = false):
var item = tree.create_item(characters_tree)
item.set_icon(0, character_icon)
if character.has('name'):
@ -126,7 +147,13 @@ func add_character(character, select = false):
item.select(0)
func add_definition(definition, select = false):
func build_definitions(selected_item: String=''):
_clear_tree_children(definitions_tree)
for t in DialogicUtil.get_sorted_default_definitions_list():
_add_definition(t, not selected_item.empty() and t['id'] == selected_item)
func _add_definition(definition, select = false):
var item = tree.create_item(definitions_tree)
item.set_text(0, definition['name'])
item.set_icon(0, get_icon("Variant", "EditorIcons"))
@ -146,33 +173,79 @@ func _on_item_selected():
# save_current_resource()
var item = get_selected()
var metadata = item.get_metadata(0)
hide_all_editors()
if metadata['editor'] == 'Timeline':
timeline_editor.visible = true
timeline_editor.load_timeline(metadata['file'])
show_timeline_editor()
if metadata['editor'] == 'Character':
character_editor.visible = true
character_editor.load_character(metadata['file'])
if not character_editor.is_selected(metadata['file']):
character_editor.load_character(metadata['file'])
show_character_editor()
if metadata['editor'] == 'Definition':
definition_editor.visible = true
definition_editor.load_definition(metadata['id'])
if not definition_editor.is_selected(metadata['id']):
definition_editor.visible = true
definition_editor.load_definition(metadata['id'])
show_definition_editor()
if metadata['editor'] == 'Theme':
theme_editor.load_theme(metadata['file'])
theme_editor.visible = true
show_theme_editor()
if metadata['editor'] == 'Settings':
settings_editor.update_data()
settings_editor.visible = true
show_settings_editor()
func hide_all_editors(show_empty = false):
func show_character_editor():
emit_signal("editor_selected", 'character')
character_editor.visible = true
timeline_editor.visible = false
definition_editor.visible = false
theme_editor.visible = false
settings_editor.visible = false
empty_editor.visible = false
func show_timeline_editor():
emit_signal("editor_selected", 'timeline')
character_editor.visible = false
timeline_editor.visible = true
definition_editor.visible = false
theme_editor.visible = false
settings_editor.visible = false
empty_editor.visible = false
func show_definition_editor():
emit_signal("editor_selected", 'definition')
character_editor.visible = false
timeline_editor.visible = false
definition_editor.visible = true
theme_editor.visible = false
settings_editor.visible = false
empty_editor.visible = false
func show_theme_editor():
emit_signal("editor_selected", 'theme')
character_editor.visible = false
timeline_editor.visible = false
definition_editor.visible = false
theme_editor.visible = true
settings_editor.visible = false
empty_editor.visible = false
func show_settings_editor():
emit_signal("editor_selected", 'theme')
character_editor.visible = false
timeline_editor.visible = false
definition_editor.visible = false
theme_editor.visible = false
settings_editor.visible = true
empty_editor.visible = false
func hide_all_editors():
emit_signal("editor_selected", 'none')
character_editor.visible = false
timeline_editor.visible = false
definition_editor.visible = false
theme_editor.visible = false
settings_editor.visible = false
if show_empty:
empty_editor.visible = true
empty_editor.visible = true
func _on_item_rmb_selected(position):
@ -216,18 +289,26 @@ func _on_gui_input(event):
func _on_item_edited():
print('edited')
var item = get_selected()
var metadata = item.get_metadata(0)
if metadata['editor'] == 'Timeline':
timeline_editor.timeline_name = item.get_text(0)
save_current_resource()
build_timelines(metadata['file'])
if metadata['editor'] == 'Theme':
DialogicResources.set_theme_value(metadata['file'], 'settings', 'name', item.get_text(0))
build_themes(metadata['file'])
if metadata['editor'] == 'Character':
character_editor.nodes['name'].text = item.get_text(0)
save_current_resource()
build_characters(metadata['file'])
if metadata['editor'] == 'Definition':
definition_editor.nodes['name'].text = item.get_text(0)
# Not sure why this signal doesn't triggers
definition_editor._on_name_changed(item.get_text(0))
save_current_resource()
build_definitions(metadata['id'])
func _on_autosave_timeout():

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/AudioBlock.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/audio-event.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Images/play.svg" type="Texture" id=5]
@ -98,11 +99,10 @@ margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 157.0
margin_right = 1735.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0
@ -113,7 +113,6 @@ items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down",
[node name="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"]
[node name="DragController" parent="." instance=ExtResource( 6 )]
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/ChangeScene.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/change-scene.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=6]
@ -90,11 +91,10 @@ margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 170.0
margin_right = 1735.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0
@ -105,6 +105,5 @@ items = [ "Move Up", null, 0, false, false, 0, 0, null, "", false, "Move Down",
[node name="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"]
[node name="DragController" parent="." instance=ExtResource( 6 )]
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonScenePicker" to="." method="_on_ButtonScenePicker_pressed"]
[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]

View file

@ -27,7 +27,7 @@ func _on_MenuButton_about_to_show():
var Dropdown = $PanelContainer/VBoxContainer/Header/MenuButton
Dropdown.get_popup().clear()
var index = 0
for c in DialogicUtil.get_timeline_list():
for c in DialogicUtil.get_sorted_timeline_list():
Dropdown.get_popup().add_item(c['name'])
Dropdown.get_popup().set_item_metadata(index, {'file': c['file'], 'color': c['color']})
index += 1

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/ChangeTimeline.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/change-timeline.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
@ -80,11 +81,10 @@ margin_right = 267.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 271.0
margin_right = 1735.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0
@ -93,5 +93,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="about_to_show" from="PanelContainer/VBoxContainer/Header/MenuButton" to="." method="_on_MenuButton_about_to_show"]

View file

@ -1,5 +1,6 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/CharacterJoinBlock.gd" type="Script" id=3]
[ext_resource path="res://addons/dialogic/Images/character-join.svg" type="Texture" id=4]
@ -124,11 +125,10 @@ margin_right = 186.0
margin_bottom = 30.0
icon = ExtResource( 5 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 1 )]
margin_left = 502.0
margin_right = 1735.0
margin_bottom = 30.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 1739.0

View file

@ -20,7 +20,7 @@ func _on_CharacterDropdown_about_to_show():
Dropdown.get_popup().clear()
Dropdown.get_popup().add_item("[All]")
var index = 1
for c in DialogicUtil.get_character_list():
for c in DialogicUtil.get_sorted_character_list():
Dropdown.get_popup().add_item(c['name'])
Dropdown.get_popup().set_item_metadata(index, {'file': c['file'], 'color': c['color']})
index += 1

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/CharacterLeaveBlock.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/character-leave.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
@ -88,11 +89,10 @@ margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 243.0
margin_right = 1735.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0
@ -101,5 +101,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="about_to_show" from="PanelContainer/VBoxContainer/Header/CharacterDropdown" to="." method="_on_CharacterDropdown_about_to_show"]

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://addons/dialogic/Images/choice.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Choice.gd" type="Script" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Images/warning.svg" type="Texture" id=6]
@ -98,11 +99,10 @@ margin_right = 102.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 106.0
margin_right = 941.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 945.0
@ -111,5 +111,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="visibility_changed" from="Indent" to="." method="_on_Indent_visibility_changed"]

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/dialogic/Images/end-dialog.svg" type="Texture" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/CloseDialog.gd" type="Script" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=5]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0
@ -74,11 +75,10 @@ margin_right = 117.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
margin_left = 121.0
margin_right = 1735.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 1739.0

View file

@ -15,7 +15,7 @@ func _on_Dropdown_about_to_show():
popup.set_item_metadata(0, {'file': '', 'color': Color('#ffffff')})
var index = 1
for c in DialogicUtil.get_character_list():
for c in DialogicUtil.get_sorted_character_list():
popup.add_item(c['name'])
popup.set_item_metadata(index, {'file': c['file'],'color': c['color']})
index += 1

View file

@ -12,12 +12,13 @@ func _ready():
func _on_MenuButton_about_to_show():
get_popup().clear()
var index = 0
for d in DialogicResources.get_default_definitions()['variables']:
get_popup().add_item(d['name'])
get_popup().set_item_metadata(index, {
'id': d['id'],
})
index += 1
for d in DialogicUtil.get_sorted_default_definitions_list():
if d['type'] == 0:
get_popup().add_item(d['name'])
get_popup().set_item_metadata(index, {
'id': d['id'],
})
index += 1
func _on_entry_selected(index):

View file

@ -37,7 +37,7 @@ func _on_about_to_show():
if allow_dont_change:
get_popup().add_item("[Don't change]")
index += 1
for c in DialogicUtil.get_character_list():
for c in DialogicUtil.get_sorted_character_list():
if c['file'] == character:
for p in c['portraits']:
get_popup().add_item(p['name'])

View file

@ -0,0 +1,8 @@
[gd_scene format=2]
[node name="Spacer" type="Control"]
mouse_filter = 1
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Images/signal.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/EmitSignal.gd" type="Script" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
@ -104,11 +105,10 @@ margin_right = 180.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 184.0
margin_right = 941.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 945.0
@ -117,5 +117,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/Header/LineEdit" to="." method="_on_LineEdit_text_changed"]

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/EndBranch.gd" type="Script" id=4]
[ext_resource path="res://addons/dialogic/Images/end-choice.svg" type="Texture" id=5]
@ -77,11 +78,10 @@ margin_right = 109.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 113.0
margin_right = 961.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 1 )]
margin_left = 965.0

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/dialogic/Images/condition.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/IfCondition.gd" type="Script" id=2]
@ -7,6 +7,7 @@
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CustomLineEdit.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DefinitionPicker.tscn" type="PackedScene" id=7]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0
@ -85,11 +86,10 @@ margin_right = 308.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
margin_left = 312.0
margin_right = 941.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 945.0

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Images/question.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Question.gd" type="Script" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
@ -87,11 +88,10 @@ margin_right = 305.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 309.0
margin_right = 941.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 945.0
@ -100,5 +100,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/Header/LineEdit" to="." method="_on_LineEdit_text_changed"]

View file

@ -1,10 +1,11 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Images/scene.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/VisibleToggle.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/SceneEvent.gd" type="Script" id=5]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=6]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0
@ -37,7 +38,7 @@ margin_bottom = 74.0
[node name="PanelContainer" type="PanelContainer" parent="."]
margin_right = 1024.0
margin_bottom = 74.0
margin_bottom = 78.0
mouse_filter = 1
size_flags_horizontal = 3
size_flags_vertical = 3
@ -47,7 +48,7 @@ custom_styles/panel = SubResource( 1 )
margin_left = 16.0
margin_top = 6.0
margin_right = 1018.0
margin_bottom = 68.0
margin_bottom = 72.0
size_flags_horizontal = 3
[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
@ -80,12 +81,10 @@ margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
margin_left = 169.0
margin_right = 961.0
margin_bottom = 30.0
mouse_filter = 1
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 965.0
@ -126,12 +125,11 @@ size_flags_horizontal = 3
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer"]
margin_top = 62.0
margin_right = 1002.0
margin_bottom = 62.0
margin_bottom = 66.0
size_flags_horizontal = 3
size_flags_vertical = 3
expand = true
stretch_mode = 5
[node name="DragController" parent="." instance=ExtResource( 3 )]
[connection signal="pressed" from="PanelContainer/VBoxContainer/HBoxContainer/ImageButton" to="." method="_on_ImageButton_pressed"]

View file

@ -26,7 +26,7 @@ func load_data(data):
func _on_MenuButton_about_to_show():
var Dropdown = $PanelContainer/VBoxContainer/Header/MenuButton
var theme_list = DialogicUtil.get_theme_list()
var theme_list = DialogicUtil.get_sorted_theme_list()
var index = 0
Dropdown.get_popup().clear()

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/SetTheme.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/theme.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
@ -80,11 +81,10 @@ margin_right = 217.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 221.0
margin_right = 1735.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0
@ -93,5 +93,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="about_to_show" from="PanelContainer/VBoxContainer/Header/MenuButton" to="." method="_on_MenuButton_about_to_show"]

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/SetValue.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Images/Events/set-value.svg" type="Texture" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DefinitionPicker.tscn" type="PackedScene" id=6]
@ -117,11 +118,10 @@ margin_right = 389.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 393.0
margin_right = 941.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 945.0
@ -130,5 +130,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/Header/LineEdit" to="." method="_on_LineEdit_text_changed"]

View file

@ -21,7 +21,7 @@ func _ready():
$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected')
portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
var c_list = DialogicUtil.get_character_list()
var c_list = DialogicUtil.get_sorted_character_list()
if c_list.size() == 0:
$PanelContainer/VBoxContainer/Header/CharacterPicker.visible = false
else:

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/TextBlock.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/VisibleToggle.tscn" type="PackedScene" id=2]
@ -7,6 +7,7 @@
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/CharacterPicker.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PortraitPicker.tscn" type="PackedScene" id=7]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 6.0
@ -100,19 +101,17 @@ margin_right = 183.0
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
visible = false
margin_left = 234.0
margin_left = 187.0
margin_top = 8.0
margin_right = 246.0
margin_right = 199.0
margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = "..."
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
margin_left = 187.0
margin_right = 971.0
margin_bottom = 30.0
mouse_filter = 1
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 975.0
@ -131,5 +130,4 @@ smooth_scrolling = true
wrap_enabled = true
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]

View file

@ -1,7 +1,8 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Images/Wait.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Pieces/WaitSeconds.gd" type="Script" id=2]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/Spacer.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Pieces/Common/DragController.tscn" type="PackedScene" id=5]
@ -93,11 +94,10 @@ margin_right = 222.0
margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" type="Control" parent="PanelContainer/VBoxContainer/Header"]
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 226.0
margin_right = 941.0
margin_bottom = 28.0
size_flags_horizontal = 3
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 945.0
@ -106,5 +106,4 @@ margin_bottom = 28.0
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 ]
[node name="DragController" parent="." instance=ExtResource( 5 )]
[connection signal="value_changed" from="PanelContainer/VBoxContainer/Header/SpinBox" to="." method="_on_SpinBox_value_changed"]

View file

@ -0,0 +1,17 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
content_margin_left = 16.0
content_margin_right = 6.0
content_margin_top = 6.0
content_margin_bottom = 6.0
bg_color = Color( 0.0980392, 0.329412, 0.509804, 1 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color( 0.0901961, 0.560784, 0.937255, 1 )
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6

View file

@ -31,7 +31,7 @@ func dialog_options(settings):
func refresh_themes(settings):
nodes['themes'].clear()
var theme_list = DialogicUtil.get_theme_list()
var theme_list = DialogicUtil.get_sorted_theme_list()
var theme_indexes = {}
var index = 0
for theme in theme_list:

View file

@ -120,7 +120,7 @@ func load_theme(filename):
func new_theme():
var theme_file = 'theme-' + str(OS.get_unix_time()) + '.cfg'
DialogicResources.add_theme(theme_file)
master_tree.add_theme({'file': theme_file, 'name': theme_file})
master_tree.build_themes(theme_file)
load_theme(theme_file)
# Check if it is the only theme to set as default
if DialogicUtil.get_theme_list().size() == 1:

View file

@ -10,6 +10,11 @@ onready var master_tree = get_node('../MasterTree')
onready var timeline = $TimelineArea/TimeLine
onready var events_warning = $ScrollContainer/EventContainer/EventsWarning
var hovered_item = null
var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Pieces/selected_styleboxflat.tres")
var saved_style : StyleBoxFlat
var selected_item : Node
func _ready():
# We connect all the event buttons to the event creation functions
for b in $ScrollContainer/EventContainer.get_children():
@ -22,6 +27,32 @@ func _ready():
b.connect('pressed', self, "_create_event_button_pressed", [b.name])
func _clear_selection():
if selected_item != null and saved_style != null:
var selected_panel: PanelContainer = selected_item.get_node("PanelContainer")
if selected_panel != null:
selected_panel.set('custom_styles/panel', saved_style)
selected_item = null
saved_style = null
func _select_item(item: Node):
if item != selected_item:
_clear_selection()
var panel: PanelContainer = item.get_node("PanelContainer")
if panel != null:
saved_style = panel.get('custom_styles/panel')
selected_item = item
panel.set('custom_styles/panel', selected_style)
else:
_clear_selection()
func _on_gui_input(event, item: Node):
if event is InputEventMouseButton and event.button_index == 1 and event.is_pressed():
_select_item(item)
# Event Creation signal for buttons
func _create_event_button_pressed(button_name):
create_event(button_name)
@ -29,15 +60,29 @@ func _create_event_button_pressed(button_name):
func _on_ButtonQuestion_pressed() -> void:
create_event("Question", {'no-data': true}, true)
create_event("Choice", {'no-data': true}, true)
create_event("Choice", {'no-data': true}, true)
create_event("EndBranch", {'no-data': true}, true)
if selected_item != null:
# Events are added bellow the selected node
# So we must reverse the adding order
create_event("EndBranch", {'no-data': true}, true)
create_event("Choice", {'no-data': true}, true)
create_event("Choice", {'no-data': true}, true)
create_event("Question", {'no-data': true}, true)
else:
create_event("Question", {'no-data': true}, true)
create_event("Choice", {'no-data': true}, true)
create_event("Choice", {'no-data': true}, true)
create_event("EndBranch", {'no-data': true}, true)
func _on_ButtonCondition_pressed() -> void:
create_event("IfCondition", {'no-data': true}, true)
create_event("EndBranch", {'no-data': true}, true)
if selected_item != null:
# Events are added bellow the selected node
# So we must reverse the adding order
create_event("EndBranch", {'no-data': true}, true)
create_event("IfCondition", {'no-data': true}, true)
else:
create_event("IfCondition", {'no-data': true}, true)
create_event("EndBranch", {'no-data': true}, true)
# Adding an event to the timeline
@ -45,9 +90,14 @@ func create_event(scene: String, data: Dictionary = {'no-data': true} , indent:
# This function will create an event in the timeline.
var piece = load("res://addons/dialogic/Editor/Pieces/" + scene + ".tscn").instance()
piece.editor_reference = editor_reference
timeline.add_child(piece)
if selected_item != null:
timeline.add_child_below_node(selected_item, piece)
else:
timeline.add_child(piece)
if data.has('no-data') == false:
piece.load_data(data)
piece.connect("gui_input", self, '_on_gui_input', [piece])
events_warning.visible = false
# Indent on create
if indent:
@ -159,6 +209,7 @@ func load_timeline(filename: String):
func clear_timeline():
_clear_selection()
for event in timeline.get_children():
event.free()
@ -191,7 +242,7 @@ func create_timeline():
func new_timeline():
# This event creates and selects the new timeline
master_tree.add_timeline(create_timeline()['metadata'], true)
master_tree.build_timelines(create_timeline()['metadata']['file'])
# Saving
@ -220,9 +271,11 @@ func save_timeline() -> void:
# Utilities
func fold_all_nodes():
for event in timeline.get_children():
event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(false)
if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"):
event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(false)
func unfold_all_nodes():
for event in timeline.get_children():
event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(true)
if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"):
event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(true)

View file

@ -102,7 +102,7 @@ static func get_variable(name: String) -> String:
## [`str()`](https://docs.godotengine.org/en/stable/classes/class_string.html) function.
##
## @param name The name of the variable to edit.
## @param value The value of the variable to set.
## @param value The value to set the variable to.
static func set_variable(name: String, value) -> void:
DialogicSingleton.set_variable(name, value)

View file

@ -39,6 +39,12 @@ static func get_character_list() -> Array:
return characters
static func get_sorted_character_list():
var array = get_character_list()
array.sort_custom(DialgicSorter, 'sort_resources')
return array
static func get_timeline_list() -> Array:
var timelines: Array = []
for file in DialogicResources.listdir(DialogicResources.get_path('TIMELINE_DIR')):
@ -54,12 +60,17 @@ static func get_timeline_list() -> Array:
return timelines
static func get_sorted_timeline_list():
var array = get_timeline_list()
array.sort_custom(DialgicSorter, 'sort_resources')
return array
static func get_theme_list() -> Array:
var themes: Array = []
for file in DialogicResources.listdir(DialogicResources.get_path('THEME_DIR')):
if '.cfg' in file:
var config = ConfigFile.new()
var err = DialogicResources.get_theme_config(file)
var config = DialogicResources.get_theme_config(file)
themes.append({
'file': file,
'name': config.get_value('settings','name', file),
@ -68,10 +79,22 @@ static func get_theme_list() -> Array:
return themes
static func get_sorted_theme_list():
var array = get_theme_list()
array.sort_custom(DialgicSorter, 'sort_resources')
return array
static func get_default_definitions_list() -> Array:
return DialogicDefinitionsUtil.definitions_json_to_array(DialogicResources.get_default_definitions())
static func get_sorted_default_definitions_list():
var array = get_default_definitions_list()
array.sort_custom(DialgicSorter, 'sort_resources')
return array
static func generate_random_id() -> String:
return str(OS.get_unix_time()) + '-' + str(100 + randi()%899+1)
@ -85,3 +108,28 @@ static func compare_dicts(dict_1: Dictionary, dict_2: Dictionary) -> bool:
return false
class DialgicSorter:
static func key_available(key, a: Dictionary) -> bool:
return key in a.keys() and not a[key].empty()
static func get_compare_value(a: Dictionary) -> String:
if key_available('display_name', a):
return a['display_name']
if key_available('name', a):
return a['name']
if key_available('id', a):
return a['id']
if 'metadata' in a.keys():
var a_metadata = a['metadata']
if key_available('name', a_metadata):
return a_metadata['name']
if key_available('file', a_metadata):
return a_metadata['file']
return ''
static func sort_resources(a: Dictionary, b: Dictionary):
return get_compare_value(a).to_lower() < get_compare_value(b).to_lower()

View file

@ -28,7 +28,7 @@ func _about_to_show_menu():
# Adding timelines
timelines_dropdown.get_popup().clear()
var index = 0
for c in DialogicUtil.get_timeline_list():
for c in DialogicUtil.get_sorted_timeline_list():
timelines_dropdown.get_popup().add_item(c['name'])
timelines_dropdown.get_popup().set_item_metadata(index, {'file': c['file'], 'color': c['color']})
index += 1

View file

@ -7,3 +7,11 @@ name="theme_normal"
use_background_color=false
background_color="#ff3c7c11"
text_color="#ff30c3f0"
[box]
size=Vector2( 910, 167 )
[text]
margin=Vector2( 20, 10 )

View file

@ -1 +1 @@
{"events":[{"change_timeline":"timeline-1616656510.json"}],"metadata":{"dialogic-version":"1.0","file":"timeline-1616659306.json","name":"start"}}
{"events":[{"change_timeline":"timeline-1616656510.json"}],"metadata":{"dialogic-version":"1.0","file":"timeline-1616659306.json","name":"_start"}}

View file

@ -1 +1 @@
{"events":[{"wait_seconds":0},{"character":"","portrait":"","text":"Fin de la démo, merci d'avoir joué !"},{"action":"join","character":"character-1616658435.json","portrait":"","position":{"0":false,"1":false,"2":false,"3":false,"4":true}},{"character":"character-1616658435.json","portrait":"","text":"À bientôt dans l'métro !"},{"action":"leaveall","character":"[All]"}],"metadata":{"dialogic-version":"1.0","file":"timeline-1616662258.json","name":"end"}}
{"events":[{"wait_seconds":1},{"character":"","portrait":"","text":"Fin de la démo, merci d'avoir joué !"},{"action":"join","character":"character-1616658435.json","portrait":"","position":{"0":false,"1":false,"2":false,"3":false,"4":true}},{"character":"character-1616658435.json","portrait":"","text":"À bientôt dans l'métro !"},{"action":"leaveall","character":"[All]"}],"metadata":{"dialogic-version":"1.0","file":"timeline-1616662258.json","name":"_end"}}