update dialogic

This commit is contained in:
Arnaud Vergnet 2021-04-16 16:35:07 +02:00
parent a84ceea08d
commit 519475a5ba
62 changed files with 2174 additions and 1057 deletions

View file

@ -11,6 +11,7 @@ onready var nodes = {
'description': $HBoxContainer/Container/Description/TextEdit, 'description': $HBoxContainer/Container/Description/TextEdit,
'file': $HBoxContainer/Container/FileName/LineEdit, 'file': $HBoxContainer/Container/FileName/LineEdit,
'color': $HBoxContainer/Container/Color/ColorPickerButton, 'color': $HBoxContainer/Container/Color/ColorPickerButton,
'mirror_portraits_checkbox' : $HBoxContainer/VBoxContainer/HBoxContainer/MirrorOption/MirrorPortraitsCheckBox,
'default_speaker': $HBoxContainer/Container/Actions/DefaultSpeaker, 'default_speaker': $HBoxContainer/Container/Actions/DefaultSpeaker,
'display_name_checkbox': $HBoxContainer/Container/Name/CheckBox, 'display_name_checkbox': $HBoxContainer/Container/Name/CheckBox,
'display_name': $HBoxContainer/Container/DisplayName/LineEdit, 'display_name': $HBoxContainer/Container/DisplayName/LineEdit,
@ -55,6 +56,7 @@ func clear_character_editor():
nodes['name'].text = '' nodes['name'].text = ''
nodes['description'].text = '' nodes['description'].text = ''
nodes['color'].color = Color('#ffffff') nodes['color'].color = Color('#ffffff')
nodes['mirror_portraits_checkbox'].pressed = false
nodes['default_speaker'].pressed = false nodes['default_speaker'].pressed = false
nodes['display_name_checkbox'].pressed = false nodes['display_name_checkbox'].pressed = false
nodes['display_name'].text = '' nodes['display_name'].text = ''
@ -76,7 +78,8 @@ func create_character():
'color': '#ffffff', 'color': '#ffffff',
'id': character_file, 'id': character_file,
'default_speaker': false, 'default_speaker': false,
'portraits': [] 'portraits': [],
'mirror_portraits' :false
} }
DialogicResources.set_character(character) DialogicResources.set_character(character)
character['metadata'] = {'file': character_file} character['metadata'] = {'file': character_file}
@ -101,6 +104,7 @@ func generate_character_data_to_save():
'id': nodes['file'].text, 'id': nodes['file'].text,
'description': nodes['description'].text, 'description': nodes['description'].text,
'color': '#' + nodes['color'].color.to_html(), 'color': '#' + nodes['color'].color.to_html(),
'mirror_portraits': nodes["mirror_portraits_checkbox"].pressed,
'default_speaker': default_speaker, 'default_speaker': default_speaker,
'portraits': portraits, 'portraits': portraits,
'display_name_bool': nodes['display_name_checkbox'].pressed, 'display_name_bool': nodes['display_name_checkbox'].pressed,
@ -150,7 +154,14 @@ func load_character(filename: String):
if data.has('offset_x'): if data.has('offset_x'):
nodes['offset_x'].value = data['offset_x'] nodes['offset_x'].value = data['offset_x']
nodes['offset_y'].value = data['offset_y'] nodes['offset_y'].value = data['offset_y']
if data.has('mirror_portraits'):
nodes['mirror_portraits_checkbox'].pressed = data['mirror_portraits']
nodes['portrait_preview'].flip_h = data['mirror_portraits']
else:
nodes['mirror_portraits_checkbox'].pressed = false
nodes['portrait_preview'].flip_h = false
# Portraits # Portraits
var default_portrait = create_portrait_entry() var default_portrait = create_portrait_entry()
default_portrait.get_node('NameEdit').text = 'Default' default_portrait.get_node('NameEdit').text = 'Default'
@ -183,3 +194,7 @@ func create_portrait_entry(p_name = '', path = '', grab_focus = false):
p.get_node("NameEdit").grab_focus() p.get_node("NameEdit").grab_focus()
p._on_ButtonSelect_pressed() p._on_ButtonSelect_pressed()
return p return p
func _on_MirrorPortraitsCheckBox_toggled(button_pressed):
nodes['portrait_preview'].flip_h = button_pressed

View file

@ -8,7 +8,7 @@ content_margin_left = 5.0
content_margin_right = 5.0 content_margin_right = 5.0
content_margin_top = 5.0 content_margin_top = 5.0
content_margin_bottom = 5.0 content_margin_bottom = 5.0
bg_color = Color( 0.2, 0.23, 0.31, 1 ) bg_color = Color( 0.03, 0.21, 0.26, 1 )
[node name="CharacterEditor" type="ScrollContainer"] [node name="CharacterEditor" type="ScrollContainer"]
margin_left = 192.0 margin_left = 192.0
@ -141,9 +141,9 @@ margin_bottom = 14.0
text = "Portraits / Expressions" text = "Portraits / Expressions"
[node name="Labels" type="HBoxContainer" parent="HBoxContainer/Container"] [node name="Labels" type="HBoxContainer" parent="HBoxContainer/Container"]
margin_top = 188.0 margin_top = 216.0
margin_right = 523.0 margin_right = 523.0
margin_bottom = 202.0 margin_bottom = 230.0
[node name="LineEdit" type="Label" parent="HBoxContainer/Container/Labels"] [node name="LineEdit" type="Label" parent="HBoxContainer/Container/Labels"]
margin_right = 100.0 margin_right = 100.0
@ -314,3 +314,15 @@ rect_min_size = Vector2( 100, 0 )
allow_greater = true allow_greater = true
allow_lesser = true allow_lesser = true
suffix = "Y" suffix = "Y"
[node name="MirrorOption" type="HBoxContainer" parent="HBoxContainer/VBoxContainer/HBoxContainer"]
margin_left = 398.0
margin_right = 523.0
margin_bottom = 24.0
[node name="MirrorPortraitsCheckBox" type="CheckBox" parent="HBoxContainer/VBoxContainer/HBoxContainer/MirrorOption"]
margin_right = 125.0
margin_bottom = 24.0
text = "Mirror portraits"
[connection signal="toggled" from="HBoxContainer/VBoxContainer/HBoxContainer/MirrorOption/MirrorPortraitsCheckBox" to="." method="_on_MirrorPortraitsCheckBox_toggled"]

View file

@ -72,11 +72,35 @@ func _ready():
$ToolBar/FoldTools/ButtonUnfold.connect('pressed', timeline_editor, 'unfold_all_nodes') $ToolBar/FoldTools/ButtonUnfold.connect('pressed', timeline_editor, 'unfold_all_nodes')
# Adding items to context menus
$TimelinePopupMenu.add_icon_item(get_icon("Filesystem", "EditorIcons"), 'Show in File Manager')
$TimelinePopupMenu.add_icon_item(get_icon("ActionCopy", "EditorIcons"), 'Copy Timeline Name')
$TimelinePopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Timeline')
$CharacterPopupMenu.add_icon_item(get_icon("Filesystem", "EditorIcons"), 'Show in File Manager')
$CharacterPopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Character')
$ThemePopupMenu.add_icon_item(get_icon("Filesystem", "EditorIcons"), 'Show in File Manager')
$ThemePopupMenu.add_icon_item(get_icon("Duplicate", "EditorIcons"), 'Duplicate Theme')
$ThemePopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Theme')
$DefinitionPopupMenu.add_icon_item(get_icon("Edit", "EditorIcons"), 'Edit Definitions File')
$DefinitionPopupMenu.add_icon_item(get_icon("Remove", "EditorIcons"), 'Remove Definition')
$TimelineRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Timeline')
$CharacterRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Character')
$ThemeRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Theme')
$DefinitionRootPopupMenu.add_icon_item(get_icon("Add", "EditorIcons") ,'Add Definition')
# Connecting context menus # Connecting context menus
$TimelinePopupMenu.connect('id_pressed', self, '_on_TimelinePopupMenu_id_pressed') $TimelinePopupMenu.connect('id_pressed', self, '_on_TimelinePopupMenu_id_pressed')
$CharacterPopupMenu.connect('id_pressed', self, '_on_CharacterPopupMenu_id_pressed') $CharacterPopupMenu.connect('id_pressed', self, '_on_CharacterPopupMenu_id_pressed')
$ThemePopupMenu.connect('id_pressed', self, '_on_ThemePopupMenu_id_pressed') $ThemePopupMenu.connect('id_pressed', self, '_on_ThemePopupMenu_id_pressed')
$DefinitionPopupMenu.connect('id_pressed', self, '_on_DefinitionPopupMenu_id_pressed') $DefinitionPopupMenu.connect('id_pressed', self, '_on_DefinitionPopupMenu_id_pressed')
$TimelineRootPopupMenu.connect('id_pressed', self, '_on_TimelineRootPopupMenu_id_pressed')
$CharacterRootPopupMenu.connect('id_pressed', self, '_on_CharacterRootPopupMenu_id_pressed')
$ThemeRootPopupMenu.connect('id_pressed', self, '_on_ThemeRootPopupMenu_id_pressed')
$DefinitionRootPopupMenu.connect('id_pressed', self, '_on_DefinitionRootPopupMenu_id_pressed')
#Connecting confirmation menus #Connecting confirmation menus
$RemoveTimelineConfirmation.connect('confirmed', self, '_on_RemoveTimelineConfirmation_confirmed') $RemoveTimelineConfirmation.connect('confirmed', self, '_on_RemoveTimelineConfirmation_confirmed')
@ -130,21 +154,42 @@ func _on_ThemePopupMenu_id_pressed(id):
if id == 0: if id == 0:
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('THEME_DIR'))) OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('THEME_DIR')))
if id == 1: if id == 1:
$RemoveThemeConfirmation.popup_centered()
if id == 2:
var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file'] var filename = $MainPanel/MasterTreeContainer/MasterTree.get_selected().get_metadata(0)['file']
if (filename.begins_with('theme-')): if (filename.begins_with('theme-')):
theme_editor.duplicate_theme(filename) theme_editor.duplicate_theme(filename)
if id == 2:
$RemoveThemeConfirmation.popup_centered()
# Definition context menu # Definition context menu
func _on_DefinitionPopupMenu_id_pressed(id): func _on_DefinitionPopupMenu_id_pressed(id):
if id == 0: if id == 0:
OS.shell_open(ProjectSettings.globalize_path(DialogicResources.get_path('DEFAULT_DEFINITIONS_FILE'))) var paths = DialogicResources.get_config_files_paths()
OS.shell_open(ProjectSettings.globalize_path(paths['DEFAULT_DEFINITIONS_FILE']))
if id == 1: if id == 1:
$RemoveDefinitionConfirmation.popup_centered() $RemoveDefinitionConfirmation.popup_centered()
# Timeline Root context menu
func _on_TimelineRootPopupMenu_id_pressed(id):
if id == 0: # Add Timeline
$MainPanel/TimelineEditor.new_timeline()
# Character Root context menu
func _on_CharacterRootPopupMenu_id_pressed(id):
if id == 0: # Add Character
$MainPanel/CharacterEditor.new_character()
# Theme Root context menu
func _on_ThemeRootPopupMenu_id_pressed(id):
if id == 0: # Add Theme
$MainPanel/ThemeEditor.new_theme()
# Definition Root context menu
func _on_DefinitionRootPopupMenu_id_pressed(id):
if id == 0: # Add Definition
$MainPanel/DefinitionEditor.new_definition()
func _on_RemoveDefinitionConfirmation_confirmed(): func _on_RemoveDefinitionConfirmation_confirmed():
var target = $MainPanel/DefinitionEditor.current_definition['id'] var target = $MainPanel/DefinitionEditor.current_definition['id']
DialogicResources.delete_default_definition(target) DialogicResources.delete_default_definition(target)
@ -194,7 +239,7 @@ func godot_dialog_connect(who, method_name):
func _on_file_selected(path): func _on_file_selected(path):
dprint(path) dprint('[D] Selected '+str(path))
func dprint(what) -> void: func dprint(what) -> void:

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2] [gd_scene load_steps=14 format=2]
[ext_resource path="res://addons/dialogic/Editor/EditorView.gd" type="Script" id=1] [ext_resource path="res://addons/dialogic/Editor/EditorView.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineEditor.tscn" type="PackedScene" id=2]
@ -8,14 +8,11 @@
[ext_resource path="res://addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn" type="PackedScene" id=6] [ext_resource path="res://addons/dialogic/Editor/SettingsEditor/SettingsEditor.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn" type="PackedScene" id=7] [ext_resource path="res://addons/dialogic/Editor/CharacterEditor/CharacterEditor.tscn" type="PackedScene" id=7]
[ext_resource path="res://addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn" type="PackedScene" id=8] [ext_resource path="res://addons/dialogic/Editor/ThemeEditor/ThemeEditor.tscn" type="PackedScene" id=8]
[ext_resource path="res://addons/dialogic/Images/Context Menus/ActionCopy.svg" type="Texture" id=11]
[ext_resource path="res://addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.tscn" type="PackedScene" id=12] [ext_resource path="res://addons/dialogic/Editor/DefinitionEditor/DefinitionEditor.tscn" type="PackedScene" id=12]
[ext_resource path="res://addons/dialogic/Images/Toolbar/add-theme.svg" type="Texture" id=13] [ext_resource path="res://addons/dialogic/Images/Toolbar/add-theme.svg" type="Texture" id=13]
[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=22]
[ext_resource path="res://addons/dialogic/Images/Context Menus/Filesystem.svg" type="Texture" id=26]
[ext_resource path="res://addons/dialogic/Editor/MasterTree/MasterTree.tscn" type="PackedScene" id=35] [ext_resource path="res://addons/dialogic/Editor/MasterTree/MasterTree.tscn" type="PackedScene" id=35]
[sub_resource type="Image" id=1] [sub_resource type="Image" id=3]
data = { data = {
"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 ), "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 ),
"format": "LumAlpha8", "format": "LumAlpha8",
@ -27,7 +24,7 @@ data = {
[sub_resource type="ImageTexture" id=2] [sub_resource type="ImageTexture" id=2]
flags = 4 flags = 4
flags = 4 flags = 4
image = SubResource( 1 ) image = SubResource( 3 )
size = Vector2( 16, 16 ) size = Vector2( 16, 16 )
[node name="EditorView" type="Control"] [node name="EditorView" type="Control"]
@ -206,7 +203,6 @@ margin_left = 151.0
margin_top = 276.0 margin_top = 276.0
margin_right = 325.0 margin_right = 325.0
margin_bottom = 332.0 margin_bottom = 332.0
items = [ "Show in File Manager", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Copy Timeline Name", ExtResource( 11 ), 0, false, false, 1, 0, null, "", false, "Remove", ExtResource( 22 ), 0, false, false, 2, 0, null, "", false ]
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@ -216,17 +212,6 @@ margin_left = 171.799
margin_top = 209.0 margin_top = 209.0
margin_right = 267.799 margin_right = 267.799
margin_bottom = 229.0 margin_bottom = 229.0
items = [ "Show in File Manager", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Character", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false ]
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ThemePopupMenu" type="PopupMenu" parent="."]
margin_left = 171.799
margin_top = 209.0
margin_right = 267.799
margin_bottom = 229.0
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 ]
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
@ -236,7 +221,51 @@ margin_left = 171.799
margin_top = 209.0 margin_top = 209.0
margin_right = 267.799 margin_right = 267.799
margin_bottom = 229.0 margin_bottom = 229.0
items = [ "Edit definitions file", ExtResource( 26 ), 0, false, false, 0, 0, null, "", false, "Remove Definition", ExtResource( 22 ), 0, false, false, 1, 0, null, "", false ] __meta__ = {
"_edit_use_anchors_": false
}
[node name="ThemePopupMenu" type="PopupMenu" parent="."]
margin_left = 171.799
margin_top = 209.0
margin_right = 267.799
margin_bottom = 229.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TimelineRootPopupMenu" type="PopupMenu" parent="."]
margin_left = 159.0
margin_top = 283.0
margin_right = 227.0
margin_bottom = 319.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CharacterRootPopupMenu" type="PopupMenu" parent="."]
margin_left = 159.0
margin_top = 283.0
margin_right = 227.0
margin_bottom = 319.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ThemeRootPopupMenu" type="PopupMenu" parent="."]
margin_left = 159.0
margin_top = 283.0
margin_right = 227.0
margin_bottom = 319.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DefinitionRootPopupMenu" type="PopupMenu" parent="."]
margin_left = 159.0
margin_top = 283.0
margin_right = 227.0
margin_bottom = 319.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }

View file

@ -7,57 +7,29 @@ var editorPopup
# This is the information of this event and it will get parsed and saved to the JSON file. # This is the information of this event and it will get parsed and saved to the JSON file.
var event_data = { var event_data = {
'event_name':'AudioEvent',
'audio': 'stop', 'audio': 'stop',
'file': '' 'file': '',
'audio_bus':'Master',
'volume':0
} }
func _ready(): func _ready():
load_audio('') $PanelContainer/VBoxContainer/Header/VisibleToggle.set_visible(true)
$PanelContainer/VBoxContainer/Header/ButtonClear.icon = get_icon("Remove", "EditorIcons") $PanelContainer/VBoxContainer/Settings/AudioPicker.editor_reference = editor_reference
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons") $PanelContainer/VBoxContainer/Settings/AudioPicker.connect('audio_changed', self, 'update_audio_data')
func _on_ButtonAudio_pressed():
editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
editor_reference.godot_dialog_connect(self, "_on_file_selected")
func _on_file_selected(path, target):
target.load_audio(path)
func load_audio(path: String):
if not path.empty():
$PanelContainer/VBoxContainer/Header/Name.text = path
$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = false
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = false
event_data['file'] = path
event_data['audio'] = 'play'
else:
$PanelContainer/VBoxContainer/Header/Name.text = 'No sound (will stop previous audio event)'
$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = true
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = true
event_data['file'] = ''
event_data['audio'] = 'stop'
func load_data(data): func load_data(data):
event_data = data event_data = data
load_audio(data['file']) $PanelContainer/VBoxContainer/Settings/AudioPicker.load_data(data)
func update_audio_data(file, playing, audio_bus, volume):
func _on_ButtonPreviewPlay_pressed(): event_data['file'] = file
if $PanelContainer/AudioPreview.is_playing(): event_data['audio'] = playing
$PanelContainer/AudioPreview.stop() event_data['audio_bus'] = audio_bus
event_data['volume'] = volume
if file:
$PanelContainer/VBoxContainer/Header/Preview.text = 'Plays '+file.get_file()
else: else:
$PanelContainer/AudioPreview.stream = load(event_data['file']) $PanelContainer/VBoxContainer/Header/Preview.text = 'Stops previous audio event'
$PanelContainer/AudioPreview.play()
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Stop", "EditorIcons")
func _on_AudioPreview_finished():
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
func _on_ButtonClear_pressed():
load_audio('')

View file

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/AudioBlock.gd" type="Script" id=1] [ext_resource path="res://addons/dialogic/Editor/Events/AudioBlock.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/AudioPicker.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0 content_margin_left = 16.0
@ -55,69 +56,49 @@ size_flags_horizontal = 3
[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] [node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
margin_right = 1776.0 margin_right = 1776.0
margin_bottom = 28.0 margin_bottom = 30.0
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"] [node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
margin_right = 22.0 margin_right = 22.0
margin_bottom = 28.0 margin_bottom = 30.0
texture = ExtResource( 3 ) texture = ExtResource( 3 )
stretch_mode = 6 stretch_mode = 6
[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 26.0 margin_left = 26.0
margin_top = 7.0 margin_top = 8.0
margin_right = 83.0 margin_right = 118.0
margin_bottom = 21.0 margin_bottom = 22.0
text = " Audio " text = " Audio Event "
[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
margin_left = 87.0 margin_left = 122.0
margin_top = 7.0 margin_right = 152.0
margin_right = 352.0 pressed = false
margin_bottom = 21.0
text = "No sound (will stop previous audio event)"
[node name="ButtonAudio" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 356.0
margin_right = 380.0
margin_bottom = 28.0
text = "..."
[node name="ButtonClear" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 384.0
margin_right = 396.0
margin_bottom = 28.0
disabled = true
[node name="ButtonPreviewPlay" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 400.0
margin_right = 412.0
margin_bottom = 28.0
disabled = true
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
visible = false margin_left = 156.0
margin_left = 103.0
margin_top = 8.0 margin_top = 8.0
margin_right = 131.0 margin_right = 156.0
margin_bottom = 22.0 margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 ) custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )] [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 416.0 margin_left = 160.0
margin_right = 1735.0 margin_right = 1735.0
margin_bottom = 28.0 margin_bottom = 30.0
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )] [node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0 margin_left = 1739.0
margin_right = 1776.0 margin_right = 1776.0
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 ] 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="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"] [node name="Settings" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
visible = false
margin_top = 34.0
margin_right = 1776.0
margin_bottom = 54.0
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"] [node name="AudioPicker" parent="PanelContainer/VBoxContainer/Settings" instance=ExtResource( 5 )]
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonClear" to="." method="_on_ButtonClear_pressed"] margin_right = 294.0
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"] margin_bottom = 20.0
[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"]

View file

@ -8,58 +8,35 @@ var editorPopup
# This is the information of this event and it will get parsed and saved to the JSON file. # This is the information of this event and it will get parsed and saved to the JSON file.
var event_data = { var event_data = {
'event_name':'BackgroundMusic',
'background-music': 'stop', 'background-music': 'stop',
'file': '' 'file': '',
'audio_bus':'Master',
'volume':0,
'fade_length':1,
} }
func _ready(): func _ready():
load_audio('') $PanelContainer/VBoxContainer/Header/VisibleToggle.set_visible(true)
$PanelContainer/VBoxContainer/Header/ButtonClear.icon = get_icon("Remove", "EditorIcons") $PanelContainer/VBoxContainer/Settings/AudioPicker.editor_reference = editor_reference
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons") $PanelContainer/VBoxContainer/Settings/AudioPicker.connect("audio_changed", self, "update_audio_data")
func _on_ButtonAudio_pressed():
editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
editor_reference.godot_dialog_connect(self, "_on_file_selected")
func _on_file_selected(path, target):
target.load_audio(path)
func load_audio(path: String):
if not path.empty():
$PanelContainer/VBoxContainer/Header/Name.text = path
$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = false
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = false
event_data['file'] = path
event_data['background-music'] = 'play'
else:
$PanelContainer/VBoxContainer/Header/Name.text = 'No music (will stop with fade out)'
$PanelContainer/VBoxContainer/Header/ButtonClear.disabled = true
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.disabled = true
event_data['file'] = ''
event_data['background-music'] = 'stop'
func load_data(data): func load_data(data):
event_data = data event_data = data
load_audio(data['file']) $PanelContainer/VBoxContainer/Settings/FadeLength.value = event_data.get("fade_length", 1)
$PanelContainer/VBoxContainer/Settings/AudioPicker.load_data(data)
func update_audio_data(file, playing, audio_bus, volume):
func _on_ButtonPreviewPlay_pressed(): event_data['background-music'] = playing
if $PanelContainer/AudioPreview.is_playing(): event_data['file'] = file
$PanelContainer/AudioPreview.stop() event_data['audio_bus'] = audio_bus
event_data['volume'] = volume
if file:
$PanelContainer/VBoxContainer/Header/Preview.text = 'Plays '+file.get_file()
else: else:
$PanelContainer/AudioPreview.stream = load(event_data['file']) $PanelContainer/VBoxContainer/Header/Preview.text = 'Fades out previous background music'
$PanelContainer/AudioPreview.play()
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Stop", "EditorIcons")
func _on_FadeLength_value_changed(value):
event_data['fade_length'] = value
func _on_AudioPreview_finished():
$PanelContainer/VBoxContainer/Header/ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
func _on_ButtonClear_pressed():
load_audio('')

View file

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/BackgroundMusic.gd" type="Script" id=1] [ext_resource path="res://addons/dialogic/Editor/Events/BackgroundMusic.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/background-music.svg" type="Texture" id=3] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/background-music.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/AudioPicker.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0 content_margin_left = 16.0
@ -55,69 +56,66 @@ size_flags_horizontal = 3
[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"] [node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
margin_right = 1776.0 margin_right = 1776.0
margin_bottom = 28.0 margin_bottom = 30.0
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"] [node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
margin_right = 22.0 margin_right = 22.0
margin_bottom = 28.0 margin_bottom = 30.0
texture = ExtResource( 3 ) texture = ExtResource( 3 )
stretch_mode = 6 stretch_mode = 6
[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 26.0 margin_left = 26.0
margin_top = 7.0 margin_top = 8.0
margin_right = 150.0 margin_right = 150.0
margin_bottom = 21.0 margin_bottom = 22.0
text = " Background Music" text = " Background Music"
[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )]
margin_left = 154.0 margin_left = 154.0
margin_top = 7.0 margin_right = 184.0
margin_right = 368.0 pressed = false
margin_bottom = 21.0
text = "No music (will stop with fade out)"
[node name="ButtonAudio" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 372.0
margin_right = 396.0
margin_bottom = 28.0
text = "..."
[node name="ButtonClear" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 400.0
margin_right = 412.0
margin_bottom = 28.0
disabled = true
[node name="ButtonPreviewPlay" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 416.0
margin_right = 428.0
margin_bottom = 28.0
disabled = true
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
visible = false margin_left = 188.0
margin_left = 103.0
margin_top = 8.0 margin_top = 8.0
margin_right = 131.0 margin_right = 188.0
margin_bottom = 22.0 margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 ) custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )] [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 432.0 margin_left = 192.0
margin_right = 1735.0 margin_right = 1735.0
margin_bottom = 28.0 margin_bottom = 30.0
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )] [node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 1739.0 margin_left = 1739.0
margin_right = 1776.0 margin_right = 1776.0
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 ] 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="AudioPreview" type="AudioStreamPlayer" parent="PanelContainer"] [node name="Settings" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
visible = false
margin_top = 34.0
margin_right = 1776.0
margin_bottom = 58.0
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonAudio" to="." method="_on_ButtonAudio_pressed"] [node name="AudioPicker" parent="PanelContainer/VBoxContainer/Settings" instance=ExtResource( 5 )]
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonClear" to="." method="_on_ButtonClear_pressed"] margin_right = 334.0
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"] margin_bottom = 24.0
[connection signal="finished" from="PanelContainer/AudioPreview" to="." method="_on_AudioPreview_finished"] event_name = "Background Music"
[node name="FadeLengthLabel" type="Label" parent="PanelContainer/VBoxContainer/Settings"]
margin_left = 338.0
margin_top = 5.0
margin_right = 425.0
margin_bottom = 19.0
text = " Fade-length:"
[node name="FadeLength" type="SpinBox" parent="PanelContainer/VBoxContainer/Settings"]
margin_left = 429.0
margin_right = 503.0
margin_bottom = 24.0
step = 0.01
suffix = "s"
[connection signal="value_changed" from="PanelContainer/VBoxContainer/Settings/FadeLength" to="." method="_on_FadeLength_value_changed"]

View file

@ -0,0 +1,52 @@
tool
extends Control
var editor_reference
var preview = "..."
var preview_scene = preload("res://addons/dialogic/Editor/Events/Common/ImagePreview.tscn")
onready var event_template = $EventTemplate
var image_picker
# This is the information of this event and it will get parsed and saved to the JSON file.
var event_data = {
'background': ''
}
func _ready():
image_picker = event_template.get_header()
# Needed to open the file dialog
image_picker.editor_reference = editor_reference
image_picker.connect("file_selected", self, "_on_file_selected")
image_picker.connect("clear_pressed", self, "_on_clear_pressed")
func load_data(data):
event_data = data
load_image(event_data['background'])
func load_image(img_src: String):
event_data['background'] = img_src
if not img_src.empty() and not img_src.ends_with('.tscn'):
event_template.set_preview("...")
event_template.set_body(preview_scene)
event_template.get_body().set_image(load(img_src))
image_picker.set_image(img_src)
elif img_src.ends_with('.tscn'):
event_template.set_preview("...")
image_picker.set_image(img_src)
event_template.set_body(null)
else:
event_template.set_body(null)
image_picker.clear_image()
func _on_file_selected(path):
load_image(path)
func _on_clear_pressed():
load_image('')

View file

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

View file

@ -2,8 +2,8 @@ tool
extends Control extends Control
var editor_reference var editor_reference
onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker onready var character_picker = $PanelContainer/VBoxContainer/Header/CharacterAndPortraitPicker
onready var mirror_toggle = $PanelContainer/VBoxContainer/Header/MirrorButton
var current_color = Color('#ffffff') var current_color = Color('#ffffff')
var default_icon_color = Color("#65989898") var default_icon_color = Color("#65989898")
@ -12,40 +12,36 @@ var event_data = {
'action': 'join', 'action': 'join',
'character': '', 'character': '',
'portrait': '', 'portrait': '',
'position': {"0":false,"1":false,"2":false,"3":false,"4":false} 'position': {"0":false,"1":false,"2":false,"3":false,"4":false},
'mirror':false
} }
func _ready(): func _ready():
for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children(): for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
p.connect('pressed', self, "position_button_pressed", [p.name]) p.connect('pressed', self, "position_button_pressed", [p.name])
$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected') character_picker.connect("character_changed", self, '_on_character_change')
portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected') character_picker.set_allow_portrait_dont_change(false)
portrait_picker.allow_dont_change = false mirror_toggle.icon = get_icon("MirrorX", "EditorIcons")
func _on_character_selected(data): func _on_character_change(character: Dictionary, portrait: String):
# Updating icon Color # Updating icon Color
current_color = Color(data['color']) if character.keys().size() > 0:
var c_c_ind = 0 current_color = Color(character['color'])
for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children(): var c_c_ind = 0
if event_data['position'][str(c_c_ind)]: for p in $PanelContainer/VBoxContainer/Header/PositionsContainer.get_children():
p.set('self_modulate', Color(data['color'])) if event_data['position'][str(c_c_ind)]:
else: p.set('self_modulate', Color(character['color']))
p.set('self_modulate', default_icon_color) else:
c_c_ind += 1 p.set('self_modulate', default_icon_color)
event_data['character'] = data['file'] c_c_ind += 1
portrait_picker.set_character(event_data['character'], event_data['portrait']) event_data['character'] = character['file']
portrait_picker.text = 'Default' event_data['portrait'] = portrait
else:
event_data['character'] = ''
func _on_portrait_selected(index): event_data['portrait'] = ''
var text = portrait_picker.get_popup().get_item_text(index) clear_all_positions()
if portrait_picker.allow_dont_change:
if text == "[Don't change]":
text = ''
event_data['portrait'] = text
portrait_picker.set_character(event_data['character'], event_data['portrait'])
func position_button_pressed(name): func position_button_pressed(name):
@ -78,10 +74,16 @@ func check_active_position(active_color = Color("#ffffff")):
func load_data(data): func load_data(data):
event_data = data event_data = data
if data['character'] != '': if data['character'] != '':
var character_data = DialogicResources.get_character_json(data['character']) character_picker.set_data(data['character'], data['portrait'])
$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data(character_data['name'], Color(character_data['color'])) current_color = character_picker.get_selected_character()['color']
portrait_picker.set_character(data['character'], data['portrait'])
current_color = Color(character_data['color'])
check_active_position(current_color) check_active_position(current_color)
return else:
check_active_position() check_active_position()
if data.has('mirror'):
mirror_toggle.pressed = data['mirror']
else:
mirror_toggle.pressed = false
func _on_MirrorButton_toggled(button_pressed):
event_data['mirror'] = button_pressed

View file

@ -1,15 +1,11 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=1] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Editor/Events/CharacterJoinBlock.gd" type="Script" id=3] [ext_resource path="res://addons/dialogic/Editor/Events/CharacterJoinBlock.gd" type="Script" id=3]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=4] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=4]
[ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=5] [ext_resource path="res://addons/dialogic/Images/Event Icons/character.svg" type="Texture" id=5]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=7] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn" type="PackedScene" id=6]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0 content_margin_left = 16.0
@ -72,14 +68,12 @@ margin_right = 130.0
margin_bottom = 22.0 margin_bottom = 22.0
text = " Character join: " text = " Character join: "
[node name="CharacterPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 8 )] [node name="CharacterAndPortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 134.0 margin_left = 134.0
margin_right = 240.0 margin_right = 240.0
margin_bottom = 30.0
[node name="PortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 7 )]
visible = false
margin_left = 278.0
margin_right = 361.0
[node name="LabelPosition" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="LabelPosition" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 244.0 margin_left = 244.0
@ -127,8 +121,17 @@ margin_right = 186.0
margin_bottom = 30.0 margin_bottom = 30.0
icon = ExtResource( 5 ) icon = ExtResource( 5 )
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 1 )] [node name="MirrorButton" type="ToolButton" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 502.0 margin_left = 502.0
margin_right = 514.0
margin_bottom = 30.0
hint_tooltip = "Mirrors the character"
focus_mode = 0
toggle_mode = true
enabled_focus_mode = 0
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 1 )]
margin_left = 518.0
margin_right = 1735.0 margin_right = 1735.0
margin_bottom = 30.0 margin_bottom = 30.0
@ -136,3 +139,5 @@ margin_bottom = 30.0
margin_left = 1739.0 margin_left = 1739.0
margin_right = 1776.0 margin_right = 1776.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 ] 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 ]
[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/MirrorButton" to="." method="_on_MirrorButton_toggled"]

View file

@ -4,23 +4,37 @@ extends Control
var editor_reference var editor_reference
var editorPopup var editorPopup
onready var definition_picker = $PanelContainer/VBoxContainer/Header/Condition/DefinitionPicker
onready var condition_picker = $PanelContainer/VBoxContainer/Header/Condition/ConditionPicker
onready var condition_line_edit = $PanelContainer/VBoxContainer/Header/Condition/CustomLineEdit2
onready var condition_checkbox = $PanelContainer/VBoxContainer/Header/ConditionCheckBox
# This is the information of this event and it will get parsed and saved to the JSON file. # This is the information of this event and it will get parsed and saved to the JSON file.
var event_data = { var event_data = {
'choice': '' 'choice': '',
'condition': '',
'definition': '',
'value': ''
} }
func _ready(): func _ready():
$PanelContainer/VBoxContainer/Header/Warning.visible = false $PanelContainer/VBoxContainer/Header/Warning.visible = false
$PanelContainer/VBoxContainer/Header/CustomLineEdit.connect('text_changed', self, '_on_LineEdit_text_changed') $PanelContainer/VBoxContainer/Header/CustomLineEdit.connect('text_changed', self, '_on_LineEdit_text_changed')
pass definition_picker.get_popup().connect("index_pressed", self, '_on_definition_entry_selected')
condition_picker.get_popup().connect("index_pressed", self, '_on_condition_entry_selected')
func load_data(data): func load_data(data):
event_data = data event_data = data
$PanelContainer/VBoxContainer/Header/CustomLineEdit.text = event_data['choice'] $PanelContainer/VBoxContainer/Header/CustomLineEdit.text = event_data['choice']
if event_data.has('condition') and event_data.has('definition') and event_data.has('value'):
condition_checkbox.pressed = not event_data['condition'].empty() and not event_data['definition'].empty() and not event_data['value'].empty()
else:
_reset_conditions()
condition_checkbox.pressed = false
_load_condition_data(event_data)
func _on_LineEdit_text_changed(new_text): func _on_LineEdit_text_changed(new_text):
event_data['choice'] = new_text event_data['choice'] = new_text
@ -28,3 +42,39 @@ func _on_LineEdit_text_changed(new_text):
func _on_Indent_visibility_changed(): func _on_Indent_visibility_changed():
$PanelContainer/VBoxContainer/Header/Warning.visible = !$Indent.visible $PanelContainer/VBoxContainer/Header/Warning.visible = !$Indent.visible
func _load_condition_data(event_data):
condition_line_edit.text = event_data['value']
definition_picker.load_definition(event_data['definition'])
condition_picker.load_condition(event_data['condition'])
func _reset_conditions():
event_data['condition'] = ''
event_data['definition'] = ''
event_data['value'] = ''
func _on_ConditionCheckBox_toggled(button_pressed):
$PanelContainer/VBoxContainer/Header/Condition.visible = button_pressed
if not button_pressed:
_reset_conditions()
_load_condition_data(event_data)
elif event_data['condition'].empty():
event_data['condition'] = '=='
_load_condition_data(event_data)
func _on_CustomLineEdit2_text_changed(new_text):
event_data['value'] = new_text
func _on_definition_entry_selected(index):
var metadata = definition_picker.get_popup().get_item_metadata(index)
event_data['definition'] = metadata['id']
func _on_condition_entry_selected(index):
var metadata = condition_picker.get_popup().get_item_metadata(index)
event_data['condition'] = metadata['condition']

View file

@ -1,14 +1,13 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=10 format=2]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/choice.svg" type="Texture" id=1] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/choice.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Choice.gd" type="Script" id=2] [ext_resource path="res://addons/dialogic/Editor/Events/Choice.gd" type="Script" id=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/ConditionPicker.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Images/Event Icons/warning.svg" type="Texture" id=6] [ext_resource path="res://addons/dialogic/Images/Event Icons/warning.svg" type="Texture" id=6]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CustomLineEdit.tscn" type="PackedScene" id=7] [ext_resource path="res://addons/dialogic/Editor/Events/Common/CustomLineEdit.tscn" type="PackedScene" id=7]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/DefinitionPicker.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0 content_margin_left = 16.0
@ -94,15 +93,52 @@ margin_left = 50.0
margin_right = 98.0 margin_right = 98.0
margin_bottom = 28.0 margin_bottom = 28.0
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Spacer2" type="Control" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 102.0 margin_left = 102.0
margin_right = 112.0
margin_bottom = 28.0
rect_min_size = Vector2( 10, 0 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ConditionCheckBox" type="CheckBox" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 116.0
margin_right = 238.0
margin_bottom = 28.0
text = "Has condition?"
[node name="Condition" type="HBoxContainer" parent="PanelContainer/VBoxContainer/Header"]
visible = false
margin_left = 228.0
margin_right = 506.0
margin_bottom = 28.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="DefinitionPicker" parent="PanelContainer/VBoxContainer/Header/Condition" instance=ExtResource( 8 )]
margin_right = 143.0
margin_bottom = 28.0
[node name="ConditionPicker" parent="PanelContainer/VBoxContainer/Header/Condition" instance=ExtResource( 5 )]
margin_left = 147.0
margin_right = 226.0
[node name="CustomLineEdit2" parent="PanelContainer/VBoxContainer/Header/Condition" instance=ExtResource( 7 )]
margin_left = 230.0
margin_right = 278.0
margin_bottom = 28.0
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 242.0
margin_top = 7.0 margin_top = 7.0
margin_right = 102.0 margin_right = 242.0
margin_bottom = 21.0 margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 ) custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )] [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 3 )]
margin_left = 106.0 margin_left = 246.0
margin_right = 941.0 margin_right = 941.0
margin_bottom = 28.0 margin_bottom = 28.0
@ -111,4 +147,7 @@ margin_left = 945.0
margin_right = 982.0 margin_right = 982.0
margin_bottom = 28.0 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 ] 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 ]
[connection signal="visibility_changed" from="Indent" to="." method="_on_Indent_visibility_changed"] [connection signal="visibility_changed" from="Indent" to="." method="_on_Indent_visibility_changed"]
[connection signal="toggled" from="PanelContainer/VBoxContainer/Header/ConditionCheckBox" to="." method="_on_ConditionCheckBox_toggled"]
[connection signal="text_changed" from="PanelContainer/VBoxContainer/Header/Condition/CustomLineEdit2" to="." method="_on_CustomLineEdit2_text_changed"]

View file

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

View file

@ -1,13 +1,11 @@
[gd_scene load_steps=6 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/SpinBoxPreventDnD.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=2] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=3] [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=3]
[ext_resource path="res://addons/dialogic/Editor/Events/CloseDialog.gd" type="Script" id=4] [ext_resource path="res://addons/dialogic/Editor/Events/CloseDialog.gd" type="Script" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=5] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=5]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0 content_margin_left = 16.0
content_margin_right = 6.0 content_margin_right = 6.0
@ -66,19 +64,36 @@ stretch_mode = 6
[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 26.0 margin_left = 26.0
margin_top = 7.0 margin_top = 7.0
margin_right = 113.0 margin_right = 121.0
margin_bottom = 21.0 margin_bottom = 21.0
text = " Close Dialog" text = " Close Dialog "
[node name="SpinBox" type="SpinBox" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 125.0
margin_right = 199.0
margin_bottom = 28.0
step = 0.1
value = 1.0
allow_greater = true
align = 1
script = ExtResource( 1 )
[node name="Title2" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 203.0
margin_top = 7.0
margin_right = 324.0
margin_bottom = 21.0
text = " Fade-out duration"
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"] [node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 117.0 margin_left = 328.0
margin_top = 7.0 margin_top = 7.0
margin_right = 117.0 margin_right = 328.0
margin_bottom = 21.0 margin_bottom = 21.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 ) custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )] [node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
margin_left = 121.0 margin_left = 332.0
margin_right = 1735.0 margin_right = 1735.0
margin_bottom = 28.0 margin_bottom = 28.0
@ -87,3 +102,4 @@ margin_left = 1739.0
margin_right = 1776.0 margin_right = 1776.0
margin_bottom = 28.0 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 ] 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 ]
[connection signal="value_changed" from="PanelContainer/VBoxContainer/Header/SpinBox" to="." method="_on_SpinBox_value_changed"]

View file

@ -0,0 +1,106 @@
tool
extends HBoxContainer
var editor_reference
var editorPopup
export (String) var event_name = 'Audio Event'
var file : String
var audio : String
var audio_bus : String = "Master"
var volume: float = 0
signal audio_changed(file, audio, audio_bus, volume)
func _ready():
load_audio('')
AudioServer.connect("bus_layout_changed", self, "update_bus_selector")
$ButtonClear.icon = get_icon("Remove", "EditorIcons")
$ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
update_bus_selector()
func _on_ButtonAudio_pressed():
editor_reference.godot_dialog("*.wav, *.ogg, *.mp3")
editor_reference.godot_dialog_connect(self, "_on_file_selected")
func _on_file_selected(path, target):
target.load_audio(path) # why is the targer needed? Couldn't it just call itself?
func load_audio(path: String):
if not path.empty():
$Name.text = path.get_file()
$Name.hint_tooltip = path
$ButtonAudio.hint_tooltip = path
$ButtonClear.disabled = false
$ButtonPreviewPlay.disabled = false
file = path
audio = 'play'
emit_signal("audio_changed", file, audio, audio_bus, volume)
show_options()
else:
$Name.text = 'No sound (will stop previous '+event_name+')'
file = ''
audio = 'stop'
emit_signal("audio_changed", file, audio, audio_bus, volume)
hide_options()
func load_data(data):
file = data['file']
if data.has('audio'): audio = data['audio']
if data.has('background-music'): audio = data['background-music']
if data.has('audio_bus'): audio_bus = data['audio_bus']
for idx in range($BusSelector.get_item_count()):
if $BusSelector.get_item_text(idx) == audio_bus:
$BusSelector.select(idx)
if data.has('volume'): volume = data['volume']
$Volume.value = volume
load_audio(file)
func _on_ButtonPreviewPlay_pressed():
if $AudioPreview.is_playing():
$AudioPreview.stop()
else:
$AudioPreview.stream = load(file)
$AudioPreview.bus = audio_bus
$AudioPreview.volume_db = volume
$AudioPreview.play()
$ButtonPreviewPlay.icon = get_icon("Stop", "EditorIcons")
func _on_AudioPreview_finished():
$ButtonPreviewPlay.icon = get_icon("Play", "EditorIcons")
func _on_ButtonClear_pressed():
load_audio('')
func update_bus_selector():
$BusSelector.clear()
for i in range(AudioServer.bus_count):
$BusSelector.add_item(AudioServer.get_bus_name(i))
func _on_BusSelector_item_selected(index):
audio_bus = $BusSelector.get_item_text(index)
emit_signal("audio_changed", file, audio, audio_bus, volume)
func _on_Volume_value_changed(value):
volume = value
emit_signal("audio_changed", file, audio, audio_bus, volume)
func show_options():
$ButtonClear.show()
$ButtonPreviewPlay.show()
$BusSelector.show()
$VolumeLabel.show()
$Volume.show()
func hide_options():
$ButtonClear.hide()
$ButtonPreviewPlay.hide()
$BusSelector.hide()
$VolumeLabel.hide()
$Volume.hide()

View file

@ -0,0 +1,101 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/AudioPicker.gd" type="Script" id=1]
[sub_resource type="Image" id=3]
data = {
"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 ),
"format": "LumAlpha8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id=2]
flags = 4
flags = 4
image = SubResource( 3 )
size = Vector2( 16, 16 )
[node name="AudioPicker" type="HBoxContainer"]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Name" type="Label" parent="."]
margin_top = 13.0
margin_right = 266.0
margin_bottom = 27.0
mouse_filter = 1
text = "No sound (will stop previous Audio Event)"
[node name="ButtonAudio" type="Button" parent="."]
margin_left = 270.0
margin_right = 294.0
margin_bottom = 40.0
text = "..."
[node name="ButtonClear" type="Button" parent="."]
visible = false
margin_left = 297.0
margin_right = 325.0
margin_bottom = 40.0
disabled = true
icon = SubResource( 2 )
[node name="ButtonPreviewPlay" type="Button" parent="."]
visible = false
margin_left = 329.0
margin_right = 357.0
margin_bottom = 40.0
disabled = true
icon = SubResource( 2 )
[node name="BusSelector" type="OptionButton" parent="."]
visible = false
margin_left = 361.0
margin_right = 390.0
margin_bottom = 40.0
text = "Master"
items = [ "Master", null, false, 0, null, "Cool new bus", null, false, 1, null ]
selected = 0
[node name="VolumeLabel" type="Label" parent="."]
margin_left = 298.0
margin_top = 13.0
margin_right = 359.0
margin_bottom = 27.0
text = " Volume:"
[node name="Volume" type="SpinBox" parent="."]
margin_left = 363.0
margin_right = 437.0
margin_bottom = 40.0
min_value = -80.0
max_value = 24.0
step = 0.01
suffix = "dB"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Preview" type="Label" parent="."]
visible = false
margin_left = 329.0
margin_top = 13.0
margin_right = 357.0
margin_bottom = 27.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="AudioPreview" type="AudioStreamPlayer" parent="."]
[connection signal="pressed" from="ButtonAudio" to="." method="_on_ButtonAudio_pressed"]
[connection signal="pressed" from="ButtonClear" to="." method="_on_ButtonClear_pressed"]
[connection signal="pressed" from="ButtonPreviewPlay" to="." method="_on_ButtonPreviewPlay_pressed"]
[connection signal="item_selected" from="BusSelector" to="." method="_on_BusSelector_item_selected"]
[connection signal="value_changed" from="Volume" to="." method="_on_Volume_value_changed"]
[connection signal="finished" from="AudioPreview" to="." method="_on_AudioPreview_finished"]

View file

@ -0,0 +1,56 @@
tool
extends HBoxContainer
onready var character_picker = $CharacterPicker
onready var portrait_picker = $PortraitPicker
signal character_changed(character, portrait)
var allow_portrait_dont_change := true
var character := {}
var portrait: String
func _ready():
character_picker.connect('character_selected', self , '_on_character_selected')
portrait_picker.connect("portrait_selected", self, '_on_portrait_selected')
func set_allow_portrait_dont_change(dont_allow: bool):
allow_portrait_dont_change = dont_allow
portrait_picker.allow_dont_change = dont_allow
func set_data(c: String, p: String):
character = {}
for ch in DialogicUtil.get_character_list():
if ch['file'] == c:
character = ch
if character.has('name') and character.has('color'):
character_picker.set_data(character['name'], Color(character['color']))
portrait_picker.set_character(character, p)
else:
character_picker.set_data('', Color('#FFFFFF'))
portrait_picker.set_character({}, '')
func _on_character_selected(data: Dictionary):
character = data
if allow_portrait_dont_change or character.keys().size() == 0:
portrait = ''
else:
portrait = 'Default'
portrait_picker.set_character(character)
emit_signal("character_changed", character, portrait)
func _on_portrait_selected(p: String):
portrait = p
emit_signal("character_changed", character, portrait)
func get_selected_character() -> Dictionary:
return character

View file

@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/PortraitPicker.tscn" type="PackedScene" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterPicker.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.gd" type="Script" id=3]
[node name="CharacterAndPortraitPicker" type="HBoxContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -880.0
margin_bottom = -570.0
rect_min_size = Vector2( 144, 30 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="CharacterPicker" parent="." instance=ExtResource( 2 )]
[node name="PortraitPicker" parent="." instance=ExtResource( 1 )]
visible = false
margin_left = 110.0
margin_right = 144.0

View file

@ -1,7 +1,7 @@
tool tool
extends HBoxContainer extends HBoxContainer
signal character_selected(value) signal character_selected(data)
func _ready(): func _ready():
@ -11,36 +11,35 @@ func _ready():
func _on_Dropdown_about_to_show(): func _on_Dropdown_about_to_show():
var popup = $Dropdown.get_popup() var popup = $Dropdown.get_popup()
popup.clear() popup.clear()
popup.add_item('No Character') popup.add_item('[Character]')
popup.set_item_metadata(0, {'file': '', 'color': Color('#ffffff')}) popup.set_item_metadata(0, {})
var index = 1 var index = 1
for c in DialogicUtil.get_sorted_character_list(): for c in DialogicUtil.get_sorted_character_list():
popup.add_item(c['name']) popup.add_item(c['name'])
popup.set_item_metadata(index, {'file': c['file'],'color': c['color']}) popup.set_item_metadata(index, c)
index += 1 index += 1
func _on_character_selected(index: int): func _on_character_selected(index: int):
var data = {'file': '', 'color': Color('#FFFFFF')} var metadata = $Dropdown.get_popup().get_item_metadata(index)
if index == 0: if index == 0:
set_data('[Character]', Color('#FFFFFF')) set_data('[Character]', Color('#FFFFFF'))
else: else:
var metadata = $Dropdown.get_popup().get_item_metadata(index)
set_data($Dropdown.get_popup().get_item_text(index), metadata['color']) set_data($Dropdown.get_popup().get_item_text(index), metadata['color'])
data['file'] = metadata['file'] emit_signal('character_selected', metadata)
data['color'] = metadata['color'] return metadata
emit_signal('character_selected', data)
return data
func set_data_by_file(file_name): func set_data_by_file(file_name: String):
# This method is used when you don't know the character's color # This method is used when you don't know the character's color
var character = DialogicResources.get_character_json(file_name) var character = DialogicResources.get_character_json(file_name)
set_data(character['name'], Color(character['color'])) set_data(character['name'], Color(character['color']))
func set_data(text: String, color:Color = Color('#FFFFFF')) -> void: func set_data(text: String, color: Color = Color('#FFFFFF')):
$Dropdown.text = text if not text.empty():
$Dropdown.text = text
else:
$Dropdown.text = '[Character]'
$Icon.set("self_modulate", Color(color)) $Icon.set("self_modulate", Color(color))

View file

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

View file

@ -0,0 +1,54 @@
tool
extends MenuButton
var character := {}
var portrait := ""
var allow_dont_change := true
signal portrait_selected(portrait)
func _ready():
visible = false
connect("about_to_show", self, '_on_about_to_show')
get_popup().connect("index_pressed", self, '_on_portrait_selected')
if not allow_dont_change:
_set_portrait('Default')
func set_character(c: Dictionary, p: String = '') -> void:
character = c
visible = character.has('portraits') and character['portraits'].size() > 1
_set_portrait('Default')
if allow_dont_change and (p == "[Don't change]" or p.empty()):
_set_portrait('')
elif visible:
for port in character['portraits']:
if port['name'] == p:
_set_portrait(p)
func _set_portrait(val: String):
if (val.empty() or val == "[Don't change]") and allow_dont_change:
text = "[Don't change]"
portrait = ""
else:
text = val
portrait = val
func _on_about_to_show():
get_popup().clear()
var index = 0
if allow_dont_change:
get_popup().add_item("[Don't change]")
index += 1
if character.has('portraits'):
for p in character['portraits']:
get_popup().add_item(p['name'])
index += 1
func _on_portrait_selected(index: int):
set_character(character, get_popup().get_item_text(index))
emit_signal("portrait_selected", portrait)

View file

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

View file

@ -0,0 +1,34 @@
tool
extends HBoxContainer
var editor_reference
signal clear_pressed()
signal file_selected()
onready var name_label = $Name
onready var clear_button = $ClearButton
func set_image(src: String):
clear_button.disabled = false
name_label.text = src;
func clear_image():
clear_button.disabled = true
name_label.text = 'No image (will clear previous scene event)'
func _on_file_selected(path, target):
emit_signal("file_selected", path)
func _on_ImageButton_pressed():
editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
editor_reference.godot_dialog_connect(self, "_on_file_selected")
func _on_ClearButton_pressed():
clear_image()
emit_signal("clear_pressed")

View file

@ -0,0 +1,34 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/ImagePicker.gd" type="Script" id=2]
[node name="ImagePicker" type="HBoxContainer"]
margin_left = 154.0
margin_right = 485.0
margin_bottom = 28.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Name" type="Label" parent="."]
margin_top = 7.0
margin_right = 271.0
margin_bottom = 21.0
text = "No image (will clear previous scene event)"
[node name="ImageButton" type="Button" parent="."]
margin_left = 275.0
margin_right = 299.0
margin_bottom = 28.0
text = "..."
[node name="ClearButton" type="Button" parent="."]
margin_left = 303.0
margin_right = 331.0
margin_bottom = 28.0
disabled = true
icon = ExtResource( 1 )
[connection signal="pressed" from="ImageButton" to="." method="_on_ImageButton_pressed"]
[connection signal="pressed" from="ClearButton" to="." method="_on_ClearButton_pressed"]

View file

@ -0,0 +1,15 @@
tool
extends CenterContainer
onready var texture_rect = $TextureRect
var previw_size = 200
func set_image(image: Texture):
texture_rect.texture = image
if image != null:
texture_rect.rect_size = Vector2(previw_size, previw_size)
texture_rect.rect_min_size = Vector2(previw_size, previw_size)
else:
texture_rect.rect_size = Vector2(0, 0)
texture_rect.rect_min_size = Vector2(0, 0)

View file

@ -0,0 +1,25 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/ImagePreview.gd" type="Script" id=1]
[node name="ImagePreview" type="CenterContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = -824.0
margin_bottom = -400.0
mouse_filter = 1
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextureRect" type="TextureRect" parent="."]
margin_right = 200.0
margin_bottom = 200.0
rect_min_size = Vector2( 200, 200 )
size_flags_horizontal = 5
size_flags_vertical = 5
expand = true
stretch_mode = 6

View file

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

View file

@ -1,44 +0,0 @@
tool
extends MenuButton
var character
var portrait
var allow_dont_change:bool = true
func _ready():
visible = false
connect("about_to_show", self, '_on_about_to_show')
if allow_dont_change == false:
text = 'Default'
func set_character(c: String, p: String = '') -> void:
character = c
portrait = p
visible = false
for c in DialogicUtil.get_character_list():
if c['file'] == character:
if c.has('portraits'):
if c['portraits'].size() > 1:
visible = true
for p in c['portraits']:
if p['name'] == portrait:
text = portrait
if allow_dont_change:
if p == "[Don't change]":
text = ''
func _on_about_to_show():
get_popup().clear()
var index = 0
if allow_dont_change:
get_popup().add_item("[Don't change]")
index += 1
for c in DialogicUtil.get_sorted_character_list():
if c['file'] == character:
for p in c['portraits']:
get_popup().add_item(p['name'])
index += 1

View file

@ -13,15 +13,14 @@ var event_data = {
'portrait': '', 'portrait': '',
} }
onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker onready var character_picker = $PanelContainer/VBoxContainer/Header/CharacterAndPortraitPicker
func _ready(): func _ready():
$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected') character_picker.connect("character_changed", self, '_on_character_changed')
portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
var c_list = DialogicUtil.get_sorted_character_list() var c_list = DialogicUtil.get_sorted_character_list()
if c_list.size() == 0: if c_list.size() == 0:
$PanelContainer/VBoxContainer/Header/CharacterPicker.visible = false character_picker.visible = false
else: else:
# Default Speaker # Default Speaker
for c in c_list: for c in c_list:
@ -36,31 +35,17 @@ func load_data(data):
event_data['portrait'] = '' event_data['portrait'] = ''
$PanelContainer/VBoxContainer/Header/LineEdit.text = event_data['question'] $PanelContainer/VBoxContainer/Header/LineEdit.text = event_data['question']
update_preview() character_picker.set_data(event_data['character'], event_data['portrait'])
func _on_LineEdit_text_changed(new_text): func _on_LineEdit_text_changed(new_text):
event_data['question'] = new_text event_data['question'] = new_text
func _on_character_selected(data): func _on_character_changed(character_data: Dictionary, portrait: String) -> void:
event_data['character'] = data['file'] if character_data.keys().size() > 0:
update_preview() event_data['character'] = character_data['file']
event_data['portrait'] = portrait
else:
func _on_portrait_selected(index): event_data['character'] = ''
var text = portrait_picker.get_popup().get_item_text(index) event_data['portrait'] = ''
if text == "[Don't change]":
text = ''
portrait_picker.text = ''
event_data['portrait'] = text
update_preview()
func update_preview():
portrait_picker.set_character(event_data['character'], event_data['portrait'])
for c in DialogicUtil.get_character_list():
if c['file'] == event_data['character']:
$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data_by_file(event_data['character'])

View file

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

View file

@ -1,60 +0,0 @@
tool
extends Control
var editor_reference
var editorPopup
var preview = "..."
onready var toggler = get_node("PanelContainer/VBoxContainer/Header/VisibleToggle")
# This is the information of this event and it will get parsed and saved to the JSON file.
var event_data = {
'background': ''
}
func _ready():
connect("gui_input", self, '_on_gui_input')
func load_data(data):
event_data = data
print("loading")
print(data)
load_image(event_data['background'])
func load_image(img_src: String):
event_data['background'] = img_src
if not img_src.empty() and not img_src.ends_with('.tscn'):
$PanelContainer/VBoxContainer/Header/Name.text = img_src
$PanelContainer/VBoxContainer/TextureRect.texture = load(img_src)
$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(200,200)
$PanelContainer/VBoxContainer/Header/ClearButton.disabled = false
preview = "..."
toggler.show()
toggler.set_visible(true)
else:
$PanelContainer/VBoxContainer/Header/Name.text = 'No image (will clear previous scene event)'
$PanelContainer/VBoxContainer/TextureRect.rect_min_size = Vector2(0,0)
$PanelContainer/VBoxContainer/Header/ClearButton.disabled = true
preview = ""
toggler.hide()
toggler.set_visible(false)
func _on_gui_input(event):
if event is InputEventMouseButton and event.is_pressed() and event.doubleclick and event.button_index == 1 and toggler.visible:
toggler.set_visible(not toggler.pressed)
func _on_ImageButton_pressed():
editor_reference.godot_dialog("*.png, *.jpg, *.jpeg, *.tga, *.svg, *.svgz, *.bmp, *.webp, *.tscn")
editor_reference.godot_dialog_connect(self, "_on_file_selected")
func _on_file_selected(path, target):
target.load_image(path)
func _on_ClearButton_pressed():
load_image('')

View file

@ -1,127 +0,0 @@
[gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/scene event.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/Context Menus/Remove.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/SceneEvent.gd" type="Script" id=5]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=6]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 16.0
content_margin_right = 6.0
content_margin_top = 6.0
content_margin_bottom = 6.0
bg_color = Color( 0.219608, 0.34902, 0.701961, 0.443137 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
border_color = Color( 0.12549, 0.12549, 0.12549, 1 )
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
[node name="SceneBlock" type="HBoxContainer"]
anchor_right = 1.0
margin_bottom = 44.0
size_flags_horizontal = 3
size_flags_vertical = 9
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Indent" type="Control" parent="."]
visible = false
margin_bottom = 46.0
[node name="PanelContainer" type="PanelContainer" parent="."]
margin_right = 1024.0
margin_bottom = 44.0
mouse_filter = 1
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/panel = SubResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
margin_left = 16.0
margin_top = 6.0
margin_right = 1018.0
margin_bottom = 38.0
size_flags_horizontal = 3
[node name="Header" type="HBoxContainer" parent="PanelContainer/VBoxContainer"]
margin_right = 1002.0
margin_bottom = 28.0
[node name="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer/Header"]
margin_right = 22.0
margin_bottom = 28.0
texture = ExtResource( 1 )
stretch_mode = 6
[node name="Title" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 26.0
margin_top = 7.0
margin_right = 139.0
margin_bottom = 21.0
text = " Scene settings "
[node name="Name" type="Label" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 143.0
margin_top = 7.0
margin_right = 414.0
margin_bottom = 21.0
text = "No image (will clear previous scene event)"
[node name="ImageButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 418.0
margin_right = 442.0
margin_bottom = 28.0
text = "..."
[node name="ClearButton" type="Button" parent="PanelContainer/VBoxContainer/Header"]
margin_left = 446.0
margin_right = 474.0
margin_bottom = 28.0
disabled = true
icon = ExtResource( 3 )
[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
visible = false
margin_left = 478.0
margin_right = 508.0
[node name="Preview" type="Label" parent="PanelContainer/VBoxContainer/Header"]
visible = false
margin_left = 512.0
margin_top = 8.0
margin_right = 540.0
margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = " ..."
[node name="Spacer" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )]
margin_left = 478.0
margin_right = 961.0
margin_bottom = 28.0
[node name="OptionButton" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 965.0
margin_right = 1002.0
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="TextureRect" type="TextureRect" parent="PanelContainer/VBoxContainer"]
margin_top = 32.0
margin_right = 1002.0
margin_bottom = 32.0
size_flags_horizontal = 3
size_flags_vertical = 3
expand = true
stretch_mode = 5
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ImageButton" to="." method="_on_ImageButton_pressed"]
[connection signal="pressed" from="PanelContainer/VBoxContainer/Header/ClearButton" to="." method="_on_ClearButton_pressed"]

View file

@ -0,0 +1,144 @@
tool
extends HBoxContainer
export(StyleBoxFlat) var event_style : StyleBoxFlat
export(Texture) var event_icon : Texture
export(String) var event_name : String
export(PackedScene) var header_scene : PackedScene
export(PackedScene) var body_scene : PackedScene
signal option_action(action_name)
signal selected()
onready var panel = $PanelContainer
onready var title_container = $PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer
onready var title_label = $PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer/TitleMarginContainer/TitleLabel
onready var icon_texture = $PanelContainer/MarginContainer/VBoxContainer/Header/IconMarginContainer/IconTexture
onready var expand_control = $PanelContainer/MarginContainer/VBoxContainer/Header/ExpandControl
onready var options_control = $PanelContainer/MarginContainer/VBoxContainer/Header/OptionsControl
onready var header_content_container = $PanelContainer/MarginContainer/VBoxContainer/Header/Content
onready var body_container = $PanelContainer/MarginContainer/VBoxContainer/Body
onready var body_content_container = $PanelContainer/MarginContainer/VBoxContainer/Body/Content
onready var indent_node = $Indent
var header_node
var body_node
var indent_size = 25
## *****************************************************************************
## PUBLIC METHODS
## *****************************************************************************
func set_event_style(style: StyleBoxFlat):
panel.set('custom_styles/panel', style)
func get_event_style():
return panel.get('custom_styles/panel')
func set_event_icon(icon: Texture):
icon_texture.texture = icon
func set_event_name(text: String):
title_label.text = text
if text.empty():
title_container.hide()
else:
title_container.show()
func set_header(scene: PackedScene):
header_node = _set_content(header_content_container, scene)
func set_body(scene: PackedScene):
body_node = _set_content(body_content_container, scene)
expand_control.set_enabled(body_node != null)
func get_body():
return body_node
func get_header():
return header_node
func set_preview(text: String):
expand_control.set_preview(text)
func set_indent(indent: int):
indent_node.rect_min_size = Vector2(indent_size * indent, 0)
indent_node.visible = indent != 0
func on_timeline_selected():
emit_signal("selected")
func set_expanded(expanded: bool):
expand_control.set_expanded(expanded)
## *****************************************************************************
## PRIVATE METHODS
## *****************************************************************************
func _setup_event():
if event_style != null:
set_event_style(event_style)
if event_icon != null:
set_event_icon(event_icon)
if event_name != null:
set_event_name(event_name)
if header_scene != null:
set_header(header_scene)
if body_scene != null:
set_body(body_scene)
func _set_content(container: Control, scene: PackedScene):
for c in container.get_children():
container.remove_child(c)
if scene != null:
var node = scene.instance()
container.add_child(node)
# node.set_owner(get_tree().get_edited_scene_root())
return node
return null
func _on_ExpandControl_state_changed(expanded: bool):
if expanded:
body_container.show()
else:
body_container.hide()
func _on_OptionsControl_action(action_name: String):
# Simply transmit the signal to the timeline editor
emit_signal("option_action", action_name)
func _on_gui_input(event):
if event is InputEventMouseButton and event.is_pressed() and event.doubleclick and event.button_index == 1 and expand_control.enabled:
expand_control.set_expanded(not expand_control.expanded)
## *****************************************************************************
## OVERRIDES
## *****************************************************************************
func _ready():
_setup_event()
panel.connect("gui_input", self, '_on_gui_input')
expand_control.connect("state_changed", self, "_on_ExpandControl_state_changed")
options_control.connect("action", self, "_on_OptionsControl_action")
expand_control.set_enabled(body_scene != null)

View file

@ -0,0 +1,168 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Templates/EventTemplate.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Templates/ExpandControl.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/Templates/OptionsControl.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Images/Plugin/plugin-editor-icon-dark-theme.svg" type="Texture" id=6]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.262745, 0.262745, 0.262745, 1 )
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_radius_top_left = 6
corner_radius_top_right = 6
corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
[node name="EventTemplate" type="HBoxContainer"]
anchor_right = 1.0
margin_bottom = 44.0
rect_min_size = Vector2( 0, 44 )
size_flags_horizontal = 3
size_flags_vertical = 9
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
event_style = SubResource( 1 )
event_icon = ExtResource( 6 )
event_name = "Event Template"
[node name="Indent" type="Control" parent="."]
visible = false
margin_bottom = 64.0
[node name="PanelContainer" type="PanelContainer" parent="."]
margin_right = 1024.0
margin_bottom = 46.0
mouse_filter = 1
mouse_default_cursor_shape = 6
size_flags_horizontal = 3
size_flags_vertical = 3
custom_styles/panel = SubResource( 1 )
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
margin_left = 2.0
margin_top = 2.0
margin_right = 1022.0
margin_bottom = 44.0
mouse_filter = 1
custom_constants/margin_right = 6
custom_constants/margin_top = 6
custom_constants/margin_left = 6
custom_constants/margin_bottom = 6
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
margin_left = 6.0
margin_top = 6.0
margin_right = 1014.0
margin_bottom = 36.0
rect_min_size = Vector2( 0, 30 )
size_flags_horizontal = 3
[node name="Header" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
margin_right = 1008.0
margin_bottom = 30.0
rect_min_size = Vector2( 0, 30 )
size_flags_horizontal = 3
[node name="IconMarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
margin_right = 31.0
margin_bottom = 30.0
mouse_filter = 1
custom_constants/margin_right = 5
custom_constants/margin_left = 10
[node name="IconTexture" type="TextureRect" parent="PanelContainer/MarginContainer/VBoxContainer/Header/IconMarginContainer"]
margin_left = 10.0
margin_right = 26.0
margin_bottom = 30.0
texture = ExtResource( 6 )
stretch_mode = 6
[node name="TitleHBoxContainer" type="HBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
margin_left = 35.0
margin_right = 160.0
margin_bottom = 30.0
[node name="VSeparator" type="VSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer"]
margin_right = 4.0
margin_bottom = 30.0
mouse_filter = 1
[node name="TitleMarginContainer" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer"]
margin_left = 8.0
margin_right = 117.0
margin_bottom = 30.0
mouse_filter = 1
custom_constants/margin_right = 5
custom_constants/margin_left = 5
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TitleLabel" type="Label" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer/TitleMarginContainer"]
margin_left = 5.0
margin_top = 8.0
margin_right = 104.0
margin_bottom = 22.0
text = "Event Template"
[node name="VSeparator2" type="VSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Header/TitleHBoxContainer"]
margin_left = 121.0
margin_right = 125.0
margin_bottom = 30.0
mouse_filter = 1
[node name="Content" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
margin_left = 164.0
margin_right = 174.0
margin_bottom = 30.0
mouse_filter = 1
custom_constants/margin_right = 5
custom_constants/margin_left = 5
[node name="ExpandControl" parent="PanelContainer/MarginContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 178.0
margin_right = 230.0
[node name="Spacer" parent="PanelContainer/MarginContainer/VBoxContainer/Header" instance=ExtResource( 4 )]
margin_left = 178.0
margin_right = 962.0
margin_bottom = 30.0
[node name="VSeparator3" type="VSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Header"]
margin_left = 966.0
margin_right = 970.0
margin_bottom = 30.0
mouse_filter = 1
[node name="OptionsControl" parent="PanelContainer/MarginContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
margin_left = 974.0
margin_right = 1008.0
margin_bottom = 30.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, "", false, "Remove", null, 0, false, false, 3, 0, null, "", false ]
[node name="Body" type="VBoxContainer" parent="PanelContainer/MarginContainer/VBoxContainer"]
visible = false
margin_top = 34.0
margin_right = 1008.0
margin_bottom = 262.0
[node name="HSeparator" type="HSeparator" parent="PanelContainer/MarginContainer/VBoxContainer/Body"]
margin_right = 1008.0
margin_bottom = 4.0
mouse_filter = 1
[node name="Content" type="MarginContainer" parent="PanelContainer/MarginContainer/VBoxContainer/Body"]
margin_top = 8.0
margin_right = 1008.0
margin_bottom = 228.0
mouse_filter = 1
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/margin_top = 10
custom_constants/margin_bottom = 10

View file

@ -0,0 +1,43 @@
tool
extends HBoxContainer
onready var visible_toggle = $VisibleToggle
onready var preview = $MarginContainer/Preview
var enabled : bool
var expanded: bool
signal state_changed(expanded)
func _ready():
set_enabled(false)
visible_toggle.connect("toggled", self, "_on_VisibleToggle_toggled")
func set_preview(text: String):
preview.text = text
func set_enabled(enabled: bool):
self.enabled = enabled
set_expanded(enabled)
if enabled:
show()
else:
hide()
func set_expanded(expanded: bool):
self.expanded = expanded
visible_toggle.pressed = expanded
if expanded:
preview.hide()
else:
preview.show()
visible_toggle.release_focus()
emit_signal("state_changed", expanded)
func _on_VisibleToggle_toggled(button_pressed: bool):
if enabled:
set_expanded(button_pressed)

View file

@ -0,0 +1,38 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Templates/ExpandControl.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=4]
[node name="ExpandControl" type="HBoxContainer"]
visible = false
margin_right = 62.0
margin_bottom = 30.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VSeparator" type="VSeparator" parent="."]
margin_right = 4.0
margin_bottom = 30.0
[node name="VisibleToggle" parent="." instance=ExtResource( 4 )]
margin_left = 8.0
margin_right = 38.0
pressed = false
script = null
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_left = 42.0
margin_right = 64.0
margin_bottom = 30.0
mouse_filter = 1
custom_constants/margin_left = 10
[node name="Preview" type="Label" parent="MarginContainer"]
margin_left = 10.0
margin_top = 8.0
margin_right = 22.0
margin_bottom = 22.0
custom_colors/font_color = Color( 1, 1, 1, 0.513726 )
text = "..."

View file

@ -0,0 +1,17 @@
tool
extends MenuButton
signal action(action_name)
func _ready():
var popup = get_popup()
popup.connect("index_pressed", self, "_on_OptionSelected")
func _on_OptionSelected(index):
if index == 0:
emit_signal("action", "up")
elif index == 1:
emit_signal("action", "down")
elif index == 3:
emit_signal("action","remove")

View file

@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/Templates/OptionsControl.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Images/Pieces/expand-icon.svg" type="Texture" id=2]
[node name="OptionsControl" type="MenuButton"]
margin_right = 29.0
margin_bottom = 20.0
icon = ExtResource( 2 )
clip_text = true
align = 2
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 ]
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}

View file

@ -13,7 +13,7 @@ var event_data = {
'portrait': '', 'portrait': '',
} }
onready var portrait_picker = $PanelContainer/VBoxContainer/Header/PortraitPicker onready var character_picker = $PanelContainer/VBoxContainer/Header/CharacterAndPortraitPicker
onready var text_editor = $PanelContainer/VBoxContainer/TextEdit onready var text_editor = $PanelContainer/VBoxContainer/TextEdit
func _ready(): func _ready():
@ -25,12 +25,11 @@ func _ready():
connect("gui_input", self, '_on_gui_input') connect("gui_input", self, '_on_gui_input')
text_editor.connect("focus_entered", self, "_on_TextEdit_focus_entered") text_editor.connect("focus_entered", self, "_on_TextEdit_focus_entered")
text_editor.set("rect_min_size", Vector2(0, 80)) text_editor.set("rect_min_size", Vector2(0, 80))
$PanelContainer/VBoxContainer/Header/CharacterPicker.connect('character_selected', self , '_on_character_selected') character_picker.connect('character_changed', self , '_on_character_changed')
portrait_picker.get_popup().connect("index_pressed", self, '_on_portrait_selected')
var c_list = DialogicUtil.get_sorted_character_list() var c_list = DialogicUtil.get_sorted_character_list()
if c_list.size() == 0: if c_list.size() == 0:
$PanelContainer/VBoxContainer/Header/CharacterPicker.visible = false character_picker.visible = false
else: else:
# Default Speaker # Default Speaker
for c in c_list: for c in c_list:
@ -38,17 +37,13 @@ func _ready():
event_data['character'] = c['file'] event_data['character'] = c['file']
func _on_character_selected(data) -> void: func _on_character_changed(character_data: Dictionary, portrait: String) -> void:
event_data['character'] = data['file'] if character_data.keys().size() > 0:
update_preview() event_data['character'] = character_data['file']
event_data['portrait'] = portrait
else:
func _on_portrait_selected(index) -> void: event_data['character'] = ''
var text = portrait_picker.get_popup().get_item_text(index) event_data['portrait'] = ''
if text == "[Don't change]":
text = ''
portrait_picker.text = ''
event_data['portrait'] = text
update_preview() update_preview()
@ -67,17 +62,13 @@ func load_text(text) -> void:
func load_data(data) -> void: func load_data(data) -> void:
event_data = data event_data = data
text_editor.text = event_data['text'] text_editor.text = event_data['text']
character_picker.set_data(event_data['character'], event_data['portrait'])
update_preview() update_preview()
func update_preview() -> String: func update_preview() -> String:
portrait_picker.set_character(event_data['character'], event_data['portrait'])
var t = text_editor.text var t = text_editor.text
text_editor.rect_min_size.y = text_height * (2 + t.count('\n')) text_editor.rect_min_size.y = text_height * (2 + t.count('\n'))
for c in DialogicUtil.get_character_list():
if c['file'] == event_data['character']:
$PanelContainer/VBoxContainer/Header/CharacterPicker.set_data_by_file(event_data['character'])
var text = event_data['text'] var text = event_data['text']
var lines = text.count('\n') var lines = text.count('\n')

View file

@ -1,16 +1,12 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://addons/dialogic/Editor/Events/TextBlock.gd" type="Script" id=1] [ext_resource path="res://addons/dialogic/Editor/Events/TextBlock.gd" type="Script" id=1]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=2] [ext_resource path="res://addons/dialogic/Editor/Events/Common/VisibleToggle.tscn" type="PackedScene" id=2]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=3] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4] [ext_resource path="res://addons/dialogic/Editor/Events/Common/PieceExtraSettings.tscn" type="PackedScene" id=4]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/CharacterPicker.tscn" type="PackedScene" id=6] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Characters/CharacterAndPortraitPicker.tscn" type="PackedScene" id=5]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/PortraitPicker.tscn" type="PackedScene" id=7]
[ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=8] [ext_resource path="res://addons/dialogic/Editor/Events/Common/Spacer.tscn" type="PackedScene" id=8]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 6.0 content_margin_left = 6.0
content_margin_right = 6.0 content_margin_right = 6.0
@ -90,14 +86,12 @@ margin_left = 35.0
margin_right = 39.0 margin_right = 39.0
margin_bottom = 30.0 margin_bottom = 30.0
[node name="CharacterPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 6 )] [node name="CharacterAndPortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 5 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 43.0 margin_left = 43.0
margin_right = 149.0 margin_right = 149.0
margin_bottom = 30.0
[node name="PortraitPicker" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 7 )]
visible = false
margin_left = 153.0
margin_right = 187.0
[node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )] [node name="VisibleToggle" parent="PanelContainer/VBoxContainer/Header" instance=ExtResource( 2 )]
margin_left = 153.0 margin_left = 153.0
@ -129,8 +123,8 @@ margin_bottom = 114.0
rect_min_size = Vector2( 0, 80 ) rect_min_size = Vector2( 0, 80 )
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
syntax_highlighting = true
show_line_numbers = true show_line_numbers = true
smooth_scrolling = true smooth_scrolling = true
wrap_enabled = true wrap_enabled = true
[connection signal="text_changed" from="PanelContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"] [connection signal="text_changed" from="PanelContainer/VBoxContainer/TextEdit" to="." method="_on_TextEdit_text_changed"]

View file

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

View file

@ -0,0 +1,13 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
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

@ -58,27 +58,26 @@ func _ready():
# Creating the parents # Creating the parents
timelines_tree = tree.create_item(root) timelines_tree = tree.create_item(root)
timelines_tree.set_selectable(0, false)
timelines_tree.set_text(0, "Timelines") timelines_tree.set_text(0, "Timelines")
timelines_tree.set_icon(0, get_icon("Folder", "EditorIcons")) timelines_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
timelines_tree.set_metadata(0, {'editor': 'Timeline Root'})
characters_tree = tree.create_item(root) characters_tree = tree.create_item(root)
characters_tree.set_selectable(0, false)
characters_tree.set_text(0, "Characters") characters_tree.set_text(0, "Characters")
characters_tree.set_icon(0, get_icon("Folder", "EditorIcons")) characters_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
characters_tree.set_metadata(0, {'editor': 'Character Root'})
definitions_tree = tree.create_item(root) definitions_tree = tree.create_item(root)
definitions_tree.set_selectable(0, false)
definitions_tree.set_text(0, "Definitions") definitions_tree.set_text(0, "Definitions")
definitions_tree.set_icon(0, get_icon("Folder", "EditorIcons")) definitions_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
definitions_tree.set_metadata(0, {'editor': 'Definition Root'})
themes_tree = tree.create_item(root) themes_tree = tree.create_item(root)
themes_tree.set_selectable(0, false)
themes_tree.set_text(0, "Themes") themes_tree.set_text(0, "Themes")
themes_tree.set_icon(0, get_icon("Folder", "EditorIcons")) themes_tree.set_icon(0, get_icon("Folder", "EditorIcons"))
themes_tree.set_metadata(0, {'editor': 'Theme Root'})
settings_tree = tree.create_item(root) settings_tree = tree.create_item(root)
settings_tree.set_selectable(0, true)
settings_tree.set_text(0, "Settings") settings_tree.set_text(0, "Settings")
settings_tree.set_icon(0, get_icon("GDScript", "EditorIcons")) settings_tree.set_icon(0, get_icon("GDScript", "EditorIcons"))
settings_tree.set_metadata(0, {'editor': 'Settings'}) settings_tree.set_metadata(0, {'editor': 'Settings'})
@ -140,6 +139,7 @@ func _add_timeline(timeline, select = false):
else: else:
item.set_text(0, timeline['file']) item.set_text(0, timeline['file'])
timeline['editor'] = 'Timeline' timeline['editor'] = 'Timeline'
timeline['editable'] = true
item.set_metadata(0, timeline) item.set_metadata(0, timeline)
if not get_constant("dark_theme", "Editor"): if not get_constant("dark_theme", "Editor"):
item.set_icon_modulate(0, get_color("property_color", "Editor")) item.set_icon_modulate(0, get_color("property_color", "Editor"))
@ -165,6 +165,7 @@ func _add_theme(theme_item, select = false):
item.set_icon(0, theme_icon) item.set_icon(0, theme_icon)
item.set_text(0, theme_item['name']) item.set_text(0, theme_item['name'])
theme_item['editor'] = 'Theme' theme_item['editor'] = 'Theme'
theme_item['editable'] = true
item.set_metadata(0, theme_item) item.set_metadata(0, theme_item)
if not get_constant("dark_theme", "Editor"): if not get_constant("dark_theme", "Editor"):
item.set_icon_modulate(0, get_color("property_color", "Editor")) item.set_icon_modulate(0, get_color("property_color", "Editor"))
@ -192,6 +193,7 @@ func _add_character(character, select = false):
else: else:
item.set_text(0, character['file']) item.set_text(0, character['file'])
character['editor'] = 'Character' character['editor'] = 'Character'
character['editable'] = true
item.set_metadata(0, character) item.set_metadata(0, character)
#item.set_editable(0, true) #item.set_editable(0, true)
if character.has('color'): if character.has('color'):
@ -220,6 +222,7 @@ func _add_definition(definition, select = false):
if definition['type'] == 1: if definition['type'] == 1:
item.set_icon(0, glossary_icon) item.set_icon(0, glossary_icon)
definition['editor'] = 'Definition' definition['editor'] = 'Definition'
definition['editable'] = true
item.set_metadata(0, definition) item.set_metadata(0, definition)
if not get_constant("dark_theme", "Editor"): if not get_constant("dark_theme", "Editor"):
item.set_icon_modulate(0, get_color("property_color", "Editor")) item.set_icon_modulate(0, get_color("property_color", "Editor"))
@ -237,23 +240,22 @@ func _on_item_selected():
if metadata['editor'] == 'Timeline': if metadata['editor'] == 'Timeline':
timeline_editor.load_timeline(metadata['file']) timeline_editor.load_timeline(metadata['file'])
show_timeline_editor() show_timeline_editor()
if metadata['editor'] == 'Character': elif metadata['editor'] == 'Character':
if not character_editor.is_selected(metadata['file']): if not character_editor.is_selected(metadata['file']):
character_editor.load_character(metadata['file']) character_editor.load_character(metadata['file'])
show_character_editor() show_character_editor()
if metadata['editor'] == 'Definition': elif metadata['editor'] == 'Definition':
if not definition_editor.is_selected(metadata['id']): if not definition_editor.is_selected(metadata['id']):
definition_editor.visible = true definition_editor.visible = true
definition_editor.load_definition(metadata['id']) definition_editor.load_definition(metadata['id'])
show_definition_editor() show_definition_editor()
if metadata['editor'] == 'Theme': elif metadata['editor'] == 'Theme':
theme_editor.load_theme(metadata['file']) theme_editor.load_theme(metadata['file'])
show_theme_editor() show_theme_editor()
if metadata['editor'] == 'Settings': elif metadata['editor'] == 'Settings':
settings_editor.update_data() settings_editor.update_data()
show_settings_editor() show_settings_editor()
func show_character_editor(): func show_character_editor():
emit_signal("editor_selected", 'character') emit_signal("editor_selected", 'character')
character_editor.visible = true character_editor.visible = true
@ -328,7 +330,18 @@ func _on_item_rmb_selected(position):
if item['editor'] == 'Definition': if item['editor'] == 'Definition':
editor_reference.get_node("DefinitionPopupMenu").rect_position = get_viewport().get_mouse_position() editor_reference.get_node("DefinitionPopupMenu").rect_position = get_viewport().get_mouse_position()
editor_reference.get_node("DefinitionPopupMenu").popup() editor_reference.get_node("DefinitionPopupMenu").popup()
if item['editor'] == 'Timeline Root':
editor_reference.get_node('TimelineRootPopupMenu').rect_position = get_viewport().get_mouse_position()
editor_reference.get_node('TimelineRootPopupMenu').popup()
if item['editor'] == 'Character Root':
editor_reference.get_node("CharacterRootPopupMenu").rect_position = get_viewport().get_mouse_position()
editor_reference.get_node("CharacterRootPopupMenu").popup()
if item['editor'] == 'Theme Root':
editor_reference.get_node("ThemeRootPopupMenu").rect_position = get_viewport().get_mouse_position()
editor_reference.get_node("ThemeRootPopupMenu").popup()
if item['editor'] == 'Definition Root':
editor_reference.get_node("DefinitionRootPopupMenu").rect_position = get_viewport().get_mouse_position()
editor_reference.get_node("DefinitionRootPopupMenu").popup()
func remove_selected(): func remove_selected():
var item = get_selected() var item = get_selected()
@ -351,8 +364,9 @@ func _on_gui_input(event):
if event.is_pressed() and event.doubleclick: if event.is_pressed() and event.doubleclick:
var item = get_selected() var item = get_selected()
var metadata = item.get_metadata(0) var metadata = item.get_metadata(0)
item.set_editable(0, true) if metadata.has("editable") and metadata["editable"]:
$RenamerReset.start(0.5) item.set_editable(0, true)
$RenamerReset.start(0.5)
func _on_item_edited(): func _on_item_edited():

View file

@ -31,16 +31,19 @@ onready var n : Dictionary = {
# Dialog box # Dialog box
'background_texture_button_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/CheckBox", 'background_texture_button_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/CheckBox",
'theme_background_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton", 'theme_background_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton",
'theme_next_image': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextIndicatorButton", 'theme_next_image': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextIndicatorButton",
'next_animation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextAnimation", 'next_indicator_scale': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer7/IndicatorScale",
'next_indicator_offset_x': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetX",
'next_indicator_offset_y': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetY",
'next_animation': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextAnimation",
'theme_action_key': $"VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton", 'theme_action_key': $"VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton",
'theme_background_color_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/CheckBox", 'theme_background_color_visible': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/CheckBox",
'theme_background_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/ColorPickerButton", 'theme_background_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2/ColorPickerButton",
'theme_text_margin': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetV", 'theme_text_margin': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetV",
'theme_text_margin_h': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetH", 'theme_text_margin_h': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetH",
'size_w': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeW", 'size_w': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeW",
'size_h': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeH", 'size_h': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeH",
'bottom_gap': $"VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer5/BottomGap", 'bottom_gap': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5/BottomGap",
'background_modulation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox", 'background_modulation': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox",
'background_modulation_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton", 'background_modulation_color': $"VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton",
@ -72,6 +75,10 @@ onready var n : Dictionary = {
'button_offset_y': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetV", 'button_offset_y': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetV",
'button_separation': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/VerticalSeparation", 'button_separation': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/VerticalSeparation",
'button_fixed': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/FixedSize",
'button_fixed_x': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeX",
'button_fixed_y': $"VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeY",
# Glossary # Glossary
'glossary_font': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton, 'glossary_font': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton,
'glossary_color': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton, 'glossary_color': $VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton,
@ -101,7 +108,7 @@ func _ready() -> void:
func load_theme(filename): func load_theme(filename):
loading = true loading = true
current_theme = filename current_theme = filename
var theme = DialogicResources.get_theme_config(filename) var theme = DialogicResources.get_theme_config(filename)
# Settings # Settings
n['theme_action_key'].text = theme.get_value('settings', 'action_key', 'ui_accept') n['theme_action_key'].text = theme.get_value('settings', 'action_key', 'ui_accept')
@ -111,6 +118,10 @@ func load_theme(filename):
n['theme_background_color'].color = Color(theme.get_value('background', 'color', '#ff000000')) n['theme_background_color'].color = Color(theme.get_value('background', 'color', '#ff000000'))
n['theme_background_color_visible'].pressed = theme.get_value('background', 'use_color', false) n['theme_background_color_visible'].pressed = theme.get_value('background', 'use_color', false)
n['theme_next_image'].text = DialogicResources.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png')) n['theme_next_image'].text = DialogicResources.get_filename_from_path(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
n['next_indicator_scale'].value = theme.get_value('next_indicator', 'scale', 0.4)
var next_indicator_offset = theme.get_value('next_indicator', 'offset', Vector2(13,10))
n['next_indicator_offset_x'].value = next_indicator_offset.x
n['next_indicator_offset_y'].value = next_indicator_offset.y
n['background_modulation'].pressed = theme.get_value('background', 'modulation', false) n['background_modulation'].pressed = theme.get_value('background', 'modulation', false)
n['background_modulation_color'].color = Color(theme.get_value('background', 'modulation_color', '#ffffffff')) n['background_modulation_color'].color = Color(theme.get_value('background', 'modulation_color', '#ffffffff'))
@ -135,8 +146,9 @@ func load_theme(filename):
n['button_separation'].value = theme.get_value('buttons', 'gap', 5) n['button_separation'].value = theme.get_value('buttons', 'gap', 5)
n['button_modulation'].pressed = theme.get_value('buttons', 'modulation', false) n['button_modulation'].pressed = theme.get_value('buttons', 'modulation', false)
n['button_modulation_color'].color = Color(theme.get_value('buttons', 'modulation_color', '#ffffffff')) n['button_modulation_color'].color = Color(theme.get_value('buttons', 'modulation_color', '#ffffffff'))
n['button_fixed'].pressed = theme.get_value('buttons', 'fixed', false)
n['button_fixed_x'].value = theme.get_value('buttons', 'fixed_size', Vector2(130,40)).x
n['button_fixed_y'].value = theme.get_value('buttons', 'fixed_size', Vector2(130,40)).y
toggle_button_customization_fields(not theme.get_value('buttons', 'use_native', false)) toggle_button_customization_fields(not theme.get_value('buttons', 'use_native', false))
@ -245,6 +257,14 @@ func _on_indicator_selected(path, target) -> void:
return return
DialogicResources.set_theme_value(current_theme, 'next_indicator','image', path) DialogicResources.set_theme_value(current_theme, 'next_indicator','image', path)
n['theme_next_image'].text = DialogicResources.get_filename_from_path(path) n['theme_next_image'].text = DialogicResources.get_filename_from_path(path)
# Since people will probably want the sprite on fresh values and the default
# ones are for the custom dialogic theme, I reset the next indicator properties
# here so they can set the scale and offset they want.
DialogicResources.set_theme_value(current_theme, 'next_indicator', 'scale', 1)
DialogicResources.set_theme_value(current_theme, 'offset', 'scale', Vector2(10,10))
n['next_indicator_scale'].value = 1
n['next_indicator_offset_x'].value = 10
n['next_indicator_offset_y'].value = 10
_on_PreviewButton_pressed() # Refreshing the preview _on_PreviewButton_pressed() # Refreshing the preview
@ -301,8 +321,12 @@ func _on_PreviewButton_pressed() -> void:
$VBoxContainer/Panel.add_child(preview_dialog) $VBoxContainer/Panel.add_child(preview_dialog)
# maintaining the preview panel big enough for the dialog box # maintaining the preview panel big enough for the dialog box
$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) var box_size = preview_dialog.current_theme.get_value('box', 'size', Vector2(910, 167)).y
var bottom_gap = preview_dialog.current_theme.get_value('box', 'bottom_gap', 40)
var extra = 90
$VBoxContainer/Panel.rect_min_size.y = box_size + extra + bottom_gap
$VBoxContainer/Panel.rect_size.y = 0 $VBoxContainer/Panel.rect_size.y = 0
preview_dialog.call_deferred('resize_main')
func _on_ActionOptionButton_item_selected(index) -> void: func _on_ActionOptionButton_item_selected(index) -> void:
@ -630,3 +654,32 @@ func _on_ColorPicker_ChoiceButtons_modulation_color_changed(color) -> void:
DialogicResources.set_theme_value(current_theme, 'buttons', 'modulation_color', '#' + color.to_html()) DialogicResources.set_theme_value(current_theme, 'buttons', 'modulation_color', '#' + color.to_html())
$DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times $DelayPreviewTimer.start(0.5) # Calling a timer so the update doesn't get triggered many times
func _on_IndicatorScale_value_changed(value) -> void:
if loading:
return
DialogicResources.set_theme_value(current_theme, 'next_indicator', 'scale', value)
_on_PreviewButton_pressed() # Refreshing the preview
func _on_NextOffset_value_changed(value):
if loading:
return
var offset_value = Vector2(n['next_indicator_offset_x'].value, n['next_indicator_offset_y'].value)
DialogicResources.set_theme_value(current_theme, 'next_indicator', 'offset', offset_value)
_on_PreviewButton_pressed() # Refreshing the preview
func _on_FixedSize_toggled(button_pressed):
if loading:
return
DialogicResources.set_theme_value(current_theme, 'buttons', 'fixed', button_pressed)
_on_PreviewButton_pressed() # Refreshing the preview
func _on_ButtonSize_value_changed(value):
if loading:
return
DialogicResources.set_theme_value(current_theme, 'buttons','fixed_size', Vector2(n['button_fixed_x'].value,n['button_fixed_y'].value))
_on_PreviewButton_pressed() # Refreshing the preview

View file

@ -8,38 +8,38 @@ content_margin_left = 4.0
content_margin_right = 4.0 content_margin_right = 4.0
content_margin_top = 4.0 content_margin_top = 4.0
content_margin_bottom = 4.0 content_margin_bottom = 4.0
bg_color = Color( 0.2265, 0.246975, 0.301575, 1 ) bg_color = Color( 0.252, 0.2718, 0.3246, 1 )
[node name="ThemeEditor" type="ScrollContainer"] [node name="ThemeEditor" type="ScrollContainer"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_right = -6.0 margin_right = -6.0
margin_bottom = -17.0 margin_bottom = 311.0
script = ExtResource( 2 ) script = ExtResource( 2 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_right = 1006.0 margin_right = 1018.0
margin_bottom = 592.0 margin_bottom = 911.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
custom_constants/separation = 15 custom_constants/separation = 15
[node name="Panel" type="Panel" parent="VBoxContainer"] [node name="Panel" type="Panel" parent="VBoxContainer"]
margin_right = 1006.0 margin_right = 1018.0
margin_bottom = 300.0 margin_bottom = 460.0
rect_min_size = Vector2( 0, 300 ) rect_min_size = Vector2( 0, 460 )
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"] [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer"]
margin_top = 315.0 margin_top = 475.0
margin_right = 1006.0 margin_right = 1018.0
margin_bottom = 375.0 margin_bottom = 535.0
custom_constants/separation = 10 custom_constants/separation = 10
[node name="TextEdit" type="TextEdit" parent="VBoxContainer/HBoxContainer3"] [node name="TextEdit" type="TextEdit" parent="VBoxContainer/HBoxContainer3"]
margin_right = 844.0 margin_right = 856.0
margin_bottom = 60.0 margin_bottom = 60.0
rect_min_size = Vector2( 400, 60 ) rect_min_size = Vector2( 400, 60 )
size_flags_horizontal = 3 size_flags_horizontal = 3
@ -48,21 +48,22 @@ text = "This is preview text. You can use [color=#A5EFAC]BBCode[/color] to styl
wrap_enabled = true wrap_enabled = true
[node name="PreviewButton" type="Button" parent="VBoxContainer/HBoxContainer3"] [node name="PreviewButton" type="Button" parent="VBoxContainer/HBoxContainer3"]
margin_left = 854.0 margin_left = 866.0
margin_right = 1006.0 margin_right = 1018.0
margin_bottom = 60.0 margin_bottom = 60.0
text = " Preview changes " text = " Preview changes "
icon = ExtResource( 1 ) icon = ExtResource( 1 )
[node name="TabContainer" type="TabContainer" parent="VBoxContainer"] [node name="TabContainer" type="TabContainer" parent="VBoxContainer"]
margin_top = 390.0 margin_top = 550.0
margin_right = 1006.0 margin_right = 1018.0
margin_bottom = 592.0 margin_bottom = 911.0
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
tab_align = 0 tab_align = 0
[node name="Dialog Text" type="HBoxContainer" parent="VBoxContainer/TabContainer"] [node name="Dialog Text" type="HBoxContainer" parent="VBoxContainer/TabContainer"]
visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_left = 4.0
@ -73,7 +74,7 @@ custom_constants/separation = 10
[node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Text"] [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Text"]
margin_right = 270.0 margin_right = 270.0
margin_bottom = 166.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -199,12 +200,12 @@ prefix = "Y"
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Text"] [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Text"]
margin_left = 280.0 margin_left = 280.0
margin_right = 284.0 margin_right = 284.0
margin_bottom = 166.0 margin_bottom = 325.0
[node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Text"] [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Text"]
margin_left = 294.0 margin_left = 294.0
margin_right = 564.0 margin_right = 564.0
margin_bottom = 166.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -251,8 +252,8 @@ margin_bottom = -4.0
custom_constants/separation = 10 custom_constants/separation = 10
[node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"] [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"]
margin_right = 270.0 margin_right = 288.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -260,29 +261,29 @@ __meta__ = {
} }
[node name="SectionTitle" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column"] [node name="SectionTitle" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column"]
margin_right = 270.0 margin_right = 288.0
margin_bottom = 22.0 margin_bottom = 22.0
custom_styles/normal = SubResource( 1 ) custom_styles/normal = SubResource( 1 )
text = "Visuals" text = "Visuals"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column"] [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column"]
margin_top = 26.0 margin_top = 26.0
margin_right = 270.0 margin_right = 288.0
margin_bottom = 154.0 margin_bottom = 190.0
size_flags_horizontal = 3 size_flags_horizontal = 3
custom_constants/hseparation = 10 custom_constants/hseparation = 10
columns = 2 columns = 2
[node name="Label5" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="Label5" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_top = 5.0 margin_top = 5.0
margin_right = 134.0 margin_right = 126.0
margin_bottom = 19.0 margin_bottom = 19.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Background Color" text = "Background Color"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_left = 144.0 margin_left = 136.0
margin_right = 270.0 margin_right = 288.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2"] [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2"]
@ -291,20 +292,20 @@ margin_bottom = 24.0
[node name="ColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2"] [node name="ColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer2"]
margin_left = 28.0 margin_left = 28.0
margin_right = 126.0 margin_right = 152.0
margin_bottom = 24.0 margin_bottom = 24.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="Label" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_top = 33.0 margin_top = 33.0
margin_right = 134.0 margin_right = 126.0
margin_bottom = 47.0 margin_bottom = 47.0
text = "Background Texture" text = "Background Texture"
[node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="HBoxContainer3" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_left = 144.0 margin_left = 136.0
margin_top = 28.0 margin_top = 28.0
margin_right = 270.0 margin_right = 288.0
margin_bottom = 52.0 margin_bottom = 52.0
[node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3"] [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3"]
@ -314,21 +315,21 @@ pressed = true
[node name="BackgroundTextureButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3"] [node name="BackgroundTextureButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3"]
margin_left = 28.0 margin_left = 28.0
margin_right = 126.0 margin_right = 152.0
margin_bottom = 24.0 margin_bottom = 24.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "background-2" text = "background-2"
[node name="Label9" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="Label9" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_top = 61.0 margin_top = 61.0
margin_right = 134.0 margin_right = 126.0
margin_bottom = 75.0 margin_bottom = 75.0
text = "Texture Modulation" text = "Texture Modulation"
[node name="HBoxContainer6" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="HBoxContainer6" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_left = 144.0 margin_left = 136.0
margin_top = 56.0 margin_top = 56.0
margin_right = 270.0 margin_right = 288.0
margin_bottom = 80.0 margin_bottom = 80.0
[node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6"] [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6"]
@ -337,47 +338,102 @@ margin_bottom = 24.0
[node name="ColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6"] [node name="ColorPickerButton" type="ColorPickerButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6"]
margin_left = 28.0 margin_left = 28.0
margin_right = 126.0 margin_right = 152.0
margin_bottom = 24.0 margin_bottom = 24.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="Label6" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_top = 87.0 margin_top = 89.0
margin_right = 134.0 margin_right = 126.0
margin_bottom = 101.0 margin_bottom = 103.0
text = "Next indicator" size_flags_horizontal = 3
text = "Box padding"
[node name="NextIndicatorButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_left = 144.0 margin_left = 136.0
margin_top = 84.0 margin_top = 84.0
margin_right = 270.0 margin_right = 288.0
margin_bottom = 104.0 margin_bottom = 108.0
text = "next-indicator"
[node name="Label4" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer"]
margin_top = 111.0 margin_right = 74.0
margin_right = 134.0 margin_bottom = 24.0
margin_bottom = 125.0 max_value = 1e+07
text = "Next animation" value = 10.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="NextAnimation" type="OptionButton" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"] [node name="TextOffsetH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer"]
margin_left = 144.0 margin_left = 78.0
margin_top = 108.0 margin_right = 152.0
margin_right = 270.0 margin_bottom = 24.0
margin_bottom = 128.0 max_value = 1e+07
__meta__ = { value = 20.0
"_edit_use_anchors_": false rounded = true
} allow_greater = true
allow_lesser = true
[node name="Label7" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_top = 117.0
margin_right = 126.0
margin_bottom = 131.0
text = "Box size (pixels)"
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_left = 136.0
margin_top = 112.0
margin_right = 288.0
margin_bottom = 136.0
[node name="BoxSizeW" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4"]
margin_right = 74.0
margin_bottom = 24.0
value = 100.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="BoxSizeH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
max_value = 999.0
value = 167.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="Label8" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_top = 145.0
margin_right = 126.0
margin_bottom = 159.0
text = "Bottom gap"
[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer"]
margin_left = 136.0
margin_top = 140.0
margin_right = 288.0
margin_bottom = 164.0
[node name="BottomGap" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5"]
margin_right = 74.0
margin_bottom = 24.0
max_value = 999.0
value = 40.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Box"] [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Box"]
margin_left = 280.0 margin_left = 298.0
margin_right = 284.0 margin_right = 302.0
margin_bottom = 157.0 margin_bottom = 325.0
[node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"] [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"]
margin_left = 294.0 margin_left = 312.0
margin_right = 564.0 margin_right = 582.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -388,29 +444,78 @@ __meta__ = {
margin_right = 270.0 margin_right = 270.0
margin_bottom = 22.0 margin_bottom = 22.0
custom_styles/normal = SubResource( 1 ) custom_styles/normal = SubResource( 1 )
text = "Placement" text = "Next Indicator"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2"] [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2"]
margin_top = 26.0 margin_top = 26.0
margin_right = 270.0 margin_right = 270.0
margin_bottom = 106.0 margin_bottom = 126.0
size_flags_horizontal = 3 size_flags_horizontal = 3
custom_constants/hseparation = 10 custom_constants/hseparation = 10
columns = 2 columns = 2
[node name="Label6" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"] [node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_top = 5.0 margin_top = 3.0
margin_right = 108.0 margin_right = 108.0
margin_bottom = 19.0 margin_bottom = 17.0
size_flags_horizontal = 3 text = "Image"
text = "Box padding"
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"] [node name="NextIndicatorButton" type="Button" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_left = 118.0 margin_left = 118.0
margin_right = 270.0 margin_right = 270.0
margin_bottom = 24.0 margin_bottom = 20.0
text = "next-indicator"
[node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer"] [node name="Label4" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_top = 27.0
margin_right = 108.0
margin_bottom = 41.0
text = "Animation"
[node name="NextAnimation" type="OptionButton" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_left = 118.0
margin_top = 24.0
margin_right = 270.0
margin_bottom = 44.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label3" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_top = 53.0
margin_right = 108.0
margin_bottom = 67.0
text = "Scale"
[node name="HBoxContainer7" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_left = 118.0
margin_top = 48.0
margin_right = 270.0
margin_bottom = 72.0
[node name="IndicatorScale" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer7"]
margin_right = 74.0
margin_bottom = 24.0
max_value = 999.0
step = 0.1
value = 1.0
allow_greater = true
allow_lesser = true
[node name="Label9" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_top = 81.0
margin_right = 108.0
margin_bottom = 95.0
size_flags_horizontal = 3
text = "Offset"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_left = 118.0
margin_top = 76.0
margin_right = 270.0
margin_bottom = 100.0
[node name="NextOffsetX" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2"]
margin_right = 74.0 margin_right = 74.0
margin_bottom = 24.0 margin_bottom = 24.0
max_value = 1e+07 max_value = 1e+07
@ -419,7 +524,7 @@ rounded = true
allow_greater = true allow_greater = true
allow_lesser = true allow_lesser = true
[node name="TextOffsetH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer"] [node name="NextOffsetY" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2"]
margin_left = 78.0 margin_left = 78.0
margin_right = 152.0 margin_right = 152.0
margin_bottom = 24.0 margin_bottom = 24.0
@ -429,66 +534,15 @@ rounded = true
allow_greater = true allow_greater = true
allow_lesser = true allow_lesser = true
[node name="Label7" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_top = 33.0
margin_right = 108.0
margin_bottom = 47.0
text = "Box size (pixels)"
[node name="HBoxContainer4" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_left = 118.0
margin_top = 28.0
margin_right = 270.0
margin_bottom = 52.0
[node name="BoxSizeW" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4"]
margin_right = 74.0
margin_bottom = 24.0
value = 100.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="BoxSizeH" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4"]
margin_left = 78.0
margin_right = 152.0
margin_bottom = 24.0
max_value = 999.0
value = 167.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="Label8" type="Label" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_top = 61.0
margin_right = 108.0
margin_bottom = 75.0
text = "Bottom gap"
[node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer"]
margin_left = 118.0
margin_top = 56.0
margin_right = 270.0
margin_bottom = 80.0
[node name="BottomGap" type="SpinBox" parent="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer5"]
margin_right = 74.0
margin_bottom = 24.0
max_value = 999.0
value = 40.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Box"] [node name="VSeparator2" type="VSeparator" parent="VBoxContainer/TabContainer/Dialog Box"]
margin_left = 574.0 margin_left = 592.0
margin_right = 578.0 margin_right = 596.0
margin_bottom = 157.0 margin_bottom = 325.0
[node name="Column3" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"] [node name="Column3" type="VBoxContainer" parent="VBoxContainer/TabContainer/Dialog Box"]
margin_left = 588.0 margin_left = 606.0
margin_right = 858.0 margin_right = 876.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -542,7 +596,7 @@ custom_constants/separation = 10
[node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"] [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"]
margin_right = 287.0 margin_right = 287.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -630,12 +684,12 @@ prefix = "Y"
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Name Label"] [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Name Label"]
margin_left = 297.0 margin_left = 297.0
margin_right = 301.0 margin_right = 301.0
margin_bottom = 157.0 margin_bottom = 325.0
[node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"] [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"]
margin_left = 311.0 margin_left = 311.0
margin_right = 581.0 margin_right = 581.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -651,7 +705,7 @@ text = "Box"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Name Label/Column2"] [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Name Label/Column2"]
margin_top = 26.0 margin_top = 26.0
margin_right = 270.0 margin_right = 270.0
margin_bottom = 78.0 margin_bottom = 106.0
columns = 2 columns = 2
[node name="Label5" type="Label" parent="VBoxContainer/TabContainer/Name Label/Column2/GridContainer"] [node name="Label5" type="Label" parent="VBoxContainer/TabContainer/Name Label/Column2/GridContainer"]
@ -725,12 +779,12 @@ size_flags_horizontal = 3
[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/TabContainer/Name Label"] [node name="VSeparator2" type="VSeparator" parent="VBoxContainer/TabContainer/Name Label"]
margin_left = 591.0 margin_left = 591.0
margin_right = 595.0 margin_right = 595.0
margin_bottom = 157.0 margin_bottom = 325.0
[node name="Column3" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"] [node name="Column3" type="VBoxContainer" parent="VBoxContainer/TabContainer/Name Label"]
margin_left = 605.0 margin_left = 605.0
margin_right = 875.0 margin_right = 875.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -770,7 +824,6 @@ allow_greater = true
allow_lesser = true allow_lesser = true
[node name="Choice Buttons" type="HBoxContainer" parent="VBoxContainer/TabContainer"] [node name="Choice Buttons" type="HBoxContainer" parent="VBoxContainer/TabContainer"]
visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_left = 4.0 margin_left = 4.0
@ -781,7 +834,7 @@ custom_constants/separation = 10
[node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons"] [node name="Column" type="VBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons"]
margin_right = 270.0 margin_right = 270.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -797,7 +850,7 @@ text = "Visuals"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column"] [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column"]
margin_top = 26.0 margin_top = 26.0
margin_right = 270.0 margin_right = 270.0
margin_bottom = 106.0 margin_bottom = 162.0
size_flags_horizontal = 3 size_flags_horizontal = 3
custom_constants/hseparation = 10 custom_constants/hseparation = 10
columns = 2 columns = 2
@ -898,26 +951,26 @@ margin_bottom = 24.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer"] [node name="Label2" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer"]
margin_top = 89.0 margin_top = 117.0
margin_right = 134.0 margin_right = 134.0
margin_bottom = 103.0 margin_bottom = 131.0
text = "Use Native Buttons" text = "Use Native Buttons"
[node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer"] [node name="CheckBox" type="CheckBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column/GridContainer"]
margin_left = 144.0 margin_left = 144.0
margin_top = 84.0 margin_top = 112.0
margin_right = 270.0 margin_right = 270.0
margin_bottom = 108.0 margin_bottom = 136.0
[node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Choice Buttons"] [node name="VSeparator" type="VSeparator" parent="VBoxContainer/TabContainer/Choice Buttons"]
margin_left = 280.0 margin_left = 280.0
margin_right = 284.0 margin_right = 284.0
margin_bottom = 157.0 margin_bottom = 325.0
[node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons"] [node name="Column2" type="VBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons"]
margin_left = 294.0 margin_left = 294.0
margin_right = 575.0 margin_right = 603.0
margin_bottom = 157.0 margin_bottom = 325.0
rect_min_size = Vector2( 270, 0 ) rect_min_size = Vector2( 270, 0 )
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
@ -925,15 +978,15 @@ __meta__ = {
} }
[node name="SectionTitle" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column2"] [node name="SectionTitle" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column2"]
margin_right = 281.0 margin_right = 309.0
margin_bottom = 22.0 margin_bottom = 22.0
custom_styles/normal = SubResource( 1 ) custom_styles/normal = SubResource( 1 )
text = "Placement" text = "Placement"
[node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2"] [node name="GridContainer" type="GridContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2"]
margin_top = 26.0 margin_top = 26.0
margin_right = 281.0 margin_right = 309.0
margin_bottom = 78.0 margin_bottom = 106.0
size_flags_horizontal = 3 size_flags_horizontal = 3
custom_constants/hseparation = 10 custom_constants/hseparation = 10
columns = 2 columns = 2
@ -947,7 +1000,7 @@ text = "Box padding"
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"] [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
margin_left = 129.0 margin_left = 129.0
margin_right = 281.0 margin_right = 309.0
margin_bottom = 24.0 margin_bottom = 24.0
[node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer"] [node name="TextOffsetV" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer"]
@ -976,12 +1029,44 @@ text = "Vertical separation"
[node name="VerticalSeparation" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"] [node name="VerticalSeparation" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
margin_left = 129.0 margin_left = 129.0
margin_top = 28.0 margin_top = 28.0
margin_right = 281.0 margin_right = 309.0
margin_bottom = 52.0 margin_bottom = 52.0
value = 5.0 value = 5.0
rounded = true rounded = true
allow_lesser = true allow_lesser = true
[node name="Label" type="Label" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
margin_top = 61.0
margin_right = 119.0
margin_bottom = 75.0
text = "Fixed size"
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer"]
margin_left = 129.0
margin_top = 56.0
margin_right = 309.0
margin_bottom = 80.0
[node name="FixedSize" type="CheckBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2"]
margin_right = 24.0
margin_bottom = 24.0
[node name="ButtonSizeX" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2"]
margin_left = 28.0
margin_right = 102.0
margin_bottom = 24.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="ButtonSizeY" type="SpinBox" parent="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2"]
margin_left = 106.0
margin_right = 180.0
margin_bottom = 24.0
rounded = true
allow_greater = true
allow_lesser = true
[node name="Glossary" type="HBoxContainer" parent="VBoxContainer/TabContainer"] [node name="Glossary" type="HBoxContainer" parent="VBoxContainer/TabContainer"]
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
@ -1114,13 +1199,16 @@ one_shot = true
[connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton" to="." method="_on_BackgroundTextureButton_pressed"] [connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer3/BackgroundTextureButton" to="." method="_on_BackgroundTextureButton_pressed"]
[connection signal="toggled" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox" to="." method="_on_BackgroundTexture_Modulation_toggled"] [connection signal="toggled" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/CheckBox" to="." method="_on_BackgroundTexture_Modulation_toggled"]
[connection signal="color_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton" to="." method="_on_ColorPicker_Background_texture_modulation_color_changed"] [connection signal="color_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer6/ColorPickerButton" to="." method="_on_ColorPicker_Background_texture_modulation_color_changed"]
[connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextIndicatorButton" to="." method="_on_NextIndicatorButton_pressed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_TextMargin_value_changed"]
[connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/NextAnimation" to="." method="_on_NextAnimation_item_selected"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_TextMargin_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_TextMargin_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeW" to="." method="_on_BoxSize_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_TextMargin_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer4/BoxSizeH" to="." method="_on_BoxSize_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeW" to="." method="_on_BoxSize_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column/GridContainer/HBoxContainer5/BottomGap" to="." method="_on_BottomGap_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer4/BoxSizeH" to="." method="_on_BoxSize_value_changed"] [connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextIndicatorButton" to="." method="_on_NextIndicatorButton_pressed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer5/BottomGap" to="." method="_on_BottomGap_value_changed"] [connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/NextAnimation" to="." method="_on_NextAnimation_item_selected"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer7/IndicatorScale" to="." method="_on_IndicatorScale_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetX" to="." method="_on_NextOffset_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Dialog Box/Column2/GridContainer/HBoxContainer2/NextOffsetY" to="." method="_on_NextOffset_value_changed"]
[connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton" to="." method="_on_ActionOptionButton_item_selected"] [connection signal="item_selected" from="VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton" to="." method="_on_ActionOptionButton_item_selected"]
[connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton" to="." method="_on_ActionOptionButton_pressed"] [connection signal="pressed" from="VBoxContainer/TabContainer/Dialog Box/Column3/GridContainer/BoxContainer/ActionOptionButton" to="." method="_on_ActionOptionButton_pressed"]
[connection signal="toggled" from="VBoxContainer/TabContainer/Name Label/Column/GridContainer/CharacterColor" to="." method="_on_name_auto_color_toggled"] [connection signal="toggled" from="VBoxContainer/TabContainer/Name Label/Column/GridContainer/CharacterColor" to="." method="_on_name_auto_color_toggled"]
@ -1147,6 +1235,9 @@ one_shot = true
[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_ButtonOffset_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetV" to="." method="_on_ButtonOffset_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_ButtonOffset_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer/TextOffsetH" to="." method="_on_ButtonOffset_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/VerticalSeparation" to="." method="_on_VerticalSeparation_value_changed"] [connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/VerticalSeparation" to="." method="_on_VerticalSeparation_value_changed"]
[connection signal="toggled" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/FixedSize" to="." method="_on_FixedSize_toggled"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeX" to="." method="_on_ButtonSize_value_changed"]
[connection signal="value_changed" from="VBoxContainer/TabContainer/Choice Buttons/Column2/GridContainer/HBoxContainer2/ButtonSizeY" to="." method="_on_ButtonSize_value_changed"]
[connection signal="pressed" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton" to="." method="_on_GlossaryFontButton_pressed"] [connection signal="pressed" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/FontButton" to="." method="_on_GlossaryFontButton_pressed"]
[connection signal="color_changed" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton" to="." method="_on_GlossaryColorPicker_color_changed"] [connection signal="color_changed" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/ColorPickerButton" to="." method="_on_GlossaryColorPicker_color_changed"]
[connection signal="toggled" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/HBoxContainer2/CheckBoxShadow" to="." method="_on_CheckBoxShadow_toggled"] [connection signal="toggled" from="VBoxContainer/TabContainer/Glossary/Column/GridContainer/HBoxContainer2/CheckBoxShadow" to="." method="_on_CheckBoxShadow_toggled"]

View file

@ -11,8 +11,9 @@ onready var timeline = $TimelineArea/TimeLine
onready var events_warning = $ScrollContainer/EventContainer/EventsWarning onready var events_warning = $ScrollContainer/EventContainer/EventsWarning
var hovered_item = null var hovered_item = null
var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/selected_styleboxflat.tres") var selected_style : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/styles/selected_styleboxflat.tres")
var selected_style_text : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/selected_styleboxflat_text_event.tres") var selected_style_text : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/styles/selected_styleboxflat_text_event.tres")
var selected_style_template : StyleBoxFlat = load("res://addons/dialogic/Editor/Events/styles/selected_styleboxflat_template.tres")
var saved_style : StyleBoxFlat var saved_style : StyleBoxFlat
var selected_item : Node var selected_item : Node
@ -20,6 +21,10 @@ var selected_item : Node
var moving_piece = null var moving_piece = null
var piece_was_dragged = false var piece_was_dragged = false
func _has_template(event):
return event.event_data.has("background")
func _ready(): func _ready():
var modifier = '' var modifier = ''
var _scale = get_constant("inspector_margin", "Editor") var _scale = get_constant("inspector_margin", "Editor")
@ -203,10 +208,12 @@ func _process(delta):
func _clear_selection(): func _clear_selection():
if selected_item != null and saved_style != null: if selected_item != null and saved_style != null:
var selected_panel: PanelContainer = selected_item.get_node("PanelContainer") if not _has_template(selected_item):
if selected_panel != null: var selected_panel: PanelContainer = selected_item.get_node("PanelContainer")
selected_panel.set('custom_styles/panel', saved_style) if selected_panel != null:
selected_panel.set('custom_styles/panel', saved_style)
else:
selected_item.event_template.set_event_style(saved_style)
selected_item = null selected_item = null
saved_style = null saved_style = null
@ -218,17 +225,22 @@ func _is_item_selected(item: Node):
func _select_item(item: Node): func _select_item(item: Node):
if item != null and not _is_item_selected(item): if item != null and not _is_item_selected(item):
_clear_selection() _clear_selection()
var panel: PanelContainer = item.get_node("PanelContainer") selected_item = item
if panel != null: if not _has_template(item):
saved_style = panel.get('custom_styles/panel') var panel: PanelContainer = item.get_node("PanelContainer")
selected_item = item if panel != null:
if selected_item.event_data.has('text') and selected_item.event_data.has('character'): saved_style = panel.get('custom_styles/panel')
panel.set('custom_styles/panel', selected_style_text) if selected_item.event_data.has('text') and selected_item.event_data.has('character'):
else: panel.set('custom_styles/panel', selected_style_text)
panel.set('custom_styles/panel', selected_style) else:
# allow event panels to do additional operation when getting selected panel.set('custom_styles/panel', selected_style)
if (selected_item.has_method("on_timeline_selected")): # allow event panels to do additional operation when getting selected
selected_item.on_timeline_selected() if (selected_item.has_method("on_timeline_selected")):
selected_item.on_timeline_selected()
else:
saved_style = item.event_template.get_event_style()
item.event_template.set_event_style(selected_style_template)
selected_item.event_template.on_timeline_selected()
else: else:
_clear_selection() _clear_selection()
@ -250,6 +262,16 @@ func _on_gui_input(event, item: Node):
piece_was_dragged = false piece_was_dragged = false
func _on_event_options_action(action: String, item: Node):
if action == "remove":
if selected_item != item:
_select_item(item)
delete_event()
else:
move_block(item, action)
indent_events()
# Event Creation signal for buttons # Event Creation signal for buttons
func _create_event_button_pressed(button_name): func _create_event_button_pressed(button_name):
create_event(button_name) create_event(button_name)
@ -284,7 +306,6 @@ func _on_ButtonCondition_pressed() -> void:
# Adding an event to the timeline # Adding an event to the timeline
func create_event(scene: String, data: Dictionary = {'no-data': true} , indent: bool = false): func create_event(scene: String, data: Dictionary = {'no-data': true} , indent: bool = false):
# This function will create an event in the timeline.
var piece = load("res://addons/dialogic/Editor/Events/" + scene + ".tscn").instance() var piece = load("res://addons/dialogic/Editor/Events/" + scene + ".tscn").instance()
piece.editor_reference = editor_reference piece.editor_reference = editor_reference
if selected_item != null: if selected_item != null:
@ -294,6 +315,9 @@ func create_event(scene: String, data: Dictionary = {'no-data': true} , indent:
if data.has('no-data') == false: if data.has('no-data') == false:
piece.load_data(data) piece.load_data(data)
if _has_template(piece):
piece.event_template.connect("option_action", self, '_on_event_options_action', [piece])
piece.connect("gui_input", self, '_on_gui_input', [piece]) piece.connect("gui_input", self, '_on_gui_input', [piece])
events_warning.visible = false events_warning.visible = false
# Indent on create # Indent on create
@ -313,8 +337,13 @@ func indent_events() -> void:
return return
# Resetting all the indents # Resetting all the indents
for event in event_list: for event in event_list:
var indent_node = event.get_node("Indent") var indent_node
indent_node.visible = false # Keep old behavior for items without template
if not _has_template(event):
indent_node = event.get_node("Indent")
indent_node.visible = false
else:
event.event_template.set_indent(0)
# Adding new indents # Adding new indents
for event in event_list: for event in event_list:
@ -322,17 +351,18 @@ func indent_events() -> void:
# in this list have an event_data property # in this list have an event_data property
if (not "event_data" in event): if (not "event_data" in event):
continue continue
if event.event_data.has('question') or event.event_data.has('condition'):
indent += 1
starter = true
question_index += 1
question_indent[question_index] = indent
if event.event_data.has('choice'): if event.event_data.has('choice'):
if question_index > 0: if question_index > 0:
indent = question_indent[question_index] + 1 indent = question_indent[question_index] + 1
starter = true starter = true
if event.event_data.has('endbranch'): elif event.event_data.has('question') or event.event_data.has('condition'):
indent += 1
starter = true
question_index += 1
question_indent[question_index] = indent
elif event.event_data.has('endbranch'):
if question_indent.has(question_index): if question_indent.has(question_index):
indent = question_indent[question_index] indent = question_indent[question_index]
indent -= 1 indent -= 1
@ -341,20 +371,24 @@ func indent_events() -> void:
indent = 0 indent = 0
if indent > 0: if indent > 0:
var indent_node = event.get_node("Indent") # Keep old behavior for items without template
indent_node.rect_min_size = Vector2(25 * indent, 0) if not _has_template(event):
indent_node.visible = true var indent_node = event.get_node("Indent")
if starter: indent_node.rect_min_size = Vector2(25 * indent, 0)
indent_node.rect_min_size = Vector2(25 * (indent - 1), 0) indent_node.visible = true
if indent - 1 == 0: if starter:
indent_node.visible = false indent_node.rect_min_size = Vector2(25 * (indent - 1), 0)
if indent - 1 == 0:
indent_node.visible = false
else:
if starter:
event.event_template.set_indent(indent - 1)
else:
event.event_template.set_indent(indent)
starter = false starter = false
func load_timeline(filename: String): func load_timeline(filename: String):
#print('---------------------------')
#print('Loading: ', filename)
clear_timeline() clear_timeline()
var start_time = OS.get_system_time_msecs() var start_time = OS.get_system_time_msecs()
timeline_file = filename timeline_file = filename
@ -370,16 +404,16 @@ func load_timeline(filename: String):
{'text', 'character', 'portrait'}: {'text', 'character', 'portrait'}:
create_event("TextBlock", i) create_event("TextBlock", i)
{'background'}: {'background'}:
create_event("SceneEvent", i) create_event("ChangeBackground", i)
{'character', 'action', 'position', 'portrait'}: {'character', 'action', 'position', 'portrait',..}:
create_event("CharacterJoinBlock", i) create_event("CharacterJoinBlock", i)
{'audio', 'file'}: {'audio', 'file', ..}:
create_event("AudioBlock", i) create_event("AudioBlock", i)
{'background-music', 'file'}: {'background-music', 'file', ..}:
create_event("BackgroundMusic", i) create_event("BackgroundMusic", i)
{'question', 'options', ..}: {'question', 'options', ..}:
create_event("Question", i) create_event("Question", i)
{'choice'}: {'choice', ..}:
create_event("Choice", i) create_event("Choice", i)
{'endbranch'}: {'endbranch'}:
create_event("EndBranch", i) create_event("EndBranch", i)
@ -391,7 +425,7 @@ func load_timeline(filename: String):
create_event("EmitSignal", i) create_event("EmitSignal", i)
{'change_scene'}: {'change_scene'}:
create_event("ChangeScene", i) create_event("ChangeScene", i)
{'close_dialog'}: {'close_dialog', ..}:
create_event("CloseDialog", i) create_event("CloseDialog", i)
{'wait_seconds'}: {'wait_seconds'}:
create_event("WaitSeconds", i) create_event("WaitSeconds", i)
@ -439,7 +473,10 @@ func get_block_below(block):
func get_block_height(block): func get_block_height(block):
if block != null: if block != null:
return block.get_node("PanelContainer").rect_size.y if not _has_template(block):
return block.get_node("PanelContainer").rect_size.y
else:
return block.rect_size.y
else: else:
return null return null
@ -506,9 +543,13 @@ func fold_all_nodes():
for event in timeline.get_children(): for event in timeline.get_children():
if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"): if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"):
event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(false) event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(false)
elif _has_template(event):
event.event_template.set_expanded(false)
func unfold_all_nodes(): func unfold_all_nodes():
for event in timeline.get_children(): for event in timeline.get_children():
if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"): if event.has_node("PanelContainer/VBoxContainer/Header/VisibleToggle"):
event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(true) event.get_node("PanelContainer/VBoxContainer/Header/VisibleToggle").set_pressed(true)
elif _has_template(event):
event.event_template.set_expanded(true)

View file

@ -3,7 +3,7 @@
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=1] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-join.svg" type="Texture" id=1]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=2] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/text-event.svg" type="Texture" id=2]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/audio-event.svg" type="Texture" id=3]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/scene event.svg" type="Texture" id=4] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/change-background.svg" type="Texture" id=4]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/condition.svg" type="Texture" id=5] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/condition.svg" type="Texture" id=5]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=6] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/close-dialog.svg" type="Texture" id=6]
[ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-leave.svg" type="Texture" id=7] [ext_resource path="res://addons/dialogic/Images/Event Icons/Main Icons/character-leave.svg" type="Texture" id=7]
@ -24,6 +24,7 @@
[ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineArea.gd" type="Script" id=22] [ext_resource path="res://addons/dialogic/Editor/TimelineEditor/TimelineArea.gd" type="Script" id=22]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 5.0 content_margin_left = 5.0
content_margin_right = 5.0 content_margin_right = 5.0
@ -266,15 +267,15 @@ align = 0
script = ExtResource( 21 ) script = ExtResource( 21 )
EventName = "ChangeTimeline" EventName = "ChangeTimeline"
[node name="SceneEvent" type="Button" parent="ScrollContainer/EventContainer"] [node name="ChangeBackground" type="Button" parent="ScrollContainer/EventContainer"]
margin_top = 408.0 margin_top = 408.0
margin_right = 180.0 margin_right = 180.0
margin_bottom = 436.0 margin_bottom = 436.0
text = " Scene Event" text = " Change Background"
icon = ExtResource( 4 ) icon = ExtResource( 4 )
align = 0 align = 0
script = ExtResource( 21 ) script = ExtResource( 21 )
EventName = "SceneEvent" EventName = "ChangeBackground"
[node name="CloseDialog" type="Button" parent="ScrollContainer/EventContainer"] [node name="CloseDialog" type="Button" parent="ScrollContainer/EventContainer"]
margin_top = 440.0 margin_top = 440.0

View file

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

Before

Width:  |  Height:  |  Size: 283 B

View file

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

Before

Width:  |  Height:  |  Size: 183 B

View file

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 843 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/change-background.svg-b779e98a98d293a18e8d288547972610.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/dialogic/Images/Event Icons/Main Icons/change-background.svg"
dest_files=[ "res://.import/change-background.svg-b779e98a98d293a18e8d288547972610.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View file

@ -1,29 +1,43 @@
extends Control extends Control
class_name DialogicBackgroundMusic class_name DialogicBackgroundMusic
onready var _anim_player := $AnimationPlayer
onready var _track1 := $Track1 onready var _track1 := $Track1
onready var _track2 := $Track2 onready var _track2 := $Track2
var current_path = "" var current_path = ""
func crossfade_to(path: String) -> void: func crossfade_to(path: String, audio_bus:String, volume:float, fade_length: float) -> void:
if current_path != path: if _track1.playing and _track2.playing:
current_path = path return
var stream: AudioStream = load(current_path)
if _track1.playing and _track2.playing: var stream: AudioStream = load(path)
return var fade_out_track = _track1
var fade_in_track = _track2
if _track2.playing:
_track1.stream = stream if _track2.playing:
_track1.play() fade_out_track = _track2
_anim_player.play("FadeToTrack1") fade_in_track = _track1
else:
_track2.stream = stream # setup the new track
_track2.play() fade_in_track.stream = stream
_anim_player.play("FadeToTrack2") fade_in_track.bus = audio_bus
fade_in_track.volume_db = -60
$Tween.interpolate_property(fade_out_track, "volume_db", null, -60, fade_length, Tween.TRANS_LINEAR)
$Tween.interpolate_property(fade_in_track, "volume_db", -60, volume, fade_length, Tween.TRANS_LINEAR)
$Tween.start()
# in case the audio is already playing we will attempt a fade into the new one from the current position
if current_path == path:
fade_in_track.play(fade_out_track.get_playback_position())
# else just play it from the beginning
else:
fade_in_track.play()
current_path = path
func fade_out(fade_length:float = 1) -> void:
func fade_out() -> void:
current_path = "" current_path = ""
_anim_player.play("FadeOut") $Tween.interpolate_property(_track1, "volume_db", null, -60, fade_length, Tween.TRANS_LINEAR)
$Tween.interpolate_property(_track2, "volume_db", null, -60, fade_length, Tween.TRANS_LINEAR)
$Tween.start()

View file

@ -1,137 +1,7 @@
[gd_scene load_steps=5 format=2] [gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/dialogic/Nodes/BackgroundMusic.gd" type="Script" id=1] [ext_resource path="res://addons/dialogic/Nodes/BackgroundMusic.gd" type="Script" id=1]
[sub_resource type="Animation" id=1]
resource_name = "FadeOut"
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Track1:volume_db")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 5.66, 1 ),
"update": 0,
"values": [ 0.0, -80.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Track2:volume_db")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 5.66, 1 ),
"update": 0,
"values": [ 0.0, -80.0 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Track2:playing")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/3/type = "value"
tracks/3/path = NodePath("Track1:playing")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=2]
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Track1:volume_db")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 5.66, 1 ),
"update": 0,
"values": [ -80.0, 0.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Track2:volume_db")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 5.66, 1 ),
"update": 0,
"values": [ 0.0, -80.0 ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Track2:playing")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
[sub_resource type="Animation" id=3]
length = 0.5
tracks/0/type = "value"
tracks/0/path = NodePath("Track1:volume_db")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 5.66, 1 ),
"update": 0,
"values": [ 0.0, -80.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Track1:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0.5 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ false ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Track2:volume_db")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 5.66, 1 ),
"update": 0,
"values": [ -80.0, 0.0 ]
}
[node name="BackgroundMusic" type="Control"] [node name="BackgroundMusic" type="Control"]
margin_right = 40.0 margin_right = 40.0
margin_bottom = 40.0 margin_bottom = 40.0
@ -141,11 +11,9 @@ __meta__ = {
} }
[node name="Track1" type="AudioStreamPlayer" parent="."] [node name="Track1" type="AudioStreamPlayer" parent="."]
volume_db = -80.0
[node name="Track2" type="AudioStreamPlayer" parent="."] [node name="Track2" type="AudioStreamPlayer" parent="."]
volume_db = -80.0 volume_db = -80.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="Tween" type="Tween" parent="."]
anims/FadeOut = SubResource( 1 )
anims/FadeToTrack1 = SubResource( 2 )
anims/FadeToTrack2 = SubResource( 3 )

View file

@ -4,7 +4,8 @@ var character_data = {
'name': 'Default', 'name': 'Default',
'image': "res://addons/dialogic/Example Assets/portraits/df-3.png", 'image': "res://addons/dialogic/Example Assets/portraits/df-3.png",
'color': Color(0.973511, 1, 0.152344), 'color': Color(0.973511, 1, 0.152344),
'file': '' 'file': '',
'mirror_portraits': false
} }
var positions = { var positions = {
'left': Vector2(-400, 0), 'left': Vector2(-400, 0),
@ -12,10 +13,11 @@ var positions = {
'center': Vector2(0, 0), 'center': Vector2(0, 0),
'center_right': Vector2(200, 0), 'center_right': Vector2(200, 0),
'center_left': Vector2(-200, 0)} 'center_left': Vector2(-200, 0)}
var direction = 'left' var direction = 'left'
var debug = false var debug = false
func init(expression: String = '', position_offset = 'left') -> void: func init(expression: String = '', position_offset = 'left', mirror = false) -> void:
rect_position += positions[position_offset] rect_position += positions[position_offset]
direction = position_offset direction = position_offset
modulate = Color(1,1,1,0) modulate = Color(1,1,1,0)
@ -41,7 +43,14 @@ func init(expression: String = '', position_offset = 'left') -> void:
$TextureRect.texture.get_width() * 0.5, $TextureRect.texture.get_width() * 0.5,
$TextureRect.texture.get_height() $TextureRect.texture.get_height()
) * custom_scale ) * custom_scale
# the mirror setting of the character
if character_data["data"].has('mirror_portraits'):
if character_data["data"]['mirror_portraits']:
$TextureRect.flip_h = true
# the mirror setting of the join event
if mirror:
$TextureRect.flip_h = !$TextureRect.flip_h
func _ready(): func _ready():
if debug: if debug:
@ -59,7 +68,7 @@ func set_portrait(expression: String) -> void:
$TextureRect.texture = load(p['path']) $TextureRect.texture = load(p['path'])
else: else:
$TextureRect.texture = Texture.new() $TextureRect.texture = Texture.new()
# Tween stuff # Tween stuff
func fade_in(node = self, time = 0.5): func fade_in(node = self, time = 0.5):

View file

@ -6,6 +6,7 @@ var text_speed := 0.02 # Higher = lower speed
onready var text_label = $RichTextLabel onready var text_label = $RichTextLabel
onready var name_label = $NameLabel onready var name_label = $NameLabel
onready var tween = $Tween onready var tween = $Tween
onready var next_indicator = $NextIndicatorContainer/NextIndicator
var _finished := false var _finished := false
@ -101,7 +102,20 @@ func load_theme(theme: ConfigFile):
$TextureRect.visible = theme.get_value('background', 'use_image', true) $TextureRect.visible = theme.get_value('background', 'use_image', true)
# Next image # Next image
$NextIndicator.texture = DialogicUtil.path_fixer_load(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png')) $NextIndicatorContainer.rect_position = Vector2(0,0)
next_indicator.texture = DialogicUtil.path_fixer_load(theme.get_value('next_indicator', 'image', 'res://addons/dialogic/Example Assets/next-indicator/next-indicator.png'))
# Reset for up and down animation
next_indicator.margin_top = 0
next_indicator.margin_bottom = 0
next_indicator.margin_left = 0
next_indicator.margin_right = 0
# Scale
var indicator_scale = theme.get_value('next_indicator', 'scale', 0.4)
next_indicator.rect_scale = Vector2(indicator_scale, indicator_scale)
# Offset
var offset = theme.get_value('next_indicator', 'offset', Vector2(13, 10))
next_indicator.rect_position = theme.get_value('box', 'size', Vector2(910, 167)) - (next_indicator.texture.get_size() * indicator_scale)
next_indicator.rect_position -= offset
# Character Name # Character Name
$NameLabel/ColorRect.visible = theme.get_value('name', 'background_visible', false) $NameLabel/ColorRect.visible = theme.get_value('name', 'background_visible', false)
@ -120,10 +134,10 @@ func load_theme(theme: ConfigFile):
$NameLabel/TextureRect.modulate = Color('#ffffffff') $NameLabel/TextureRect.modulate = Color('#ffffffff')
# Setting next indicator animation # Setting next indicator animation
$NextIndicator.self_modulate = Color('#ffffff') next_indicator.self_modulate = Color('#ffffff')
$NextIndicator/AnimationPlayer.play( var animation = theme.get_value('next_indicator', 'animation', 'Up and down')
theme.get_value('next_indicator', 'animation', 'Up and down') next_indicator.get_node('AnimationPlayer').play(animation)
)
## ***************************************************************************** ## *****************************************************************************
## PRIVATE METHODS ## PRIVATE METHODS

View file

@ -31,7 +31,7 @@ resource_name = "Static"
[sub_resource type="Animation" id=4] [sub_resource type="Animation" id=4]
loop = true loop = true
tracks/0/type = "value" tracks/0/type = "value"
tracks/0/path = NodePath(".:margin_bottom") tracks/0/path = NodePath("..:rect_position")
tracks/0/interp = 2 tracks/0/interp = 2
tracks/0/loop_wrap = true tracks/0/loop_wrap = true
tracks/0/imported = false tracks/0/imported = false
@ -40,7 +40,7 @@ tracks/0/keys = {
"times": PoolRealArray( 0, 0.5 ), "times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 1 ),
"update": 0, "update": 0,
"values": [ 12.0, 55.0 ] "values": [ Vector2( 0, 0 ), Vector2( 0, -10 ) ]
} }
[sub_resource type="StyleBoxFlat" id=5] [sub_resource type="StyleBoxFlat" id=5]
@ -92,7 +92,7 @@ margin_bottom = -10.0
rect_clip_content = false rect_clip_content = false
custom_styles/normal = SubResource( 1 ) custom_styles/normal = SubResource( 1 )
custom_fonts/normal_font = ExtResource( 1 ) custom_fonts/normal_font = ExtResource( 1 )
custom_colors/default_color = Color( 0.423529, 0.580392, 0.74902, 1 ) custom_colors/default_color = Color( 1, 1, 1, 1 )
custom_colors/font_color_shadow = Color( 1, 1, 1, 0 ) custom_colors/font_color_shadow = Color( 1, 1, 1, 0 )
custom_constants/shadow_offset_x = 2 custom_constants/shadow_offset_x = 2
custom_constants/shadow_offset_y = 2 custom_constants/shadow_offset_y = 2
@ -104,30 +104,31 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="NextIndicator" type="TextureRect" parent="."] [node name="NextIndicatorContainer" type="Control" parent="."]
visible = false margin_right = 40.0
anchor_left = 1.0 margin_bottom = 40.0
anchor_top = 1.0 __meta__ = {
anchor_right = 1.0 "_edit_use_anchors_": false
anchor_bottom = 1.0 }
margin_left = -36.4279
margin_top = -35.9016 [node name="NextIndicator" type="TextureRect" parent="NextIndicatorContainer"]
margin_right = 14.5721 margin_top = -10.0
margin_bottom = 44.8652 margin_right = 51.0
rect_scale = Vector2( 0.4, 0.4 ) margin_bottom = 41.0
texture = ExtResource( 3 ) texture = ExtResource( 3 )
stretch_mode = 4 stretch_mode = 4
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="AnimationPlayer" type="AnimationPlayer" parent="NextIndicator"] [node name="AnimationPlayer" type="AnimationPlayer" parent="NextIndicatorContainer/NextIndicator"]
autoplay = "Up and down" autoplay = "Up and down"
anims/Pulse = SubResource( 2 ) anims/Pulse = SubResource( 2 )
anims/Static = SubResource( 3 ) anims/Static = SubResource( 3 )
"anims/Up and down" = SubResource( 4 ) "anims/Up and down" = SubResource( 4 )
[node name="NameLabel" type="Label" parent="."] [node name="NameLabel" type="Label" parent="."]
visible = false
margin_top = -48.0 margin_top = -48.0
margin_right = 58.0 margin_right = 58.0
margin_bottom = -8.0 margin_bottom = -8.0

View file

@ -56,6 +56,8 @@ func _ready():
# Setting everything up for the node to be default # Setting everything up for the node to be default
$DefinitionInfo.visible = false $DefinitionInfo.visible = false
$TextBubble.connect("text_completed", self, "_on_text_completed") $TextBubble.connect("text_completed", self, "_on_text_completed")
$TextBubble/RichTextLabel.connect('meta_hover_started', self, '_on_RichTextLabel_meta_hover_started')
$TextBubble/RichTextLabel.connect('meta_hover_ended', self, '_on_RichTextLabel_meta_hover_ended')
# Getting the character information # Getting the character information
characters = DialogicUtil.get_character_list() characters = DialogicUtil.get_character_list()
@ -83,15 +85,16 @@ func load_config_files():
func resize_main(): func resize_main():
# This function makes sure that the dialog is displayed at the correct # This function makes sure that the dialog is displayed at the correct
# size and position in the screen. # size and position in the screen.
if Engine.is_editor_hint() == false: var reference = rect_size
if not Engine.is_editor_hint():
set_global_position(Vector2(0,0)) set_global_position(Vector2(0,0))
if ProjectSettings.get_setting("display/window/stretch/mode") != '2d': reference = get_viewport().get_visible_rect().size
set_deferred('rect_size', get_viewport().size)
dprint("Viewport", get_viewport().size) $TextBubble.rect_position.x = (reference.x / 2) - ($TextBubble.rect_size.x / 2)
$TextBubble.rect_position.x = (rect_size.x / 2) - ($TextBubble.rect_size.x / 2)
if current_theme != null: if current_theme != null:
$TextBubble.rect_position.y = (rect_size.y) - ($TextBubble.rect_size.y) - current_theme.get_value('box', 'bottom_gap', 40) $TextBubble.rect_position.y = (reference.y) - ($TextBubble.rect_size.y) - current_theme.get_value('box', 'bottom_gap', 40)
func set_current_dialog(dialog_path: String): func set_current_dialog(dialog_path: String):
@ -190,32 +193,48 @@ func parse_branches(dialog_script: Dictionary) -> Dictionary:
var event_id: int = 0 # The current id for jumping later on var event_id: int = 0 # The current id for jumping later on
var question_id: int = 0 # identifying the questions to assign options to it var question_id: int = 0 # identifying the questions to assign options to it
for event in dialog_script['events']: for event in dialog_script['events']:
if event.has('question'):
event['event_id'] = event_id
event['question_id'] = question_id
event['answered'] = false
question_id += 1
questions.append(event)
parser_queue.append(event)
if event.has('condition'):
event['event_id'] = event_id
event['question_id'] = question_id
event['answered'] = false
question_id += 1
questions.append(event)
parser_queue.append(event)
if event.has('choice'): if event.has('choice'):
var opened_branch = parser_queue.back() var opened_branch = parser_queue.back()
dialog_script['events'][opened_branch['event_id']]['options'].append({ var option = {
'question_id': opened_branch['question_id'], 'question_id': opened_branch['question_id'],
'label': event['choice'], 'label': event['choice'],
'event_id': event_id, 'event_id': event_id,
}) }
if event.has('condition') and event.has('definition') and event.has('value'):
option = {
'question_id': opened_branch['question_id'],
'label': event['choice'],
'event_id': event_id,
'condition': event['condition'],
'definition': event['definition'],
'value': event['value'],
}
else:
option = {
'question_id': opened_branch['question_id'],
'label': event['choice'],
'event_id': event_id,
'condition': '',
'definition': '',
'value': '',
}
dialog_script['events'][opened_branch['event_id']]['options'].append(option)
event['question_id'] = opened_branch['question_id'] event['question_id'] = opened_branch['question_id']
elif event.has('question'):
if event.has('endbranch'): event['event_id'] = event_id
event['question_id'] = question_id
event['answered'] = false
question_id += 1
questions.append(event)
parser_queue.append(event)
elif event.has('condition'):
event['event_id'] = event_id
event['question_id'] = question_id
event['answered'] = false
question_id += 1
questions.append(event)
parser_queue.append(event)
elif event.has('endbranch'):
event['event_id'] = event_id event['event_id'] = event_id
var opened_branch = parser_queue.pop_back() var opened_branch = parser_queue.pop_back()
event['end_branch_of'] = opened_branch['question_id'] event['end_branch_of'] = opened_branch['question_id']
@ -256,7 +275,7 @@ func _insert_glossary_definitions(text: String):
func _process(delta): func _process(delta):
$TextBubble/NextIndicator.visible = finished $TextBubble/NextIndicatorContainer/NextIndicator.visible = finished
if waiting_for_answer and Input.is_action_just_released(input_next): if waiting_for_answer and Input.is_action_just_released(input_next):
if $Options.get_child_count() > 0: if $Options.get_child_count() > 0:
$Options.get_child(0).grab_focus() $Options.get_child(0).grab_focus()
@ -317,6 +336,7 @@ func on_timeline_end():
DialogicSingleton.save_definitions() DialogicSingleton.save_definitions()
DialogicSingleton.set_current_timeline('') DialogicSingleton.set_current_timeline('')
emit_signal("event_end", "timeline") emit_signal("event_end", "timeline")
dprint('[D] Timeline End')
func _init_dialog(): func _init_dialog():
@ -435,7 +455,7 @@ func event_handler(event: Dictionary):
if char_portrait == '': if char_portrait == '':
char_portrait = 'Default' char_portrait = 'Default'
p.character_data = character_data p.character_data = character_data
p.init(char_portrait, get_character_position(event['position'])) p.init(char_portrait, get_character_position(event['position']), event.get('mirror', false))
$Portraits.add_child(p) $Portraits.add_child(p)
p.fade_in() p.fade_in()
_load_next_event() _load_next_event()
@ -455,6 +475,7 @@ func event_handler(event: Dictionary):
background.anchor_bottom = 1 background.anchor_bottom = 1
background.stretch_mode = TextureRect.STRETCH_SCALE background.stretch_mode = TextureRect.STRETCH_SCALE
background.show_behind_parent = true background.show_behind_parent = true
background.mouse_filter = Control.MOUSE_FILTER_IGNORE
add_child(background) add_child(background)
background.texture = null background.texture = null
if (background.get_child_count() > 0): if (background.get_child_count() > 0):
@ -469,7 +490,7 @@ func event_handler(event: Dictionary):
elif (event['background'] != ''): elif (event['background'] != ''):
background.texture = load(event['background']) background.texture = load(event['background'])
_load_next_event() _load_next_event()
{'audio'}, {'audio', 'file'}: {'audio'}, {'audio', 'file', ..}:
emit_signal("event_start", "audio", event) emit_signal("event_start", "audio", event)
if event['audio'] == 'play' and 'file' in event.keys() and not event['file'].empty(): if event['audio'] == 'play' and 'file' in event.keys() and not event['file'].empty():
var audio = get_node_or_null('AudioEvent') var audio = get_node_or_null('AudioEvent')
@ -477,21 +498,25 @@ func event_handler(event: Dictionary):
audio = AudioStreamPlayer.new() audio = AudioStreamPlayer.new()
audio.name = 'AudioEvent' audio.name = 'AudioEvent'
add_child(audio) add_child(audio)
if event.has('audio_bus'):
if AudioServer.get_bus_index(event['audio_bus']) >= 0:
audio.bus = event['audio_bus']
if event.has('volume'):
audio.volume_db = event['volume']
audio.stream = load(event['file']) audio.stream = load(event['file'])
audio.play() audio.play()
print('play')
else: else:
var audio = get_node_or_null('AudioEvent') var audio = get_node_or_null('AudioEvent')
if audio != null: if audio != null:
audio.stop() audio.stop()
audio.queue_free() audio.queue_free()
_load_next_event() _load_next_event()
{'background-music'}, {'background-music', 'file'}: {'background-music'}, {'background-music', 'file',..}:
emit_signal("event_start", "background-music", event) emit_signal("event_start", "background-music", event)
if event['background-music'] == 'play' and 'file' in event.keys() and not event['file'].empty(): if event['background-music'] == 'play' and 'file' in event.keys() and not event['file'].empty():
$FX/BackgroundMusic.crossfade_to(event['file']) $FX/BackgroundMusic.crossfade_to(event['file'], event.get('audio_bus', 'Master'), event.get('volume', 0), event.get('fade_length', 1))
else: else:
$FX/BackgroundMusic.fade_out() $FX/BackgroundMusic.fade_out(event.get('fade_length', 1))
_load_next_event() _load_next_event()
{'endbranch', ..}: {'endbranch', ..}:
emit_signal("event_start", "endbranch", event) emit_signal("event_start", "endbranch", event)
@ -502,9 +527,12 @@ func event_handler(event: Dictionary):
dprint('[!] Emitting signal: dialogic_signal(', event['emit_signal'], ')') dprint('[!] Emitting signal: dialogic_signal(', event['emit_signal'], ')')
emit_signal("dialogic_signal", event['emit_signal']) emit_signal("dialogic_signal", event['emit_signal'])
_load_next_event() _load_next_event()
{'close_dialog'}: {'close_dialog', ..}:
emit_signal("event_start", "close_dialog", event) emit_signal("event_start", "close_dialog", event)
close_dialog_event() var transition_duration = 1.0
if event.has('transition_duration'):
transition_duration = event['transition_duration']
close_dialog_event(transition_duration)
{'set_theme'}: {'set_theme'}:
emit_signal("event_start", "set_theme", event) emit_signal("event_start", "set_theme", event)
if event['set_theme'] != '': if event['set_theme'] != '':
@ -569,7 +597,7 @@ func event_handler(event: Dictionary):
_load_next_event() _load_next_event()
_: _:
visible = false visible = false
dprint('Other event. ', event) dprint('[D] Other event. ', event)
$Options.visible = waiting_for_answer $Options.visible = waiting_for_answer
@ -580,7 +608,21 @@ func reset_options():
option.queue_free() option.queue_free()
func add_choice_button(option): func _should_add_choice_button(option: Dictionary):
if not option['condition'].empty() and not option['definition'].empty() and not option['value'].empty():
var def_value = null
for d in definitions['variables']:
if d['id'] == option['definition']:
def_value = d['value']
return def_value != null and _compare_definitions(def_value, option['value'], option['condition']);
else:
return true
func add_choice_button(option: Dictionary):
if not _should_add_choice_button(option):
return
var theme = current_theme var theme = current_theme
var button = ChoiceButton.instance() var button = ChoiceButton.instance()
@ -593,6 +635,11 @@ func add_choice_button(option):
button.set('custom_colors/font_color', text_color) button.set('custom_colors/font_color', text_color)
button.set('custom_colors/font_color_hover', text_color) button.set('custom_colors/font_color_hover', text_color)
button.set('custom_colors/font_color_pressed', text_color) button.set('custom_colors/font_color_pressed', text_color)
if theme.get_value('buttons', 'fixed', false):
var size = theme.get_value('buttons', 'fixed_size', Vector2(130,40))
button.rect_min_size = size
button.rect_size = size
if theme.get_value('buttons', 'text_color_enabled', true): if theme.get_value('buttons', 'text_color_enabled', true):
var button_text_color = Color(theme.get_value('buttons', 'text_color', "#ffffffff")) var button_text_color = Color(theme.get_value('buttons', 'text_color', "#ffffffff"))
@ -729,7 +776,7 @@ func _on_RichTextLabel_meta_hover_started(meta):
'color': current_theme.get_value('definitions', 'color', '#ffbebebe'), 'color': current_theme.get_value('definitions', 'color', '#ffbebebe'),
}) })
correct_type = true correct_type = true
dprint(d) dprint('[D] Hovered over glossary entry: ', d)
if correct_type: if correct_type:
definition_visible = true definition_visible = true
@ -740,7 +787,6 @@ func _on_RichTextLabel_meta_hover_started(meta):
func _on_RichTextLabel_meta_hover_ended(meta): func _on_RichTextLabel_meta_hover_ended(meta):
# Adding a timer to avoid a graphical glitch # Adding a timer to avoid a graphical glitch
$DefinitionInfo/Timer.start(0.1) $DefinitionInfo/Timer.start(0.1)
@ -752,18 +798,17 @@ func _on_Definition_Timer_timeout():
func wait_seconds(seconds): func wait_seconds(seconds):
var timer = Timer.new() var timer = Timer.new()
timer.name = 'WaitSeconds'
add_child(timer) add_child(timer)
timer.connect("timeout", self, '_on_WaitSeconds_timeout') timer.connect("timeout", self, '_on_WaitSeconds_timeout', [timer])
timer.start(seconds) timer.start(seconds)
$TextBubble.visible = false $TextBubble.visible = false
func _on_WaitSeconds_timeout(): func _on_WaitSeconds_timeout(timer):
emit_signal("event_end", "wait") emit_signal("event_end", "wait")
waiting = false waiting = false
$WaitSeconds.stop() timer.stop()
$WaitSeconds.queue_free() timer.queue_free()
$TextBubble.visible = true $TextBubble.visible = true
_load_next_event() _load_next_event()
@ -811,18 +856,21 @@ func characters_leave_all():
p.fade_out() p.fade_out()
func close_dialog_event(): func close_dialog_event(transition_duration):
var tween = Tween.new()
add_child(tween)
tween.interpolate_property($TextBubble, "modulate",
$TextBubble.modulate, Color('#00ffffff'), 1,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
var close_dialog_timer = Timer.new()
close_dialog_timer.connect("timeout", self, '_on_close_dialog_timeout')
add_child(close_dialog_timer)
close_dialog_timer.start(2)
characters_leave_all() characters_leave_all()
if transition_duration == 0:
_on_close_dialog_timeout()
else:
var tween = Tween.new()
add_child(tween)
tween.interpolate_property($TextBubble, "modulate",
$TextBubble.modulate, Color('#00ffffff'), transition_duration,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
tween.start()
var close_dialog_timer = Timer.new()
close_dialog_timer.connect("timeout", self, '_on_close_dialog_timeout')
add_child(close_dialog_timer)
close_dialog_timer.start(transition_duration)
func _on_close_dialog_timeout(): func _on_close_dialog_timeout():

View file

@ -0,0 +1,77 @@
using Godot;
using GC = Godot.Collections;
using System;
public static class DialogicSharp
{
private static Script _dialogic = GD.Load<Script>("res://addons/dialogic/Other/DialogicClass.gd");
private const String DEFAULT_DIALOG_RESOURCE = "res://addons/dialogic/Dialog.tscn";
public static String CurrentTimeline
{
get
{
return (String)_dialogic.Call("get_current_timeline");
}
set
{
_dialogic.Call("set_current_timeline", value);
}
}
public static GC.Dictionary Definitions
{
get
{
return (GC.Dictionary)_dialogic.Call("get_definitions");
}
}
public static GC.Dictionary DefaultDefinitions
{
get
{
return (GC.Dictionary)_dialogic.Call("get_default_definitions");
}
}
public static Node Start(String timeline, bool resetSaves = true, bool debugMode = false)
{
return Start<Node>(timeline, DEFAULT_DIALOG_RESOURCE, resetSaves, debugMode);
}
public static T Start<T>(String timeline, String dialogScenePath, bool resetSaves = true, bool debugMode = false) where T : class
{
return (T)_dialogic.Call("start", timeline, resetSaves, dialogScenePath, debugMode);
}
public static Node StartFromSave(String timeline, bool debugMode = false)
{
return StartFromSave<Node>(timeline, DEFAULT_DIALOG_RESOURCE, debugMode);
}
public static T StartFromSave<T>(String timeline, String dialogScenePath, bool debugMode = false) where T : class
{
return (T)_dialogic.Call("start", timeline, dialogScenePath, debugMode);
}
public static String GetVariable(String name)
{
return (String)_dialogic.Call("get_variable", name);
}
public static void SetVariable(String name, String value)
{
_dialogic.Call("set_variable", name, value);
}
public static GC.Dictionary GetGlossary(String name)
{
return (GC.Dictionary)_dialogic.Call("get_glossary", name);
}
public static void SetGlossary(String name, String title, String text, String extra)
{
_dialogic.Call("set_glossary", name, title, text, extra);
}
}