Add more NPCs, update dialogue manager to 4.4 compatible version
This commit is contained in:
@@ -2,13 +2,9 @@
|
||||
extends Control
|
||||
|
||||
|
||||
const DialogueConstants = preload("../constants.gd")
|
||||
const DialogueSettings = preload("../settings.gd")
|
||||
const DialogueResource = preload("../dialogue_resource.gd")
|
||||
const DialogueManagerParser = preload("../components/parser.gd")
|
||||
|
||||
const OPEN_OPEN = 100
|
||||
const OPEN_CLEAR = 101
|
||||
const OPEN_QUICK = 101
|
||||
const OPEN_CLEAR = 102
|
||||
|
||||
const TRANSLATIONS_GENERATE_LINE_IDS = 100
|
||||
const TRANSLATIONS_SAVE_CHARACTERS_TO_CSV = 201
|
||||
@@ -32,17 +28,17 @@ enum TranslationSource {
|
||||
signal confirmation_closed()
|
||||
|
||||
|
||||
@onready var parse_timer := $ParseTimer
|
||||
@onready var parse_timer: Timer = $ParseTimer
|
||||
|
||||
# Dialogs
|
||||
@onready var new_dialog: FileDialog = $NewDialog
|
||||
@onready var save_dialog: FileDialog = $SaveDialog
|
||||
@onready var open_dialog: FileDialog = $OpenDialog
|
||||
@onready var quick_open_dialog: ConfirmationDialog = $QuickOpenDialog
|
||||
@onready var quick_open_files_list: VBoxContainer = $QuickOpenDialog/QuickOpenFilesList
|
||||
@onready var export_dialog: FileDialog = $ExportDialog
|
||||
@onready var import_dialog: FileDialog = $ImportDialog
|
||||
@onready var errors_dialog: AcceptDialog = $ErrorsDialog
|
||||
@onready var settings_dialog: AcceptDialog = $SettingsDialog
|
||||
@onready var settings_view := $SettingsDialog/SettingsView
|
||||
@onready var build_error_dialog: AcceptDialog = $BuildErrorDialog
|
||||
@onready var close_confirmation_dialog: ConfirmationDialog = $CloseConfirmationDialog
|
||||
@onready var updated_dialog: AcceptDialog = $UpdatedDialog
|
||||
@@ -55,10 +51,10 @@ signal confirmation_closed()
|
||||
@onready var save_all_button: Button = %SaveAllButton
|
||||
@onready var find_in_files_button: Button = %FindInFilesButton
|
||||
@onready var test_button: Button = %TestButton
|
||||
@onready var test_line_button: Button = %TestLineButton
|
||||
@onready var search_button: Button = %SearchButton
|
||||
@onready var insert_button: MenuButton = %InsertButton
|
||||
@onready var translations_button: MenuButton = %TranslationsButton
|
||||
@onready var settings_button: Button = %SettingsButton
|
||||
@onready var support_button: Button = %SupportButton
|
||||
@onready var docs_button: Button = %DocsButton
|
||||
@onready var version_label: Label = %VersionLabel
|
||||
@@ -71,7 +67,7 @@ signal confirmation_closed()
|
||||
@onready var files_list := %FilesList
|
||||
@onready var files_popup_menu: PopupMenu = %FilesPopupMenu
|
||||
@onready var title_list := %TitleList
|
||||
@onready var code_edit := %CodeEdit
|
||||
@onready var code_edit: DMCodeEdit = %CodeEdit
|
||||
@onready var errors_panel := %ErrorsPanel
|
||||
|
||||
# The currently open file
|
||||
@@ -79,9 +75,10 @@ var current_file_path: String = "":
|
||||
set(next_current_file_path):
|
||||
current_file_path = next_current_file_path
|
||||
files_list.current_file_path = current_file_path
|
||||
if current_file_path == "":
|
||||
if current_file_path == "" or not open_buffers.has(current_file_path):
|
||||
save_all_button.disabled = true
|
||||
test_button.disabled = true
|
||||
test_line_button.disabled = true
|
||||
search_button.disabled = true
|
||||
insert_button.disabled = true
|
||||
translations_button.disabled = true
|
||||
@@ -92,6 +89,7 @@ var current_file_path: String = "":
|
||||
errors_panel.hide()
|
||||
else:
|
||||
test_button.disabled = false
|
||||
test_line_button.disabled = false
|
||||
search_button.disabled = false
|
||||
insert_button.disabled = false
|
||||
translations_button.disabled = false
|
||||
@@ -103,7 +101,7 @@ var current_file_path: String = "":
|
||||
code_edit.text = open_buffers[current_file_path].text
|
||||
code_edit.errors = []
|
||||
code_edit.clear_undo_history()
|
||||
code_edit.set_cursor(DialogueSettings.get_caret(current_file_path))
|
||||
code_edit.set_cursor(DMSettings.get_caret(current_file_path))
|
||||
code_edit.grab_focus()
|
||||
|
||||
_on_code_edit_text_changed()
|
||||
@@ -134,16 +132,16 @@ func _ready() -> void:
|
||||
version_label.text = "v%s" % plugin.get_version()
|
||||
update_button.on_before_refresh = func on_before_refresh():
|
||||
# Save everything
|
||||
DialogueSettings.set_user_value("just_refreshed", {
|
||||
DMSettings.set_user_value("just_refreshed", {
|
||||
current_file_path = current_file_path,
|
||||
open_buffers = open_buffers
|
||||
})
|
||||
return true
|
||||
|
||||
# Did we just load from an addon version refresh?
|
||||
var just_refreshed = DialogueSettings.get_user_value("just_refreshed", null)
|
||||
var just_refreshed = DMSettings.get_user_value("just_refreshed", null)
|
||||
if just_refreshed != null:
|
||||
DialogueSettings.set_user_value("just_refreshed", null)
|
||||
DMSettings.set_user_value("just_refreshed", null)
|
||||
call_deferred("load_from_version_refresh", just_refreshed)
|
||||
|
||||
# Hook up the search toolbar
|
||||
@@ -154,35 +152,35 @@ func _ready() -> void:
|
||||
translations_button.get_popup().id_pressed.connect(_on_translations_button_menu_id_pressed)
|
||||
|
||||
code_edit.main_view = self
|
||||
code_edit.wrap_mode = TextEdit.LINE_WRAPPING_BOUNDARY if DialogueSettings.get_setting("wrap_lines", false) else TextEdit.LINE_WRAPPING_NONE
|
||||
var editor_settings: EditorSettings = plugin.get_editor_interface().get_editor_settings()
|
||||
code_edit.wrap_mode = TextEdit.LINE_WRAPPING_BOUNDARY if DMSettings.get_setting(DMSettings.WRAP_LONG_LINES, false) else TextEdit.LINE_WRAPPING_NONE
|
||||
var editor_settings: EditorSettings = EditorInterface.get_editor_settings()
|
||||
editor_settings.settings_changed.connect(_on_editor_settings_changed)
|
||||
_on_editor_settings_changed()
|
||||
|
||||
# Reopen any files that were open when Godot was closed
|
||||
if editor_settings.get_setting("text_editor/behavior/files/restore_scripts_on_load"):
|
||||
var reopen_files: Array = DialogueSettings.get_user_value("reopen_files", [])
|
||||
var reopen_files: Array = DMSettings.get_user_value("reopen_files", [])
|
||||
for reopen_file in reopen_files:
|
||||
open_file(reopen_file)
|
||||
|
||||
self.current_file_path = DialogueSettings.get_user_value("most_recent_reopen_file", "")
|
||||
self.current_file_path = DMSettings.get_user_value("most_recent_reopen_file", "")
|
||||
|
||||
save_all_button.disabled = true
|
||||
|
||||
close_confirmation_dialog.ok_button_text = DialogueConstants.translate(&"confirm_close.save")
|
||||
close_confirmation_dialog.add_button(DialogueConstants.translate(&"confirm_close.discard"), true, "discard")
|
||||
close_confirmation_dialog.ok_button_text = DMConstants.translate(&"confirm_close.save")
|
||||
close_confirmation_dialog.add_button(DMConstants.translate(&"confirm_close.discard"), true, "discard")
|
||||
|
||||
errors_dialog.dialog_text = DialogueConstants.translate(&"errors_in_script")
|
||||
errors_dialog.dialog_text = DMConstants.translate(&"errors_in_script")
|
||||
|
||||
# Update the buffer if a file was modified externally (retains undo step)
|
||||
Engine.get_meta("DialogueCache").file_content_changed.connect(_on_cache_file_content_changed)
|
||||
Engine.get_meta("DMCache").file_content_changed.connect(_on_cache_file_content_changed)
|
||||
|
||||
plugin.get_editor_interface().get_file_system_dock().files_moved.connect(_on_files_moved)
|
||||
EditorInterface.get_file_system_dock().files_moved.connect(_on_files_moved)
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
DialogueSettings.set_user_value("reopen_files", open_buffers.keys())
|
||||
DialogueSettings.set_user_value("most_recent_reopen_file", self.current_file_path)
|
||||
DMSettings.set_user_value("reopen_files", open_buffers.keys())
|
||||
DMSettings.set_user_value("most_recent_reopen_file", self.current_file_path)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
@@ -222,13 +220,12 @@ func load_from_version_refresh(just_refreshed: Dictionary) -> void:
|
||||
else:
|
||||
open_buffers = just_refreshed.open_buffers
|
||||
|
||||
var interface: EditorInterface = plugin.get_editor_interface()
|
||||
if just_refreshed.current_file_path != "":
|
||||
interface.edit_resource(load(just_refreshed.current_file_path))
|
||||
EditorInterface.edit_resource(load(just_refreshed.current_file_path))
|
||||
else:
|
||||
interface.set_main_screen_editor("Dialogue")
|
||||
EditorInterface.set_main_screen_editor("Dialogue")
|
||||
|
||||
updated_dialog.dialog_text = DialogueConstants.translate(&"update.success").format({ version = update_button.get_version() })
|
||||
updated_dialog.dialog_text = DMConstants.translate(&"update.success").format({ version = update_button.get_version() })
|
||||
updated_dialog.popup_centered()
|
||||
|
||||
|
||||
@@ -238,26 +235,11 @@ func new_file(path: String, content: String = "") -> void:
|
||||
|
||||
var file: FileAccess = FileAccess.open(path, FileAccess.WRITE)
|
||||
if content == "":
|
||||
if DialogueSettings.get_setting("new_with_template", true):
|
||||
file.store_string("\n".join([
|
||||
"~ this_is_a_node_title",
|
||||
"",
|
||||
"Nathan: [[Hi|Hello|Howdy]], this is some dialogue.",
|
||||
"Nathan: Here are some choices.",
|
||||
"- First one",
|
||||
"\tNathan: You picked the first one.",
|
||||
"- Second one",
|
||||
"\tNathan: You picked the second one.",
|
||||
"- Start again => this_is_a_node_title",
|
||||
"- End the conversation => END",
|
||||
"Nathan: For more information see the online documentation.",
|
||||
"",
|
||||
"=> END"
|
||||
]))
|
||||
file.store_string(DMSettings.get_setting(DMSettings.NEW_FILE_TEMPLATE, ""))
|
||||
else:
|
||||
file.store_string(content)
|
||||
|
||||
plugin.get_editor_interface().get_resource_filesystem().scan()
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
|
||||
|
||||
# Open a dialogue resource for editing
|
||||
@@ -266,6 +248,8 @@ func open_resource(resource: DialogueResource) -> void:
|
||||
|
||||
|
||||
func open_file(path: String) -> void:
|
||||
if not FileAccess.file_exists(path): return
|
||||
|
||||
if not open_buffers.has(path):
|
||||
var file: FileAccess = FileAccess.open(path, FileAccess.READ)
|
||||
var text = file.get_as_text()
|
||||
@@ -276,7 +260,7 @@ func open_file(path: String) -> void:
|
||||
pristine_text = text
|
||||
}
|
||||
|
||||
DialogueSettings.add_recent_file(path)
|
||||
DMSettings.add_recent_file(path)
|
||||
build_open_menu()
|
||||
|
||||
files_list.files = open_buffers.keys()
|
||||
@@ -286,11 +270,7 @@ func open_file(path: String) -> void:
|
||||
|
||||
|
||||
func show_file_in_filesystem(path: String) -> void:
|
||||
var file_system_dock: FileSystemDock = plugin \
|
||||
.get_editor_interface() \
|
||||
.get_file_system_dock()
|
||||
|
||||
file_system_dock.navigate_to_path(path)
|
||||
EditorInterface.get_file_system_dock().navigate_to_path(path)
|
||||
|
||||
|
||||
# Save any open files
|
||||
@@ -304,7 +284,7 @@ func save_files() -> void:
|
||||
save_file(path, false)
|
||||
|
||||
if saved_files.size() > 0:
|
||||
Engine.get_meta("DialogueCache").reimport_files(saved_files)
|
||||
Engine.get_meta("DMCache").mark_files_for_reimport(saved_files)
|
||||
|
||||
|
||||
# Save a file
|
||||
@@ -326,10 +306,7 @@ func save_file(path: String, rescan_file_system: bool = true) -> void:
|
||||
file.close()
|
||||
|
||||
if rescan_file_system:
|
||||
plugin \
|
||||
.get_editor_interface() \
|
||||
.get_resource_filesystem()\
|
||||
.scan()
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
|
||||
|
||||
func close_file(path: String) -> void:
|
||||
@@ -341,7 +318,7 @@ func close_file(path: String) -> void:
|
||||
remove_file_from_open_buffers(path)
|
||||
await get_tree().process_frame
|
||||
else:
|
||||
close_confirmation_dialog.dialog_text = DialogueConstants.translate(&"confirm_close").format({ path = path.get_file() })
|
||||
close_confirmation_dialog.dialog_text = DMConstants.translate(&"confirm_close").format({ path = path.get_file() })
|
||||
close_confirmation_dialog.popup_centered()
|
||||
await confirmation_closed
|
||||
|
||||
@@ -364,8 +341,8 @@ func remove_file_from_open_buffers(path: String) -> void:
|
||||
# Apply theme colors and icons to the UI
|
||||
func apply_theme() -> void:
|
||||
if is_instance_valid(plugin) and is_instance_valid(code_edit):
|
||||
var scale: float = plugin.get_editor_interface().get_editor_scale()
|
||||
var editor_settings = plugin.get_editor_interface().get_editor_settings()
|
||||
var scale: float = EditorInterface.get_editor_scale()
|
||||
var editor_settings = EditorInterface.get_editor_settings()
|
||||
code_edit.theme_overrides = {
|
||||
scale = scale,
|
||||
|
||||
@@ -391,77 +368,77 @@ func apply_theme() -> void:
|
||||
}
|
||||
|
||||
new_button.icon = get_theme_icon("New", "EditorIcons")
|
||||
new_button.tooltip_text = DialogueConstants.translate(&"start_a_new_file")
|
||||
new_button.tooltip_text = DMConstants.translate(&"start_a_new_file")
|
||||
|
||||
open_button.icon = get_theme_icon("Load", "EditorIcons")
|
||||
open_button.tooltip_text = DialogueConstants.translate(&"open_a_file")
|
||||
open_button.tooltip_text = DMConstants.translate(&"open_a_file")
|
||||
|
||||
save_all_button.icon = get_theme_icon("Save", "EditorIcons")
|
||||
save_all_button.tooltip_text = DialogueConstants.translate(&"start_all_files")
|
||||
save_all_button.text = DMConstants.translate(&"all")
|
||||
save_all_button.tooltip_text = DMConstants.translate(&"start_all_files")
|
||||
|
||||
find_in_files_button.icon = get_theme_icon("ViewportZoom", "EditorIcons")
|
||||
find_in_files_button.tooltip_text = DialogueConstants.translate(&"find_in_files")
|
||||
find_in_files_button.tooltip_text = DMConstants.translate(&"find_in_files")
|
||||
|
||||
test_button.icon = get_theme_icon("PlayScene", "EditorIcons")
|
||||
test_button.tooltip_text = DialogueConstants.translate(&"test_dialogue")
|
||||
test_button.icon = get_theme_icon("DebugNext", "EditorIcons")
|
||||
test_button.tooltip_text = DMConstants.translate(&"test_dialogue")
|
||||
|
||||
test_line_button.icon = get_theme_icon("DebugStep", "EditorIcons")
|
||||
test_line_button.tooltip_text = DMConstants.translate(&"test_dialogue_from_line")
|
||||
|
||||
search_button.icon = get_theme_icon("Search", "EditorIcons")
|
||||
search_button.tooltip_text = DialogueConstants.translate(&"search_for_text")
|
||||
search_button.tooltip_text = DMConstants.translate(&"search_for_text")
|
||||
|
||||
insert_button.icon = get_theme_icon("RichTextEffect", "EditorIcons")
|
||||
insert_button.text = DialogueConstants.translate(&"insert")
|
||||
insert_button.text = DMConstants.translate(&"insert")
|
||||
|
||||
translations_button.icon = get_theme_icon("Translation", "EditorIcons")
|
||||
translations_button.text = DialogueConstants.translate(&"translations")
|
||||
|
||||
settings_button.icon = get_theme_icon("Tools", "EditorIcons")
|
||||
settings_button.tooltip_text = DialogueConstants.translate(&"settings")
|
||||
translations_button.text = DMConstants.translate(&"translations")
|
||||
|
||||
support_button.icon = get_theme_icon("Heart", "EditorIcons")
|
||||
support_button.text = DialogueConstants.translate(&"sponsor")
|
||||
support_button.tooltip_text = DialogueConstants.translate(&"show_support")
|
||||
support_button.text = DMConstants.translate(&"sponsor")
|
||||
support_button.tooltip_text = DMConstants.translate(&"show_support")
|
||||
|
||||
docs_button.icon = get_theme_icon("Help", "EditorIcons")
|
||||
docs_button.text = DialogueConstants.translate(&"docs")
|
||||
docs_button.text = DMConstants.translate(&"docs")
|
||||
|
||||
update_button.apply_theme()
|
||||
|
||||
# Set up the effect menu
|
||||
var popup: PopupMenu = insert_button.get_popup()
|
||||
popup.clear()
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.wave_bbcode"), 0)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.shake_bbcode"), 1)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.wave_bbcode"), 0)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.shake_bbcode"), 1)
|
||||
popup.add_separator()
|
||||
popup.add_icon_item(get_theme_icon("Time", "EditorIcons"), DialogueConstants.translate(&"insert.typing_pause"), 3)
|
||||
popup.add_icon_item(get_theme_icon("ViewportSpeed", "EditorIcons"), DialogueConstants.translate(&"insert.typing_speed_change"), 4)
|
||||
popup.add_icon_item(get_theme_icon("DebugNext", "EditorIcons"), DialogueConstants.translate(&"insert.auto_advance"), 5)
|
||||
popup.add_separator(DialogueConstants.translate(&"insert.templates"))
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.title"), 6)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.dialogue"), 7)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.response"), 8)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.random_lines"), 9)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.random_text"), 10)
|
||||
popup.add_separator(DialogueConstants.translate(&"insert.actions"))
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.jump"), 11)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DialogueConstants.translate(&"insert.end_dialogue"), 12)
|
||||
popup.add_icon_item(get_theme_icon("Time", "EditorIcons"), DMConstants.translate(&"insert.typing_pause"), 3)
|
||||
popup.add_icon_item(get_theme_icon("ViewportSpeed", "EditorIcons"), DMConstants.translate(&"insert.typing_speed_change"), 4)
|
||||
popup.add_icon_item(get_theme_icon("DebugNext", "EditorIcons"), DMConstants.translate(&"insert.auto_advance"), 5)
|
||||
popup.add_separator(DMConstants.translate(&"insert.templates"))
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.title"), 6)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.dialogue"), 7)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.response"), 8)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.random_lines"), 9)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.random_text"), 10)
|
||||
popup.add_separator(DMConstants.translate(&"insert.actions"))
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.jump"), 11)
|
||||
popup.add_icon_item(get_theme_icon("RichTextEffect", "EditorIcons"), DMConstants.translate(&"insert.end_dialogue"), 12)
|
||||
|
||||
# Set up the translations menu
|
||||
popup = translations_button.get_popup()
|
||||
popup.clear()
|
||||
popup.add_icon_item(get_theme_icon("Translation", "EditorIcons"), DialogueConstants.translate(&"generate_line_ids"), TRANSLATIONS_GENERATE_LINE_IDS)
|
||||
popup.add_icon_item(get_theme_icon("Translation", "EditorIcons"), DMConstants.translate(&"generate_line_ids"), TRANSLATIONS_GENERATE_LINE_IDS)
|
||||
popup.add_separator()
|
||||
popup.add_icon_item(get_theme_icon("FileList", "EditorIcons"), DialogueConstants.translate(&"save_characters_to_csv"), TRANSLATIONS_SAVE_CHARACTERS_TO_CSV)
|
||||
popup.add_icon_item(get_theme_icon("FileList", "EditorIcons"), DialogueConstants.translate(&"save_to_csv"), TRANSLATIONS_SAVE_TO_CSV)
|
||||
popup.add_icon_item(get_theme_icon("AssetLib", "EditorIcons"), DialogueConstants.translate(&"import_from_csv"), TRANSLATIONS_IMPORT_FROM_CSV)
|
||||
popup.add_icon_item(get_theme_icon("FileList", "EditorIcons"), DMConstants.translate(&"save_characters_to_csv"), TRANSLATIONS_SAVE_CHARACTERS_TO_CSV)
|
||||
popup.add_icon_item(get_theme_icon("FileList", "EditorIcons"), DMConstants.translate(&"save_to_csv"), TRANSLATIONS_SAVE_TO_CSV)
|
||||
popup.add_icon_item(get_theme_icon("AssetLib", "EditorIcons"), DMConstants.translate(&"import_from_csv"), TRANSLATIONS_IMPORT_FROM_CSV)
|
||||
|
||||
# Dialog sizes
|
||||
new_dialog.min_size = Vector2(600, 500) * scale
|
||||
save_dialog.min_size = Vector2(600, 500) * scale
|
||||
open_dialog.min_size = Vector2(600, 500) * scale
|
||||
quick_open_dialog.min_size = Vector2(400, 600) * scale
|
||||
export_dialog.min_size = Vector2(600, 500) * scale
|
||||
import_dialog.min_size = Vector2(600, 500) * scale
|
||||
settings_dialog.min_size = Vector2(1000, 600) * scale
|
||||
settings_dialog.max_size = Vector2(1000, 600) * scale
|
||||
find_in_files_dialog.min_size = Vector2(800, 600) * scale
|
||||
|
||||
|
||||
@@ -472,12 +449,13 @@ func apply_theme() -> void:
|
||||
func build_open_menu() -> void:
|
||||
var menu = open_button.get_popup()
|
||||
menu.clear()
|
||||
menu.add_icon_item(get_theme_icon("Load", "EditorIcons"), DialogueConstants.translate(&"open.open"), OPEN_OPEN)
|
||||
menu.add_icon_item(get_theme_icon("Load", "EditorIcons"), DMConstants.translate(&"open.open"), OPEN_OPEN)
|
||||
menu.add_icon_item(get_theme_icon("Load", "EditorIcons"), DMConstants.translate(&"open.quick_open"), OPEN_QUICK)
|
||||
menu.add_separator()
|
||||
|
||||
var recent_files = DialogueSettings.get_recent_files()
|
||||
var recent_files = DMSettings.get_recent_files()
|
||||
if recent_files.size() == 0:
|
||||
menu.add_item(DialogueConstants.translate(&"open.no_recent_files"))
|
||||
menu.add_item(DMConstants.translate(&"open.no_recent_files"))
|
||||
menu.set_item_disabled(2, true)
|
||||
else:
|
||||
for path in recent_files:
|
||||
@@ -485,7 +463,7 @@ func build_open_menu() -> void:
|
||||
menu.add_icon_item(get_theme_icon("File", "EditorIcons"), path)
|
||||
|
||||
menu.add_separator()
|
||||
menu.add_item(DialogueConstants.translate(&"open.clear_recent_files"), OPEN_CLEAR)
|
||||
menu.add_item(DMConstants.translate(&"open.clear_recent_files"), OPEN_CLEAR)
|
||||
if menu.id_pressed.is_connected(_on_open_menu_id_pressed):
|
||||
menu.id_pressed.disconnect(_on_open_menu_id_pressed)
|
||||
menu.id_pressed.connect(_on_open_menu_id_pressed)
|
||||
@@ -494,25 +472,22 @@ func build_open_menu() -> void:
|
||||
# Get the last place a CSV, etc was exported
|
||||
func get_last_export_path(extension: String) -> String:
|
||||
var filename = current_file_path.get_file().replace(".dialogue", "." + extension)
|
||||
return DialogueSettings.get_user_value("last_export_path", current_file_path.get_base_dir()) + "/" + filename
|
||||
return DMSettings.get_user_value("last_export_path", current_file_path.get_base_dir()) + "/" + filename
|
||||
|
||||
|
||||
# Check the current text for errors
|
||||
func parse() -> void:
|
||||
func compile() -> void:
|
||||
# Skip if nothing to parse
|
||||
if current_file_path == "": return
|
||||
|
||||
var parser = DialogueManagerParser.new()
|
||||
var errors: Array[Dictionary] = []
|
||||
if parser.parse(code_edit.text, current_file_path) != OK:
|
||||
errors = parser.get_errors()
|
||||
code_edit.errors = errors
|
||||
errors_panel.errors = errors
|
||||
parser.free()
|
||||
var result: DMCompilerResult = DMCompiler.compile_string(code_edit.text, current_file_path)
|
||||
code_edit.errors = result.errors
|
||||
errors_panel.errors = result.errors
|
||||
title_list.titles = code_edit.get_titles()
|
||||
|
||||
|
||||
func show_build_error_dialog() -> void:
|
||||
build_error_dialog.dialog_text = DialogueConstants.translate(&"errors_with_build")
|
||||
build_error_dialog.dialog_text = DMConstants.translate(&"errors_with_build")
|
||||
build_error_dialog.popup_centered()
|
||||
|
||||
|
||||
@@ -521,8 +496,6 @@ func generate_translations_keys() -> void:
|
||||
randomize()
|
||||
seed(Time.get_unix_time_from_system())
|
||||
|
||||
var parser = DialogueManagerParser.new()
|
||||
|
||||
var cursor: Vector2 = code_edit.get_cursor()
|
||||
var lines: PackedStringArray = code_edit.text.split("\n")
|
||||
|
||||
@@ -538,7 +511,7 @@ func generate_translations_keys() -> void:
|
||||
var text = ""
|
||||
var l = line.replace(found.strings[0], "").strip_edges().strip_edges()
|
||||
if l.begins_with("- "):
|
||||
text = parser.extract_response_prompt(l)
|
||||
text = DMCompiler.extract_translatable_string(l)
|
||||
elif ":" in l:
|
||||
text = l.split(":")[1]
|
||||
else:
|
||||
@@ -550,34 +523,43 @@ func generate_translations_keys() -> void:
|
||||
var line = lines[i]
|
||||
var l = line.strip_edges()
|
||||
|
||||
if parser.is_line_empty(l): continue
|
||||
if parser.is_condition_line(l, true): continue
|
||||
if parser.is_title_line(l): continue
|
||||
if parser.is_mutation_line(l): continue
|
||||
if parser.is_goto_line(l): continue
|
||||
if parser.is_import_line(l): continue
|
||||
if not [DMConstants.TYPE_DIALOGUE, DMConstants.TYPE_RESPONSE].has(DMCompiler.get_line_type(l)): continue
|
||||
|
||||
if "[ID:" in line: continue
|
||||
|
||||
var key = "t" + str(randi() % 1000000).sha1_text().substr(0, 10)
|
||||
while key in known_keys:
|
||||
key = "t" + str(randi() % 1000000).sha1_text().substr(0, 10)
|
||||
|
||||
var text = ""
|
||||
if l.begins_with("- "):
|
||||
text = parser.extract_response_prompt(l)
|
||||
text = DMCompiler.extract_translatable_string(l)
|
||||
else:
|
||||
text = l.substr(l.find(":") + 1)
|
||||
|
||||
lines[i] = line.replace(text, text + " [ID:%s]" % key)
|
||||
var key: String = ""
|
||||
if known_keys.values().has(text):
|
||||
key = known_keys.find_key(text)
|
||||
else:
|
||||
var regex: DMCompilerRegEx = DMCompilerRegEx.new()
|
||||
key = regex.ALPHA_NUMERIC.sub(text.strip_edges(), "_", true).substr(0, 30)
|
||||
if key.begins_with("_"):
|
||||
key = key.substr(1)
|
||||
if key.ends_with("_"):
|
||||
key = key.substr(0, key.length() - 1)
|
||||
|
||||
# Make sure key is unique
|
||||
var hashed_key: String = key + "_" + str(randi() % 1000000).sha1_text().substr(0, 6)
|
||||
while hashed_key in known_keys and text != known_keys.get(hashed_key):
|
||||
hashed_key = key + "_" + str(randi() % 1000000).sha1_text().substr(0, 6)
|
||||
key = hashed_key.to_upper()
|
||||
|
||||
line = line.replace("\\n", "!NEWLINE!")
|
||||
text = text.replace("\n", "!NEWLINE!")
|
||||
lines[i] = line.replace(text, text + " [ID:%s]" % [key]).replace("!NEWLINE!", "\\n")
|
||||
|
||||
known_keys[key] = text
|
||||
|
||||
code_edit.text = "\n".join(lines)
|
||||
code_edit.set_cursor(cursor)
|
||||
_on_code_edit_text_changed()
|
||||
|
||||
parser.free()
|
||||
|
||||
|
||||
# Add a translation file to the project settings
|
||||
func add_path_to_project_translations(path: String) -> void:
|
||||
@@ -589,7 +571,7 @@ func add_path_to_project_translations(path: String) -> void:
|
||||
|
||||
# Export dialogue and responses to CSV
|
||||
func export_translations_to_csv(path: String) -> void:
|
||||
var default_locale: String = DialogueSettings.get_setting("default_csv_locale", "en")
|
||||
var default_locale: String = DMSettings.get_setting(DMSettings.DEFAULT_CSV_LOCALE, "en")
|
||||
|
||||
var file: FileAccess
|
||||
|
||||
@@ -621,13 +603,13 @@ func export_translations_to_csv(path: String) -> void:
|
||||
existing_csv[line[0]] = line
|
||||
|
||||
# The character column wasn't found in the existing file but the setting is turned on
|
||||
if character_column == -1 and DialogueSettings.get_setting("include_character_in_translation_exports", false):
|
||||
if character_column == -1 and DMSettings.get_setting(DMSettings.INCLUDE_CHARACTER_IN_TRANSLATION_EXPORTS, false):
|
||||
character_column = column_count
|
||||
column_count += 1
|
||||
existing_csv["keys"].append("_character")
|
||||
|
||||
# The notes column wasn't found in the existing file but the setting is turned on
|
||||
if notes_column == -1 and DialogueSettings.get_setting("include_notes_in_translation_exports", false):
|
||||
if notes_column == -1 and DMSettings.get_setting(DMSettings.INCLUDE_NOTES_IN_TRANSLATION_EXPORTS, false):
|
||||
notes_column = column_count
|
||||
column_count += 1
|
||||
existing_csv["keys"].append("_notes")
|
||||
@@ -636,11 +618,11 @@ func export_translations_to_csv(path: String) -> void:
|
||||
file = FileAccess.open(path, FileAccess.WRITE)
|
||||
|
||||
if not FileAccess.file_exists(path):
|
||||
var headings: PackedStringArray = ["keys", default_locale]
|
||||
if DialogueSettings.get_setting("include_character_in_translation_exports", false):
|
||||
var headings: PackedStringArray = ["keys", default_locale] + DMSettings.get_setting(DMSettings.EXTRA_CSV_LOCALES, [])
|
||||
if DMSettings.get_setting(DMSettings.INCLUDE_CHARACTER_IN_TRANSLATION_EXPORTS, false):
|
||||
character_column = headings.size()
|
||||
headings.append("_character")
|
||||
if DialogueSettings.get_setting("include_notes_in_translation_exports", false):
|
||||
if DMSettings.get_setting(DMSettings.INCLUDE_NOTES_IN_TRANSLATION_EXPORTS, false):
|
||||
notes_column = headings.size()
|
||||
headings.append("_notes")
|
||||
file.store_csv_line(headings)
|
||||
@@ -649,30 +631,33 @@ func export_translations_to_csv(path: String) -> void:
|
||||
# Write our translations to file
|
||||
var known_keys: PackedStringArray = []
|
||||
|
||||
var dialogue: Dictionary = DialogueManagerParser.parse_string(code_edit.text, current_file_path).lines
|
||||
var dialogue = DMCompiler.compile_string(code_edit.text, current_file_path).lines
|
||||
|
||||
# Make a list of stuff that needs to go into the file
|
||||
var lines_to_save = []
|
||||
for key in dialogue.keys():
|
||||
var line: Dictionary = dialogue.get(key)
|
||||
|
||||
if not line.type in [DialogueConstants.TYPE_DIALOGUE, DialogueConstants.TYPE_RESPONSE]: continue
|
||||
if line.translation_key in known_keys: continue
|
||||
if not line.type in [DMConstants.TYPE_DIALOGUE, DMConstants.TYPE_RESPONSE]: continue
|
||||
|
||||
known_keys.append(line.translation_key)
|
||||
var translation_key: String = line.get(&"translation_key", line.text)
|
||||
|
||||
if translation_key in known_keys: continue
|
||||
|
||||
known_keys.append(translation_key)
|
||||
|
||||
var line_to_save: PackedStringArray = []
|
||||
if existing_csv.has(line.translation_key):
|
||||
line_to_save = existing_csv.get(line.translation_key)
|
||||
if existing_csv.has(translation_key):
|
||||
line_to_save = existing_csv.get(translation_key)
|
||||
line_to_save.resize(column_count)
|
||||
existing_csv.erase(line.translation_key)
|
||||
existing_csv.erase(translation_key)
|
||||
else:
|
||||
line_to_save.resize(column_count)
|
||||
line_to_save[0] = line.translation_key
|
||||
line_to_save[0] = translation_key
|
||||
|
||||
line_to_save[default_locale_column] = line.text
|
||||
if character_column > -1:
|
||||
line_to_save[character_column] = "(response)" if line.type == DialogueConstants.TYPE_RESPONSE else line.character
|
||||
line_to_save[character_column] = "(response)" if line.type == DMConstants.TYPE_RESPONSE else line.character
|
||||
if notes_column > -1:
|
||||
line_to_save[notes_column] = line.notes
|
||||
|
||||
@@ -686,8 +671,8 @@ func export_translations_to_csv(path: String) -> void:
|
||||
|
||||
file.close()
|
||||
|
||||
plugin.get_editor_interface().get_resource_filesystem().scan()
|
||||
plugin.get_editor_interface().get_file_system_dock().call_deferred("navigate_to_path", path)
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
EditorInterface.get_file_system_dock().call_deferred("navigate_to_path", path)
|
||||
|
||||
# Add it to the project l10n settings if it's not already there
|
||||
var language_code: RegExMatch = RegEx.create_from_string("^[a-z]{2,3}").search(default_locale)
|
||||
@@ -719,12 +704,12 @@ func export_character_names_to_csv(path: String) -> void:
|
||||
file = FileAccess.open(path, FileAccess.WRITE)
|
||||
|
||||
if not file.file_exists(path):
|
||||
file.store_csv_line(["keys", DialogueSettings.get_setting("default_csv_locale", "en")])
|
||||
file.store_csv_line(["keys", DMSettings.get_setting(DMSettings.DEFAULT_CSV_LOCALE, "en")])
|
||||
|
||||
# Write our translations to file
|
||||
var known_keys: PackedStringArray = []
|
||||
|
||||
var character_names: PackedStringArray = DialogueManagerParser.parse_string(code_edit.text, current_file_path).character_names
|
||||
var character_names: PackedStringArray = DMCompiler.compile_string(code_edit.text, current_file_path).character_names
|
||||
|
||||
# Make a list of stuff that needs to go into the file
|
||||
var lines_to_save = []
|
||||
@@ -749,8 +734,8 @@ func export_character_names_to_csv(path: String) -> void:
|
||||
|
||||
file.close()
|
||||
|
||||
plugin.get_editor_interface().get_resource_filesystem().scan()
|
||||
plugin.get_editor_interface().get_file_system_dock().call_deferred("navigate_to_path", path)
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
EditorInterface.get_file_system_dock().call_deferred("navigate_to_path", path)
|
||||
|
||||
# Add it to the project l10n settings if it's not already there
|
||||
var translation_path: String = path.replace(".csv", ".en.translation")
|
||||
@@ -772,17 +757,15 @@ func import_translations_from_csv(path: String) -> void:
|
||||
if csv_line.size() > 1:
|
||||
keys[csv_line[0]] = csv_line[1]
|
||||
|
||||
var parser: DialogueManagerParser = DialogueManagerParser.new()
|
||||
|
||||
# Now look over each line in the dialogue and replace the content for matched keys
|
||||
var lines: PackedStringArray = code_edit.text.split("\n")
|
||||
var start_index: int = 0
|
||||
var end_index: int = 0
|
||||
for i in range(0, lines.size()):
|
||||
var line: String = lines[i]
|
||||
var translation_key: String = parser.extract_translation(line)
|
||||
var translation_key: String = DMCompiler.get_static_line_id(line)
|
||||
if keys.has(translation_key):
|
||||
if parser.is_dialogue_line(line):
|
||||
if DMCompiler.get_line_type(line) == DMConstants.TYPE_DIALOGUE:
|
||||
start_index = 0
|
||||
# See if we need to skip over a character name
|
||||
line = line.replace("\\:", "!ESCAPED_COLON!")
|
||||
@@ -790,7 +773,7 @@ func import_translations_from_csv(path: String) -> void:
|
||||
start_index = line.find(": ") + 2
|
||||
lines[i] = (line.substr(0, start_index) + keys.get(translation_key) + " [ID:" + translation_key + "]").replace("!ESCAPED_COLON!", ":")
|
||||
|
||||
elif parser.is_response_line(line):
|
||||
elif DMCompiler.get_line_type(line) == DMConstants.TYPE_RESPONSE:
|
||||
start_index = line.find("- ") + 2
|
||||
# See if we need to skip over a character name
|
||||
line = line.replace("\\:", "!ESCAPED_COLON!")
|
||||
@@ -806,8 +789,6 @@ func import_translations_from_csv(path: String) -> void:
|
||||
code_edit.text = "\n".join(lines)
|
||||
code_edit.set_cursor(cursor)
|
||||
|
||||
parser.free()
|
||||
|
||||
|
||||
func show_search_form(is_enabled: bool) -> void:
|
||||
if code_edit.last_selected_text:
|
||||
@@ -831,14 +812,15 @@ func _on_files_moved(old_file: String, new_file: String) -> void:
|
||||
func _on_cache_file_content_changed(path: String, new_content: String) -> void:
|
||||
if open_buffers.has(path):
|
||||
var buffer = open_buffers[path]
|
||||
if buffer.text != new_content:
|
||||
if buffer.text == buffer.pristine_text and buffer.text != new_content:
|
||||
buffer.text = new_content
|
||||
buffer.pristine_text = new_content
|
||||
code_edit.text = new_content
|
||||
title_list.titles = code_edit.get_titles()
|
||||
buffer.pristine_text = new_content
|
||||
|
||||
|
||||
func _on_editor_settings_changed() -> void:
|
||||
var editor_settings: EditorSettings = plugin.get_editor_interface().get_editor_settings()
|
||||
var editor_settings: EditorSettings = EditorInterface.get_editor_settings()
|
||||
code_edit.minimap_draw = editor_settings.get_setting("text_editor/appearance/minimap/show_minimap")
|
||||
code_edit.minimap_width = editor_settings.get_setting("text_editor/appearance/minimap/minimap_width")
|
||||
code_edit.scroll_smooth = editor_settings.get_setting("text_editor/behavior/navigation/smooth_scrolling")
|
||||
@@ -848,8 +830,12 @@ func _on_open_menu_id_pressed(id: int) -> void:
|
||||
match id:
|
||||
OPEN_OPEN:
|
||||
open_dialog.popup_centered()
|
||||
OPEN_QUICK:
|
||||
quick_open_files_list.files = Engine.get_meta("DMCache").get_files()
|
||||
quick_open_dialog.popup_centered()
|
||||
quick_open_files_list.focus_filter()
|
||||
OPEN_CLEAR:
|
||||
DialogueSettings.clear_recent_files()
|
||||
DMSettings.clear_recent_files()
|
||||
build_open_menu()
|
||||
_:
|
||||
var menu = open_button.get_popup()
|
||||
@@ -912,7 +898,7 @@ func _on_translations_button_menu_id_pressed(id: int) -> void:
|
||||
|
||||
|
||||
func _on_export_dialog_file_selected(path: String) -> void:
|
||||
DialogueSettings.set_user_value("last_export_path", path.get_base_dir())
|
||||
DMSettings.set_user_value("last_export_path", path.get_base_dir())
|
||||
match path.get_extension():
|
||||
"csv":
|
||||
match translation_source:
|
||||
@@ -923,7 +909,7 @@ func _on_export_dialog_file_selected(path: String) -> void:
|
||||
|
||||
|
||||
func _on_import_dialog_file_selected(path: String) -> void:
|
||||
DialogueSettings.set_user_value("last_export_path", path.get_base_dir())
|
||||
DMSettings.set_user_value("last_export_path", path.get_base_dir())
|
||||
import_translations_from_csv(path)
|
||||
|
||||
|
||||
@@ -937,16 +923,25 @@ func _on_main_view_visibility_changed() -> void:
|
||||
|
||||
|
||||
func _on_new_button_pressed() -> void:
|
||||
new_dialog.current_file = ""
|
||||
new_dialog.current_file = "dialogue"
|
||||
new_dialog.popup_centered()
|
||||
|
||||
|
||||
func _on_new_dialog_confirmed() -> void:
|
||||
if new_dialog.current_file.get_basename() == "":
|
||||
var path = "res://untitled.dialogue"
|
||||
new_file(path)
|
||||
open_file(path)
|
||||
|
||||
|
||||
func _on_new_dialog_file_selected(path: String) -> void:
|
||||
new_file(path)
|
||||
open_file(path)
|
||||
|
||||
|
||||
func _on_save_dialog_file_selected(path: String) -> void:
|
||||
if path == "": path = "res://untitled.dialogue"
|
||||
|
||||
new_file(path, code_edit.text)
|
||||
open_file(path)
|
||||
|
||||
@@ -959,6 +954,16 @@ func _on_open_dialog_file_selected(path: String) -> void:
|
||||
open_file(path)
|
||||
|
||||
|
||||
func _on_quick_open_files_list_file_double_clicked(file_path: String) -> void:
|
||||
quick_open_dialog.hide()
|
||||
open_file(file_path)
|
||||
|
||||
|
||||
func _on_quick_open_dialog_confirmed() -> void:
|
||||
if quick_open_files_list.current_file_path:
|
||||
open_file(quick_open_files_list.current_file_path)
|
||||
|
||||
|
||||
func _on_save_all_button_pressed() -> void:
|
||||
save_files()
|
||||
|
||||
@@ -969,8 +974,6 @@ func _on_find_in_files_button_pressed() -> void:
|
||||
|
||||
|
||||
func _on_code_edit_text_changed() -> void:
|
||||
title_list.titles = code_edit.get_titles()
|
||||
|
||||
var buffer = open_buffers[current_file_path]
|
||||
buffer.text = code_edit.text
|
||||
|
||||
@@ -982,11 +985,10 @@ func _on_code_edit_text_changed() -> void:
|
||||
|
||||
func _on_code_edit_active_title_change(title: String) -> void:
|
||||
title_list.select_title(title)
|
||||
DialogueSettings.set_user_value("run_title", title)
|
||||
|
||||
|
||||
func _on_code_edit_caret_changed() -> void:
|
||||
DialogueSettings.set_caret(current_file_path, code_edit.get_cursor())
|
||||
DMSettings.set_caret(current_file_path, code_edit.get_cursor())
|
||||
|
||||
|
||||
func _on_code_edit_error_clicked(line_number: int) -> void:
|
||||
@@ -1000,11 +1002,11 @@ func _on_title_list_title_selected(title: String) -> void:
|
||||
|
||||
func _on_parse_timer_timeout() -> void:
|
||||
parse_timer.stop()
|
||||
parse()
|
||||
compile()
|
||||
|
||||
|
||||
func _on_errors_panel_error_pressed(line_number: int, column_number: int) -> void:
|
||||
code_edit.set_caret_line(line_number)
|
||||
code_edit.set_caret_line(line_number - 1)
|
||||
code_edit.set_caret_column(column_number)
|
||||
code_edit.grab_focus()
|
||||
|
||||
@@ -1023,34 +1025,39 @@ func _on_search_and_replace_close_requested() -> void:
|
||||
code_edit.grab_focus()
|
||||
|
||||
|
||||
func _on_settings_button_pressed() -> void:
|
||||
settings_view.prepare()
|
||||
settings_dialog.popup_centered()
|
||||
|
||||
|
||||
func _on_settings_view_script_button_pressed(path: String) -> void:
|
||||
settings_dialog.hide()
|
||||
plugin.get_editor_interface().edit_resource(load(path))
|
||||
|
||||
|
||||
func _on_test_button_pressed() -> void:
|
||||
save_file(current_file_path, false)
|
||||
Engine.get_meta("DMCache").reimport_files([current_file_path])
|
||||
|
||||
if errors_panel.errors.size() > 0:
|
||||
errors_dialog.popup_centered()
|
||||
return
|
||||
|
||||
DMSettings.set_user_value("run_title", "")
|
||||
DMSettings.set_user_value("is_running_test_scene", true)
|
||||
DMSettings.set_user_value("run_resource_path", current_file_path)
|
||||
var test_scene_path: String = DMSettings.get_setting(DMSettings.CUSTOM_TEST_SCENE_PATH, "res://addons/dialogue_manager/test_scene.tscn")
|
||||
EditorInterface.play_custom_scene(test_scene_path)
|
||||
|
||||
|
||||
func _on_test_line_button_pressed() -> void:
|
||||
save_file(current_file_path)
|
||||
|
||||
if errors_panel.errors.size() > 0:
|
||||
errors_dialog.popup_centered()
|
||||
return
|
||||
|
||||
DialogueSettings.set_user_value("is_running_test_scene", true)
|
||||
DialogueSettings.set_user_value("run_resource_path", current_file_path)
|
||||
var test_scene_path: String = DialogueSettings.get_setting("custom_test_scene_path", "res://addons/dialogue_manager/test_scene.tscn")
|
||||
plugin.get_editor_interface().play_custom_scene(test_scene_path)
|
||||
|
||||
|
||||
func _on_settings_dialog_confirmed() -> void:
|
||||
settings_view.apply_settings_changes()
|
||||
parse()
|
||||
code_edit.wrap_mode = TextEdit.LINE_WRAPPING_BOUNDARY if DialogueSettings.get_setting("wrap_lines", false) else TextEdit.LINE_WRAPPING_NONE
|
||||
code_edit.grab_focus()
|
||||
# Find next non-empty line
|
||||
var line_to_run: int = 0
|
||||
for i in range(code_edit.get_cursor().y, code_edit.get_line_count()):
|
||||
if not code_edit.get_line(i).is_empty():
|
||||
line_to_run = i
|
||||
break;
|
||||
DMSettings.set_user_value("run_title", str(line_to_run))
|
||||
DMSettings.set_user_value("is_running_test_scene", true)
|
||||
DMSettings.set_user_value("run_resource_path", current_file_path)
|
||||
var test_scene_path: String = DMSettings.get_setting(DMSettings.CUSTOM_TEST_SCENE_PATH, "res://addons/dialogue_manager/test_scene.tscn")
|
||||
EditorInterface.play_custom_scene(test_scene_path)
|
||||
|
||||
|
||||
func _on_support_button_pressed() -> void:
|
||||
@@ -1075,14 +1082,14 @@ func _on_files_popup_menu_about_to_popup() -> void:
|
||||
|
||||
var shortcuts: Dictionary = plugin.get_editor_shortcuts()
|
||||
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.save"), ITEM_SAVE, OS.find_keycode_from_string(shortcuts.get("save")[0].as_text_keycode()))
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.save_as"), ITEM_SAVE_AS)
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close"), ITEM_CLOSE, OS.find_keycode_from_string(shortcuts.get("close_file")[0].as_text_keycode()))
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close_all"), ITEM_CLOSE_ALL)
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.close_other_files"), ITEM_CLOSE_OTHERS)
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.save"), ITEM_SAVE, OS.find_keycode_from_string(shortcuts.get("save")[0].as_text_keycode()))
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.save_as"), ITEM_SAVE_AS)
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.close"), ITEM_CLOSE, OS.find_keycode_from_string(shortcuts.get("close_file")[0].as_text_keycode()))
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.close_all"), ITEM_CLOSE_ALL)
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.close_other_files"), ITEM_CLOSE_OTHERS)
|
||||
files_popup_menu.add_separator()
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.copy_file_path"), ITEM_COPY_PATH)
|
||||
files_popup_menu.add_item(DialogueConstants.translate(&"buffer.show_in_filesystem"), ITEM_SHOW_IN_FILESYSTEM)
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.copy_file_path"), ITEM_COPY_PATH)
|
||||
files_popup_menu.add_item(DMConstants.translate(&"buffer.show_in_filesystem"), ITEM_SHOW_IN_FILESYSTEM)
|
||||
|
||||
|
||||
func _on_files_popup_menu_id_pressed(id: int) -> void:
|
||||
|
||||
@@ -1 +1 @@
|
||||
uid://qkrp3bclecwq
|
||||
uid://cipjcc7bkh1pc
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
[gd_scene load_steps=16 format=3 uid="uid://cbuf1q3xsse3q"]
|
||||
[gd_scene load_steps=15 format=3 uid="uid://cbuf1q3xsse3q"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogue_manager/views/main_view.gd" id="1_h6qfq"]
|
||||
[ext_resource type="Script" uid="uid://cipjcc7bkh1pc" path="res://addons/dialogue_manager/views/main_view.gd" id="1_h6qfq"]
|
||||
[ext_resource type="PackedScene" uid="uid://civ6shmka5e8u" path="res://addons/dialogue_manager/components/code_edit.tscn" id="2_f73fm"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnufpcdrreva3" path="res://addons/dialogue_manager/components/files_list.tscn" id="2_npj2k"]
|
||||
[ext_resource type="PackedScene" uid="uid://ctns6ouwwd68i" path="res://addons/dialogue_manager/components/title_list.tscn" id="2_onb4i"]
|
||||
[ext_resource type="PackedScene" uid="uid://co8yl23idiwbi" path="res://addons/dialogue_manager/components/update_button.tscn" id="2_ph3vs"]
|
||||
[ext_resource type="PackedScene" uid="uid://gr8nakpbrhby" path="res://addons/dialogue_manager/components/search_and_replace.tscn" id="6_ylh0t"]
|
||||
[ext_resource type="PackedScene" uid="uid://cs8pwrxr5vxix" path="res://addons/dialogue_manager/components/errors_panel.tscn" id="7_5cvl4"]
|
||||
[ext_resource type="Script" path="res://addons/dialogue_manager/components/code_edit_syntax_highlighter.gd" id="7_necsa"]
|
||||
[ext_resource type="PackedScene" uid="uid://cpg4lg1r3ff6m" path="res://addons/dialogue_manager/views/settings_view.tscn" id="9_8bf36"]
|
||||
[ext_resource type="Script" uid="uid://klpiq4tk3t7a" path="res://addons/dialogue_manager/components/code_edit_syntax_highlighter.gd" id="7_necsa"]
|
||||
[ext_resource type="PackedScene" uid="uid://0n7hwviyyly4" path="res://addons/dialogue_manager/components/find_in_files.tscn" id="10_yold3"]
|
||||
|
||||
[sub_resource type="Image" id="Image_3ewak"]
|
||||
[sub_resource type="Image" id="Image_faxki"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
|
||||
"format": "RGBA8",
|
||||
@@ -20,10 +19,10 @@ data = {
|
||||
"width": 16
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_wmrmd"]
|
||||
image = SubResource("Image_3ewak")
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_ka3gk"]
|
||||
image = SubResource("Image_faxki")
|
||||
|
||||
[sub_resource type="Image" id="Image_jj6l1"]
|
||||
[sub_resource type="Image" id="Image_y6rqu"]
|
||||
data = {
|
||||
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 94, 94, 127, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 231, 255, 94, 94, 54, 255, 94, 94, 57, 255, 93, 93, 233, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 93, 93, 41, 255, 255, 255, 0, 255, 255, 255, 0, 255, 97, 97, 42, 255, 93, 93, 233, 255, 93, 93, 232, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 44, 255, 255, 255, 0, 255, 97, 97, 42, 255, 97, 97, 42, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 96, 96, 45, 255, 93, 93, 235, 255, 94, 94, 234, 255, 95, 95, 43, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 93, 93, 235, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 233, 255, 95, 95, 59, 255, 96, 96, 61, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 93, 93, 255, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0),
|
||||
"format": "RGBA8",
|
||||
@@ -32,10 +31,10 @@ data = {
|
||||
"width": 16
|
||||
}
|
||||
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_r0npg"]
|
||||
image = SubResource("Image_jj6l1")
|
||||
[sub_resource type="ImageTexture" id="ImageTexture_57eek"]
|
||||
image = SubResource("Image_y6rqu")
|
||||
|
||||
[sub_resource type="SyntaxHighlighter" id="SyntaxHighlighter_4re8k"]
|
||||
[sub_resource type="SyntaxHighlighter" id="SyntaxHighlighter_kb7f8"]
|
||||
script = ExtResource("7_necsa")
|
||||
|
||||
[node name="MainView" type="Control"]
|
||||
@@ -68,6 +67,7 @@ metadata/_edit_layout_mode = 1
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
dragger_visibility = 1
|
||||
|
||||
[node name="SidePanel" type="VBoxContainer" parent="Margin/Content"]
|
||||
custom_minimum_size = Vector2(150, 0)
|
||||
@@ -89,31 +89,28 @@ layout_mode = 2
|
||||
tooltip_text = "Open a file"
|
||||
item_count = 9
|
||||
popup/item_0/text = "Open..."
|
||||
popup/item_0/icon = SubResource("ImageTexture_wmrmd")
|
||||
popup/item_0/icon = SubResource("ImageTexture_ka3gk")
|
||||
popup/item_0/id = 100
|
||||
popup/item_1/text = ""
|
||||
popup/item_1/id = -1
|
||||
popup/item_1/separator = true
|
||||
popup/item_2/text = "res://blah.dialogue"
|
||||
popup/item_2/icon = SubResource("ImageTexture_wmrmd")
|
||||
popup/item_2/id = 2
|
||||
popup/item_1/icon = SubResource("ImageTexture_ka3gk")
|
||||
popup/item_1/id = 101
|
||||
popup/item_2/id = -1
|
||||
popup/item_2/separator = true
|
||||
popup/item_3/text = "res://examples/dialogue.dialogue"
|
||||
popup/item_3/icon = SubResource("ImageTexture_wmrmd")
|
||||
popup/item_3/icon = SubResource("ImageTexture_ka3gk")
|
||||
popup/item_3/id = 3
|
||||
popup/item_4/text = "res://examples/dialogue_with_input.dialogue"
|
||||
popup/item_4/icon = SubResource("ImageTexture_wmrmd")
|
||||
popup/item_4/icon = SubResource("ImageTexture_ka3gk")
|
||||
popup/item_4/id = 4
|
||||
popup/item_5/text = "res://examples/dialogue_for_point_n_click.dialogue"
|
||||
popup/item_5/icon = SubResource("ImageTexture_wmrmd")
|
||||
popup/item_5/icon = SubResource("ImageTexture_ka3gk")
|
||||
popup/item_5/id = 5
|
||||
popup/item_6/text = "res://examples/dialogue_for_visual_novel.dialogue"
|
||||
popup/item_6/icon = SubResource("ImageTexture_wmrmd")
|
||||
popup/item_6/icon = SubResource("ImageTexture_ka3gk")
|
||||
popup/item_6/id = 6
|
||||
popup/item_7/text = ""
|
||||
popup/item_7/id = -1
|
||||
popup/item_7/separator = true
|
||||
popup/item_8/text = "Clear recent files"
|
||||
popup/item_8/id = 101
|
||||
popup/item_8/id = 102
|
||||
|
||||
[node name="SaveAllButton" type="Button" parent="Margin/Content/SidePanel/Toolbar"]
|
||||
unique_name_in_owner = true
|
||||
@@ -133,6 +130,7 @@ size_flags_vertical = 3
|
||||
|
||||
[node name="FilesList" parent="Margin/Content/SidePanel/Bookmarks" instance=ExtResource("2_npj2k")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
@@ -141,6 +139,7 @@ unique_name_in_owner = true
|
||||
|
||||
[node name="TitleList" parent="Margin/Content/SidePanel/Bookmarks" instance=ExtResource("2_onb4i")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CodePanel" type="VBoxContainer" parent="Margin/Content"]
|
||||
@@ -154,73 +153,72 @@ layout_mode = 2
|
||||
[node name="InsertButton" type="MenuButton" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Insert"
|
||||
item_count = 15
|
||||
popup/item_0/text = "Wave BBCode"
|
||||
popup/item_0/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_0/id = 0
|
||||
popup/item_0/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_1/text = "Shake BBCode"
|
||||
popup/item_1/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_1/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = ""
|
||||
popup/item_2/id = -1
|
||||
popup/item_2/separator = true
|
||||
popup/item_3/text = "Typing pause"
|
||||
popup/item_3/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_3/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_3/id = 3
|
||||
popup/item_4/text = "Typing speed change"
|
||||
popup/item_4/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_4/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_4/id = 4
|
||||
popup/item_5/text = "Auto advance"
|
||||
popup/item_5/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_5/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_5/id = 5
|
||||
popup/item_6/text = "Templates"
|
||||
popup/item_6/id = -1
|
||||
popup/item_6/separator = true
|
||||
popup/item_7/text = "Title"
|
||||
popup/item_7/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_7/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_7/id = 6
|
||||
popup/item_8/text = "Dialogue"
|
||||
popup/item_8/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_8/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_8/id = 7
|
||||
popup/item_9/text = "Response"
|
||||
popup/item_9/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_9/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_9/id = 8
|
||||
popup/item_10/text = "Random lines"
|
||||
popup/item_10/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_10/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_10/id = 9
|
||||
popup/item_11/text = "Random text"
|
||||
popup/item_11/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_11/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_11/id = 10
|
||||
popup/item_12/text = "Actions"
|
||||
popup/item_12/id = -1
|
||||
popup/item_12/separator = true
|
||||
popup/item_13/text = "Jump to title"
|
||||
popup/item_13/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_13/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_13/id = 11
|
||||
popup/item_14/text = "End dialogue"
|
||||
popup/item_14/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_14/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_14/id = 12
|
||||
|
||||
[node name="TranslationsButton" type="MenuButton" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
disabled = true
|
||||
text = "Translations"
|
||||
item_count = 5
|
||||
popup/item_0/text = "Generate line IDs"
|
||||
popup/item_0/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_0/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_0/id = 100
|
||||
popup/item_1/text = ""
|
||||
popup/item_1/id = -1
|
||||
popup/item_1/separator = true
|
||||
popup/item_2/text = "Save character names to CSV..."
|
||||
popup/item_2/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_2/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_2/id = 201
|
||||
popup/item_3/text = "Save lines to CSV..."
|
||||
popup/item_3/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_3/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_3/id = 202
|
||||
popup/item_4/text = "Import line changes from CSV..."
|
||||
popup/item_4/icon = SubResource("ImageTexture_r0npg")
|
||||
popup/item_4/icon = SubResource("ImageTexture_57eek")
|
||||
popup/item_4/id = 203
|
||||
|
||||
[node name="Separator" type="VSeparator" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
@@ -230,22 +228,25 @@ layout_mode = 2
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "Search for text"
|
||||
disabled = true
|
||||
toggle_mode = true
|
||||
flat = true
|
||||
|
||||
[node name="Separator2" type="VSeparator" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TestButton" type="Button" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "Test dialogue"
|
||||
disabled = true
|
||||
flat = true
|
||||
|
||||
[node name="Separator3" type="VSeparator" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SettingsButton" type="Button" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
[node name="TestLineButton" type="Button" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
tooltip_text = "Settings"
|
||||
tooltip_text = "Test dialogue"
|
||||
disabled = true
|
||||
flat = true
|
||||
|
||||
[node name="Spacer2" type="Control" parent="Margin/Content/CodePanel/Toolbar"]
|
||||
@@ -272,12 +273,13 @@ flat = true
|
||||
unique_name_in_owner = true
|
||||
modulate = Color(1, 1, 1, 0.490196)
|
||||
layout_mode = 2
|
||||
text = "v2.41.3"
|
||||
text = "v2.42.2"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="UpdateButton" parent="Margin/Content/CodePanel/Toolbar" instance=ExtResource("2_ph3vs")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "v2.44.1 available"
|
||||
|
||||
[node name="SearchAndReplace" parent="Margin/Content/CodePanel" instance=ExtResource("6_ylh0t")]
|
||||
unique_name_in_owner = true
|
||||
@@ -285,29 +287,32 @@ layout_mode = 2
|
||||
|
||||
[node name="CodeEdit" parent="Margin/Content/CodePanel" instance=ExtResource("2_f73fm")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_colors/current_line_color = Color(0.266667, 0.278431, 0.352941, 0.243137)
|
||||
theme_override_colors/background_color = Color(0.156863, 0.164706, 0.211765, 1)
|
||||
theme_override_colors/font_color = Color(0.972549, 0.972549, 0.94902, 1)
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_colors/bookmark_color = Color(1, 0.333333, 0.333333, 1)
|
||||
theme_override_colors/current_line_color = Color(0.266667, 0.278431, 0.352941, 0.243137)
|
||||
theme_override_font_sizes/font_size = 21
|
||||
text = "~ this_is_a_node_title
|
||||
text = "~ start
|
||||
|
||||
Nathan: [[Hi|Hello|Howdy]], this is some dialogue.
|
||||
Nathan: Here are some choices.
|
||||
Nathan: Hi, I'm Nathan and this is Coco.
|
||||
Coco: Meow.
|
||||
Nathan: Here are some response options.
|
||||
- First one
|
||||
Nathan: You picked the first one.
|
||||
- Second one
|
||||
Nathan: You picked the second one.
|
||||
- Start again => this_is_a_node_title
|
||||
- Start again => start
|
||||
- End the conversation => END
|
||||
Nathan: For more information see the online documentation.
|
||||
Nathan: I hope this example is helpful.
|
||||
Coco: Meow.
|
||||
|
||||
=> END"
|
||||
scroll_smooth = true
|
||||
syntax_highlighter = SubResource("SyntaxHighlighter_4re8k")
|
||||
syntax_highlighter = SubResource("SyntaxHighlighter_kb7f8")
|
||||
|
||||
[node name="ErrorsPanel" parent="Margin/Content/CodePanel" instance=ExtResource("7_5cvl4")]
|
||||
unique_name_in_owner = true
|
||||
@@ -315,33 +320,41 @@ layout_mode = 2
|
||||
|
||||
[node name="NewDialog" type="FileDialog" parent="."]
|
||||
size = Vector2i(900, 750)
|
||||
min_size = Vector2i(900, 750)
|
||||
min_size = Vector2i(600, 500)
|
||||
dialog_hide_on_ok = true
|
||||
filters = PackedStringArray("*.dialogue ; Dialogue")
|
||||
|
||||
[node name="SaveDialog" type="FileDialog" parent="."]
|
||||
size = Vector2i(900, 750)
|
||||
min_size = Vector2i(900, 750)
|
||||
min_size = Vector2i(600, 500)
|
||||
dialog_hide_on_ok = true
|
||||
filters = PackedStringArray("*.dialogue ; Dialogue")
|
||||
|
||||
[node name="OpenDialog" type="FileDialog" parent="."]
|
||||
title = "Open a File"
|
||||
size = Vector2i(900, 750)
|
||||
min_size = Vector2i(900, 750)
|
||||
min_size = Vector2i(600, 500)
|
||||
ok_button_text = "Open"
|
||||
dialog_hide_on_ok = true
|
||||
file_mode = 0
|
||||
filters = PackedStringArray("*.dialogue ; Dialogue")
|
||||
|
||||
[node name="QuickOpenDialog" type="ConfirmationDialog" parent="."]
|
||||
title = "Quick open"
|
||||
size = Vector2i(600, 900)
|
||||
min_size = Vector2i(400, 600)
|
||||
ok_button_text = "Open"
|
||||
|
||||
[node name="QuickOpenFilesList" parent="QuickOpenDialog" instance=ExtResource("2_npj2k")]
|
||||
|
||||
[node name="ExportDialog" type="FileDialog" parent="."]
|
||||
size = Vector2i(900, 750)
|
||||
min_size = Vector2i(900, 750)
|
||||
min_size = Vector2i(600, 500)
|
||||
|
||||
[node name="ImportDialog" type="FileDialog" parent="."]
|
||||
title = "Open a File"
|
||||
size = Vector2i(900, 750)
|
||||
min_size = Vector2i(900, 750)
|
||||
min_size = Vector2i(600, 500)
|
||||
ok_button_text = "Open"
|
||||
file_mode = 0
|
||||
filters = PackedStringArray("*.csv ; Translation CSV")
|
||||
@@ -350,21 +363,6 @@ filters = PackedStringArray("*.csv ; Translation CSV")
|
||||
title = "Error"
|
||||
dialog_text = "You have errors in your script. Fix them and then try again."
|
||||
|
||||
[node name="SettingsDialog" type="AcceptDialog" parent="."]
|
||||
title = "Settings"
|
||||
size = Vector2i(1500, 900)
|
||||
unresizable = true
|
||||
min_size = Vector2i(1500, 900)
|
||||
max_size = Vector2i(1500, 900)
|
||||
ok_button_text = "Done"
|
||||
|
||||
[node name="SettingsView" parent="SettingsDialog" instance=ExtResource("9_8bf36")]
|
||||
offset_left = 8.0
|
||||
offset_top = 8.0
|
||||
offset_right = -8.0
|
||||
offset_bottom = -49.0
|
||||
current_tab = 0
|
||||
|
||||
[node name="BuildErrorDialog" type="AcceptDialog" parent="."]
|
||||
title = "Errors"
|
||||
dialog_text = "You need to fix dialogue errors before you can run your game."
|
||||
@@ -381,7 +379,7 @@ dialog_text = "You're now up to date!"
|
||||
[node name="FindInFilesDialog" type="AcceptDialog" parent="."]
|
||||
title = "Find in files"
|
||||
size = Vector2i(1200, 900)
|
||||
min_size = Vector2i(1200, 900)
|
||||
min_size = Vector2i(800, 600)
|
||||
ok_button_text = "Done"
|
||||
|
||||
[node name="FindInFiles" parent="FindInFilesDialog" node_paths=PackedStringArray("main_view", "code_edit") instance=ExtResource("10_yold3")]
|
||||
@@ -408,7 +406,7 @@ code_edit = NodePath("../../Margin/Content/CodePanel/CodeEdit")
|
||||
[connection signal="title_selected" from="Margin/Content/SidePanel/Bookmarks/TitleList" to="." method="_on_title_list_title_selected"]
|
||||
[connection signal="toggled" from="Margin/Content/CodePanel/Toolbar/SearchButton" to="." method="_on_search_button_toggled"]
|
||||
[connection signal="pressed" from="Margin/Content/CodePanel/Toolbar/TestButton" to="." method="_on_test_button_pressed"]
|
||||
[connection signal="pressed" from="Margin/Content/CodePanel/Toolbar/SettingsButton" to="." method="_on_settings_button_pressed"]
|
||||
[connection signal="pressed" from="Margin/Content/CodePanel/Toolbar/TestLineButton" to="." method="_on_test_line_button_pressed"]
|
||||
[connection signal="pressed" from="Margin/Content/CodePanel/Toolbar/SupportButton" to="." method="_on_support_button_pressed"]
|
||||
[connection signal="pressed" from="Margin/Content/CodePanel/Toolbar/DocsButton" to="." method="_on_docs_button_pressed"]
|
||||
[connection signal="close_requested" from="Margin/Content/CodePanel/SearchAndReplace" to="." method="_on_search_and_replace_close_requested"]
|
||||
@@ -419,13 +417,14 @@ code_edit = NodePath("../../Margin/Content/CodePanel/CodeEdit")
|
||||
[connection signal="external_file_requested" from="Margin/Content/CodePanel/CodeEdit" to="." method="_on_code_edit_external_file_requested"]
|
||||
[connection signal="text_changed" from="Margin/Content/CodePanel/CodeEdit" to="." method="_on_code_edit_text_changed"]
|
||||
[connection signal="error_pressed" from="Margin/Content/CodePanel/ErrorsPanel" to="." method="_on_errors_panel_error_pressed"]
|
||||
[connection signal="confirmed" from="NewDialog" to="." method="_on_new_dialog_confirmed"]
|
||||
[connection signal="file_selected" from="NewDialog" to="." method="_on_new_dialog_file_selected"]
|
||||
[connection signal="file_selected" from="SaveDialog" to="." method="_on_save_dialog_file_selected"]
|
||||
[connection signal="file_selected" from="OpenDialog" to="." method="_on_open_dialog_file_selected"]
|
||||
[connection signal="confirmed" from="QuickOpenDialog" to="." method="_on_quick_open_dialog_confirmed"]
|
||||
[connection signal="file_double_clicked" from="QuickOpenDialog/QuickOpenFilesList" to="." method="_on_quick_open_files_list_file_double_clicked"]
|
||||
[connection signal="file_selected" from="ExportDialog" to="." method="_on_export_dialog_file_selected"]
|
||||
[connection signal="file_selected" from="ImportDialog" to="." method="_on_import_dialog_file_selected"]
|
||||
[connection signal="confirmed" from="SettingsDialog" to="." method="_on_settings_dialog_confirmed"]
|
||||
[connection signal="script_button_pressed" from="SettingsDialog/SettingsView" to="." method="_on_settings_view_script_button_pressed"]
|
||||
[connection signal="confirmed" from="CloseConfirmationDialog" to="." method="_on_close_confirmation_dialog_confirmed"]
|
||||
[connection signal="custom_action" from="CloseConfirmationDialog" to="." method="_on_close_confirmation_dialog_custom_action"]
|
||||
[connection signal="result_selected" from="FindInFilesDialog/FindInFiles" to="." method="_on_find_in_files_result_selected"]
|
||||
|
||||
@@ -1,280 +0,0 @@
|
||||
@tool
|
||||
extends TabContainer
|
||||
|
||||
|
||||
signal script_button_pressed(path: String)
|
||||
|
||||
|
||||
const DialogueConstants = preload("../constants.gd")
|
||||
const DialogueSettings = preload("../settings.gd")
|
||||
const BaseDialogueTestScene = preload("../test_scene.gd")
|
||||
|
||||
|
||||
enum PathTarget {
|
||||
CustomTestScene,
|
||||
Balloon
|
||||
}
|
||||
|
||||
|
||||
# Editor
|
||||
@onready var new_template_button: CheckBox = $Editor/NewTemplateButton
|
||||
@onready var characters_translations_button: CheckBox = $Editor/CharactersTranslationsButton
|
||||
@onready var wrap_lines_button: Button = $Editor/WrapLinesButton
|
||||
@onready var default_csv_locale: LineEdit = $Editor/DefaultCSVLocale
|
||||
|
||||
# Runtime
|
||||
@onready var include_all_responses_button: CheckBox = $Runtime/IncludeAllResponsesButton
|
||||
@onready var ignore_missing_state_values: CheckBox = $Runtime/IgnoreMissingStateValues
|
||||
@onready var balloon_path_input: LineEdit = $Runtime/CustomBalloon/BalloonPath
|
||||
@onready var revert_balloon_button: Button = $Runtime/CustomBalloon/RevertBalloonPath
|
||||
@onready var load_balloon_button: Button = $Runtime/CustomBalloon/LoadBalloonPath
|
||||
@onready var states_title: Label = $Runtime/StatesTitle
|
||||
@onready var globals_list: Tree = $Runtime/GlobalsList
|
||||
|
||||
# Advanced
|
||||
@onready var check_for_updates: CheckBox = $Advanced/CheckForUpdates
|
||||
@onready var include_characters_in_translations: CheckBox = $Advanced/IncludeCharactersInTranslations
|
||||
@onready var include_notes_in_translations: CheckBox = $Advanced/IncludeNotesInTranslations
|
||||
@onready var open_in_external_editor_button: CheckBox = $Advanced/OpenInExternalEditorButton
|
||||
@onready var test_scene_path_input: LineEdit = $Advanced/CustomTestScene/TestScenePath
|
||||
@onready var revert_test_scene_button: Button = $Advanced/CustomTestScene/RevertTestScene
|
||||
@onready var load_test_scene_button: Button = $Advanced/CustomTestScene/LoadTestScene
|
||||
@onready var custom_test_scene_file_dialog: FileDialog = $CustomTestSceneFileDialog
|
||||
@onready var create_lines_for_response_characters: CheckBox = $Advanced/CreateLinesForResponseCharacters
|
||||
@onready var missing_translations_button: CheckBox = $Advanced/MissingTranslationsButton
|
||||
|
||||
var all_globals: Dictionary = {}
|
||||
var enabled_globals: Array = []
|
||||
var path_target: PathTarget = PathTarget.CustomTestScene
|
||||
|
||||
var _default_test_scene_path: String = preload("../test_scene.tscn").resource_path
|
||||
|
||||
var _recompile_if_changed_settings: Dictionary
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
new_template_button.text = DialogueConstants.translate(&"settings.new_template")
|
||||
$Editor/MissingTranslationsHint.text = DialogueConstants.translate(&"settings.missing_keys_hint")
|
||||
characters_translations_button.text = DialogueConstants.translate(&"settings.characters_translations")
|
||||
wrap_lines_button.text = DialogueConstants.translate(&"settings.wrap_long_lines")
|
||||
$Editor/DefaultCSVLocaleLabel.text = DialogueConstants.translate(&"settings.default_csv_locale")
|
||||
|
||||
include_all_responses_button.text = DialogueConstants.translate(&"settings.include_failed_responses")
|
||||
ignore_missing_state_values.text = DialogueConstants.translate(&"settings.ignore_missing_state_values")
|
||||
$Runtime/CustomBalloonLabel.text = DialogueConstants.translate(&"settings.default_balloon_hint")
|
||||
states_title.text = DialogueConstants.translate(&"settings.states_shortcuts")
|
||||
$Runtime/StatesMessage.text = DialogueConstants.translate(&"settings.states_message")
|
||||
$Runtime/StatesHint.text = DialogueConstants.translate(&"settings.states_hint")
|
||||
|
||||
check_for_updates.text = DialogueConstants.translate(&"settings.check_for_updates")
|
||||
include_characters_in_translations.text = DialogueConstants.translate(&"settings.include_characters_in_translations")
|
||||
include_notes_in_translations.text = DialogueConstants.translate(&"settings.include_notes_in_translations")
|
||||
open_in_external_editor_button.text = DialogueConstants.translate(&"settings.open_in_external_editor")
|
||||
$Advanced/ExternalWarning.text = DialogueConstants.translate(&"settings.external_editor_warning")
|
||||
$Advanced/CustomTestSceneLabel.text = DialogueConstants.translate(&"settings.custom_test_scene")
|
||||
$Advanced/RecompileWarning.text = DialogueConstants.translate(&"settings.recompile_warning")
|
||||
missing_translations_button.text = DialogueConstants.translate(&"settings.missing_keys")
|
||||
create_lines_for_response_characters.text = DialogueConstants.translate(&"settings.create_lines_for_responses_with_characters")
|
||||
|
||||
current_tab = 0
|
||||
|
||||
|
||||
func prepare() -> void:
|
||||
_recompile_if_changed_settings = _get_settings_that_require_recompilation()
|
||||
|
||||
test_scene_path_input.placeholder_text = DialogueSettings.get_setting("custom_test_scene_path", _default_test_scene_path)
|
||||
revert_test_scene_button.visible = test_scene_path_input.placeholder_text != _default_test_scene_path
|
||||
revert_test_scene_button.icon = get_theme_icon("RotateLeft", "EditorIcons")
|
||||
revert_test_scene_button.tooltip_text = DialogueConstants.translate(&"settings.revert_to_default_test_scene")
|
||||
load_test_scene_button.icon = get_theme_icon("Load", "EditorIcons")
|
||||
|
||||
var balloon_path: String = DialogueSettings.get_setting("balloon_path", "")
|
||||
if not FileAccess.file_exists(balloon_path):
|
||||
DialogueSettings.set_setting("balloon_path", "")
|
||||
balloon_path = ""
|
||||
balloon_path_input.placeholder_text = balloon_path if balloon_path != "" else DialogueConstants.translate(&"settings.default_balloon_path")
|
||||
revert_balloon_button.visible = balloon_path != ""
|
||||
revert_balloon_button.icon = get_theme_icon("RotateLeft", "EditorIcons")
|
||||
revert_balloon_button.tooltip_text = DialogueConstants.translate(&"settings.revert_to_default_balloon")
|
||||
load_balloon_button.icon = get_theme_icon("Load", "EditorIcons")
|
||||
|
||||
var scale: float = Engine.get_meta("DialogueManagerPlugin").get_editor_interface().get_editor_scale()
|
||||
custom_test_scene_file_dialog.min_size = Vector2(600, 500) * scale
|
||||
|
||||
states_title.add_theme_font_override("font", get_theme_font("bold", "EditorFonts"))
|
||||
|
||||
check_for_updates.set_pressed_no_signal(DialogueSettings.get_user_value("check_for_updates", true))
|
||||
characters_translations_button.set_pressed_no_signal(DialogueSettings.get_setting("export_characters_in_translation", true))
|
||||
wrap_lines_button.set_pressed_no_signal(DialogueSettings.get_setting("wrap_lines", false))
|
||||
include_all_responses_button.set_pressed_no_signal(DialogueSettings.get_setting("include_all_responses", false))
|
||||
ignore_missing_state_values.set_pressed_no_signal(DialogueSettings.get_setting("ignore_missing_state_values", false))
|
||||
new_template_button.set_pressed_no_signal(DialogueSettings.get_setting("new_with_template", true))
|
||||
default_csv_locale.text = DialogueSettings.get_setting("default_csv_locale", "en")
|
||||
|
||||
missing_translations_button.set_pressed_no_signal(DialogueSettings.get_setting("missing_translations_are_errors", false))
|
||||
create_lines_for_response_characters.set_pressed_no_signal(DialogueSettings.get_setting("create_lines_for_responses_with_characters", true))
|
||||
|
||||
include_characters_in_translations.set_pressed_no_signal(DialogueSettings.get_setting("include_character_in_translation_exports", false))
|
||||
include_notes_in_translations.set_pressed_no_signal(DialogueSettings.get_setting("include_notes_in_translation_exports", false))
|
||||
open_in_external_editor_button.set_pressed_no_signal(DialogueSettings.get_user_value("open_in_external_editor", false))
|
||||
|
||||
var editor_settings: EditorSettings = Engine.get_meta("DialogueManagerPlugin").get_editor_interface().get_editor_settings()
|
||||
var external_editor: String = editor_settings.get_setting("text_editor/external/exec_path")
|
||||
var use_external_editor: bool = editor_settings.get_setting("text_editor/external/use_external_editor") and external_editor != ""
|
||||
if not use_external_editor:
|
||||
open_in_external_editor_button.hide()
|
||||
$Advanced/ExternalWarning.hide()
|
||||
$Advanced/ExternalSeparator.hide()
|
||||
|
||||
var project = ConfigFile.new()
|
||||
var err = project.load("res://project.godot")
|
||||
assert(err == OK, "Could not find the project file")
|
||||
|
||||
all_globals.clear()
|
||||
if project.has_section("autoload"):
|
||||
for key in project.get_section_keys("autoload"):
|
||||
if key != "DialogueManager":
|
||||
all_globals[key] = project.get_value("autoload", key)
|
||||
|
||||
enabled_globals = DialogueSettings.get_setting("states", []).duplicate()
|
||||
globals_list.clear()
|
||||
var root = globals_list.create_item()
|
||||
for name in all_globals.keys():
|
||||
var item: TreeItem = globals_list.create_item(root)
|
||||
item.set_cell_mode(0, TreeItem.CELL_MODE_CHECK)
|
||||
item.set_checked(0, name in enabled_globals)
|
||||
item.set_text(0, name)
|
||||
item.add_button(1, get_theme_icon("Edit", "EditorIcons"))
|
||||
item.set_text(2, all_globals.get(name, "").replace("*res://", "res://"))
|
||||
|
||||
globals_list.set_column_expand(0, false)
|
||||
globals_list.set_column_custom_minimum_width(0, 250)
|
||||
globals_list.set_column_expand(1, false)
|
||||
globals_list.set_column_custom_minimum_width(1, 40)
|
||||
globals_list.set_column_titles_visible(true)
|
||||
globals_list.set_column_title(0, DialogueConstants.translate(&"settings.autoload"))
|
||||
globals_list.set_column_title(1, "")
|
||||
globals_list.set_column_title(2, DialogueConstants.translate(&"settings.path"))
|
||||
|
||||
|
||||
func apply_settings_changes() -> void:
|
||||
if _recompile_if_changed_settings != _get_settings_that_require_recompilation():
|
||||
Engine.get_meta("DialogueCache").reimport_files()
|
||||
|
||||
|
||||
func _get_settings_that_require_recompilation() -> Dictionary:
|
||||
return DialogueSettings.get_settings([
|
||||
"missing_translations_are_errors",
|
||||
"create_lines_for_responses_with_characters"
|
||||
])
|
||||
|
||||
|
||||
### Signals
|
||||
|
||||
|
||||
func _on_missing_translations_button_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("missing_translations_are_errors", toggled_on)
|
||||
|
||||
|
||||
func _on_characters_translations_button_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("export_characters_in_translation", toggled_on)
|
||||
|
||||
|
||||
func _on_wrap_lines_button_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("wrap_lines", toggled_on)
|
||||
|
||||
|
||||
func _on_include_all_responses_button_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("include_all_responses", toggled_on)
|
||||
|
||||
|
||||
func _on_globals_list_item_selected() -> void:
|
||||
var item = globals_list.get_selected()
|
||||
var is_checked = not item.is_checked(0)
|
||||
item.set_checked(0, is_checked)
|
||||
|
||||
if is_checked:
|
||||
enabled_globals.append(item.get_text(0))
|
||||
else:
|
||||
enabled_globals.erase(item.get_text(0))
|
||||
|
||||
DialogueSettings.set_setting("states", enabled_globals)
|
||||
|
||||
|
||||
func _on_globals_list_button_clicked(item: TreeItem, column: int, id: int, mouse_button_index: int) -> void:
|
||||
emit_signal("script_button_pressed", item.get_text(2))
|
||||
|
||||
|
||||
func _on_sample_template_toggled(toggled_on):
|
||||
DialogueSettings.set_setting("new_with_template", toggled_on)
|
||||
|
||||
|
||||
func _on_revert_test_scene_pressed() -> void:
|
||||
DialogueSettings.set_setting("custom_test_scene_path", _default_test_scene_path)
|
||||
test_scene_path_input.placeholder_text = _default_test_scene_path
|
||||
revert_test_scene_button.visible = test_scene_path_input.placeholder_text != _default_test_scene_path
|
||||
|
||||
|
||||
func _on_load_test_scene_pressed() -> void:
|
||||
path_target = PathTarget.CustomTestScene
|
||||
custom_test_scene_file_dialog.popup_centered()
|
||||
|
||||
|
||||
func _on_custom_test_scene_file_dialog_file_selected(path: String) -> void:
|
||||
match path_target:
|
||||
PathTarget.CustomTestScene:
|
||||
# Check that the test scene is a subclass of BaseDialogueTestScene
|
||||
var test_scene: PackedScene = load(path)
|
||||
if test_scene and test_scene.instantiate() is BaseDialogueTestScene:
|
||||
DialogueSettings.set_setting("custom_test_scene_path", path)
|
||||
test_scene_path_input.placeholder_text = path
|
||||
revert_test_scene_button.visible = test_scene_path_input.placeholder_text != _default_test_scene_path
|
||||
else:
|
||||
var accept: AcceptDialog = AcceptDialog.new()
|
||||
accept.dialog_text = DialogueConstants.translate(&"settings.invalid_test_scene").format({ path = path })
|
||||
add_child(accept)
|
||||
accept.popup_centered.call_deferred()
|
||||
|
||||
PathTarget.Balloon:
|
||||
DialogueSettings.set_setting("balloon_path", path)
|
||||
balloon_path_input.placeholder_text = path
|
||||
revert_balloon_button.visible = balloon_path_input.placeholder_text != ""
|
||||
|
||||
|
||||
func _on_ignore_missing_state_values_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("ignore_missing_state_values", toggled_on)
|
||||
|
||||
|
||||
func _on_default_csv_locale_text_changed(new_text: String) -> void:
|
||||
DialogueSettings.set_setting("default_csv_locale", new_text)
|
||||
|
||||
|
||||
func _on_revert_balloon_path_pressed() -> void:
|
||||
DialogueSettings.set_setting("balloon_path", "")
|
||||
balloon_path_input.placeholder_text = DialogueConstants.translate(&"settings.default_balloon_path")
|
||||
revert_balloon_button.visible = DialogueSettings.get_setting("balloon_path", "") != ""
|
||||
|
||||
|
||||
func _on_load_balloon_path_pressed() -> void:
|
||||
path_target = PathTarget.Balloon
|
||||
custom_test_scene_file_dialog.popup_centered()
|
||||
|
||||
|
||||
func _on_create_lines_for_response_characters_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("create_lines_for_responses_with_characters", toggled_on)
|
||||
|
||||
|
||||
func _on_open_in_external_editor_button_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_user_value("open_in_external_editor", toggled_on)
|
||||
|
||||
|
||||
func _on_include_characters_in_translations_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("include_character_in_translation_exports", toggled_on)
|
||||
|
||||
|
||||
func _on_include_notes_in_translations_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_setting("include_notes_in_translation_exports", toggled_on)
|
||||
|
||||
|
||||
func _on_keep_up_to_date_toggled(toggled_on: bool) -> void:
|
||||
DialogueSettings.set_user_value("check_for_updates", toggled_on)
|
||||
@@ -1 +0,0 @@
|
||||
uid://md7m321a3hur
|
||||
@@ -1,221 +0,0 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://cpg4lg1r3ff6m"]
|
||||
|
||||
[ext_resource type="Script" path="res://addons/dialogue_manager/views/settings_view.gd" id="1_06uxa"]
|
||||
|
||||
[sub_resource type="Theme" id="Theme_3a8rc"]
|
||||
HSeparator/constants/separation = 20
|
||||
|
||||
[node name="SettingsView" type="TabContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_right = -206.0
|
||||
offset_bottom = -345.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme = SubResource("Theme_3a8rc")
|
||||
current_tab = 2
|
||||
script = ExtResource("1_06uxa")
|
||||
|
||||
[node name="Editor" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="NewTemplateButton" type="CheckBox" parent="Editor"]
|
||||
layout_mode = 2
|
||||
button_pressed = true
|
||||
text = "New dialogue files will start with template text"
|
||||
|
||||
[node name="MissingTranslationsHint" type="Label" parent="Editor"]
|
||||
modulate = Color(1, 1, 1, 0.501961)
|
||||
custom_minimum_size = Vector2(10, 0)
|
||||
layout_mode = 2
|
||||
text = "If you are using static translation keys then having this enabled will help you find any lines that you haven't added a key to yet."
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="CharactersTranslationsButton" type="CheckBox" parent="Editor"]
|
||||
layout_mode = 2
|
||||
button_pressed = true
|
||||
text = "Export character names in translation files"
|
||||
|
||||
[node name="WrapLinesButton" type="CheckBox" parent="Editor"]
|
||||
layout_mode = 2
|
||||
button_pressed = true
|
||||
text = "Wrap long lines"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Editor"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="DefaultCSVLocaleLabel" type="Label" parent="Editor"]
|
||||
layout_mode = 2
|
||||
text = "Default CSV Locale"
|
||||
|
||||
[node name="DefaultCSVLocale" type="LineEdit" parent="Editor"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Runtime" type="VBoxContainer" parent="."]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="IncludeAllResponsesButton" type="CheckBox" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
text = "Include responses with failed conditions"
|
||||
|
||||
[node name="IgnoreMissingStateValues" type="CheckBox" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
text = "Skip over missing state value errors (not recommended)"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CustomBalloonLabel" type="Label" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
text = "Custom balloon to use when calling \"DialogueManager.show_balloon()\""
|
||||
|
||||
[node name="CustomBalloon" type="HBoxContainer" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BalloonPath" type="LineEdit" parent="Runtime/CustomBalloon"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
focus_mode = 0
|
||||
editable = false
|
||||
shortcut_keys_enabled = false
|
||||
middle_mouse_paste_enabled = false
|
||||
|
||||
[node name="RevertBalloonPath" type="Button" parent="Runtime/CustomBalloon"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
tooltip_text = "Revert to default test scene"
|
||||
flat = true
|
||||
|
||||
[node name="LoadBalloonPath" type="Button" parent="Runtime/CustomBalloon"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="StatesTitle" type="Label" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
text = "State Shortcuts"
|
||||
|
||||
[node name="StatesMessage" type="Label" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
text = "If an autoload is enabled here you can refer to its properties and methods without having to use its name."
|
||||
|
||||
[node name="StatesHint" type="Label" parent="Runtime"]
|
||||
modulate = Color(1, 1, 1, 0.501961)
|
||||
custom_minimum_size = Vector2(10, 0)
|
||||
layout_mode = 2
|
||||
text = "ie. Instead of \"SomeState.some_property\" you could just use \"some_property\""
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="GlobalsList" type="Tree" parent="Runtime"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
columns = 3
|
||||
column_titles_visible = true
|
||||
allow_reselect = true
|
||||
hide_folding = true
|
||||
hide_root = true
|
||||
select_mode = 1
|
||||
|
||||
[node name="Advanced" type="VBoxContainer" parent="."]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CheckForUpdates" type="CheckBox" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Check for updates"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="IncludeCharactersInTranslations" type="CheckBox" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Include character names in translation exports"
|
||||
|
||||
[node name="IncludeNotesInTranslations" type="CheckBox" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Include notes (## comments) in translation exports"
|
||||
|
||||
[node name="ExternalSeparator" type="HSeparator" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="OpenInExternalEditorButton" type="CheckBox" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Open dialogue files in external editor"
|
||||
|
||||
[node name="ExternalWarning" type="Label" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Note: Syntax highlighting and detailed error checking are not supported in external editors."
|
||||
|
||||
[node name="HSeparator3" type="HSeparator" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="CustomTestSceneLabel" type="Label" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Custom test scene (must extend BaseDialogueTestScene)"
|
||||
|
||||
[node name="CustomTestScene" type="HBoxContainer" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="TestScenePath" type="LineEdit" parent="Advanced/CustomTestScene"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
focus_mode = 0
|
||||
placeholder_text = "res://addons/dialogue_manager/test_scene.tscn"
|
||||
editable = false
|
||||
shortcut_keys_enabled = false
|
||||
middle_mouse_paste_enabled = false
|
||||
|
||||
[node name="RevertTestScene" type="Button" parent="Advanced/CustomTestScene"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
tooltip_text = "Revert to default test scene"
|
||||
flat = true
|
||||
|
||||
[node name="LoadTestScene" type="Button" parent="Advanced/CustomTestScene"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator4" type="HSeparator" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="RecompileWarning" type="Label" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Changing these settings will force a recompile of all dialogue. Only change them if you know what you are doing."
|
||||
|
||||
[node name="MissingTranslationsButton" type="CheckBox" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Treat missing translation keys as errors"
|
||||
|
||||
[node name="CreateLinesForResponseCharacters" type="CheckBox" parent="Advanced"]
|
||||
layout_mode = 2
|
||||
text = "Create child dialogue line for responses with character names in them"
|
||||
|
||||
[node name="CustomTestSceneFileDialog" type="FileDialog" parent="."]
|
||||
title = "Open a File"
|
||||
ok_button_text = "Open"
|
||||
file_mode = 0
|
||||
filters = PackedStringArray("*.tscn ; Scene")
|
||||
|
||||
[connection signal="toggled" from="Editor/NewTemplateButton" to="." method="_on_sample_template_toggled"]
|
||||
[connection signal="toggled" from="Editor/CharactersTranslationsButton" to="." method="_on_characters_translations_button_toggled"]
|
||||
[connection signal="toggled" from="Editor/WrapLinesButton" to="." method="_on_wrap_lines_button_toggled"]
|
||||
[connection signal="text_changed" from="Editor/DefaultCSVLocale" to="." method="_on_default_csv_locale_text_changed"]
|
||||
[connection signal="toggled" from="Runtime/IncludeAllResponsesButton" to="." method="_on_include_all_responses_button_toggled"]
|
||||
[connection signal="toggled" from="Runtime/IgnoreMissingStateValues" to="." method="_on_ignore_missing_state_values_toggled"]
|
||||
[connection signal="pressed" from="Runtime/CustomBalloon/RevertBalloonPath" to="." method="_on_revert_balloon_path_pressed"]
|
||||
[connection signal="pressed" from="Runtime/CustomBalloon/LoadBalloonPath" to="." method="_on_load_balloon_path_pressed"]
|
||||
[connection signal="button_clicked" from="Runtime/GlobalsList" to="." method="_on_globals_list_button_clicked"]
|
||||
[connection signal="item_selected" from="Runtime/GlobalsList" to="." method="_on_globals_list_item_selected"]
|
||||
[connection signal="toggled" from="Advanced/CheckForUpdates" to="." method="_on_keep_up_to_date_toggled"]
|
||||
[connection signal="toggled" from="Advanced/IncludeCharactersInTranslations" to="." method="_on_include_characters_in_translations_toggled"]
|
||||
[connection signal="toggled" from="Advanced/IncludeNotesInTranslations" to="." method="_on_include_notes_in_translations_toggled"]
|
||||
[connection signal="toggled" from="Advanced/OpenInExternalEditorButton" to="." method="_on_open_in_external_editor_button_toggled"]
|
||||
[connection signal="pressed" from="Advanced/CustomTestScene/RevertTestScene" to="." method="_on_revert_test_scene_pressed"]
|
||||
[connection signal="pressed" from="Advanced/CustomTestScene/LoadTestScene" to="." method="_on_load_test_scene_pressed"]
|
||||
[connection signal="toggled" from="Advanced/MissingTranslationsButton" to="." method="_on_missing_translations_button_toggled"]
|
||||
[connection signal="toggled" from="Advanced/CreateLinesForResponseCharacters" to="." method="_on_create_lines_for_response_characters_toggled"]
|
||||
[connection signal="file_selected" from="CustomTestSceneFileDialog" to="." method="_on_custom_test_scene_file_dialog_file_selected"]
|
||||
Reference in New Issue
Block a user