From d99934197c1a33e925108a303529dfdfc11cf03c Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Mon, 15 Jun 2020 21:14:18 +0100 Subject: [PATCH] Added options in ProjectSettings --- .../tools/extractor_dialog.gd | 10 ++++++++++ addons/zylann.translation_editor/tools/plugin.gd | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/addons/zylann.translation_editor/tools/extractor_dialog.gd b/addons/zylann.translation_editor/tools/extractor_dialog.gd index 220c8d9..047b8cf 100644 --- a/addons/zylann.translation_editor/tools/extractor_dialog.gd +++ b/addons/zylann.translation_editor/tools/extractor_dialog.gd @@ -37,6 +37,16 @@ func _notification(what: int): _results.clear() _results_list.clear() _update_import_button() + + if ProjectSettings.has_setting("translation_editor/string_prefix"): + _prefix_edit.text = ProjectSettings.get_setting("translation_editor/string_prefix") + + if ProjectSettings.has_setting("translation_editor/search_root"): + _root_path_edit.text = ProjectSettings.get_setting("translation_editor/search_root") + + if ProjectSettings.has_setting("translation_editor/ignored_folders"): + _excluded_dirs_edit.text = \ + ProjectSettings.get_setting("translation_editor/ignored_folders") func _update_import_button(): diff --git a/addons/zylann.translation_editor/tools/plugin.gd b/addons/zylann.translation_editor/tools/plugin.gd index f33b246..fb2944f 100644 --- a/addons/zylann.translation_editor/tools/plugin.gd +++ b/addons/zylann.translation_editor/tools/plugin.gd @@ -5,6 +5,12 @@ const TranslationEditor = preload("./translation_editor.gd") const TranslationEditorScene = preload("./translation_editor.tscn") const Logger = preload("./util/logger.gd") +const _default_settings = { + "translation_editor/string_prefix": "", + "translation_editor/search_root": "res://", + "translation_editor/ignored_folders": "addons" +} + var _main_control : TranslationEditor = null var _logger = Logger.get_for(self) @@ -19,6 +25,12 @@ func _enter_tree(): _main_control.configure_for_godot_integration(base_control) _main_control.hide() editor_interface.get_editor_viewport().add_child(_main_control) + + for key in _default_settings: + if not ProjectSettings.has_setting(key): + var v = _default_settings[key] + ProjectSettings.set_setting(key, v) + ProjectSettings.set_initial_value(key, v) func _exit_tree():