summaryrefslogtreecommitdiffstats
path: root/editor/plugins/script_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r--editor/plugins/script_editor_plugin.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index d639121ae0..e986510895 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -60,6 +60,7 @@
#include "editor/plugins/shader_editor_plugin.h"
#include "editor/plugins/text_shader_editor.h"
#include "editor/themes/editor_scale.h"
+#include "editor/themes/editor_theme_manager.h"
#include "editor/window_wrapper.h"
#include "scene/main/node.h"
#include "scene/main/window.h"
@@ -696,7 +697,7 @@ void ScriptEditor::_go_to_tab(int p_idx) {
_update_help_overview_visibility();
}
-void ScriptEditor::_add_recent_script(String p_path) {
+void ScriptEditor::_add_recent_script(const String &p_path) {
if (p_path.is_empty()) {
return;
}
@@ -790,7 +791,7 @@ void ScriptEditor::_open_recent_script(int p_idx) {
_show_error_dialog(path);
}
-void ScriptEditor::_show_error_dialog(String p_path) {
+void ScriptEditor::_show_error_dialog(const String &p_path) {
error_dialog->set_text(vformat(TTR("Can't open '%s'. The file could have been moved or deleted."), p_path));
error_dialog->popup_centered();
}
@@ -1000,6 +1001,11 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
}
}
+ if (p_res.is_valid()) {
+ // In case the Resource has built-in scripts.
+ _mark_built_in_scripts_as_saved(p_res->get_path());
+ }
+
_update_script_names();
Ref<Script> scr = p_res;
if (scr.is_valid()) {
@@ -1009,6 +1015,10 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) {
void ScriptEditor::_scene_saved_callback(const String &p_path) {
// If scene was saved, mark all built-in scripts from that scene as saved.
+ _mark_built_in_scripts_as_saved(p_path);
+}
+
+void ScriptEditor::_mark_built_in_scripts_as_saved(const String &p_parent_path) {
for (int i = 0; i < tab_container->get_tab_count(); i++) {
ScriptEditorBase *se = Object::cast_to<ScriptEditorBase>(tab_container->get_tab_control(i));
if (!se) {
@@ -1021,7 +1031,7 @@ void ScriptEditor::_scene_saved_callback(const String &p_path) {
continue; // External script, who cares.
}
- if (edited_res->get_path().get_slice("::", 0) == p_path) {
+ if (edited_res->get_path().get_slice("::", 0) == p_parent_path) {
se->tag_saved_version();
}
@@ -1109,7 +1119,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) {
return need_reload;
}
-void ScriptEditor::_file_dialog_action(String p_file) {
+void ScriptEditor::_file_dialog_action(const String &p_file) {
switch (file_dialog_option) {
case FILE_NEW_TEXTFILE: {
Error err;
@@ -2784,7 +2794,8 @@ void ScriptEditor::_save_layout() {
}
void ScriptEditor::_editor_settings_changed() {
- if (!EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor") &&
+ if (!EditorThemeManager::is_generated_theme_outdated() &&
+ !EditorSettings::get_singleton()->check_changed_settings_in_group("interface/editor") &&
!EditorSettings::get_singleton()->check_changed_settings_in_group("text_editor") &&
!EditorSettings::get_singleton()->check_changed_settings_in_group("docks/filesystem")) {
return;
@@ -3628,7 +3639,7 @@ void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
auto_reload_running_scripts = p_enabled;
}
-void ScriptEditor::_help_search(String p_text) {
+void ScriptEditor::_help_search(const String &p_text) {
help_search_dialog->popup_dialog(p_text);
}
@@ -3679,20 +3690,20 @@ void ScriptEditor::_script_changed() {
NodeDock::get_singleton()->update_lists();
}
-void ScriptEditor::_on_find_in_files_requested(String text) {
+void ScriptEditor::_on_find_in_files_requested(const String &text) {
find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::SEARCH_MODE);
find_in_files_dialog->set_search_text(text);
find_in_files_dialog->popup_centered();
}
-void ScriptEditor::_on_replace_in_files_requested(String text) {
+void ScriptEditor::_on_replace_in_files_requested(const String &text) {
find_in_files_dialog->set_find_in_files_mode(FindInFilesDialog::REPLACE_MODE);
find_in_files_dialog->set_search_text(text);
find_in_files_dialog->set_replace_text("");
find_in_files_dialog->popup_centered();
}
-void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) {
+void ScriptEditor::_on_find_in_files_result_selected(const String &fpath, int line_number, int begin, int end) {
if (ResourceLoader::exists(fpath)) {
Ref<Resource> res = ResourceLoader::load(fpath);
@@ -3814,7 +3825,7 @@ void ScriptEditor::_start_find_in_files(bool with_replace) {
EditorNode::get_bottom_panel()->make_item_visible(find_in_files);
}
-void ScriptEditor::_on_find_in_files_modified_files(PackedStringArray paths) {
+void ScriptEditor::_on_find_in_files_modified_files(const PackedStringArray &paths) {
_test_script_times_on_disk();
_update_modified_scripts_for_external_editor();
}
@@ -4217,7 +4228,7 @@ void ScriptEditorPlugin::_focus_another_editor() {
}
}
-void ScriptEditorPlugin::_save_last_editor(String p_editor) {
+void ScriptEditorPlugin::_save_last_editor(const String &p_editor) {
if (p_editor != get_name()) {
last_editor = p_editor;
}