diff options
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index edf0b73356..55191f44d4 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -45,7 +45,6 @@ #include "editor/editor_interface.h" #include "editor/editor_node.h" #include "editor/editor_paths.h" -#include "editor/editor_scale.h" #include "editor/editor_script.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" @@ -58,6 +57,7 @@ #include "editor/node_dock.h" #include "editor/plugins/shader_editor_plugin.h" #include "editor/plugins/text_shader_editor.h" +#include "editor/themes/editor_scale.h" #include "editor/window_wrapper.h" #include "scene/main/node.h" #include "scene/main/window.h" @@ -733,7 +733,7 @@ void ScriptEditor::_open_recent_script(int p_idx) { // clear button if (p_idx == recent_scripts->get_item_count() - 1) { EditorSettings::get_singleton()->set_project_metadata("recent_files", "scripts", Array()); - call_deferred(SNAME("_update_recent_scripts")); + callable_mp(this, &ScriptEditor::_update_recent_scripts).call_deferred(); return; } @@ -1001,7 +1001,10 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource> &p_res) { } _update_script_names(); - trigger_live_script_reload(); + Ref<Script> scr = p_res; + if (scr.is_valid()) { + trigger_live_script_reload(scr->get_path()); + } } void ScriptEditor::_scene_saved_callback(const String &p_path) { @@ -1029,16 +1032,33 @@ void ScriptEditor::_scene_saved_callback(const String &p_path) { } } -void ScriptEditor::trigger_live_script_reload() { +void ScriptEditor::trigger_live_script_reload(const String &p_script_path) { + if (!script_paths_to_reload.has(p_script_path)) { + script_paths_to_reload.append(p_script_path); + } + if (!pending_auto_reload && auto_reload_running_scripts) { + callable_mp(this, &ScriptEditor::_live_auto_reload_running_scripts).call_deferred(); + pending_auto_reload = true; + } +} + +void ScriptEditor::trigger_live_script_reload_all() { if (!pending_auto_reload && auto_reload_running_scripts) { call_deferred(SNAME("_live_auto_reload_running_scripts")); pending_auto_reload = true; + reload_all_scripts = true; } } void ScriptEditor::_live_auto_reload_running_scripts() { pending_auto_reload = false; - EditorDebuggerNode::get_singleton()->reload_scripts(); + if (reload_all_scripts) { + EditorDebuggerNode::get_singleton()->reload_all_scripts(); + } else { + EditorDebuggerNode::get_singleton()->reload_scripts(script_paths_to_reload); + } + reload_all_scripts = false; + script_paths_to_reload.clear(); } bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) { @@ -1082,7 +1102,7 @@ bool ScriptEditor::_test_script_times_on_disk(Ref<Resource> p_for_script) { script_editor->reload_scripts(); need_reload = false; } else { - disk_changed->call_deferred(SNAME("popup_centered_ratio"), 0.3); + callable_mp((Window *)disk_changed, &Window::popup_centered_ratio).call_deferred(0.3); } } @@ -2873,7 +2893,7 @@ void ScriptEditor::_tree_changed() { } waiting_update_names = true; - call_deferred(SNAME("_update_script_names")); + callable_mp(this, &ScriptEditor::_update_script_names).call_deferred(); } void ScriptEditor::_split_dragged(float) { @@ -3386,7 +3406,6 @@ void ScriptEditor::_help_class_goto(const String &p_desc) { eh->set_name(cname); tab_container->add_child(eh); - _go_to_tab(tab_container->get_tab_count() - 1); eh->go_to_help(p_desc); eh->connect("go_to_help", callable_mp(this, &ScriptEditor::_help_class_goto)); _add_recent_script(eh->get_class()); @@ -3394,7 +3413,7 @@ void ScriptEditor::_help_class_goto(const String &p_desc) { _update_script_names(); _save_layout(); - call_deferred("_help_tab_goto", cname, p_desc); + callable_mp(this, &ScriptEditor::_help_tab_goto).call_deferred(cname, p_desc); } bool ScriptEditor::_help_tab_goto(const String &p_name, const String &p_desc) { @@ -3792,18 +3811,7 @@ void ScriptEditor::_filter_methods_text_changed(const String &p_newtext) { } void ScriptEditor::_bind_methods() { - ClassDB::bind_method("_close_docs_tab", &ScriptEditor::_close_docs_tab); - ClassDB::bind_method("_close_all_tabs", &ScriptEditor::_close_all_tabs); - ClassDB::bind_method("_close_other_tabs", &ScriptEditor::_close_other_tabs); - ClassDB::bind_method("_goto_script_line2", &ScriptEditor::_goto_script_line2); - ClassDB::bind_method("_copy_script_path", &ScriptEditor::_copy_script_path); - - ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open); ClassDB::bind_method("_help_tab_goto", &ScriptEditor::_help_tab_goto); - ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts); - ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview); - ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); - ClassDB::bind_method("get_current_editor", &ScriptEditor::_get_current_editor); ClassDB::bind_method("get_open_script_editors", &ScriptEditor::_get_open_script_editors); |